aboutsummaryrefslogtreecommitdiff
path: root/mparser.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-02-23 13:59:53 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2013-02-23 13:59:53 +0200
commitd30c2eba03a5345a206581d3172c146cb5e98501 (patch)
tree809e2fa12bdcaaf93b01492a4bc03e0caa4fa5fe /mparser.py
parenta21737cdd7e79938f80314773248f70eab470a9f (diff)
downloadmeson-d30c2eba03a5345a206581d3172c146cb5e98501.zip
meson-d30c2eba03a5345a206581d3172c146cb5e98501.tar.gz
meson-d30c2eba03a5345a206581d3172c146cb5e98501.tar.bz2
Added script to compile Meson itself.
Diffstat (limited to 'mparser.py')
-rw-r--r--[-rwxr-xr-x]mparser.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/mparser.py b/mparser.py
index 7a38ccf..499381f 100755..100644
--- a/mparser.py
+++ b/mparser.py
@@ -215,20 +215,17 @@ def test_lexer():
break
print(tok)
-def test_parser():
- code = """func_call('something', 'or else')
- objectname.methodname(abc)
-
- emptycall()"""
- print(build_ast(code))
+def generate_parser_files(outputdir):
+ code = """project('empty', 'c')
+"""
+ build_ast(code, outputdir=outputdir)
-def build_ast(code):
+def build_ast(code, outputdir=None):
code = code.rstrip() + '\n'
lex.lex()
- parser = yacc.yacc()
+ if outputdir:
+ parser = yacc.yacc(outputdir=outputdir)
+ else:
+ parser = yacc.yacc()
result = parser.parse(code)
return result
-
-if __name__ == '__main__':
- #test_lexer()
- test_parser()