Esempio n. 1
0
    def visit_prefix(self, node, children):
        if len(children) == 2:
            if children[0] == NOT:
                retval = Not()
            else:
                retval = And()
            if type(children[1]) is list:
                retval.nodes = children[1]
            else:
                retval.nodes = [children[1]]
        else:
            # If there is no optional prefix reduce.
            retval = children[0]

        return retval
Esempio n. 2
0
    def visit_prefix(self, node, children):
        if len(children) == 2:
            if children[0] == NOT:
                retval = Not()
            else:
                retval = And()
            if type(children[1]) is list:
                retval.nodes = children[1]
            else:
                retval.nodes = [children[1]]
        else:
            # If there is no optional prefix reduce.
            retval = children[0]

        return retval
Esempio n. 3
0
 def visit_expression(self, node, children):
     if len(children) == 1:
         return children[0]
     if children[0] == '!':
         return Not(nodes=[children[1]])
     else:
         return And(nodes=[children[1]])
Esempio n. 4
0
def expression():
    return [
        # regex,
        arg_identifier,
        (OPEN, ordered_choice, CLOSE),
        str_match
    ], Not(ASSIGNMENT)
Esempio n. 5
0
def function_type_args() -> GrammarType:
    return Optional([
        # The `Not` rule is necessary to prevent the full_type rule to match, that prevents Arpeggio
        # to try the variadic dots rule
        Sequence(OneOrMore(full_type, Not('...'), sep=','),
                 Optional(',', Optional(full_type), function_variadic_dots)),
        Sequence(Optional(full_type), function_variadic_dots)
    ]), trailing_comma
Esempio n. 6
0
def expression_SA(parser, node, children):
    if len(children) > 1:
        if children[0] == '!':
            return Not(nodes=[children[1]])
        else:
            return And(nodes=[children[1]])
    else:
        return children[0]
Esempio n. 7
0
def option_help():
    return Sequence((
        Not(space),
        any_until_eol,
    ), rule_name='option_help')
Esempio n. 8
0
def MyNum():
    return (
        Not('0'),
        RegExMatch('[0-9]+'),
    )
Esempio n. 9
0
def case_value():       return Not( 'Else' ), expr # Any expr but the keyword 'Else'


# Def<Type> rules
def range_type_decl():  return var_type, var_ranges
Esempio n. 10
0
def Identifier():
    return (Not(ReservedWord), RegExMatch(r'[A-Za-z_][A-Za-z0-9_]*'))
 def grammar():
     return [Not(['two', 'three']), 'one', 'two'], _(r'\w+')
Esempio n. 12
0
def HelpCommand():
    return Combine(['help', 'h', '?'], Not(Identifier))
 def grammar():
     return ['one', Not('two')], _(r'\w+')
Esempio n. 14
0
def function_declaration() -> GrammarType:
    return Optional('cdecl'), function_prototype, Not('{')
Esempio n. 15
0
def QuitCommand():
    return Combine(['quit', 'exit', 'q'], Not(Identifier))
Esempio n. 16
0
def pattern_identifier(): return Not(ellipsis), symbol
def ellipsis(): return "..."
Esempio n. 17
0
def variable(): return Not(syntactic_keyword), identifier

def literal(): return [quotation , self_valuating]
Esempio n. 18
0
def ListVarsCommand():
    return Combine(['variables', 'vars', 'v'], Not(Identifier))
Esempio n. 19
0
def identifier() -> GrammarType:
    return Not(builtin_keyword), [builtin_type,
                                  RegExMatch(r'[A-Za-z_][A-Za-z0-9_]*', str_repr='identifier')]
Esempio n. 20
0
def expression():
    return [regex, rule_crossref, (OPEN, ordered_choice, CLOSE),
            str_match], Not(ASSIGNMENT)
Esempio n. 21
0
def option_description_intro():
    # return OneOrMore ( Sequence ( ( Not(option_line_start), wx, text_line ) ),
    return OneOrMore(Sequence(
        (Not(option_line_start), wx, any_until_end_of_line)),
                     rule_name='option_description_intro',
                     skipws=False)
Esempio n. 22
0
def print_expr():       return Not( 'Using' ), expr # Any expr but the keyword 'Using'
def print_sep():        return [ ',', ';' ]
 def grammar():
     return Not('one'), Not('two'), _(r'\w+')
Esempio n. 24
0
def case_block():       return Not([ ( 'End', 'Select' ), 'Case' ]), [ ( labels, statement ), statement ], ZeroOrMore( statement_sep, case_block )
def end_case_block():   return And( new_line, [ ( 'End', 'Select' ), 'Case' ] )
 def grammar():
     return "a", Not("b"), ["b", "c"], EOF
Esempio n. 26
0
def case_intvl_value(): return Not( 'To' ), expr # Any expr but the keyword 'To'
def case_value():       return Not( 'Else' ), expr # Any expr but the keyword 'Else'
Esempio n. 27
0
def ol_space():
    return Sequence(space, Not(space), rule_name='ol_space', skipws=False)
Esempio n. 28
0
def expression():       return [regex, rule_crossref,
                                (OPEN, ordered_choice, CLOSE),
                                str_match], Not(ASSIGNMENT)

# PEG Lexical rules
def regex():            return [("r'", _(r'''[^'\\]*(?:\\.[^'\\]*)*'''), "'"),