Class: ExcelFormula::Lexer
- Inherits:
-
ANTLR3::Lexer
- Object
- ANTLR3::Lexer
- ExcelFormula::Lexer
- Includes:
- TokenData
- Defined in:
- lib/surpass/ExcelFormulaLexer.rb
Defined Under Namespace
Classes: DFA14
Constant Summary collapse
- RULE_NAMES =
["EQ", "LT", "GT", "NE", "LE", "GE", "ADD", "SUB", "MUL", "DIV", "COLON", "SEMICOLON", "COMMA", "LP", "RP", "CONCAT", "PERCENT", "POWER", "BANG", "DIGIT", "INT_CONST", "NUM_CONST", "STR_CONST", "REF2D", "TRUE_CONST", "FALSE_CONST", "QUOTENAME", "FUNC_IF", "FUNC_CHOOSE", "ALPHA", "NAME", "WS"].freeze
- RULE_METHODS =
[:eq!, :lt!, :gt!, :ne!, :le!, :ge!, :add!, :sub!, :mul!, :div!, :colon!, :semicolon!, :comma!, :lp!, :rp!, :concat!, :percent!, :power!, :bang!, :digit!, :int_const!, :num_const!, :str_const!, :ref_2_d!, :true_const!, :false_const!, :quotename!, :func_if!, :func_choose!, :alpha!, :name!, :ws!].freeze
Instance Method Summary collapse
-
#add! ⇒ Object
lexer rule add! (ADD) (in ExcelFormula.g).
-
#alpha! ⇒ Object
lexer rule alpha! (ALPHA) (in ExcelFormula.g).
-
#bang! ⇒ Object
lexer rule bang! (BANG) (in ExcelFormula.g).
-
#colon! ⇒ Object
lexer rule colon! (COLON) (in ExcelFormula.g).
-
#comma! ⇒ Object
lexer rule comma! (COMMA) (in ExcelFormula.g).
-
#concat! ⇒ Object
lexer rule concat! (CONCAT) (in ExcelFormula.g).
-
#digit! ⇒ Object
lexer rule digit! (DIGIT) (in ExcelFormula.g).
-
#div! ⇒ Object
lexer rule div! (DIV) (in ExcelFormula.g).
-
#eq! ⇒ Object
-
lexer rules - - - - - - - - - - - - lexer rule eq! (EQ) (in ExcelFormula.g).
-
-
#false_const! ⇒ Object
lexer rule false_const! (FALSE_CONST) (in ExcelFormula.g).
-
#func_choose! ⇒ Object
lexer rule func_choose! (FUNC_CHOOSE) (in ExcelFormula.g).
-
#func_if! ⇒ Object
lexer rule func_if! (FUNC_IF) (in ExcelFormula.g).
-
#ge! ⇒ Object
lexer rule ge! (GE) (in ExcelFormula.g).
-
#gt! ⇒ Object
lexer rule gt! (GT) (in ExcelFormula.g).
-
#initialize(input = nil, options = {}) ⇒ Lexer
constructor
A new instance of Lexer.
-
#int_const! ⇒ Object
lexer rule int_const! (INT_CONST) (in ExcelFormula.g).
-
#le! ⇒ Object
lexer rule le! (LE) (in ExcelFormula.g).
-
#lp! ⇒ Object
lexer rule lp! (LP) (in ExcelFormula.g).
-
#lt! ⇒ Object
lexer rule lt! (LT) (in ExcelFormula.g).
-
#mul! ⇒ Object
lexer rule mul! (MUL) (in ExcelFormula.g).
-
#name! ⇒ Object
lexer rule name! (NAME) (in ExcelFormula.g).
-
#ne! ⇒ Object
lexer rule ne! (NE) (in ExcelFormula.g).
-
#num_const! ⇒ Object
lexer rule num_const! (NUM_CONST) (in ExcelFormula.g).
-
#percent! ⇒ Object
lexer rule percent! (PERCENT) (in ExcelFormula.g).
-
#power! ⇒ Object
lexer rule power! (POWER) (in ExcelFormula.g).
-
#quotename! ⇒ Object
lexer rule quotename! (QUOTENAME) (in ExcelFormula.g).
-
#ref_2_d! ⇒ Object
lexer rule ref_2_d! (REF2D) (in ExcelFormula.g).
-
#rp! ⇒ Object
lexer rule rp! (RP) (in ExcelFormula.g).
-
#semicolon! ⇒ Object
lexer rule semicolon! (SEMICOLON) (in ExcelFormula.g).
-
#str_const! ⇒ Object
lexer rule str_const! (STR_CONST) (in ExcelFormula.g).
-
#sub! ⇒ Object
lexer rule sub! (SUB) (in ExcelFormula.g).
-
#token! ⇒ Object
main rule used to study the input at the current position, and choose the proper lexer rule to call in order to fetch the next token.
-
#true_const! ⇒ Object
lexer rule true_const! (TRUE_CONST) (in ExcelFormula.g).
-
#ws! ⇒ Object
lexer rule ws! (WS) (in ExcelFormula.g).
Constructor Details
#initialize(input = nil, options = {}) ⇒ Lexer
Returns a new instance of Lexer.
104 105 106 107 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 104 def initialize(input=nil, = {}) super(input, ) end |
Instance Method Details
#add! ⇒ Object
lexer rule add! (ADD) (in ExcelFormula.g)
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 256 def add! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 7) type = ADD channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 347:6: '+' match(?+) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 7) end |
#alpha! ⇒ Object
lexer rule alpha! (ALPHA) (in ExcelFormula.g)
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 1119 def alpha! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 30) # - - - - main rule block - - - - # at line if @input.peek(1).between?(?A, ?Z) || @input.peek(1).between?(?a, ?z) @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 30) end |
#bang! ⇒ Object
lexer rule bang! (BANG) (in ExcelFormula.g)
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 544 def bang! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 19) type = BANG channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 361:7: '!' match(?!) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 19) end |
#colon! ⇒ Object
lexer rule colon! (COLON) (in ExcelFormula.g)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 352 def colon! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 11) type = COLON channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 352:8: ':' match(?:) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 11) end |
#comma! ⇒ Object
lexer rule comma! (COMMA) (in ExcelFormula.g)
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 400 def comma! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 13) type = COMMA channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 354:8: ',' match(?,) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 13) end |
#concat! ⇒ Object
lexer rule concat! (CONCAT) (in ExcelFormula.g)
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 472 def concat! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 16) type = CONCAT channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 358:9: '&' match(?&) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 16) end |
#digit! ⇒ Object
lexer rule digit! (DIGIT) (in ExcelFormula.g)
568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 568 def digit! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 20) # - - - - main rule block - - - - # at line 363:17: '0' .. '9' match_range(?0, ?9) ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 20) end |
#div! ⇒ Object
lexer rule div! (DIV) (in ExcelFormula.g)
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 328 def div! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 10) type = DIV channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 350:6: '/' match(?/) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 10) end |
#eq! ⇒ Object
-
lexer rules - - - - - - - - - - - -
-
lexer rule eq! (EQ) (in ExcelFormula.g)
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 112 def eq! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 1) type = EQ channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 340:5: '=' match(?=) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 1) end |
#false_const! ⇒ Object
lexer rule false_const! (FALSE_CONST) (in ExcelFormula.g)
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 979 def false_const! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 26) type = FALSE_CONST channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 370:14: ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' ) if @input.peek(1) == ?F || @input.peek(1) == ?f @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end if @input.peek(1) == ?A || @input.peek(1) == ?a @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end if @input.peek(1) == ?L || @input.peek(1) == ?l @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end if @input.peek(1) == ?S || @input.peek(1) == ?s @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end if @input.peek(1) == ?E || @input.peek(1) == ?e @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 26) end |
#func_choose! ⇒ Object
lexer rule func_choose! (FUNC_CHOOSE) (in ExcelFormula.g)
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 1095 def func_choose! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 29) type = FUNC_CHOOSE channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 373:14: 'CHOOSE' match("CHOOSE") @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 29) end |
#func_if! ⇒ Object
lexer rule func_if! (FUNC_IF) (in ExcelFormula.g)
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 1071 def func_if! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 28) type = FUNC_IF channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 372:10: 'IF' match("IF") @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 28) end |
#ge! ⇒ Object
lexer rule ge! (GE) (in ExcelFormula.g)
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 232 def ge! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 6) type = GE channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 345:5: '>=' match(">=") @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 6) end |
#gt! ⇒ Object
lexer rule gt! (GT) (in ExcelFormula.g)
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 160 def gt! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 3) type = GT channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 342:5: '>' match(?>) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 3) end |
#int_const! ⇒ Object
lexer rule int_const! (INT_CONST) (in ExcelFormula.g)
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 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 585 def int_const! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 21) type = INT_CONST channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 365:12: ( DIGIT )+ # at file 365:12: ( DIGIT )+ match_count_1 = 0 loop do alt_1 = 2 look_1_0 = @input.peek(1) if (look_1_0.between?(?0, ?9)) alt_1 = 1 end case alt_1 when 1 # at line 365:12: DIGIT digit! else match_count_1 > 0 and break eee = EarlyExit(1) raise eee end match_count_1 += 1 end @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 21) end |
#le! ⇒ Object
lexer rule le! (LE) (in ExcelFormula.g)
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 208 def le! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 5) type = LE channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 344:5: '<=' match("<=") @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 5) end |
#lp! ⇒ Object
lexer rule lp! (LP) (in ExcelFormula.g)
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 424 def lp! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 14) type = LP channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 356:5: '(' match(?() @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 14) end |
#lt! ⇒ Object
lexer rule lt! (LT) (in ExcelFormula.g)
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 136 def lt! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 2) type = LT channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 341:5: '<' match(?<) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 2) end |
#mul! ⇒ Object
lexer rule mul! (MUL) (in ExcelFormula.g)
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 304 def mul! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 9) type = MUL channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 349:6: '*' match(?*) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 9) end |
#name! ⇒ Object
lexer rule name! (NAME) (in ExcelFormula.g)
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 1144 def name! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 31) type = NAME channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 376:7: ( ALPHA )+ # at file 376:7: ( ALPHA )+ match_count_12 = 0 loop do alt_12 = 2 look_12_0 = @input.peek(1) if (look_12_0.between?(?A, ?Z) || look_12_0.between?(?a, ?z)) alt_12 = 1 end case alt_12 when 1 # at line 376:7: ALPHA alpha! else match_count_12 > 0 and break eee = EarlyExit(12) raise eee end match_count_12 += 1 end @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 31) end |
#ne! ⇒ Object
lexer rule ne! (NE) (in ExcelFormula.g)
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 184 def ne! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 4) type = NE channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 343:5: '<>' match("<>") @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 4) end |
#num_const! ⇒ Object
lexer rule num_const! (NUM_CONST) (in ExcelFormula.g)
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 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 633 def num_const! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 22) type = NUM_CONST channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 366:12: ( DIGIT )* '.' ( DIGIT )+ ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )? # at line 366:12: ( DIGIT )* loop do # decision 2 alt_2 = 2 look_2_0 = @input.peek(1) if (look_2_0.between?(?0, ?9)) alt_2 = 1 end case alt_2 when 1 # at line 366:12: DIGIT digit! else break # out of loop for decision 2 end end # loop for decision 2 match(?.) # at file 366:23: ( DIGIT )+ match_count_3 = 0 loop do alt_3 = 2 look_3_0 = @input.peek(1) if (look_3_0.between?(?0, ?9)) alt_3 = 1 end case alt_3 when 1 # at line 366:23: DIGIT digit! else match_count_3 > 0 and break eee = EarlyExit(3) raise eee end match_count_3 += 1 end # at line 366:30: ( ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ )? alt_6 = 2 look_6_0 = @input.peek(1) if (look_6_0 == ?E || look_6_0 == ?e) alt_6 = 1 end case alt_6 when 1 # at line 366:31: ( 'E' | 'e' ) ( '+' | '-' )? ( DIGIT )+ if @input.peek(1) == ?E || @input.peek(1) == ?e @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end # at line 366:41: ( '+' | '-' )? alt_4 = 2 look_4_0 = @input.peek(1) if (look_4_0 == ?+ || look_4_0 == ?-) alt_4 = 1 end case alt_4 when 1 # at line if @input.peek(1) == ?+ || @input.peek(1) == ?- @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end end # at file 366:52: ( DIGIT )+ match_count_5 = 0 loop do alt_5 = 2 look_5_0 = @input.peek(1) if (look_5_0.between?(?0, ?9)) alt_5 = 1 end case alt_5 when 1 # at line 366:52: DIGIT digit! else match_count_5 > 0 and break eee = EarlyExit(5) raise eee end match_count_5 += 1 end end @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 22) end |
#percent! ⇒ Object
lexer rule percent! (PERCENT) (in ExcelFormula.g)
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 496 def percent! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 17) type = PERCENT channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 359:10: '\\%' match(?\%) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 17) end |
#power! ⇒ Object
lexer rule power! (POWER) (in ExcelFormula.g)
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 520 def power! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 18) type = POWER channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 360:8: '^' match(?^) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 18) end |
#quotename! ⇒ Object
lexer rule quotename! (QUOTENAME) (in ExcelFormula.g)
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 1047 def quotename! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 27) type = QUOTENAME channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 371:12: '\\'(?:[^\\']|\\'\\')*\\'' match("'(?:[^']|'')*'") @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 27) end |
#ref_2_d! ⇒ Object
lexer rule ref_2_d! (REF2D) (in ExcelFormula.g)
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 825 def ref_2_d! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 24) type = REF2D channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 368:8: ( '$' )? ( 'A' .. 'I' )? ( 'A' .. 'Z' ) ( '$' )? ( DIGIT )+ # at line 368:8: ( '$' )? alt_8 = 2 look_8_0 = @input.peek(1) if (look_8_0 == ?$) alt_8 = 1 end case alt_8 when 1 # at line 368:8: '$' match(?$) end # at line 368:13: ( 'A' .. 'I' )? alt_9 = 2 look_9_0 = @input.peek(1) if (look_9_0.between?(?A, ?I)) look_9_1 = @input.peek(2) if (look_9_1.between?(?A, ?Z)) alt_9 = 1 end end case alt_9 when 1 # at line 368:14: 'A' .. 'I' match_range(?A, ?I) end # at line 368:25: ( 'A' .. 'Z' ) # at line 368:26: 'A' .. 'Z' match_range(?A, ?Z) # at line 368:36: ( '$' )? alt_10 = 2 look_10_0 = @input.peek(1) if (look_10_0 == ?$) alt_10 = 1 end case alt_10 when 1 # at line 368:36: '$' match(?$) end # at file 368:41: ( DIGIT )+ match_count_11 = 0 loop do alt_11 = 2 look_11_0 = @input.peek(1) if (look_11_0.between?(?0, ?9)) alt_11 = 1 end case alt_11 when 1 # at line 368:41: DIGIT digit! else match_count_11 > 0 and break eee = EarlyExit(11) raise eee end match_count_11 += 1 end @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 24) end |
#rp! ⇒ Object
lexer rule rp! (RP) (in ExcelFormula.g)
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 448 def rp! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 15) type = RP channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 357:5: ')' match(?)) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 15) end |
#semicolon! ⇒ Object
lexer rule semicolon! (SEMICOLON) (in ExcelFormula.g)
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 376 def semicolon! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 12) type = SEMICOLON channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 353:12: ';' match(?;) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 12) end |
#str_const! ⇒ Object
lexer rule str_const! (STR_CONST) (in ExcelFormula.g)
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 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 767 def str_const! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 23) type = STR_CONST channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 367:12: '\"' (~ '\"' )+ '\"' match(?") # at file 367:16: (~ '\"' )+ match_count_7 = 0 loop do alt_7 = 2 look_7_0 = @input.peek(1) if (look_7_0.between?(0x0000, ?!) || look_7_0.between?(?#, 0xFFFF)) alt_7 = 1 end case alt_7 when 1 # at line 367:17: ~ '\"' if @input.peek(1).between?(0x0000, ?!) || @input.peek(1).between?(?#, 0x00FF) @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end else match_count_7 > 0 and break eee = EarlyExit(7) raise eee end match_count_7 += 1 end match(?") @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 23) end |
#sub! ⇒ Object
lexer rule sub! (SUB) (in ExcelFormula.g)
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 280 def sub! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 8) type = SUB channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 348:6: '-' match(?-) @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 8) end |
#token! ⇒ Object
main rule used to study the input at the current position, and choose the proper lexer rule to call in order to fetch the next token
usually, you don’t make direct calls to this method, but instead use the next_token method, which will build and emit the actual next token
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 1248 def token! # at line 1:8: ( EQ | LT | GT | NE | LE | GE | ADD | SUB | MUL | DIV | COLON | SEMICOLON | COMMA | LP | RP | CONCAT | PERCENT | POWER | BANG | INT_CONST | NUM_CONST | STR_CONST | REF2D | TRUE_CONST | FALSE_CONST | QUOTENAME | FUNC_IF | FUNC_CHOOSE | NAME | WS ) alt_14 = 30 alt_14 = @dfa14.predict(@input) case alt_14 when 1 # at line 1:10: EQ eq! when 2 # at line 1:13: LT lt! when 3 # at line 1:16: GT gt! when 4 # at line 1:19: NE ne! when 5 # at line 1:22: LE le! when 6 # at line 1:25: GE ge! when 7 # at line 1:28: ADD add! when 8 # at line 1:32: SUB sub! when 9 # at line 1:36: MUL mul! when 10 # at line 1:40: DIV div! when 11 # at line 1:44: COLON colon! when 12 # at line 1:50: SEMICOLON semicolon! when 13 # at line 1:60: COMMA comma! when 14 # at line 1:66: LP lp! when 15 # at line 1:69: RP rp! when 16 # at line 1:72: CONCAT concat! when 17 # at line 1:79: PERCENT percent! when 18 # at line 1:87: POWER power! when 19 # at line 1:93: BANG bang! when 20 # at line 1:98: INT_CONST int_const! when 21 # at line 1:108: NUM_CONST num_const! when 22 # at line 1:118: STR_CONST str_const! when 23 # at line 1:128: REF2D ref_2_d! when 24 # at line 1:134: TRUE_CONST true_const! when 25 # at line 1:145: FALSE_CONST false_const! when 26 # at line 1:157: QUOTENAME quotename! when 27 # at line 1:167: FUNC_IF func_if! when 28 # at line 1:175: FUNC_CHOOSE func_choose! when 29 # at line 1:187: NAME name! when 30 # at line 1:192: WS ws! end end |
#true_const! ⇒ Object
lexer rule true_const! (TRUE_CONST) (in ExcelFormula.g)
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 920 def true_const! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 25) type = TRUE_CONST channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 369:13: ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'E' | 'e' ) if @input.peek(1) == ?T || @input.peek(1) == ?t @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end if @input.peek(1) == ?R || @input.peek(1) == ?r @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end if @input.peek(1) == ?U || @input.peek(1) == ?u @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end if @input.peek(1) == ?E || @input.peek(1) == ?e @input.consume else mse = MismatchedSet(nil) recover(mse) raise mse end @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 25) end |
#ws! ⇒ Object
lexer rule ws! (WS) (in ExcelFormula.g)
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 |
# File 'lib/surpass/ExcelFormulaLexer.rb', line 1192 def ws! # -> uncomment the next line to manually enable rule tracing # trace_in(__method__, 32) type = WS channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 378:5: ( ' ' )+ # at file 378:5: ( ' ' )+ match_count_13 = 0 loop do alt_13 = 2 look_13_0 = @input.peek(1) if (look_13_0 == ?\s) alt_13 = 1 end case alt_13 when 1 # at line 378:6: ' ' match(?\s) else match_count_13 > 0 and break eee = EarlyExit(13) raise eee end match_count_13 += 1 end # --> action skip() # <-- action @state.type = type @state.channel = channel ensure # -> uncomment the next line to manually enable rule tracing # trace_out(__method__, 32) end |