diff options
author | sienkiew <sienkiew@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2011-08-09 15:29:03 -0400 |
---|---|---|
committer | sienkiew <sienkiew@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2011-08-09 15:29:03 -0400 |
commit | aa9fc9827f379f6d0a37cdb49a7d995e14ba47c7 (patch) | |
tree | 0685b6e2690e51742048eeffa54807ff9f29303b | |
parent | e96fe3cd998e94c9c728d46190fd1d61700efd00 (diff) | |
download | exyapps-aa9fc9827f379f6d0a37cdb49a7d995e14ba47c7.tar.gz |
pass data block to parser for your code to use
git-svn-id: http://svn.stsci.edu/svn/ssb/etal/exyapps/trunk@363 d34015c8-bcbb-4646-8ac8-8ba5febf221d
-rw-r--r-- | README | 27 | ||||
-rw-r--r-- | exyapps/runtime.py | 5 |
2 files changed, 25 insertions, 7 deletions
@@ -1,10 +1,10 @@ This is exyapps, a LL(1) parser generator. -It is derived from yapps ( http://theory.stanford.edu/~amitp/yapps/ -) by Amit J. Patel <amitp@cs.stanford.edu>. He is no longer -maintaining it, and there seem to be several forks out there, all -with varying version numbers. This copy was derived from some -patches included with Debian by Matthias Urlichs <smurf@debian.org> +It is derived from yapps ( http://theory.stanford.edu/~amitp/yapps/ ) +by Amit J. Patel <amitp@cs.stanford.edu>. He is no longer maintaining +it, and there seem to be several forks out there, all with varying +version numbers. This copy was derived from some patches included +with Debian by Matthias Urlichs <smurf@debian.org> Since I want to make some of my own specific changes, I'm actually changing the name so this package can have a distinctive identity. @@ -22,6 +22,13 @@ Installing / using exyapps For now, the package is compatible with yapps; Someday, I want to make parsers run without the exyapps package installed. +VIM +-- + +Put this in .vimrc + +autocmd BufRead,BufNewFile *.exy set filetype=python + What is here? -- @@ -48,3 +55,13 @@ test not actual tests, but apparently some interesting input to run through the parser for testing + +New Features +-- + +- You can pass a data object to the parser for it to use as +parser-global data. I know the OO way is to subclass the parser +object and hope you don't accidentally override/smash anything +important, but this is easier to use in a particular application +I have in mind. + diff --git a/exyapps/runtime.py b/exyapps/runtime.py index 5d9d1d6..b0642fb 100644 --- a/exyapps/runtime.py +++ b/exyapps/runtime.py @@ -65,7 +65,7 @@ class Token(object): in_name=0 class Scanner(object): - """Yapps scanner. + """Yapps scanner. (lexical analyzer) The Yapps scanner can work in context sensitive or context insensitive modes. The token(i) method is used to retrieve the @@ -357,8 +357,9 @@ class Parser(object): """ - def __init__(self, scanner): + def __init__(self, scanner, data=None): self._scanner = scanner + self.data = data def _stack(self, input="",file=None,filename=None): """Temporarily read from someplace else""" |