rockit 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/README +24 -160
  2. data/TODO +17 -17
  3. data/VERSION +1 -1
  4. data/doc/rockit_paper.pdf +0 -0
  5. data/lib/packrat/grammar.rb +139 -84
  6. data/rakefile +27 -9
  7. data/tests/acceptance/packrat/java/atest_java.rb +37 -0
  8. data/tests/acceptance/packrat/java/java.rb +136 -0
  9. data/tests/acceptance/packrat/java/t.rb +10 -0
  10. data/tests/acceptance/packrat/java/todo +10 -0
  11. data/tests/acceptance/packrat/java/xtc.lang.java/Java.rats +446 -0
  12. data/tests/acceptance/packrat/java/xtc.lang.java/JavaConstant.rats +111 -0
  13. data/tests/acceptance/packrat/java/xtc.lang.java/JavaCore.rats +508 -0
  14. data/tests/acceptance/packrat/java/xtc.lang.java/JavaIdentifier.rats +62 -0
  15. data/tests/acceptance/packrat/java/xtc.lang.java/JavaSymbol.rats +38 -0
  16. data/tests/acceptance/packrat/java/xtc.lang.java/JavaTree.rats +40 -0
  17. data/tests/acceptance/packrat/java/xtc.lang.java/JavaType.rats +61 -0
  18. data/tests/acceptance/packrat/java/xtc.lang.java/Spacing.rats +36 -0
  19. data/tests/acceptance/packrat/java/xtc.lang.java/Symbol.rats +77 -0
  20. data/tests/acceptance/packrat/minibasic/README +13 -0
  21. data/tests/acceptance/packrat/minibasic/atest_minibasic.rb +151 -13
  22. data/tests/acceptance/packrat/minibasic/minibasic.rb +94 -76
  23. data/tests/acceptance/packrat/minibasic/mult3.basic +6 -0
  24. data/tests/acceptance/packrat/minibasic/sumeven.basic +19 -0
  25. data/tests/unit/packrat/test_ast.rb +116 -0
  26. data/tests/unit/packrat/test_interpreting_parser.rb +15 -55
  27. metadata +22 -59
  28. data/lib/rockit/prettyprint/box.rb +0 -60
  29. data/lib/rockit/prettyprint/renderer.rb +0 -41
  30. data/lib/rockit/prettyprint/text_renderer.rb +0 -47
  31. data/lib/rockit/tree/base.rb +0 -223
  32. data/lib/rockit/tree/enter_leave_visitor.rb +0 -12
  33. data/lib/rockit/tree/graphviz.rb +0 -69
  34. data/lib/rockit/tree/visitor.rb +0 -12
  35. data/lib/util/array_alternatives.rb +0 -20
  36. data/lib/util/enter_leave_visitor.rb +0 -69
  37. data/lib/util/graphviz_dot.rb +0 -182
  38. data/lib/util/string_location.rb +0 -42
  39. data/lib/util/visitor.rb +0 -49
  40. data/lib/util/visitor_combinators.rb +0 -14
  41. data/tests/acceptance/rockit/dparser/atest_any_operator.rb +0 -33
  42. data/tests/acceptance/rockit/dparser/atest_arithmetic_grammar.rb +0 -30
  43. data/tests/acceptance/rockit/dparser/atest_list_operator.rb +0 -57
  44. data/tests/acceptance/rockit/dparser/atest_mult_operator.rb +0 -60
  45. data/tests/acceptance/rockit/dparser/atest_operator_grammar.rb +0 -61
  46. data/tests/acceptance/rockit/dparser/atest_plus_operator.rb +0 -55
  47. data/tests/acceptance/rockit/dparser/atest_samples_calculator.rb +0 -14
  48. data/tests/acceptance/rockit/dparser/atest_samples_minibasic.rb +0 -20
  49. data/tests/acceptance/rockit/dparser/atest_samples_multifunccalculator.rb +0 -36
  50. data/tests/acceptance/rockit/dparser/atest_simple_grammar.rb +0 -34
  51. data/tests/acceptance/rockit/dparser/atest_speculative_code_action.rb +0 -128
  52. data/tests/acceptance/rockit/dparser/calc_tests_common.rb +0 -103
  53. data/tests/unit/parse/utest_ebnf_grammar.rb +0 -50
  54. data/tests/unit/parse/utest_expand_grammar.rb +0 -23
  55. data/tests/unit/parse/utest_grammar.rb +0 -160
  56. data/tests/unit/rockit/assembler/llvm/utest_instructions.rb +0 -41
  57. data/tests/unit/rockit/assembler/llvm/utest_module.rb +0 -19
  58. data/tests/unit/rockit/prettyprint/utest_box.rb +0 -44
  59. data/tests/unit/rockit/tree/utest_tree_base.rb +0 -301
  60. data/tests/unit/rockit/tree/utest_tree_enter_leave_visitor.rb +0 -69
  61. data/tests/unit/rockit/tree/utest_tree_visitor.rb +0 -63
  62. data/tests/unit/rockit/utest_grammar.rb +0 -145
  63. data/tests/unit/rockit/utest_grammar_symbol.rb +0 -11
  64. data/tests/unit/rockit/utest_maybe_operator.rb +0 -12
  65. data/tests/unit/rockit/utest_regexp_terminal.rb +0 -45
  66. data/tests/unit/rockit/utest_repetition_operators.rb +0 -35
  67. data/tests/unit/rockit/utest_rule.rb +0 -23
  68. data/tests/unit/rockit/utest_string_terminal.rb +0 -40
  69. data/tests/unit/util/utest_array_alternatives.rb +0 -23
  70. data/tests/unit/util/utest_enter_leave_visitor.rb +0 -89
  71. data/tests/unit/util/utest_string_location.rb +0 -42
  72. data/tests/unit/util/utest_visitor.rb +0 -92
  73. data/tests/unit/util/utest_visitor_combinators.rb +0 -64
