Skip to content

Commit 0471464

Browse files
committedNov 12, 2013
Rename all operators in grammar to be more consistent
1 parent f489441 commit 0471464

File tree

3 files changed

+193
-193
lines changed

3 files changed

+193
-193
lines changed
 

‎lib/opal/parser/grammar.rb

+58-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/opal/parser/grammar.y

+85-85
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
77
kUNTIL_MOD kRESCUE_MOD kALIAS kDEFINED klBEGIN klEND k__LINE__
88
k__FILE__ IDENTIFIER FID GVAR IVAR CONSTANT CVAR NTH_REF
99
BACK_REF STRING_CONTENT INTEGER FLOAT REGEXP_END '+@'
10-
'-@' '-@NUM' '**' '<=>' '==' '===' '!=' '>=' '<=' '&&'
11-
'||' '=~' '!~' '.' '..' '...' '[]' '[]=' '<<' '>>'
12-
'::' '::@' OP_ASGN '=>' PAREN_BEG '(' ')' tLPAREN_ARG
13-
ARRAY_BEG ']' tLBRACE tLBRACE_ARG SPLAT '*' '&@' '&'
14-
'~' '%' '/' '+' '-' '<' '>' '|' '!' '^'
10+
'-@' '-@NUM' tPOW tCMP tEQ tEQQ tNEQ tGEQ tLEQ tANDOP
11+
tOROP tMATCH tNMATCH '.' tDOT2 tDOT3 '[]' '[]=' tLSHFT tRSHFT
12+
'::' '::@' tOP_ASGN '=>' PAREN_BEG '(' ')' tLPAREN_ARG
13+
ARRAY_BEG ']' tLBRACE tLBRACE_ARG SPLAT tSTAR2 '&@' tAMPER2
14+
tTILDE tPERCENT tDIVIDE '+' '-' tLT tGT tPIPE tBANG tCARET
1515
LCURLY '}' BACK_REF2 SYMBOL_BEG STRING_BEG XSTRING_BEG REGEXP_BEG
1616
WORDS_BEG AWORDS_BEG STRING_DBEG STRING_DVAR STRING_END STRING
17-
SYMBOL '\\n' '?' ':' ',' SPACE ';' LABEL LAMBDA LAMBEG kDO_LAMBDA
17+
SYMBOL '\\n' tEH tCOLON ',' SPACE ';' LABEL LAMBDA LAMBEG kDO_LAMBDA
1818

