示例#1
0
 def _token_nud_quoted_identifier(self, token):
     field = ast.field(token['value'])
     # You can't have a quoted identifier as a function
     # name.
     if self._current_token() == 'lparen':
         t = self._lookahead_token(0)
         raise exceptions.ParseError(
             0, t['value'], t['type'],
             'Quoted identifier not allowed for function names.')
     return field
示例#2
0
 def _token_nud_quoted_identifier(self, token):
     field = ast.field(token['value'])
     # You can't have a quoted identifier as a function
     # name.
     if self._current_token() == 'lparen':
         t = self._lookahead_token(0)
         raise exceptions.ParseError(
             0, t['value'], t['type'],
             'Quoted identifier not allowed for function names.')
     return field
示例#3
0
 def _token_nud_unquoted_identifier(self, token):
     return ast.field(token['value'])
示例#4
0
 def test_or_repr(self):
     self.assert_parsed_ast(
         'foo || bar', ast.or_expression(ast.field('foo'),
                                         ast.field('bar')))
示例#5
0
 def test_quoted_subexpression(self):
     self.assert_parsed_ast(
         '"foo"."bar"',
         ast.subexpression([ast.field('foo'),
                            ast.field('bar')]))
示例#6
0
 def test_dot_syntax(self):
     self.assert_parsed_ast(
         'foo.bar', ast.subexpression([ast.field('foo'),
                                       ast.field('bar')]))
示例#7
0
 def test_field(self):
     self.assert_parsed_ast('foo', ast.field('foo'))
示例#8
0
 def test_or_repr(self):
     self.assert_parsed_ast("foo || bar", ast.or_expression(ast.field("foo"), ast.field("bar")))
示例#9
0
 def test_quoted_subexpression(self):
     self.assert_parsed_ast('"foo"."bar"', ast.subexpression([ast.field("foo"), ast.field("bar")]))
示例#10
0
 def test_dot_syntax(self):
     self.assert_parsed_ast("foo.bar", ast.subexpression([ast.field("foo"), ast.field("bar")]))
示例#11
0
 def test_field(self):
     self.assert_parsed_ast("foo", ast.field("foo"))
示例#12
0
 def test_or_repr(self):
     self.assert_parsed_ast('foo || bar', ast.or_expression(ast.field('foo'),
                                                            ast.field('bar')))
示例#13
0
 def test_dot_syntax(self):
     self.assert_parsed_ast('foo.bar',
                            ast.subexpression([ast.field('foo'),
                                               ast.field('bar')]))
示例#14
0
 def test_field(self):
     self.assert_parsed_ast('foo', ast.field('foo'))
示例#15
0
 def _token_nud_unquoted_identifier(self, token):
     return ast.field(token['value'])