diff options
author | eli.bendersky <devnull@localhost> | 2011-03-04 09:51:23 +0200 |
---|---|---|
committer | eli.bendersky <devnull@localhost> | 2011-03-04 09:51:23 +0200 |
commit | fc96e5e750fe78919d937f2189c5f49b1692c394 (patch) | |
tree | bfe67fbf949834a691dae3ce653e00b38343cb13 /pycparser/c_parser.py | |
parent | ae36e9629694dd6dc12b2f03f4856f9cd90896f6 (diff) | |
download | pycparser-fc96e5e750fe78919d937f2189c5f49b1692c394.tar.gz |
fixing issue 23: coords of casts
Diffstat (limited to 'pycparser/c_parser.py')
-rw-r--r-- | pycparser/c_parser.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py index 500f4a7..98afe61 100644 --- a/pycparser/c_parser.py +++ b/pycparser/c_parser.py @@ -874,7 +874,8 @@ class CParser(PLYParser): spec = p[1] decl = c_ast.Typename( quals=spec['qual'], - type=p[2] or c_ast.TypeDecl(None, None, None)) + type=p[2] or c_ast.TypeDecl(None, None, None), + coord=self._coord(p.lineno(2))) typename = spec['type'] or ['int'] p[0] = self._fix_decl_name_type(decl, typename) @@ -943,7 +944,8 @@ class CParser(PLYParser): typename = c_ast.Typename( quals=p[1]['qual'], - type=p[2] or c_ast.TypeDecl(None, None, None)) + type=p[2] or c_ast.TypeDecl(None, None, None), + coord=self._coord(p.lineno(2))) p[0] = self._fix_decl_name_type(typename, p[1]['type']) @@ -1205,7 +1207,7 @@ class CParser(PLYParser): def p_cast_expression_2(self, p): """ cast_expression : LPAREN type_name RPAREN cast_expression """ - p[0] = c_ast.Cast(p[2], p[4], p[2].coord) + p[0] = c_ast.Cast(p[2], p[4], self._coord(p.lineno(1))) def p_unary_expression_1(self, p): """ unary_expression : postfix_expression """ |