1919
prechigh
20-
right '!' '~' '+@'
21-
right '**'
20+
right tBANG tTILDE '+@'
21+
right tPOW
2222
right '-@NUM' '-@'
23-
left '*' '/' '%'
23+
left tSTAR2 tDIVIDE tPERCENT
2424
left '+' '-'
25-
left '<<' '>>'
26-
left '&'
27-
left '|' '^'
28-
left '>' '>=' '<' '<='
29-
nonassoc '<=>' '==' '===' '!=' '=~' '!~'
30-
left '&&'
31-
left '||'
32-
nonassoc '..' '...'
33-
right '?' ':'
25+
left tLSHFT tRSHFT
26+
left tAMPER2
27+
left tPIPE tCARET
28+
left tGT tGEQ tLT tLEQ
29+
nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
30+
left tANDOP
31+
left tOROP
32+
nonassoc tDOT2 tDOT3
33+
right tEH tCOLON
3434
left kRESCUE_MOD
35-
right '=' OP_ASGN
35+
right tEQL tOP_ASGN
3636
nonassoc kDEFINED
3737
right kNOT
3838
left kOR kAND
@@ -126,38 +126,38 @@ stmt:
126126
}
127127
| klBEGIN LCURLY compstmt '}'
128128
| klEND LCURLY compstmt '}'
129-
| lhs '=' command_call
129+
| lhs tEQL command_call
130130
{
131131
result = new_assign val[0], val[2]
132132
}
133-
| mlhs '=' command_call
133+
| mlhs tEQL command_call
134134
{
135135
result = s(:masgn, val[0], s(:to_ary, val[2]))
136136
}
137-
| var_lhs OP_ASGN command_call
137+
| var_lhs tOP_ASGN command_call
138138
{
139139
result = new_op_asgn val[1].intern, val[0], val[2]
140140
}
141-
| primary_value '[@' aref_args ']' OP_ASGN command_call
141+
| primary_value '[@' aref_args ']' tOP_ASGN command_call
142142
# {
143143
# result = OpAsgnNode.new(val[4], ArefNode.new(val[0], val[2]), val[5])
144144
# }
145-
| primary_value '.' IDENTIFIER OP_ASGN command_call
145+
| primary_value '.' IDENTIFIER tOP_ASGN command_call
146146
{
147147
result = s(:op_asgn2, val[0], "#{val[2]}=".intern, val[3].intern, val[4])
148148
}
149-
| primary_value '.' CONSTANT OP_ASGN command_call
150-
| primary_value '::' IDENTIFIER OP_ASGN command_call
151-
| backref OP_ASGN command_call
152-
| lhs '=' mrhs
149+
| primary_value '.' CONSTANT tOP_ASGN command_call
150+
| primary_value '::' IDENTIFIER tOP_ASGN command_call
151+
| backref tOP_ASGN command_call
152+
| lhs tEQL mrhs
153153
{
154154
result = new_assign val[0], s(:svalue, val[2])
155155
}
156-
| mlhs '=' arg_value
156+
| mlhs tEQL arg_value
157157
{
158158
result = s(:masgn, val[0], s(:to_ary, val[2]))
159159
}
160-
| mlhs '=' mrhs
160+
| mlhs tEQL mrhs
161161
{
162162
result = s(:masgn, val[0], val[2])
163163
}
@@ -180,7 +180,7 @@ expr:
180180
result = s(:not, val[1])
181181
result.line = val[1].line
182182
}
183-
| '!' command_call
183+
| tBANG command_call
184184
{
185185
result = s(:not, val[1])
186186
}
@@ -421,11 +421,11 @@ undef_list:
421421
}
422422

423423
op:
424-
'|' | '^' | '&' | '<=>' | '==' | '==='
425-
| '=~' | '>' | '>=' | '<' | '<=' | '<<'
426-
| '>>' | '+' | '-' | '*' | SPLAT | '/'
427-
| '%' | '**' | '~' | '+@' | '-@' | '[]'
428-
| '[]=' | BACK_REF2 | '!' | '!='
424+
tPIPE | tCARET | tAMPER2 | tCMP | tEQ | tEQQ
425+
| tMATCH | tGT | tGEQ | tLT | tLEQ | tLSHFT
426+
| tRSHFT | '+' | '-' | tSTAR2 | SPLAT | tDIVIDE
427+
| tPERCENT | tPOW | tTILDE | '+@' | '-@' | '[]'
428+
| '[]=' | BACK_REF2 | tBANG | tNEQ
429429

430430
reswords:
431431
k__LINE__ | k__FILE__ | klBEGIN | klEND | kALIAS | kAND
@@ -438,40 +438,40 @@ reswords:
438438
| kIF | kWHILE | kUNTIL | kUNLESS
439439

