Class: ZunScript::Parser
- Inherits:
-
ANTLR3::Parser
- Object
- ANTLR3::Parser
- ZunScript::Parser
- Includes:
- ANTLR3::ASTBuilder, TokenData
- Defined in:
- ext/zunscript/parser.rb
Defined Under Namespace
Classes: DFA6
Constant Summary collapse
- RULE_METHODS =
[ :script, :line, :comment, :open_expression, :closed_expression, :variable, :value, :block, :block_body, :arguments, :assign, :invoke, :bind, :closed_invoke, :closed_bind, :params, :param, :synpred5_ZunScript, :synpred6_ZunScript, :synpred7_ZunScript ].freeze
- ScriptReturnValue =
-
Rules - - - - - - - - - - - - -
-
define_return_scope- LineReturnValue =
define_return_scope- CommentReturnValue =
define_return_scope- OpenExpressionReturnValue =
define_return_scope- ClosedExpressionReturnValue =
define_return_scope- VariableReturnValue =
define_return_scope- ValueReturnValue =
define_return_scope- BlockReturnValue =
define_return_scope- BlockBodyReturnValue =
define_return_scope- ArgumentsReturnValue =
define_return_scope- AssignReturnValue =
define_return_scope- InvokeReturnValue =
define_return_scope- BindReturnValue =
define_return_scope- ClosedInvokeReturnValue =
define_return_scope- ClosedBindReturnValue =
define_return_scope- ParamsReturnValue =
define_return_scope- ParamReturnValue =
define_return_scope
Instance Method Summary collapse
-
#arguments ⇒ Object
parser rule arguments.
-
#assign ⇒ Object
parser rule assign.
-
#bind ⇒ Object
parser rule bind.
-
#block ⇒ Object
parser rule block.
-
#block_body ⇒ Object
parser rule block_body.
-
#closed_bind ⇒ Object
parser rule closed_bind.
-
#closed_expression ⇒ Object
parser rule closed_expression.
-
#closed_invoke ⇒ Object
parser rule closed_invoke.
-
#comment ⇒ Object
parser rule comment.
-
#initialize(input, options = {}) ⇒ Parser
constructor
A new instance of Parser.
-
#invoke ⇒ Object
parser rule invoke.
-
#line ⇒ Object
parser rule line.
-
#open_expression ⇒ Object
parser rule open_expression.
-
#param ⇒ Object
parser rule param.
-
#params ⇒ Object
parser rule params.
-
#script ⇒ Object
parser rule script.
-
#synpred5_ZunScript ⇒ Object
syntactic predicate synpred5_ZunScript.
-
#synpred6_ZunScript ⇒ Object
syntactic predicate synpred6_ZunScript.
-
#synpred7_ZunScript ⇒ Object
syntactic predicate synpred7_ZunScript.
-
#value ⇒ Object
parser rule value.
-
#variable ⇒ Object
parser rule variable.
Constructor Details
#initialize(input, options = {}) ⇒ Parser
Returns a new instance of Parser.
115 116 117 |
# File 'ext/zunscript/parser.rb', line 115 def initialize( input, = {} ) super( input, ) end |
Instance Method Details
#arguments ⇒ Object
parser rule arguments
(in ZunScript.g) 71:1: arguments : (| NAME ( COMMA ! NAME )* );
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 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 |
# File 'ext/zunscript/parser.rb', line 1221 def arguments # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 10 ) return_value = ArgumentsReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __NAME29__ = nil __COMMA30__ = nil __NAME31__ = nil tree_for_NAME29 = nil tree_for_COMMA30 = nil tree_for_NAME31 = nil begin # at line 71:10: (| NAME ( COMMA ! NAME )* ) alt_11 = 2 look_11_0 = @input.peek( 1 ) if ( look_11_0 == NEWLINE ) alt_11 = 1 elsif ( look_11_0 == NAME ) alt_11 = 2 else @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed ) raise NoViableAlternative( "", 11, 0 ) end case alt_11 when 1 root_0 = @adaptor.create_flat_list # at line 71:12: when 2 root_0 = @adaptor.create_flat_list # at line 71:13: NAME ( COMMA ! NAME )* __NAME29__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_arguments_591 ) if @state.backtracking == 0 tree_for_NAME29 = @adaptor.create_with_payload( __NAME29__ ) @adaptor.add_child( root_0, tree_for_NAME29 ) end # at line 71:18: ( COMMA ! NAME )* while true # decision 10 alt_10 = 2 look_10_0 = @input.peek( 1 ) if ( look_10_0 == COMMA ) alt_10 = 1 end case alt_10 when 1 # at line 71:19: COMMA ! NAME __COMMA30__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_arguments_594 ) __NAME31__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_arguments_597 ) if @state.backtracking == 0 tree_for_NAME31 = @adaptor.create_with_payload( __NAME31__ ) @adaptor.add_child( root_0, tree_for_NAME31 ) end else break # out of loop for decision 10 end end # loop for decision 10 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 10 ) end return return_value end |
#assign ⇒ Object
parser rule assign
(in ZunScript.g) 73:1: assign : variable ASSIGN open_expression -> ^( ASSIGN variable open_expression ) ;
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 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 |
# File 'ext/zunscript/parser.rb', line 1341 def assign # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 11 ) return_value = AssignReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __ASSIGN33__ = nil variable32 = nil open_expression34 = nil tree_for_ASSIGN33 = nil stream_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token ASSIGN" ) stream_open_expression = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule open_expression" ) stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" ) begin # at line 74:5: variable ASSIGN open_expression @state.following.push( TOKENS_FOLLOWING_variable_IN_assign_610 ) variable32 = variable @state.following.pop if @state.backtracking == 0 stream_variable.add( variable32.tree ) end __ASSIGN33__ = match( ASSIGN, TOKENS_FOLLOWING_ASSIGN_IN_assign_612 ) if @state.backtracking == 0 stream_ASSIGN.add( __ASSIGN33__ ) end @state.following.push( TOKENS_FOLLOWING_open_expression_IN_assign_614 ) open_expression34 = open_expression @state.following.pop if @state.backtracking == 0 stream_open_expression.add( open_expression34.tree ) end # AST Rewrite # elements: variable, open_expression, ASSIGN # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 74:37: -> ^( ASSIGN variable open_expression ) # at line 74:40: ^( ASSIGN variable open_expression ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( stream_ASSIGN.next_node, root_1 ) @adaptor.add_child( root_1, stream_variable.next_tree ) @adaptor.add_child( root_1, stream_open_expression.next_tree ) @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 11 ) end return return_value end |
#bind ⇒ Object
parser rule bind
(in ZunScript.g) 78:1: bind : variable params -> ^( BIND variable ( params )* ) ;
1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 |
# File 'ext/zunscript/parser.rb', line 1563 def bind # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 13 ) return_value = BindReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil variable38 = nil params39 = nil stream_params = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule params" ) stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" ) begin # at line 79:5: variable params @state.following.push( TOKENS_FOLLOWING_variable_IN_bind_660 ) variable38 = variable @state.following.pop if @state.backtracking == 0 stream_variable.add( variable38.tree ) end @state.following.push( TOKENS_FOLLOWING_params_IN_bind_662 ) params39 = params @state.following.pop if @state.backtracking == 0 stream_params.add( params39.tree ) end # AST Rewrite # elements: variable, params # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 79:21: -> ^( BIND variable ( params )* ) # at line 79:24: ^( BIND variable ( params )* ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( BIND, "BIND" ), root_1 ) @adaptor.add_child( root_1, stream_variable.next_tree ) # at line 79:40: ( params )* while stream_params.has_next? @adaptor.add_child( root_1, stream_params.next_tree ) end stream_params.reset(); @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 13 ) end return return_value end |
#block ⇒ Object
parser rule block
(in ZunScript.g) 68:1: block : BLOCK_RIGHT arguments NEWLINE block_body BLOCK_END -> ^( BLK ( arguments )* block_body ) ;
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 |
# File 'ext/zunscript/parser.rb', line 978 def block # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 8 ) return_value = BlockReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __BLOCK_RIGHT23__ = nil __NEWLINE25__ = nil __BLOCK_END27__ = nil arguments24 = nil block_body26 = nil tree_for_BLOCK_RIGHT23 = nil tree_for_NEWLINE25 = nil tree_for_BLOCK_END27 = nil stream_BLOCK_RIGHT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BLOCK_RIGHT" ) stream_NEWLINE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token NEWLINE" ) stream_BLOCK_END = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BLOCK_END" ) stream_arguments = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule arguments" ) stream_block_body = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule block_body" ) begin # at line 68:8: BLOCK_RIGHT arguments NEWLINE block_body BLOCK_END __BLOCK_RIGHT23__ = match( BLOCK_RIGHT, TOKENS_FOLLOWING_BLOCK_RIGHT_IN_block_548 ) if @state.backtracking == 0 stream_BLOCK_RIGHT.add( __BLOCK_RIGHT23__ ) end @state.following.push( TOKENS_FOLLOWING_arguments_IN_block_550 ) arguments24 = arguments @state.following.pop if @state.backtracking == 0 stream_arguments.add( arguments24.tree ) end __NEWLINE25__ = match( NEWLINE, TOKENS_FOLLOWING_NEWLINE_IN_block_552 ) if @state.backtracking == 0 stream_NEWLINE.add( __NEWLINE25__ ) end @state.following.push( TOKENS_FOLLOWING_block_body_IN_block_554 ) block_body26 = block_body @state.following.pop if @state.backtracking == 0 stream_block_body.add( block_body26.tree ) end __BLOCK_END27__ = match( BLOCK_END, TOKENS_FOLLOWING_BLOCK_END_IN_block_556 ) if @state.backtracking == 0 stream_BLOCK_END.add( __BLOCK_END27__ ) end # AST Rewrite # elements: block_body, arguments # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 68:59: -> ^( BLK ( arguments )* block_body ) # at line 68:62: ^( BLK ( arguments )* block_body ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( BLK, "BLK" ), root_1 ) # at line 68:68: ( arguments )* while stream_arguments.has_next? @adaptor.add_child( root_1, stream_arguments.next_tree ) end stream_arguments.reset(); @adaptor.add_child( root_1, stream_block_body.next_tree ) @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 8 ) end return return_value end |
#block_body ⇒ Object
parser rule block_body
(in ZunScript.g) 69:1: block_body : ( line )* -> ^( BODY ( line )* ) ;
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 |
# File 'ext/zunscript/parser.rb', line 1108 def block_body # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 9 ) return_value = BlockBodyReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil line28 = nil stream_line = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule line" ) begin # at line 69:13: ( line )* # at line 69:13: ( line )* while true # decision 9 alt_9 = 2 look_9_0 = @input.peek( 1 ) if ( look_9_0 == BLOCK_RIGHT || look_9_0 == COMMENT || look_9_0.between?( LPAREN, NEWLINE ) || look_9_0 == NUMBER || look_9_0 == STRING ) alt_9 = 1 end case alt_9 when 1 # at line 69:13: line @state.following.push( TOKENS_FOLLOWING_line_IN_block_body_573 ) line28 = line @state.following.pop if @state.backtracking == 0 stream_line.add( line28.tree ) end else break # out of loop for decision 9 end end # loop for decision 9 # AST Rewrite # elements: line # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 69:19: -> ^( BODY ( line )* ) # at line 69:22: ^( BODY ( line )* ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( BODY, "BODY" ), root_1 ) # at line 69:29: ( line )* while stream_line.has_next? @adaptor.add_child( root_1, stream_line.next_tree ) end stream_line.reset(); @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 9 ) end return return_value end |
#closed_bind ⇒ Object
parser rule closed_bind
(in ZunScript.g) 82:1: closed_bind : variable param -> ^( BIND variable param ) ;
1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 |
# File 'ext/zunscript/parser.rb', line 1795 def closed_bind # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 15 ) return_value = ClosedBindReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil variable43 = nil param44 = nil stream_param = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule param" ) stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" ) begin # at line 83:5: variable param @state.following.push( TOKENS_FOLLOWING_variable_IN_closed_bind_710 ) variable43 = variable @state.following.pop if @state.backtracking == 0 stream_variable.add( variable43.tree ) end @state.following.push( TOKENS_FOLLOWING_param_IN_closed_bind_712 ) param44 = param @state.following.pop if @state.backtracking == 0 stream_param.add( param44.tree ) end # AST Rewrite # elements: variable, param # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 83:20: -> ^( BIND variable param ) # at line 83:23: ^( BIND variable param ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( BIND, "BIND" ), root_1 ) @adaptor.add_child( root_1, stream_variable.next_tree ) @adaptor.add_child( root_1, stream_param.next_tree ) @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 15 ) end return return_value end |
#closed_expression ⇒ Object
parser rule closed_expression
(in ZunScript.g) 57:1: closed_expression : ( value | variable | closed_invoke | closed_bind | LPAREN ! open_expression RPAREN !);
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 |
# File 'ext/zunscript/parser.rb', line 554 def closed_expression # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 5 ) return_value = ClosedExpressionReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __LPAREN16__ = nil __RPAREN18__ = nil value12 = nil variable13 = nil closed_invoke14 = nil closed_bind15 = nil open_expression17 = nil tree_for_LPAREN16 = nil tree_for_RPAREN18 = nil begin # at line 57:18: ( value | variable | closed_invoke | closed_bind | LPAREN ! open_expression RPAREN !) alt_6 = 5 alt_6 = @dfa6.predict( @input ) case alt_6 when 1 root_0 = @adaptor.create_flat_list # at line 58:5: value @state.following.push( TOKENS_FOLLOWING_value_IN_closed_expression_449 ) value12 = value @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, value12.tree ) end when 2 root_0 = @adaptor.create_flat_list # at line 58:13: variable @state.following.push( TOKENS_FOLLOWING_variable_IN_closed_expression_453 ) variable13 = variable @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, variable13.tree ) end when 3 root_0 = @adaptor.create_flat_list # at line 58:24: closed_invoke @state.following.push( TOKENS_FOLLOWING_closed_invoke_IN_closed_expression_457 ) closed_invoke14 = closed_invoke @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, closed_invoke14.tree ) end when 4 root_0 = @adaptor.create_flat_list # at line 58:40: closed_bind @state.following.push( TOKENS_FOLLOWING_closed_bind_IN_closed_expression_461 ) closed_bind15 = closed_bind @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, closed_bind15.tree ) end when 5 root_0 = @adaptor.create_flat_list # at line 59:5: LPAREN ! open_expression RPAREN ! __LPAREN16__ = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_closed_expression_467 ) @state.following.push( TOKENS_FOLLOWING_open_expression_IN_closed_expression_470 ) open_expression17 = open_expression @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, open_expression17.tree ) end __RPAREN18__ = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_closed_expression_472 ) end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 5 ) end return return_value end |
#closed_invoke ⇒ Object
parser rule closed_invoke
(in ZunScript.g) 80:1: closed_invoke : variable BANG ( param )? -> ^( INVOKE variable ( param )* ) ;
1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 |
# File 'ext/zunscript/parser.rb', line 1669 def closed_invoke # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 14 ) return_value = ClosedInvokeReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __BANG41__ = nil variable40 = nil param42 = nil tree_for_BANG41 = nil stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BANG" ) stream_param = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule param" ) stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" ) begin # at line 81:5: variable BANG ( param )? @state.following.push( TOKENS_FOLLOWING_variable_IN_closed_invoke_684 ) variable40 = variable @state.following.pop if @state.backtracking == 0 stream_variable.add( variable40.tree ) end __BANG41__ = match( BANG, TOKENS_FOLLOWING_BANG_IN_closed_invoke_686 ) if @state.backtracking == 0 stream_BANG.add( __BANG41__ ) end # at line 81:19: ( param )? alt_12 = 2 look_12_0 = @input.peek( 1 ) if ( look_12_0 == BLOCK_RIGHT || look_12_0.between?( LPAREN, NAME ) || look_12_0 == NUMBER || look_12_0 == STRING ) alt_12 = 1 end case alt_12 when 1 # at line 81:19: param @state.following.push( TOKENS_FOLLOWING_param_IN_closed_invoke_688 ) param42 = param @state.following.pop if @state.backtracking == 0 stream_param.add( param42.tree ) end end # AST Rewrite # elements: param, variable # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 81:26: -> ^( INVOKE variable ( param )* ) # at line 81:29: ^( INVOKE variable ( param )* ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( INVOKE, "INVOKE" ), root_1 ) @adaptor.add_child( root_1, stream_variable.next_tree ) # at line 81:47: ( param )* while stream_param.has_next? @adaptor.add_child( root_1, stream_param.next_tree ) end stream_param.reset(); @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 14 ) end return return_value end |
#comment ⇒ Object
parser rule comment
(in ZunScript.g) 53:1: comment : COMMENT (~ NEWLINE )* ;
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 |
# File 'ext/zunscript/parser.rb', line 307 def comment # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 3 ) return_value = CommentReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __COMMENT6__ = nil set7 = nil tree_for_COMMENT6 = nil tree_for_set7 = nil begin root_0 = @adaptor.create_flat_list # at line 53:10: COMMENT (~ NEWLINE )* __COMMENT6__ = match( COMMENT, TOKENS_FOLLOWING_COMMENT_IN_comment_410 ) if @state.backtracking == 0 tree_for_COMMENT6 = @adaptor.create_with_payload( __COMMENT6__ ) @adaptor.add_child( root_0, tree_for_COMMENT6 ) end # at line 53:18: (~ NEWLINE )* while true # decision 4 alt_4 = 2 look_4_0 = @input.peek( 1 ) if ( look_4_0.between?( ARITH_SIGN, NAME ) || look_4_0.between?( NONCONTROL_CHAR, T__38 ) ) alt_4 = 1 end case alt_4 when 1 # at line set7 = @input.look if @input.peek( 1 ).between?( ARITH_SIGN, NAME ) || @input.peek( 1 ).between?( NONCONTROL_CHAR, T__38 ) @input.consume if @state.backtracking == 0 @adaptor.add_child( root_0, @adaptor.create_with_payload( set7 ) ) end @state.error_recovery = false else @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed ) mse = MismatchedSet( nil ) raise mse end else break # out of loop for decision 4 end end # loop for decision 4 # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 3 ) end return return_value end |
#invoke ⇒ Object
parser rule invoke
(in ZunScript.g) 76:1: invoke : variable BANG params -> ^( INVOKE variable ( params )* ) ;
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 |
# File 'ext/zunscript/parser.rb', line 1449 def invoke # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 12 ) return_value = InvokeReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __BANG36__ = nil variable35 = nil params37 = nil tree_for_BANG36 = nil stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token BANG" ) stream_params = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule params" ) stream_variable = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, "rule variable" ) begin # at line 77:5: variable BANG params @state.following.push( TOKENS_FOLLOWING_variable_IN_invoke_635 ) variable35 = variable @state.following.pop if @state.backtracking == 0 stream_variable.add( variable35.tree ) end __BANG36__ = match( BANG, TOKENS_FOLLOWING_BANG_IN_invoke_637 ) if @state.backtracking == 0 stream_BANG.add( __BANG36__ ) end @state.following.push( TOKENS_FOLLOWING_params_IN_invoke_639 ) params37 = params @state.following.pop if @state.backtracking == 0 stream_params.add( params37.tree ) end # AST Rewrite # elements: variable, params # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 77:26: -> ^( INVOKE variable ( params )* ) # at line 77:29: ^( INVOKE variable ( params )* ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( INVOKE, "INVOKE" ), root_1 ) @adaptor.add_child( root_1, stream_variable.next_tree ) # at line 77:47: ( params )* while stream_params.has_next? @adaptor.add_child( root_1, stream_params.next_tree ) end stream_params.reset(); @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 12 ) end return return_value end |
#line ⇒ Object
parser rule line
(in ZunScript.g) 51:1: line : ( open_expression )? ( comment !)? NEWLINE !;
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 |
# File 'ext/zunscript/parser.rb', line 212 def line # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 2 ) return_value = LineReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __NEWLINE5__ = nil open_expression3 = nil comment4 = nil tree_for_NEWLINE5 = nil begin root_0 = @adaptor.create_flat_list # at line 51:7: ( open_expression )? ( comment !)? NEWLINE ! # at line 51:7: ( open_expression )? alt_2 = 2 look_2_0 = @input.peek( 1 ) if ( look_2_0 == BLOCK_RIGHT || look_2_0.between?( LPAREN, NAME ) || look_2_0 == NUMBER || look_2_0 == STRING ) alt_2 = 1 end case alt_2 when 1 # at line 51:7: open_expression @state.following.push( TOKENS_FOLLOWING_open_expression_IN_line_395 ) open_expression3 = open_expression @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, open_expression3.tree ) end end # at line 51:31: ( comment !)? alt_3 = 2 look_3_0 = @input.peek( 1 ) if ( look_3_0 == COMMENT ) alt_3 = 1 end case alt_3 when 1 # at line 51:31: comment ! @state.following.push( TOKENS_FOLLOWING_comment_IN_line_398 ) comment4 = comment @state.following.pop end __NEWLINE5__ = match( NEWLINE, TOKENS_FOLLOWING_NEWLINE_IN_line_402 ) # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 2 ) end return return_value end |
#open_expression ⇒ Object
parser rule open_expression
(in ZunScript.g) 55:1: open_expression : ( assign | invoke | bind | closed_expression );
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 |
# File 'ext/zunscript/parser.rb', line 412 def open_expression # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 4 ) return_value = OpenExpressionReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil assign8 = nil invoke9 = nil bind10 = nil closed_expression11 = nil begin # at line 55:16: ( assign | invoke | bind | closed_expression ) alt_5 = 4 look_5_0 = @input.peek( 1 ) if ( look_5_0 == NAME ) look_5_1 = @input.peek( 2 ) if ( syntactic_predicate?( :synpred5_ZunScript ) ) alt_5 = 1 elsif ( syntactic_predicate?( :synpred6_ZunScript ) ) alt_5 = 2 elsif ( syntactic_predicate?( :synpred7_ZunScript ) ) alt_5 = 3 elsif ( true ) alt_5 = 4 else @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed ) raise NoViableAlternative( "", 5, 1 ) end elsif ( look_5_0 == BLOCK_RIGHT || look_5_0 == LPAREN || look_5_0 == NUMBER || look_5_0 == STRING ) alt_5 = 4 else @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed ) raise NoViableAlternative( "", 5, 0 ) end case alt_5 when 1 root_0 = @adaptor.create_flat_list # at line 56:5: assign @state.following.push( TOKENS_FOLLOWING_assign_IN_open_expression_427 ) assign8 = assign @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, assign8.tree ) end when 2 root_0 = @adaptor.create_flat_list # at line 56:14: invoke @state.following.push( TOKENS_FOLLOWING_invoke_IN_open_expression_431 ) invoke9 = invoke @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, invoke9.tree ) end when 3 root_0 = @adaptor.create_flat_list # at line 56:23: bind @state.following.push( TOKENS_FOLLOWING_bind_IN_open_expression_435 ) bind10 = bind @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, bind10.tree ) end when 4 root_0 = @adaptor.create_flat_list # at line 56:30: closed_expression @state.following.push( TOKENS_FOLLOWING_closed_expression_IN_open_expression_439 ) closed_expression11 = closed_expression @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, closed_expression11.tree ) end end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 4 ) end return return_value end |
#param ⇒ Object
parser rule param
(in ZunScript.g) 87:1: param : closed_expression ;
1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 |
# File 'ext/zunscript/parser.rb', line 1988 def param # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 17 ) return_value = ParamReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil closed_expression48 = nil begin root_0 = @adaptor.create_flat_list # at line 87:8: closed_expression @state.following.push( TOKENS_FOLLOWING_closed_expression_IN_param_747 ) closed_expression48 = closed_expression @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, closed_expression48.tree ) end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 17 ) end return return_value end |
#params ⇒ Object
parser rule params
(in ZunScript.g) 85:1: params : param ( COMMA ! param )* ;
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 |
# File 'ext/zunscript/parser.rb', line 1895 def params # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 16 ) return_value = ParamsReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __COMMA46__ = nil param45 = nil param47 = nil tree_for_COMMA46 = nil begin root_0 = @adaptor.create_flat_list # at line 86:5: param ( COMMA ! param )* @state.following.push( TOKENS_FOLLOWING_param_IN_params_733 ) param45 = param @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, param45.tree ) end # at line 86:11: ( COMMA ! param )* while true # decision 13 alt_13 = 2 look_13_0 = @input.peek( 1 ) if ( look_13_0 == COMMA ) alt_13 = 1 end case alt_13 when 1 # at line 86:12: COMMA ! param __COMMA46__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_params_736 ) @state.following.push( TOKENS_FOLLOWING_param_IN_params_739 ) param47 = param @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, param47.tree ) end else break # out of loop for decision 13 end end # loop for decision 13 # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 16 ) end return return_value end |
#script ⇒ Object
parser rule script
(in ZunScript.g) 50:1: script : ( line )* EOF !;
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 |
# File 'ext/zunscript/parser.rb', line 127 def script # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 1 ) return_value = ScriptReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __EOF2__ = nil line1 = nil tree_for_EOF2 = nil begin root_0 = @adaptor.create_flat_list # at line 50:9: ( line )* EOF ! # at line 50:9: ( line )* while true # decision 1 alt_1 = 2 look_1_0 = @input.peek( 1 ) if ( look_1_0 == BLOCK_RIGHT || look_1_0 == COMMENT || look_1_0.between?( LPAREN, NEWLINE ) || look_1_0 == NUMBER || look_1_0 == STRING ) alt_1 = 1 end case alt_1 when 1 # at line 50:9: line @state.following.push( TOKENS_FOLLOWING_line_IN_script_385 ) line1 = line @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, line1.tree ) end else break # out of loop for decision 1 end end # loop for decision 1 __EOF2__ = match( EOF, TOKENS_FOLLOWING_EOF_IN_script_388 ) # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 1 ) end return return_value end |
#synpred5_ZunScript ⇒ Object
syntactic predicate synpred5_ZunScript
(in ZunScript.g) 56:5: synpred5_ZunScript : assign ;
This is an imaginary rule inserted by ANTLR to implement a syntactic predicate decision
2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 |
# File 'ext/zunscript/parser.rb', line 2053 def synpred5_ZunScript # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 22 ) # at line 56:5: assign @state.following.push( TOKENS_FOLLOWING_assign_IN_synpred5_ZunScript_427 ) assign @state.following.pop ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 22 ) end |
#synpred6_ZunScript ⇒ Object
syntactic predicate synpred6_ZunScript
(in ZunScript.g) 56:14: synpred6_ZunScript : invoke ;
This is an imaginary rule inserted by ANTLR to implement a syntactic predicate decision
2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 |
# File 'ext/zunscript/parser.rb', line 2078 def synpred6_ZunScript # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 23 ) # at line 56:14: invoke @state.following.push( TOKENS_FOLLOWING_invoke_IN_synpred6_ZunScript_431 ) invoke @state.following.pop ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 23 ) end |
#synpred7_ZunScript ⇒ Object
syntactic predicate synpred7_ZunScript
(in ZunScript.g) 56:23: synpred7_ZunScript : bind ;
This is an imaginary rule inserted by ANTLR to implement a syntactic predicate decision
2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 |
# File 'ext/zunscript/parser.rb', line 2103 def synpred7_ZunScript # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 24 ) # at line 56:23: bind @state.following.push( TOKENS_FOLLOWING_bind_IN_synpred7_ZunScript_435 ) bind @state.following.pop ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 24 ) end |
#value ⇒ Object
parser rule value
(in ZunScript.g) 63:1: value : (v= NUMBER -> ^( NUM $v) |v= STRING -> ^( STR $v) | block );
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 |
# File 'ext/zunscript/parser.rb', line 819 def value # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 7 ) return_value = ValueReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil v = nil block22 = nil tree_for_v = nil stream_STRING = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token STRING" ) stream_NUMBER = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token NUMBER" ) begin # at line 63:6: (v= NUMBER -> ^( NUM $v) |v= STRING -> ^( STR $v) | block ) alt_8 = 3 case look_8 = @input.peek( 1 ) when NUMBER then alt_8 = 1 when STRING then alt_8 = 2 when BLOCK_RIGHT then alt_8 = 3 else @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed ) raise NoViableAlternative( "", 8, 0 ) end case alt_8 when 1 # at line 64:5: v= NUMBER v = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_value_509 ) if @state.backtracking == 0 stream_NUMBER.add( v ) end # AST Rewrite # elements: v # token labels: v # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_v = token_stream( "token v", v ) stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 64:14: -> ^( NUM $v) # at line 64:17: ^( NUM $v) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( NUM, "NUM" ), root_1 ) @adaptor.add_child( root_1, stream_v.next_node ) @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end when 2 # at line 65:5: v= STRING v = match( STRING, TOKENS_FOLLOWING_STRING_IN_value_526 ) if @state.backtracking == 0 stream_STRING.add( v ) end # AST Rewrite # elements: v # token labels: v # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_v = token_stream( "token v", v ) stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 65:14: -> ^( STR $v) # at line 65:17: ^( STR $v) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( STR, "STR" ), root_1 ) @adaptor.add_child( root_1, stream_v.next_node ) @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end when 3 root_0 = @adaptor.create_flat_list # at line 66:5: block @state.following.push( TOKENS_FOLLOWING_block_IN_value_541 ) block22 = block @state.following.pop if @state.backtracking == 0 @adaptor.add_child( root_0, block22.tree ) end end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 7 ) end return return_value end |
#variable ⇒ Object
parser rule variable
(in ZunScript.g) 61:1: variable : ( NAME ‘.’ )* NAME -> ^( VARIABLE ( NAME )* ) ;
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 |
# File 'ext/zunscript/parser.rb', line 686 def variable # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 6 ) return_value = VariableReturnValue.new # $rule.start = the first token seen before matching return_value.start = @input.look root_0 = nil __NAME19__ = nil char_literal20 = nil __NAME21__ = nil tree_for_NAME19 = nil tree_for_char_literal20 = nil tree_for_NAME21 = nil stream_NAME = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token NAME" ) stream_T__38 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, "token T__38" ) begin # at line 61:11: ( NAME '.' )* NAME # at line 61:11: ( NAME '.' )* while true # decision 7 alt_7 = 2 look_7_0 = @input.peek( 1 ) if ( look_7_0 == NAME ) look_7_1 = @input.peek( 2 ) if ( look_7_1 == T__38 ) alt_7 = 1 end end case alt_7 when 1 # at line 61:12: NAME '.' __NAME19__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_variable_481 ) if @state.backtracking == 0 stream_NAME.add( __NAME19__ ) end char_literal20 = match( T__38, TOKENS_FOLLOWING_T__38_IN_variable_483 ) if @state.backtracking == 0 stream_T__38.add( char_literal20 ) end else break # out of loop for decision 7 end end # loop for decision 7 __NAME21__ = match( NAME, TOKENS_FOLLOWING_NAME_IN_variable_487 ) if @state.backtracking == 0 stream_NAME.add( __NAME21__ ) end # AST Rewrite # elements: NAME # token labels: # rule labels: return_value # token list labels: # rule list labels: # wildcard labels: if @state.backtracking == 0 return_value.tree = root_0 stream_return_value = return_value ? subtree_stream( "rule return_value", return_value.tree ) : subtree_stream( "token return_value" ) root_0 = @adaptor.create_flat_list # 61:28: -> ^( VARIABLE ( NAME )* ) # at line 61:31: ^( VARIABLE ( NAME )* ) root_1 = @adaptor.create_flat_list root_1 = @adaptor.become_root( @adaptor.create_from_type( VARIABLE, "VARIABLE" ), root_1 ) # at line 61:42: ( NAME )* while stream_NAME.has_next? @adaptor.add_child( root_1, stream_NAME.next_node ) end stream_NAME.reset(); @adaptor.add_child( root_0, root_1 ) return_value.tree = root_0 end # - - - - - - - rule clean up - - - - - - - - return_value.stop = @input.look( -1 ) if @state.backtracking == 0 return_value.tree = @adaptor.rule_post_processing( root_0 ) @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop ) end rescue ANTLR3::Error::RecognitionError => re report_error(re) recover(re) return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re ) ensure # -> uncomment the next line to manually enable rule tracing # trace_out( __method__, 6 ) end return return_value end |