-
Notifications
You must be signed in to change notification settings - Fork 4
/
jdibug-java-expr.wy
847 lines (719 loc) · 24.3 KB
/
jdibug-java-expr.wy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
;;; wisent-java.wy -- LALR grammar for Java
;;
;; Copyright (C) 2002, 2003, 2004 David Ponce
;;
;; Author: David Ponce <[email protected]>
;; Maintainer: Troy Daniels <[email protected]>
;; Created: 19 Feb 2002
;; Keywords: syntax
;; X-RCS: $Id: wisent-java.wy,v 1.21 2004/06/15 18:20:39 ponced Exp $
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.
;;
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;
;;; Commentary:
;;
;; This grammar fully parses Java 1.5 expression syntax.
;;
;; It is based on wisent-java.wy by David Ponce in cedet/semantic. It
;; has been reduced to remove items not required for parsing
;; expressions.
;;
;;
;; %{
;; ;; Stack of enum names in scope.
;; (defvar wisent-java-wy--enums nil)
;; }
%package jdibug-java-expr-wy
;; %languagemode java-mode
;; The default goal. Other goals are only for debugging.
%start expression
%start dot_expression
;; -----------------------------
;; Block & Parenthesis terminals
;; -----------------------------
%type <block> ;;syntax "\\s(\\|\\s)" matchdatatype block
%token <block> PAREN_BLOCK "(LPAREN RPAREN)"
;; %token <block> BRACE_BLOCK "(LBRACE RBRACE)"
%token <block> BRACK_BLOCK "(LBRACK RBRACK)"
%token <open-paren> LPAREN "("
%token <close-paren> RPAREN ")"
;; %token <open-paren> LBRACE "{"
;; %token <close-paren> RBRACE "}"
%token <open-paren> LBRACK "["
%token <close-paren> RBRACK "]"
;; ------------------
;; Operator terminals
;; ------------------
%type <punctuation> ;;syntax "\\(\\s.\\|\\s$\\|\\s'\\)+" matchdatatype string
%token <punctuation> NOT "!"
%token <punctuation> NOTEQ "!="
%token <punctuation> MOD "%"
;; %token <punctuation> MODEQ "%="
%token <punctuation> AND "&"
%token <punctuation> ANDAND "&&"
;; %token <punctuation> ANDEQ "&="
%token <punctuation> MULT "*"
;; %token <punctuation> MULTEQ "*="
%token <punctuation> PLUS "+"
;; %token <punctuation> PLUSPLUS "++"
;; %token <punctuation> PLUSEQ "+="
%token <punctuation> COMMA ","
%token <punctuation> MINUS "-"
;; %token <punctuation> MINUSMINUS "--"
;; %token <punctuation> MINUSEQ "-="
%token <punctuation> DOT "."
%token <punctuation> DIV "/"
;; %token <punctuation> DIVEQ "/="
%token <punctuation> COLON ":"
;; %token <punctuation> SEMICOLON ";"
%token <punctuation> LT "<"
%token <punctuation> LSHIFT "<<"
;; %token <punctuation> LSHIFTEQ "<<="
%token <punctuation> LTEQ "<="
;; %token <punctuation> EQ "="
%token <punctuation> EQEQ "=="
%token <punctuation> GT ">"
%token <punctuation> GTEQ ">="
%token <punctuation> RSHIFT ">>"
;; %token <punctuation> RSHIFTEQ ">>="
%token <punctuation> URSHIFT ">>>"
;; %token <punctuation> URSHIFTEQ ">>>="
%token <punctuation> QUESTION "?"
%token <punctuation> XOR "^"
;; %token <punctuation> XOREQ "^="
%token <punctuation> OR "|"
;; %token <punctuation> OREQ "|="
%token <punctuation> OROR "||"
%token <punctuation> COMP "~"
;; %token <punctuation> ELLIPSIS "..."
;; %token <punctuation> AT "@"
;; -----------------
;; Literal terminals
;; -----------------
%type <symbol> ;;syntax "\\(\\sw\\|\\s_\\)+"
%token <symbol> NULL_LITERAL "\\`null\\'"
%token <symbol> BOOLEAN_LITERAL "\\`false\\'"
%token <symbol> BOOLEAN_LITERAL "\\`true\\'"
%token <symbol> IDENTIFIER
%type <string> ;;syntax "\\s\"" matchdatatype sexp
%token <string> STRING_LITERAL
%type <number> ;;syntax semantic-lex-number-expression
%token <number> NUMBER_LITERAL
;; -----------------
;; Keyword terminals
;; -----------------
;; Generate a keyword analyzer
%type <keyword> ;;syntax "\\(\\sw\\|\\s_\\)+" matchdatatype keyword
%keyword BOOLEAN "boolean"
%put BOOLEAN summary
"Primitive logical quantity type (true or false)"
%keyword BYTE "byte"
%put BYTE summary
"Integral primitive type (-128 to 127)"
%keyword CHAR "char"
%put CHAR summary
"Integral primitive type ('\u0000' to '\uffff') (0 to 65535)"
%keyword CLASS "class"
%put CLASS summary
"Class declaration: class <name>"
%keyword DOUBLE "double"
%put DOUBLE summary
"Primitive floating-point type (double-precision 64-bit IEEE 754)"
%keyword FLOAT "float"
%put FLOAT summary
"Primitive floating-point type (single-precision 32-bit IEEE 754)"
%keyword INSTANCEOF "instanceof"
%keyword INT "int"
%put INT summary
"Integral primitive type (-2147483648 to 2147483647)"
%keyword LONG "long"
%put LONG summary
"Integral primitive type (-9223372036854775808 to 9223372036854775807)"
;; %keyword NEW "new"
%keyword SHORT "short"
%put SHORT summary
"Integral primitive type (-32768 to 32767)"
%keyword SUPER "super"
%keyword THIS "this"
%keyword VOID "void"
%put VOID summary
"Method return type: void <name> ..."
%%
;; ------------
;; LALR Grammar
;; ------------
;; goal
;; : expression
;; ;
;;; 19.3) Lexical Structure.
;;
literal
: NUMBER_LITERAL
(TAG $1 'constant :type 'number)
| BOOLEAN_LITERAL
(TAG $1 'constant :type 'boolean)
| STRING_LITERAL
;; Strip off the quotes
(let (bare-string)
(cond
((string-match "^\"\\(.*\\)\"$" $1)
(TAG (match-string 1 $1) 'constant :type 'string))
;; Multiple characters are allowed to handle characters like \n
;; and unicode
((string-match "^'\\(.*\\)'$" $1)
(TAG (match-string 1 $1) 'constant :type 'char))
(t (error "Unable to understand string format of %s" $1))))
| NULL_LITERAL
(TAG $1 'constant :type 'null)
;
;;; 19.4) Types, Values, and Variables
;;
;; type
;; : primitive_type
;; | reference_type
;; ;
primitive_type
: numeric_type
| BOOLEAN
(TYPE-TAG $1 $1 nil nil)
;
numeric_type
: integral_type
| floating_point_type
;
integral_type
: BYTE
(TYPE-TAG $1 $1 nil nil)
| SHORT
(TYPE-TAG $1 $1 nil nil)
| INT
(TYPE-TAG $1 $1 nil nil)
| LONG
(TYPE-TAG $1 $1 nil nil)
| CHAR
(TYPE-TAG $1 $1 nil nil)
;
floating_point_type
: FLOAT
(TYPE-TAG $1 $1 nil nil)
| DOUBLE
(TYPE-TAG $1 $1 nil nil)
;
reference_type
: class_or_interface_type
;; Must check whether this is a class name or a type variable.
| array_type
;
class_or_interface
: name_with_opt_package
;; | class_or_interface LT type_argument_list_1 DOT name
;; (concat $1 $2 $3 $4 $5)
;
class_or_interface_type
: class_or_interface
;; | class_or_interface LT type_argument_list_1
;; (concat $1 $2 $3)
;
array_type
: primitive_type dims
(concat $1 $2)
| name_with_opt_package dims
(concat $1 $2)
;; | class_or_interface LT type_argument_list_1 DOT name dims
;; (concat $1 $2 $3 $4 $5 $6)
;; | class_or_interface LT type_argument_list_1 dims
;; (concat $1 $2 $3 $4)
;
;;; 19.5) Names
;;
;; This rule is only used in places where we expect something like
;; java.lang.String or Set.class. It is not used for variable
;; references.
name_with_opt_package
: simple_name
| qualified_name
;
simple_name
: IDENTIFIER
(TAG $1 'identifier)
;
qualified_name
: name_with_opt_package DOT simple_name
(FUNCTION-TAG 'dot "dot" `(,$1 ,$3))
;
;;; 19.12) Expressions
;;
primary
;; : primary_no_new_array
;; ;; | array_creation_init
;; ;; | array_creation_uninit
;; ;
;; primary_no_new_array
: literal
| THIS
(TAG 'this 'identifier)
;; TODO: figure out how to add this in without conflicts
;; | LPAREN name RPAREN
;; | LPAREN expression_no_name RPAREN
| LPAREN expression RPAREN
(progn $2)
;; | class_instance_creation_expression
;; | field_access
;; | method_invocation
;; | field_access_or_method_invocation
;; | array_access
;; | name_with_opt_package DOT THIS
| dot_expression
| simple_name
| VOID DOT CLASS
(TAG 'void 'class)
;; "Type DOT CLASS", but expanded.
| primitive_type DOT CLASS
(TAG $1 'class)
| primitive_type dims DOT CLASS
(TAG (FUNCTION-TAG 'dims "dims" (list $1 $2)) 'class)
;; TODO: add these back in. They probably need to be merged into the rule that holds field access and method invocations.
;; | name_with_opt_package DOT CLASS
;; | name_with_opt_package dims DOT CLASS
;; The following two productions are part of the expansion of `type
;; DOT CLASS' but are not actually allowed, as they involve params.
;; | class_or_interface type_arguments DOT name dims DOT CLASS
;; | class_or_interface LT type_argument_list_1 dims DOT CLASS
;
;; class_instance_creation_expression
;; : NEW class_or_interface_type LPAREN argument_list_opt RPAREN ;; class_body_opt
;; ;; | NEW type_arguments class_or_interface_type LPAREN argument_list_opt RPAREN ;; class_body_opt
;; | primary DOT NEW ;; type_arguments_opt
;; IDENTIFIER ;; type_arguments_opt
;; LPAREN argument_list_opt RPAREN ;; class_body_opt
;; | name DOT NEW ;; type_arguments_opt
;; IDENTIFIER ;; type_arguments_opt
;; LPAREN argument_list_opt RPAREN ;; class_body_opt
;; ;
argument_list_opt
: ;;EMPTY
| argument_list
;
argument_list
: expression
(list $1)
| argument_list COMMA expression
(append $1 (list $3))
;
;; array_creation_uninit
;; : NEW primitive_type dim_exprs dims_opt
;; | NEW class_or_interface_type dim_exprs dims_opt
;; ;
;; array_creation_init
;; : NEW primitive_type dims array_initializer
;; | NEW class_or_interface_type dims array_initializer
;; ;
;; dim_exprs
;; : dim_expr
;; | dim_exprs dim_expr
;; ;
;; dim_expr
;; : LBRACK expression RBRACK
;; | LBRACK error
;; ;; On error, skip current block and try to continue.
;; (wisent-skip-block)
;; ;
dims_opt
: ;;EMPTY
(progn "")
| dims
;
dims
: LBRACK RBRACK
(concat $1 $2)
| dims LBRACK RBRACK
(concat $1 $2 $3)
;
;; field_access
;; : primary DOT IDENTIFIER
;; | SUPER DOT IDENTIFIER
;; | name DOT SUPER DOT IDENTIFIER
;; ;
;; method_invocation
;; : name LPAREN argument_list_opt RPAREN
;; ;; It looks that this production should be removed
;; ;; from the grammar:
;; ;; | type_arguments name LPAREN argument_list_opt RPAREN
;; ;; It introduces ambiguities in the grammar for expressions like:
;; ;; `A((B)<C,D>E());', which could be either an invocation on E or two
;; ;; boolean comparisons.
;; | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN
;; (FUNCTION-TAG $3 $3 $5 :this $1)
;; ;; | primary DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN
;; ;; | name DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN
;; | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
;; ;; | SUPER DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN
;; | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
;; ;; | name DOT SUPER DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN
;; ;
;; Field access and method invocation both start with IDENTIFIER (DOT
;; IDENTIFIER)* but the trees are build differently. This is similar
;; to the standard if-then-else ambiguity. It is resolved with a
;; trailing element that is eithe empty of the full argument list. To
;; avoid conflicts, everything else that also might be IDENTIFIER DOT
;; IDENTIFIER has to fall in the same rule.
dot_expression
:
;; primary DOT IDENTIFIER paren_arg_list_opt
;; (FUNCTION-TAG $3 $3 (cdr $4) :this $1)
primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN
(FUNCTION-TAG $3 $3 $5 :this $1)
| primary DOT simple_name
(FUNCTION-TAG 'dot "dot"
(list $1 $3)) ;; (TAG $3 'identifier)))
;; primary DOT IDENTIFIER paren_arg_list_opt
;; (if $4
;; (FUNCTION-TAG $3 $3 (cdr $4) :this $1)
;; (FUNCTION-TAG 'dot "dot" `(,$1 ,$3)))
| primary DOT CLASS
(FUNCTION-TAG 'class "class" (list $1))
| array_access
;; | name_with_opt_package DOT THIS
;; TODO: add these back in
;; | SUPER DOT IDENTIFIER paren_arg_list_opt
;; | name DOT SUPER DOT IDENTIFIER paren_arg_list_opt
;; | name LPAREN argument_list_opt RPAREN
;
array_access
: primary LBRACK expression RBRACK
(FUNCTION-TAG 'array "array" (list $1 $3))
;; Does changing the first term in the previous option from name to primary mean that we do not need the following term?
;; | primary_no_new_array LBRACK expression RBRACK
;; (FUNCTION-TAG 'array "array" (list $1 $3))
;; | array_creation_init LBRACK expression RBRACK
;
postfix_expression
: primary
;; | simple_name
;; | name ;; changed to simple name, since field_access_or_method_invocation covers qualified_name
;; | postincrement_expression
;; | postdecrement_expression
;
unary_expression
:
;; preincrement_expression
;; | predecrement_expression |
PLUS unary_expression
(progn $2)
| MINUS unary_expression
(FUNCTION-TAG 'unary-minus "negation" (list $2))
| unary_expression_not_plus_minus
;
unary_expression_not_plus_minus
: postfix_expression
| COMP unary_expression
(FUNCTION-TAG 'complement "complement" (list $2))
| NOT unary_expression
(FUNCTION-TAG 'not "negation" (list $2))
;; | cast_expression
;
;; cast_expression
;; : LPAREN type RPAREN unary_expression_not_plus_minus
;; Introduces ambiguities between parenthesized LT relational
;; operations and type casts, like in `LPAREN name LT name ...'.
;; The following `cast_expression' production solves that.
cast_expression
: LPAREN primitive_type dims_opt RPAREN unary_expression
(FUNCTION-TAG 'cast "cast" (list $2 $4))
| LPAREN name_with_opt_package RPAREN unary_expression_not_plus_minus
(FUNCTION-TAG 'cast "cast" (list $2 $4))
| LPAREN name_with_opt_package dims RPAREN unary_expression_not_plus_minus
(FUNCTION-TAG 'cast-array "cast" (list $2 $5) :dims $3)
;; | LPAREN name LT type_argument_list_1 dims_opt RPAREN
;; unary_expression_not_plus_minus
;; | LPAREN name LT type_argument_list_1 DOT
;; class_or_interface_type dims_opt RPAREN
;; unary_expression_not_plus_minus
;
multiplicative_expression
: unary_expression
| multiplicative_expression MULT unary_expression
(FUNCTION-TAG 'mult "multiplicative_expression type" (list $1 $3))
| multiplicative_expression DIV unary_expression
(FUNCTION-TAG 'div "multiplicative_expression type" (list $1 $3))
| multiplicative_expression MOD unary_expression
(FUNCTION-TAG 'mod "multiplicative_expression type" (list $1 $3))
;
additive_expression
: multiplicative_expression
| additive_expression PLUS multiplicative_expression
(FUNCTION-TAG 'plus "additive_expression type" (list $1 $3))
| additive_expression MINUS multiplicative_expression
(FUNCTION-TAG 'minus "additive_expression type" (list $1 $3))
;
shift_expression
: additive_expression
| shift_expression LSHIFT additive_expression
(FUNCTION-TAG 'left-shift "left shift" (list $1 $3))
| shift_expression RSHIFT additive_expression
(FUNCTION-TAG 'right-shift "right shift" (list $1 $3))
| shift_expression URSHIFT additive_expression
(FUNCTION-TAG 'unsigned-right-shift "unsigned right shift" (list $1 $3))
;
relational_expression
: shift_expression
| relational_expression LT shift_expression
(FUNCTION-TAG 'less-than "less than" (list $1 $3))
| relational_expression GT shift_expression
(FUNCTION-TAG 'greater-than "greater than" (list $1 $3))
| relational_expression LTEQ shift_expression
(FUNCTION-TAG 'less-equal "less than or equal to" (list $1 $3))
| relational_expression GTEQ shift_expression
(FUNCTION-TAG 'greater-equal "greater than or equal to" (list $1 $3))
;
;; Lower the precendence of instanceof to resolve a grammar ambiguity.
;; Semantics are unchanged, since relational expressions do not
;; operate on boolean.
instanceof_expression
: relational_expression
| instanceof_expression INSTANCEOF reference_type
(FUNCTION-TAG 'instance-of "instance of" (list $1 $3))
;
equality_expression
: instanceof_expression
| equality_expression EQEQ instanceof_expression
(FUNCTION-TAG 'equal "equal to" (list $1 $3))
| equality_expression NOTEQ instanceof_expression
(FUNCTION-TAG 'not-equal "not equal to" (list $1 $3))
;
and_expression
: equality_expression
| and_expression AND equality_expression
(FUNCTION-TAG 'bitand "bitwise and" (list $1 $3))
;
exclusive_or_expression
: and_expression
| exclusive_or_expression XOR and_expression
(FUNCTION-TAG 'bitxor "bitwise xor" (list $1 $3))
;
inclusive_or_expression
: exclusive_or_expression
| inclusive_or_expression OR exclusive_or_expression
(FUNCTION-TAG 'bitor "bitwise or" (list $1 $3))
;
conditional_and_expression
: inclusive_or_expression
| conditional_and_expression ANDAND inclusive_or_expression
(FUNCTION-TAG 'logand "logical and" (list $1 $3))
;
conditional_or_expression
: conditional_and_expression
| conditional_or_expression OROR conditional_and_expression
(FUNCTION-TAG 'logor "logical or" (list $1 $3))
;
conditional_expression
: conditional_or_expression
| conditional_or_expression QUESTION expression
COLON conditional_expression
(FUNCTION-TAG 'question "question colon" (list $1 $3 $5))
;
expression
: conditional_expression
;
;;; JSR-14) Generics
;;
;; type_parameters_opt
;; : type_parameters
;; | ;;EMPTY
;; ;
;; type_parameters
;; : LT type_parameter_list_1
;; (progn $2)
;; ;
;; type_parameter_list
;; : type_parameter_list COMMA type_parameter
;; (cons $3 $1)
;; | type_parameter
;; (list $1)
;; ;
;; type_parameter_list_1
;; : type_parameter_1
;; (list $1)
;; | type_parameter_list COMMA type_parameter_1
;; (cons $3 $1)
;; ;
;; type_parameter
;; : type_variable type_bound_opt
;; ;
;; type_parameter_1
;; : type_variable GT
;; | type_variable type_bound_1
;; ;
;; type_bound_opt
;; : type_bound
;; | ;;EMPTY
;; ;
;; type_bound
;; : EXTENDS reference_type additional_bound_list_opt
;; ;
;; type_bound_1
;; : EXTENDS reference_type_1
;; | EXTENDS reference_type additional_bound_list_1
;; ;
;; additional_bound_list_opt
;; : additional_bound_list
;; | ;;EMPTY
;; ;
;; additional_bound_list
;; : additional_bound additional_bound_list
;; | additional_bound
;; ;
;; additional_bound_list_1
;; : additional_bound additional_bound_list_1
;; | additional_bound_1
;; ;
;; additional_bound
;; : AND interface_type
;; ;
;; additional_bound_1
;; : AND reference_type_1
;; ;
;; ;; Duplicate `_no_name' rules to remove ambiguity between `(x)' as an
;; ;; expression or a type cast.
;; postfix_expression_no_name
;; : primary
;; ;; The `name' production was removed here.
;; ;; | postincrement_expression
;; ;; | postdecrement_expression
;; ;
;; unary_expression_no_name
;; :
;; ;; preincrement_expression
;; ;; | predecrement_expression |
;; PLUS unary_expression
;; | MINUS unary_expression
;; | unary_expression_not_plus_minus_no_name
;; ;
;; unary_expression_not_plus_minus_no_name
;; : postfix_expression_no_name
;; | COMP unary_expression
;; | NOT unary_expression
;; | cast_expression
;; ;
;; multiplicative_expression_no_name
;; : unary_expression_no_name
;; | name MULT unary_expression
;; | multiplicative_expression_no_name MULT unary_expression
;; | name DIV unary_expression
;; | multiplicative_expression_no_name DIV unary_expression
;; | name MOD unary_expression
;; | multiplicative_expression_no_name MOD unary_expression
;; ;
;; additive_expression_no_name
;; : multiplicative_expression_no_name
;; | name PLUS multiplicative_expression
;; | additive_expression_no_name PLUS multiplicative_expression
;; | name MINUS multiplicative_expression
;; | additive_expression_no_name MINUS multiplicative_expression
;; ;
;; shift_expression_no_name
;; : additive_expression_no_name
;; | name LSHIFT additive_expression
;; | shift_expression_no_name LSHIFT additive_expression
;; | name RSHIFT additive_expression
;; | shift_expression_no_name RSHIFT additive_expression
;; | name URSHIFT additive_expression
;; | shift_expression_no_name URSHIFT additive_expression
;; ;
;; relational_expression_no_name
;; : shift_expression_no_name
;; ;; These productions for LT/GT disallow a<b<c as a valid expression
;; ;; to avoid ambiguity with parameterized types in casts.
;; | name LT shift_expression
;; | shift_expression_no_name LT shift_expression
;; | name GT shift_expression
;; | shift_expression_no_name GT shift_expression
;; | name LTEQ shift_expression
;; | relational_expression_no_name LTEQ shift_expression
;; | name GTEQ shift_expression
;; | relational_expression_no_name GTEQ shift_expression
;; ;
;; instanceof_expression_no_name
;; : relational_expression_no_name
;; | name INSTANCEOF reference_type
;; | instanceof_expression_no_name INSTANCEOF reference_type
;; ;
;; equality_expression_no_name
;; : instanceof_expression_no_name
;; | name EQEQ instanceof_expression
;; | equality_expression_no_name EQEQ instanceof_expression
;; | name NOTEQ instanceof_expression
;; | equality_expression_no_name NOTEQ instanceof_expression
;; ;
;; and_expression_no_name
;; : equality_expression_no_name
;; | name AND equality_expression
;; | and_expression_no_name AND equality_expression
;; ;
;; exclusive_or_expression_no_name
;; : and_expression_no_name
;; | name XOR and_expression
;; | exclusive_or_expression_no_name XOR and_expression
;; ;
;; inclusive_or_expression_no_name
;; : exclusive_or_expression_no_name
;; | name OR exclusive_or_expression
;; | inclusive_or_expression_no_name OR exclusive_or_expression
;; ;
;; conditional_and_expression_no_name
;; : inclusive_or_expression_no_name
;; | name ANDAND inclusive_or_expression
;; (FUNCTION-TAG 'logand "logical and" (list $1 $3))
;; | conditional_and_expression_no_name ANDAND inclusive_or_expression
;; (FUNCTION-TAG 'logand "logical and" (list $1 $3))
;; ;
;; conditional_or_expression_no_name
;; : conditional_and_expression_no_name
;; | name OROR conditional_and_expression
;; (FUNCTION-TAG 'logor "logical or" (list $1 $3))
;; | conditional_or_expression_no_name OROR conditional_and_expression
;; (FUNCTION-TAG 'logor "logical or" (list $1 $3))
;; ;
;; conditional_expression_no_name
;; : conditional_or_expression_no_name
;; | name QUESTION expression COLON conditional_expression
;; | conditional_or_expression_no_name QUESTION expression
;; COLON conditional_expression
;; ;
;; expression_no_name
;; : conditional_expression_no_name
;; ;
%%
;; Define the lexer for this grammar
(define-lex jdibug-java-expr-lexer
"Lexical analyzer that handles Java buffers.
It ignores whitespaces, newlines and comments."
semantic-lex-ignore-whitespace
semantic-lex-ignore-newline
semantic-lex-ignore-comments
;;;; Auto-generated analyzers.
jdibug-java-expr-wy--<number>-regexp-analyzer
jdibug-java-expr-wy--<string>-sexp-analyzer
;; Must detect keywords before other symbols
jdibug-java-expr-wy--<keyword>-keyword-analyzer
jdibug-java-expr-wy--<symbol>-regexp-analyzer
jdibug-java-expr-wy--<punctuation>-string-analyzer
jdibug-java-expr-wy--<block>-block-analyzer
;;;;
semantic-lex-default-action)
;;; jdibug-java-expr.wy ends here