summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Bendersky <eliben@users.noreply.github.com>2015-06-09 19:56:28 -0700
committerEli Bendersky <eliben@users.noreply.github.com>2015-06-09 19:56:28 -0700
commit3b888ee99a007a6e25c26ba07b1f7c9e70835a5f (patch)
tree975ca001434721784c39ed169415513974e6e15a
parent3a5bfeab5d0a4e76bb1399b0208950072b28d6af (diff)
parentec80dde76b34415c26ff53ccd21871fdafc4f900 (diff)
downloadpycparser-3b888ee99a007a6e25c26ba07b1f7c9e70835a5f.tar.gz
Merge pull request #84 from shai-xio/master
Added taboutputdir parameter to control outputdir for tab files
-rw-r--r--pycparser/c_parser.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py
index b10bba1..f4f7453 100644
--- a/pycparser/c_parser.py
+++ b/pycparser/c_parser.py
@@ -23,7 +23,8 @@ class CParser(PLYParser):
lextab='pycparser.lextab',
yacc_optimize=True,
yacctab='pycparser.yacctab',
- yacc_debug=False):
+ yacc_debug=False,
+ taboutputdir=''):
""" Create a new CParser.
Some arguments for controlling the debug/optimization
@@ -64,6 +65,10 @@ class CParser(PLYParser):
yacc_debug:
Generate a parser.out file that explains how yacc
built the parsing table from the grammar.
+
+ taboutputdir:
+ Set this parameter to control the location of generated
+ lextab and yacctab files.
"""
self.clex = CLexer(
error_func=self._lex_error_func,
@@ -73,7 +78,8 @@ class CParser(PLYParser):
self.clex.build(
optimize=lex_optimize,
- lextab=lextab)
+ lextab=lextab,
+ outputdir=taboutputdir)
self.tokens = self.clex.tokens
rules_with_opt = [
@@ -101,7 +107,8 @@ class CParser(PLYParser):
start='translation_unit_or_empty',
debug=yacc_debug,
optimize=yacc_optimize,
- tabmodule=yacctab)
+ tabmodule=yacctab,
+ outputdir=taboutputdir)
# Stack of scopes for keeping track of symbols. _scope_stack[-1] is
# the current (topmost) scope. Each scope is a dictionary that