Module: Liquor::Lexer
- Defined in:
- lib/liquor/grammar/lexer.rb
Class Attribute Summary collapse
-
._liquor_actions ⇒ Object
Returns the value of attribute _liquor_actions.
-
._liquor_eof_actions ⇒ Object
Returns the value of attribute _liquor_eof_actions.
-
._liquor_eof_trans ⇒ Object
Returns the value of attribute _liquor_eof_trans.
-
._liquor_from_state_actions ⇒ Object
Returns the value of attribute _liquor_from_state_actions.
-
._liquor_index_offsets ⇒ Object
Returns the value of attribute _liquor_index_offsets.
-
._liquor_indicies ⇒ Object
Returns the value of attribute _liquor_indicies.
-
._liquor_key_offsets ⇒ Object
Returns the value of attribute _liquor_key_offsets.
-
._liquor_range_lengths ⇒ Object
Returns the value of attribute _liquor_range_lengths.
-
._liquor_single_lengths ⇒ Object
Returns the value of attribute _liquor_single_lengths.
-
._liquor_to_state_actions ⇒ Object
Returns the value of attribute _liquor_to_state_actions.
-
._liquor_trans_actions ⇒ Object
Returns the value of attribute _liquor_trans_actions.
-
._liquor_trans_keys ⇒ Object
Returns the value of attribute _liquor_trans_keys.
-
._liquor_trans_targs ⇒ Object
Returns the value of attribute _liquor_trans_targs.
-
.liquor_en_code ⇒ Object
Returns the value of attribute liquor_en_code.
-
.liquor_en_comment ⇒ Object
Returns the value of attribute liquor_en_comment.
-
.liquor_en_dqstring ⇒ Object
Returns the value of attribute liquor_en_dqstring.
-
.liquor_en_integer ⇒ Object
Returns the value of attribute liquor_en_integer.
-
.liquor_en_plaintext ⇒ Object
Returns the value of attribute liquor_en_plaintext.
-
.liquor_en_sqstring ⇒ Object
Returns the value of attribute liquor_en_sqstring.
-
.liquor_en_tag_start ⇒ Object
Returns the value of attribute liquor_en_tag_start.
-
.liquor_error ⇒ Object
Returns the value of attribute liquor_error.
-
.liquor_first_final ⇒ Object
Returns the value of attribute liquor_first_final.
-
.liquor_start ⇒ Object
Returns the value of attribute liquor_start.
Class Method Summary collapse
-
.lex(data, name = '(code)', registered_tags = {}) ⇒ Object
line 217 “lib/liquor/grammar/lexer.rl”.
Class Attribute Details
._liquor_actions ⇒ Object
Returns the value of attribute _liquor_actions.
12 13 14 |
# File 'lib/liquor/grammar/lexer.rb', line 12 def _liquor_actions @_liquor_actions end |
._liquor_eof_actions ⇒ Object
Returns the value of attribute _liquor_eof_actions.
207 208 209 |
# File 'lib/liquor/grammar/lexer.rb', line 207 def _liquor_eof_actions @_liquor_eof_actions end |
._liquor_eof_trans ⇒ Object
Returns the value of attribute _liquor_eof_trans.
219 220 221 |
# File 'lib/liquor/grammar/lexer.rb', line 219 def _liquor_eof_trans @_liquor_eof_trans end |
._liquor_from_state_actions ⇒ Object
Returns the value of attribute _liquor_from_state_actions.
195 196 197 |
# File 'lib/liquor/grammar/lexer.rb', line 195 def _liquor_from_state_actions @_liquor_from_state_actions end |
._liquor_index_offsets ⇒ Object
Returns the value of attribute _liquor_index_offsets.
102 103 104 |
# File 'lib/liquor/grammar/lexer.rb', line 102 def _liquor_index_offsets @_liquor_index_offsets end |
._liquor_indicies ⇒ Object
Returns the value of attribute _liquor_indicies.
114 115 116 |
# File 'lib/liquor/grammar/lexer.rb', line 114 def _liquor_indicies @_liquor_indicies end |
._liquor_key_offsets ⇒ Object
Returns the value of attribute _liquor_key_offsets.
38 39 40 |
# File 'lib/liquor/grammar/lexer.rb', line 38 def _liquor_key_offsets @_liquor_key_offsets end |
._liquor_range_lengths ⇒ Object
Returns the value of attribute _liquor_range_lengths.
90 91 92 |
# File 'lib/liquor/grammar/lexer.rb', line 90 def _liquor_range_lengths @_liquor_range_lengths end |
._liquor_single_lengths ⇒ Object
Returns the value of attribute _liquor_single_lengths.
78 79 80 |
# File 'lib/liquor/grammar/lexer.rb', line 78 def _liquor_single_lengths @_liquor_single_lengths end |
._liquor_to_state_actions ⇒ Object
Returns the value of attribute _liquor_to_state_actions.
183 184 185 |
# File 'lib/liquor/grammar/lexer.rb', line 183 def _liquor_to_state_actions @_liquor_to_state_actions end |
._liquor_trans_actions ⇒ Object
Returns the value of attribute _liquor_trans_actions.
163 164 165 |
# File 'lib/liquor/grammar/lexer.rb', line 163 def _liquor_trans_actions @_liquor_trans_actions end |
._liquor_trans_keys ⇒ Object
Returns the value of attribute _liquor_trans_keys.
50 51 52 |
# File 'lib/liquor/grammar/lexer.rb', line 50 def _liquor_trans_keys @_liquor_trans_keys end |
._liquor_trans_targs ⇒ Object
Returns the value of attribute _liquor_trans_targs.
143 144 145 |
# File 'lib/liquor/grammar/lexer.rb', line 143 def _liquor_trans_targs @_liquor_trans_targs end |
.liquor_en_code ⇒ Object
Returns the value of attribute liquor_en_code.
264 265 266 |
# File 'lib/liquor/grammar/lexer.rb', line 264 def liquor_en_code @liquor_en_code end |
.liquor_en_comment ⇒ Object
Returns the value of attribute liquor_en_comment.
244 245 246 |
# File 'lib/liquor/grammar/lexer.rb', line 244 def liquor_en_comment @liquor_en_comment end |
.liquor_en_dqstring ⇒ Object
Returns the value of attribute liquor_en_dqstring.
248 249 250 |
# File 'lib/liquor/grammar/lexer.rb', line 248 def liquor_en_dqstring @liquor_en_dqstring end |
.liquor_en_integer ⇒ Object
Returns the value of attribute liquor_en_integer.
256 257 258 |
# File 'lib/liquor/grammar/lexer.rb', line 256 def liquor_en_integer @liquor_en_integer end |
.liquor_en_plaintext ⇒ Object
Returns the value of attribute liquor_en_plaintext.
268 269 270 |
# File 'lib/liquor/grammar/lexer.rb', line 268 def liquor_en_plaintext @liquor_en_plaintext end |
.liquor_en_sqstring ⇒ Object
Returns the value of attribute liquor_en_sqstring.
252 253 254 |
# File 'lib/liquor/grammar/lexer.rb', line 252 def liquor_en_sqstring @liquor_en_sqstring end |
.liquor_en_tag_start ⇒ Object
Returns the value of attribute liquor_en_tag_start.
260 261 262 |
# File 'lib/liquor/grammar/lexer.rb', line 260 def liquor_en_tag_start @liquor_en_tag_start end |
.liquor_error ⇒ Object
Returns the value of attribute liquor_error.
239 240 241 |
# File 'lib/liquor/grammar/lexer.rb', line 239 def liquor_error @liquor_error end |
.liquor_first_final ⇒ Object
Returns the value of attribute liquor_first_final.
235 236 237 |
# File 'lib/liquor/grammar/lexer.rb', line 235 def liquor_first_final @liquor_first_final end |
.liquor_start ⇒ Object
Returns the value of attribute liquor_start.
231 232 233 |
# File 'lib/liquor/grammar/lexer.rb', line 231 def liquor_start @liquor_start end |
Class Method Details
.lex(data, name = '(code)', registered_tags = {}) ⇒ Object
line 217 “lib/liquor/grammar/lexer.rl”
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 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 917 918 919 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 976 977 978 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 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 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 1189 1190 1191 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 |
# File 'lib/liquor/grammar/lexer.rb', line 275 def self.lex(data, name='(code)', ={}) eof = data.length ts = nil # token start te = nil # token end stack = [] # Strings string = "" str_start = nil runaway = false # Tags kw_stop = nil line_starts = [0] find_line_start = ->(index) { line_starts. each_index.find { |i| line_starts[i + 1].nil? || line_starts[i + 1] > index } } loc = ->(index) { line_start_index = find_line_start.(index) [ line_start_index, index - line_starts[line_start_index] ] } # Tag stack tag_stack = [] tag_conts = [] last_tag = nil update_tag_cont = ->() { tag = tag_stack.last if .include?(tag) tag_conts = [tag].continuations end } push_last_tag = ->() { if last_tag tag_stack.push last_tag last_tag = nil update_tag_cont.() end } pop_tag = ->() { tag_stack.pop update_tag_cont.() } tokens = [] fixtok = ->(new_type) { tokens.last[0] = new_type } tok = ->(type, data=nil, ={}) { sl, sc, el, ec = *loc.([:ts] || ts), *loc.([:te] || te - 1) tokens << [type, { file: name, line: sl, start: sc, end: ec }, *data] } # line 338 "lib/liquor/grammar/lexer.rb" begin p ||= 0 pe ||= data.length cs = liquor_start top = 0 ts = nil te = nil act = 0 end # line 280 "lib/liquor/grammar/lexer.rl" # line 351 "lib/liquor/grammar/lexer.rb" begin _klen, _trans, _keys, _acts, _nacts = nil _goto_level = 0 _resume = 10 _eof_trans = 15 _again = 20 _test_eof = 30 _out = 40 while true _trigger_goto = false if _goto_level <= 0 if p == pe _goto_level = _test_eof next end end if _goto_level <= _resume _acts = _liquor_from_state_actions[cs] _nacts = _liquor_actions[_acts] _acts += 1 while _nacts > 0 _nacts -= 1 _acts += 1 case _liquor_actions[_acts - 1] when 4 then # line 1 "NONE" begin ts = p end # line 381 "lib/liquor/grammar/lexer.rb" end # from state action switch end if _trigger_goto next end _keys = _liquor_key_offsets[cs] _trans = _liquor_index_offsets[cs] _klen = _liquor_single_lengths[cs] _break_match = false begin if _klen > 0 _lower = _keys _upper = _keys + _klen - 1 loop do break if _upper < _lower _mid = _lower + ( (_upper - _lower) >> 1 ) if data[p].ord < _liquor_trans_keys[_mid] _upper = _mid - 1 elsif data[p].ord > _liquor_trans_keys[_mid] _lower = _mid + 1 else _trans += (_mid - _keys) _break_match = true break end end # loop break if _break_match _keys += _klen _trans += _klen end _klen = _liquor_range_lengths[cs] if _klen > 0 _lower = _keys _upper = _keys + (_klen << 1) - 2 loop do break if _upper < _lower _mid = _lower + (((_upper-_lower) >> 1) & ~1) if data[p].ord < _liquor_trans_keys[_mid] _upper = _mid - 2 elsif data[p].ord > _liquor_trans_keys[_mid+1] _lower = _mid + 2 else _trans += ((_mid - _keys) >> 1) _break_match = true break end end # loop break if _break_match _trans += _klen end end while false _trans = _liquor_indicies[_trans] end if _goto_level <= _eof_trans cs = _liquor_trans_targs[_trans] if _liquor_trans_actions[_trans] != 0 _acts = _liquor_trans_actions[_trans] _nacts = _liquor_actions[_acts] _acts += 1 while _nacts > 0 _nacts -= 1 _acts += 1 case _liquor_actions[_acts - 1] when 0 then # line 5 "lib/liquor/grammar/lexer.rl" begin line_starts.push(p + 1) end when 2 then # line 136 "lib/liquor/grammar/lexer.rl" begin kw_stop = p end when 5 then # line 1 "NONE" begin te = p+1 end when 6 then # line 54 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin begin stack[top] = cs top+= 1 cs = 11 _trigger_goto = true _goto_level = _again break end end end when 7 then # line 55 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin begin top -= 1 cs = stack[top] _trigger_goto = true _goto_level = _again break end end end when 8 then # line 56 "lib/liquor/grammar/lexer.rl" begin te = p+1 end when 9 then # line 56 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; end when 10 then # line 60 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin string << '"' end end when 11 then # line 61 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin string << '\\' end end when 12 then # line 27 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:string, string.dup, ts: str_start) string.clear begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 13 then # line 23 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin string << data[p] end end when 14 then # line 37 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin symbol = data[p] if symbol == "\n" symbol = "end of line" else symbol = "`#{symbol.inspect[1..-2]}'" end error = SyntaxError.new("unexpected #{symbol}", file: name, line: line_starts.count - 1, start: p - line_starts.last, end: p - line_starts.last) raise error end end when 15 then # line 23 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin string << data[p] end end when 16 then # line 69 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin string << "'" end end when 17 then # line 70 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin string << '\\' end end when 18 then # line 27 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:string, string.dup, ts: str_start) string.clear begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 19 then # line 23 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin string << data[p] end end when 20 then # line 37 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin symbol = data[p] if symbol == "\n" symbol = "end of line" else symbol = "`#{symbol.inspect[1..-2]}'" end error = SyntaxError.new("unexpected #{symbol}", file: name, line: line_starts.count - 1, start: p - line_starts.last, end: p - line_starts.last) raise error end end when 21 then # line 23 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin string << data[p] end end when 22 then # line 37 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin symbol = data[p] if symbol == "\n" symbol = "end of line" else symbol = "`#{symbol.inspect[1..-2]}'" end error = SyntaxError.new("unexpected #{symbol}", file: name, line: line_starts.count - 1, start: p - line_starts.last, end: p - line_starts.last) raise error end end when 23 then # line 80 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin p = p - 1; begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 24 then # line 78 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:integer, data[ts...te].to_i) end end when 25 then # line 105 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin fixtok.(:lblock2) tok.(:keyword, data[ts...te - 1]) begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 26 then # line 126 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin p = p - 1; begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 27 then # line 84 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; end when 28 then # line 87 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tag = data[ts + 4...te] if tag_stack.last == tag fixtok.(:lblock2) tok.(:endtag) pop_tag.() else (sl, sc), (el, ec) = loc.(ts), loc.(te - 1) info = { file: name, line: sl, start: sc, end: ec } if tag_stack.any? raise SyntaxError.new("unmatched `end #{tag}', expected `end #{tag_stack.last}'", info) else raise SyntaxError.new("unexpected `end #{tag}'", info) end end begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 29 then # line 111 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tag = data[ts...te] if tag_conts.include? tag fixtok.(:lblock2) tok.(:keyword, tag) begin cs = 27 _trigger_goto = true _goto_level = _again break end end tok.(:ident, tag) last_tag = tag begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 30 then # line 111 "lib/liquor/grammar/lexer.rl" begin begin p = ((te))-1; end begin tag = data[ts...te] if tag_conts.include? tag fixtok.(:lblock2) tok.(:keyword, tag) begin cs = 27 _trigger_goto = true _goto_level = _again break end end tok.(:ident, tag) last_tag = tag begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 31 then # line 134 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin p = p - 1; begin cs = 18 _trigger_goto = true _goto_level = _again break end end end when 32 then # line 137 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:keyword, data[ts...kw_stop], te: kw_stop) tok.(:rblock, nil, ts: te - 2) push_last_tag.() begin cs = 6 _trigger_goto = true _goto_level = _again break end end end when 33 then # line 147 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:keyword, '=', te: ts + 1) tok.(:rblock, nil, ts: te - 2) push_last_tag.() begin cs = 6 _trigger_goto = true _goto_level = _again break end end end when 34 then # line 157 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:comma) end end when 35 then # line 158 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:dot) end end when 36 then # line 160 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:lbracket) end end when 37 then # line 161 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:rbracket) end end when 38 then # line 163 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:lparen) end end when 39 then # line 164 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:rparen) end end when 40 then # line 168 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_plus) end end when 41 then # line 169 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_minus) end end when 42 then # line 170 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_mul) end end when 43 then # line 171 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_div) end end when 44 then # line 174 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_eq) end end when 45 then # line 175 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_neq) end end when 46 then # line 177 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_geq) end end when 47 then # line 179 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_leq) end end when 48 then # line 183 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_and) end end when 49 then # line 184 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:op_or) end end when 50 then # line 186 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin str_start = p; begin cs = 14 _trigger_goto = true _goto_level = _again break end end end when 51 then # line 187 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin str_start = p; begin cs = 16 _trigger_goto = true _goto_level = _again break end end end when 52 then # line 189 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:rinterp); begin cs = 6 _trigger_goto = true _goto_level = _again break end end end when 53 then # line 190 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:rblock); last_tag = nil; begin cs = 6 _trigger_goto = true _goto_level = _again break end end end when 54 then # line 37 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin symbol = data[p] if symbol == "\n" symbol = "end of line" else symbol = "`#{symbol.inspect[1..-2]}'" end error = SyntaxError.new("unexpected #{symbol}", file: name, line: line_starts.count - 1, start: p - line_starts.last, end: p - line_starts.last) raise error end end when 55 then # line 130 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; end when 56 then # line 132 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:ident, data[ts...te]) end end when 57 then # line 144 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:keyword, data[ts...te-1]) end end when 58 then # line 155 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:keyword, '=') end end when 59 then # line 166 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:pipe) end end when 60 then # line 172 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:op_mod) end end when 61 then # line 176 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:op_gt) end end when 62 then # line 178 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:op_lt) end end when 63 then # line 181 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:op_not) end end when 64 then # line 37 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin symbol = data[p] if symbol == "\n" symbol = "end of line" else symbol = "`#{symbol.inspect[1..-2]}'" end error = SyntaxError.new("unexpected #{symbol}", file: name, line: line_starts.count - 1, start: p - line_starts.last, end: p - line_starts.last) raise error end end when 65 then # line 144 "lib/liquor/grammar/lexer.rl" begin begin p = ((te))-1; end begin tok.(:keyword, data[ts...te-1]) end end when 66 then # line 155 "lib/liquor/grammar/lexer.rl" begin begin p = ((te))-1; end begin tok.(:keyword, '=') end end when 67 then # line 200 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:linterp); begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 68 then # line 203 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin tok.(:lblock); begin cs = 20 _trigger_goto = true _goto_level = _again break end end end when 69 then # line 206 "lib/liquor/grammar/lexer.rl" begin te = p+1 begin begin stack[top] = cs top+= 1 cs = 11 _trigger_goto = true _goto_level = _again break end end end when 70 then # line 197 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin tok.(:plaintext, data[ts...te]); end end when 71 then # line 209 "lib/liquor/grammar/lexer.rl" begin te = p p = p - 1; begin p = p - 1; begin cs = 27 _trigger_goto = true _goto_level = _again break end end end when 72 then # line 197 "lib/liquor/grammar/lexer.rl" begin begin p = ((te))-1; end begin tok.(:plaintext, data[ts...te]); end end # line 1141 "lib/liquor/grammar/lexer.rb" end # action switch end end if _trigger_goto next end end if _goto_level <= _again _acts = _liquor_to_state_actions[cs] _nacts = _liquor_actions[_acts] _acts += 1 while _nacts > 0 _nacts -= 1 _acts += 1 case _liquor_actions[_acts - 1] when 3 then # line 1 "NONE" begin ts = nil; end # line 1161 "lib/liquor/grammar/lexer.rb" end # to state action switch end if _trigger_goto next end p += 1 if p != pe _goto_level = _resume next end end if _goto_level <= _test_eof if p == eof if _liquor_eof_trans[cs] > 0 _trans = _liquor_eof_trans[cs] - 1; _goto_level = _eof_trans next; end __acts = _liquor_eof_actions[cs] __nacts = _liquor_actions[__acts] __acts += 1 while __nacts > 0 __nacts -= 1 __acts += 1 case _liquor_actions[__acts - 1] when 1 then # line 33 "lib/liquor/grammar/lexer.rl" begin runaway = true end # line 1193 "lib/liquor/grammar/lexer.rb" end # eof action switch end if _trigger_goto next end end end if _goto_level <= _out break end end end # line 281 "lib/liquor/grammar/lexer.rl" if runaway line_start_index = find_line_start.(str_start) line_start = line_starts[line_start_index] error = SyntaxError.new("literal not terminated", file: name, line: line_start_index, start: str_start - line_start, end: str_start - line_start) raise error end tokens end |