diff options
author | Eli Bendersky <eliben@gmail.com> | 2017-02-02 20:15:21 -0800 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2017-02-02 20:15:21 -0800 |
commit | 29ef706d3c7ae75975ee1ce7ad4b51573c274c19 (patch) | |
tree | 8581cb14a6a6aca1119f8a843bf5705190ed9c40 | |
parent | 18c284431f7a50ade94950970a67d4afbf6b9084 (diff) | |
download | pycparser-29ef706d3c7ae75975ee1ce7ad4b51573c274c19.tar.gz |
Revert "Add argument to CParser.__init__ for overriding the yacc start symbol. (#159)"
This reverts commit 44137334bac69df72c6378fa84931006179d8bdf.
-rw-r--r-- | pycparser/c_parser.py | 9 | ||||
-rwxr-xr-x | tests/test_c_parser.py | 9 |
2 files changed, 2 insertions, 16 deletions
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py index 6a27ccc..a69688d 100644 --- a/pycparser/c_parser.py +++ b/pycparser/c_parser.py @@ -25,8 +25,7 @@ class CParser(PLYParser): yacc_optimize=True, yacctab='pycparser.yacctab', yacc_debug=False, - taboutputdir='', - start='translation_unit_or_empty'): + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -75,10 +74,6 @@ class CParser(PLYParser): taboutputdir: Set this parameter to control the location of generated lextab and yacctab files. - - start: - Sets the parser start symbol. By default, it is - 'translation_unit_or_empty'. """ self.clex = lexer( error_func=self._lex_error_func, @@ -114,7 +109,7 @@ class CParser(PLYParser): self.cparser = yacc.yacc( module=self, - start=start, + start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, tabmodule=yacctab, diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py index 826f875..2bd43d1 100755 --- a/tests/test_c_parser.py +++ b/tests/test_c_parser.py @@ -1898,15 +1898,6 @@ class TestCParser_typenames(TestCParser_base): self.assertRaises(ParseError, self.parse, s2) -class TestCParser_extra(unittest.TestCase): - def test_start_symbol(self): - parser = c_parser.CParser(lex_optimize=False, yacc_debug=True, - yacc_optimize=False, yacctab='yacctab', - start='expression') - ast = parser.parse("1 + 2") - assert isinstance(ast, BinaryOp) - - if __name__ == '__main__': #~ suite = unittest.TestLoader().loadTestsFromNames( #~ ['test_c_parser.TestCParser_fundamentals.test_typedef']) |