440440
arg:
441-
lhs '=' arg
441+
lhs tEQL arg
442442
{
443443
result = new_assign val[0], val[2]
444444
}
445-
| lhs '=' arg kRESCUE_MOD arg
445+
| lhs tEQL arg kRESCUE_MOD arg
446446
{
447447
result = new_assign val[0], s(:rescue_mod, val[2], val[4])
448448
}
449-
| var_lhs OP_ASGN arg
449+
| var_lhs tOP_ASGN arg
450450
{
451451
result = new_op_asgn val[1].intern, val[0], val[2]
452452
}
453-
| primary_value '[@' aref_args ']' OP_ASGN arg
453+
| primary_value '[@' aref_args ']' tOP_ASGN arg
454454
{
455455
args = val[2]
456456
args.type = :arglist if args.type == :array
457457
result = s(:op_asgn1, val[0], val[2], val[4].intern, val[5])
458458
result.line = val[0].line
459459
}
460-
| primary_value '.' IDENTIFIER OP_ASGN arg
460+
| primary_value '.' IDENTIFIER tOP_ASGN arg
461461
{
462462
result = s(:op_asgn2, val[0], "#{val[2]}=".intern, val[3].intern, val[4])
463463
}
464-
| primary_value '.' CONSTANT OP_ASGN arg
465-
| primary_value '::' IDENTIFIER OP_ASGN arg
466-
| primary_value '::' CONSTANT OP_ASGN arg
467-
| '::@' CONSTANT OP_ASGN arg
468-
| backref OP_ASGN arg
469-
| arg '..' arg
464+
| primary_value '.' CONSTANT tOP_ASGN arg
465+
| primary_value '::' IDENTIFIER tOP_ASGN arg
466+
| primary_value '::' CONSTANT tOP_ASGN arg
467+
| '::@' CONSTANT tOP_ASGN arg
468+
| backref tOP_ASGN arg
469+
| arg tDOT2 arg
470470
{
471471
result = s(:dot2, val[0], val[2])
472472
result.line = val[0].line
473473
}
474-
| arg '...' arg
474+
| arg tDOT3 arg
475475
{
476476
result = s(:dot3, val[0], val[2])
477477
result.line = val[0].line
@@ -484,24 +484,24 @@ arg:
484484
{
485485
result = new_call val[0], :"-", s(:arglist, val[2])
486486
}
487-
| arg '*' arg
487+
| arg tSTAR2 arg
488488
{
489489
result = new_call val[0], :"*", s(:arglist, val[2])
490490
}
491-
| arg '/' arg
491+
| arg tDIVIDE arg
492492
{
493493
result = new_call val[0], :"/", s(:arglist, val[2])
494494
}
495-
| arg '%' arg
495+
| arg tPERCENT arg
496496
{
497497
result = new_call val[0], :"%", s(:arglist, val[2])
498498
}
499-
| arg '**' arg
499+
| arg tPOW arg
500500
{
501501
result = new_call val[0], :"**", s(:arglist, val[2])
502502
}
503-
| '-@NUM' INTEGER '**' arg
504-
| '-@NUM' FLOAT '**' arg
503+
| '-@NUM' INTEGER tPOW arg
504+
| '-@NUM' FLOAT tPOW arg
505505
| '+@' arg
506506
{
507507
result = new_call val[1], :"+@", s(:arglist)
@@ -518,80 +518,80 @@ arg:
518518
result = val[1]
519519
end
520520
}
521-
| arg '|' arg
521+
| arg tPIPE arg
522522
{
523523
result = new_call val[0], :"|", s(:arglist, val[2])
524524
}
525-
| arg '^' arg
525+
| arg tCARET arg
526526
{
527527
result = new_call val[0], :"^", s(:arglist, val[2])
528528
}
529-
| arg '&' arg
529+
| arg tAMPER2 arg
530530
{
531531
result = new_call val[0], :"&", s(:arglist, val[2])
532532
}
533-
| arg '<=>' arg
533+
| arg tCMP arg
534534
{
535535
result = new_call val[0], :"<=>", s(:arglist, val[2])
536536
}
537-
| arg '>' arg
537+
| arg tGT arg
538538
{
539539
result = new_call val[0], :">", s(:arglist, val[2])
540540
}
541-
| arg '>=' arg
541+
| arg tGEQ arg
542542
{
543543
result = new_call val[0], :">=", s(:arglist, val[2])
544544
}
545-
| arg '<' arg
545+
| arg tLT arg
546546
{
547547
result = new_call val[0], :"<", s(:arglist, val[2])
548548
}
549-
| arg '<=' arg
549+
| arg tLEQ arg
550550
{
551551
result = new_call val[0], :"<=", s(:arglist, val[2])
552552
}
553-
| arg '==' arg
553+
| arg tEQ arg
554554
{
555555
result = new_call val[0], :"==", s(:arglist, val[2])
556556
}
557-
| arg '===' arg
557+
| arg tEQQ arg
558558
{
559559
result = new_call val[0], :"===", s(:arglist, val[2])
560560
}
561-
| arg '!=' arg
561+
| arg tNEQ arg
562562
{
563563
result = s(:not, new_call(val[0], :"==", s(:arglist, val[2])))
564564
}
565-
| arg '=~' arg
565+
| arg tMATCH arg
566566
{
567567
result = new_call val[0], :"=~", s(:arglist, val[2])
568568
}
569-
| arg '!~' arg
569+
| arg tNMATCH arg
570570
{
571571
result = s(:not, new_call(val[0], :"=~", s(:arglist, val[2])))
572572
}
573-
| '!' arg
573+
| tBANG arg
574574
{
575575
result = s(:not, val[1])
576576
}
577-
| '~' arg
577+
| tTILDE arg
578578
{
579579
result = new_call val[1], :"~", s(:arglist)
580580
}
581-
| arg '<<' arg
581+
| arg tLSHFT arg
582582
{
583583
result = new_call val[0], :"<<", s(:arglist, val[2])
584584
}
585-
| arg '>>' arg
585+
| arg tRSHFT arg
586586
{
587587
result = new_call val[0], :">>", s(:arglist, val[2])
588588
}
589-
| arg '&&' arg
589+
| arg tANDOP arg
590590
{
591591
result = s(:and, val[0], val[2])
592592
result.line = val[0].line
593593
}
594-
| arg '||' arg
594+
| arg tOROP arg
595595
{
596596
result = s(:or, val[0], val[2])
597597
result.line = val[0].line
@@ -600,7 +600,7 @@ arg:
600600
{
601601
result = s(:defined, val[2])
602602
}
603-
| arg '?' arg ':' arg
603+
| arg tEH arg tCOLON arg
604604
{
605605
result = s(:if, val[0], val[2], val[4])
606606
result.line = val[0].line
@@ -911,7 +911,7 @@ primary:
911911
result.line = val[1]
912912
result.end_line = lexer.line
913913
}
914-
| kCLASS '<<'
914+
| kCLASS tLSHFT
915915
{
916916
result = lexer.line
917917
}
@@ -981,13 +981,13 @@ primary_value:
981981

982982
then:
983983
term
984-
| ':'
984+
| tCOLON
985985
| kTHEN
986986
| term kTHEN
987987

988988
do:
989989
term
990-
| ':'
990+
| tCOLON
991991
| kDO_COND
992992

993993
lambda:
@@ -1053,22 +1053,22 @@ f_block_optarg:
10531053
}
10541054

10551055
f_block_opt:
1056-
IDENTIFIER '=' primary_value
1056+
IDENTIFIER tEQL primary_value
10571057
{
10581058
result = new_assign new_assignable(s(:identifier, val[0].intern)), val[2]
10591059
}
10601060

10611061
opt_block_var:
10621062
none
1063-
| '|' '|'
1063+
| tPIPE tPIPE
10641064
{
10651065
result = 0
10661066
}
1067-
| '||'
1067+
| tOROP
10681068
{
10691069
result = 0
10701070
}
1071-
| '|' block_param '|'
1071+
| tPIPE block_param tPIPE
10721072
{
10731073
result = val[1]
10741074
}
@@ -1521,7 +1521,7 @@ superclass:
15211521
{
15221522
result = nil
15231523
}
1524-
| '<' expr_value term
1524+
| tLT expr_value term
15251525
{
15261526
result = val[1]
15271527
}
@@ -1649,7 +1649,7 @@ f_arg:
16491649
}
16501650

