예제 #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'])