@@ -244,7 +244,7 @@ def __str__(self) -> str:
244244 '_PyAST_Interactive ( a , p -> arena )' : (1 , 'factory.createInteractiveModule(a, $RANGE)' ),
245245 '_PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA )' : (1 , 'factory.createLambda(a == null ? factory.emptyArguments() : a, b, $RANGE)' ),
246246 '_PyAST_ListComp ( a , b , EXTRA )' : (1 , 'factory.createListComprehension(a, b, $RANGE)' ),
247- 'CHECK_VERSION ( expr_ty , 8 , "Assignment expressions are" , _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ) )' : (1 , 'checkVersion(8, "Assignment expressions are", factory.createNamedExp(this.check(this. setExprContext(a, ExprContextTy.Store) ), b, $RANGE))' ),
247+ 'CHECK_VERSION ( expr_ty , 8 , "Assignment expressions are" , _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ) )' : (1 , 'checkVersion(8, "Assignment expressions are", factory.createNamedExp(this.setExprContext(a, ExprContextTy.Store), b, $RANGE))' ),
248248 '_PyAST_Nonlocal ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA )' : (1 , 'factory.createNonLocal(extractNames(a), $RANGE)' ),
249249 '_PyAST_Pass ( EXTRA )' : (1 , 'factory.createPass($RANGE)' ),
250250 '_PyAST_Raise ( NULL , NULL , EXTRA )' : (1 , 'factory.createRaise(null, null, $RANGE)' ),
@@ -1020,13 +1020,6 @@ def _set_up_token_end_metadata_extraction(self) -> None:
10201020 self .add_return ("null" )
10211021 self .print ("}" )
10221022
1023- def _check_for_errors (self ) -> None :
1024- self .print ("if (errorIndicator) {" )
1025- with self .indent ():
1026- self .remove_level ();
1027- self .print ("return null;" )
1028- self .print ("}" )
1029-
10301023 def _set_up_rule_memoization (self , node : Rule , result_type : str ) -> None :
10311024 self .print ("{" )
10321025 with self .indent ():
@@ -1064,7 +1057,6 @@ def _handle_default_rule_body(self, node: Rule, rhs: Rhs, result_type: str) -> N
10641057 memoize = self ._should_memoize (node )
10651058
10661059 self .add_level ()
1067- self ._check_for_errors ()
10681060 self .print ("int _mark = mark();" )
10691061 self .print (f"Object _res = null;" )
10701062 if memoize :
@@ -1095,7 +1087,6 @@ def _handle_loop_rule_body(self, node: Rule, rhs: Rhs) -> None:
10951087 is_repeat1 = node .name .startswith ("_loop1" )
10961088
10971089 self .add_level ()
1098- self ._check_for_errors ()
10991090 self .print ("Object _res = null;" )
11001091 self .print ("int _mark = mark();" )
11011092 if memoize :
@@ -1220,15 +1211,17 @@ def emit_default_action(self, is_gather: bool, node: Alt) -> None:
12201211 f"{ self .local_variable_names [0 ]} , { self .local_variable_names [1 ]} , { element_type } .class);"
12211212 )
12221213 else :
1214+ node_str = str (node ).replace ('"' , '\\ "' )
12231215 self .printDebug (
1224- f'debugMessageln("Hit without action [%d:%d]: %s", _mark, mark(), "{ node } ");'
1216+ f'debugMessageln("Hit without action [%d:%d]: %s", _mark, mark(), "{ node_str } ");'
12251217 )
12261218 self .print (
12271219 f"_res = dummyName({ ', ' .join (self .local_variable_names )} );"
12281220 )
12291221 else :
1222+ node_str = str (node ).replace ('"' , '\\ "' )
12301223 self .printDebug (
1231- f'debugMessageln("Hit with default action [%d:%d]: %s", _mark, mark(), "{ node } ");'
1224+ f'debugMessageln("Hit with default action [%d:%d]: %s", _mark, mark(), "{ node_str } ");'
12321225 )
12331226 self .print (f"_res = { self .local_variable_names [0 ]} ;" )
12341227
@@ -1293,7 +1286,6 @@ def visit_Alt(
12931286 else :
12941287 self .print (f"{{ // { node } " )
12951288 with self .indent ():
1296- self ._check_for_errors ()
12971289 node_str = str (node ).replace ('"' , '\\ "' )
12981290 self .printDebug (
12991291 f'debugMessageln("%d> { rulename } [%d-%d]: %s", level, _mark, mark(), "{ node_str } ");'
0 commit comments