16511651
f_opt:
1652-
IDENTIFIER '=' arg_value
1652+
IDENTIFIER tEQL arg_value
16531653
{
16541654
result = new_assign new_assignable(s(:identifier, val[0].intern)), val[2]
16551655
}
@@ -1666,7 +1666,7 @@ f_optarg:
16661666
}
16671667

16681668
restarg_mark:
1669-
'*'
1669+
tSTAR2
16701670
| SPLAT
16711671

16721672
f_rest_arg:
@@ -1680,7 +1680,7 @@ f_rest_arg:
16801680
}
16811681

16821682
blkarg_mark:
1683-
'&'
1683+
tAMPER2
16841684
| '&@'
16851685

16861686
f_block_arg:

‎lib/opal/parser/lexer.rb

+50-50
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def yylex
489489
if scanner.scan(/\*/)
490490
if scanner.scan(/\=/)
491491
@lex_state = :expr_beg
492-
return :OP_ASGN, '**'
492+
return :tOP_ASGN, '**'
493493
end
494494

495495
if @lex_state == :expr_fname or @lex_state == :expr_dot
@@ -498,18 +498,18 @@ def yylex
498498
@lex_state = :expr_beg
499499
end
500500

501-
return '**', '**'
501+
return :tPOW, '**'
502502