@@ -0,0 +1,111 @@
1
+ /*
2
+ * xtc - The eXTensible Compiler
3
+ * Copyright (C) 2004-2005 Robert Grimm, New York University
4
+ *
5
+ * This program is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License
7
+ * as published by the Free Software Foundation; either version 2
8
+ * of the License, or (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ */
19
+
20
+ /**
21
+ * Definition of Java constants.
22
+ *
23
+ * @author Stacey Kuznetsov
24
+ * @author Robert Grimm
25
+ * @version $Revision: 1.2 $
26
+ */
27
+ module xtc.lang.JavaConstant(Identifier, Spacing);
28
+
29
+ import Identifier;
30
+ import Spacing;
31
+
32
+ GNode Literal =
33
+ FloatingPointLiteral Spacing
34
+ / IntegerLiteral Spacing
35
+ / CharacterLiteralNode Spacing
36
+ / StringLiteralNode Spacing
37
+ / BooleanLiteral
38
+ / NullLiteral
39
+ ;
40
+
41
+ // ----- Integer literals
42
+
43
+ generic IntegerLiteral =
44
+ <Hex> HexLiteral
45
+ / <Octal> OctalLiteral
46
+ / <Decimal> DecimalLiteral
47
+ ;
48
+
49
+ transient String HexLiteral = HexNumeral IntegerTypeSuffix? ;
50
+ transient String OctalLiteral = OctalNumeral IntegerTypeSuffix? ;
51
+ transient String DecimalLiteral = DecimalNumeral IntegerTypeSuffix? ;
52
+
53
+ transient String DecimalNumeral = '0' / NonZeroDigit Digit* ;
54
+ transient String NonZeroDigit = [1-9] ;
55
+ transient String Digit = [0-9] ;
56
+
57
+ transient String HexNumeral = '0' [xX] HexDigit+ ;
58
+ transient String HexDigit = [0-9a-fA-F] ;
59
+
60
+ transient String OctalNumeral = '0' OctalDigit+ ;
61
+ transient String OctalDigit = [0-7] ;
62
+
63
+ transient String IntegerTypeSuffix = [lL] ;
64
+
65
+ // ----- Floating point literals
66
+
67
+ generic FloatingPointLiteral = FloatingPointString;
68
+
69
+ String FloatingPointString =
70
+ Digit+ '.' Digit* Exponent? FloatTypeSuffix?
71
+ / '.' Digit+ Exponent? FloatTypeSuffix?
72
+ / Digit+ Exponent FloatTypeSuffix?
73
+ / Digit+ Exponent? FloatTypeSuffix
74
+ ;
75
+
76
+ transient String Exponent = [eE] [+\-]? Digit+ ;
77
+ transient String FloatTypeSuffix = [fFdD] ;
78
+
79
+ // ----- Character and string constants
80
+
81
+ generic CharacterLiteralNode = CharacterLiteral;
82
+ generic StringLiteralNode = StringLiteral;
83
+
84
+ String CharacterLiteral = ['] ( EscapeSequence / !['\\] _ ) ['] ;
85
+
86
+ String StringLiteral = ["] ( EscapeSequence / !["\\] _ )* ["] ;
87
+
88
+ transient String EscapeSequence =
89
+ '\\' [btnfr"'\\] / UnicodeEscape / OctalEscape ;
90
+
91
+ transient String OctalEscape =
92
+ '\\' [0-3] OctalDigit OctalDigit
93
+ / '\\' OctalDigit OctalDigit
94
+ / '\\' OctalDigit
95
+ ;
96
+
97
+ transient String UnicodeEscape =
98
+ '\\' 'u' HexDigit HexDigit HexDigit HexDigit ;
99
+
100
+ // ----- Boolean literals
101
+
102
+ generic BooleanLiteral =
103
+ "true":Word
104
+ / "false":Word
105
+ ;
106
+
107
+ // ----- Null literals
108
+
109
+ generic NullLiteral =
110
+ void:"null":Word
111
+ ;
@@ -0,0 +1,508 @@
1
+ /*
2
+ * xtc - The eXTensible Compiler
3
+ * Copyright (C) 2004-2005 Robert Grimm, New York University
4
+ *
5
+ * This program is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU General Public License
7
+ * as published by the Free Software Foundation; either version 2
8
+ * of the License, or (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program; if not, write to the Free Software
17
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+ */
19
+
20
+ /**
21
+ * Definition of Java's hierarchical syntax.
22
+ *
23
+ * @author Stacey Kuznetsov
24
+ * @author Robert Grimm
25
+ * @version $Revision: 1.2 $
26
+ */
27
+ module xtc.lang.JavaCore(Type, Constant, Identifier, Symbol, Spacing);
28
+
29
+ import Type;
30
+ import Constant;
31
+ import Identifier;
32
+ import Symbol;
33
+ import Spacing;
34
+
35
+ // ---------------------------------------------------------- Compilation Unit
36
+
37
+ public transient generic CompilationUnit =
38
+ Spacing
39
+ PackageDeclaration?
40
+ ImportDeclaration*
41
+ Declaration*
42
+ void:'\u001a'?
43
+ EndOfFile
44
+ ;
45
+
46
+ transient generic PackageDeclaration =
47
+ void:"package":Word QualifiedIdentifier void:";":Symbol
48
+ ;
49
+
50
+ transient generic ImportDeclaration =
51
+ void:"import":Word QualifiedIdentifier
52
+ DotStarTail?
53
+ void:";":Symbol
54
+ ;
55
+
56
+ transient generic DotStarTail = void:".":Symbol void:"*":Symbol ;
57
+
58
+ // ---------------------------------------------------------- Declarations
59
+
60
+ generic Modifiers = Modifier* ;
61
+
62
+ String Modifier =
63
+ "public":Word
64
+ / "protected":Word
65
+ / "private":Word
66
+ / "static":Word
67
+ / "abstract":Word
68
+ / "final":Word
69
+ / "native":Word
70
+ / "synchronized":Word
71
+ / "transient":Word
72
+ / "volatile":Word
73
+ / "strictfp":Word
74
+ ;
75
+
76
+ transient generic FormalParameter =
77
+ FinalClause? Type Identifier Dimensions?
78
+ ;
79
+
80
+ generic FinalClause = void:"final":Word ;
81
+
82
+ generic FormalParameters =
83
+ void:"(":Symbol FormalParameter ( void:",":Symbol FormalParameter )* void:")":Symbol
84
+ / void:"(":Symbol void:")":Symbol
85
+ ;
86
+
87
+ transient generic Declarator =
88
+ Identifier Dimensions? ( void:"=":Symbol VariableInitializer )?
89
+ ;
90
+
91
+ generic Declarators =
92
+ Declarator ( void:",":Symbol Declarator )*
93
+ ;
94
+
95
+ transient generic ClassBody =
96
+ void:"{":Symbol Declaration* void:"}":Symbol
97
+ ;
98
+
99
+ transient GNode Declaration =
100
+ FieldDeclaration
101
+ / MethodDeclaration
102
+ / ConstructorDeclaration
103
+ / ClassDeclaration
104
+ / InterfaceDeclaration
105
+ / BlockDeclaration
106
+ ;
107
+
108
+ generic FieldDeclaration =
109
+ Modifiers Type Declarators void:";":Symbol
110
+ ;
111
+
112
+ generic MethodDeclaration =
113
+ Modifiers
114
+ ResultType Identifier FormalParameters Dimensions? OptionalThrowsClause?
115
+ ( Block / void:";":Symbol )
116
+ ;
117
+
118
+ generic ConstructorDeclaration =
119
+ Modifiers Identifier FormalParameters OptionalThrowsClause? Block
120
+ ;
121
+
122
+ generic ClassDeclaration =
123
+ Modifiers void:"class":Word Identifier
124
+ Extension?
125
+ Implementation?
126
+ ClassBody
127
+ ;
128
+
129
+ generic InterfaceDeclaration =
130
+ Modifiers void:"interface":Word Identifier
131
+ Extension?
132
+ ClassBody
133
+ ;
134
+
135
+ generic BlockDeclaration =
136
+ (StaticClause)?
137
+ Block
138
+ ;
139
+
140
+ generic StaticClause = void:"static":Word ;
141
+
142
+ generic OptionalThrowsClause =
143
+ void:"throws":Word QualifiedIdentifier ( void:",":Symbol QualifiedIdentifier )*
144
+ ;
145
+
146
+ generic Extension = void:"extends":Word Type ( void:",":Symbol Type )*
147
+ / void:"extends":Word Type;
148
+
149
+ generic Implementation = void:"implements":Word Type ( void:",":Symbol Type )*;
150
+
151
+ // ---------------------------------------------------------- Statements
152
+
153
+ generic Block =
154
+ void:"{":Symbol BlockStatement* void:"}":Symbol
155
+ ;
156
+
157
+ transient GNode BlockStatement =
158
+ Declaration
159
+ / Statement
160
+ ;
161
+
162
+ transient GNode Statement =
163
+ Block
164
+ / ConditionalStatement
165
+ / ForStatement
166
+ / WhileStatement
167
+ / DoWhileStatement
168
+ / TryStatement
169
+ / SwitchStatement
170
+ / SynchronizedStatement
171
+ / ReturnStatement
172
+ / ThrowStatement
173
+ / BreakStatement
174
+ / ContinueStatement
175
+ / LabeledStatement
176
+ / ExpressionStatement
177
+ / VoidStatement
178
+ ;
179
+
180
+ GNode ConditionalStatement =
181
+ <IfElse> IfElseStatement
182
+ / <If> IfStatement
183
+ ;
184
+
185
+ generic IfElseStatement =
186
+ void:"if":Word ParExpression
187
+ Statement void:"else":Word Statement
188
+ ;
189
+
190
+ generic IfStatement =
191
+ void:"if":Word ParExpression
192
+ Statement
193
+ ;
194
+
195
+ generic ForStatement= void:"for":Word void:"(":Symbol
196
+ ForInit
197
+ Expression? void:";":Symbol
198
+ ExpressionList? void:")":Symbol Statement
199
+ ;
200
+
201
+ generic ForInit =
202
+ FinalClause? Type Declarators void:";":Symbol
203
+ / ExpressionList void:";":Symbol
204
+ / void:";":Symbol
205
+ ;
206
+
207
+ generic WhileStatement = void:"while":Word ParExpression Statement;
208
+
209
+ generic DoWhileStatement = void:"do":Word Statement void:"while":Word ParExpression void:";":Symbol;
210
+
211
+ generic ParExpression = void:"(":Symbol Expression void:")":Symbol ;
212
+
213
+ GNode TryStatement =
214
+ <Finally> TryCatchFinallyStatement
215
+ / <NoFinally> TryCatchStatement
216
+ ;
217
+
218
+ generic TryCatchFinallyStatement =
219
+ void: "try":Word
220
+ Block
221
+ CatchClause*
222
+ void:"finally":Word
223
+ Block
224
+ ;
225
+
226
+ generic TryCatchStatement = void:"try":Word Block CatchClause+ ;
227
+
228
+ generic CatchClause =
229
+ void:"catch":Word void:"(":Symbol FormalParameter void:")":Symbol Block
230
+ ;
231
+
232
+ generic SwitchStatement =
233
+ void:"switch":Word ParExpression
234
+ void:"{":Symbol SwitchGroup* void:"}":Symbol
235
+ ;
236
+
237
+ GNode SwitchGroup =
238
+ <Case> CaseExpression
239
+ / <Default> DefaultExpression
240
+ ;
241
+
242
+ generic CaseExpression =
243
+ void:"case":Word Expression void:":":Symbol BlockStatement*
244
+ ;
245
+
246
+ generic DefaultExpression =
247
+ void:"default":Word void:":":Symbol BlockStatement*
248
+ ;
249
+
250
+ generic SynchronizedStatement =
251
+ void:"synchronized":Word ParExpression Block ;
252
+
253
+ generic ReturnStatement =
254
+ void:"return":Word Expression? void:";":Symbol ;
255
+
256
+ generic ThrowStatement =
257
+ void:"throw":Word Expression void:";":Symbol ;
258
+
259
+ generic BreakStatement =
260
+ void:"break":Word Identifier? void:";":Symbol ;
261
+
262
+ generic ContinueStatement =
263
+ void:"continue":Word Identifier? void:";":Symbol ;
264
+
265
+ generic LabeledStatement =
266
+ Identifier void:":":Symbol Statement ;
267
+
268
+ generic ExpressionStatement =
269
+ Expression void:";":Symbol;
270
+
271
+ generic VoidStatement =
272
+ void:";":Symbol ;
273
+
274
+ // ---------------------------------------------------------- Expressions
275
+
276
+ transient generic ExpressionList =
277
+ Expression ( void:",":Symbol Expression )*
278
+ ;
279
+
280
+ generic Expression =
281
+ <Assignment> ConditionalExpression AssignmentOperator Expression
282
+ / <Base> yyValue: ConditionalExpression
283
+ ;
284
+
285
+ String AssignmentOperator =
286
+ <Equal> "=":Symbol
287
+ / <PlusEqual> "+=":Symbol
288
+ / <MinusEqual> "-=":Symbol
289
+ / <StarEqual> "*=":Symbol
290
+ / <SlashEqual> "/=":Symbol
291
+ / <AmpersandEqual> "&=":Symbol
292
+ / <BarEqual> "|=":Symbol
293
+ / <CaretEqual> "^=":Symbol
294
+ / <PercentEqual> "%=":Symbol
295
+ / <DoubleLessEqual> "<<=":Symbol
296
+ / <DoubleGreaterEqual> ">>=":Symbol
297
+ / <TripleGreaterEqual> ">>>=":Symbol
298
+ ;
299
+
300
+ generic ConditionalExpression =
301
+ <Conditional> ConditionalOrExpression void:"?":Symbol Expression
302
+ void:":":Symbol ConditionalExpression
303
+ / <Base> yyValue:ConditionalOrExpression
304
+ ;
305
+
306
+ generic ConditionalOrExpression =
307
+ <Or> ConditionalOrExpression void:"||":Symbol ConditionalAndExpression
308
+ / <Base> yyValue:ConditionalAndExpression
309
+ ;
310
+
311
+ transient generic ConditionalAndExpression =
312
+ <And> ConditionalAndExpression void:"&&":Symbol InclusiveOrExpression
313
+ / <Base> yyValue:InclusiveOrExpression
314
+ ;
315
+
316
+ transient generic InclusiveOrExpression =
317
+ <Or> InclusiveOrExpression void:"|":Symbol ExclusiveOrExpression
318
+ / <Base> yyValue:ExclusiveOrExpression
319
+ ;
320
+
321
+ transient generic ExclusiveOrExpression =
322
+ <Xor> ExclusiveOrExpression void:"^":Symbol AndExpression
323
+ / <Base> yyValue:AndExpression
324
+ ;
325
+
326
+ transient generic AndExpression =
327
+ <And> AndExpression void:"&":Symbol EqualityExpression
328
+ / <Base> yyValue:EqualityExpression
329
+ ;
330
+
331
+ transient generic EqualityExpression =
332
+ <Recursion> EqualityExpression EqualityOperator InstanceOfExpression
333
+ / <Base> yyValue:InstanceOfExpression
334
+ ;
335
+
336
+ String EqualityOperator =
337
+ <Equal> "==":Symbol
338
+ / <NotEqual> "!=":Symbol
339
+ ;
340
+
341
+
342
+ transient generic InstanceOfExpression =
343
+ <Instanceof> RelationalExpression void:"instanceof":Word Type
344
+ / <Base> yyValue:RelationalExpression
345
+ ;
346
+
347
+ generic RelationalExpression =
348
+ <Recursion> RelationalExpression RelationalOperator ShiftExpression
349
+ / <Base> yyValue:ShiftExpression
350
+ ;
351
+
352
+ String RelationalOperator =
353
+ <Less> "<":Symbol
354
+ / <Greater> ">":Symbol
355
+ / <LessEqual> "<=":Symbol
356
+ / <GreaterEqual> ">=":Symbol
357
+ ;
358
+
359
+
360
+ transient generic ShiftExpression =
361
+ <Recursion> ShiftExpression ShiftOperator AdditiveExpression
362
+ / <Base> yyValue:AdditiveExpression
363
+ ;
364
+
365
+ String ShiftOperator =
366
+ <Left> "<<":Symbol
367
+ / <Right> ">>":Symbol
368
+ / <UnsignedRight> ">>>":Symbol
369
+ ;
370
+
371
+ transient generic AdditiveExpression =
372
+ <Recursion> AdditiveExpression AdditiveOperator MultiplicativeExpression
373
+ / <Base> yyValue:MultiplicativeExpression
374
+ ;
375
+
376
+ String AdditiveOperator =
377
+ <Plus> "+":Symbol
378
+ / <Minus> "-":Symbol
379
+ ;
380
+
381
+ transient generic MultiplicativeExpression =
382
+ <Times> MultiplicativeExpression MultiplicativeOperator UnaryExpression
383
+ / <Base> yyValue:UnaryExpression
384
+ ;
385
+
386
+ String MultiplicativeOperator =
387
+ <Times> "*":Symbol
388
+ / <Over> "/":Symbol
389
+ / <Modulo> "%":Symbol
390
+ ;
391
+
392
+
393
+ transient generic UnaryExpression =
394
+ <Plus> "+":Symbol UnaryExpression
395
+ / <Minus> "-":Symbol UnaryExpression
396
+ / <Increment> "++":Symbol UnaryExpression
397
+ / <Decrement> "--":Symbol UnaryExpression
398
+ / <Base> yyValue:UnaryExpressionNotPlusMinus
399
+ ;
400
+
401
+ transient GNode UnaryExpressionNotPlusMinus =
402
+ <BitwiseNot> BitwiseNegationExpression
403
+ / <LogicalNot> LogicalNegationExpression
404
+ / <BasicCast> BasicCastExpression
405
+ / <Cast> CastExpression
406
+ / <Base> PostfixExpression
407
+ ;
408
+
409
+ transient generic BitwiseNegationExpression =
410
+ void:"~":Symbol UnaryExpression
411
+ ;
412
+
413
+ transient generic LogicalNegationExpression =
414
+ void:"!":Symbol UnaryExpression
415
+ ;
416
+
417
+ transient generic BasicCastExpression =
418
+ void:"(":Symbol BasicType Dimensions? void:")":Symbol UnaryExpression
419
+ ;
420
+
421
+ transient generic CastExpression =
422
+ void:"(":Symbol Type void:")":Symbol UnaryExpressionNotPlusMinus
423
+ ;
424
+
425
+ generic PostfixExpression =
426
+ PrimaryExpression PostfixExpressionTail*
427
+ ;
428
+
429
+ GNode PostfixExpressionTail =
430
+ SubscriptExpression
431
+ / Arguments
432
+ / PrimaryExpressionTail
433
+ / ClassTail
434
+ / PostincrementExpression
435
+ / PostdecrementExpression
436
+ ;
437
+
438
+ generic SubscriptExpression =
439
+ void:"[":Symbol Expression? void:"]":Symbol
440
+ ;
441
+
442
+ generic PrimaryExpressionTail =
443
+ void:".":Symbol PrimaryExpression
444
+ ;
445
+
446
+ generic ClassTail =
447
+ void:".":Symbol void:"class":Word
448
+ ;
449
+
450
+ generic PostincrementExpression = void:"++":Symbol ;
451
+
452
+ generic PostdecrementExpression = void:"--":Symbol ;
453
+
454
+ transient GNode PrimaryExpression =
455
+ <Literal> Literal
456
+ / <PrimaryIdentifier> PrimaryIdentifier
457
+ / <NestedExpression> NestedExpression
458
+ / <ThisExpression> ThisExpression
459
+ / <SuperExpression> SuperExpression
460
+ / <NewExpression> NewExpression
461
+ / <VoidClassExpression> VoidClassExpression
462
+ ;
463
+
464
+ transient generic PrimaryIdentifier = Identifier ;
465
+
466
+ transient generic NestedExpression =
467
+ void:"(":Symbol Expression void:")":Symbol
468
+ ;
469
+
470
+ transient generic ThisExpression = void:"this":Word ;
471
+
472
+ transient generic SuperExpression = void:"super":Word ;
473
+
474
+ transient generic NewExpression =
475
+ <Class> void:"new":Word QualifiedIdentifier Arguments ClassBody?
476
+ / <Array> void:"new":Word TypeName DimensionExpressions Dimensions?
477
+ / <InitArray> void:"new":Word TypeName Dimensions? ArrayInitializer
478
+ ;
479
+
480
+ transient generic VoidClassExpression =
481
+ void:"void":Word void:".":Symbol void:"class":Word
482
+ ;
483
+
484
+ transient generic DimensionExpressions = DimensionExpression+;
485
+
486
+ transient generic DimensionExpression =
487
+ void:"[":Symbol Expression void:"]":Symbol
488
+ ;
489
+
490
+ transient generic Arguments =
491
+ <Arguments> void:"(":Symbol ExpressionList void:")":Symbol
492
+ / <NoArguments> void:"(":Symbol void:")":Symbol
493
+ ;
494
+
495
+ transient generic ArrayInitializer =
496
+ void:"{":Symbol
497
+ ( VariableInitializer void:",":Symbol )*
498
+ void:"}":Symbol
499
+ / void:"{":Symbol
500
+ VariableInitializer
501
+ ( void:",":Symbol VariableInitializer )*
502
+ void:"}":Symbol
503
+ ;
504
+
505
+ GNode VariableInitializer =
506
+ <Array> ArrayInitializer
507
+ / <Expression> Expression
508
+ ;