diff options
author | Eli Bendersky <eliben@users.noreply.github.com> | 2016-07-26 04:23:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-26 04:23:21 -0700 |
commit | 4f604f513a4649e2538749cb2c7064c0716b757a (patch) | |
tree | 872414ce4bf3900d5f3c4ca60c301937d1607cff | |
parent | ffd8cb7dfc4b80c79a500e27736db8f7bfc1186e (diff) | |
parent | d443b2736344ae0ff6f9dc4b933dd0c86966b7a6 (diff) | |
download | pycparser-4f604f513a4649e2538749cb2c7064c0716b757a.tar.gz |
Merge pull request #133 from esoma/master
Allow user to decide which lexer the parser uses.
-rw-r--r-- | pycparser/c_parser.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py index 5c17a74..d02e577 100644 --- a/pycparser/c_parser.py +++ b/pycparser/c_parser.py @@ -20,6 +20,7 @@ class CParser(PLYParser): def __init__( self, lex_optimize=True, + lexer=CLexer, lextab='pycparser.lextab', yacc_optimize=True, yacctab='pycparser.yacctab', @@ -41,7 +42,11 @@ class CParser(PLYParser): When releasing with a stable lexer, set to True to save the re-generation of the lexer table on each run. - + + lexer: + Set this parameter to define the lexer to use if + you're not using the default CLexer. + lextab: Points to the lex table that's used for optimized mode. Only if you're modifying the lexer and want @@ -70,7 +75,7 @@ class CParser(PLYParser): Set this parameter to control the location of generated lextab and yacctab files. """ - self.clex = CLexer( + self.clex = lexer( error_func=self._lex_error_func, on_lbrace_func=self._lex_on_lbrace_func, on_rbrace_func=self._lex_on_rbrace_func, |