503503
else
504504
if scanner.scan(/\=/)
505505
@lex_state = :expr_beg
506-
return :OP_ASGN, '*'
506+
return :tOP_ASGN, '*'
507507
end
508508
end
509509

510510
if scanner.scan(/\*\=/)
511511
@lex_state = :expr_beg
512-
return :OP_ASGN, '**'
512+
return :tOP_ASGN, '**'
513513
end
514514

515515
if scanner.scan(/\*/)
@@ -519,17 +519,17 @@ def yylex
519519
@lex_state = :expr_beg
520520
end
521521

522-
return '**', '**'
522+
return :tPOW, '**'
523523
end
524524

525525
if scanner.scan(/\=/)
526526
@lex_state = :expr_beg
527-
return :OP_ASGN, '*'
527+
return :tOP_ASGN, '*'
528528
else
529529
result = '*'
530530
if @lex_state == :expr_fname or @lex_state == :expr_dot
531531
@lex_state = :expr_arg
532-
return '*', result
532+
return :tSTAR2, result
533533
elsif @space_seen && scanner.check(/\S/)
534534
@lex_state = :expr_beg
535535
return :SPLAT, result
@@ -538,7 +538,7 @@ def yylex
538538
return :SPLAT, result
539539
else
540540
@lex_state = :expr_beg
541-
return '*', result
541+
return :tSTAR2, result
542542
end
543543
end
544544

@@ -547,20 +547,20 @@ def yylex
547547
if after_operator?
548548
@lex_state = :expr_arg
549549
if c == "@"
550-
return '!', '!'
550+
return :tBANG, '!'
551551
end
552552
else
553553
@lex_state = :expr_beg
554554
end
555555

556556
if c == '='
557-
return '!=', '!='
557+
return :tNEQ, '!='
558558
elsif c == '~'
559-
return '!~', '!~'
559+
return :tNMATCH, '!~'
560560
end
561561

562562
scanner.pos = scanner.pos - 1
563-
return '!', '!'
563+
return :tBANG, '!'
564564

565565
elsif scanner.scan(/\=/)
566566
if @lex_state == :expr_beg and !@space_seen
@@ -596,19 +596,19 @@ def yylex
596596

597597
if scanner.scan(/\=/)
598598
if scanner.scan(/\=/)
599-
return '===', '==='
599+
return :tEQQ, '==='
600600
end
601601

602-
return '==', '=='
602+
return :tEQ, '=='
603603
end
604604

605605
if scanner.scan(/\~/)
606-
return '=~', '=~'
606+
return :tMATCH, '=~'
607607
elsif scanner.scan(/\>/)
608608
return '=>', '=>'
609609
end
610610

611-
return '=', '='
611+
return :tEQL, '='
612612

