def __init__(self, debug=False): self.global_scope = SymbolTable(ast.EmptyNode(), globalFunctionTable) self.scopes = [self.global_scope] self.linenos = [1] self.line_num = 0 self.debug = debug self.runtime_error = False
def __init__(self, debug=False, mark_used=False): self.global_scope = SymbolTable(ast.EmptyNode(), globalFunctionTable) self.scopes = [self.global_scope] self.debug = debug self.runtime_error = False self.freeze_constant_folding = False self.freeze_set_constant = False self.check_constant_outer = False self.check_constant_self = False self.mark_used = mark_used
def p_root_section_opt_1(self, p): '''root_section_opt : empty''' p[0] = ast.EmptyNode()
def p_jump_statement_1(self, p): '''jump_statement : RETURN SEMICOLON''' linespan = (p.linespan(1)[0], p.linespan(2)[1]) p[0] = ast.Return(ast.EmptyNode(), linespan=linespan)
def p_conditional_statement_1(self, p): '''conditional_statement : IF PAREN_L expression PAREN_R section_wrapper %prec IFS''' linespan = (p.linespan(1)[0], p[5].linespan[1]) p[0] = ast.ConditionalStatement(p[3], p[5], ast.EmptyNode(), linespan=linespan)
def p_function_simple_declarator_2(self, p): '''function_simple_declarator : ID PAREN_L PAREN_R | ID PAREN_L VOID PAREN_R''' linespan = (p.linespan(1)[0], p.linespan(len(p) - 1)[1]) p[0] = ast.FnDeclarator(p[1], ast.EmptyNode(), linespan=linespan)