Revision | 07a60acffe6c28f1f1d778f7067f19c73f5921f6 (tree) |
---|---|
Zeit | 2015-11-13 07:17:47 |
Autor | MirrgieRiana |
Commiter | MirrgieRiana |
test.libr: add: TokenCallFunction
@@ -329,18 +329,14 @@ | ||
329 | 329 | |
330 | 330 | } |
331 | 331 | |
332 | - public static class Function extends TNodeBase implements ITNodeExpression | |
332 | + public static class TokenCallFunction extends TNodeBase | |
333 | 333 | { |
334 | 334 | |
335 | 335 | public TokenIdentifier identifier; |
336 | 336 | public Operation arguments; |
337 | 337 | |
338 | - public ITNodeExpression call; | |
339 | - | |
340 | - @Override | |
341 | - public boolean validate(ArgumentsValidate argumentsValidate) | |
338 | + public ITNodeExpression[] getExpressions() | |
342 | 339 | { |
343 | - | |
344 | 340 | ITNodeExpression[] expressions; |
345 | 341 | if (arguments == null) { |
346 | 342 | expressions = new ITNodeExpression[0]; |
@@ -352,8 +348,23 @@ | ||
352 | 348 | expressions[i] = expression; |
353 | 349 | } |
354 | 350 | } |
351 | + return expressions; | |
352 | + } | |
355 | 353 | |
356 | - call = new Call(identifier.nodes, identifier.node.string.string, expressions); | |
354 | + } | |
355 | + | |
356 | + public static class Function extends TNodeBase implements ITNodeExpression | |
357 | + { | |
358 | + | |
359 | + public TokenCallFunction token; | |
360 | + | |
361 | + public ITNodeExpression call; | |
362 | + | |
363 | + @Override | |
364 | + public boolean validate(ArgumentsValidate argumentsValidate) | |
365 | + { | |
366 | + ITNodeExpression[] expressions = token.getExpressions(); | |
367 | + call = new Call(token.identifier.nodes, token.identifier.node.string.string, expressions); | |
357 | 368 | |
358 | 369 | if (!call.validate(argumentsValidate)) return false; |
359 | 370 |
@@ -19,16 +19,16 @@ | ||
19 | 19 | TokenInteger := Comments <radix>=IntegerUnsigned 'x' <string>="[0-9a-zA-Z]+" : <TokenInteger>; |
20 | 20 | TokenReal := Comments <node>=Real : <TokenReal>; |
21 | 21 | TokenImaginary := Comments <node>=Imaginary : <TokenImaginary>; |
22 | +TokenCallFunction := <identifier>=TokenIdentifier | |
23 | + Comments '(' | |
24 | + <arguments>=?[Expression, | |
25 | + Comments ',' | |
26 | + ] | |
27 | + Comments ')' : <TokenCallFunction>; | |
22 | 28 | |
23 | 29 | // ■因子 |
24 | 30 | Variable := <identifier>=TokenIdentifier : <Variable>; |
25 | -Function := <identifier>=TokenIdentifier | |
26 | - Comments '(' | |
27 | - <arguments>=?[Expression, | |
28 | - Comments ',' | |
29 | - ] | |
30 | - Comments ')' | |
31 | - : <Function>; | |
31 | +Function := <token>=TokenCallFunction : <Function>; | |
32 | 32 | LiteralNumeric := <token>=( TokenDecimal |
33 | 33 | | TokenInteger |
34 | 34 | | TokenReal |