Exemplo n.º 1
0
 def _integer(self):
     integer = self._hexadecimal_as_string() | self._decimal_as_string()
     # Python does not care about suffixes so we just drop them.
     possible_suffix = pyparsing.Literal(
         'u') | 'U' | 'll' | 'LL' | 'l' | 'L'
     maybe_suffix = (pyparsing.ZeroOrMore(possible_suffix)).suppress()
     return (integer + maybe_suffix).setParseAction(
         util.action(lambda x: int(x, base=0)))
Exemplo n.º 2
0
 def _string_literal(self):
     return (pyparsing.dblQuotedString.copy()).setParseAction(
         util.action(c_ast.CLiteral))
Exemplo n.º 3
0
 def _number(self):
     return self._integer().addParseAction(util.action(c_ast.CNumber))
Exemplo n.º 4
0
 def _nested_expression(self):
     return (pyparsing.Literal('(') + self.expression +
             pyparsing.Literal(')')).setParseAction(
                 util.action(c_ast.CNestedExpression))
Exemplo n.º 5
0
 def _variable(self):
     return (self._identifier()).addParseAction(util.action(
         c_ast.CVariable))
Exemplo n.º 6
0
 def _argument_with_dots(self):
     return (self._identifier_with_dots()).setParseAction(
         util.action(c_ast.CLiteral))
Exemplo n.º 7
0
 def _multiword_argument(self):
     return pyparsing.Group(
         self._variable() +
         pyparsing.OneOrMore(self._variable())).setParseAction(
             util.action(pre_ast.CompositeBlock))
Exemplo n.º 8
0
 def _function_call(self):
     return (~_TYPE_PROPERTY_KEYWORD + self._identifier() +
             _OPEN_PARENTHESIS + self._arguments() +
             _CLOSE_PARENTHESIS).setParseAction(
                 util.action(c_ast.CFunctionCall))
Exemplo n.º 9
0
 def _natural(self):
     return pyparsing.Word(pyparsing.nums).setParseAction(util.action(int))
Exemplo n.º 10
0
 def _natural(self):
     return pyparsing.Word(pyparsing.nums).setParseAction(util.action(int))