613613
elsif scanner.scan(/\"/)
614614
self.strterm = { :type => :dquote, :beg => '"', :end => '"' }
@@ -627,14 +627,14 @@ def yylex
627627
@lex_state = :expr_beg
628628

629629
if scanner.scan(/\=/)
630-
return :OP_ASGN, '&&'
630+
return :tOP_ASGN, '&&'
631631
end
632632

633-
return '&&', '&&'
633+
return :tANDOP, '&&'
634634

635635
elsif scanner.scan(/\=/)
636636
@lex_state = :expr_beg
637-
return :OP_ASGN, '&'
637+
return :tOP_ASGN, '&'
638638
end
639639

640640
if spcarg?
@@ -644,7 +644,7 @@ def yylex
644644
result = '&@'
645645
else
646646
#puts "warn_balanced: & argument prefix"
647-
result = '&'
647+
result = :tAMPER2
648648
end
649649

650650
@lex_state = after_operator? ? :expr_arg : :expr_beg
@@ -654,17 +654,17 @@ def yylex
654654
if scanner.scan(/\|/)
655655
@lex_state = :expr_beg
656656
if scanner.scan(/\=/)
657-
return :OP_ASGN, '||'
657+
return :tOP_ASGN, '||'
658658
end
659659

660-
return '||', '||'
660+
return :tOROP, '||'
661661

662662
elsif scanner.scan(/\=/)
663-
return :OP_ASGN, '|'
663+
return :tOP_ASGN, '|'
664664
end
665665

666666
@lex_state = after_operator?() ? :expr_arg : :expr_beg
667-
return '|', '|'
667+
return :tPIPE, '|'
668668

669669
elsif scanner.scan(/\%W/)
670670
start_word = scanner.scan(/./)
@@ -705,7 +705,7 @@ def yylex
705705
return :REGEXP_BEG, scanner.matched
706706
elsif scanner.scan(/\=/)
707707
@lex_state = :expr_beg
708-
return :OP_ASGN, '/'
708+
return :tOP_ASGN, '/'
709709
elsif @lex_state == :expr_fname or @lex_state == :expr_dot
710710
@lex_state = :expr_arg
711711
elsif @lex_state == :expr_cmdarg || @lex_state == :expr_arg
@@ -717,12 +717,12 @@ def yylex
717717
@lex_state = :expr_beg
718718
end
719719

720-
return '/', '/'
720+
return :tDIVIDE, '/'
721721

722722
elsif scanner.scan(/\%/)
723723
if scanner.scan(/\=/)
724724
@lex_state = :expr_beg
725-
return :OP_ASGN, '%'
725+
return :tOP_ASGN, '%'
726726
elsif scanner.check(/[^\s]/)
727727
if @lex_state == :expr_beg or (@lex_state == :expr_arg && @space_seen)
728728
start_word = scanner.scan(/./)
@@ -734,7 +734,7 @@ def yylex
734734

735735
@lex_state = after_operator? ? :expr_arg : :expr_beg
736736

737-
return '%', '%'
737+
return :tPERCENT, '%'
738738

739739
elsif scanner.scan(/\\/)
740740
if scanner.scan(/\r?\n/)
@@ -805,11 +805,11 @@ def yylex
805805

806806
elsif scanner.scan(/\.\.\./)
807807
@lex_state = :expr_beg
808-
return '...', scanner.matched
808+
return :tDOT3, scanner.matched
809809

810810
elsif scanner.scan(/\.\./)
811811
@lex_state = :expr_beg
812-
return '..', scanner.matched
812+
return :tDOT2, scanner.matched
813813

814814
elsif scanner.scan(/\./)
815815
@lex_state = :expr_dot unless @lex_state == :expr_fname
@@ -831,7 +831,7 @@ def yylex
831831
if end? || scanner.check(/\s/)
832832
unless scanner.check(/\w/)
833833
@lex_state = :expr_beg
834-
return ':', ':'
834+
return :tCOLON, ':'
835835
end
836836

837837
@lex_state = :expr_fname
@@ -849,34 +849,34 @@ def yylex
849849

850850
elsif scanner.scan(/\^\=/)
851851
@lex_state = :expr_beg
852-
return :OP_ASGN, '^'
852+
return :tOP_ASGN, '^'
853853
elsif scanner.scan(/\^/)
854854
if @lex_state == :expr_fname or @lex_state == :expr_dot
855855
@lex_state = :expr_arg
856-
return '^', scanner.matched
856+
return :tCARET, scanner.matched
857857
end
858858

859859
@lex_state = :expr_beg
860-
return '^', scanner.matched
860+
return :tCARET, scanner.matched
861861

862862
elsif scanner.check(/\</)
863863
if scanner.scan(/\<\<\=/)
864864
@lex_state = :expr_beg
865-
return :OP_ASGN, '<<'
865+
return :tOP_ASGN, '<<'
866866
elsif scanner.scan(/\<\</)
867867
if @lex_state == :expr_fname or @lex_state == :expr_dot
868868
@lex_state = :expr_arg
869-
return '<<', '<<'
869+
return :tLSHFT, '<<'
870870
elsif ![:expr_dot, :expr_class].include?(@lex_state) && !end? && (!arg? || @space_seen)
871871
if token = heredoc_identifier
872872
return token
873873
end
874874

875875
@lex_state = :expr_beg
876-
return '<<', '<<'
876+
return :tLSHFT, '<<'
877877
end
878878
@lex_state = :expr_beg
879-
return '<<', '<<'
879+
return :tLSHFT, '<<'
880880
elsif scanner.scan(/\<\=\>/)
881881
if after_operator?
882882
@lex_state = :expr_arg
@@ -888,47 +888,47 @@ def yylex
888888
@lex_state = :expr_beg
889889
end
890890

891-
return '<=>', '<=>'
891+
return :tCMP, '<=>'
892892
elsif scanner.scan(/\<\=/)
893893
if @lex_state == :expr_fname or @lex_state == :expr_dot
894894
@lex_state = :expr_arg
895895
else
896896
@lex_state = :expr_beg
897897
end
898-
return '<=', '<='
898+
return :tLEQ, '<='
899899
elsif scanner.scan(/\</)
900900
if @lex_state == :expr_fname or @lex_state == :expr_dot
901901
@lex_state = :expr_arg
902902
else
903903
@lex_state = :expr_beg
904904
end
905-
return '<', '<'
905+
return :tLT, '<'
906906
end
907907

908908
elsif scanner.check(/\>/)
909909
if scanner.scan(/\>\>\=/)
910-
return :OP_ASGN, '>>'
910+
return :tOP_ASGN, '>>'
911911
elsif scanner.scan(/\>\>/)
912912
if @lex_state == :expr_fname or @lex_state == :expr_dot
913913
@lex_state = :expr_arg
914914
else
915915
@lex_state = :expr_beg
916916
end
917-
return '>>', '>>'
917+
return :tRSHFT, '>>'
918918
elsif scanner.scan(/\>\=/)
919919
if @lex_state == :expr_fname or @lex_state == :expr_dot
920920
@lex_state = :expr_end
921921
else
922922
@lex_state = :expr_beg
923923
end
924-
return '>=', scanner.matched
924+
return :tGEQ, scanner.matched
925925
elsif scanner.scan(/\>/)
926926
if @lex_state == :expr_fname or @lex_state == :expr_dot
927927
@lex_state = :expr_arg
928928
else
929929
@lex_state = :expr_beg
930930
end
931-
return '>', '>'
931+
return :tGT, '>'
932932
end
933933

934934
elsif scanner.scan(/->/)
@@ -952,7 +952,7 @@ def yylex
952952

953953
if scanner.scan(/\=/)
954954
@lex_state = :expr_beg
955-
return [:OP_ASGN, result]
955+
return [:tOP_ASGN, result]
956956
end
957957

958958
if @lex_state == :expr_cmdarg || @lex_state == :expr_arg
@@ -968,7 +968,7 @@ def yylex
968968
elsif scanner.scan(/\?/)
969969
if end?
970970
@lex_state = :expr_beg
971-
return '?', scanner.matched
971+
return :tEH, scanner.matched
972972
end
973973

974974
unless scanner.check(/\ |\t|\r|\s/)
@@ -977,15 +977,15 @@ def yylex
977977
end
978978

979979
@lex_state = :expr_beg
980-
return '?', scanner.matched
980+
return :tEH, scanner.matched
981981

982982
elsif scanner.scan(/\~/)
983983
if @lex_state == :expr_fname
984984
@lex_state = :expr_end
985-
return '~', '~'
985+
return :tTILDE, '~'
986986
end
987987
@lex_state = :expr_beg
988-
return '~', '~'
988+
return :tTILDE, '~'
989989

990990
elsif scanner.check(/\$/)
991991
if scanner.scan(/\$([1-9]\d*)/)

0 commit comments

Comments
 (0)
Please sign in to comment.