Diff of /pyke/krb_compiler/krbparser.py [9c0a10] .. [f16399]  Maximize  Restore

Switch to unified view

a/pyke/krb_compiler/krbparser.py b/pyke/krb_compiler/krbparser.py
...
...
43
    p[0] = p[1]
43
    p[0] = p[1]
44
44
45
def p_goal(p):
45
def p_goal(p):
46
    ''' python_goal : CHECK_TOK IDENTIFIER_TOK '.' IDENTIFIER_TOK LP_TOK patterns_opt RP_TOK
46
    ''' python_goal : CHECK_TOK IDENTIFIER_TOK '.' IDENTIFIER_TOK LP_TOK patterns_opt RP_TOK
47
    '''
47
    '''
48
    p[0] = (p[2], p[4], p[6], python_vars, pattern_vars)
48
    p[0] = (p[2], p[4], p[6], pattern_vars)
49
49
50
def p_file(p):
50
def p_file(p):
51
    ''' file : nl_opt parent_opt fc_rules bc_rules_opt
51
    ''' file : nl_opt parent_opt fc_rules bc_rules_opt
52
    '''
52
    '''
53
    p[0] = ('file', p[2], (tuple(p[3]), ()), p[4])
53
    p[0] = ('file', p[2], (tuple(p[3]), ()), p[4])
...
...
379
    if goal_mode:
379
    if goal_mode:
380
        pattern_vars.append(p[1])
380
        pattern_vars.append(p[1])
381
        p[0] = contexts.variable(p[1])
381
        p[0] = contexts.variable(p[1])
382
    else:
382
    else:
383
        p[0] = "contexts.variable(%s)" % p[1]
383
        p[0] = "contexts.variable(%s)" % p[1]
384
385
def p_python_var(p):
386
    ''' variable : PYTHON_VAR_TOK
387
    '''
388
    global python_vars
389
    python_vars.append(p[1])
390
    p[0] = contexts.variable(p[1])
391
384
392
def p_anonymous_var(p):
385
def p_anonymous_var(p):
393
    ''' variable : ANONYMOUS_VAR_TOK
386
    ''' variable : ANONYMOUS_VAR_TOK
394
    '''
387
    '''
395
    if goal_mode:
388
    if goal_mode:
...
...
607
        #parser.restart()
600
        #parser.restart()
608
        return parser.parse(f.read(), lexer=scanner.lexer, tracking=True,
601
        return parser.parse(f.read(), lexer=scanner.lexer, tracking=True,
609
                            debug=debug)
602
                            debug=debug)
610
603
611
def parse_goal(this_module, s, check_tables = False, debug = 0):
604
def parse_goal(this_module, s, check_tables = False, debug = 0):
612
    global goal_mode, python_vars, pattern_vars
605
    global goal_mode, pattern_vars
613
    init(this_module, check_tables, debug)
606
    init(this_module, check_tables, debug)
614
    scanner.init(scanner, debug, check_tables)
607
    scanner.init(scanner, debug, check_tables)
615
    scanner.lexer.lineno = 1
608
    scanner.lexer.lineno = 1
616
    scanner.lexer.filename = s
609
    scanner.lexer.filename = s
617
    scanner.kfb_mode = False
610
    scanner.kfb_mode = False
618
    scanner.goal_mode = True
611
    scanner.goal_mode = True
619
    goal_mode = True
612
    goal_mode = True
620
    python_vars = []
621
    pattern_vars = []
613
    pattern_vars = []
622
    #parser.restart()
614
    #parser.restart()
623
    return parser.parse('check ' + s, lexer=scanner.lexer, tracking=True,
615
    return parser.parse('check ' + s, lexer=scanner.lexer, tracking=True,
624
                        debug=debug)
616
                        debug=debug)
625
617

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks