[Pkg-privacy-commits] [torbrowser-launcher] 134/476: added python lib depenendencies that aren't packaged in debian, to allow twisted to use a socks proxy

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:21:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository torbrowser-launcher.

commit 249f8c0309cf2f88572130ee51fa0f2f8f16741e
Author: Micah Lee <micahflee at riseup.net>
Date:   Wed May 15 09:35:25 2013 -0700

    added python lib depenendencies that aren't packaged in debian, to allow twisted to use a socks proxy
---
 .gitignore                                         |    2 -
 lib/Parsley-1.1/LICENSE                            |   24 +
 lib/Parsley-1.1/NEWS                               |   69 +
 lib/Parsley-1.1/PKG-INFO                           |  135 ++
 lib/Parsley-1.1/README                             |  125 ++
 lib/Parsley-1.1/doc/Makefile                       |  153 ++
 lib/Parsley-1.1/doc/calc.py                        |   42 +
 lib/Parsley-1.1/doc/conf.py                        |  242 ++++
 lib/Parsley-1.1/doc/extending.rst                  |   25 +
 lib/Parsley-1.1/doc/index.rst                      |   17 +
 lib/Parsley-1.1/doc/reference.rst                  |   94 ++
 lib/Parsley-1.1/doc/test_calc.py                   |    9 +
 lib/Parsley-1.1/doc/tutorial.rst                   |  381 +++++
 lib/Parsley-1.1/doc/tutorial2.rst                  |  134 ++
 lib/Parsley-1.1/examples/minml.py                  |   28 +
 lib/Parsley-1.1/examples/parsley_json.py           |   31 +
 lib/Parsley-1.1/examples/test_parsley_json.py      |   39 +
 lib/Parsley-1.1/ometa/__init__.py                  |    0
 lib/Parsley-1.1/ometa/_generated/__init__.py       |    0
 lib/Parsley-1.1/ometa/_generated/parsley.py        |  969 +++++++++++++
 .../ometa/_generated/parsley_termactions.py        |   97 ++
 .../ometa/_generated/parsley_tree_transformer.py   |  486 +++++++
 lib/Parsley-1.1/ometa/_generated/pymeta_v1.py      |  779 ++++++++++
 lib/Parsley-1.1/ometa/builder.py                   |  418 ++++++
 lib/Parsley-1.1/ometa/compat.py                    |    8 +
 lib/Parsley-1.1/ometa/grammar.py                   |   80 ++
 lib/Parsley-1.1/ometa/interp.py                    |  648 +++++++++
 lib/Parsley-1.1/ometa/runtime.py                   | 1057 ++++++++++++++
 lib/Parsley-1.1/ometa/test/__init__.py             |    0
 lib/Parsley-1.1/ometa/test/test_builder.py         |  368 +++++
 lib/Parsley-1.1/ometa/test/test_pymeta.py          | 1487 ++++++++++++++++++++
 lib/Parsley-1.1/ometa/test/test_runtime.py         |  284 ++++
 lib/Parsley-1.1/parsley.py                         |   86 ++
 lib/Parsley-1.1/setup.py                           |   20 +
 lib/Parsley-1.1/terml/README.txt                   |   63 +
 lib/Parsley-1.1/terml/__init__.py                  |    0
 lib/Parsley-1.1/terml/_generated/__init__.py       |    0
 lib/Parsley-1.1/terml/_generated/quasiterm.py      |  417 ++++++
 lib/Parsley-1.1/terml/_generated/terml.py          | 1151 +++++++++++++++
 lib/Parsley-1.1/terml/nodes.py                     |  141 ++
 lib/Parsley-1.1/terml/parser.py                    |  103 ++
 lib/Parsley-1.1/terml/qnodes.py                    |  235 ++++
 lib/Parsley-1.1/terml/quasiterm.py                 |   66 +
 lib/Parsley-1.1/terml/test/__init__.py             |    0
 lib/Parsley-1.1/terml/test/test_quasiterm.py       |   52 +
 lib/Parsley-1.1/terml/test/test_terml.py           |  156 ++
 lib/txsocksx-0.0.2/LICENSE                         |   10 +
 lib/txsocksx-0.0.2/MANIFEST.in                     |    1 +
 lib/txsocksx-0.0.2/PKG-INFO                        |   10 +
 lib/txsocksx-0.0.2/setup.cfg                       |    5 +
 lib/txsocksx-0.0.2/setup.py                        |   10 +
 lib/txsocksx-0.0.2/txsocksx/__init__.py            |    0
 lib/txsocksx-0.0.2/txsocksx/auth.py                |   41 +
 lib/txsocksx-0.0.2/txsocksx/client.py              |  195 +++
 lib/txsocksx-0.0.2/txsocksx/constants.py           |   10 +
 lib/txsocksx-0.0.2/txsocksx/errors.py              |   73 +
 lib/txsocksx-0.0.2/txsocksx/parser.py              |  112 ++
 lib/txsocksx-0.0.2/txsocksx/ssl.py                 |   14 +
 setup.py                                           |   20 +-
 torbrowser-launcher                                |    8 +-
 60 files changed, 11226 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index d9a800f..0de63fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,8 +16,6 @@ var
 sdist
 develop-eggs
 .installed.cfg
-lib
-lib64
 MANIFEST
 
 # Installer logs
diff --git a/lib/Parsley-1.1/LICENSE b/lib/Parsley-1.1/LICENSE
new file mode 100644
index 0000000..0a63ae6
--- /dev/null
+++ b/lib/Parsley-1.1/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2008-2012
+Allen Short
+Waldemar Kornewald
+
+Soli Deo Gloria.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/lib/Parsley-1.1/NEWS b/lib/Parsley-1.1/NEWS
new file mode 100644
index 0000000..e4315a3
--- /dev/null
+++ b/lib/Parsley-1.1/NEWS
@@ -0,0 +1,69 @@
+1.1.0 (2013-03-03):
+ - The 'spaces' rule has been provided under the alias 'ws'; 'spaces'
+   is now the deprecated name.
+ - Single quotes can now be used around multiple characters to match
+   them consecutively. For example, 'abc' is equivalent 'a' 'b' 'c'.
+ - The 'token' rule is thus deprecated as well, since "token('foo')"
+   is more typing than "ws 'foo'".
+ - Hex escapes can now be used in literals for matching bytes.
+ - 'makeGrammar' now takes an 'unwrap' argument, to get a grammar
+   class suitable for subclassing.
+ - 'makeGrammar' also takes an 'extends' argument that can be either a
+   regular python class or a wrapped Parsley grammar, for simple
+   subclassing.
+ - 'repeat' expressions now work for 0 repetitions properly.
+ - ometa.runtime.TIMING flag added for enabling debug output of
+   grammar load times.
+ - OMeta version 1 parser moved to ometa.compat.
+ - Twine removed.
+ - Various bugfixes around error reporting.
+ - Parsley no longer loads its internal grammars at import time. The
+   'stage' script in bin/ is used to regenerate the compiled versions
+   after modification.
+ - Experimental tree transformer grammars, with special syntax for
+   destructuring terms and creating string templates, have been added.
+
+1.0.0 (2012-10-01):
+ - PyMeta is now Parsley.
+ - A new public API has been added in the 'parsley' module.
+ - Grammars now use the OMeta 2 syntax by default. Compatibility is
+   available via ometa.grammar.OMeta1.
+ - A generic AST-handling library has been added, 'terml'.
+ - Grammars now parse to term trees instead of nested lists. The code
+   generator has accordingly been greatly simplified.
+ - A grammar interpreter has been added, which parses by evaluating
+   the grammar term tree directly instead of generating a class.
+ - A push parser has been added which accepts data in arbitrary
+   chunks, maintaining state while waiting for more input.
+
+0.4.0 (2010-05-15):
+ - Builders now work from a grammar AST, rather than being driven by
+   the grammar parser directly.
+ - All parse operations now carry error information, including what
+   was expected to be parsed and where.
+  * Consequently, ParseError now has a 'formatError' method that takes
+    the input string and returns a human-readable description the
+    parse failure.
+ - New example: TermL parser, in examples/terml.
+ - New script, bin/generate_parser. Takes a file containing a PyMeta
+   grammar as input and writes a Python module file.
+
+ - A couple bugfixes:
+ #248643 subclassed grammars don't inherit base namespace
+ #564135 makeGrammar error handling for nonsensical grammars is broken
+
+
+0.3.0 (2008-07-12):
+ - Input stream now implemented like the Javascript version, with immutable
+   position objects.
+
+0.2.0 (2008-04-17):
+ - Grammars generate Python source instead of ASTs.
+ - OMeta now has a "metagrammarClass" attribute, to ease extension of
+   the metagrammar.
+
+0.1.1 (2008-03-27):
+ - Fixed a bug in 'super'.
+
+0.1 (2008-03-26):
+ - Initial release.
diff --git a/lib/Parsley-1.1/PKG-INFO b/lib/Parsley-1.1/PKG-INFO
new file mode 100644
index 0000000..c79bd4a
--- /dev/null
+++ b/lib/Parsley-1.1/PKG-INFO
@@ -0,0 +1,135 @@
+Metadata-Version: 1.0
+Name: Parsley
+Version: 1.1
+Summary: Parsing and pattern matching made easy.
+Home-page: http://launchpad.net/parsley
+Author: Allen Short
+Author-email: washort42 at gmail.com
+License: MIT License
+Description: .. -*- mode: rst -*-
+        
+        ===============================================================
+        Parsley: A Pattern-Matching Language Based on OMeta and Python
+        ===============================================================
+        
+        You can read further docs at: http://parsley.readthedocs.org/en/latest/
+        
+        Summary
+        -------
+        
+        Parsley is a parsing library for people who find parsers scary or
+        annoying. I wrote it because I wanted to parse a programming language,
+        and tools like PLY or ANTLR or Bison were very hard to understand and
+        integrate into my Python code. Most parser generators are based on LL
+        or LR parsing algorithms that compile to big state machine
+        tables. It was like I had to wake up a different section of my brain
+        to understand or work on grammar rules.
+        
+        Parsley, like pyparsing and ZestyParser, uses the PEG algorithm, so
+        each expression in the grammar rules works like a Python
+        expression. In particular, alternatives are evaluated in order, unlike
+        table-driven parsers such as yacc, bison or PLY.
+        
+        Parsley is an implementation of OMeta, an object-oriented
+        pattern-matching language developed by Alessandro Warth at
+        http://tinlizzie.org/ometa/ . For further reading, see Warth's PhD
+        thesis, which provides a detailed description of OMeta:
+        http://www.vpri.org/pdf/tr2008003_experimenting.pdf
+        
+        How It Works
+        ------------
+        
+        Parsley compiles a grammar to a Python class, with the rules as methods. The
+        rules specify parsing expressions, which consume input and return values if
+        they succeed in matching.
+        
+        Basic syntax
+        ~~~~~~~~~~~~
+        ``foo = ....``:
+           Define a rule named foo.
+        
+        ``expr1 expr2``:
+           Match expr1, and then match expr2 if it succeeds, returning the value of
+           expr2. Like Python's ``and``.
+        
+        ``expr1 | expr2``:
+          Try to match ``expr1`` --- if it fails, match ``expr2`` instead. Like Python's
+          ``or``.
+        
+        ``expr*``:
+          Match ``expr`` zero or more times, returning a list of matches.
+        
+        ``expr+``:
+          Match ``expr`` one or more times, returning a list of matches.
+        
+        ``expr?``:
+          Try to match ``expr``. Returns ``None`` if it fails to match.
+        
+        ``expr{n, m}``:
+          Match ``expr`` at least ``n`` times, and no more than ``m`` times.
+        
+        ``expr{n}``:
+          Match ``expr`` ``n`` times exactly.
+        
+        ``~expr``:
+          Negative lookahead. Fails if the next item in the input matches
+          ``expr``. Consumes no input.
+        
+        ``~~expr``:
+          Positive lookahead. Fails if the next item in the input does *not*
+          match ``expr``. Consumes no input.
+        
+        ``ruleName`` or ``ruleName(arg1 arg2 etc)``:
+          Call the rule ``ruleName``, possibly with args.
+        
+        ``'x'``:
+          Match the literal character 'x'.
+        
+        ``<expr>``:
+          Returns the string consumed by matching ``expr``. Good for tokenizing rules.
+        
+        ``expr:name``:
+          Bind the result of expr to the local variable ``name``.
+        
+        ``-> pythonExpression``:
+          Evaluate the given Python expression and return its result. Can be
+          used inside parentheses too!
+        
+        ``!(pythonExpression)``:
+          Invoke a Python expression as an action.
+        
+        ``?(pythonExpression)``:
+          Fail if the Python expression is false, Returns True otherwise.
+        
+        Comments like Python comments are supported as well, starting with #
+        and extending to the end of the line.
+        
+        Interface
+        ---------
+        
+        The starting point for defining a new grammar is
+        ``parsley.makeGrammar(grammarSource, bindings)``, which takes a grammar
+        definition and a dict of variable bindings for its embedded
+        expressions and produces a Python class. Grammars can be subclassed as
+        usual, and makeGrammar can be called on these classes to override
+        rules and provide new ones. Grammar rules are exposed as methods.
+        
+        Example Usage
+        -------------
+        
+        ::
+        
+            from parsley import makeGrammar
+            exampleGrammar = """
+            ones = '1' '1' -> 1
+            twos = '2' '2' -> 2
+            stuff = (ones | twos)+
+            """
+            Example = makeGrammar(exampleGrammar, {})
+            g = Example("11221111")
+            result, error = g.stuff()
+            print result
+        
+        →  ``[1, 2, 1, 1]``
+        
+Platform: UNKNOWN
diff --git a/lib/Parsley-1.1/README b/lib/Parsley-1.1/README
new file mode 100644
index 0000000..99596a9
--- /dev/null
+++ b/lib/Parsley-1.1/README
@@ -0,0 +1,125 @@
+.. -*- mode: rst -*-
+
+===============================================================
+Parsley: A Pattern-Matching Language Based on OMeta and Python
+===============================================================
+
+You can read further docs at: http://parsley.readthedocs.org/en/latest/
+
+Summary
+-------
+
+Parsley is a parsing library for people who find parsers scary or
+annoying. I wrote it because I wanted to parse a programming language,
+and tools like PLY or ANTLR or Bison were very hard to understand and
+integrate into my Python code. Most parser generators are based on LL
+or LR parsing algorithms that compile to big state machine
+tables. It was like I had to wake up a different section of my brain
+to understand or work on grammar rules.
+
+Parsley, like pyparsing and ZestyParser, uses the PEG algorithm, so
+each expression in the grammar rules works like a Python
+expression. In particular, alternatives are evaluated in order, unlike
+table-driven parsers such as yacc, bison or PLY.
+
+Parsley is an implementation of OMeta, an object-oriented
+pattern-matching language developed by Alessandro Warth at
+http://tinlizzie.org/ometa/ . For further reading, see Warth's PhD
+thesis, which provides a detailed description of OMeta:
+http://www.vpri.org/pdf/tr2008003_experimenting.pdf
+
+How It Works
+------------
+
+Parsley compiles a grammar to a Python class, with the rules as methods. The
+rules specify parsing expressions, which consume input and return values if
+they succeed in matching.
+
+Basic syntax
+~~~~~~~~~~~~
+``foo = ....``:
+   Define a rule named foo.
+
+``expr1 expr2``:
+   Match expr1, and then match expr2 if it succeeds, returning the value of
+   expr2. Like Python's ``and``.
+
+``expr1 | expr2``:
+  Try to match ``expr1`` --- if it fails, match ``expr2`` instead. Like Python's
+  ``or``.
+
+``expr*``:
+  Match ``expr`` zero or more times, returning a list of matches.
+
+``expr+``:
+  Match ``expr`` one or more times, returning a list of matches.
+
+``expr?``:
+  Try to match ``expr``. Returns ``None`` if it fails to match.
+
+``expr{n, m}``:
+  Match ``expr`` at least ``n`` times, and no more than ``m`` times.
+
+``expr{n}``:
+  Match ``expr`` ``n`` times exactly.
+
+``~expr``:
+  Negative lookahead. Fails if the next item in the input matches
+  ``expr``. Consumes no input.
+
+``~~expr``:
+  Positive lookahead. Fails if the next item in the input does *not*
+  match ``expr``. Consumes no input.
+
+``ruleName`` or ``ruleName(arg1 arg2 etc)``:
+  Call the rule ``ruleName``, possibly with args.
+
+``'x'``:
+  Match the literal character 'x'.
+
+``<expr>``:
+  Returns the string consumed by matching ``expr``. Good for tokenizing rules.
+
+``expr:name``:
+  Bind the result of expr to the local variable ``name``.
+
+``-> pythonExpression``:
+  Evaluate the given Python expression and return its result. Can be
+  used inside parentheses too!
+
+``!(pythonExpression)``:
+  Invoke a Python expression as an action.
+
+``?(pythonExpression)``:
+  Fail if the Python expression is false, Returns True otherwise.
+
+Comments like Python comments are supported as well, starting with #
+and extending to the end of the line.
+
+Interface
+---------
+
+The starting point for defining a new grammar is
+``parsley.makeGrammar(grammarSource, bindings)``, which takes a grammar
+definition and a dict of variable bindings for its embedded
+expressions and produces a Python class. Grammars can be subclassed as
+usual, and makeGrammar can be called on these classes to override
+rules and provide new ones. Grammar rules are exposed as methods.
+
+Example Usage
+-------------
+
+::
+
+    from parsley import makeGrammar
+    exampleGrammar = """
+    ones = '1' '1' -> 1
+    twos = '2' '2' -> 2
+    stuff = (ones | twos)+
+    """
+    Example = makeGrammar(exampleGrammar, {})
+    g = Example("11221111")
+    result, error = g.stuff()
+    print result
+
+→  ``[1, 2, 1, 1]``
diff --git a/lib/Parsley-1.1/doc/Makefile b/lib/Parsley-1.1/doc/Makefile
new file mode 100644
index 0000000..86dee5a
--- /dev/null
+++ b/lib/Parsley-1.1/doc/Makefile
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Parsley.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Parsley.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/Parsley"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Parsley"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
diff --git a/lib/Parsley-1.1/doc/calc.py b/lib/Parsley-1.1/doc/calc.py
new file mode 100644
index 0000000..e97255f
--- /dev/null
+++ b/lib/Parsley-1.1/doc/calc.py
@@ -0,0 +1,42 @@
+import math
+from parsley import makeGrammar
+
+def calculate(start, pairs):
+        result = start
+        for op, value in pairs:
+            if op == '+':
+                result += value
+            elif op == '-':
+                result -= value
+            elif op == '*':
+                result *= value
+            elif op == '/':
+                result /= value
+        return result
+
+calcGrammar = """
+number = <digit+>:ds -> int(ds)
+parens = '(' ws expr:e ws ')' -> e
+value = number | parens
+ws = ' '*
+add = '+' ws expr2:n -> ('+', n)
+sub = '-' ws expr2:n -> ('-', n)
+mul = '*' ws value:n -> ('*', n)
+div = '/' ws value:n -> ('/', n)
+
+addsub = ws (add | sub)
+muldiv = ws (mul | div)
+
+expr = expr2:left addsub*:right -> calculate(left, right)
+expr2 = value:left muldiv*:right -> calculate(left, right)
+"""
+
+Calc = makeGrammar(calcGrammar, {"calculate": calculate}, name="Calc")
+
+calcGrammarEx = """
+value = super | constant
+constant = 'pi' -> math.pi
+         | 'e' -> math.e
+"""
+CalcEx = makeGrammar(calcGrammarEx, {"math": math}, name="CalcEx",
+                     extends=Calc)
diff --git a/lib/Parsley-1.1/doc/conf.py b/lib/Parsley-1.1/doc/conf.py
new file mode 100644
index 0000000..66a43c8
--- /dev/null
+++ b/lib/Parsley-1.1/doc/conf.py
@@ -0,0 +1,242 @@
+# -*- coding: utf-8 -*-
+#
+# Parsley documentation build configuration file, created by
+# sphinx-quickstart on Tue Aug 21 09:46:24 2012.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Parsley'
+copyright = u'2013, Allen Short'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.1'
+# The full version, including alpha/beta/rc tags.
+release = '1.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Parsleydoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'Parsley.tex', u'Parsley Documentation',
+   u'Allen Short', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'parsley', u'Parsley Documentation',
+     [u'Allen Short'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('index', 'Parsley', u'Parsley Documentation',
+   u'Allen Short', 'Parsley', 'One line description of project.',
+   'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
diff --git a/lib/Parsley-1.1/doc/extending.rst b/lib/Parsley-1.1/doc/extending.rst
new file mode 100644
index 0000000..3ab3a0f
--- /dev/null
+++ b/lib/Parsley-1.1/doc/extending.rst
@@ -0,0 +1,25 @@
+==================================
+Extending Grammars and Inheritance
+==================================
+
+:warning: Unfinished
+
+Another feature taken from OMeta is *grammar inheritance*. We can
+write a grammar with rules that override ones in a parent. If we load
+the grammar from our calculator tutorial as ``Calc``, we can extend it
+with some constants::
+
+    from parsley import makeGrammar
+    import math
+    import calc
+    calcGrammarEx = """
+    value = super | constant
+    constant = 'pi' -> math.pi
+             | 'e' -> math.e
+    """
+    CalcEx = makeGrammar(calcGrammar, {"math": math}, extends=calc.Calc)
+
+
+Invoking the rule ``super`` calls the rule ``value`` in Calc. If it
+fails to match, our new ``value`` rule attempts to match a constant
+name.
diff --git a/lib/Parsley-1.1/doc/index.rst b/lib/Parsley-1.1/doc/index.rst
new file mode 100644
index 0000000..85696e6
--- /dev/null
+++ b/lib/Parsley-1.1/doc/index.rst
@@ -0,0 +1,17 @@
+.. Parsley documentation master file, created by
+   sphinx-quickstart on Tue Aug 21 09:46:24 2012.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to Parsley's documentation!
+===================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   tutorial
+   tutorial2
+   extending
+   reference
diff --git a/lib/Parsley-1.1/doc/reference.rst b/lib/Parsley-1.1/doc/reference.rst
new file mode 100644
index 0000000..4425f26
--- /dev/null
+++ b/lib/Parsley-1.1/doc/reference.rst
@@ -0,0 +1,94 @@
+Parsley Reference
+-----------------
+
+Basic syntax
+~~~~~~~~~~~~
+``foo = ....``:
+   Define a rule named foo.
+
+``expr1 expr2``:
+   Match expr1, and then match expr2 if it succeeds, returning the value of
+   expr2. Like Python's ``and``.
+
+``expr1 | expr2``:
+  Try to match ``expr1`` --- if it fails, match ``expr2`` instead. Like Python's
+  ``or``.
+
+``expr*``:
+  Match ``expr`` zero or more times, returning a list of matches.
+
+``expr+``:
+  Match ``expr`` one or more times, returning a list of matches.
+
+``expr?``:
+  Try to match ``expr``. Returns ``None`` if it fails to match.
+
+``expr{n, m}``:
+  Match ``expr`` at least ``n`` times, and no more than ``m`` times.
+
+``expr{n}``:
+  Match ``expr`` ``n`` times exactly.
+
+``~expr``:
+  Negative lookahead. Fails if the next item in the input matches
+  ``expr``. Consumes no input.
+
+``~~expr``:
+  Positive lookahead. Fails if the next item in the input does *not*
+  match ``expr``. Consumes no input.
+
+``ruleName`` or ``ruleName(arg1 arg2 etc)``:
+  Call the rule ``ruleName``, possibly with args.
+
+``'x'``:
+  Match the literal character 'x'.
+
+``<expr>``:
+  Returns the string consumed by matching ``expr``. Good for tokenizing rules.
+
+``expr:name``:
+  Bind the result of expr to the local variable ``name``.
+
+``-> pythonExpression``:
+  Evaluate the given Python expression and return its result. Can be
+  used inside parentheses too!
+
+``!(pythonExpression)``:
+  Invoke a Python expression as an action.
+
+``?(pythonExpression)``:
+  Fail if the Python expression is false, Returns True otherwise.
+
+Comments like Python comments are supported as well, starting with #
+and extending to the end of the line.
+
+
+Python API
+~~~~~~~~~~
+.. automodule:: parsley
+   :members:
+
+
+Built-in Parsley Rules
+~~~~~~~~~~~~~~~~~~~~~~
+
+``anything``:
+    Matches a single character from the input.
+
+``letter``:
+    Matches a single ASCII letter.
+
+``digit``:
+    Matches a decimal digit.
+
+``letterOrDigit``:
+    Combines the above.
+
+``end``:
+    Matches the end of input.
+
+``ws``:
+    Matches zero or more spaces, tabs, or newlines.
+
+``exactly(char)``:
+   Matches the character `char`.
diff --git a/lib/Parsley-1.1/doc/test_calc.py b/lib/Parsley-1.1/doc/test_calc.py
new file mode 100644
index 0000000..856751f
--- /dev/null
+++ b/lib/Parsley-1.1/doc/test_calc.py
@@ -0,0 +1,9 @@
+from calc import Calc
+import unittest
+
+class CalcTest(unittest.TestCase):
+
+    def test_calc(self):
+        self.assertEqual(Calc("2 * (3 + 4 * 5)").expr(), 46)
+        self.assertEqual(Calc("2 *( 3 + 40 /   5)").expr(), 22)
+        self.assertEqual(Calc("2 + (4 * 3 + 40 /   5)").expr(), 22)
diff --git a/lib/Parsley-1.1/doc/tutorial.rst b/lib/Parsley-1.1/doc/tutorial.rst
new file mode 100644
index 0000000..242b6e1
--- /dev/null
+++ b/lib/Parsley-1.1/doc/tutorial.rst
@@ -0,0 +1,381 @@
+==========================================
+Parsley Tutorial Part I: Basics and Syntax
+==========================================
+
+*************************************
+From Regular Expressions To Grammars
+*************************************
+
+Parsley is a pattern matching and parsing tool for Python programmers.
+
+Most Python programmers are familiar with regular expressions, as
+provided by Python's `re` module. To use it, you provide a string that
+describes the pattern you want to match, and your input.
+
+For example::
+
+    >>> import re
+    >>> x = re.compile("a(b|c)d+e")
+    >>> x.match("abddde")
+    <_sre.SRE_Match object at 0x7f587af54af8>
+
+
+You can do exactly the same sort of thing in Parsley::
+
+    >>> import parsley
+    >>> x = parsley.makeGrammar("foo = 'a' ('b' | 'c') 'd'+ 'e'", {})
+    >>> x("abdde").foo()
+    'e'
+
+From this small example, a couple differences between regular
+expressions and Parsley grammars can be seen:
+
+Parsley Grammars Have Named Rules
+---------------------------------
+
+A Parsley grammar can have many rules, and each has a name. The
+example above has a single rule named `foo`. Rules can call each
+other; calling rules in Parsley works like calling functions in
+Python. Here is another way to write the grammar above::
+
+    foo = 'a' baz 'd'+ 'e'
+    baz = 'b' | 'c'
+
+
+Parsley Grammars Are Expressions
+--------------------------------
+
+Calling `match` for a regular expression returns a match object if the
+match succeeds or None if it fails. Parsley parsers return the value
+of last expression in the rule. Behind the scenes, Parsley turns each
+rule in your grammar into Python methods. In pseudo-Python code, it
+looks something like this::
+
+    def foo(self):
+        match('a')
+        self.baz()
+        match_one_or_more('d')
+        return match('e')
+
+    def baz(self):
+        return match('b') or match('c')
+
+The value of the last expression in the rule is what the rule
+returns. This is why our example returns 'e'.
+
+The similarities to regular expressions pretty much end here,
+though. Having multiple named rules composed of expressions makes for
+a much more powerful tool, and now we're going to look at some more
+features that go even further.
+
+Rules Can Embed Python Expressions
+----------------------------------
+
+Since these rules just turn into Python code eventually, we can stick
+some Python code into them ourselves. This is particularly useful for
+changing the return value of a rule. The Parsley expression for this
+is `->`. We can also bind the results of expressions to variable names
+and use them in Python code. So things like this are possible::
+
+    x = parsley.makeGrammar("""
+    foo = 'a':one baz:two 'd'+ 'e' -> (one, two)
+    baz = 'b' | 'c'
+    """, {})
+    print x("abdde").foo()
+
+::
+
+    ('a', 'b')
+
+Literal match expressions like `'a'` return the character they
+match. Using a colon and a variable name after an expression is like
+assignment in Python. As a result, we can use those names in a Python
+expression - in this case, creating a tuple.
+
+Another way to use Python code in a rule is to write custom tests for
+matching. Sometimes it's more convenient to write some Python that
+determines if a rule matches than to stick to Parsley expressions
+alone. For those cases, we can use `?()`. Here, we use the builtin
+rule `anything` to match a single character, then a Python predicate
+to decide if it's the one we want::
+
+    digit = anything:x ?(x in '0123456789') -> x
+
+This rule `digit` will match any decimal digit. We need the `-> x` on
+the end to return the character rather than the value of the predicate
+expression, which is just `True`.
+
+Repeated Matches Make Lists
+---------------------------
+
+Like regular expressions, Parsley supports repeating matches. You can
+match an expression zero or more times with '* ', one or more times
+with '+', and a specific number of times with '{n, m}' or just
+'{n}'. Since all expressions in Parsley return a value, these
+repetition operators return a list containing each match they made.
+
+::
+
+    x = parsley.makeGrammar("""
+    digit = anything:x ?(x in '0123456789') -> x
+    number = digit+
+    """, {})
+    print x("314159").number()
+
+::
+
+    ['3', '1', '4', '1', '5', '9']
+
+The `number` rule repeatedly matches `digit` and collects the matches
+into a list. This gets us part way to turning a string like `314159`
+into an integer. All we need now is to turn the list back into a
+string and call `int()`::
+
+    x = parsley.makeGrammar("""
+    digit = anything:x ?(x in '0123456789') -> x
+    number = digit+:ds -> int(''.join(ds))
+    """, {})
+    print x("8675309").number()
+
+::
+
+    8675309
+
+Collecting Chunks Of Input
+--------------------------
+
+If it seemed kind of strange to break our input string up into a list
+and then reassemble it into a string using `join`, you're not
+alone. Parsley has a shortcut for this since it's a common case: you
+can use `<>` around a rule to make it return the slice of input it
+consumes, ignoring the actual return value of the rule. For example::
+
+    x = parsley.makeGrammar("""
+    digit = anything:x ?(x in '0123456789')
+    number = <digit+>:ds -> int(ds)
+    """, {})
+    print x("11235").number()
+
+::
+
+    11235
+
+Here, `<digit+>` returns the string `"11235"`, since that's the
+portion of the input that `digit+` matched. (In this case it's the
+entire input, but we'll see some more complex cases soon.) Since it
+ignores the list returned by `digit+`, leaving the `-> x` out of
+`digit` doesn't change the result.
+
+**********************
+Building A Calculator
+**********************
+
+Now let's look at using these rules in a more complicated parser. We
+have support for parsing numbers; let's do addition, as well.
+::
+
+    x = parsley.makeGrammar("""
+    digit = anything:x ?(x in '0123456789')
+    number = <digit+>:ds -> int(ds)
+    expr = number:left ( '+' number:right -> left + right
+                       | -> left)
+    """, {})
+    print x("17+34").expr()
+    print x("18").expr()
+
+::
+
+    51
+    18
+
+Parentheses group expressions just like in Python. the '`|`' operator
+is like `or` in Python - it short-circuits. It tries each expression
+until it finds one that matches. For `"17+34"`, the `number` rule
+matches "17", then Parsley tries to match `+` followed by another
+`number`. Since "+" and "34" are the next things in the input, those
+match, and it then runs the Python expression `left + right` and
+returns its value. For the input `"18"` it does the same, but `+` does
+not match, so Parsley tries the next thing after `|`. Since this is
+just a Python expression, the match succeeds and the number 18 is
+returned.
+
+Now let's add subtraction::
+
+    digit = anything:x ?(x in '0123456789')
+    number = <digit+>:ds -> int(ds)
+    expr = number:left ( '+' number:right -> left + right
+                       | '-' number:right -> left - right
+                       | -> left)
+
+This will accept things like '5-4' now.
+
+Since parsing numbers is so common and useful, Parsley actually has
+'digit' as a builtin rule, so we don't even need to define it
+ourselves. We'll leave it out in further examples and rely on the
+version Parsley provides.
+
+Normally we like to allow whitespace in our expressions, so let's add
+some support for spaces::
+
+    number = <digit+>:ds -> int(ds)
+    ws = ' '*
+    expr = number:left ws ('+' ws number:right -> left + right
+                          |'-' ws number:right -> left - right
+                          | -> left)
+
+Now we can handle "17 +34", "2  - 1", etc.
+
+We could go ahead and add multiplication and division here (and
+hopefully it's obvious how that would work), but let's complicate
+things further and allow multiple operations in our expressions --
+things like "1 - 2 + 3".
+
+There's a couple different ways to do this. Possibly the easiest is to
+build a list of numbers and operations, then do the math.::
+
+    x = parsley.makeGrammar("""
+    number = <digit+>:ds -> int(ds)
+    ws = ' '*
+    add = '+' ws number:n -> ('+', n)
+    sub = '-' ws number:n -> ('-', n)
+    addsub = ws (add | sub)
+    expr = number:left (addsub+:right -> right
+                       | -> left)
+    """, {})
+    print x("1 + 2 - 3").expr()
+
+::
+
+    [('+', 2), ('-, 3)]
+
+Oops, this is only half the job done. We're collecting the operators
+and values, but now we need to do the actual calculation. The easiest
+way to do it is probably to write a Python function and call it from
+inside the grammar.
+
+So far we have been passing an empty dict as the second argument to
+``makeGrammar``. This is a dict of variable bindings that can be used
+in Python expressions in the grammar. So we can pass Python objects,
+such as functions, this way::
+
+    def calculate(start, pairs):
+        result = start
+        for op, value in pairs:
+            if op == '+':
+                result += value
+            elif op == '-':
+                result -= value
+        return result
+    x = parsley.makeGrammar("""
+    number = <digit+>:ds -> int(ds)
+    ws = ' '*
+    add = '+' ws number:n -> ('+', n)
+    sub = '-' ws number:n -> ('-', n)
+    addsub = ws (add | sub)
+    expr = number:left (addsub+:right -> calculate(left, right)
+                       | -> left)
+    """, {"calculate": calculate})
+    print x("4 + 5 - 6").expr()
+
+::
+
+    3
+
+
+Introducing this function lets us simplify even further: instead of
+using ``addsub+``, we can use ``addsub*``, since ``calculate(left, [])``
+will return ``left`` -- so now ``expr`` becomes::
+
+    expr = number:left addsub*:right -> calculate(left, right)
+
+
+So now let's look at adding multiplication and division. Here, we run
+into precedence rules: should "4 * 5 + 6" give us 26, or 44? The
+traditional choice is for multiplication and division to take
+precedence over addition and subtraction, so the answer should
+be 26. We'll resolve this by making sure multiplication and division
+happen before addition and subtraction are considered::
+
+    def calculate(start, pairs):
+        result = start
+        for op, value in pairs:
+            if op == '+':
+                result += value
+            elif op == '-':
+                result -= value
+            elif op == '*':
+                result *= value
+            elif op == '/':
+                result /= value
+        return result
+    x = parsley.makeGrammar("""
+    number = <digit+>:ds -> int(ds)
+    ws = ' '*
+    add = '+' ws expr2:n -> ('+', n)
+    sub = '-' ws expr2:n -> ('-', n)
+    mul = '*' ws number:n -> ('*', n)
+    div = '/' ws number:n -> ('/', n)
+
+    addsub = ws (add | sub)
+    muldiv = ws (mul | div)
+
+    expr = expr2:left addsub*:right -> calculate(left, right)
+    expr2 = number:left muldiv*:right -> calculate(left, right)
+    """, {"calculate": calculate})
+    print x("4 * 5 + 6").expr()
+
+::
+
+    26
+
+Notice particularly that ``add``, ``sub``, and ``expr`` all call the
+``expr2`` rule now where they called ``number`` before. This means
+that all the places where a number was expected previously, a
+multiplication or division expression can appear instead.
+
+
+Finally let's add parentheses, so you can override the precedence and
+write "4 * (5 + 6)" when you do want 44. We'll do this by adding a
+``value`` rule that accepts either a number or an expression in
+parentheses, and replace existing calls to ``number`` with calls to
+``value``.
+
+::
+
+    def calculate(start, pairs):
+        result = start
+        for op, value in pairs:
+            if op == '+':
+                result += value
+            elif op == '-':
+                result -= value
+            elif op == '*':
+                result *= value
+            elif op == '/':
+                result /= value
+        return result
+    x = parsley.makeGrammar("""
+    number = <digit+>:ds -> int(ds)
+    parens = '(' ws expr:e ws ')' -> e
+    value = number | parens
+    ws = ' '*
+    add = '+' ws expr2:n -> ('+', n)
+    sub = '-' ws expr2:n -> ('-', n)
+    mul = '*' ws value:n -> ('*', n)
+    div = '/' ws value:n -> ('/', n)
+
+    addsub = ws (add | sub)
+    muldiv = ws (mul | div)
+
+    expr = expr2:left addsub*:right -> calculate(left, right)
+    expr2 = value:left muldiv*:right -> calculate(left, right)
+    """, {"calculate": calculate})
+
+    print x("4 * (5 + 6) + 1").expr()
+
+::
+
+    45
+
+And there you have it: a four-function calculator with precedence and
+parentheses.
diff --git a/lib/Parsley-1.1/doc/tutorial2.rst b/lib/Parsley-1.1/doc/tutorial2.rst
new file mode 100644
index 0000000..7a22a98
--- /dev/null
+++ b/lib/Parsley-1.1/doc/tutorial2.rst
@@ -0,0 +1,134 @@
+=================================================
+Parsley Tutorial Part II: Parsing Structured Data
+=================================================
+
+Now that you are familiar with the basics of Parsley syntax, let's
+look at a more realistic example: a JSON parser.
+
+The JSON spec on http://json.org/ describes the format, and we can
+adapt its description to a parser. We'll write the Parsley rules in
+the same order as the grammar rules in the right sidebar on the JSON
+site, starting with the top-level rule, 'object'.
+::
+
+    object = ws '{' members:m ws '}' -> dict(m)
+
+Parsley defines a builtin rule ``ws`` which consumes any spaces, tabs,
+or newlines it can.
+
+Since JSON objects are represented in Python as dicts, and ``dict``
+takes a list of pairs, we need a rule to collect name/value pairs
+inside an object expression.
+::
+
+    members = (pair:first (ws ',' pair)*:rest -> [first] + rest)
+              | -> []
+
+This handles the three cases for object contents: one, multiple, or
+zero pairs. A name/value pair is separated by a colon. We use the
+builtin rule ``spaces`` to consume any whitespace after the colon::
+
+    pair = ws string:k ws ':' value:v -> (k, v)
+
+Arrays, similarly, are sequences of array elements, and are
+represented as Python lists.
+::
+
+    array = '[' elements:xs ws ']' -> xs
+    elements = (value:first (ws ',' value)*:rest -> [first] + rest) | -> []
+
+Values can be any JSON expression.
+::
+
+    value = ws (string | number | object | array
+               | 'true'  -> True
+               | 'false' -> False
+               | 'null'  -> None)
+
+
+Strings are sequences of zero or more characters between double
+quotes. Of course, we need to deal with escaped characters as
+well. This rule introduces the operator ``~``, which does negative
+lookahead; if the expression following it succeeds, its parse will
+fail. If the expression fails, the rest of the parse continues. Either
+way, no input will be consumed.
+::
+
+    string = '"' (escapedChar | ~'"' anything)*:c '"' -> ''.join(c)
+
+This is a common pattern, so let's examine it step by step. This will
+match leading whitespace and then a double quote character. It then
+matches zero or more characters. If it's not an ``escapedChar`` (which
+will start with a backslash), we check to see if it's a double quote,
+in which case we want to end the loop. If it's not a double quote, we
+match it using the rule ``anything``, which accepts a single character
+of any kind, and continue. Finally, we match the ending double quote
+and return the characters in the string. We cannot use the ``<>``
+syntax in this case because we don't want a literal slice of the input
+-- we want escape sequences to be replaced with the character they
+represent.
+
+It's very common to use ``~`` for "match until" situations where you
+want to keep parsing only until an end marker is found. Similarly,
+``~~`` is positive lookahead: it succeed if its expression succeeds
+but not consume any input.
+
+The ``escapedChar`` rule should not be too surprising: we match a
+backslash then whatever escape code is given.
+
+::
+
+    escapedChar = '\\' (('"' -> '"')    |('\\' -> '\\')
+                       |('/' -> '/')    |('b' -> '\b')
+                       |('f' -> '\f')   |('n' -> '\n')
+                       |('r' -> '\r')   |('t' -> '\t')
+                       |('\'' -> '\'')  | escapedUnicode)
+
+Unicode escapes (of the form ``\u2603``) require matching four hex
+digits, so we use the repetition operator ``{}``, which works like +
+or * except taking either a ``{min, max}`` pair or simply a
+``{number}`` indicating the exact number of repetitions.
+::
+
+    hexdigit = :x ?(x in '0123456789abcdefABCDEF') -> x
+    escapedUnicode = 'u' <hexdigit{4}>:hs -> unichr(int(hs, 16))
+
+With strings out of the way, we advance to numbers, both integer and
+floating-point.
+
+::
+
+    number = spaces ('-' | -> ''):sign (intPart:ds (floatPart(sign ds)
+                                                   | -> int(sign + ds)))
+
+Here we vary from the json.org description a little and move sign
+handling up into the ``number`` rule. We match either an ``intPart``
+followed by a ``floatPart`` or just an ``intPart`` by itself.
+::
+
+    digit = :x ?(x in '0123456789') -> x
+    digits = <digit*>
+    digit1_9 = :x ?(x in '123456789') -> x
+
+    intPart = (digit1_9:first digits:rest -> first + rest) | digit
+    floatPart :sign :ds = <('.' digits exponent?) | exponent>:tail
+			 -> float(sign + ds + tail)
+    exponent = ('e' | 'E') ('+' | '-')? digits
+
+In JSON, multi-digit numbers cannot start with 0 (since that is
+Javascript's syntax for octal numbers), so ``intPart`` uses ``digit1_9``
+to exclude it in the first position.
+
+The ``floatPart`` rule takes two parameters, ``sign`` and ``ds``. Our
+``number`` rule passes values for these when it invokes ``floatPart``,
+letting us avoid duplication of work within the rule. Note that
+pattern matching on arguments to rules works the same as on the string
+input to the parser. In this case, we provide no pattern, just a name:
+``:ds`` is the same as ``anything:ds``.
+
+(Also note that our float rule cheats a little: it does not really
+parse floating-point numbers, it merely recognizes them and passes
+them to Python's ``float`` builtin to actually produce the value.)
+
+The full version of this parser and its test cases can be found in the
+``examples`` directory in the Parsley distribution.
diff --git a/lib/Parsley-1.1/examples/minml.py b/lib/Parsley-1.1/examples/minml.py
new file mode 100644
index 0000000..42ffcd1
--- /dev/null
+++ b/lib/Parsley-1.1/examples/minml.py
@@ -0,0 +1,28 @@
+"""
+A grammar for parsing a tiny HTML-like language, plus a transformer for it.
+"""
+from parsley import makeGrammar, term, makeTerm as t
+from itertools import chain
+
+tinyHTMLGrammar = """
+
+name = <letterOrDigit+>
+
+tag = ('<' spaces name:n spaces attribute*:attrs '>'
+         html:c
+         '<' '/' token(n) spaces '>'
+             -> t.Element(n.lower(), dict(attrs), c))
+
+html = (text | tag)*
+
+text = <(~('<') anything)+>
+
+attribute = spaces name:k token('=') quotedString:v -> (k, v)
+
+quotedString = (('"' | '\''):q <(~exactly(q) anything)*>:xs exactly(q)
+                     -> xs
+
+"""
+TinyHTML = makeGrammar(tinyHTMLGrammar, globals(), name="TinyHTML")
+
+testSource = "<html><title>Yes</title><body><h1>Man, HTML is <i>great</i>.</h1><p>How could you even <b>think</b> otherwise?</p><img src='HIPPO.JPG'></img><a href='http://twistedmatrix.com'>A Good Website</a></body></html>"
diff --git a/lib/Parsley-1.1/examples/parsley_json.py b/lib/Parsley-1.1/examples/parsley_json.py
new file mode 100644
index 0000000..f7a6119
--- /dev/null
+++ b/lib/Parsley-1.1/examples/parsley_json.py
@@ -0,0 +1,31 @@
+from parsley import makeGrammar
+jsonGrammar = r"""
+ws = (' ' | '\r' | '\n' | '\t')*
+object = ws '{' members:m ws '}' ws -> dict(m)
+members = (pair:first (ws ',' pair)*:rest -> [first] + rest) | -> []
+pair = ws string:k ws ':' value:v -> (k, v)
+array = '[' elements:xs ws ']' -> xs
+elements = (value:first (ws ',' value)*:rest -> [first] + rest) | -> []
+value = ws (string | number | object | array
+           | 'true'  -> True
+           | 'false' -> False
+           | 'null'  -> None)
+string = '"' (escapedChar | ~'"' anything)*:c '"' -> ''.join(c)
+escapedChar = '\\' (('"' -> '"')    |('\\' -> '\\')
+                   |('/' -> '/')    |('b' -> '\b')
+                   |('f' -> '\f')   |('n' -> '\n')
+                   |('r' -> '\r')   |('t' -> '\t')
+                   |('\'' -> '\'')  | escapedUnicode)
+hexdigit = :x ?(x in '0123456789abcdefABCDEF') -> x
+escapedUnicode = 'u' <hexdigit{4}>:hs -> unichr(int(hs, 16))
+number = ('-' | -> ''):sign (intPart:ds (floatPart(sign ds)
+                            | -> int(sign + ds)))
+digit = :x ?(x in '0123456789') -> x
+digits = <digit*>
+digit1_9 = :x ?(x in '123456789') -> x
+intPart = (digit1_9:first digits:rest -> first + rest) | digit
+floatPart :sign :ds = <('.' digits exponent?) | exponent>:tail
+                    -> float(sign + ds + tail)
+exponent = ('e' | 'E') ('+' | '-')? digits
+"""
+JSONParser = makeGrammar(jsonGrammar, {})
diff --git a/lib/Parsley-1.1/examples/test_parsley_json.py b/lib/Parsley-1.1/examples/test_parsley_json.py
new file mode 100644
index 0000000..134544a
--- /dev/null
+++ b/lib/Parsley-1.1/examples/test_parsley_json.py
@@ -0,0 +1,39 @@
+from parsley_json import JSONParser
+import unittest
+
+class JSONParserTests(unittest.TestCase):
+
+
+    def test_integer(self):
+        self.assertEqual(JSONParser("123").number(), 123)
+        self.assertEqual(JSONParser("-123").number(), -123)
+        self.assertEqual(JSONParser("0").number(), 0)
+
+    def test_float(self):
+        self.assertEqual(JSONParser("0.5").number(), 0.5)
+        self.assertEqual(JSONParser("1.0").number(), 1.0)
+        self.assertEqual(JSONParser("-3.5").number(), -3.5)
+        self.assertEqual(JSONParser("2e7").number(), 2e7)
+        self.assertEqual(JSONParser("1.2E6").number(), 1.2E6)
+
+    def test_string(self):
+        self.assertEqual(JSONParser('u2603').escapedUnicode(), u"\u2603")
+        self.assertEqual(JSONParser('"foo"').string(), u"foo")
+        self.assertEqual(JSONParser(r'"foo\n"').string(), u"foo\n")
+        self.assertEqual(JSONParser(r'"foo\rbaz\u2603"').string(), u"foo\rbaz\u2603")
+        self.assertEqual(JSONParser(r'"\\\/\b\"\f\t"').string(), u'\\/\b"\f\t')
+
+    def test_literals(self):
+        self.assertEqual(JSONParser(r'true').value(), True)
+        self.assertEqual(JSONParser(r'false').value(), False)
+        self.assertEqual(JSONParser(r'null').value(), None)
+
+    def test_array(self):
+        self.assertEqual(JSONParser(r'[1, 2]').array(), [1, 2])
+        self.assertEqual(JSONParser(r'["foo", []]').array(), ["foo", []])
+
+    def test_object(self):
+        self.assertEqual(JSONParser(r'{"foo": 1}').object(), {"foo": 1})
+        self.assertEqual(JSONParser(r'{"foo": "baz", "x": {}}').object(),
+                         {"foo": "baz", "x": {}})
+
diff --git a/lib/Parsley-1.1/ometa/__init__.py b/lib/Parsley-1.1/ometa/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Parsley-1.1/ometa/_generated/__init__.py b/lib/Parsley-1.1/ometa/_generated/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Parsley-1.1/ometa/_generated/parsley.py b/lib/Parsley-1.1/ometa/_generated/parsley.py
new file mode 100644
index 0000000..1dd0317
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/_generated/parsley.py
@@ -0,0 +1,969 @@
+def createParserClass(GrammarBase, ruleGlobals):
+    if ruleGlobals is None:
+        ruleGlobals = {}
+    class parsley(GrammarBase):
+        def rule_comment(self):
+            _locals = {'self': self}
+            self.locals['comment'] = _locals
+            _G_exactly_1, lastError = self.exactly('#')
+            self.considerError(lastError, 'comment')
+            def _G_many_2():
+                def _G_not_3():
+                    _G_exactly_4, lastError = self.exactly('\n')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_4, self.currentError)
+                _G_not_5, lastError = self._not(_G_not_3)
+                self.considerError(lastError, None)
+                _G_apply_6, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError, None)
+                return (_G_apply_6, self.currentError)
+            _G_many_7, lastError = self.many(_G_many_2)
+            self.considerError(lastError, 'comment')
+            return (_G_many_7, self.currentError)
+
+
+        def rule_hspace(self):
+            _locals = {'self': self}
+            self.locals['hspace'] = _locals
+            def _G_or_8():
+                _G_exactly_9, lastError = self.exactly(' ')
+                self.considerError(lastError, None)
+                return (_G_exactly_9, self.currentError)
+            def _G_or_10():
+                _G_exactly_11, lastError = self.exactly('\t')
+                self.considerError(lastError, None)
+                return (_G_exactly_11, self.currentError)
+            def _G_or_12():
+                _G_apply_13, lastError = self._apply(self.rule_comment, "comment", [])
+                self.considerError(lastError, None)
+                return (_G_apply_13, self.currentError)
+            _G_or_14, lastError = self._or([_G_or_8, _G_or_10, _G_or_12])
+            self.considerError(lastError, 'hspace')
+            return (_G_or_14, self.currentError)
+
+
+        def rule_vspace(self):
+            _locals = {'self': self}
+            self.locals['vspace'] = _locals
+            def _G_or_15():
+                _G_exactly_16, lastError = self.exactly('\r\n')
+                self.considerError(lastError, None)
+                return (_G_exactly_16, self.currentError)
+            def _G_or_17():
+                _G_exactly_18, lastError = self.exactly('\r')
+                self.considerError(lastError, None)
+                return (_G_exactly_18, self.currentError)
+            def _G_or_19():
+                _G_exactly_20, lastError = self.exactly('\n')
+                self.considerError(lastError, None)
+                return (_G_exactly_20, self.currentError)
+            _G_or_21, lastError = self._or([_G_or_15, _G_or_17, _G_or_19])
+            self.considerError(lastError, 'vspace')
+            return (_G_or_21, self.currentError)
+
+
+        def rule_ws(self):
+            _locals = {'self': self}
+            self.locals['ws'] = _locals
+            def _G_many_22():
+                def _G_or_23():
+                    _G_apply_24, lastError = self._apply(self.rule_hspace, "hspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_24, self.currentError)
+                def _G_or_25():
+                    _G_apply_26, lastError = self._apply(self.rule_vspace, "vspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_26, self.currentError)
+                def _G_or_27():
+                    _G_apply_28, lastError = self._apply(self.rule_comment, "comment", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_28, self.currentError)
+                _G_or_29, lastError = self._or([_G_or_23, _G_or_25, _G_or_27])
+                self.considerError(lastError, None)
+                return (_G_or_29, self.currentError)
+            _G_many_30, lastError = self.many(_G_many_22)
+            self.considerError(lastError, 'ws')
+            return (_G_many_30, self.currentError)
+
+
+        def rule_emptyline(self):
+            _locals = {'self': self}
+            self.locals['emptyline'] = _locals
+            def _G_many_31():
+                _G_apply_32, lastError = self._apply(self.rule_hspace, "hspace", [])
+                self.considerError(lastError, None)
+                return (_G_apply_32, self.currentError)
+            _G_many_33, lastError = self.many(_G_many_31)
+            self.considerError(lastError, 'emptyline')
+            _G_apply_34, lastError = self._apply(self.rule_vspace, "vspace", [])
+            self.considerError(lastError, 'emptyline')
+            return (_G_apply_34, self.currentError)
+
+
+        def rule_indentation(self):
+            _locals = {'self': self}
+            self.locals['indentation'] = _locals
+            def _G_many_35():
+                _G_apply_36, lastError = self._apply(self.rule_emptyline, "emptyline", [])
+                self.considerError(lastError, None)
+                return (_G_apply_36, self.currentError)
+            _G_many_37, lastError = self.many(_G_many_35)
+            self.considerError(lastError, 'indentation')
+            def _G_many1_38():
+                _G_apply_39, lastError = self._apply(self.rule_hspace, "hspace", [])
+                self.considerError(lastError, None)
+                return (_G_apply_39, self.currentError)
+            _G_many1_40, lastError = self.many(_G_many1_38, _G_many1_38())
+            self.considerError(lastError, 'indentation')
+            return (_G_many1_40, self.currentError)
+
+
+        def rule_noindentation(self):
+            _locals = {'self': self}
+            self.locals['noindentation'] = _locals
+            def _G_many_41():
+                _G_apply_42, lastError = self._apply(self.rule_emptyline, "emptyline", [])
+                self.considerError(lastError, None)
+                return (_G_apply_42, self.currentError)
+            _G_many_43, lastError = self.many(_G_many_41)
+            self.considerError(lastError, 'noindentation')
+            def _G_lookahead_44():
+                def _G_not_45():
+                    _G_apply_46, lastError = self._apply(self.rule_hspace, "hspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_46, self.currentError)
+                _G_not_47, lastError = self._not(_G_not_45)
+                self.considerError(lastError, None)
+                return (_G_not_47, self.currentError)
+            _G_lookahead_48, lastError = self.lookahead(_G_lookahead_44)
+            self.considerError(lastError, 'noindentation')
+            return (_G_lookahead_48, self.currentError)
+
+
+        def rule_number(self):
+            _locals = {'self': self}
+            self.locals['number'] = _locals
+            _G_apply_49, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'number')
+            def _G_or_50():
+                _G_exactly_51, lastError = self.exactly('-')
+                self.considerError(lastError, None)
+                _G_apply_52, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_52
+                _G_python_53, lastError = eval('t.Exactly(-x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_53, self.currentError)
+            def _G_or_54():
+                _G_apply_55, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_55
+                _G_python_56, lastError = eval('t.Exactly(x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_56, self.currentError)
+            _G_or_57, lastError = self._or([_G_or_50, _G_or_54])
+            self.considerError(lastError, 'number')
+            return (_G_or_57, self.currentError)
+
+
+        def rule_barenumber(self):
+            _locals = {'self': self}
+            self.locals['barenumber'] = _locals
+            def _G_or_58():
+                _G_exactly_59, lastError = self.exactly('0')
+                self.considerError(lastError, None)
+                def _G_or_60():
+                    def _G_or_61():
+                        _G_exactly_62, lastError = self.exactly('x')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_62, self.currentError)
+                    def _G_or_63():
+                        _G_exactly_64, lastError = self.exactly('X')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_64, self.currentError)
+                    _G_or_65, lastError = self._or([_G_or_61, _G_or_63])
+                    self.considerError(lastError, None)
+                    def _G_consumedby_66():
+                        def _G_many1_67():
+                            _G_apply_68, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                            self.considerError(lastError, None)
+                            return (_G_apply_68, self.currentError)
+                        _G_many1_69, lastError = self.many(_G_many1_67, _G_many1_67())
+                        self.considerError(lastError, None)
+                        return (_G_many1_69, self.currentError)
+                    _G_consumedby_70, lastError = self.consumedby(_G_consumedby_66)
+                    self.considerError(lastError, None)
+                    _locals['hs'] = _G_consumedby_70
+                    _G_python_71, lastError = eval('int(hs, 16)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_71, self.currentError)
+                def _G_or_72():
+                    def _G_consumedby_73():
+                        def _G_many1_74():
+                            _G_apply_75, lastError = self._apply(self.rule_octaldigit, "octaldigit", [])
+                            self.considerError(lastError, None)
+                            return (_G_apply_75, self.currentError)
+                        _G_many1_76, lastError = self.many(_G_many1_74, _G_many1_74())
+                        self.considerError(lastError, None)
+                        return (_G_many1_76, self.currentError)
+                    _G_consumedby_77, lastError = self.consumedby(_G_consumedby_73)
+                    self.considerError(lastError, None)
+                    _locals['ds'] = _G_consumedby_77
+                    _G_python_78, lastError = eval('int(ds, 8)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_78, self.currentError)
+                _G_or_79, lastError = self._or([_G_or_60, _G_or_72])
+                self.considerError(lastError, None)
+                return (_G_or_79, self.currentError)
+            def _G_or_80():
+                def _G_consumedby_81():
+                    def _G_many1_82():
+                        _G_apply_83, lastError = self._apply(self.rule_digit, "digit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_83, self.currentError)
+                    _G_many1_84, lastError = self.many(_G_many1_82, _G_many1_82())
+                    self.considerError(lastError, None)
+                    return (_G_many1_84, self.currentError)
+                _G_consumedby_85, lastError = self.consumedby(_G_consumedby_81)
+                self.considerError(lastError, None)
+                _locals['ds'] = _G_consumedby_85
+                _G_python_86, lastError = eval('int(ds)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_86, self.currentError)
+            _G_or_87, lastError = self._or([_G_or_58, _G_or_80])
+            self.considerError(lastError, 'barenumber')
+            return (_G_or_87, self.currentError)
+
+
+        def rule_octaldigit(self):
+            _locals = {'self': self}
+            self.locals['octaldigit'] = _locals
+            _G_apply_88, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'octaldigit')
+            _locals['x'] = _G_apply_88
+            def _G_pred_89():
+                _G_python_90, lastError = eval("x in '01234567'", self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_90, self.currentError)
+            _G_pred_91, lastError = self.pred(_G_pred_89)
+            self.considerError(lastError, 'octaldigit')
+            _G_python_92, lastError = eval('x', self.globals, _locals), None
+            self.considerError(lastError, 'octaldigit')
+            return (_G_python_92, self.currentError)
+
+
+        def rule_hexdigit(self):
+            _locals = {'self': self}
+            self.locals['hexdigit'] = _locals
+            _G_apply_93, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'hexdigit')
+            _locals['x'] = _G_apply_93
+            def _G_pred_94():
+                _G_python_95, lastError = eval("x in '0123456789ABCDEFabcdef'", self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_95, self.currentError)
+            _G_pred_96, lastError = self.pred(_G_pred_94)
+            self.considerError(lastError, 'hexdigit')
+            _G_python_97, lastError = eval('x', self.globals, _locals), None
+            self.considerError(lastError, 'hexdigit')
+            return (_G_python_97, self.currentError)
+
+
+        def rule_escapedChar(self):
+            _locals = {'self': self}
+            self.locals['escapedChar'] = _locals
+            _G_exactly_98, lastError = self.exactly('\\')
+            self.considerError(lastError, 'escapedChar')
+            def _G_or_99():
+                _G_exactly_100, lastError = self.exactly('n')
+                self.considerError(lastError, None)
+                _G_python_101, lastError = "\n", None
+                self.considerError(lastError, None)
+                return (_G_python_101, self.currentError)
+            def _G_or_102():
+                _G_exactly_103, lastError = self.exactly('r')
+                self.considerError(lastError, None)
+                _G_python_104, lastError = "\r", None
+                self.considerError(lastError, None)
+                return (_G_python_104, self.currentError)
+            def _G_or_105():
+                _G_exactly_106, lastError = self.exactly('t')
+                self.considerError(lastError, None)
+                _G_python_107, lastError = "\t", None
+                self.considerError(lastError, None)
+                return (_G_python_107, self.currentError)
+            def _G_or_108():
+                _G_exactly_109, lastError = self.exactly('b')
+                self.considerError(lastError, None)
+                _G_python_110, lastError = "\b", None
+                self.considerError(lastError, None)
+                return (_G_python_110, self.currentError)
+            def _G_or_111():
+                _G_exactly_112, lastError = self.exactly('f')
+                self.considerError(lastError, None)
+                _G_python_113, lastError = "\f", None
+                self.considerError(lastError, None)
+                return (_G_python_113, self.currentError)
+            def _G_or_114():
+                _G_exactly_115, lastError = self.exactly('"')
+                self.considerError(lastError, None)
+                _G_python_116, lastError = '"', None
+                self.considerError(lastError, None)
+                return (_G_python_116, self.currentError)
+            def _G_or_117():
+                _G_exactly_118, lastError = self.exactly("'")
+                self.considerError(lastError, None)
+                _G_python_119, lastError = "'", None
+                self.considerError(lastError, None)
+                return (_G_python_119, self.currentError)
+            def _G_or_120():
+                _G_exactly_121, lastError = self.exactly('x')
+                self.considerError(lastError, None)
+                def _G_consumedby_122():
+                    _G_apply_123, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_124, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_124, self.currentError)
+                _G_consumedby_125, lastError = self.consumedby(_G_consumedby_122)
+                self.considerError(lastError, None)
+                _locals['d'] = _G_consumedby_125
+                _G_python_126, lastError = eval('chr(int(d, 16))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_126, self.currentError)
+            def _G_or_127():
+                _G_exactly_128, lastError = self.exactly('\\')
+                self.considerError(lastError, None)
+                _G_python_129, lastError = "\\", None
+                self.considerError(lastError, None)
+                return (_G_python_129, self.currentError)
+            _G_or_130, lastError = self._or([_G_or_99, _G_or_102, _G_or_105, _G_or_108, _G_or_111, _G_or_114, _G_or_117, _G_or_120, _G_or_127])
+            self.considerError(lastError, 'escapedChar')
+            return (_G_or_130, self.currentError)
+
+
+        def rule_character(self):
+            _locals = {'self': self}
+            self.locals['character'] = _locals
+            _G_apply_131, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'character')
+            _G_exactly_132, lastError = self.exactly("'")
+            self.considerError(lastError, 'character')
+            def _G_many1_133():
+                def _G_not_134():
+                    _G_exactly_135, lastError = self.exactly("'")
+                    self.considerError(lastError, None)
+                    return (_G_exactly_135, self.currentError)
+                _G_not_136, lastError = self._not(_G_not_134)
+                self.considerError(lastError, None)
+                def _G_or_137():
+                    _G_apply_138, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_138, self.currentError)
+                def _G_or_139():
+                    _G_apply_140, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_140, self.currentError)
+                _G_or_141, lastError = self._or([_G_or_137, _G_or_139])
+                self.considerError(lastError, None)
+                return (_G_or_141, self.currentError)
+            _G_many1_142, lastError = self.many(_G_many1_133, _G_many1_133())
+            self.considerError(lastError, 'character')
+            _locals['c'] = _G_many1_142
+            _G_apply_143, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'character')
+            _G_exactly_144, lastError = self.exactly("'")
+            self.considerError(lastError, 'character')
+            _G_python_145, lastError = eval("t.Exactly(''.join(c))", self.globals, _locals), None
+            self.considerError(lastError, 'character')
+            return (_G_python_145, self.currentError)
+
+
+        def rule_string(self):
+            _locals = {'self': self}
+            self.locals['string'] = _locals
+            _G_apply_146, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'string')
+            _G_exactly_147, lastError = self.exactly('"')
+            self.considerError(lastError, 'string')
+            def _G_many_148():
+                def _G_or_149():
+                    _G_apply_150, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_150, self.currentError)
+                def _G_or_151():
+                    def _G_not_152():
+                        _G_exactly_153, lastError = self.exactly('"')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_153, self.currentError)
+                    _G_not_154, lastError = self._not(_G_not_152)
+                    self.considerError(lastError, None)
+                    _G_apply_155, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_155, self.currentError)
+                _G_or_156, lastError = self._or([_G_or_149, _G_or_151])
+                self.considerError(lastError, None)
+                return (_G_or_156, self.currentError)
+            _G_many_157, lastError = self.many(_G_many_148)
+            self.considerError(lastError, 'string')
+            _locals['c'] = _G_many_157
+            _G_apply_158, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'string')
+            _G_exactly_159, lastError = self.exactly('"')
+            self.considerError(lastError, 'string')
+            _G_python_160, lastError = eval("t.Token(''.join(c))", self.globals, _locals), None
+            self.considerError(lastError, 'string')
+            return (_G_python_160, self.currentError)
+
+
+        def rule_name(self):
+            _locals = {'self': self}
+            self.locals['name'] = _locals
+            def _G_consumedby_161():
+                _G_apply_162, lastError = self._apply(self.rule_letter, "letter", [])
+                self.considerError(lastError, None)
+                def _G_many_163():
+                    def _G_or_164():
+                        _G_exactly_165, lastError = self.exactly('_')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_165, self.currentError)
+                    def _G_or_166():
+                        _G_apply_167, lastError = self._apply(self.rule_letterOrDigit, "letterOrDigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_167, self.currentError)
+                    _G_or_168, lastError = self._or([_G_or_164, _G_or_166])
+                    self.considerError(lastError, None)
+                    return (_G_or_168, self.currentError)
+                _G_many_169, lastError = self.many(_G_many_163)
+                self.considerError(lastError, None)
+                return (_G_many_169, self.currentError)
+            _G_consumedby_170, lastError = self.consumedby(_G_consumedby_161)
+            self.considerError(lastError, 'name')
+            return (_G_consumedby_170, self.currentError)
+
+
+        def rule_args(self):
+            _locals = {'self': self}
+            self.locals['args'] = _locals
+            def _G_or_171():
+                _G_exactly_172, lastError = self.exactly('(')
+                self.considerError(lastError, None)
+                _G_python_173, lastError = eval("self.applicationArgs(finalChar=')')", self.globals, _locals), None
+                self.considerError(lastError, None)
+                _locals['args'] = _G_python_173
+                _G_exactly_174, lastError = self.exactly(')')
+                self.considerError(lastError, None)
+                _G_python_175, lastError = eval('args', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_175, self.currentError)
+            def _G_or_176():
+                _G_python_177, lastError = [], None
+                self.considerError(lastError, None)
+                return (_G_python_177, self.currentError)
+            _G_or_178, lastError = self._or([_G_or_171, _G_or_176])
+            self.considerError(lastError, 'args')
+            return (_G_or_178, self.currentError)
+
+
+        def rule_application(self):
+            _locals = {'self': self}
+            self.locals['application'] = _locals
+            def _G_optional_179():
+                _G_apply_180, lastError = self._apply(self.rule_indentation, "indentation", [])
+                self.considerError(lastError, None)
+                return (_G_apply_180, self.currentError)
+            def _G_optional_181():
+                return (None, self.input.nullError())
+            _G_or_182, lastError = self._or([_G_optional_179, _G_optional_181])
+            self.considerError(lastError, 'application')
+            _G_apply_183, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'application')
+            _locals['name'] = _G_apply_183
+            _G_apply_184, lastError = self._apply(self.rule_args, "args", [])
+            self.considerError(lastError, 'application')
+            _locals['args'] = _G_apply_184
+            _G_python_185, lastError = eval('t.Apply(name, self.rulename, args)', self.globals, _locals), None
+            self.considerError(lastError, 'application')
+            return (_G_python_185, self.currentError)
+
+
+        def rule_foreignApply(self):
+            _locals = {'self': self}
+            self.locals['foreignApply'] = _locals
+            def _G_optional_186():
+                _G_apply_187, lastError = self._apply(self.rule_indentation, "indentation", [])
+                self.considerError(lastError, None)
+                return (_G_apply_187, self.currentError)
+            def _G_optional_188():
+                return (None, self.input.nullError())
+            _G_or_189, lastError = self._or([_G_optional_186, _G_optional_188])
+            self.considerError(lastError, 'foreignApply')
+            _G_apply_190, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'foreignApply')
+            _locals['grammar_name'] = _G_apply_190
+            _G_exactly_191, lastError = self.exactly('.')
+            self.considerError(lastError, 'foreignApply')
+            _G_apply_192, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'foreignApply')
+            _locals['rule_name'] = _G_apply_192
+            _G_apply_193, lastError = self._apply(self.rule_args, "args", [])
+            self.considerError(lastError, 'foreignApply')
+            _locals['args'] = _G_apply_193
+            _G_python_194, lastError = eval('t.ForeignApply(grammar_name, rule_name, self.rulename, args)', self.globals, _locals), None
+            self.considerError(lastError, 'foreignApply')
+            return (_G_python_194, self.currentError)
+
+
+        def rule_expr1(self):
+            _locals = {'self': self}
+            self.locals['expr1'] = _locals
+            def _G_or_195():
+                _G_apply_196, lastError = self._apply(self.rule_foreignApply, "foreignApply", [])
+                self.considerError(lastError, None)
+                return (_G_apply_196, self.currentError)
+            def _G_or_197():
+                _G_apply_198, lastError = self._apply(self.rule_application, "application", [])
+                self.considerError(lastError, None)
+                return (_G_apply_198, self.currentError)
+            def _G_or_199():
+                _G_apply_200, lastError = self._apply(self.rule_ruleValue, "ruleValue", [])
+                self.considerError(lastError, None)
+                return (_G_apply_200, self.currentError)
+            def _G_or_201():
+                _G_apply_202, lastError = self._apply(self.rule_semanticPredicate, "semanticPredicate", [])
+                self.considerError(lastError, None)
+                return (_G_apply_202, self.currentError)
+            def _G_or_203():
+                _G_apply_204, lastError = self._apply(self.rule_semanticAction, "semanticAction", [])
+                self.considerError(lastError, None)
+                return (_G_apply_204, self.currentError)
+            def _G_or_205():
+                _G_apply_206, lastError = self._apply(self.rule_number, "number", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_206
+                _G_python_207, lastError = eval('self.isTree()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_python_208, lastError = eval('n', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_208, self.currentError)
+            def _G_or_209():
+                _G_apply_210, lastError = self._apply(self.rule_character, "character", [])
+                self.considerError(lastError, None)
+                return (_G_apply_210, self.currentError)
+            def _G_or_211():
+                _G_apply_212, lastError = self._apply(self.rule_string, "string", [])
+                self.considerError(lastError, None)
+                return (_G_apply_212, self.currentError)
+            def _G_or_213():
+                _G_apply_214, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_215, lastError = self.exactly('(')
+                self.considerError(lastError, None)
+                _G_apply_216, lastError = self._apply(self.rule_expr, "expr", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_216
+                _G_apply_217, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_218, lastError = self.exactly(')')
+                self.considerError(lastError, None)
+                _G_python_219, lastError = eval('e', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_219, self.currentError)
+            def _G_or_220():
+                _G_apply_221, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_222, lastError = self.exactly('<')
+                self.considerError(lastError, None)
+                _G_apply_223, lastError = self._apply(self.rule_expr, "expr", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_223
+                _G_apply_224, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_225, lastError = self.exactly('>')
+                self.considerError(lastError, None)
+                _G_python_226, lastError = eval('t.ConsumedBy(e)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_226, self.currentError)
+            def _G_or_227():
+                _G_apply_228, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_229, lastError = self.exactly('[')
+                self.considerError(lastError, None)
+                def _G_optional_230():
+                    _G_apply_231, lastError = self._apply(self.rule_expr, "expr", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_231, self.currentError)
+                def _G_optional_232():
+                    return (None, self.input.nullError())
+                _G_or_233, lastError = self._or([_G_optional_230, _G_optional_232])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_or_233
+                _G_apply_234, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_235, lastError = self.exactly(']')
+                self.considerError(lastError, None)
+                _G_python_236, lastError = eval('self.isTree()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_python_237, lastError = eval('t.List(e) if e else t.List()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_237, self.currentError)
+            _G_or_238, lastError = self._or([_G_or_195, _G_or_197, _G_or_199, _G_or_201, _G_or_203, _G_or_205, _G_or_209, _G_or_211, _G_or_213, _G_or_220, _G_or_227])
+            self.considerError(lastError, 'expr1')
+            return (_G_or_238, self.currentError)
+
+
+        def rule_expr2(self):
+            _locals = {'self': self}
+            self.locals['expr2'] = _locals
+            def _G_or_239():
+                _G_apply_240, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_241, lastError = self.exactly('~')
+                self.considerError(lastError, None)
+                def _G_or_242():
+                    _G_exactly_243, lastError = self.exactly('~')
+                    self.considerError(lastError, None)
+                    _G_apply_244, lastError = self._apply(self.rule_expr2, "expr2", [])
+                    self.considerError(lastError, None)
+                    _locals['e'] = _G_apply_244
+                    _G_python_245, lastError = eval('t.Lookahead(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_245, self.currentError)
+                def _G_or_246():
+                    _G_apply_247, lastError = self._apply(self.rule_expr2, "expr2", [])
+                    self.considerError(lastError, None)
+                    _locals['e'] = _G_apply_247
+                    _G_python_248, lastError = eval('t.Not(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_248, self.currentError)
+                _G_or_249, lastError = self._or([_G_or_242, _G_or_246])
+                self.considerError(lastError, None)
+                return (_G_or_249, self.currentError)
+            def _G_or_250():
+                _G_apply_251, lastError = self._apply(self.rule_expr1, "expr1", [])
+                self.considerError(lastError, None)
+                return (_G_apply_251, self.currentError)
+            _G_or_252, lastError = self._or([_G_or_239, _G_or_250])
+            self.considerError(lastError, 'expr2')
+            return (_G_or_252, self.currentError)
+
+
+        def rule_repeatTimes(self):
+            _locals = {'self': self}
+            self.locals['repeatTimes'] = _locals
+            def _G_or_253():
+                _G_apply_254, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_254
+                _G_python_255, lastError = eval('int(x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_255, self.currentError)
+            def _G_or_256():
+                _G_apply_257, lastError = self._apply(self.rule_name, "name", [])
+                self.considerError(lastError, None)
+                return (_G_apply_257, self.currentError)
+            _G_or_258, lastError = self._or([_G_or_253, _G_or_256])
+            self.considerError(lastError, 'repeatTimes')
+            return (_G_or_258, self.currentError)
+
+
+        def rule_expr3(self):
+            _locals = {'self': self}
+            self.locals['expr3'] = _locals
+            def _G_or_259():
+                _G_apply_260, lastError = self._apply(self.rule_expr2, "expr2", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_260
+                def _G_or_261():
+                    _G_exactly_262, lastError = self.exactly('*')
+                    self.considerError(lastError, None)
+                    _G_python_263, lastError = eval('t.Many(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_263, self.currentError)
+                def _G_or_264():
+                    _G_exactly_265, lastError = self.exactly('+')
+                    self.considerError(lastError, None)
+                    _G_python_266, lastError = eval('t.Many1(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_266, self.currentError)
+                def _G_or_267():
+                    _G_exactly_268, lastError = self.exactly('?')
+                    self.considerError(lastError, None)
+                    _G_python_269, lastError = eval('t.Optional(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_269, self.currentError)
+                def _G_or_270():
+                    _G_exactly_271, lastError = self.exactly('{')
+                    self.considerError(lastError, None)
+                    _G_apply_272, lastError = self._apply(self.rule_ws, "ws", [])
+                    self.considerError(lastError, None)
+                    _G_apply_273, lastError = self._apply(self.rule_repeatTimes, "repeatTimes", [])
+                    self.considerError(lastError, None)
+                    _locals['start'] = _G_apply_273
+                    _G_apply_274, lastError = self._apply(self.rule_ws, "ws", [])
+                    self.considerError(lastError, None)
+                    def _G_or_275():
+                        _G_exactly_276, lastError = self.exactly(',')
+                        self.considerError(lastError, None)
+                        _G_apply_277, lastError = self._apply(self.rule_ws, "ws", [])
+                        self.considerError(lastError, None)
+                        _G_apply_278, lastError = self._apply(self.rule_repeatTimes, "repeatTimes", [])
+                        self.considerError(lastError, None)
+                        _locals['end'] = _G_apply_278
+                        _G_apply_279, lastError = self._apply(self.rule_ws, "ws", [])
+                        self.considerError(lastError, None)
+                        _G_exactly_280, lastError = self.exactly('}')
+                        self.considerError(lastError, None)
+                        _G_python_281, lastError = eval('t.Repeat(start, end, e)', self.globals, _locals), None
+                        self.considerError(lastError, None)
+                        return (_G_python_281, self.currentError)
+                    def _G_or_282():
+                        _G_apply_283, lastError = self._apply(self.rule_ws, "ws", [])
+                        self.considerError(lastError, None)
+                        _G_exactly_284, lastError = self.exactly('}')
+                        self.considerError(lastError, None)
+                        _G_python_285, lastError = eval('t.Repeat(start, start, e)', self.globals, _locals), None
+                        self.considerError(lastError, None)
+                        return (_G_python_285, self.currentError)
+                    _G_or_286, lastError = self._or([_G_or_275, _G_or_282])
+                    self.considerError(lastError, None)
+                    return (_G_or_286, self.currentError)
+                def _G_or_287():
+                    _G_python_288, lastError = eval('e', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_288, self.currentError)
+                _G_or_289, lastError = self._or([_G_or_261, _G_or_264, _G_or_267, _G_or_270, _G_or_287])
+                self.considerError(lastError, None)
+                _locals['r'] = _G_or_289
+                def _G_or_290():
+                    _G_exactly_291, lastError = self.exactly(':')
+                    self.considerError(lastError, None)
+                    _G_apply_292, lastError = self._apply(self.rule_name, "name", [])
+                    self.considerError(lastError, None)
+                    _locals['n'] = _G_apply_292
+                    _G_python_293, lastError = eval('t.Bind(n, r)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_293, self.currentError)
+                def _G_or_294():
+                    _G_python_295, lastError = eval('r', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_295, self.currentError)
+                _G_or_296, lastError = self._or([_G_or_290, _G_or_294])
+                self.considerError(lastError, None)
+                return (_G_or_296, self.currentError)
+            def _G_or_297():
+                _G_apply_298, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_299, lastError = self.exactly(':')
+                self.considerError(lastError, None)
+                _G_apply_300, lastError = self._apply(self.rule_name, "name", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_300
+                _G_python_301, lastError = eval('t.Bind(n, t.Apply("anything", self.rulename, []))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_301, self.currentError)
+            _G_or_302, lastError = self._or([_G_or_259, _G_or_297])
+            self.considerError(lastError, 'expr3')
+            return (_G_or_302, self.currentError)
+
+
+        def rule_expr4(self):
+            _locals = {'self': self}
+            self.locals['expr4'] = _locals
+            def _G_many1_303():
+                _G_apply_304, lastError = self._apply(self.rule_expr3, "expr3", [])
+                self.considerError(lastError, None)
+                return (_G_apply_304, self.currentError)
+            _G_many1_305, lastError = self.many(_G_many1_303, _G_many1_303())
+            self.considerError(lastError, 'expr4')
+            _locals['es'] = _G_many1_305
+            _G_python_306, lastError = eval('es[0] if len(es) == 1 else t.And(es)', self.globals, _locals), None
+            self.considerError(lastError, 'expr4')
+            return (_G_python_306, self.currentError)
+
+
+        def rule_expr(self):
+            _locals = {'self': self}
+            self.locals['expr'] = _locals
+            _G_apply_307, lastError = self._apply(self.rule_expr4, "expr4", [])
+            self.considerError(lastError, 'expr')
+            _locals['e'] = _G_apply_307
+            def _G_many_308():
+                _G_apply_309, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_310, lastError = self.exactly('|')
+                self.considerError(lastError, None)
+                _G_apply_311, lastError = self._apply(self.rule_expr4, "expr4", [])
+                self.considerError(lastError, None)
+                return (_G_apply_311, self.currentError)
+            _G_many_312, lastError = self.many(_G_many_308)
+            self.considerError(lastError, 'expr')
+            _locals['es'] = _G_many_312
+            _G_python_313, lastError = eval('t.Or([e] + es) if es else e', self.globals, _locals), None
+            self.considerError(lastError, 'expr')
+            return (_G_python_313, self.currentError)
+
+
+        def rule_ruleValue(self):
+            _locals = {'self': self}
+            self.locals['ruleValue'] = _locals
+            _G_apply_314, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'ruleValue')
+            _G_exactly_315, lastError = self.exactly('->')
+            self.considerError(lastError, 'ruleValue')
+            _G_python_316, lastError = eval('self.ruleValueExpr(True)', self.globals, _locals), None
+            self.considerError(lastError, 'ruleValue')
+            return (_G_python_316, self.currentError)
+
+
+        def rule_semanticPredicate(self):
+            _locals = {'self': self}
+            self.locals['semanticPredicate'] = _locals
+            _G_apply_317, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticPredicate')
+            _G_exactly_318, lastError = self.exactly('?(')
+            self.considerError(lastError, 'semanticPredicate')
+            _G_python_319, lastError = eval('self.semanticPredicateExpr()', self.globals, _locals), None
+            self.considerError(lastError, 'semanticPredicate')
+            return (_G_python_319, self.currentError)
+
+
+        def rule_semanticAction(self):
+            _locals = {'self': self}
+            self.locals['semanticAction'] = _locals
+            _G_apply_320, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticAction')
+            _G_exactly_321, lastError = self.exactly('!(')
+            self.considerError(lastError, 'semanticAction')
+            _G_python_322, lastError = eval('self.semanticActionExpr()', self.globals, _locals), None
+            self.considerError(lastError, 'semanticAction')
+            return (_G_python_322, self.currentError)
+
+
+        def rule_ruleEnd(self):
+            _locals = {'self': self}
+            self.locals['ruleEnd'] = _locals
+            def _G_or_323():
+                def _G_many_324():
+                    _G_apply_325, lastError = self._apply(self.rule_hspace, "hspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_325, self.currentError)
+                _G_many_326, lastError = self.many(_G_many_324)
+                self.considerError(lastError, None)
+                def _G_many1_327():
+                    _G_apply_328, lastError = self._apply(self.rule_vspace, "vspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_328, self.currentError)
+                _G_many1_329, lastError = self.many(_G_many1_327, _G_many1_327())
+                self.considerError(lastError, None)
+                return (_G_many1_329, self.currentError)
+            def _G_or_330():
+                _G_apply_331, lastError = self._apply(self.rule_end, "end", [])
+                self.considerError(lastError, None)
+                return (_G_apply_331, self.currentError)
+            _G_or_332, lastError = self._or([_G_or_323, _G_or_330])
+            self.considerError(lastError, 'ruleEnd')
+            return (_G_or_332, self.currentError)
+
+
+        def rule_rulePart(self):
+            _locals = {'self': self}
+            self.locals['rulePart'] = _locals
+            _G_apply_333, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'rulePart')
+            _locals['requiredName'] = _G_apply_333
+            _G_apply_334, lastError = self._apply(self.rule_noindentation, "noindentation", [])
+            self.considerError(lastError, 'rulePart')
+            _G_apply_335, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'rulePart')
+            _locals['n'] = _G_apply_335
+            def _G_pred_336():
+                _G_python_337, lastError = eval('n == requiredName', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_337, self.currentError)
+            _G_pred_338, lastError = self.pred(_G_pred_336)
+            self.considerError(lastError, 'rulePart')
+            _G_python_339, lastError = eval('setattr(self, "rulename", n)', self.globals, _locals), None
+            self.considerError(lastError, 'rulePart')
+            def _G_optional_340():
+                _G_apply_341, lastError = self._apply(self.rule_expr4, "expr4", [])
+                self.considerError(lastError, None)
+                return (_G_apply_341, self.currentError)
+            def _G_optional_342():
+                return (None, self.input.nullError())
+            _G_or_343, lastError = self._or([_G_optional_340, _G_optional_342])
+            self.considerError(lastError, 'rulePart')
+            _locals['args'] = _G_or_343
+            def _G_or_344():
+                _G_apply_345, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_346, lastError = self.exactly('=')
+                self.considerError(lastError, None)
+                _G_apply_347, lastError = self._apply(self.rule_expr, "expr", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_347
+                _G_apply_348, lastError = self._apply(self.rule_ruleEnd, "ruleEnd", [])
+                self.considerError(lastError, None)
+                _G_python_349, lastError = eval('t.And([args, e]) if args else e', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_349, self.currentError)
+            def _G_or_350():
+                _G_apply_351, lastError = self._apply(self.rule_ruleEnd, "ruleEnd", [])
+                self.considerError(lastError, None)
+                _G_python_352, lastError = eval('args', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_352, self.currentError)
+            _G_or_353, lastError = self._or([_G_or_344, _G_or_350])
+            self.considerError(lastError, 'rulePart')
+            return (_G_or_353, self.currentError)
+
+
+        def rule_rule(self):
+            _locals = {'self': self}
+            self.locals['rule'] = _locals
+            _G_apply_354, lastError = self._apply(self.rule_noindentation, "noindentation", [])
+            self.considerError(lastError, 'rule')
+            def _G_lookahead_355():
+                _G_apply_356, lastError = self._apply(self.rule_name, "name", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_356
+                return (_locals['n'], self.currentError)
+            _G_lookahead_357, lastError = self.lookahead(_G_lookahead_355)
+            self.considerError(lastError, 'rule')
+            def _G_many1_358():
+                _G_python_359, lastError = eval('n', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_apply_360, lastError = self._apply(self.rule_rulePart, "rulePart", [_G_python_359])
+                self.considerError(lastError, None)
+                return (_G_apply_360, self.currentError)
+            _G_many1_361, lastError = self.many(_G_many1_358, _G_many1_358())
+            self.considerError(lastError, 'rule')
+            _locals['rs'] = _G_many1_361
+            _G_python_362, lastError = eval('t.Rule(n, t.Or(rs))', self.globals, _locals), None
+            self.considerError(lastError, 'rule')
+            return (_G_python_362, self.currentError)
+
+
+        def rule_grammar(self):
+            _locals = {'self': self}
+            self.locals['grammar'] = _locals
+            def _G_many_363():
+                _G_apply_364, lastError = self._apply(self.rule_rule, "rule", [])
+                self.considerError(lastError, None)
+                return (_G_apply_364, self.currentError)
+            _G_many_365, lastError = self.many(_G_many_363)
+            self.considerError(lastError, 'grammar')
+            _locals['rs'] = _G_many_365
+            _G_apply_366, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'grammar')
+            _G_python_367, lastError = eval('t.Grammar(self.name, self.tree_target, rs)', self.globals, _locals), None
+            self.considerError(lastError, 'grammar')
+            return (_G_python_367, self.currentError)
+
+
+    if parsley.globals is not None:
+        parsley.globals = parsley.globals.copy()
+        parsley.globals.update(ruleGlobals)
+    else:
+        parsley.globals = ruleGlobals
+    return parsley
diff --git a/lib/Parsley-1.1/ometa/_generated/parsley_termactions.py b/lib/Parsley-1.1/ometa/_generated/parsley_termactions.py
new file mode 100644
index 0000000..23d905c
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/_generated/parsley_termactions.py
@@ -0,0 +1,97 @@
+def createParserClass(GrammarBase, ruleGlobals):
+    if ruleGlobals is None:
+        ruleGlobals = {}
+    class parsley_termactions(GrammarBase):
+        def rule_ruleValue(self):
+            _locals = {'self': self}
+            self.locals['ruleValue'] = _locals
+            _G_apply_1, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'ruleValue')
+            _G_exactly_2, lastError = self.exactly('->')
+            self.considerError(lastError, 'ruleValue')
+            _G_apply_3, lastError = self._apply(self.rule_term, "term", [])
+            self.considerError(lastError, 'ruleValue')
+            _locals['tt'] = _G_apply_3
+            _G_python_4, lastError = eval('t.Action(tt)', self.globals, _locals), None
+            self.considerError(lastError, 'ruleValue')
+            return (_G_python_4, self.currentError)
+
+
+        def rule_semanticPredicate(self):
+            _locals = {'self': self}
+            self.locals['semanticPredicate'] = _locals
+            _G_apply_5, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticPredicate')
+            _G_exactly_6, lastError = self.exactly('?(')
+            self.considerError(lastError, 'semanticPredicate')
+            _G_apply_7, lastError = self._apply(self.rule_term, "term", [])
+            self.considerError(lastError, 'semanticPredicate')
+            _locals['tt'] = _G_apply_7
+            _G_apply_8, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticPredicate')
+            _G_exactly_9, lastError = self.exactly(')')
+            self.considerError(lastError, 'semanticPredicate')
+            _G_python_10, lastError = eval('t.Predicate(tt)', self.globals, _locals), None
+            self.considerError(lastError, 'semanticPredicate')
+            return (_G_python_10, self.currentError)
+
+
+        def rule_semanticAction(self):
+            _locals = {'self': self}
+            self.locals['semanticAction'] = _locals
+            _G_apply_11, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticAction')
+            _G_exactly_12, lastError = self.exactly('!(')
+            self.considerError(lastError, 'semanticAction')
+            _G_apply_13, lastError = self._apply(self.rule_term, "term", [])
+            self.considerError(lastError, 'semanticAction')
+            _locals['tt'] = _G_apply_13
+            _G_apply_14, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticAction')
+            _G_exactly_15, lastError = self.exactly(')')
+            self.considerError(lastError, 'semanticAction')
+            _G_python_16, lastError = eval('t.Action(tt)', self.globals, _locals), None
+            self.considerError(lastError, 'semanticAction')
+            return (_G_python_16, self.currentError)
+
+
+        def rule_application(self):
+            _locals = {'self': self}
+            self.locals['application'] = _locals
+            def _G_optional_17():
+                _G_apply_18, lastError = self._apply(self.rule_indentation, "indentation", [])
+                self.considerError(lastError, None)
+                return (_G_apply_18, self.currentError)
+            def _G_optional_19():
+                return (None, self.input.nullError())
+            _G_or_20, lastError = self._or([_G_optional_17, _G_optional_19])
+            self.considerError(lastError, 'application')
+            _G_apply_21, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'application')
+            _locals['name'] = _G_apply_21
+            def _G_or_22():
+                _G_exactly_23, lastError = self.exactly('(')
+                self.considerError(lastError, None)
+                _G_apply_24, lastError = self._apply(self.rule_term_arglist, "term_arglist", [])
+                self.considerError(lastError, None)
+                _locals['args'] = _G_apply_24
+                _G_exactly_25, lastError = self.exactly(')')
+                self.considerError(lastError, None)
+                _G_python_26, lastError = eval('t.Apply(name, self.rulename, args)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_26, self.currentError)
+            def _G_or_27():
+                _G_python_28, lastError = eval('t.Apply(name, self.rulename, [])', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_28, self.currentError)
+            _G_or_29, lastError = self._or([_G_or_22, _G_or_27])
+            self.considerError(lastError, 'application')
+            return (_G_or_29, self.currentError)
+
+
+    if parsley_termactions.globals is not None:
+        parsley_termactions.globals = parsley_termactions.globals.copy()
+        parsley_termactions.globals.update(ruleGlobals)
+    else:
+        parsley_termactions.globals = ruleGlobals
+    return parsley_termactions
\ No newline at end of file
diff --git a/lib/Parsley-1.1/ometa/_generated/parsley_tree_transformer.py b/lib/Parsley-1.1/ometa/_generated/parsley_tree_transformer.py
new file mode 100644
index 0000000..08b2691
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/_generated/parsley_tree_transformer.py
@@ -0,0 +1,486 @@
+def createParserClass(GrammarBase, ruleGlobals):
+    if ruleGlobals is None:
+        ruleGlobals = {}
+    class parsley_tree_transformer(GrammarBase):
+        def rule_termPattern(self):
+            _locals = {'self': self}
+            self.locals['termPattern'] = _locals
+            def _G_optional_1():
+                _G_apply_2, lastError = self._apply(self.rule_indentation, "indentation", [])
+                self.considerError(lastError, None)
+                return (_G_apply_2, self.currentError)
+            def _G_optional_3():
+                return (None, self.input.nullError())
+            _G_or_4, lastError = self._or([_G_optional_1, _G_optional_3])
+            self.considerError(lastError, 'termPattern')
+            _G_apply_5, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'termPattern')
+            _locals['name'] = _G_apply_5
+            def _G_pred_6():
+                _G_python_7, lastError = eval('name[0].isupper()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_7, self.currentError)
+            _G_pred_8, lastError = self.pred(_G_pred_6)
+            self.considerError(lastError, 'termPattern')
+            _G_exactly_9, lastError = self.exactly('(')
+            self.considerError(lastError, 'termPattern')
+            def _G_optional_10():
+                _G_apply_11, lastError = self._apply(self.rule_expr, "expr", [])
+                self.considerError(lastError, None)
+                return (_G_apply_11, self.currentError)
+            def _G_optional_12():
+                return (None, self.input.nullError())
+            _G_or_13, lastError = self._or([_G_optional_10, _G_optional_12])
+            self.considerError(lastError, 'termPattern')
+            _locals['patts'] = _G_or_13
+            _G_exactly_14, lastError = self.exactly(')')
+            self.considerError(lastError, 'termPattern')
+            _G_python_15, lastError = eval('t.TermPattern(name, patts)', self.globals, _locals), None
+            self.considerError(lastError, 'termPattern')
+            return (_G_python_15, self.currentError)
+
+
+        def rule_subtransform(self):
+            _locals = {'self': self}
+            self.locals['subtransform'] = _locals
+            _G_apply_16, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'subtransform')
+            _G_exactly_17, lastError = self.exactly('@')
+            self.considerError(lastError, 'subtransform')
+            _G_apply_18, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'subtransform')
+            _locals['n'] = _G_apply_18
+            _G_python_19, lastError = eval("t.Bind(n, t.Apply('transform', self.rulename, []))", self.globals, _locals), None
+            self.considerError(lastError, 'subtransform')
+            return (_G_python_19, self.currentError)
+
+
+        def rule_wide_templatedValue(self):
+            _locals = {'self': self}
+            self.locals['wide_templatedValue'] = _locals
+            _G_apply_20, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'wide_templatedValue')
+            _G_exactly_21, lastError = self.exactly('-->')
+            self.considerError(lastError, 'wide_templatedValue')
+            def _G_many_22():
+                _G_exactly_23, lastError = self.exactly(' ')
+                self.considerError(lastError, None)
+                return (_G_exactly_23, self.currentError)
+            _G_many_24, lastError = self.many(_G_many_22)
+            self.considerError(lastError, 'wide_templatedValue')
+            _G_apply_25, lastError = self._apply(self.rule_wideTemplateBits, "wideTemplateBits", [])
+            self.considerError(lastError, 'wide_templatedValue')
+            _locals['contents'] = _G_apply_25
+            _G_python_26, lastError = eval('t.StringTemplate(contents)', self.globals, _locals), None
+            self.considerError(lastError, 'wide_templatedValue')
+            return (_G_python_26, self.currentError)
+
+
+        def rule_tall_templatedValue(self):
+            _locals = {'self': self}
+            self.locals['tall_templatedValue'] = _locals
+            def _G_optional_27():
+                _G_apply_28, lastError = self._apply(self.rule_hspace, "hspace", [])
+                self.considerError(lastError, None)
+                return (_G_apply_28, self.currentError)
+            def _G_optional_29():
+                return (None, self.input.nullError())
+            _G_or_30, lastError = self._or([_G_optional_27, _G_optional_29])
+            self.considerError(lastError, 'tall_templatedValue')
+            _G_exactly_31, lastError = self.exactly('{{{')
+            self.considerError(lastError, 'tall_templatedValue')
+            def _G_many_32():
+                def _G_or_33():
+                    _G_exactly_34, lastError = self.exactly(' ')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_34, self.currentError)
+                def _G_or_35():
+                    _G_exactly_36, lastError = self.exactly('\t')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_36, self.currentError)
+                _G_or_37, lastError = self._or([_G_or_33, _G_or_35])
+                self.considerError(lastError, None)
+                return (_G_or_37, self.currentError)
+            _G_many_38, lastError = self.many(_G_many_32)
+            self.considerError(lastError, 'tall_templatedValue')
+            def _G_optional_39():
+                _G_apply_40, lastError = self._apply(self.rule_vspace, "vspace", [])
+                self.considerError(lastError, None)
+                return (_G_apply_40, self.currentError)
+            def _G_optional_41():
+                return (None, self.input.nullError())
+            _G_or_42, lastError = self._or([_G_optional_39, _G_optional_41])
+            self.considerError(lastError, 'tall_templatedValue')
+            _G_apply_43, lastError = self._apply(self.rule_tallTemplateBits, "tallTemplateBits", [])
+            self.considerError(lastError, 'tall_templatedValue')
+            _locals['contents'] = _G_apply_43
+            _G_exactly_44, lastError = self.exactly('}}}')
+            self.considerError(lastError, 'tall_templatedValue')
+            _G_python_45, lastError = eval('t.StringTemplate(contents)', self.globals, _locals), None
+            self.considerError(lastError, 'tall_templatedValue')
+            return (_G_python_45, self.currentError)
+
+
+        def rule_tallTemplateBits(self):
+            _locals = {'self': self}
+            self.locals['tallTemplateBits'] = _locals
+            def _G_many_46():
+                def _G_or_47():
+                    _G_apply_48, lastError = self._apply(self.rule_exprHole, "exprHole", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_48, self.currentError)
+                def _G_or_49():
+                    _G_apply_50, lastError = self._apply(self.rule_tallTemplateText, "tallTemplateText", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_50, self.currentError)
+                _G_or_51, lastError = self._or([_G_or_47, _G_or_49])
+                self.considerError(lastError, None)
+                return (_G_or_51, self.currentError)
+            _G_many_52, lastError = self.many(_G_many_46)
+            self.considerError(lastError, 'tallTemplateBits')
+            return (_G_many_52, self.currentError)
+
+
+        def rule_tallTemplateText(self):
+            _locals = {'self': self}
+            self.locals['tallTemplateText'] = _locals
+            def _G_or_53():
+                def _G_consumedby_54():
+                    def _G_many1_55():
+                        def _G_or_56():
+                            def _G_not_57():
+                                def _G_or_58():
+                                    _G_exactly_59, lastError = self.exactly('}}}')
+                                    self.considerError(lastError, None)
+                                    return (_G_exactly_59, self.currentError)
+                                def _G_or_60():
+                                    _G_exactly_61, lastError = self.exactly('$')
+                                    self.considerError(lastError, None)
+                                    return (_G_exactly_61, self.currentError)
+                                def _G_or_62():
+                                    _G_exactly_63, lastError = self.exactly('\r')
+                                    self.considerError(lastError, None)
+                                    return (_G_exactly_63, self.currentError)
+                                def _G_or_64():
+                                    _G_exactly_65, lastError = self.exactly('\n')
+                                    self.considerError(lastError, None)
+                                    return (_G_exactly_65, self.currentError)
+                                _G_or_66, lastError = self._or([_G_or_58, _G_or_60, _G_or_62, _G_or_64])
+                                self.considerError(lastError, None)
+                                return (_G_or_66, self.currentError)
+                            _G_not_67, lastError = self._not(_G_not_57)
+                            self.considerError(lastError, None)
+                            _G_apply_68, lastError = self._apply(self.rule_anything, "anything", [])
+                            self.considerError(lastError, None)
+                            return (_G_apply_68, self.currentError)
+                        def _G_or_69():
+                            _G_exactly_70, lastError = self.exactly('$')
+                            self.considerError(lastError, None)
+                            _G_exactly_71, lastError = self.exactly('$')
+                            self.considerError(lastError, None)
+                            return (_G_exactly_71, self.currentError)
+                        _G_or_72, lastError = self._or([_G_or_56, _G_or_69])
+                        self.considerError(lastError, None)
+                        return (_G_or_72, self.currentError)
+                    _G_many1_73, lastError = self.many(_G_many1_55, _G_many1_55())
+                    self.considerError(lastError, None)
+                    def _G_many_74():
+                        _G_apply_75, lastError = self._apply(self.rule_vspace, "vspace", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_75, self.currentError)
+                    _G_many_76, lastError = self.many(_G_many_74)
+                    self.considerError(lastError, None)
+                    return (_G_many_76, self.currentError)
+                _G_consumedby_77, lastError = self.consumedby(_G_consumedby_54)
+                self.considerError(lastError, None)
+                return (_G_consumedby_77, self.currentError)
+            def _G_or_78():
+                _G_apply_79, lastError = self._apply(self.rule_vspace, "vspace", [])
+                self.considerError(lastError, None)
+                return (_G_apply_79, self.currentError)
+            _G_or_80, lastError = self._or([_G_or_53, _G_or_78])
+            self.considerError(lastError, 'tallTemplateText')
+            return (_G_or_80, self.currentError)
+
+
+        def rule_wideTemplateBits(self):
+            _locals = {'self': self}
+            self.locals['wideTemplateBits'] = _locals
+            def _G_many_81():
+                def _G_or_82():
+                    _G_apply_83, lastError = self._apply(self.rule_exprHole, "exprHole", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_83, self.currentError)
+                def _G_or_84():
+                    _G_apply_85, lastError = self._apply(self.rule_wideTemplateText, "wideTemplateText", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_85, self.currentError)
+                _G_or_86, lastError = self._or([_G_or_82, _G_or_84])
+                self.considerError(lastError, None)
+                return (_G_or_86, self.currentError)
+            _G_many_87, lastError = self.many(_G_many_81)
+            self.considerError(lastError, 'wideTemplateBits')
+            return (_G_many_87, self.currentError)
+
+
+        def rule_wideTemplateText(self):
+            _locals = {'self': self}
+            self.locals['wideTemplateText'] = _locals
+            def _G_consumedby_88():
+                def _G_many1_89():
+                    def _G_or_90():
+                        def _G_not_91():
+                            def _G_or_92():
+                                _G_apply_93, lastError = self._apply(self.rule_vspace, "vspace", [])
+                                self.considerError(lastError, None)
+                                return (_G_apply_93, self.currentError)
+                            def _G_or_94():
+                                _G_apply_95, lastError = self._apply(self.rule_end, "end", [])
+                                self.considerError(lastError, None)
+                                return (_G_apply_95, self.currentError)
+                            def _G_or_96():
+                                _G_exactly_97, lastError = self.exactly('$')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_97, self.currentError)
+                            _G_or_98, lastError = self._or([_G_or_92, _G_or_94, _G_or_96])
+                            self.considerError(lastError, None)
+                            return (_G_or_98, self.currentError)
+                        _G_not_99, lastError = self._not(_G_not_91)
+                        self.considerError(lastError, None)
+                        _G_apply_100, lastError = self._apply(self.rule_anything, "anything", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_100, self.currentError)
+                    def _G_or_101():
+                        _G_exactly_102, lastError = self.exactly('$')
+                        self.considerError(lastError, None)
+                        _G_exactly_103, lastError = self.exactly('$')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_103, self.currentError)
+                    _G_or_104, lastError = self._or([_G_or_90, _G_or_101])
+                    self.considerError(lastError, None)
+                    return (_G_or_104, self.currentError)
+                _G_many1_105, lastError = self.many(_G_many1_89, _G_many1_89())
+                self.considerError(lastError, None)
+                return (_G_many1_105, self.currentError)
+            _G_consumedby_106, lastError = self.consumedby(_G_consumedby_88)
+            self.considerError(lastError, 'wideTemplateText')
+            return (_G_consumedby_106, self.currentError)
+
+
+        def rule_exprHole(self):
+            _locals = {'self': self}
+            self.locals['exprHole'] = _locals
+            _G_exactly_107, lastError = self.exactly('$')
+            self.considerError(lastError, 'exprHole')
+            _G_apply_108, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'exprHole')
+            _locals['n'] = _G_apply_108
+            _G_python_109, lastError = eval('t.QuasiExprHole(n)', self.globals, _locals), None
+            self.considerError(lastError, 'exprHole')
+            return (_G_python_109, self.currentError)
+
+
+        def rule_expr1(self):
+            _locals = {'self': self}
+            self.locals['expr1'] = _locals
+            def _G_or_110():
+                _G_apply_111, lastError = self._apply(self.rule_foreignApply, "foreignApply", [])
+                self.considerError(lastError, None)
+                return (_G_apply_111, self.currentError)
+            def _G_or_112():
+                _G_apply_113, lastError = self._apply(self.rule_termPattern, "termPattern", [])
+                self.considerError(lastError, None)
+                return (_G_apply_113, self.currentError)
+            def _G_or_114():
+                _G_apply_115, lastError = self._apply(self.rule_subtransform, "subtransform", [])
+                self.considerError(lastError, None)
+                return (_G_apply_115, self.currentError)
+            def _G_or_116():
+                _G_apply_117, lastError = self._apply(self.rule_application, "application", [])
+                self.considerError(lastError, None)
+                return (_G_apply_117, self.currentError)
+            def _G_or_118():
+                _G_apply_119, lastError = self._apply(self.rule_ruleValue, "ruleValue", [])
+                self.considerError(lastError, None)
+                return (_G_apply_119, self.currentError)
+            def _G_or_120():
+                _G_apply_121, lastError = self._apply(self.rule_wide_templatedValue, "wide_templatedValue", [])
+                self.considerError(lastError, None)
+                return (_G_apply_121, self.currentError)
+            def _G_or_122():
+                _G_apply_123, lastError = self._apply(self.rule_tall_templatedValue, "tall_templatedValue", [])
+                self.considerError(lastError, None)
+                return (_G_apply_123, self.currentError)
+            def _G_or_124():
+                _G_apply_125, lastError = self._apply(self.rule_semanticPredicate, "semanticPredicate", [])
+                self.considerError(lastError, None)
+                return (_G_apply_125, self.currentError)
+            def _G_or_126():
+                _G_apply_127, lastError = self._apply(self.rule_semanticAction, "semanticAction", [])
+                self.considerError(lastError, None)
+                return (_G_apply_127, self.currentError)
+            def _G_or_128():
+                _G_apply_129, lastError = self._apply(self.rule_number, "number", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_129
+                _G_python_130, lastError = eval('self.isTree()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_python_131, lastError = eval('n', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_131, self.currentError)
+            def _G_or_132():
+                _G_apply_133, lastError = self._apply(self.rule_character, "character", [])
+                self.considerError(lastError, None)
+                return (_G_apply_133, self.currentError)
+            def _G_or_134():
+                _G_apply_135, lastError = self._apply(self.rule_string, "string", [])
+                self.considerError(lastError, None)
+                return (_G_apply_135, self.currentError)
+            def _G_or_136():
+                _G_apply_137, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_138, lastError = self.exactly('(')
+                self.considerError(lastError, None)
+                def _G_optional_139():
+                    _G_apply_140, lastError = self._apply(self.rule_expr, "expr", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_140, self.currentError)
+                def _G_optional_141():
+                    return (None, self.input.nullError())
+                _G_or_142, lastError = self._or([_G_optional_139, _G_optional_141])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_or_142
+                _G_apply_143, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_144, lastError = self.exactly(')')
+                self.considerError(lastError, None)
+                _G_python_145, lastError = eval('e', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_145, self.currentError)
+            def _G_or_146():
+                _G_apply_147, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_148, lastError = self.exactly('[')
+                self.considerError(lastError, None)
+                def _G_optional_149():
+                    _G_apply_150, lastError = self._apply(self.rule_expr, "expr", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_150, self.currentError)
+                def _G_optional_151():
+                    return (None, self.input.nullError())
+                _G_or_152, lastError = self._or([_G_optional_149, _G_optional_151])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_or_152
+                _G_apply_153, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_154, lastError = self.exactly(']')
+                self.considerError(lastError, None)
+                _G_python_155, lastError = eval('t.TermPattern(".tuple.", e or t.And([]))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_155, self.currentError)
+            _G_or_156, lastError = self._or([_G_or_110, _G_or_112, _G_or_114, _G_or_116, _G_or_118, _G_or_120, _G_or_122, _G_or_124, _G_or_126, _G_or_128, _G_or_132, _G_or_134, _G_or_136, _G_or_146])
+            self.considerError(lastError, 'expr1')
+            return (_G_or_156, self.currentError)
+
+
+        def rule_grammar(self):
+            _locals = {'self': self}
+            self.locals['grammar'] = _locals
+            def _G_many_157():
+                _G_apply_158, lastError = self._apply(self.rule_rule, "rule", [])
+                self.considerError(lastError, None)
+                return (_G_apply_158, self.currentError)
+            _G_many_159, lastError = self.many(_G_many_157)
+            self.considerError(lastError, 'grammar')
+            _locals['rs'] = _G_many_159
+            _G_apply_160, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'grammar')
+            _G_python_161, lastError = eval('t.Grammar(self.name, True, rs)', self.globals, _locals), None
+            self.considerError(lastError, 'grammar')
+            return (_G_python_161, self.currentError)
+
+
+        def rule_rule(self):
+            _locals = {'self': self}
+            self.locals['rule'] = _locals
+            _G_apply_162, lastError = self._apply(self.rule_noindentation, "noindentation", [])
+            self.considerError(lastError, 'rule')
+            def _G_lookahead_163():
+                _G_apply_164, lastError = self._apply(self.rule_name, "name", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_164
+                return (_locals['n'], self.currentError)
+            _G_lookahead_165, lastError = self.lookahead(_G_lookahead_163)
+            self.considerError(lastError, 'rule')
+            def _G_or_166():
+                def _G_many1_167():
+                    _G_python_168, lastError = eval('n', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    _G_apply_169, lastError = self._apply(self.rule_termRulePart, "termRulePart", [_G_python_168])
+                    self.considerError(lastError, None)
+                    return (_G_apply_169, self.currentError)
+                _G_many1_170, lastError = self.many(_G_many1_167, _G_many1_167())
+                self.considerError(lastError, None)
+                _locals['rs'] = _G_many1_170
+                return (_locals['rs'], self.currentError)
+            def _G_or_171():
+                def _G_many1_172():
+                    _G_python_173, lastError = eval('n', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    _G_apply_174, lastError = self._apply(self.rule_rulePart, "rulePart", [_G_python_173])
+                    self.considerError(lastError, None)
+                    return (_G_apply_174, self.currentError)
+                _G_many1_175, lastError = self.many(_G_many1_172, _G_many1_172())
+                self.considerError(lastError, None)
+                _locals['rs'] = _G_many1_175
+                return (_locals['rs'], self.currentError)
+            _G_or_176, lastError = self._or([_G_or_166, _G_or_171])
+            self.considerError(lastError, 'rule')
+            _G_python_177, lastError = eval('t.Rule(n, t.Or(rs))', self.globals, _locals), None
+            self.considerError(lastError, 'rule')
+            return (_G_python_177, self.currentError)
+
+
+        def rule_termRulePart(self):
+            _locals = {'self': self}
+            self.locals['termRulePart'] = _locals
+            _G_apply_178, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'termRulePart')
+            _locals['requiredName'] = _G_apply_178
+            _G_apply_179, lastError = self._apply(self.rule_noindentation, "noindentation", [])
+            self.considerError(lastError, 'termRulePart')
+            _G_python_180, lastError = eval('setattr(self, "rulename", requiredName)', self.globals, _locals), None
+            self.considerError(lastError, 'termRulePart')
+            _G_apply_181, lastError = self._apply(self.rule_termPattern, "termPattern", [])
+            self.considerError(lastError, 'termRulePart')
+            _locals['tt'] = _G_apply_181
+            def _G_pred_182():
+                _G_python_183, lastError = eval('tt.args[0].data == requiredName', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_183, self.currentError)
+            _G_pred_184, lastError = self.pred(_G_pred_182)
+            self.considerError(lastError, 'termRulePart')
+            def _G_optional_185():
+                _G_python_186, lastError = "=", None
+                self.considerError(lastError, None)
+                _G_apply_187, lastError = self._apply(self.rule_token, "token", [_G_python_186])
+                self.considerError(lastError, None)
+                return (_G_apply_187, self.currentError)
+            def _G_optional_188():
+                return (None, self.input.nullError())
+            _G_or_189, lastError = self._or([_G_optional_185, _G_optional_188])
+            self.considerError(lastError, 'termRulePart')
+            _G_apply_190, lastError = self._apply(self.rule_expr, "expr", [])
+            self.considerError(lastError, 'termRulePart')
+            _locals['tail'] = _G_apply_190
+            _G_python_191, lastError = eval('t.And([tt, tail])', self.globals, _locals), None
+            self.considerError(lastError, 'termRulePart')
+            return (_G_python_191, self.currentError)
+
+
+    if parsley_tree_transformer.globals is not None:
+        parsley_tree_transformer.globals = parsley_tree_transformer.globals.copy()
+        parsley_tree_transformer.globals.update(ruleGlobals)
+    else:
+        parsley_tree_transformer.globals = ruleGlobals
+    return parsley_tree_transformer
\ No newline at end of file
diff --git a/lib/Parsley-1.1/ometa/_generated/pymeta_v1.py b/lib/Parsley-1.1/ometa/_generated/pymeta_v1.py
new file mode 100644
index 0000000..2b2baf1
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/_generated/pymeta_v1.py
@@ -0,0 +1,779 @@
+def createParserClass(GrammarBase, ruleGlobals):
+    if ruleGlobals is None:
+        ruleGlobals = {}
+    class pymeta_v1(GrammarBase):
+        def rule_comment(self):
+            _locals = {'self': self}
+            self.locals['comment'] = _locals
+            _G_exactly_1, lastError = self.exactly('#')
+            self.considerError(lastError, 'comment')
+            def _G_many_2():
+                def _G_not_3():
+                    _G_exactly_4, lastError = self.exactly('\n')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_4, self.currentError)
+                _G_not_5, lastError = self._not(_G_not_3)
+                self.considerError(lastError, None)
+                _G_apply_6, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError, None)
+                return (_G_apply_6, self.currentError)
+            _G_many_7, lastError = self.many(_G_many_2)
+            self.considerError(lastError, 'comment')
+            return (_G_many_7, self.currentError)
+
+
+        def rule_hspace(self):
+            _locals = {'self': self}
+            self.locals['hspace'] = _locals
+            def _G_or_8():
+                _G_exactly_9, lastError = self.exactly(' ')
+                self.considerError(lastError, None)
+                return (_G_exactly_9, self.currentError)
+            def _G_or_10():
+                _G_exactly_11, lastError = self.exactly('\t')
+                self.considerError(lastError, None)
+                return (_G_exactly_11, self.currentError)
+            def _G_or_12():
+                _G_apply_13, lastError = self._apply(self.rule_comment, "comment", [])
+                self.considerError(lastError, None)
+                return (_G_apply_13, self.currentError)
+            _G_or_14, lastError = self._or([_G_or_8, _G_or_10, _G_or_12])
+            self.considerError(lastError, 'hspace')
+            return (_G_or_14, self.currentError)
+
+
+        def rule_vspace(self):
+            _locals = {'self': self}
+            self.locals['vspace'] = _locals
+            def _G_or_15():
+                _G_exactly_16, lastError = self.exactly('\r\n')
+                self.considerError(lastError, None)
+                return (_G_exactly_16, self.currentError)
+            def _G_or_17():
+                _G_exactly_18, lastError = self.exactly('\r')
+                self.considerError(lastError, None)
+                return (_G_exactly_18, self.currentError)
+            def _G_or_19():
+                _G_exactly_20, lastError = self.exactly('\n')
+                self.considerError(lastError, None)
+                return (_G_exactly_20, self.currentError)
+            _G_or_21, lastError = self._or([_G_or_15, _G_or_17, _G_or_19])
+            self.considerError(lastError, 'vspace')
+            return (_G_or_21, self.currentError)
+
+
+        def rule_ws(self):
+            _locals = {'self': self}
+            self.locals['ws'] = _locals
+            def _G_many_22():
+                def _G_or_23():
+                    _G_apply_24, lastError = self._apply(self.rule_hspace, "hspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_24, self.currentError)
+                def _G_or_25():
+                    _G_apply_26, lastError = self._apply(self.rule_vspace, "vspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_26, self.currentError)
+                def _G_or_27():
+                    _G_apply_28, lastError = self._apply(self.rule_comment, "comment", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_28, self.currentError)
+                _G_or_29, lastError = self._or([_G_or_23, _G_or_25, _G_or_27])
+                self.considerError(lastError, None)
+                return (_G_or_29, self.currentError)
+            _G_many_30, lastError = self.many(_G_many_22)
+            self.considerError(lastError, 'ws')
+            return (_G_many_30, self.currentError)
+
+
+        def rule_number(self):
+            _locals = {'self': self}
+            self.locals['number'] = _locals
+            _G_apply_31, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'number')
+            def _G_or_32():
+                _G_exactly_33, lastError = self.exactly('-')
+                self.considerError(lastError, None)
+                _G_apply_34, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_34
+                _G_python_35, lastError = eval('t.Exactly(-x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_35, self.currentError)
+            def _G_or_36():
+                _G_apply_37, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_37
+                _G_python_38, lastError = eval('t.Exactly(x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_38, self.currentError)
+            _G_or_39, lastError = self._or([_G_or_32, _G_or_36])
+            self.considerError(lastError, 'number')
+            return (_G_or_39, self.currentError)
+
+
+        def rule_barenumber(self):
+            _locals = {'self': self}
+            self.locals['barenumber'] = _locals
+            def _G_or_40():
+                _G_exactly_41, lastError = self.exactly('0')
+                self.considerError(lastError, None)
+                def _G_or_42():
+                    def _G_or_43():
+                        _G_exactly_44, lastError = self.exactly('x')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_44, self.currentError)
+                    def _G_or_45():
+                        _G_exactly_46, lastError = self.exactly('X')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_46, self.currentError)
+                    _G_or_47, lastError = self._or([_G_or_43, _G_or_45])
+                    self.considerError(lastError, None)
+                    def _G_consumedby_48():
+                        def _G_many1_49():
+                            _G_apply_50, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                            self.considerError(lastError, None)
+                            return (_G_apply_50, self.currentError)
+                        _G_many1_51, lastError = self.many(_G_many1_49, _G_many1_49())
+                        self.considerError(lastError, None)
+                        return (_G_many1_51, self.currentError)
+                    _G_consumedby_52, lastError = self.consumedby(_G_consumedby_48)
+                    self.considerError(lastError, None)
+                    _locals['hs'] = _G_consumedby_52
+                    _G_python_53, lastError = eval('int(hs, 16)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_53, self.currentError)
+                def _G_or_54():
+                    def _G_consumedby_55():
+                        def _G_many1_56():
+                            _G_apply_57, lastError = self._apply(self.rule_octaldigit, "octaldigit", [])
+                            self.considerError(lastError, None)
+                            return (_G_apply_57, self.currentError)
+                        _G_many1_58, lastError = self.many(_G_many1_56, _G_many1_56())
+                        self.considerError(lastError, None)
+                        return (_G_many1_58, self.currentError)
+                    _G_consumedby_59, lastError = self.consumedby(_G_consumedby_55)
+                    self.considerError(lastError, None)
+                    _locals['ds'] = _G_consumedby_59
+                    _G_python_60, lastError = eval('int(ds, 8)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_60, self.currentError)
+                _G_or_61, lastError = self._or([_G_or_42, _G_or_54])
+                self.considerError(lastError, None)
+                return (_G_or_61, self.currentError)
+            def _G_or_62():
+                def _G_consumedby_63():
+                    def _G_many1_64():
+                        _G_apply_65, lastError = self._apply(self.rule_digit, "digit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_65, self.currentError)
+                    _G_many1_66, lastError = self.many(_G_many1_64, _G_many1_64())
+                    self.considerError(lastError, None)
+                    return (_G_many1_66, self.currentError)
+                _G_consumedby_67, lastError = self.consumedby(_G_consumedby_63)
+                self.considerError(lastError, None)
+                _locals['ds'] = _G_consumedby_67
+                _G_python_68, lastError = eval('int(ds)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_68, self.currentError)
+            _G_or_69, lastError = self._or([_G_or_40, _G_or_62])
+            self.considerError(lastError, 'barenumber')
+            return (_G_or_69, self.currentError)
+
+
+        def rule_octaldigit(self):
+            _locals = {'self': self}
+            self.locals['octaldigit'] = _locals
+            _G_apply_70, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'octaldigit')
+            _locals['x'] = _G_apply_70
+            def _G_pred_71():
+                _G_python_72, lastError = eval("x in '01234567'", self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_72, self.currentError)
+            _G_pred_73, lastError = self.pred(_G_pred_71)
+            self.considerError(lastError, 'octaldigit')
+            _G_python_74, lastError = eval('x', self.globals, _locals), None
+            self.considerError(lastError, 'octaldigit')
+            return (_G_python_74, self.currentError)
+
+
+        def rule_hexdigit(self):
+            _locals = {'self': self}
+            self.locals['hexdigit'] = _locals
+            _G_apply_75, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'hexdigit')
+            _locals['x'] = _G_apply_75
+            def _G_pred_76():
+                _G_python_77, lastError = eval("x in '0123456789ABCDEFabcdef'", self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_77, self.currentError)
+            _G_pred_78, lastError = self.pred(_G_pred_76)
+            self.considerError(lastError, 'hexdigit')
+            _G_python_79, lastError = eval('x', self.globals, _locals), None
+            self.considerError(lastError, 'hexdigit')
+            return (_G_python_79, self.currentError)
+
+
+        def rule_escapedChar(self):
+            _locals = {'self': self}
+            self.locals['escapedChar'] = _locals
+            _G_exactly_80, lastError = self.exactly('\\')
+            self.considerError(lastError, 'escapedChar')
+            def _G_or_81():
+                _G_exactly_82, lastError = self.exactly('n')
+                self.considerError(lastError, None)
+                _G_python_83, lastError = "\n", None
+                self.considerError(lastError, None)
+                return (_G_python_83, self.currentError)
+            def _G_or_84():
+                _G_exactly_85, lastError = self.exactly('r')
+                self.considerError(lastError, None)
+                _G_python_86, lastError = "\r", None
+                self.considerError(lastError, None)
+                return (_G_python_86, self.currentError)
+            def _G_or_87():
+                _G_exactly_88, lastError = self.exactly('t')
+                self.considerError(lastError, None)
+                _G_python_89, lastError = "\t", None
+                self.considerError(lastError, None)
+                return (_G_python_89, self.currentError)
+            def _G_or_90():
+                _G_exactly_91, lastError = self.exactly('b')
+                self.considerError(lastError, None)
+                _G_python_92, lastError = "\b", None
+                self.considerError(lastError, None)
+                return (_G_python_92, self.currentError)
+            def _G_or_93():
+                _G_exactly_94, lastError = self.exactly('f')
+                self.considerError(lastError, None)
+                _G_python_95, lastError = "\f", None
+                self.considerError(lastError, None)
+                return (_G_python_95, self.currentError)
+            def _G_or_96():
+                _G_exactly_97, lastError = self.exactly('"')
+                self.considerError(lastError, None)
+                _G_python_98, lastError = '"', None
+                self.considerError(lastError, None)
+                return (_G_python_98, self.currentError)
+            def _G_or_99():
+                _G_exactly_100, lastError = self.exactly("'")
+                self.considerError(lastError, None)
+                _G_python_101, lastError = "'", None
+                self.considerError(lastError, None)
+                return (_G_python_101, self.currentError)
+            def _G_or_102():
+                _G_exactly_103, lastError = self.exactly('\\')
+                self.considerError(lastError, None)
+                _G_python_104, lastError = "\\", None
+                self.considerError(lastError, None)
+                return (_G_python_104, self.currentError)
+            _G_or_105, lastError = self._or([_G_or_81, _G_or_84, _G_or_87, _G_or_90, _G_or_93, _G_or_96, _G_or_99, _G_or_102])
+            self.considerError(lastError, 'escapedChar')
+            return (_G_or_105, self.currentError)
+
+
+        def rule_character(self):
+            _locals = {'self': self}
+            self.locals['character'] = _locals
+            _G_apply_106, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'character')
+            _G_exactly_107, lastError = self.exactly("'")
+            self.considerError(lastError, 'character')
+            def _G_or_108():
+                _G_apply_109, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                self.considerError(lastError, None)
+                return (_G_apply_109, self.currentError)
+            def _G_or_110():
+                _G_apply_111, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError, None)
+                return (_G_apply_111, self.currentError)
+            _G_or_112, lastError = self._or([_G_or_108, _G_or_110])
+            self.considerError(lastError, 'character')
+            _locals['c'] = _G_or_112
+            _G_apply_113, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'character')
+            _G_exactly_114, lastError = self.exactly("'")
+            self.considerError(lastError, 'character')
+            _G_python_115, lastError = eval('t.Exactly(c)', self.globals, _locals), None
+            self.considerError(lastError, 'character')
+            return (_G_python_115, self.currentError)
+
+
+        def rule_string(self):
+            _locals = {'self': self}
+            self.locals['string'] = _locals
+            _G_apply_116, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'string')
+            _G_exactly_117, lastError = self.exactly('"')
+            self.considerError(lastError, 'string')
+            def _G_many_118():
+                def _G_or_119():
+                    _G_apply_120, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_120, self.currentError)
+                def _G_or_121():
+                    def _G_not_122():
+                        _G_exactly_123, lastError = self.exactly('"')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_123, self.currentError)
+                    _G_not_124, lastError = self._not(_G_not_122)
+                    self.considerError(lastError, None)
+                    _G_apply_125, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_125, self.currentError)
+                _G_or_126, lastError = self._or([_G_or_119, _G_or_121])
+                self.considerError(lastError, None)
+                return (_G_or_126, self.currentError)
+            _G_many_127, lastError = self.many(_G_many_118)
+            self.considerError(lastError, 'string')
+            _locals['c'] = _G_many_127
+            _G_exactly_128, lastError = self.exactly('"')
+            self.considerError(lastError, 'string')
+            _G_python_129, lastError = eval("t.Exactly(''.join(c))", self.globals, _locals), None
+            self.considerError(lastError, 'string')
+            return (_G_python_129, self.currentError)
+
+
+        def rule_name(self):
+            _locals = {'self': self}
+            self.locals['name'] = _locals
+            def _G_consumedby_130():
+                _G_apply_131, lastError = self._apply(self.rule_letter, "letter", [])
+                self.considerError(lastError, None)
+                def _G_many_132():
+                    def _G_or_133():
+                        _G_apply_134, lastError = self._apply(self.rule_letterOrDigit, "letterOrDigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_134, self.currentError)
+                    def _G_or_135():
+                        _G_exactly_136, lastError = self.exactly('_')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_136, self.currentError)
+                    _G_or_137, lastError = self._or([_G_or_133, _G_or_135])
+                    self.considerError(lastError, None)
+                    return (_G_or_137, self.currentError)
+                _G_many_138, lastError = self.many(_G_many_132)
+                self.considerError(lastError, None)
+                return (_G_many_138, self.currentError)
+            _G_consumedby_139, lastError = self.consumedby(_G_consumedby_130)
+            self.considerError(lastError, 'name')
+            return (_G_consumedby_139, self.currentError)
+
+
+        def rule_application(self):
+            _locals = {'self': self}
+            self.locals['application'] = _locals
+            _G_apply_140, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'application')
+            _G_exactly_141, lastError = self.exactly('<')
+            self.considerError(lastError, 'application')
+            _G_apply_142, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'application')
+            _G_apply_143, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'application')
+            _locals['name'] = _G_apply_143
+            def _G_or_144():
+                _G_exactly_145, lastError = self.exactly(' ')
+                self.considerError(lastError, None)
+                _G_python_146, lastError = eval("self.applicationArgs(finalChar='>')", self.globals, _locals), None
+                self.considerError(lastError, None)
+                _locals['args'] = _G_python_146
+                _G_exactly_147, lastError = self.exactly('>')
+                self.considerError(lastError, None)
+                _G_python_148, lastError = eval('t.Apply(name, self.rulename, args)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_148, self.currentError)
+            def _G_or_149():
+                _G_apply_150, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_151, lastError = self.exactly('>')
+                self.considerError(lastError, None)
+                _G_python_152, lastError = eval('t.Apply(name, self.rulename, [])', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_152, self.currentError)
+            _G_or_153, lastError = self._or([_G_or_144, _G_or_149])
+            self.considerError(lastError, 'application')
+            return (_G_or_153, self.currentError)
+
+
+        def rule_expr1(self):
+            _locals = {'self': self}
+            self.locals['expr1'] = _locals
+            def _G_or_154():
+                _G_apply_155, lastError = self._apply(self.rule_application, "application", [])
+                self.considerError(lastError, None)
+                return (_G_apply_155, self.currentError)
+            def _G_or_156():
+                _G_apply_157, lastError = self._apply(self.rule_ruleValue, "ruleValue", [])
+                self.considerError(lastError, None)
+                return (_G_apply_157, self.currentError)
+            def _G_or_158():
+                _G_apply_159, lastError = self._apply(self.rule_semanticPredicate, "semanticPredicate", [])
+                self.considerError(lastError, None)
+                return (_G_apply_159, self.currentError)
+            def _G_or_160():
+                _G_apply_161, lastError = self._apply(self.rule_semanticAction, "semanticAction", [])
+                self.considerError(lastError, None)
+                return (_G_apply_161, self.currentError)
+            def _G_or_162():
+                _G_apply_163, lastError = self._apply(self.rule_number, "number", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_163
+                _G_python_164, lastError = eval('self.isTree()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_python_165, lastError = eval('n', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_165, self.currentError)
+            def _G_or_166():
+                _G_apply_167, lastError = self._apply(self.rule_character, "character", [])
+                self.considerError(lastError, None)
+                return (_G_apply_167, self.currentError)
+            def _G_or_168():
+                _G_apply_169, lastError = self._apply(self.rule_string, "string", [])
+                self.considerError(lastError, None)
+                return (_G_apply_169, self.currentError)
+            def _G_or_170():
+                _G_apply_171, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_172, lastError = self.exactly('(')
+                self.considerError(lastError, None)
+                _G_apply_173, lastError = self._apply(self.rule_expr, "expr", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_173
+                _G_apply_174, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_175, lastError = self.exactly(')')
+                self.considerError(lastError, None)
+                _G_python_176, lastError = eval('e', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_176, self.currentError)
+            def _G_or_177():
+                _G_apply_178, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_179, lastError = self.exactly('[')
+                self.considerError(lastError, None)
+                _G_apply_180, lastError = self._apply(self.rule_expr, "expr", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_180
+                _G_apply_181, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_182, lastError = self.exactly(']')
+                self.considerError(lastError, None)
+                _G_python_183, lastError = eval('self.isTree()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_python_184, lastError = eval('t.List(e)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_184, self.currentError)
+            _G_or_185, lastError = self._or([_G_or_154, _G_or_156, _G_or_158, _G_or_160, _G_or_162, _G_or_166, _G_or_168, _G_or_170, _G_or_177])
+            self.considerError(lastError, 'expr1')
+            return (_G_or_185, self.currentError)
+
+
+        def rule_expr2(self):
+            _locals = {'self': self}
+            self.locals['expr2'] = _locals
+            def _G_or_186():
+                _G_apply_187, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_188, lastError = self.exactly('~')
+                self.considerError(lastError, None)
+                def _G_or_189():
+                    _G_exactly_190, lastError = self.exactly('~')
+                    self.considerError(lastError, None)
+                    _G_apply_191, lastError = self._apply(self.rule_expr2, "expr2", [])
+                    self.considerError(lastError, None)
+                    _locals['e'] = _G_apply_191
+                    _G_python_192, lastError = eval('t.Lookahead(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_192, self.currentError)
+                def _G_or_193():
+                    _G_apply_194, lastError = self._apply(self.rule_expr2, "expr2", [])
+                    self.considerError(lastError, None)
+                    _locals['e'] = _G_apply_194
+                    _G_python_195, lastError = eval('t.Not(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_195, self.currentError)
+                _G_or_196, lastError = self._or([_G_or_189, _G_or_193])
+                self.considerError(lastError, None)
+                return (_G_or_196, self.currentError)
+            def _G_or_197():
+                _G_apply_198, lastError = self._apply(self.rule_expr1, "expr1", [])
+                self.considerError(lastError, None)
+                return (_G_apply_198, self.currentError)
+            _G_or_199, lastError = self._or([_G_or_186, _G_or_197])
+            self.considerError(lastError, 'expr2')
+            return (_G_or_199, self.currentError)
+
+
+        def rule_expr3(self):
+            _locals = {'self': self}
+            self.locals['expr3'] = _locals
+            def _G_or_200():
+                _G_apply_201, lastError = self._apply(self.rule_expr2, "expr2", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_201
+                def _G_or_202():
+                    _G_exactly_203, lastError = self.exactly('*')
+                    self.considerError(lastError, None)
+                    _G_python_204, lastError = eval('t.Many(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_204, self.currentError)
+                def _G_or_205():
+                    _G_exactly_206, lastError = self.exactly('+')
+                    self.considerError(lastError, None)
+                    _G_python_207, lastError = eval('t.Many1(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_207, self.currentError)
+                def _G_or_208():
+                    _G_exactly_209, lastError = self.exactly('?')
+                    self.considerError(lastError, None)
+                    _G_python_210, lastError = eval('t.Optional(e)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_210, self.currentError)
+                def _G_or_211():
+                    _G_python_212, lastError = eval('e', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_212, self.currentError)
+                _G_or_213, lastError = self._or([_G_or_202, _G_or_205, _G_or_208, _G_or_211])
+                self.considerError(lastError, None)
+                _locals['r'] = _G_or_213
+                def _G_or_214():
+                    _G_exactly_215, lastError = self.exactly(':')
+                    self.considerError(lastError, None)
+                    _G_apply_216, lastError = self._apply(self.rule_name, "name", [])
+                    self.considerError(lastError, None)
+                    _locals['n'] = _G_apply_216
+                    _G_python_217, lastError = eval('t.Bind(n, r)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_217, self.currentError)
+                def _G_or_218():
+                    _G_python_219, lastError = eval('r', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_219, self.currentError)
+                _G_or_220, lastError = self._or([_G_or_214, _G_or_218])
+                self.considerError(lastError, None)
+                return (_G_or_220, self.currentError)
+            def _G_or_221():
+                _G_apply_222, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_223, lastError = self.exactly(':')
+                self.considerError(lastError, None)
+                _G_apply_224, lastError = self._apply(self.rule_name, "name", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_224
+                _G_python_225, lastError = eval('t.Bind(n, t.Apply("anything", self.rulename, []))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_225, self.currentError)
+            _G_or_226, lastError = self._or([_G_or_200, _G_or_221])
+            self.considerError(lastError, 'expr3')
+            return (_G_or_226, self.currentError)
+
+
+        def rule_expr4(self):
+            _locals = {'self': self}
+            self.locals['expr4'] = _locals
+            def _G_many_227():
+                _G_apply_228, lastError = self._apply(self.rule_expr3, "expr3", [])
+                self.considerError(lastError, None)
+                return (_G_apply_228, self.currentError)
+            _G_many_229, lastError = self.many(_G_many_227)
+            self.considerError(lastError, 'expr4')
+            _locals['es'] = _G_many_229
+            _G_python_230, lastError = eval('t.And(es)', self.globals, _locals), None
+            self.considerError(lastError, 'expr4')
+            return (_G_python_230, self.currentError)
+
+
+        def rule_expr(self):
+            _locals = {'self': self}
+            self.locals['expr'] = _locals
+            _G_apply_231, lastError = self._apply(self.rule_expr4, "expr4", [])
+            self.considerError(lastError, 'expr')
+            _locals['e'] = _G_apply_231
+            def _G_many_232():
+                _G_apply_233, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_234, lastError = self.exactly('|')
+                self.considerError(lastError, None)
+                _G_apply_235, lastError = self._apply(self.rule_expr4, "expr4", [])
+                self.considerError(lastError, None)
+                return (_G_apply_235, self.currentError)
+            _G_many_236, lastError = self.many(_G_many_232)
+            self.considerError(lastError, 'expr')
+            _locals['es'] = _G_many_236
+            _G_python_237, lastError = eval('t.Or([e] + es)', self.globals, _locals), None
+            self.considerError(lastError, 'expr')
+            return (_G_python_237, self.currentError)
+
+
+        def rule_ruleValue(self):
+            _locals = {'self': self}
+            self.locals['ruleValue'] = _locals
+            _G_apply_238, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'ruleValue')
+            _G_exactly_239, lastError = self.exactly('=>')
+            self.considerError(lastError, 'ruleValue')
+            _G_python_240, lastError = eval('self.ruleValueExpr(False)', self.globals, _locals), None
+            self.considerError(lastError, 'ruleValue')
+            return (_G_python_240, self.currentError)
+
+
+        def rule_semanticPredicate(self):
+            _locals = {'self': self}
+            self.locals['semanticPredicate'] = _locals
+            _G_apply_241, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticPredicate')
+            _G_exactly_242, lastError = self.exactly('?(')
+            self.considerError(lastError, 'semanticPredicate')
+            _G_python_243, lastError = eval('self.semanticPredicateExpr()', self.globals, _locals), None
+            self.considerError(lastError, 'semanticPredicate')
+            return (_G_python_243, self.currentError)
+
+
+        def rule_semanticAction(self):
+            _locals = {'self': self}
+            self.locals['semanticAction'] = _locals
+            _G_apply_244, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'semanticAction')
+            _G_exactly_245, lastError = self.exactly('!(')
+            self.considerError(lastError, 'semanticAction')
+            _G_python_246, lastError = eval('self.semanticActionExpr()', self.globals, _locals), None
+            self.considerError(lastError, 'semanticAction')
+            return (_G_python_246, self.currentError)
+
+
+        def rule_ruleEnd(self):
+            _locals = {'self': self}
+            self.locals['ruleEnd'] = _locals
+            def _G_or_247():
+                def _G_many_248():
+                    _G_apply_249, lastError = self._apply(self.rule_hspace, "hspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_249, self.currentError)
+                _G_many_250, lastError = self.many(_G_many_248)
+                self.considerError(lastError, None)
+                def _G_many1_251():
+                    _G_apply_252, lastError = self._apply(self.rule_vspace, "vspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_252, self.currentError)
+                _G_many1_253, lastError = self.many(_G_many1_251, _G_many1_251())
+                self.considerError(lastError, None)
+                return (_G_many1_253, self.currentError)
+            def _G_or_254():
+                _G_apply_255, lastError = self._apply(self.rule_end, "end", [])
+                self.considerError(lastError, None)
+                return (_G_apply_255, self.currentError)
+            _G_or_256, lastError = self._or([_G_or_247, _G_or_254])
+            self.considerError(lastError, 'ruleEnd')
+            return (_G_or_256, self.currentError)
+
+
+        def rule_rulePart(self):
+            _locals = {'self': self}
+            self.locals['rulePart'] = _locals
+            _G_apply_257, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'rulePart')
+            _locals['requiredName'] = _G_apply_257
+            _G_apply_258, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'rulePart')
+            _G_apply_259, lastError = self._apply(self.rule_name, "name", [])
+            self.considerError(lastError, 'rulePart')
+            _locals['n'] = _G_apply_259
+            def _G_pred_260():
+                _G_python_261, lastError = eval('n == requiredName', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_261, self.currentError)
+            _G_pred_262, lastError = self.pred(_G_pred_260)
+            self.considerError(lastError, 'rulePart')
+            _G_python_263, lastError = eval('setattr(self, "rulename", n)', self.globals, _locals), None
+            self.considerError(lastError, 'rulePart')
+            _G_apply_264, lastError = self._apply(self.rule_expr4, "expr4", [])
+            self.considerError(lastError, 'rulePart')
+            _locals['args'] = _G_apply_264
+            def _G_or_265():
+                _G_apply_266, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_267, lastError = self.exactly('::=')
+                self.considerError(lastError, None)
+                _G_apply_268, lastError = self._apply(self.rule_expr, "expr", [])
+                self.considerError(lastError, None)
+                _locals['e'] = _G_apply_268
+                _G_apply_269, lastError = self._apply(self.rule_ruleEnd, "ruleEnd", [])
+                self.considerError(lastError, None)
+                _G_python_270, lastError = eval('t.And([args, e])', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_270, self.currentError)
+            def _G_or_271():
+                _G_apply_272, lastError = self._apply(self.rule_ruleEnd, "ruleEnd", [])
+                self.considerError(lastError, None)
+                _G_python_273, lastError = eval('args', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_273, self.currentError)
+            _G_or_274, lastError = self._or([_G_or_265, _G_or_271])
+            self.considerError(lastError, 'rulePart')
+            return (_G_or_274, self.currentError)
+
+
+        def rule_rule(self):
+            _locals = {'self': self}
+            self.locals['rule'] = _locals
+            _G_apply_275, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'rule')
+            def _G_lookahead_276():
+                _G_apply_277, lastError = self._apply(self.rule_name, "name", [])
+                self.considerError(lastError, None)
+                _locals['n'] = _G_apply_277
+                return (_locals['n'], self.currentError)
+            _G_lookahead_278, lastError = self.lookahead(_G_lookahead_276)
+            self.considerError(lastError, 'rule')
+            _G_python_279, lastError = eval('n', self.globals, _locals), None
+            self.considerError(lastError, 'rule')
+            _G_apply_280, lastError = self._apply(self.rule_rulePart, "rulePart", [_G_python_279])
+            self.considerError(lastError, 'rule')
+            _locals['r'] = _G_apply_280
+            def _G_or_281():
+                def _G_many1_282():
+                    _G_python_283, lastError = eval('n', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    _G_apply_284, lastError = self._apply(self.rule_rulePart, "rulePart", [_G_python_283])
+                    self.considerError(lastError, None)
+                    return (_G_apply_284, self.currentError)
+                _G_many1_285, lastError = self.many(_G_many1_282, _G_many1_282())
+                self.considerError(lastError, None)
+                _locals['rs'] = _G_many1_285
+                _G_python_286, lastError = eval('t.Rule(n, t.Or([r] + rs))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_286, self.currentError)
+            def _G_or_287():
+                _G_python_288, lastError = eval('t.Rule(n, r)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_288, self.currentError)
+            _G_or_289, lastError = self._or([_G_or_281, _G_or_287])
+            self.considerError(lastError, 'rule')
+            return (_G_or_289, self.currentError)
+
+
+        def rule_grammar(self):
+            _locals = {'self': self}
+            self.locals['grammar'] = _locals
+            def _G_many_290():
+                _G_apply_291, lastError = self._apply(self.rule_rule, "rule", [])
+                self.considerError(lastError, None)
+                return (_G_apply_291, self.currentError)
+            _G_many_292, lastError = self.many(_G_many_290)
+            self.considerError(lastError, 'grammar')
+            _locals['rs'] = _G_many_292
+            _G_apply_293, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'grammar')
+            _G_python_294, lastError = eval('t.Grammar(self.name, self.tree_target, rs)', self.globals, _locals), None
+            self.considerError(lastError, 'grammar')
+            return (_G_python_294, self.currentError)
+
+
+    if pymeta_v1.globals is not None:
+        pymeta_v1.globals = pymeta_v1.globals.copy()
+        pymeta_v1.globals.update(ruleGlobals)
+    else:
+        pymeta_v1.globals = ruleGlobals
+    return pymeta_v1
\ No newline at end of file
diff --git a/lib/Parsley-1.1/ometa/builder.py b/lib/Parsley-1.1/ometa/builder.py
new file mode 100644
index 0000000..c4fadf7
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/builder.py
@@ -0,0 +1,418 @@
+# -*- test-case-name: ometa.test.test_builder -*-
+import ast
+from StringIO import StringIO
+from types import ModuleType as module
+import linecache, sys
+from terml.nodes import Term, Tag, coerceToTerm
+
+class TextWriter(object):
+
+    stepSize = 4
+
+    def __init__(self, f, indentSteps=0):
+        self.file = f
+        self.indentSteps = indentSteps
+
+
+    def writeln(self, data):
+        if data:
+            self.file.write(" " * (self.indentSteps * self.stepSize))
+            self.file.write(data)
+        self.file.write("\n")
+
+    def indent(self):
+        return TextWriter(self.file, self.indentSteps + 1)
+
+
+class PythonWriter(object):
+    """
+    Converts an OMeta syntax tree into Python source.
+    """
+    def __init__(self, tree):
+        self.tree = tree
+        self.gensymCounter = 0
+
+
+    def _generate(self, out, expr, retrn=False, debugname=None):
+        result = self._generateNode(out, expr, debugname=debugname)
+        if retrn:
+            out.writeln("return (%s, self.currentError)" % (result,))
+        elif result:
+            out.writeln(result)
+
+    def output(self, out):
+        self._generate(out, self.tree)
+
+
+    def _generateNode(self, out, node, debugname=None):
+        name = node.tag.name
+        args = node.args
+        if name == 'null':
+            return 'None'
+        return getattr(self, "generate_"+name)(out, *args, debugname=debugname)
+
+
+    def _gensym(self, name):
+        """
+        Produce a unique name for a variable in generated code.
+        """
+        self.gensymCounter += 1
+        return "_G_%s_%s" % (name, self.gensymCounter)
+
+
+    def _newThunkFor(self, out, name, expr):
+        """
+        Define a new function of no arguments.
+        @param name: The name of the rule generating this thunk.
+        @param expr: A list of lines of Python code.
+        """
+
+        fname = self._gensym(name)
+        self._writeFunction(out, fname, (),  expr)
+        return fname
+
+
+    def _expr(self, out, typ, e, debugname=None):
+        """
+        Generate the code needed to execute the expression, and return the
+        variable name bound to its value.
+        """
+        name = self._gensym(typ)
+        out.writeln("%s, lastError = %s" % (name, e))
+        out.writeln("self.considerError(lastError, %r)" % (debugname and debugname.data,))
+        return name
+
+
+    def _writeFunction(self, out, fname, arglist, expr):
+        """
+        Generate a function.
+        @param out: the TextWriter used for output.
+        @param fname: The name of the function generated.
+        @param arglist: A list of parameter names.
+        @param expr: The term tree to generate the function body from.
+        """
+
+        out.writeln("def %s(%s):" % (fname, ", ".join(arglist)))
+        self._generate(out.indent(), expr, retrn=True)
+        return fname
+
+
+    def compilePythonExpr(self, out, expr, debugname=None):
+        """
+        Generate code for running embedded Python expressions.
+        """
+        try:
+            ast.literal_eval(expr)
+            return self._expr(out, 'python', expr + ', None', debugname)
+        except ValueError:
+            return self._expr(out, 'python',
+                              'eval(%r, self.globals, _locals), None' % (expr,),
+                              debugname)
+
+    def _convertArgs(self, out, rawArgs, debugname):
+        return [self._generateNode(out, x, debugname) for x in rawArgs]
+
+
+    def generate_Apply(self, out, ruleName, codeName, rawArgs, debugname=None):
+        """
+        Create a call to self.apply(ruleName, *args).
+        """
+        ruleName = ruleName.data
+        args = self._convertArgs(out, rawArgs.args, debugname)
+        if ruleName == 'super':
+            return self._expr(out, 'apply', 'self.superApply("%s", %s)'
+                              % (codeName.data, ', '.join(args)),
+                              debugname)
+        return self._expr(out, 'apply', 'self._apply(self.rule_%s, "%s", [%s])'
+                          % (ruleName, ruleName, ', '.join(args)),
+                          debugname)
+
+    def generate_ForeignApply(self, out, grammarName, ruleName, codeName,
+            rawArgs, debugname=None):
+        """
+        Create a call to self.foreignApply(ruleName, *args)
+        """
+        grammarName = grammarName.data
+        ruleName = ruleName.data
+        args = self._convertArgs(out, rawArgs.args, debugname)
+        call = ('self.foreignApply("%s", "%s", self.globals, _locals, %s)'
+                            % (grammarName, ruleName, ', '.join(args)))
+        return self._expr(out, 'apply', call, debugname)
+
+    def generate_Exactly(self, out, literal, debugname=None):
+        """
+        Create a call to self.exactly(expr).
+        """
+        return self._expr(out, 'exactly', 'self.exactly(%r)' % (literal.data,), debugname)
+
+
+    def generate_Token(self, out, literal, debugname=None):
+        if self.takesTreeInput:
+            return self.generate_Exactly(out, literal, debugname)
+        else:
+            return self._expr(out, 'apply',
+                              'self._apply(self.rule_token, "token", ["%s"])'
+                              % (literal.data,),
+                              debugname)
+
+
+    def generate_Many(self, out, expr, debugname=None):
+        """
+        Create a call to self.many(lambda: expr).
+        """
+        fname = self._newThunkFor(out, "many", expr)
+        return self._expr(out, 'many', 'self.many(%s)' % (fname,), debugname)
+
+
+    def generate_Many1(self, out, expr, debugname=None):
+        """
+        Create a call to self.many(lambda: expr).
+        """
+        fname = self._newThunkFor(out, "many1", expr)
+        return self._expr(out, 'many1', 'self.many(%s, %s())' % (fname, fname), debugname)
+
+
+    def generate_Repeat(self, out, min, max, expr, debugname=None):
+        """
+        Create a call to self.repeat(min, max, lambda: expr).
+        """
+        fname = self._newThunkFor(out, "repeat", expr)
+        if min.tag.name == '.int.':
+            min = min.data
+        else:
+            min = '_locals["%s"]' % min.data
+        if max.tag.name == '.int.':
+            max = max.data
+        else:
+            max = '_locals["%s"]' % max.data
+        if min == max == 0:
+            return "''"
+        return self._expr(out, 'repeat', 'self.repeat(%s, %s, %s)'
+                          % (min, max, fname))
+
+    def generate_Optional(self, out, expr, debugname=None):
+        """
+        Try to parse an expr and continue if it fails.
+        """
+        realf = self._newThunkFor(out, "optional", expr)
+        passf = self._gensym("optional")
+        out.writeln("def %s():" % (passf,))
+        out.indent().writeln("return (None, self.input.nullError())")
+        return self._expr(out, 'or', 'self._or([%s])'
+                          % (', '.join([realf, passf])),
+                          debugname)
+
+
+    def generate_Or(self, out, exprs, debugname=None):
+        """
+        Create a call to
+        self._or([lambda: expr1, lambda: expr2, ... , lambda: exprN]).
+        """
+        if len(exprs.args) > 1:
+            fnames = [self._newThunkFor(out, "or", expr) for expr in exprs.args]
+            return self._expr(out, 'or', 'self._or([%s])' % (', '.join(fnames)), debugname)
+        else:
+            return self._generateNode(out, exprs.args[0], debugname)
+
+
+    def generate_Not(self, out, expr, debugname=None):
+        """
+        Create a call to self._not(lambda: expr).
+        """
+        fname = self._newThunkFor(out, "not", expr)
+        return self._expr(out, "not", "self._not(%s)" % (fname,), debugname)
+
+
+    def generate_Lookahead(self, out, expr, debugname=None):
+        """
+        Create a call to self.lookahead(lambda: expr).
+        """
+        fname = self._newThunkFor(out, "lookahead", expr)
+        return self._expr(out, "lookahead", "self.lookahead(%s)" %(fname,), debugname)
+
+
+    def generate_And(self, out, exprs, debugname=None):
+        """
+        Generate code for each statement in order.
+        """
+        v = None
+        for ex in exprs.args:
+            v = self._generateNode(out, ex, debugname)
+        return v
+
+
+    def generate_Bind(self, out, name, expr, debugname=None):
+        """
+        Bind the value of 'expr' to a name in the _locals dict.
+        """
+        v = self._generateNode(out, expr, debugname)
+        ref = "_locals['%s']" % (name.data,)
+        out.writeln("%s = %s" %(ref, v))
+        return ref
+
+
+    def generate_Predicate(self, out, expr, debugname=None):
+        """
+        Generate a call to self.pred(lambda: expr).
+        """
+
+        fname = self._newThunkFor(out, "pred", expr)
+        return self._expr(out, "pred", "self.pred(%s)" %(fname,), debugname)
+
+
+    def generate_Action(self, out, expr, debugname=None):
+        """
+        Generate this embedded Python expression on its own line.
+        """
+        return self.compilePythonExpr(out, expr.data, debugname)
+
+
+    def generate_Python(self, out, expr, debugname=None):
+        """
+        Generate this embedded Python expression on its own line.
+        """
+        return self.compilePythonExpr(out, expr.data, debugname)
+
+
+    def generate_List(self, out, expr, debugname=None):
+        """
+        Generate a call to self.listpattern(lambda: expr).
+        """
+        fname = self._newThunkFor(out, "listpattern", expr)
+        return  self._expr(out, "listpattern", "self.listpattern(%s)" %(fname,),
+                           debugname)
+
+
+    def generate_TermPattern(self, out, name, expr, debugname=None):
+        fname = self._newThunkFor(out, "termpattern", expr)
+        return self._expr(out, 'termpattern', 'self.termpattern(%r, %s)' % (name.data, fname),
+                          debugname)
+
+    def generate_StringTemplate(self, out, template, debugname=None):
+        out.writeln("from terml.parser import parseTerm as term")
+        return self._expr(out, 'stringtemplate', 'self.stringtemplate(%s, _locals)' % (template,))
+
+    def generate_ConsumedBy(self, out, expr, debugname=None):
+        """
+        Generate a call to self.consumedBy(lambda: expr).
+        """
+        fname = self._newThunkFor(out, "consumedby", expr)
+        return  self._expr(out, "consumedby", "self.consumedby(%s)" %(fname,),
+                           debugname)
+
+
+    def generate_Rule(self, prevOut, name, expr, debugname=None):
+        prevOut.writeln("def rule_%s(self):" % (name.data,))
+        out = prevOut.indent()
+        out.writeln("_locals = {'self': self}")
+        out.writeln("self.locals[%r] = _locals" % (name.data,))
+        self._generate(prevOut.indent(), expr, retrn=True, debugname=name)
+
+    def generate_Grammar(self, out, name, takesTreeInput, rules,
+                         debugname=None):
+        self.takesTreeInput = takesTreeInput.tag.name == 'true'
+        out.writeln("def createParserClass(GrammarBase, ruleGlobals):")
+        funcOut = out.indent()
+        funcOut.writeln("if ruleGlobals is None:")
+        funcOut.indent().writeln("ruleGlobals = {}")
+        funcOut.writeln("class %s(GrammarBase):" % (name.data,))
+        out = funcOut.indent()
+        for rule in rules.args:
+            self._generateNode(out, rule, debugname)
+            out.writeln("")
+            out.writeln("")
+        if self.takesTreeInput:
+            out.writeln("tree = %s" % self.takesTreeInput)
+        funcOut.writeln(
+            "if %s.globals is not None:" % (name.data,))
+        out.writeln("%s.globals = %s.globals.copy()" % (name.data,
+                                                        name.data))
+        out.writeln("%s.globals.update(ruleGlobals)" % (name.data,))
+        funcOut.writeln(
+            "else:")
+        out.writeln("%s.globals = ruleGlobals" % (name.data,))
+        funcOut.writeln("return " + name.data)
+
+
+class _Term2PythonAction(object):
+    def leafData(bldr, data):
+        return repr(data)
+
+    def leafTag(bldr, tag):
+        return tag.name
+
+    def term(bldr, tag, args):
+        if tag == '.tuple.':
+            return "[%s]" % (', '.join(args),)
+        elif tag == '.attr.':
+            return "(%s)" % (', '.join(args),)
+        elif tag == '.bag.':
+            return "dict(%s)" % (', '.join(args),)
+        if not args:
+            return tag
+        return "%s(%s)" % (tag, ', '.join(args))
+
+
+class TermActionPythonWriter(PythonWriter):
+    builder = _Term2PythonAction
+
+    def _convertArgs(self, out, termArgs, debugname):
+        return [self._termAsPython(out, a, debugname) for a in termArgs]
+
+
+    def generate_Predicate(self, out, term, debugname=None):
+        """
+        Generate a call to self.pred(lambda: expr).
+        """
+
+        fname = self._newThunkFor(out, "pred", Term(Tag("Action"), None,
+                                                    [term]))
+        return self._expr(out, "pred", "self.pred(%s)" %(fname,), debugname)
+
+    def generate_Action(self, out, term, debugname=None):
+        return self._termAsPython(out, term, debugname)
+
+    generate_Python = generate_Action
+
+    def _termAsPython(self, out, term, debugname):
+        if not term.args:
+            if term.data is None:
+                return self.compilePythonExpr(out, term.tag.name, debugname)
+            else:
+                name = self._gensym("literal")
+                out.writeln("%s = %r" % (name, term.data))
+                return name
+        else:
+            return self.compilePythonExpr(out, term.build(self.builder()), debugname)
+
+
+def writePython(tree):
+    f = StringIO()
+    out = TextWriter(f)
+    pw = PythonWriter(tree)
+    pw.output(out)
+    return f.getvalue().strip()
+
+
+class GeneratedCodeLoader(object):
+    """
+    Object for use as a module's __loader__, to display generated
+    source.
+    """
+    def __init__(self, source):
+        self.source = source
+    def get_source(self, name):
+        return self.source
+
+
+
+def moduleFromGrammar(source, className, modname, filename):
+    mod = module(modname)
+    mod.__name__ = modname
+    mod.__loader__ = GeneratedCodeLoader(source)
+    code = compile(source, filename, "exec")
+    eval(code, mod.__dict__)
+    sys.modules[modname] = mod
+    linecache.getlines(filename, mod.__dict__)
+    return mod
+
diff --git a/lib/Parsley-1.1/ometa/compat.py b/lib/Parsley-1.1/ometa/compat.py
new file mode 100644
index 0000000..efd84a1
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/compat.py
@@ -0,0 +1,8 @@
+import ometa
+from ometa.runtime import OMetaGrammarBase
+from ometa.grammar import OMeta
+from ometa.grammar import loadGrammar
+from terml.nodes import termMaker as t
+
+OMeta1 = loadGrammar(ometa, "pymeta_v1",
+                     globals(), OMetaGrammarBase)
diff --git a/lib/Parsley-1.1/ometa/grammar.py b/lib/Parsley-1.1/ometa/grammar.py
new file mode 100644
index 0000000..998a755
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/grammar.py
@@ -0,0 +1,80 @@
+# -*- test-case-name: ometa.test.test_pymeta -*-
+"""
+Public interface to OMeta, as well as the grammars used to compile grammar
+definitions.
+"""
+import os.path
+import string
+from StringIO import StringIO
+
+from terml.nodes import termMaker as t
+import ometa
+from ometa._generated.parsley import createParserClass as makeBootGrammar
+from ometa.builder import TermActionPythonWriter, moduleFromGrammar, TextWriter
+from ometa.runtime import OMetaBase, OMetaGrammarBase
+
+OMeta = makeBootGrammar(OMetaGrammarBase, globals())
+
+
+def loadGrammar(pkg, name, globals, superclass=OMetaBase):
+    try:
+        m = __import__('.'.join([pkg.__name__, '_generated', name]),
+                       fromlist=[name], level=0)
+    except ImportError:
+        base = os.path.dirname(os.path.abspath(pkg.__file__))
+        src = open(os.path.join(base, name + ".parsley")).read()
+        m = OMeta.makeGrammar(src, name)
+
+    return m.createParserClass(superclass, globals)
+
+class TermOMeta(loadGrammar(
+        ometa, "parsley_termactions",
+        globals(), superclass=OMeta)):
+
+    _writer = TermActionPythonWriter
+
+    @classmethod
+    def makeGrammar(cls, grammar, name):
+        """
+        Define a new parser class with the rules in the given grammar.
+
+        @param grammar: A string containing a PyMeta grammar.
+        @param globals: A dict of names that should be accessible by this
+        grammar.
+        @param name: The name of the class to be generated.
+        @param superclass: The class the generated class is a child of.
+        """
+        g = cls(grammar)
+        tree = g.parseGrammar(name)
+        modname = "pymeta_grammar__" + name
+        filename = "/pymeta_generated_code/" + modname + ".py"
+        source = g.writeTerm(tree)
+        return moduleFromGrammar(source, name, modname, filename)
+
+    def writeTerm(self, term):
+        f = StringIO()
+        pw = self._writer(term)
+        out = TextWriter(f)
+        pw.output(out)
+        return f.getvalue().strip()
+
+    def rule_term(self):
+        from terml.parser import TermLParser
+        tp = TermLParser('')
+        tp.input = self.input
+        self.input.setMemo('term', None)
+        val, err = tp.apply('term')
+        self.input = tp.input
+        return val, err
+
+    def rule_term_arglist(self):
+        from terml.parser import TermLParser
+        tp = TermLParser('')
+        tp.input = self.input
+        val, err = tp.apply('argList')
+        self.input = tp.input
+        return val, err
+
+TreeTransformerGrammar = loadGrammar(
+    ometa, "parsley_tree_transformer",
+    globals(), superclass=OMeta)
diff --git a/lib/Parsley-1.1/ometa/interp.py b/lib/Parsley-1.1/ometa/interp.py
new file mode 100644
index 0000000..e1884a1
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/interp.py
@@ -0,0 +1,648 @@
+import string
+from ometa.runtime import (InputStream, ParseError, EOFError, ArgInput,
+                           joinErrors, expected, LeftRecursion)
+
+def decomposeGrammar(grammar):
+    rules = {}
+    #XXX remove all these asserts once we have quasiterms
+    assert grammar.tag.name == 'Grammar'
+    for rule in grammar.args[2].args:
+        assert rule.tag.name == 'Rule'
+        rules[rule.args[0].data] = rule.args[1]
+    return rules
+
+# after 12, i'm worse than a gremlin
+_feed_me = object()
+
+
+class TrampolinedGrammarInterpreter(object):
+    """
+    An interpreter for OMeta grammars that processes input
+    incrementally.
+    """
+    def __init__(self, grammar, ruleName, callback=None, globals=None):
+        self.grammar = grammar
+        self.position = 0
+        self.callback = callback
+        self.globals = globals or {}
+        self.rules = decomposeGrammar(grammar)
+        self.next = self.apply(ruleName, None, ())
+        self._localsStack = []
+        self.currentResult = None
+        self.input = InputStream([], 0)
+        self.ended = False
+
+
+    def receive(self, buf):
+        """
+        Feed data to the parser.
+        """
+        if not buf:
+            # No data. Nothing to do.
+            return
+        if self.ended:
+            raise ValueError("Can't feed a parser that's been ended.")
+        self.input.data.extend(buf)
+        x = None
+        for x in self.next:
+            if x is _feed_me:
+                return x
+        if self.callback:
+            self.callback(*x)
+        self.ended = True
+
+
+    def end(self):
+        """
+        Close the input stream, indicating to the grammar that no more
+        input will arrive.
+        """
+        if self.ended:
+            return
+        self.ended = True
+        x = None
+        for x in self.next:
+            pass
+        if self.callback:
+            self.callback(*x)
+
+
+    def error(self, typ, val, trail=None):
+        raise ParseError(''.join(self.input.data), typ, val, trail=trail)
+
+    ## Implementation note: each method, instead of being a function
+    ## returning a value, is a generator that will yield '_feed_me' an
+    ## arbitrary number of times, then finally yield the value of the
+    ## expression being evaluated.
+
+
+    def _apply(self, rule, ruleName, args):
+        """
+        Apply a rule method to some args.
+        @param rule: A method of this object.
+        @param ruleName: The name of the rule invoked.
+        @param args: A sequence of arguments to it.
+        """
+        if args:
+            if ((not getattr(rule, 'func_code', None))
+                 or rule.func_code.co_argcount - 1 != len(args)):
+                for arg in args[::-1]:
+                    self.input = ArgInput(arg, self.input)
+                g = rule()
+            else:
+                g = rule(*args)
+            for x in g:
+                if x is _feed_me: yield x
+            yield x
+            return
+        memoRec = self.input.getMemo(ruleName)
+        if memoRec is None:
+            oldPosition = self.input
+            lr = LeftRecursion()
+            memoRec = self.input.setMemo(ruleName, lr)
+
+            try:
+                inp = self.input
+                for x in rule():
+                    if x is _feed_me: yield x
+                memoRec = inp.setMemo(ruleName, [x, self.input])
+            except ParseError:
+                raise
+            if lr.detected:
+                sentinel = self.input
+                while True:
+                    try:
+                        self.input = oldPosition
+                        for x in rule():
+                            if x is _feed_me: yield x
+                        ans = x
+                        if (self.input == sentinel):
+                            break
+
+                        memoRec = oldPosition.setMemo(ruleName,
+                                                     [ans, self.input])
+                    except ParseError:
+                        break
+            self.input = oldPosition
+
+        elif isinstance(memoRec, LeftRecursion):
+            memoRec.detected = True
+            self.error(None, None)
+        self.input = memoRec[1]
+        yield memoRec[0]
+
+
+    def _eval(self, expr):
+        """
+        Dispatch to a parse_<term name> method for the given grammar expression.
+        """
+        return getattr(self, "parse_" + expr.tag.name)(*expr.args)
+
+
+    def parse_Apply(self, ruleName, codeName, args):
+        for x in self.apply(ruleName.data, codeName.data, args.args):
+            if x is _feed_me: yield x
+        yield x
+
+
+    def apply(self, ruleName, codeName, args):
+        """
+        Invoke a rule, optionally with arguments.
+        """
+        argvals = []
+        for a in args:
+            for x in self._eval(a):
+                if x is _feed_me: yield x
+            argvals.append(x[0])
+        _locals = {}
+        self._localsStack.append(_locals)
+        try:
+            #XXX super
+            rul = self.rules.get(ruleName)
+            if rul:
+                def f():
+                    return self._eval(rul)
+            else:
+                #ruleName may be a Twine, so gotta call str()
+                f = getattr(self, str('rule_' + ruleName))
+            for x in self._apply(f, ruleName, argvals):
+                if x is _feed_me: yield x
+            yield x
+        finally:
+            self._localsStack.pop()
+
+
+    def parse_Exactly(self, spec):
+        """
+        Accept a one or more characters that equal the given spec.
+        """
+        wanted = spec.data
+        result = []
+        for c in wanted:
+            try:
+                val, p = self.input.head()
+            except EOFError:
+                yield _feed_me
+                val, p = self.input.head()
+            result.append(val)
+            if val == c:
+                self.input = self.input.tail()
+            else:
+                self.error(''.join(result), expected(None, wanted))
+        yield ''.join(result), p
+
+
+    def parse_Token(self, spec):
+        """
+        Consume leading whitespace then the given string.
+        """
+        val = ' '
+        while val.isspace():
+            try:
+                val, p = self.input.head()
+            except EOFError:
+                yield _feed_me
+                val, p = self.input.head()
+            if val.isspace():
+                self.input = self.input.tail()
+        wanted = spec.data
+        result = []
+        for c in wanted:
+            try:
+                val, p = self.input.head()
+            except EOFError:
+                yield _feed_me
+                val, p = self.input.head()
+            result.append(val)
+            if val == c:
+                self.input = self.input.tail()
+            else:
+                self.error(''.join(result), expected(None, wanted))
+        yield ''.join(result), p
+
+
+    def parse_And(self, expr):
+        """
+        Execute multiple subexpressions in order, returning the result
+        of the last one.
+        """
+        seq = expr.args
+        x = None, self.input.nullError()
+        for subexpr in seq:
+            for x in self._eval(subexpr):
+                if x is _feed_me: yield x
+            self.currentError = x[1]
+        yield x
+
+
+    def parse_Or(self, expr):
+        """
+        Execute multiple subexpressions, returning the result of the
+        first one that succeeds.
+        """
+        errors = []
+        i = self.input
+        for subexpr in expr.args:
+            try:
+                for x in self._eval(subexpr):
+                    if x is _feed_me: yield x
+                val, p = x
+                errors.append(p)
+                self.currentError = joinErrors(errors)
+                yield x
+                return
+            except ParseError, err:
+                errors.append(err)
+                self.input = i
+        self.error(*joinErrors(errors))
+
+
+    def parse_Many(self, expr, ans=None):
+        """
+        Execute an expression repeatedly until it fails to match,
+        collecting the results into a list. Implementation of '*'.
+        """
+        ans = ans or []
+        while True:
+            try:
+                m = self.input
+                for x in self._eval(expr):
+                    if x is _feed_me: yield x
+                ans.append(x[0])
+                self.currentError = x[1]
+            except ParseError, err:
+                self.input = m
+                break
+        yield ans, err
+
+
+    def parse_Many1(self, expr):
+        """
+        Execute an expression one or more times, collecting the
+        results into a list. Implementation of '+'.
+        """
+        for x in self._eval(expr):
+            if x is _feed_me: yield x
+        for x in self.parse_Many(expr, ans=[x[0]]):
+            if x is _feed_me: yield x
+        yield x
+
+
+    def parse_Repeat(self, min, max, expr):
+        """
+        Execute an expression between C{min} and C{max} times,
+        collecting the results into a list. Implementation of '{}'.
+        """
+        if min.tag.name == '.int.':
+            min = min.data
+        else:
+            min = self._localsStack[-1][min.data]
+        if max.tag.name == '.int.':
+            max = max.data
+        elif max.tag.name == 'null':
+            max = None
+        else:
+            max = self._localsStack[-1][max.data]
+
+        if min == max == 0:
+            yield '', None
+            return
+        ans = []
+        for i in range(min):
+            for x in self._eval(expr):
+                if x is _feed_me: yield x
+            v, e = x
+            ans.append(v)
+
+        if max is not None:
+            repeats = xrange(min, max)
+            for i in repeats:
+                try:
+                    m = self.input
+                    for x in self._eval(expr):
+                        if x is _feed_me: yield x
+                    v, e = x
+                    ans.append(v)
+                except ParseError, e:
+                    self.input = m
+                    break
+        yield ans, e
+
+
+
+    def parse_Optional(self, expr):
+        """
+        Execute an expression, returning None if it
+        fails. Implementation of '?'.
+        """
+        i = self.input
+        try:
+            for x in self._eval(expr):
+                if x is _feed_me: yield x
+            yield x
+        except ParseError:
+            self.input = i
+            yield (None, self.input.nullError())
+
+
+    def parse_Not(self, expr):
+        """
+        Execute an expression, returning True if it fails and failing
+        otherwise. Implementation of '~'.
+        """
+        m = self.input
+        try:
+            for x in self._eval(expr):
+                if x is _feed_me: yield x
+        except ParseError:
+            self.input = m
+            yield True, self.input.nullError()
+        else:
+            self.error(*self.input.nullError())
+
+
+    def parse_Lookahead(self, expr):
+        """
+        Execute an expression, then reset the input stream to the
+        position before execution. Implementation of '~~'.
+        """
+        try:
+            i = self.input
+            for x in self._eval(expr):
+                if x is _feed_me: yield x
+        finally:
+            self.input = i
+
+
+    def parse_Bind(self, name, expr):
+        """
+        Execute an expression and bind its result to the given name.
+        """
+        for x in self._eval(expr):
+            if x is _feed_me: yield x
+        v, err = x
+        self._localsStack[-1][name.data] = v
+        yield v, err
+
+
+    def parse_Predicate(self, expr):
+        """
+        Run a Python expression and fail if it returns False.
+        """
+        for x in self._eval(expr):
+            if x is _feed_me: yield x
+        val, err = x
+        if not val:
+            self.error(*err)
+        else:
+            yield True, err
+
+
+    def parse_Action(self, expr):
+        """
+        Run a Python expression, return its result.
+        """
+        val = eval(expr.data, self.globals, self._localsStack[-1])
+        yield val, self.input.nullError()
+
+
+    def parse_ConsumedBy(self, expr):
+        """
+        Run an expression. Return the literal contents of the input
+        stream it consumed.
+        """
+        oldInput = self.input
+        for x in self._eval(expr):
+            if x is _feed_me: yield x
+        slice = oldInput.data[oldInput.position:self.input.position]
+        yield "".join(slice), x[1]
+
+    def rule_anything(self):
+        """
+        Match a single character.
+        """
+        try:
+            val, p = self.input.head()
+        except EOFError:
+            yield _feed_me
+            val, p = self.input.head()
+        self.input = self.input.tail()
+        yield val, p
+
+    def rule_letter(self):
+        """
+        Match a single letter.
+        """
+        try:
+            val, p = self.input.head()
+        except EOFError:
+            yield _feed_me
+            val, p = self.input.head()
+        if val in string.letters:
+            self.input = self.input.tail()
+            yield val, p
+        else:
+            self.error(val, expected(None, "a letter"))
+
+    def rule_digit(self):
+        """
+        Match a digit.
+        """
+        try:
+            val, p = self.input.head()
+        except EOFError:
+            yield _feed_me
+            val, p = self.input.head()
+        if val in string.digits:
+            self.input = self.input.tail()
+            yield val, p
+        else:
+            self.error(val, expected(None, "a digit"))
+
+
+class GrammarInterpreter(object):
+
+    def __init__(self, grammar, base, globals=None):
+        """
+        grammar: A term tree representing a grammar.
+        """
+        self.grammar = grammar
+        self.base = base
+        self.rules = {}
+        self._localsStack = []
+        self._globals = globals or {}
+        self.rules = decomposeGrammar(grammar)
+        self.run = None
+
+    def apply(self, input, rulename, tree=False):
+        self.run = self.base(input, self._globals, tree=tree)
+        #XXX hax, fix grammar parser to distinguish tree from nontree grammars
+        if not isinstance(self.run.input.data, basestring):
+            tree = True
+            self.run.tree = True
+        v, err = self._apply(self.run, rulename, ())
+        return self.run.input, v, err
+
+
+    def _apply(self, run, ruleName, args):
+        argvals = [self._eval(run, a)[0] for a in args]
+        _locals = {'self': run}
+        self._localsStack.append(_locals)
+        try:
+            if ruleName == 'super':
+                return run.superApply(ruleName, argvals)
+            else:
+                rul = self.rules.get(ruleName)
+                if rul:
+                    return run._apply(
+                        (lambda: self._eval(run, rul)),
+                        ruleName, argvals)
+                else:
+                    #ruleName may be a Twine, so calling str()
+                    x = run._apply(getattr(run, str('rule_' + ruleName)),
+                                   ruleName, argvals)
+                    return x
+        finally:
+            self._localsStack.pop()
+
+
+    def _eval(self, run, expr):
+        name = expr.tag.name
+        args = expr.args
+        if name == "Apply":
+            ruleName = args[0].data
+            return self._apply(run, ruleName, args[2].args)
+
+        elif name == "Exactly":
+            return run.exactly(args[0].data)
+
+        elif name == "Token":
+            if run.tree:
+                return run._apply(run.rule_exactly, "exactly", [args[0].data])
+            else:
+                return run._apply(run.rule_token, "token", [args[0].data])
+
+        elif name in ("Many", "Many1"):
+            ans = [self._eval(run, args[0])[0]] if name == "Many1" else []
+            while True:
+                try:
+                    m = run.input
+                    v, _ = self._eval(run, args[0])
+                    ans.append(v)
+                except ParseError, err:
+                    run.input = m
+                    break
+            return ans, err
+
+        elif name == "Repeat":
+            if args[0].tag.name == '.int.':
+                min = args[0].data
+            else:
+                min = self._localsStack[-1][args[0].data]
+            if args[1].tag.name == '.int.':
+                max = args[1].data
+            elif args[1].tag.name == 'null':
+                max = None
+            else:
+                max = self._localsStack[-1][args[1].data]
+            if min == max == 0:
+                return "", None
+            ans = []
+            for i in range(min):
+                v, e = self._eval(run, args[2])
+                ans.append(v)
+
+            for i in range(min, max):
+                try:
+                    m = run.input
+                    v, e = self._eval(run, args[2])
+                    ans.append(v)
+                except ParseError, e:
+                    run.input = m
+                    break
+            return ans, e
+
+        elif name == "Optional":
+            i = run.input
+            try:
+                return self._eval(run, args[0])
+            except ParseError:
+                run.input = i
+                return (None, run.input.nullError())
+
+        elif name == "Or":
+            errors = []
+            for e in args[0].args:
+                try:
+                    m = run.input
+                    x = self._eval(run, e)
+                    ret, err = x
+                    errors.append(err)
+                    return ret, joinErrors(errors)
+                except ParseError, err:
+                    errors.append(err)
+                    run.input = m
+            raise joinErrors(errors)
+
+
+        elif name == "Not":
+            m = run.input
+            try:
+                self._eval(run, args[0])
+            except ParseError, err:
+                run.input = m
+                return True, run.input.nullError()
+            else:
+                raise run.input.nullError()
+
+
+        elif name == "Lookahead":
+            try:
+                m = run.input
+                return self._eval(run, args[0])
+            finally:
+                run.input = m
+
+        elif name == "And":
+            v = None, run.input.nullError()
+            for e in args[0].args:
+                v = self._eval(run, e)
+            return v
+
+        elif name == "Bind":
+            v, err =  self._eval(run, args[1])
+            self._localsStack[-1][args[0].data] = v
+            return v, err
+
+        elif name == "Predicate":
+            val, err = self._eval(run, args[0])
+            if not val:
+                raise err
+            else:
+                return True, err
+
+        elif name == "List":
+            v, e = run.rule_anything()
+            oldInput = run.input
+            try:
+                run.input = InputStream.fromIterable(v)
+            except TypeError:
+                raise e.withMessage(expected("an iterable"))
+            self._eval(run, args[0])
+            run.end()
+            run.input = oldInput
+            return v, e
+
+        elif name in ("Action", "Python"):
+            lo = self._localsStack[-1]
+            val = eval(args[0].data, self._globals, lo)
+            return (val, run.input.nullError())
+
+        elif name == "ConsumedBy":
+            oldInput = run.input
+            _, err = self._eval(run, args[0])
+            slice = oldInput.data[oldInput.position:run.input.position]
+            return slice, err
+
+        else:
+            raise ValueError("Unrecognized term: %r" % (name,))
diff --git a/lib/Parsley-1.1/ometa/runtime.py b/lib/Parsley-1.1/ometa/runtime.py
new file mode 100644
index 0000000..d4692e4
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/runtime.py
@@ -0,0 +1,1057 @@
+# -*- test-case-name: ometa.test.test_runtime -*-
+"""
+Code needed to run a grammar after it has been compiled.
+"""
+import string
+import time
+import operator
+from textwrap import dedent
+from terml.nodes import coerceToTerm, Term, termMaker as t
+from ometa.builder import moduleFromGrammar, writePython
+
+TIMING = False
+
+class ParseError(Exception):
+    """
+    ?Redo from start
+    """
+
+    @property
+    def position(self):
+        return self.args[0]
+
+
+    @property
+    def error(self):
+        return self.args[1]
+
+    def __init__(self, input, position, message, trail=None):
+        Exception.__init__(self, position, message)
+        self.input = input
+        self.trail = trail or []
+
+
+    def __eq__(self, other):
+        if other.__class__ == self.__class__:
+            return (self.position, self.error) == (other.position, other.error)
+
+
+    def formatReason(self):
+        if self.error is None:
+            return "Syntax error"
+        if len(self.error) == 1:
+            if self.error[0][0] == 'message':
+                return self.error[0][1]
+            if self.error[0][2] == None:
+                return 'expected a %s' % (self.error[0][1])
+            else:
+                typ = self.error[0][1]
+                if typ is None:
+                    if isinstance(self.input, basestring):
+                        typ = 'character'
+                    else:
+                        typ = 'object'
+                return 'expected the %s %r' % (typ, self.error[0][2])
+        else:
+            bits = []
+            for s in self.error:
+                if s[0] == 'message':
+                    desc = s[1]
+                elif s[2] is None:
+                    desc = "a " + s[1]
+                else:
+                    desc = repr(s[2])
+                    if s[1] is not None:
+                        desc = "%s %s" % (s[1], desc)
+                bits.append(desc)
+            bits.sort()
+            return "expected one of %s, or %s" % (', '.join(bits[:-1]),
+                                                  bits[-1])
+
+
+    def formatError(self):
+        """
+        Return a pretty string containing error info about string
+        parsing failure.
+        """
+        #de-twineifying
+        lines = str(self.input).split('\n')
+        counter = 0
+        lineNo = 1
+        columnNo = 0
+        for line in lines:
+            newCounter = counter + len(line)
+            if newCounter > self.position:
+                columnNo = self.position - counter
+                break
+            else:
+                counter += len(line) + 1
+                lineNo += 1
+        reason = self.formatReason()
+        return ('\n' + line + '\n' + (' ' * columnNo + '^') +
+                "\nParse error at line %s, column %s: %s. trail: [%s]\n"
+                % (lineNo, columnNo, reason, ' '.join(self.trail)))
+
+
+    def __str__(self):
+        return self.formatError()
+
+
+    def withMessage(self, msg):
+        return ParseError(self.input, self.position, msg, self.trail)
+
+
+class EOFError(ParseError):
+    """
+    Raised when the end of input is encountered.
+    """
+    def __init__(self, input, position):
+        ParseError.__init__(self, input, position, eof())
+
+
+def expected(typ, val=None):
+    """
+    Return an indication of expected input and the position where it was
+    expected and not encountered.
+    """
+
+    return [("expected", typ, val)]
+
+
+def eof():
+    """
+    Return an indication that the end of the input was reached.
+    """
+    return [("message", "end of input")]
+
+_go = False
+def joinErrors(errors):
+    """
+    Return the error from the branch that matched the most of the input.
+    """
+    errors.sort(reverse=True, key=operator.itemgetter(0))
+    results = set()
+    pos = errors[0].position
+    trail = None
+    for err in errors:
+        if pos == err.position:
+            e, trail = err.error, (err.trail or trail)
+            if e is not None:
+                for item in e:
+                        results.add(item)
+        else:
+            break
+    return ParseError(errors[0].input,  pos, list(results) or None, trail)
+
+
+class character(str):
+    """
+    Type to allow distinguishing characters from strings.
+    """
+
+    def __iter__(self):
+        """
+        Prevent string patterns and list patterns from matching single
+        characters.
+        """
+        raise TypeError("Characters are not iterable")
+
+
+
+class unicodeCharacter(unicode):
+    """
+    Type to distinguish characters from Unicode strings.
+    """
+    def __iter__(self):
+        """
+        Prevent string patterns and list patterns from matching single
+        characters.
+        """
+        raise TypeError("Characters are not iterable")
+
+
+
+class InputStream(object):
+    """
+    The basic input mechanism used by OMeta grammars.
+    """
+
+    def fromIterable(cls, iterable):
+        """
+        @param iterable: Any iterable Python object.
+        """
+        if isinstance(iterable, (character, unicodeCharacter)):
+            raise TypeError("Characters are not iterable")
+        if isinstance(iterable, str):
+            return WrappedValueInputStream(iterable, 0, wrapper=character)
+        elif isinstance(iterable, unicode):
+            return WrappedValueInputStream(iterable, 0,
+                                           wrapper=unicodeCharacter)
+        else:
+            return cls(list(iterable), 0)
+    fromIterable = classmethod(fromIterable)
+
+
+    def fromFile(cls, f, encoding='utf-8'):
+        if getattr(f, 'seek', None) and getattr(f, 'tell', None):
+            position = f.tell()
+        else:
+            position = 0
+        txt = f.read()
+        return cls(txt, position)
+    fromFile = classmethod(fromFile)
+
+
+    def fromText(cls, t, name="<string>"):
+        return cls(t, 0)
+
+    fromText = classmethod(fromText)
+
+
+    def __init__(self, data, position):
+        self.data = data
+        self.position = position
+        self.memo = {}
+        self.tl = None
+        self.error = ParseError(self.data, self.position, None)
+
+    def head(self):
+        if self.position >= len(self.data):
+            if getattr(self.data, 'join', None):
+                data = self.data.__class__('').join(self.data)
+            else:
+                data = self.data
+            raise EOFError(data, self.position)
+        return self.data[self.position], self.error
+
+    def nullError(self, msg=None):
+        if msg:
+            return self.error.withMessage(msg)
+        else:
+            return self.error
+
+    def tail(self):
+        if self.tl is None:
+            self.tl = InputStream(self.data, self.position+1)
+        return self.tl
+
+    def advanceBy(self, n):
+        return InputStream(self.data, self.position + n)
+
+    def slice(self, n):
+        data = self.data[self.position:self.position + n]
+        tail = self.advanceBy(n)
+        return data, self.nullError(), tail
+
+    def prev(self):
+        return InputStream(self.data, self.position-1)
+
+    def getMemo(self, name):
+        """
+        Returns the memo record for the named rule.
+        @param name: A rule name.
+        """
+        return self.memo.get(name, None)
+
+
+    def setMemo(self, name, rec):
+        """
+        Store a memo record for the given value and position for the given
+        rule.
+        @param name: A rule name.
+        @param rec: A memo record.
+        """
+        self.memo[name] = rec
+        return rec
+
+    def __cmp__(self, other):
+        return cmp((self.data, self.position), (other.data, other.position))
+
+
+class WrappedValueInputStream(InputStream):
+
+    def __init__(self, data, position, wrapper=None):
+        InputStream.__init__(self, data, position)
+        self.wrapper = wrapper
+
+    def head(self):
+        v, e = InputStream.head(self)
+        return self.wrapper(v), e
+
+    def tail(self):
+        if self.tl is None:
+            self.tl = WrappedValueInputStream(self.data, self.position+1,
+                                              self.wrapper)
+        return self.tl
+
+    def advanceBy(self, n):
+        return InputStream(self.data, self.position + n, self.wrapper)
+
+    def slice(self, n):
+        data = self.data[self.position:self.position + n]
+        tail = self.advanceBy(n)
+        return [self.wrapper(x) for x in data], self.nullError(), tail
+
+class ArgInput(object):
+    def __init__(self, arg, parent):
+        self.arg = arg
+        self.parent = parent
+        self.memo = {}
+        self.err = parent.nullError()
+
+    @property
+    def data(self):
+        return self.parent.data
+
+    def head(self):
+        return self.arg, self.err
+
+    def tail(self):
+        return self.parent
+
+    def advanceBy(self, n):
+        return self.parent.advanceBy(n - 1)
+
+    def slice(self, n):
+        prevVal, _, input =  self.parent.slice(n - 1)
+        return [self.arg] + list(prevVal), self.err, input
+
+    def nullError(self):
+        return self.parent.nullError()
+
+
+    def getMemo(self, name):
+        """
+        Returns the memo record for the named rule.
+        @param name: A rule name.
+        """
+        return self.memo.get(name, None)
+
+
+    def setMemo(self, name, rec):
+        """
+        Store a memo record for the given value and position for the given
+        rule.
+        @param name: A rule name.
+        @param rec: A memo record.
+        """
+        self.memo[name] = rec
+        return rec
+
+
+class LeftRecursion(object):
+    """
+    Marker for left recursion in a grammar rule.
+    """
+    detected = False
+
+
+class OMetaBase(object):
+    """
+    Base class providing implementations of the fundamental OMeta
+    operations. Built-in rules are defined here.
+    """
+    globals = None
+    tree = False
+    def __init__(self, input, globals=None, name='<string>', tree=False,
+            stream=False):
+        """
+        @param input: The string or input object (if stream=True) to be parsed.
+
+        @param globals: A dictionary of names to objects, for use in evaluating
+        embedded Python expressions.
+
+        @param tree: Whether the input should be treated as part of a
+        tree of nested iterables, rather than being a standalone
+        string.
+
+        @param stream: Whether the input should be treated as an existing
+        InputStream object.
+        """
+        if stream:
+            self.input = input
+        elif self.tree or tree:
+            self.input = InputStream.fromIterable(input)
+        else:
+            self.input = InputStream.fromText(input)
+        self.locals = {}
+        if self.globals is None:
+            if globals is None:
+                self.globals = {}
+            else:
+                self.globals = globals
+
+        self.currentError = self.input.nullError()
+
+    def considerError(self, error, typ=None):
+        if error:
+            if error[0] > self.currentError[0]:
+                self.currentError = error
+            elif error[0] == self.currentError[0]:
+                self.currentError = joinErrors([error, self.currentError])
+
+
+    def superApply(self, ruleName, *args):
+        """
+        Apply the named rule as defined on this object's superclass.
+
+        @param ruleName: A rule name.
+        """
+        r = getattr(super(self.__class__, self), "rule_"+ruleName, None)
+        if r is not None:
+            self.input.setMemo(ruleName, None)
+            return self._apply(r, ruleName, args)
+        else:
+            raise NameError("No rule named '%s'" %(ruleName,))
+
+    def foreignApply(self, grammarName, ruleName, globals_, locals_, *args):
+        """
+        Apply the named rule of a foreign grammar.
+
+        @param grammarName: name to look up in locals/globals for grammar
+        @param ruleName: rule name
+        """
+        grammar = locals_.get(grammarName, None)
+        if grammar is None:
+            grammar = globals_[grammarName]
+
+        grammar = getattr(grammar, "_grammarClass", grammar)
+        instance = grammar(self.input, stream=True)
+        rule = getattr(instance, "rule_" + ruleName, None)
+        if rule is not None:
+            self.input.setMemo(ruleName, None)
+            result = instance._apply(rule, ruleName, args)
+            self.input = instance.input
+            return result
+        else:
+            raise NameError("No rule named '%s' on grammar '%s'" %
+                    (ruleName, grammarName))
+
+    def apply(self, ruleName, *args):
+        """
+        Apply the named rule, optionally with some arguments.
+
+        @param ruleName: A rule name.
+        """
+        r = getattr(self, "rule_"+ruleName, None)
+        if r is not None:
+            val, err = self._apply(r, ruleName, args)
+            return val, err
+
+        else:
+            raise NameError("No rule named '%s'" %(ruleName,))
+
+
+    def _apply(self, rule, ruleName, args):
+        """
+        Apply a rule method to some args.
+        @param rule: A method of this object.
+        @param ruleName: The name of the rule invoked.
+        @param args: A sequence of arguments to it.
+        """
+        if args:
+            if ((not getattr(rule, 'func_code', None))
+                 or rule.func_code.co_argcount - 1 != len(args)):
+                for arg in args[::-1]:
+                    self.input = ArgInput(arg, self.input)
+                return rule()
+            else:
+                return rule(*args)
+        memoRec = self.input.getMemo(ruleName)
+        if memoRec is None:
+            oldPosition = self.input
+            lr = LeftRecursion()
+            memoRec = self.input.setMemo(ruleName, lr)
+            try:
+                memoRec = self.input.setMemo(ruleName,
+                                         [rule(), self.input])
+            except ParseError, e:
+                e.trail.append(ruleName)
+                raise
+            if lr.detected:
+                sentinel = self.input
+                while True:
+                    try:
+                        self.input = oldPosition
+                        ans = rule()
+                        if (self.input == sentinel):
+                            break
+
+                        memoRec = oldPosition.setMemo(ruleName,
+                                                     [ans, self.input])
+                    except ParseError:
+                        break
+            self.input = oldPosition
+
+        elif isinstance(memoRec, LeftRecursion):
+            memoRec.detected = True
+            raise self.input.nullError()
+        self.input = memoRec[1]
+        return memoRec[0]
+
+
+    def exactly(self, wanted):
+        """
+        Match a single item from the input equal to the given
+        specimen, or a sequence of characters if the input is string.
+        @param wanted: What to match.
+        """
+        i = self.input
+        if not self.tree and len(wanted) > 1:
+            val, p, self.input = self.input.slice(len(wanted))
+        else:
+            val, p = self.input.head()
+            self.input = self.input.tail()
+        if wanted == val:
+            return val, p
+        else:
+            self.input = i
+            raise p.withMessage(expected(None, wanted))
+
+
+    def many(self, fn, *initial):
+        """
+        Call C{fn} until it fails to match the input. Collect the resulting
+        values into a list.
+
+        @param fn: A callable of no arguments.
+        @param initial: Initial values to populate the returned list with.
+        """
+        ans = []
+        for x, e in initial:
+            ans.append(x)
+        while True:
+            try:
+                m = self.input
+                v, _ = fn()
+                ans.append(v)
+            except ParseError, e:
+                self.input = m
+                break
+        return ans, e
+
+
+    def repeat(self, min, max, fn):
+        """
+        Call C{fn} C{max} times or until it fails to match the
+        input. Fail if less than C{min} matches were made.
+        Collect the results into a list.
+        """
+        if min == max == 0:
+            return '', None
+        ans = []
+        for i in range(min):
+            v, e = fn()
+            ans.append(v)
+
+        for i in range(min, max):
+            try:
+                m = self.input
+                v, e = fn()
+                ans.append(v)
+            except ParseError, e:
+                self.input = m
+                break
+        return ans, e
+
+    def _or(self, fns):
+        """
+        Call each of a list of functions in sequence until one succeeds,
+        rewinding the input between each.
+
+        @param fns: A list of no-argument callables.
+        """
+        errors = []
+        for f in fns:
+            try:
+                m = self.input
+                ret, err = f()
+                errors.append(err)
+                return ret, joinErrors(errors)
+            except ParseError, e:
+                errors.append(e)
+                self.input = m
+        raise joinErrors(errors)
+
+
+    def _not(self, fn):
+        """
+        Call the given function. Raise ParseError iff it does not.
+
+        @param fn: A callable of no arguments.
+        """
+        m = self.input
+        try:
+            fn()
+        except ParseError, e:
+            self.input = m
+            return True, self.input.nullError()
+        else:
+            raise self.input.nullError()
+
+
+    def eatWhitespace(self):
+        """
+        Consume input until a non-whitespace character is reached.
+        """
+        while True:
+            try:
+                c, e = self.input.head()
+            except EOFError, e:
+                break
+            t = self.input.tail()
+            if c.isspace():
+                self.input = t
+            else:
+                break
+        return True, e
+
+
+    def pred(self, expr):
+        """
+        Call the given function, raising ParseError if it returns false.
+
+        @param expr: A callable of no arguments.
+        """
+        val, e = expr()
+        if not val:
+            raise e
+        else:
+            return True, e
+
+
+    def listpattern(self, expr):
+        """
+        Call the given function, treating the next object on the stack as an
+        iterable to be used for input.
+
+        @param expr: A callable of no arguments.
+        """
+        v, e = self.rule_anything()
+        oldInput = self.input
+        try:
+            self.input = InputStream.fromIterable(v)
+        except TypeError:
+            raise e.withMessage(expected("an iterable"))
+
+        expr()
+        self.end()
+        self.input = oldInput
+        return v, e
+
+
+    def consumedby(self, expr):
+        oldInput = self.input
+        _, e = expr()
+        slice = oldInput.data[oldInput.position:self.input.position]
+        return slice, e
+
+
+    def stringtemplate(self, template, vals):
+        output = []
+        checkIndent = False
+        currentIndent = ""
+        for chunk in template.args:
+            if chunk.tag.name == ".String.":
+                output.append(chunk.data)
+                if checkIndent and chunk.data.isspace():
+                    currentIndent = chunk.data
+                    checkIndent = False
+                if chunk.data.endswith('\n'):
+                    checkIndent = True
+            elif chunk.tag.name == "QuasiExprHole":
+                v = vals[chunk.args[0].data]
+                if not isinstance(v, basestring):
+                    try:
+                        vs = list(v)
+                    except TypeError:
+                        raise TypeError("Only know how to templatize strings and lists of strings")
+                    lines = []
+                    for x in vs:
+                        lines.extend(x.split('\n'))
+                    compacted_lines = []
+                    for line in lines:
+                        if line:
+                            compacted_lines.append(line)
+                        elif compacted_lines:
+                            compacted_lines[-1] = compacted_lines[-1] + '\n'
+                    v = ("\n" + currentIndent).join(compacted_lines)
+                output.append(v)
+            else:
+                raise TypeError("didn't expect %r in string template" % chunk)
+        return ''.join(output).rstrip('\n'), None
+
+    def end(self):
+        """
+        Match the end of the stream.
+        """
+        return self._not(self.rule_anything)
+
+
+    def lookahead(self, f):
+        """
+        Execute the given callable, rewinding the stream no matter whether it
+        returns successfully or not.
+
+        @param f: A callable of no arguments.
+        """
+        try:
+            m = self.input
+            x = f()
+            return x
+        finally:
+            self.input = m
+
+
+    def token(self, tok):
+        """
+        Match and return the given string, consuming any preceding whitespace.
+        """
+        m = self.input
+        try:
+            self.eatWhitespace()
+            for c in tok:
+                v, e = self.exactly(c)
+            return tok, e
+        except ParseError, e:
+            self.input = m
+            raise e.withMessage(expected("token", tok))
+
+
+    def letter(self):
+        """
+        Match a single letter.
+        """
+        x, e = self.rule_anything()
+        if x.isalpha():
+            return x, e
+        else:
+            raise e.withMessage(expected("letter"))
+
+
+    def letterOrDigit(self):
+        """
+        Match a single alphanumeric character.
+        """
+        x, e = self.rule_anything()
+        if x.isalnum():
+            return x, e
+        else:
+            raise e.withMessage(expected("letter or digit"))
+
+    def digit(self):
+        """
+        Match a single digit.
+        """
+        x, e = self.rule_anything()
+        if x.isdigit():
+            return x, e
+        else:
+            raise e.withMessage(expected("digit"))
+
+    rule_digit = digit
+
+    rule_letterOrDigit = letterOrDigit
+    rule_letter = letter
+    rule_end = end
+    rule_ws = eatWhitespace
+    rule_exactly = exactly
+
+    #Deprecated.
+    rule_spaces = eatWhitespace
+    rule_token = token
+
+
+    def rule_anything(self):
+        """
+        Match a single item from the input of any kind.
+        """
+        h, p = self.input.head()
+        self.input = self.input.tail()
+        return h, p
+
+
+
+class OMetaGrammarBase(OMetaBase):
+    """
+    Common methods for the OMeta grammar parser itself, and its variants.
+    """
+    tree_target = False
+
+    @classmethod
+    def makeGrammar(cls, grammar, name='Grammar'):
+        """
+        Define a new parser class with the rules in the given grammar.
+
+        @param grammar: A string containing a PyMeta grammar.
+        @param name: The name of the class to be generated.
+        @param superclass: The class the generated class is a child of.
+        """
+        g = cls(grammar)
+        if TIMING:
+            start = time.time()
+        tree = g.parseGrammar(name)
+        if TIMING:
+            print "Grammar %r parsed in %g secs" % (name, time.time() - start)
+            def cnt(n):
+                count = sum(cnt(a) for a in n.args) + 1
+                return count
+            print "%d nodes." % (cnt(tree))
+            start = time.time()
+        modname = "pymeta_grammar__" + name
+        filename = "/pymeta_generated_code/" + modname + ".py"
+        source = writePython(tree)
+        if TIMING:
+            print "Grammar %r generated in %g secs" % (name, time.time() - start)
+        return moduleFromGrammar(source, name, modname, filename)
+
+
+    def __init__(self, grammar, *a, **kw):
+        OMetaBase.__init__(self, dedent(grammar), *a, **kw)
+
+
+    def parseGrammar(self, name):
+        """
+        Entry point for converting a grammar to code (of some variety).
+
+        @param name: The name for this grammar.
+
+        @param builder: A class that implements the grammar-building interface
+        (interface to be explicitly defined later)
+        """
+        self.name = name
+        res, err = self.apply("grammar")
+        try:
+            x = self.input.head()
+        except EOFError:
+            pass
+        else:
+            raise err
+        return res
+
+
+    def applicationArgs(self, finalChar):
+        """
+        Collect rule arguments, a list of Python expressions separated by
+        spaces.
+        """
+        args = []
+        while True:
+            try:
+                (arg, endchar), err = self.pythonExpr(" " + finalChar)
+                if not arg:
+                    break
+                args.append(t.Action(arg))
+                if endchar == finalChar:
+                    break
+                if endchar == ' ':
+                    self.rule_anything()
+            except ParseError:
+                break
+        if args:
+            return args
+        else:
+            raise self.input.nullError()
+
+    def ruleValueExpr(self, singleLine):
+        """
+        Find and generate code for a Python expression terminated by a close
+        paren/brace or end of line.
+        """
+        (expr, endchar), err = self.pythonExpr(endChars="\r\n)]")
+        # if str(endchar) in ")]" or (singleLine and endchar):
+        #     self.input = self.input.prev()
+        return t.Action(expr)
+
+    def semanticActionExpr(self):
+        """
+        Find and generate code for a Python expression terminated by a
+        close-paren, whose return value is ignored.
+        """
+        val = t.Action(self.pythonExpr(')')[0][0])
+        self.exactly(')')
+        return val
+
+    def semanticPredicateExpr(self):
+        """
+        Find and generate code for a Python expression terminated by a
+        close-paren, whose return value determines the success of the pattern
+        it's in.
+        """
+        expr = t.Action(self.pythonExpr(')')[0][0])
+        self.exactly(')')
+        return t.Predicate(expr)
+
+
+    def eatWhitespace(self):
+        """
+        Consume input until a non-whitespace character is reached.
+        """
+        consumingComment = False
+        while True:
+            try:
+                c, e = self.input.head()
+            except EOFError, e:
+                break
+            t = self.input.tail()
+            if c.isspace() or consumingComment:
+                self.input = t
+                if c == '\n':
+                    consumingComment = False
+            elif c == '#':
+                consumingComment = True
+            else:
+                break
+        return True, e
+    rule_spaces = eatWhitespace
+
+
+    def pythonExpr(self, endChars="\r\n"):
+        """
+        Extract a Python expression from the input and return it.
+
+        @arg endChars: A set of characters delimiting the end of the expression.
+        """
+        delimiters = { "(": ")", "[": "]", "{": "}"}
+        stack = []
+        expr = []
+        endchar = None
+        while True:
+            try:
+                c, e = self.rule_anything()
+                endchar = c
+            except ParseError, e:
+                endchar = None
+                break
+            if c in endChars and len(stack) == 0:
+                self.input = self.input.prev()
+                break
+            else:
+                expr.append(c)
+                if c in delimiters:
+                    stack.append(delimiters[c])
+                elif len(stack) > 0 and c == stack[-1]:
+                    stack.pop()
+                elif c in delimiters.values():
+                    raise ParseError(self.input.data, self.input.position,
+                                     expected("Python expression"))
+                elif c in "\"'":
+                    while True:
+                        strc, stre = self.rule_anything()
+                        expr.append(strc)
+                        slashcount = 0
+                        while strc == '\\':
+                            strc, stre = self.rule_anything()
+                            expr.append(strc)
+                            slashcount += 1
+                        if strc == c and slashcount % 2 == 0:
+                            break
+
+        if len(stack) > 0:
+            raise ParseError(self.input.data, self.input.position,
+                             expected("Python expression"))
+        return (''.join(expr).strip(), endchar), e
+
+    def isTree(self):
+        self.tree_target = True
+
+
+class TreeTransformerBase(OMetaBase):
+
+    @classmethod
+    def transform(cls, term):
+        g = cls([term])
+        return g.apply("transform")
+
+    def _transform_data(self, tt):
+        if tt.data is not None:
+            return tt.data
+        name = tt.tag.name
+        if name == 'null':
+            return None
+        if name == 'true':
+            return True
+        if name == 'false':
+            return False
+        raise ValueError()
+
+    def rule_transform(self):
+        tt, e = self.rule_anything()
+        if isinstance(tt, Term):
+            try:
+                return self._transform_data(tt), e
+            except ValueError:
+                name = tt.tag.name
+                if name == '.tuple.':
+                    return self._transform_iterable(tt.args)
+                else:
+                    if getattr(self, 'rule_' + name, None):
+                        return self.apply(name, tt)
+                    else:
+                        return self.apply("unknown_term", tt)
+        else:
+            return self._transform_iterable(tt)
+
+    def _transform_iterable(self, contents):
+        oldInput = self.input
+        self.input = InputStream.fromIterable(contents)
+        v = self.many(self.rule_transform)
+        self.end()
+        self.input = oldInput
+        return v
+
+    def rule_unknown_term(self):
+        tt, _ = self.rule_anything()
+        oldInput = self.input
+        self.input = InputStream.fromIterable(tt.args)
+        newargs, e = self.many(self.rule_transform)
+        self.end()
+        self.input = oldInput
+        return Term(tt.tag, None, tuple(coerceToTerm(a) for a in newargs)), e
+
+    def rule_null(self):
+        tt, e = self.rule_anything()
+        if not tt.tag.name == "null":
+            raise self.input.nullError()
+        return None, self.input.nullError()
+
+    def termpattern(self, name, expr):
+        v, e = self.rule_anything()
+        if name == ".tuple." and getattr(v, 'tag', None) is None:
+            newInput = v
+        elif name != v.tag.name:
+            raise e.withMessage(expected("a Term named " + name))
+        else:
+            newInput = v.args
+        oldInput = self.input
+        try:
+            self.input = InputStream.fromIterable(newInput)
+        except TypeError:
+            raise e.withMessage(expected("a Term"))
+
+        expr()
+        self.end()
+        self.input = oldInput
+        return v, e
+
+    def exactly(self, wanted):
+        """
+        Match a single item from the input equal to the given
+        specimen, or a sequence of characters if the input is string.
+        @param wanted: What to match.
+        """
+        i = self.input
+        if not self.tree and len(wanted) > 1:
+            val, p, self.input = self.input.slice(len(wanted))
+        else:
+            val, p = self.input.head()
+            self.input = self.input.tail()
+        if getattr(val, 'data', None) is not None:
+            val = val.data
+        if wanted == val:
+            return val, p
+        else:
+            self.input = i
+            raise p.withMessage(expected(None, wanted))
+
+    rule_exactly = exactly
diff --git a/lib/Parsley-1.1/ometa/test/__init__.py b/lib/Parsley-1.1/ometa/test/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Parsley-1.1/ometa/test/test_builder.py b/lib/Parsley-1.1/ometa/test/test_builder.py
new file mode 100644
index 0000000..650d574
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/test/test_builder.py
@@ -0,0 +1,368 @@
+from textwrap import dedent
+import unittest
+
+from ometa.builder import writePython
+from terml.nodes import termMaker as t
+from terml.parser import parseTerm as term
+
+def dd(txt):
+    return dedent(txt).strip()
+
+class PythonWriterTests(unittest.TestCase):
+    """
+    Tests for generating Python source from an AST.
+    """
+
+    def test_exactly(self):
+        """
+        Test generation of code for the 'exactly' pattern.
+        """
+
+        x = t.Exactly("x")
+        self.assertEqual(writePython(x),
+                         dd("""
+                            _G_exactly_1, lastError = self.exactly('x')
+                            self.considerError(lastError, None)
+                            _G_exactly_1
+                            """))
+
+
+
+    def test_apply(self):
+        """
+        Test generation of code for rule application.
+        """
+
+        one = t.Action("1")
+        x = t.Action("x")
+        a = t.Apply("foo", "main", [one, x])
+        self.assertEqual(writePython(a),
+                         dd("""
+                            _G_python_1, lastError = 1, None
+                            self.considerError(lastError, None)
+                            _G_python_2, lastError = eval('x', self.globals, _locals), None
+                            self.considerError(lastError, None)
+                            _G_apply_3, lastError = self._apply(self.rule_foo, "foo", [_G_python_1, _G_python_2])
+                            self.considerError(lastError, None)
+                            _G_apply_3
+                            """))
+
+    def test_foreignApply(self):
+        """
+        Test generation of code for calling foreign grammar's rules.
+        """
+        one = t.Action("1")
+        x = t.Action("x")
+        a = t.ForeignApply("thegrammar", "foo", "main", [one, x])
+        self.assertEqual(writePython(a),
+                         dd("""
+                            _G_python_1, lastError = 1, None
+                            self.considerError(lastError, None)
+                            _G_python_2, lastError = eval('x', self.globals, _locals), None
+                            self.considerError(lastError, None)
+                            _G_apply_3, lastError = self.foreignApply("thegrammar", "foo", self.globals, _locals, _G_python_1, _G_python_2)
+                            self.considerError(lastError, None)
+                            _G_apply_3
+                            """))
+
+    def test_superApply(self):
+        """
+        Test generation of code for calling the superclass' implementation of
+        the current rule.
+        """
+        one = t.Action("1")
+        x = t.Action("x")
+        a = t.Apply("super", "main", [one, x])
+        self.assertEqual(writePython(a),
+                         dd("""
+                            _G_python_1, lastError = 1, None
+                            self.considerError(lastError, None)
+                            _G_python_2, lastError = eval('x', self.globals, _locals), None
+                            self.considerError(lastError, None)
+                            _G_apply_3, lastError = self.superApply("main", _G_python_1, _G_python_2)
+                            self.considerError(lastError, None)
+                            _G_apply_3
+                            """))
+
+
+    def test_many(self):
+        """
+        Test generation of code for matching zero or more instances of
+        a pattern.
+        """
+
+        xs = t.Many(t.Exactly("x"))
+        self.assertEqual(writePython(xs),
+                         dd("""
+                            def _G_many_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            _G_many_3, lastError = self.many(_G_many_1)
+                            self.considerError(lastError, None)
+                            _G_many_3
+                            """))
+
+
+    def test_many1(self):
+        """
+        Test generation of code for matching one or more instances of
+        a pattern.
+        """
+
+        xs = t.Many1(t.Exactly("x"))
+        self.assertEqual(writePython(xs),
+                         dd("""
+                            def _G_many1_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            _G_many1_3, lastError = self.many(_G_many1_1, _G_many1_1())
+                            self.considerError(lastError, None)
+                            _G_many1_3
+                            """))
+
+
+
+    def test_or(self):
+        """
+        Test code generation for a sequence of alternatives.
+        """
+
+        xy = t.Or([t.Exactly("x"),
+                               t.Exactly("y")])
+        self.assertEqual(writePython(xy),
+                         dd("""
+                            def _G_or_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            def _G_or_3():
+                                _G_exactly_4, lastError = self.exactly('y')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_4, self.currentError)
+                            _G_or_5, lastError = self._or([_G_or_1, _G_or_3])
+                            self.considerError(lastError, None)
+                            _G_or_5
+                            """))
+
+    def test_singleOr(self):
+        """
+        Test code generation for a sequence of alternatives.
+        """
+
+        x1 = t.Or([t.Exactly("x")])
+        x = t.Exactly("x")
+        self.assertEqual(writePython(x), writePython(x1))
+
+
+    def test_optional(self):
+        """
+        Test code generation for optional terms.
+        """
+        x = t.Optional(t.Exactly("x"))
+        self.assertEqual(writePython(x),
+                         dd("""
+                            def _G_optional_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            def _G_optional_3():
+                                return (None, self.input.nullError())
+                            _G_or_4, lastError = self._or([_G_optional_1, _G_optional_3])
+                            self.considerError(lastError, None)
+                            _G_or_4
+                            """))
+
+
+    def test_not(self):
+        """
+        Test code generation for negated terms.
+        """
+        x = t.Not(t.Exactly("x"))
+        self.assertEqual(writePython(x),
+                         dd("""
+                            def _G_not_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            _G_not_3, lastError = self._not(_G_not_1)
+                            self.considerError(lastError, None)
+                            _G_not_3
+                            """))
+
+
+    def test_lookahead(self):
+        """
+        Test code generation for lookahead expressions.
+        """
+        x = t.Lookahead(t.Exactly("x"))
+        self.assertEqual(writePython(x),
+                         dd("""
+                            def _G_lookahead_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            _G_lookahead_3, lastError = self.lookahead(_G_lookahead_1)
+                            self.considerError(lastError, None)
+                            _G_lookahead_3
+                            """))
+
+
+
+    def test_sequence(self):
+        """
+        Test generation of code for sequence patterns.
+        """
+        x = t.Exactly("x")
+        y = t.Exactly("y")
+        z = t.And([x, y])
+        self.assertEqual(writePython(z),
+                         dd("""
+                            _G_exactly_1, lastError = self.exactly('x')
+                            self.considerError(lastError, None)
+                            _G_exactly_2, lastError = self.exactly('y')
+                            self.considerError(lastError, None)
+                            _G_exactly_2
+                            """))
+
+
+    def test_bind(self):
+        """
+        Test code generation for variable assignment.
+        """
+        x = t.Exactly("x")
+        b = t.Bind("var", x)
+        self.assertEqual(writePython(b),
+                         dd("""
+                            _G_exactly_1, lastError = self.exactly('x')
+                            self.considerError(lastError, None)
+                            _locals['var'] = _G_exactly_1
+                            _locals['var']
+                            """))
+
+
+    def test_pred(self):
+        """
+        Test code generation for predicate expressions.
+        """
+        x = t.Predicate(t.Exactly("x"))
+        self.assertEqual(writePython(x),
+                         dd("""
+                            def _G_pred_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            _G_pred_3, lastError = self.pred(_G_pred_1)
+                            self.considerError(lastError, None)
+                            _G_pred_3
+                            """))
+
+
+    def test_action(self):
+        """
+        Test code generation for semantic actions.
+        """
+        x = t.Action("doStuff()")
+        self.assertEqual(writePython(x),
+                         dd("""
+                            _G_python_1, lastError = eval('doStuff()', self.globals, _locals), None
+                            self.considerError(lastError, None)
+                            _G_python_1
+                            """))
+
+
+    def test_expr(self):
+        """
+        Test code generation for semantic predicates.
+        """
+        x = t.Action("returnStuff()")
+        self.assertEqual(writePython(x),
+                         dd("""
+                            _G_python_1, lastError = eval('returnStuff()', self.globals, _locals), None
+                            self.considerError(lastError, None)
+                            _G_python_1
+                            """))
+
+    def test_listpattern(self):
+        """
+        Test code generation for list patterns.
+        """
+        x = t.List(t.Exactly("x"))
+        self.assertEqual(writePython(x),
+                         dd("""
+                            def _G_listpattern_1():
+                                _G_exactly_2, lastError = self.exactly('x')
+                                self.considerError(lastError, None)
+                                return (_G_exactly_2, self.currentError)
+                            _G_listpattern_3, lastError = self.listpattern(_G_listpattern_1)
+                            self.considerError(lastError, None)
+                            _G_listpattern_3
+                            """))
+
+
+    def test_markAsTree(self):
+        """
+        Grammars containing list patterns are marked as taking
+        tree-shaped input rather than character streams.
+        """
+        x = t.Rule("foo", t.List(
+                t.Exactly("x")))
+        g = t.Grammar("TestGrammar", True, [x])
+        self.assertIn("\n        tree = True\n", writePython(g))
+
+
+    def test_rule(self):
+        """
+        Test generation of entire rules.
+        """
+
+        x = t.Rule("foo", t.Exactly("x"))
+        self.assertEqual(writePython(x),
+                         dd("""
+                            def rule_foo(self):
+                                _locals = {'self': self}
+                                self.locals['foo'] = _locals
+                                _G_exactly_1, lastError = self.exactly('x')
+                                self.considerError(lastError, 'foo')
+                                return (_G_exactly_1, self.currentError)
+                            """))
+
+
+    def test_grammar(self):
+        """
+        Test generation of an entire grammar.
+        """
+        r1 = t.Rule("foo", t.Exactly("x"))
+        r2 = t.Rule("baz", t.Exactly("y"))
+        x = t.Grammar("BuilderTest", False, [r1, r2])
+        self.assertEqual(
+            writePython(x),
+            dd("""
+               def createParserClass(GrammarBase, ruleGlobals):
+                   if ruleGlobals is None:
+                       ruleGlobals = {}
+                   class BuilderTest(GrammarBase):
+                       def rule_foo(self):
+                           _locals = {'self': self}
+                           self.locals['foo'] = _locals
+                           _G_exactly_1, lastError = self.exactly('x')
+                           self.considerError(lastError, 'foo')
+                           return (_G_exactly_1, self.currentError)
+
+
+                       def rule_baz(self):
+                           _locals = {'self': self}
+                           self.locals['baz'] = _locals
+                           _G_exactly_2, lastError = self.exactly('y')
+                           self.considerError(lastError, 'baz')
+                           return (_G_exactly_2, self.currentError)
+
+
+                   if BuilderTest.globals is not None:
+                       BuilderTest.globals = BuilderTest.globals.copy()
+                       BuilderTest.globals.update(ruleGlobals)
+                   else:
+                       BuilderTest.globals = ruleGlobals
+                   return BuilderTest
+                            """))
diff --git a/lib/Parsley-1.1/ometa/test/test_pymeta.py b/lib/Parsley-1.1/ometa/test/test_pymeta.py
new file mode 100644
index 0000000..76f3e12
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/test/test_pymeta.py
@@ -0,0 +1,1487 @@
+import operator
+from textwrap import dedent
+from twisted.trial import unittest
+from ometa.grammar import OMeta, TermOMeta, TreeTransformerGrammar
+from ometa.compat import OMeta1
+from ometa.runtime import (ParseError, OMetaBase, OMetaGrammarBase, EOFError,
+                           expected, TreeTransformerBase)
+from ometa.interp import GrammarInterpreter, TrampolinedGrammarInterpreter
+from terml.parser import parseTerm as term
+
+
+class HandyWrapper(object):
+    """
+    Convenient grammar wrapper for parsing strings.
+    """
+    def __init__(self, klass):
+        """
+        @param klass: The grammar class to be wrapped.
+        """
+        self.klass = klass
+
+
+    def __getattr__(self, name):
+        """
+        Return a function that will instantiate a grammar and invoke the named
+        rule.
+        @param: Rule name.
+        """
+        def doIt(s):
+            """
+            @param s: The string to be parsed by the wrapped grammar.
+            """
+            obj = self.klass(s)
+            ret, err = obj.apply(name)
+            try:
+                extra, _ = obj.input.head()
+            except EOFError:
+                try:
+                    return ''.join(ret)
+                except TypeError:
+                    return ret
+            else:
+                raise err
+        return doIt
+
+
+
+class OMeta1TestCase(unittest.TestCase):
+    """
+    Tests of OMeta grammar compilation, with v1 syntax.
+    """
+
+    classTested = OMeta1
+
+    def compile(self, grammar):
+        """
+        Produce an object capable of parsing via this grammar.
+
+        @param grammar: A string containing an OMeta grammar.
+        """
+        m = self.classTested.makeGrammar(dedent(grammar), 'TestGrammar')
+        g = m.createParserClass(OMetaBase, globals())
+        return HandyWrapper(g)
+
+
+
+    def test_literals(self):
+        """
+        Input matches can be made on literal characters.
+        """
+        g = self.compile("digit ::= '1'")
+        self.assertEqual(g.digit("1"), "1")
+        self.assertRaises(ParseError, g.digit, "4")
+
+
+    def test_multipleRules(self):
+        """
+        Grammars with more than one rule work properly.
+        """
+        g = self.compile("""
+                          digit ::= '1'
+                          aLetter ::= 'a'
+                          """)
+        self.assertEqual(g.digit("1"), "1")
+        self.assertRaises(ParseError, g.digit, "4")
+
+
+    def test_escapedLiterals(self):
+        """
+        Input matches can be made on escaped literal characters.
+        """
+        g = self.compile(r"newline ::= '\n'")
+        self.assertEqual(g.newline("\n"), "\n")
+
+
+    def test_integers(self):
+        """
+        Input matches can be made on literal integers.
+        """
+        g = self.compile("stuff ::= 17 0x1F -2 0177")
+        self.assertEqual(g.stuff([17, 0x1f, -2, 0177]), 0177)
+        self.assertRaises(ParseError, g.stuff, [1, 2, 3])
+
+
+    def test_star(self):
+        """
+        Input matches can be made on zero or more repetitions of a pattern.
+        """
+        g = self.compile("xs ::= 'x'*")
+        self.assertEqual(g.xs(""), "")
+        self.assertEqual(g.xs("x"), "x")
+        self.assertEqual(g.xs("xxxx"), "xxxx")
+        self.assertRaises(ParseError, g.xs, "xy")
+
+
+    def test_plus(self):
+        """
+        Input matches can be made on one or more repetitions of a pattern.
+        """
+        g = self.compile("xs ::= 'x'+")
+        self.assertEqual(g.xs("x"), "x")
+        self.assertEqual(g.xs("xxxx"), "xxxx")
+        self.assertRaises(ParseError, g.xs, "xy")
+        self.assertRaises(ParseError, g.xs, "")
+
+
+    def test_sequencing(self):
+        """
+        Input matches can be made on a sequence of patterns.
+        """
+        g = self.compile("twelve ::= '1' '2'")
+        self.assertEqual(g.twelve("12"), "2");
+        self.assertRaises(ParseError, g.twelve, "1")
+
+
+    def test_alternatives(self):
+        """
+        Input matches can be made on one of a set of alternatives.
+        """
+        g = self.compile("digit ::= '0' | '1' | '2'")
+        self.assertEqual(g.digit("0"), "0")
+        self.assertEqual(g.digit("1"), "1")
+        self.assertEqual(g.digit("2"), "2")
+        self.assertRaises(ParseError, g.digit, "3")
+
+
+    def test_optional(self):
+        """
+        Subpatterns can be made optional.
+        """
+        g = self.compile("foo ::= 'x' 'y'? 'z'")
+        self.assertEqual(g.foo("xyz"), 'z')
+        self.assertEqual(g.foo("xz"), 'z')
+
+
+    def test_apply(self):
+        """
+        Other productions can be invoked from within a production.
+        """
+        g = self.compile("""
+              digit ::= '0' | '1'
+              bits ::= <digit>+
+            """)
+        self.assertEqual(g.bits('0110110'), '0110110')
+
+
+    def test_negate(self):
+        """
+        Input can be matched based on its failure to match a pattern.
+        """
+        g = self.compile("foo ::= ~'0' <anything>")
+        self.assertEqual(g.foo("1"), "1")
+        self.assertRaises(ParseError, g.foo, "0")
+
+
+    def test_ruleValue(self):
+        """
+        Productions can specify a Python expression that provides the result
+        of the parse.
+        """
+        g = self.compile("foo ::= '1' => 7")
+        self.assertEqual(g.foo('1'), 7)
+
+
+    def test_ruleValueEscapeQuotes(self):
+        """
+        Escaped quotes are handled properly in Python expressions.
+        """
+        g = self.compile(r"""escapedChar ::= '\'' => '\\\''""")
+        self.assertEqual(g.escapedChar("'"), "\\'")
+
+
+    def test_ruleValueEscapeSlashes(self):
+        """
+        Escaped slashes are handled properly in Python expressions.
+        """
+        g = self.compile(r"""escapedChar ::= '\\' => '\\'""")
+        self.assertEqual(g.escapedChar("\\"), "\\")
+
+
+    def test_lookahead(self):
+        """
+        Doubled negation does lookahead.
+        """
+        g = self.compile("""
+                         foo ::= ~~(:x) <bar x>
+                         bar :x ::= :a :b ?(x == a == b) => x
+                         """)
+        self.assertEqual(g.foo("11"), '1')
+        self.assertEqual(g.foo("22"), '2')
+
+
+    def test_binding(self):
+        """
+        The result of a parsing expression can be bound to a name.
+        """
+        g = self.compile("foo ::= '1':x => int(x) * 2")
+        self.assertEqual(g.foo("1"), 2)
+
+
+    def test_bindingAccess(self):
+        """
+        Bound names in a rule can be accessed on the grammar's "locals" dict.
+        """
+        G = self.classTested.makeGrammar(
+            "stuff ::= '1':a ('2':b | '3':c)", 'TestGrammar').createParserClass(OMetaBase, {})
+        g = G("12")
+        self.assertEqual(g.apply("stuff")[0], '2')
+        self.assertEqual(g.locals['stuff']['a'], '1')
+        self.assertEqual(g.locals['stuff']['b'], '2')
+        g = G("13")
+        self.assertEqual(g.apply("stuff")[0], '3')
+        self.assertEqual(g.locals['stuff']['a'], '1')
+        self.assertEqual(g.locals['stuff']['c'], '3')
+
+
+    def test_predicate(self):
+        """
+        Python expressions can be used to determine the success or failure of a
+        parse.
+        """
+        g = self.compile("""
+              digit ::= '0' | '1'
+              double_bits ::= <digit>:a <digit>:b ?(a == b) => int(b)
+           """)
+        self.assertEqual(g.double_bits("00"), 0)
+        self.assertEqual(g.double_bits("11"), 1)
+        self.assertRaises(ParseError, g.double_bits, "10")
+        self.assertRaises(ParseError, g.double_bits, "01")
+
+
+    def test_parens(self):
+        """
+        Parens can be used to group subpatterns.
+        """
+        g = self.compile("foo ::= 'a' ('b' | 'c')")
+        self.assertEqual(g.foo("ab"), "b")
+        self.assertEqual(g.foo("ac"), "c")
+
+
+    def test_action(self):
+        """
+        Python expressions can be run as actions with no effect on the result
+        of the parse.
+        """
+        g = self.compile("""foo ::= ('1'*:ones !(False) !(ones.insert(0, '0')) => ''.join(ones))""")
+        self.assertEqual(g.foo("111"), "0111")
+
+
+    def test_bindNameOnly(self):
+        """
+        A pattern consisting of only a bind name matches a single element and
+        binds it to that name.
+        """
+        g = self.compile("foo ::= '1' :x '2' => x")
+        self.assertEqual(g.foo("132"), "3")
+
+
+    def test_args(self):
+        """
+        Productions can take arguments.
+        """
+        g = self.compile("""
+              digit ::= ('0' | '1' | '2'):d => int(d)
+              foo :x :ignored ::= (?(x > 1) '9' | ?(x <= 1) '8'):d => int(d)
+              baz ::= <digit>:a <foo a None>:b => [a, b]
+            """)
+        self.assertEqual(g.baz("18"), [1, 8])
+        self.assertEqual(g.baz("08"), [0, 8])
+        self.assertEqual(g.baz("29"), [2, 9])
+        self.assertRaises(ParseError, g.foo, "28")
+
+
+    def test_patternMatch(self):
+        """
+        Productions can pattern-match on arguments.
+        Also, multiple definitions of a rule can be done in sequence.
+        """
+        g = self.compile("""
+              fact 0                       => 1
+              fact :n ::= <fact (n - 1)>:m => n * m
+           """)
+        self.assertEqual(g.fact([3]), 6)
+
+
+    def test_listpattern(self):
+        """
+        Brackets can be used to match contents of lists.
+        """
+        g = self.compile("""
+             digit  ::= :x ?(x.isdigit())          => int(x)
+             interp ::= [<digit>:x '+' <digit>:y] => x + y
+           """)
+        self.assertEqual(g.interp([['3', '+', '5']]), 8)
+
+    def test_listpatternresult(self):
+        """
+        The result of a list pattern is the entire list.
+        """
+        g = self.compile("""
+             digit  ::= :x ?(x.isdigit())          => int(x)
+             interp ::= [<digit>:x '+' <digit>:y]:z => (z, x + y)
+        """)
+        e = ['3', '+', '5']
+        self.assertEqual(g.interp([e]), (e, 8))
+
+    def test_recursion(self):
+        """
+        Rules can call themselves.
+        """
+        g = self.compile("""
+             interp ::= (['+' <interp>:x <interp>:y] => x + y
+                       | ['*' <interp>:x <interp>:y] => x * y
+                       | :x ?(isinstance(x, str) and x.isdigit()) => int(x))
+             """)
+        self.assertEqual(g.interp([['+', '3', ['*', '5', '2']]]), 13)
+
+
+    def test_leftrecursion(self):
+         """
+         Left-recursion is detected and compiled appropriately.
+         """
+         g = self.compile("""
+               num ::= (<num>:n <digit>:d   => n * 10 + d
+                      | <digit>)
+               digit ::= :x ?(x.isdigit()) => int(x)
+              """)
+         self.assertEqual(g.num("3"), 3)
+         self.assertEqual(g.num("32767"), 32767)
+
+
+    def test_characterVsSequence(self):
+        """
+        Characters (in single-quotes) are not regarded as sequences.
+        """
+        g = self.compile("""
+        interp ::= ([<interp>:x '+' <interp>:y] => x + y
+                  | [<interp>:x '*' <interp>:y] => x * y
+                  | :x ?(isinstance(x, basestring) and x.isdigit()) => int(x))
+        """)
+        self.assertEqual(g.interp([['3', '+', ['5', '*', '2']]]), 13)
+        self.assertEqual(g.interp([[u'3', u'+', [u'5', u'*', u'2']]]), 13)
+
+
+    def test_string(self):
+        """
+        Strings in double quotes match string objects.
+        """
+        g = self.compile("""
+             interp ::= ["Foo" 1 2] => 3
+           """)
+        self.assertEqual(g.interp([["Foo", 1, 2]]), 3)
+
+    def test_argEscape(self):
+        """
+        Regression test for bug #239344.
+        """
+        g = self.compile("""
+            memo_arg :arg ::= <anything> ?(False)
+            trick ::= <letter> <memo_arg 'c'>
+            broken ::= <trick> | <anything>*
+        """)
+        self.assertEqual(g.broken('ab'), 'ab')
+
+
+    def test_comments(self):
+        """
+        Comments in grammars are accepted and ignored.
+        """
+        g = self.compile("""
+        #comment here
+        digit ::= ( '0' #second comment
+                  | '1') #another one
+        #comments after rules are cool too
+        bits ::= <digit>+   #last one
+        """)
+        self.assertEqual(g.bits('0110110'), '0110110')
+
+
+    def test_accidental_bareword(self):
+        """
+        Accidental barewords are treated as syntax errors in the grammar.
+        """
+        self.assertRaises(ParseError,
+                          self.compile, """
+                          atom ::= ~('|') :a => Regex_Atom(a)
+                                   | ' ' atom:a
+                          """)
+
+
+
+
+class OMetaTestCase(unittest.TestCase):
+    """
+    Tests of OMeta grammar compilation.
+    """
+
+    classTested = OMeta
+
+
+    def compile(self, grammar, globals=None):
+        """
+        Produce an object capable of parsing via this grammar.
+
+        @param grammar: A string containing an OMeta grammar.
+        """
+        g = self.classTested.makeGrammar(grammar, 'TestGrammar').createParserClass(OMetaBase, globals or {})
+        return HandyWrapper(g)
+
+
+    def test_literals(self):
+        """
+        Input matches can be made on literal characters.
+        """
+        g = self.compile("digit = '1'")
+        self.assertEqual(g.digit("1"), "1")
+        self.assertRaises(ParseError, g.digit, "4")
+
+
+    def test_escaped_char(self):
+        """
+        Hex escapes are supported in strings in grammars.
+        """
+        g = self.compile(r"bel = '\x07'")
+        self.assertEqual(g.bel("\x07"), "\x07")
+
+
+    def test_literals_multi(self):
+        """
+        Input matches can be made on multiple literal characters at
+        once.
+        """
+        g = self.compile("foo = 'foo'")
+        self.assertEqual(g.foo("foo"), "foo")
+        self.assertRaises(ParseError, g.foo, "for")
+
+    def test_token(self):
+        """
+        Input matches can be made on tokens, which default to
+        consuming leading whitespace.
+        """
+        g = self.compile('foo = "foo"')
+        self.assertEqual(g.foo("    foo"), "foo")
+        self.assertRaises(ParseError, g.foo, "fog")
+
+
+    def test_multipleRules(self):
+        """
+        Grammars with more than one rule work properly.
+        """
+        g = self.compile("""
+                          digit = '1'
+                          aLetter = 'a'
+                          """)
+        self.assertEqual(g.digit("1"), "1")
+        self.assertRaises(ParseError, g.digit, "4")
+
+
+    def test_escapedLiterals(self):
+        """
+        Input matches can be made on escaped literal characters.
+        """
+        g = self.compile(r"newline = '\n'")
+        self.assertEqual(g.newline("\n"), "\n")
+
+
+    def test_integers(self):
+        """
+        Input matches can be made on literal integers.
+        """
+        g = self.compile("stuff = 17 0x1F -2 0177")
+        self.assertEqual(g.stuff([17, 0x1f, -2, 0177]), 0177)
+        self.assertRaises(ParseError, g.stuff, [1, 2, 3])
+
+
+    def test_star(self):
+        """
+        Input matches can be made on zero or more repetitions of a pattern.
+        """
+        g = self.compile("xs = 'x'*")
+        self.assertEqual(g.xs(""), "")
+        self.assertEqual(g.xs("x"), "x")
+        self.assertEqual(g.xs("xxxx"), "xxxx")
+        self.assertRaises(ParseError, g.xs, "xy")
+
+
+    def test_plus(self):
+        """
+        Input matches can be made on one or more repetitions of a pattern.
+        """
+        g = self.compile("xs = 'x'+")
+        self.assertEqual(g.xs("x"), "x")
+        self.assertEqual(g.xs("xxxx"), "xxxx")
+        self.assertRaises(ParseError, g.xs, "xy")
+        self.assertRaises(ParseError, g.xs, "")
+
+
+    def test_repeat(self):
+        """
+        Match repetitions can be specifically numbered.
+        """
+        g = self.compile("xs = 'x'{2, 4}:n 'x'* -> n")
+        self.assertEqual(g.xs("xx"), "xx")
+        self.assertEqual(g.xs("xxxx"), "xxxx")
+        self.assertEqual(g.xs("xxxxxx"), "xxxx")
+        self.assertRaises(ParseError, g.xs, "x")
+        self.assertRaises(ParseError, g.xs, "")
+
+
+    def test_repeat_single(self):
+        """
+        Match repetitions can be specifically numbered.
+        """
+        g = self.compile("xs = 'x'{3}:n 'x'* -> n")
+        self.assertEqual(g.xs("xxx"), "xxx")
+        self.assertEqual(g.xs("xxxxxx"), "xxx")
+        self.assertRaises(ParseError, g.xs, "xx")
+
+    def test_repeat_zero(self):
+        """
+        Match repetitions can be specifically numbered.
+        """
+        g = self.compile("xs = 'x'{0}:n 'y' -> n")
+        self.assertEqual(g.xs("y"), "")
+        self.assertRaises(ParseError, g.xs, "xy")
+
+    def test_repeat_zero_n(self):
+        """
+        Match repetitions can be specifically numbered.
+        """
+        g = self.compile("""
+                         xs :n = 'x'{n}:a 'y' -> a
+                         start = xs(0)
+                         """)
+        self.assertEqual(g.start("y"), "")
+        self.assertRaises(ParseError, g.start, "xy")
+
+
+    def test_repeat_var(self):
+        """
+        Match repetitions can be variables.
+        """
+        g = self.compile("xs = (:v -> int(v)):n 'x'{n}:xs 'x'* -> xs")
+        self.assertEqual(g.xs("2xx"), "xx")
+        self.assertEqual(g.xs("4xxxx"), "xxxx")
+        self.assertEqual(g.xs("3xxxxxx"), "xxx")
+        self.assertRaises(ParseError, g.xs, "2x")
+        self.assertRaises(ParseError, g.xs, "1")
+
+
+    def test_sequencing(self):
+        """
+        Input matches can be made on a sequence of patterns.
+        """
+        g = self.compile("twelve = '1' '2'")
+        self.assertEqual(g.twelve("12"), "2");
+        self.assertRaises(ParseError, g.twelve, "1")
+
+
+    def test_alternatives(self):
+        """
+        Input matches can be made on one of a set of alternatives.
+        """
+        g = self.compile("digit = '0' | '1' | '2'")
+        self.assertEqual(g.digit("0"), "0")
+        self.assertEqual(g.digit("1"), "1")
+        self.assertEqual(g.digit("2"), "2")
+        self.assertRaises(ParseError, g.digit, "3")
+
+
+    def test_optional(self):
+        """
+        Subpatterns can be made optional.
+        """
+        g = self.compile("foo = 'x' 'y'? 'z'")
+        self.assertEqual(g.foo("xyz"), 'z')
+        self.assertEqual(g.foo("xz"), 'z')
+
+
+    def test_apply(self):
+        """
+        Other productions can be invoked from within a production.
+        """
+        g = self.compile("""
+              digit = '0' | '1'
+              bits = digit+
+            """)
+        self.assertEqual(g.bits('0110110'), '0110110')
+
+
+    def test_negate(self):
+        """
+        Input can be matched based on its failure to match a pattern.
+        """
+        g = self.compile("foo = ~'0' anything")
+        self.assertEqual(g.foo("1"), "1")
+        self.assertRaises(ParseError, g.foo, "0")
+
+
+    def test_ruleValue(self):
+        """
+        Productions can specify a Python expression that provides the result
+        of the parse.
+        """
+        g = self.compile("foo = '1' -> 7")
+        self.assertEqual(g.foo('1'), 7)
+
+
+    def test_lookahead(self):
+        """
+        Doubled negation does lookahead.
+        """
+        g = self.compile("""
+                         foo = ~~(:x) bar(x)
+                         bar :x = :a :b ?(x == a == b) -> x
+                         """)
+        self.assertEqual(g.foo("11"), '1')
+        self.assertEqual(g.foo("22"), '2')
+
+
+    def test_binding(self):
+        """
+        The result of a parsing expression can be bound to a name.
+        """
+        g = self.compile("foo = '1':x -> int(x) * 2")
+        self.assertEqual(g.foo("1"), 2)
+
+
+    def test_bindingAccess(self):
+        """
+        Bound names in a rule can be accessed on the grammar's "locals" dict.
+        """
+        G = self.classTested.makeGrammar(
+            "stuff = '1':a ('2':b | '3':c)", 'TestGrammar').createParserClass(OMetaBase, {})
+        g = G("12")
+        self.assertEqual(g.apply("stuff")[0], '2')
+        self.assertEqual(g.locals['stuff']['a'], '1')
+        self.assertEqual(g.locals['stuff']['b'], '2')
+        g = G("13")
+        self.assertEqual(g.apply("stuff")[0], '3')
+        self.assertEqual(g.locals['stuff']['a'], '1')
+        self.assertEqual(g.locals['stuff']['c'], '3')
+
+
+    def test_predicate(self):
+        """
+        Python expressions can be used to determine the success or
+        failure of a parse.
+        """
+        g = self.compile("""
+              digit = '0' | '1'
+              double_bits = digit:a digit:b ?(a == b) -> int(b)
+           """)
+        self.assertEqual(g.double_bits("00"), 0)
+        self.assertEqual(g.double_bits("11"), 1)
+        self.assertRaises(ParseError, g.double_bits, "10")
+        self.assertRaises(ParseError, g.double_bits, "01")
+
+
+    def test_parens(self):
+        """
+        Parens can be used to group subpatterns.
+        """
+        g = self.compile("foo = 'a' ('b' | 'c')")
+        self.assertEqual(g.foo("ab"), "b")
+        self.assertEqual(g.foo("ac"), "c")
+
+
+    def test_action(self):
+        """
+        Python expressions can be run as actions with no effect on the
+        result of the parse.
+        """
+        g = self.compile("""foo = ('1'*:ones !(False) !(ones.insert(0, '0')) -> ''.join(ones))""")
+        self.assertEqual(g.foo("111"), "0111")
+
+
+    def test_bindNameOnly(self):
+        """
+        A pattern consisting of only a bind name matches a single element and
+        binds it to that name.
+        """
+        g = self.compile("foo = '1' :x '2' -> x")
+        self.assertEqual(g.foo("132"), "3")
+
+
+    def test_args(self):
+        """
+        Productions can take arguments.
+        """
+        g = self.compile("""
+              digit = ('0' | '1' | '2'):d -> int(d)
+              foo :x = (?(x > 1) '9' | ?(x <= 1) '8'):d -> int(d)
+              baz = digit:a foo(a):b -> [a, b]
+            """)
+        self.assertEqual(g.baz("18"), [1, 8])
+        self.assertEqual(g.baz("08"), [0, 8])
+        self.assertEqual(g.baz("29"), [2, 9])
+        self.assertRaises(ParseError, g.foo, "28")
+
+
+    def test_patternMatch(self):
+        """
+        Productions can pattern-match on arguments.
+        Also, multiple definitions of a rule can be done in sequence.
+        """
+        g = self.compile("""
+              fact 0                    -> 1
+              fact :n = fact((n - 1)):m -> n * m
+           """)
+        self.assertEqual(g.fact([3]), 6)
+
+
+    def test_listpattern(self):
+        """
+        Brackets can be used to match contents of lists.
+        """
+        g = self.compile("""
+             digit  = :x ?(x.isdigit())     -> int(x)
+             interp = [digit:x '+' digit:y] -> x + y
+           """)
+        self.assertEqual(g.interp([['3', '+', '5']]), 8)
+
+    def test_listpatternresult(self):
+        """
+        The result of a list pattern is the entire list.
+        """
+        g = self.compile("""
+             digit  = :x ?(x.isdigit())       -> int(x)
+             interp = [digit:x '+' digit:y]:z -> (z, x + y)
+        """)
+        e = ['3', '+', '5']
+        self.assertEqual(g.interp([e]), (e, 8))
+
+    def test_recursion(self):
+        """
+        Rules can call themselves.
+        """
+        g = self.compile("""
+             interp = (['+' interp:x interp:y] -> x + y
+                       | ['*' interp:x interp:y] -> x * y
+                       | :x ?(isinstance(x, str) and x.isdigit()) -> int(x))
+             """)
+        self.assertEqual(g.interp([['+', '3', ['*', '5', '2']]]), 13)
+
+
+    def test_leftrecursion(self):
+         """
+         Left-recursion is detected and compiled appropriately.
+         """
+         g = self.compile("""
+               num = (num:n digit:d   -> n * 10 + d
+                      | digit)
+               digit = :x ?(x.isdigit()) -> int(x)
+              """)
+         self.assertEqual(g.num("3"), 3)
+         self.assertEqual(g.num("32767"), 32767)
+
+
+    def test_characterVsSequence(self):
+        """
+        Characters (in single-quotes) are not regarded as sequences.
+        """
+        g = self.compile("""
+        interp = ([interp:x '+' interp:y] -> x + y
+                  | [interp:x '*' interp:y] -> x * y
+                  | :x ?(isinstance(x, basestring) and x.isdigit()) -> int(x))
+        """)
+        self.assertEqual(g.interp([['3', '+', ['5', '*', '2']]]), 13)
+        self.assertEqual(g.interp([[u'3', u'+', [u'5', u'*', u'2']]]), 13)
+
+
+    def test_stringConsumedBy(self):
+        """
+        OMeta2's "consumed-by" operator works on strings.
+        """
+        g = self.compile("""
+        ident = <letter (letter | digit)*>
+        """)
+        self.assertEqual(g.ident("a"), "a")
+        self.assertEqual(g.ident("abc"), "abc")
+        self.assertEqual(g.ident("a1z"), "a1z")
+        self.assertRaises(ParseError, g.ident, "1a")
+
+
+    def test_listConsumedBy(self):
+        """
+        OMeta2's "consumed-by" operator works on lists.
+        """
+        g = self.compile("""
+        ands = [<"And" (ors | vals)*>:x] -> x
+        ors = [<"Or" vals*:x>] -> x
+        vals = 1 | 0
+        """)
+        self.assertEqual(g.ands([["And", ["Or", 1, 0], 1]]),
+                         ["And", ["Or", 1, 0], 1])
+
+
+    def test_string(self):
+        """
+        Strings in double quotes match string objects.
+        """
+        g = self.compile("""
+             interp = ["Foo" 1 2] -> 3
+           """)
+        self.assertEqual(g.interp([["Foo", 1, 2]]), 3)
+
+    def test_argEscape(self):
+        """
+        Regression test for bug #239344.
+        """
+        g = self.compile("""
+            memo_arg :arg = anything ?(False)
+            trick = letter memo_arg('c')
+            broken = trick | anything*
+        """)
+        self.assertEqual(g.broken('ab'), 'ab')
+
+
+class TermActionGrammarTests(OMetaTestCase):
+
+    classTested = TermOMeta
+
+    def test_binding(self):
+        """
+        The result of a parsing expression can be bound to a name.
+        """
+        g = self.compile("foo = '1':x -> mul(int(x), 2)",
+                         {"mul": operator.mul})
+        self.assertEqual(g.foo("1"), 2)
+
+
+    def test_bindingAccess(self):
+        """
+        Bound names in a rule can be accessed on the grammar's "locals" dict.
+        """
+        G = self.classTested.makeGrammar(
+            "stuff = '1':a ('2':b | '3':c)", 'TestGrammar').createParserClass(OMetaBase, {})
+        g = G("12")
+        self.assertEqual(g.apply("stuff")[0], '2')
+        self.assertEqual(g.locals['stuff']['a'], '1')
+        self.assertEqual(g.locals['stuff']['b'], '2')
+        g = G("13")
+        self.assertEqual(g.apply("stuff")[0], '3')
+        self.assertEqual(g.locals['stuff']['a'], '1')
+        self.assertEqual(g.locals['stuff']['c'], '3')
+
+
+    def test_predicate(self):
+        """
+        Term actions can be used to determine the success or
+        failure of a parse.
+        """
+        g = self.compile("""
+              digit = '0' | '1'
+              double_bits = digit:a digit:b ?(equal(a, b)) -> int(b)
+           """, {"equal": operator.eq})
+        self.assertEqual(g.double_bits("00"), 0)
+        self.assertEqual(g.double_bits("11"), 1)
+        self.assertRaises(ParseError, g.double_bits, "10")
+        self.assertRaises(ParseError, g.double_bits, "01")
+
+
+    def test_action(self):
+        """
+        Term actions can be run as actions with no effect on the
+        result of the parse.
+        """
+        g = self.compile(
+            """foo = ('1'*:ones !(False)
+                     !(nconc(ones, '0')) -> join(ones))""",
+            {"nconc": lambda lst, val: lst.insert(0, val),
+             "join": ''.join})
+        self.assertEqual(g.foo("111"), "0111")
+
+
+    def test_patternMatch(self):
+        """
+        Productions can pattern-match on arguments.
+        Also, multiple definitions of a rule can be done in sequence.
+        """
+        g = self.compile("""
+              fact 0                    -> 1
+              fact :n = fact(decr(n)):m -> mul(n, m)
+           """, {"mul": operator.mul, "decr": lambda x: x -1})
+        self.assertEqual(g.fact([3]), 6)
+
+
+    def test_listpattern(self):
+        """
+        Brackets can be used to match contents of lists.
+        """
+        g = self.compile("""
+             digit  = :x ?(x.isdigit())     -> int(x)
+             interp = [digit:x '+' digit:y] -> add(x, y)
+           """, {"add": operator.add})
+        self.assertEqual(g.interp([['3', '+', '5']]), 8)
+
+
+    def test_listpatternresult(self):
+        """
+        The result of a list pattern is the entire list.
+        """
+        g = self.compile("""
+             digit  = :x ?(x.isdigit())       -> int(x)
+             interp = [digit:x '+' digit:y]:z -> [z, plus(x, y)]
+        """, {"plus": operator.add})
+        e = ['3', '+', '5']
+        self.assertEqual(g.interp([e]), [e, 8])
+
+
+    def test_recursion(self):
+        """
+        Rules can call themselves.
+        """
+        g = self.compile("""
+             interp = (['+' interp:x interp:y]   -> add(x, y)
+                       | ['*' interp:x interp:y] -> mul(x, y)
+                       | :x ?(isdigit(x)) -> int(x))
+             """, {"mul": operator.mul,
+                   "add": operator.add,
+                   "isdigit": lambda x: str(x).isdigit()})
+        self.assertEqual(g.interp([['+', '3', ['*', '5', '2']]]), 13)
+
+
+    def test_leftrecursion(self):
+         """
+         Left-recursion is detected and compiled appropriately.
+         """
+         g = self.compile("""
+               num = (num:n digit:d   -> makeInt(n, d)
+                      | digit)
+               digit = :x ?(isdigit(x)) -> int(x)
+              """, {"makeInt": lambda x, y: x * 10 + y,
+                    "isdigit": lambda x: x.isdigit()})
+         self.assertEqual(g.num("3"), 3)
+         self.assertEqual(g.num("32767"), 32767)
+
+    def test_characterVsSequence(self):
+        """
+        Characters (in single-quotes) are not regarded as sequences.
+        """
+        g = self.compile(
+            """
+        interp = ([interp:x '+' interp:y] -> add(x, y)
+                  | [interp:x '*' interp:y] -> mul(x, y)
+                  | :x ?(isdigit(x)) -> int(x))
+        """,
+            {"add": operator.add, "mul": operator.mul,
+             "isdigit": lambda x: isinstance(x, basestring) and x.isdigit()})
+
+        self.assertEqual(g.interp([['3', '+', ['5', '*', '2']]]), 13)
+        self.assertEqual(g.interp([[u'3', u'+', [u'5', u'*', u'2']]]), 13)
+
+
+    def test_string(self):
+        """
+        Strings in double quotes match string objects.
+        """
+        g = self.compile("""
+             interp = ["Foo" 1 2] -> 3
+           """)
+        self.assertEqual(g.interp([["Foo", 1, 2]]), 3)
+
+    def test_argEscape(self):
+        """
+        Regression test for bug #239344.
+        """
+        g = self.compile("""
+            memo_arg :arg = anything ?(False)
+            trick = letter memo_arg('c')
+            broken = trick | anything*
+        """)
+        self.assertEqual(g.broken('ab'), 'ab')
+
+
+    def test_lookahead(self):
+        """
+        Doubled negation does lookahead.
+        """
+        g = self.compile("""
+                         foo = ~~(:x) bar(x)
+                         bar :x = :a :b ?(equal(x, a, b)) -> x
+                         """,
+                         {"equal": lambda i, j, k: i == j == k})
+        self.assertEqual(g.foo("11"), '1')
+        self.assertEqual(g.foo("22"), '2')
+
+
+    def test_args(self):
+        """
+        Productions can take arguments.
+        """
+        g = self.compile("""
+              digit = ('0' | '1' | '2'):d -> int(d)
+              foo :x = (?(gt(x, 1)) '9' | ?(lte(x, 1)) '8'):d -> int(d)
+              baz = digit:a foo(a):b -> [a, b]
+            """, {"lte": operator.le, "gt": operator.gt})
+        self.assertEqual(g.baz("18"), [1, 8])
+        self.assertEqual(g.baz("08"), [0, 8])
+        self.assertEqual(g.baz("29"), [2, 9])
+        self.assertRaises(ParseError, g.foo, "28")
+
+
+
+class PyExtractorTest(unittest.TestCase):
+    """
+    Tests for finding Python expressions in OMeta grammars.
+    """
+
+    def findInGrammar(self, expr):
+        """
+        L{OMeta.pythonExpr()} can extract a single Python expression from a
+        string, ignoring the text following it.
+        """
+        o = OMetaGrammarBase(expr + "\nbaz = ...\n")
+        self.assertEqual(o.pythonExpr()[0][0], expr)
+
+
+    def test_expressions(self):
+        """
+        L{OMeta.pythonExpr()} can recognize various paired delimiters properly
+        and include newlines in expressions where appropriate.
+        """
+        self.findInGrammar("x")
+        self.findInGrammar("(x + 1)")
+        self.findInGrammar("{x: (y)}")
+        self.findInGrammar("x, '('")
+        self.findInGrammar('x, "("')
+        self.findInGrammar('x, """("""')
+        self.findInGrammar('(x +\n 1)')
+        self.findInGrammar('[x, "]",\n 1]')
+        self.findInGrammar('{x: "]",\ny: "["}')
+
+        o = OMetaGrammarBase("foo(x[1]])\nbaz = ...\n")
+        self.assertRaises(ParseError, o.pythonExpr)
+        o = OMetaGrammarBase("foo(x[1]\nbaz = ...\n")
+        self.assertRaises(ParseError, o.pythonExpr)
+
+
+class MakeGrammarTest(unittest.TestCase):
+    """
+    Test the definition of grammars via the 'makeGrammar' method.
+    """
+
+
+    def test_makeGrammar(self):
+        results = []
+        grammar = """
+        digit = :x ?('0' <= x <= '9') -> int(x)
+        num = (num:n digit:d !(results.append(True)) -> n * 10 + d
+               | digit)
+        """
+        TestGrammar = OMeta.makeGrammar(grammar, "G").createParserClass(OMetaBase, {'results':results})
+        g = TestGrammar("314159")
+        self.assertEqual(g.apply("num")[0], 314159)
+        self.assertNotEqual(len(results), 0)
+
+
+    def test_brokenGrammar(self):
+        grammar = """
+        andHandler = handler:h1 'and handler:h2 -> And(h1, h2)
+        """
+        e = self.assertRaises(ParseError, OMeta.makeGrammar, grammar,
+                              "Foo")
+        self.assertEquals(e.position, 56)
+        self.assertEquals(e.error, [("expected", None, "\r\n"), ("message", "end of input")])
+
+
+    def test_subclassing(self):
+        """
+        A subclass of an OMeta subclass should be able to call rules on its
+        parent, and access variables in its scope.
+        """
+        grammar1 = """
+        dig = :x ?(a <= x <= b) -> int(x)
+        """
+        TestGrammar1 = OMeta.makeGrammar(grammar1, "G").createParserClass(OMetaBase, {'a':'0', 'b':'9'})
+
+        grammar2 = """
+        num = (num:n dig:d -> n * base + d
+                | dig)
+        """
+        TestGrammar2 = OMeta.makeGrammar(grammar2, "G2").createParserClass(TestGrammar1, {'base':10})
+        g = TestGrammar2("314159")
+        self.assertEqual(g.apply("num")[0], 314159)
+
+        grammar3 = """
+        dig = :x ?(a <= x <= b or c <= x <= d) -> int(x, base)
+        """
+        TestGrammar3 = OMeta.makeGrammar(grammar3, "G3").createParserClass(
+            TestGrammar2, {'c':'a', 'd':'f', 'base':16})
+        g = TestGrammar3("abc123")
+        self.assertEqual(g.apply("num")[0], 11256099)
+
+
+    def test_super(self):
+        """
+        Rules can call the implementation in a superclass.
+        """
+        grammar1 = "expr = letter"
+        TestGrammar1 = OMeta.makeGrammar(grammar1, "G").createParserClass(OMetaBase, {})
+        grammar2 = "expr = super | digit"
+        TestGrammar2 = OMeta.makeGrammar(grammar2, "G2").createParserClass(TestGrammar1, {})
+        self.assertEqual(TestGrammar2("x").apply("expr")[0], "x")
+        self.assertEqual(TestGrammar2("3").apply("expr")[0], "3")
+
+    def test_foreign(self):
+        """
+        Rules can call the implementation in a superclass.
+        """
+        grammar_letter = "expr = letter"
+        GrammarLetter = OMeta.makeGrammar(grammar_letter, "G").createParserClass(OMetaBase, {})
+
+        grammar_digit = "expr '5' = digit"
+        GrammarDigit = OMeta.makeGrammar(grammar_digit, "H").createParserClass(OMetaBase, {})
+
+        grammar = ("expr = !(grammar_digit_global):grammar_digit "
+                        "grammar_letter.expr | grammar_digit.expr('5')")
+        TestGrammar = OMeta.makeGrammar(grammar, "I").createParserClass(
+            OMetaBase,
+            {"grammar_letter": GrammarLetter,
+             "grammar_digit_global": GrammarDigit
+         })
+
+        self.assertEqual(TestGrammar("x").apply("expr")[0], "x")
+        self.assertEqual(TestGrammar("3").apply("expr")[0], "3")
+
+
+class HandyInterpWrapper(object):
+    """
+    Convenient grammar wrapper for parsing strings.
+    """
+    def __init__(self, interp):
+        self._interp = interp
+
+
+    def __getattr__(self, name):
+        """
+        Return a function that will instantiate a grammar and invoke the named
+        rule.
+        @param: Rule name.
+        """
+        def doIt(s):
+            """
+            @param s: The string to be parsed by the wrapped grammar.
+            """
+            # totally cheating
+            tree = not isinstance(s, basestring)
+
+            input, ret, err = self._interp.apply(s, name, tree)
+            try:
+                extra, _ = input.head()
+            except EOFError:
+                try:
+                    return ''.join(ret)
+                except TypeError:
+                    return ret
+            else:
+                raise err
+        return doIt
+
+
+class InterpTestCase(OMetaTestCase):
+
+    def compile(self, grammar, globals=None):
+        """
+        Produce an object capable of parsing via this grammar.
+
+        @param grammar: A string containing an OMeta grammar.
+        """
+        g = OMeta(grammar)
+        tree = g.parseGrammar('TestGrammar')
+        g = GrammarInterpreter(tree, OMetaBase, globals)
+        return HandyInterpWrapper(g)
+
+
+class TrampolinedInterpWrapper(object):
+    """
+    Convenient grammar wrapper for parsing strings.
+    """
+    def __init__(self, tree, globals):
+        self._tree = tree
+        self._globals = globals
+
+
+    def __getattr__(self, name):
+        """
+        Return a function that will instantiate a grammar and invoke the named
+        rule.
+        @param: Rule name.
+        """
+        def doIt(s):
+            """
+            @param s: The string to be parsed by the wrapped grammar.
+            """
+            tree = not isinstance(s, basestring)
+            if tree:
+                raise unittest.SkipTest("Not applicable for push parsing")
+            results = []
+            def whenDone(val, err):
+                results.append(val)
+            parser = TrampolinedGrammarInterpreter(self._tree, name, whenDone,
+                                                   self._globals)
+            for i, c in enumerate(s):
+                assert len(results) == 0
+                parser.receive(c)
+            parser.end()
+            if results and parser.input.position == len(parser.input.data):
+                try:
+                    return ''.join(results[0])
+                except TypeError:
+                    return results[0]
+            else:
+                raise parser.currentError
+        return doIt
+
+
+
+class TrampolinedInterpreterTestCase(OMetaTestCase):
+
+    def compile(self, grammar, globals=None):
+        g = OMeta(grammar)
+        tree = g.parseGrammar('TestGrammar')
+        return TrampolinedInterpWrapper(tree, globals)
+
+
+    def test_failure(self):
+        g = OMeta("""
+           foo = 'a':one baz:two 'd'+ 'e' -> (one, two)
+           baz = 'b' | 'c'
+           """, {})
+        tree = g.parseGrammar('TestGrammar')
+        i = TrampolinedGrammarInterpreter(
+            tree, 'foo', callback=lambda x: setattr(self, 'result', x))
+        e = self.assertRaises(ParseError, i.receive, 'foobar')
+        self.assertEqual(str(e),
+        "\nfoobar\n^\nParse error at line 2, column 0:"
+        " expected the character 'a'. trail: []\n")
+
+
+    def test_stringConsumedBy(self):
+        called = []
+        grammarSource = "rule = <'x'+>:y -> y"
+        grammar = OMeta(grammarSource).parseGrammar("Parser")
+        def interp(result, error):
+            called.append(result)
+        trampoline = TrampolinedGrammarInterpreter(grammar, "rule", interp)
+        trampoline.receive("xxxxx")
+        trampoline.end()
+        self.assertEqual(called, ["xxxxx"])
+
+
+
+class TreeTransformerTestCase(unittest.TestCase):
+
+    def compile(self, grammar, namespace=None):
+        """
+        Produce an object capable of parsing via this grammar.
+
+        @param grammar: A string containing an OMeta grammar.
+        """
+        if namespace is None:
+            namespace = globals()
+        g = TreeTransformerGrammar.makeGrammar(
+            dedent(grammar), 'TestGrammar').createParserClass(
+                TreeTransformerBase, namespace)
+        return g
+
+    def test_termForm(self):
+        g = self.compile("Foo(:left :right) -> left.data + right.data")
+        self.assertEqual(g.transform(term("Foo(1, 2)"))[0], 3)
+
+    def test_termFormNest(self):
+        g = self.compile("Foo(:left Baz(:right)) -> left.data + right.data")
+        self.assertEqual(g.transform(term("Foo(1, Baz(2))"))[0], 3)
+
+    def test_listForm(self):
+        g = self.compile("Foo(:left [:first :second]) -> left.data + first.data + second.data")
+        self.assertEqual(g.transform(term("Foo(1, [2, 3])"))[0], 6)
+
+    def test_emptyList(self):
+        g = self.compile("Foo([]) -> 6")
+        self.assertEqual(g.transform(term("Foo([])"))[0], 6)
+
+    def test_emptyArgs(self):
+        g = self.compile("Foo() -> 6")
+        self.assertEqual(g.transform(term("Foo()"))[0], 6)
+
+    def test_emptyArgsMeansEmpty(self):
+        g = self.compile("""
+                         Foo() -> 6
+                         Foo(:x) -> x
+                         """)
+        self.assertEqual(g.transform(term("Foo(3)"))[0].data, 3)
+
+    def test_subTransform(self):
+        g = self.compile("""
+                         Foo(:left @right) -> left.data + right
+                         Baz(:front :back) -> front.data * back.data
+                         """)
+        self.assertEqual(g.transform(term("Foo(1, Baz(2, 3))"))[0], 7)
+
+    def test_defaultExpand(self):
+        g = self.compile("""
+                         Foo(:left @right) -> left.data + right
+                         Baz(:front :back) -> front.data * back.data
+                         """)
+        self.assertEqual(g.transform(term("Blee(Foo(1, 2), Baz(2, 3))"))[0],
+                         term("Blee(3, 6)"))
+
+    def test_wide_template(self):
+        g = self.compile(
+            """
+            Pair(@left @right) --> $left, $right
+            Name(@n) = ?(n == "a") --> foo
+                     |             --> baz
+            """)
+        self.assertEqual(g.transform(term('Pair(Name("a"), Name("b"))'))[0],
+                         "foo, baz")
+
+    def test_tall_template(self):
+        g = self.compile(
+            """
+            Name(@n) = ?(n == "a") --> foo
+                     |             --> baz
+            Pair(@left @right) {{{
+            $left
+            also, $right
+            }}}
+            """)
+        self.assertEqual(g.transform(term('Pair(Name("a"), Name("b"))'))[0],
+                         "foo\nalso, baz")
+
+    def test_tall_template_suite(self):
+        g = self.compile(
+            """
+            Name(@n) -> n
+            If(@test @suite) {{{
+            if $test:
+              $suite
+            }}}
+            """)
+        self.assertEqual(g.transform(term('If(Name("a"), [Name("foo"), Name("baz")])'))[0],
+                         "if a:\n  foo\n  baz")
+
+    def test_foreign(self):
+        """
+        Rules can call the implementation in a superclass.
+        """
+        grammar_letter = "expr = letter"
+        GrammarLetter = self.compile(grammar_letter, {})
+
+        grammar_digit = "expr '5' = digit"
+        GrammarDigit = self.compile(grammar_digit, {})
+
+        grammar = ("expr = !(grammar_digit_global):grammar_digit "
+                   "GrammarLetter.expr | grammar_digit.expr('5')")
+        TestGrammar = self.compile(grammar, {
+            "GrammarLetter": GrammarLetter,
+            "grammar_digit_global": GrammarDigit
+        })
+
+        self.assertEqual(TestGrammar("x").apply("expr")[0], "x")
+        self.assertEqual(TestGrammar("3").apply("expr")[0], "3")
+
+
+
+class ErrorReportingTests(unittest.TestCase):
+
+
+    def compile(self, grammar):
+        """
+        Produce an object capable of parsing via this grammar.
+
+        @param grammar: A string containing an OMeta grammar.
+        """
+        g = OMeta.makeGrammar(grammar, 'TestGrammar').createParserClass(OMetaBase, {})
+        return HandyWrapper(g)
+
+
+    def test_rawReporting(self):
+        """
+        Errors from parsing contain enough info to figure out what was
+        expected and where.
+        """
+        g = self.compile("""
+
+        start = ( (person feeling target)
+                  | (adjective animal feeling token("some") target))
+        adjective = token("crazy") | token("clever") | token("awesome")
+        feeling = token("likes") | token("loves") | token("hates")
+        animal = token("monkey") | token("horse") | token("unicorn")
+        person = token("crazy horse") | token("hacker")
+        target = (token("bananas") | token("robots") | token("americans")
+                   | token("bacon"))
+        """)
+
+        #some warmup
+        g.start("clever monkey hates some robots")
+        g.start("awesome unicorn loves some bacon")
+        g.start("crazy horse hates americans")
+        g.start("hacker likes robots")
+
+        e = self.assertRaises(ParseError, g.start,
+                              "clever hacker likes bacon")
+        self.assertEqual(e.position, 8)
+        self.assertEqual(e.error, [('expected', "token", "horse")])
+
+        e = self.assertRaises(ParseError, g.start,
+                              "crazy horse likes some grass")
+
+        #matching "some" means second branch of 'start' is taken
+        self.assertEqual(e.position, 23)
+        self.assertEqual(e.error, [('expected', "token", "bananas"),
+                                   ('expected', 'token', "bacon"),
+                                   ('expected', "token", "robots"),
+                                   ('expected', "token", "americans")])
+
+        e = self.assertRaises(ParseError, g.start,
+                              "crazy horse likes mountains")
+
+        #no "some" means first branch of 'start' is taken...
+        #but second is also viable
+        self.assertEqual(e.position, 18)
+        self.assertEqual(e.error, [('expected', "token", "some"),
+                                   ('expected', "token", "bananas"),
+                                   ('expected', 'token', "bacon"),
+                                   ('expected', "token", "robots"),
+                                   ('expected', "token", "americans")])
+
+
+    def test_formattedReporting(self):
+        """
+        Parse errors can be formatted into a nice human-readable view
+        containing the erroneous input and possible fixes.
+        """
+        g = self.compile("""
+        dig = '1' | '2' | '3'
+        bits = <dig>+
+        """)
+
+        input = "123x321"
+        e = self.assertRaises(ParseError, g.bits, input)
+        self.assertEqual(e.formatError(),
+                         dedent("""
+                         123x321
+                            ^
+                         Parse error at line 1, column 3: expected one of '1', '2', or '3'. trail: [dig]
+                         """))
+        input = "foo\nbaz\nboz\ncharlie\nbuz"
+        e = ParseError(input, 12, expected('token', 'foo') + expected(None, 'b'))
+        self.assertEqual(e.formatError(),
+                         dedent("""
+                         charlie
+                         ^
+                         Parse error at line 4, column 0: expected one of 'b', or token 'foo'. trail: []
+                         """))
+
+        input = '123x321'
+        e = ParseError(input, 3, expected('digit'))
+        self.assertEqual(e.formatError(),
+                         dedent("""
+                         123x321
+                            ^
+                         Parse error at line 1, column 3: expected a digit. trail: []
+                         """))
diff --git a/lib/Parsley-1.1/ometa/test/test_runtime.py b/lib/Parsley-1.1/ometa/test/test_runtime.py
new file mode 100644
index 0000000..76b739b
--- /dev/null
+++ b/lib/Parsley-1.1/ometa/test/test_runtime.py
@@ -0,0 +1,284 @@
+import unittest
+from ometa.runtime import OMetaBase, ParseError, expected, eof
+
+class RuntimeTests(unittest.TestCase):
+    """
+    Tests for L{pymeta.runtime}.
+    """
+
+    def test_anything(self):
+        """
+        L{OMetaBase.rule_anything} returns each item from the input
+        along with its position.
+        """
+
+        data = "foo"
+        o = OMetaBase(data)
+
+        for i, c in enumerate(data):
+            v, e = o.rule_anything()
+            self.assertEqual((c, i), (v, e[0]))
+
+
+    def test_exactly(self):
+        """
+        L{OMetaBase.rule_exactly} returns the requested item from the input
+        string along with its position, if it's there.
+        """
+
+        data = "foo"
+        o = OMetaBase(data)
+        v, e = o.rule_exactly("f")
+        self.assertEqual(v, "f")
+        self.assertEqual(e[0], 0)
+
+    def test_exactly_multi(self):
+        """
+        L{OMetaBase.rule_exactly} returns the requested item from the input
+        string along with its position, if it's there.
+        """
+
+        data = "foo"
+        o = OMetaBase(data)
+        v, e = o.rule_exactly("fo")
+        self.assertEqual(v, "fo")
+        self.assertEqual(e[0], 0)
+
+    def test_exactlyFail(self):
+        """
+        L{OMetaBase.rule_exactly} raises L{ParseError} when the requested item
+        doesn't match the input. The error contains info on what was expected
+        and the position.
+        """
+
+        data = "foo"
+        o = OMetaBase(data)
+        with self.assertRaises(ParseError) as e:
+            o.rule_exactly("g")
+        self.assertEquals(e.exception[1], expected(None, "g"))
+        self.assertEquals(e.exception[0], 0)
+
+
+
+    def test_token(self):
+        """
+        L{OMetaBase.rule_token} matches all the characters in the given string
+        plus any preceding whitespace.
+        """
+
+        data = "  foo bar"
+        o = OMetaBase(data)
+        v, e = o.rule_token("foo")
+        self.assertEqual(v, "foo")
+        self.assertEqual(e[0], 4)
+        v, e = o.rule_token("bar")
+        self.assertEqual(v, "bar")
+        self.assertEqual(e[0], 8)
+
+
+    def test_tokenFailed(self):
+        """
+        On failure, L{OMetaBase.rule_token} produces an error indicating the
+        position where match failure occurred and the expected character.
+        """
+        data = "foozle"
+        o = OMetaBase(data)
+        with self.assertRaises(ParseError) as e:
+            o.rule_token("fog")
+        self.assertEqual(e.exception[0], 2)
+        self.assertEqual(e.exception[1], expected("token", "fog"))
+
+
+    def test_many(self):
+        """
+        L{OMetaBase.many} returns a list of parsed values and the error that
+        caused the end of the loop.
+        """
+
+        data = "ooops"
+        o  = OMetaBase(data)
+        self.assertEqual(o.many(lambda: o.rule_exactly('o')),
+                         (['o'] * 3, ParseError(o.input, 3,
+                                                expected(None, 'o'))))
+
+
+    def test_or(self):
+        """
+        L{OMetaBase._or} returns the result of the first of its
+        arguments to succeed.
+        """
+
+        data = "a"
+
+        o = OMetaBase(data)
+        called = [False, False, False]
+        targets = ['b', 'a', 'c']
+        matchers = []
+        for i, m in enumerate(targets):
+            def match(i=i, m=m):
+                called[i] = True
+                return o.exactly(m)
+            matchers.append(match)
+
+        v, e = o._or(matchers)
+        self.assertEqual(called, [True, True, False])
+        self.assertEqual(v, 'a')
+        self.assertEqual(e[0], 0)
+
+
+    def test_orSimpleFailure(self):
+        """
+        When none of the alternatives passed to L{OMetaBase._or} succeed, the
+        one that got the furthest is returned.
+        """
+
+        data = "foozle"
+        o = OMetaBase(data)
+
+        with self.assertRaises(ParseError) as e:
+            o._or([lambda: o.token("fog"),
+                   lambda: o.token("foozik"),
+                   lambda: o.token("woozle")])
+        self.assertEqual(e.exception[0], 4)
+        self.assertEqual(e.exception[1], expected("token",  "foozik"))
+
+
+    def test_orFalseSuccess(self):
+        """
+        When a failing branch of L{OMetaBase._or} gets further than a
+        succeeding one, its error is returned instead of the success branch's.
+        """
+
+        data = "foozle"
+        o = OMetaBase(data)
+
+        v, e = o._or( [lambda: o.token("fog"),
+                               lambda: o.token("foozik"),
+                               lambda: o.token("f")])
+        self.assertEqual(e[0], 4)
+        self.assertEqual(e[1], expected("token", "foozik"))
+
+    def test_orErrorTie(self):
+        """
+        When branches of L{OMetaBase._or} produce errors that tie for rightmost
+        position, they are merged.
+        """
+
+        data = "foozle"
+        o = OMetaBase(data)
+
+        v, e = o._or( [lambda: o.token("fog"),
+                               lambda: o.token("foz"),
+                               lambda: o.token("f")])
+        self.assertEqual(e[0], 2)
+        self.assertEqual(e[1], [expected("token", "fog")[0],
+                                expected("token", "foz")[0]])
+
+
+    def test_notError(self):
+        """
+        When L{OMetaBase._not} fails, its error contains the current
+        input position and no error info.
+        """
+
+        data = "xy"
+        o = OMetaBase(data)
+        with self.assertRaises(ParseError) as e:
+            o._not(lambda: o.exactly("x"))
+        self.assertEqual(e.exception[0], 1)
+        self.assertEqual(e.exception[1], None)
+
+
+    def test_spaces(self):
+        """
+        L{OMetaBase.rule_spaces} provides error information.
+        """
+
+        data = "  xyz"
+        o = OMetaBase(data)
+        v, e = o.rule_spaces()
+
+        self.assertEqual(e[0], 2)
+
+    def test_predSuccess(self):
+        """
+        L{OMetaBase.pred} returns True and empty error info on success.
+        """
+
+        o = OMetaBase("")
+        v, e = o.pred(lambda: (True, ParseError(o.input, 0, None)))
+        self.assertEqual((v, e), (True, ParseError(o.input, 0, None)))
+
+
+    def test_predFailure(self):
+        """
+        L{OMetaBase.pred} returns True and empty error info on success.
+        """
+
+        o = OMetaBase("")
+        with self.assertRaises(ParseError) as e:
+            o.pred(lambda: (False, ParseError(o.input, 0, None)))
+        self.assertEqual(e.exception, ParseError(o.input, 0, None))
+
+
+    def test_end(self):
+        """
+        L{OMetaBase.rule_end} matches the end of input and raises L{ParseError}
+        if input is left.
+        """
+        o = OMetaBase("abc")
+        with self.assertRaises(ParseError) as e:
+            o.rule_end()
+        self.assertEqual(e.exception, ParseError(o.input, 1, None))
+        o.many(o.rule_anything)
+        self.assertEqual(o.rule_end(), (True, ParseError("abc", 3, None)))
+
+
+    def test_letter(self):
+        """
+        L{OMetaBase.rule_letter} matches letters.
+        """
+        o = OMetaBase("a1")
+        v, e = o.rule_letter()
+        self.assertEqual((v, e), ("a", ParseError(o.input, 0, None)))
+        with self.assertRaises(ParseError) as e:
+            o.rule_letter()
+        self.assertEqual(e.exception, ParseError(o.input, 1,
+                                                 expected("letter")))
+
+
+    def test_letterOrDigit(self):
+        """
+        L{OMetaBase.rule_letterOrDigit} matches alphanumerics.
+        """
+        o = OMetaBase("a1@")
+        v, e = o.rule_letterOrDigit()
+        self.assertEqual((v, e), ("a", ParseError(None, 0, None)))
+        v, e = o.rule_letterOrDigit()
+        self.assertEqual((v, e), ("1", ParseError(None, 1, None)))
+        with self.assertRaises(ParseError) as e:
+            o.rule_letterOrDigit()
+        self.assertEqual(e.exception,
+                         ParseError(o.input, 2, expected("letter or digit")))
+
+
+    def test_digit(self):
+        """
+        L{OMetaBase.rule_digit} matches digits.
+        """
+        o = OMetaBase("1a")
+        v, e = o.rule_digit()
+        self.assertEqual((v, e), ("1", ParseError("1a", 0, None)))
+        with self.assertRaises(ParseError) as e:
+            o.rule_digit()
+        self.assertEqual(e.exception, ParseError(o.input, 1, expected("digit")))
+
+
+
+    def test_listpattern(self):
+        """
+        L{OMetaBase.rule_listpattern} matches contents of lists.
+        """
+        o = OMetaBase([["a"]], tree=True)
+        v, e = o.listpattern(lambda: o.exactly("a"))
+        self.assertEqual((v, e), (["a"], ParseError("a", 0, None)))
diff --git a/lib/Parsley-1.1/parsley.py b/lib/Parsley-1.1/parsley.py
new file mode 100644
index 0000000..2bbd8be
--- /dev/null
+++ b/lib/Parsley-1.1/parsley.py
@@ -0,0 +1,86 @@
+from ometa.grammar import OMeta
+from ometa.runtime import ParseError, EOFError, OMetaBase
+from terml.parser import parseTerm as term
+from terml.nodes import termMaker
+from terml.quasiterm import quasiterm
+
+__version__ = '1.1'
+
+
+def wrapGrammar(g):
+    def makeParser(input):
+        """
+        Creates a parser for the given input, with methods for
+        invoking each rule.
+
+        :param input: The string you want to parse.
+        """
+        return _GrammarWrapper(g(input), input)
+    makeParser._grammarClass = g
+    return makeParser
+
+
+def makeGrammar(source, bindings, name='Grammar', unwrap=False,
+                extends=wrapGrammar(OMetaBase)):
+    """
+    Create a class from a Parsley grammar.
+
+    :param source: A grammar, as a string.
+    :param bindings: A mapping of variable names to objects.
+    :param name: Name used for the generated class.
+
+    :param unwrap: If True, return a parser class suitable for
+                   subclassing. If False, return a wrapper with the
+                   friendly API.
+    :param extends: The superclass for the generated parser class.
+    """
+    g = OMeta.makeGrammar(source, name).createParserClass(
+        unwrapGrammar(extends), bindings)
+    if unwrap:
+        return g
+    else:
+        return wrapGrammar(g)
+
+def unwrapGrammar(w):
+    """
+    Access the internal parser class for a Parsley grammar object.
+    """
+    return getattr(w, '_grammarClass', None) or w
+
+class _GrammarWrapper(object):
+    """
+    A wrapper for Parsley grammar instances.
+
+    To invoke a Parsley rule, invoke a method with that name -- this
+    turns x(input).foo() calls into grammar.apply("foo") calls.
+    """
+    def __init__(self, grammar, input):
+        self._grammar = grammar
+        self._input = input
+        #so pydoc doesn't get trapped in the __getattr__
+        self.__name__ = _GrammarWrapper.__name__
+
+    def __getattr__(self, name):
+        """
+        Return a function that will instantiate a grammar and invoke the named
+        rule.
+        :param name: Rule name.
+        """
+        def invokeRule(*args, **kwargs):
+            """
+            Invoke a Parsley rule. Passes any positional args to the rule.
+            """
+            try:
+                ret, err = self._grammar.apply(name, *args)
+            except ParseError, e:
+                self._grammar.considerError(e)
+                err = self._grammar.currentError
+            else:
+                try:
+                    extra, _ = self._grammar.input.head()
+                except EOFError:
+                    return ret
+            raise err
+        return invokeRule
+
+__all__ = ['makeGrammar', 'wrapGrammar', 'unwrapGrammar', 'term', 'quasiterm']
diff --git a/lib/Parsley-1.1/setup.py b/lib/Parsley-1.1/setup.py
new file mode 100644
index 0000000..24ba042
--- /dev/null
+++ b/lib/Parsley-1.1/setup.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+"""
+Setup script for the Parsley distribution.
+"""
+
+from distutils.core import setup
+setup(
+    name="Parsley",
+    version="1.1",
+    url="http://launchpad.net/parsley",
+    description="Parsing and pattern matching made easy.",
+    author="Allen Short",
+    author_email="washort42 at gmail.com",
+    license="MIT License",
+    long_description=open("README").read(),
+    packages=["ometa", "terml", "ometa._generated", "terml._generated",
+              "ometa.test", "terml.test"],
+    py_modules=["parsley"]
+)
diff --git a/lib/Parsley-1.1/terml/README.txt b/lib/Parsley-1.1/terml/README.txt
new file mode 100644
index 0000000..664decf
--- /dev/null
+++ b/lib/Parsley-1.1/terml/README.txt
@@ -0,0 +1,63 @@
+TermL is JSON's big brother.
+It's described here: http://www.erights.org/data/terml/terml-spec.html
+
+In addition to JSON's dict, list, string, and number types, TermL
+supports arbitrary identifiers as tags, with optional parenthesized
+arguments. It's a nice representation for ASTs and the like, where you
+have a tree of things with a relatively small set of names.
+
+To use this code, do something like this:
+
+>>> from terml.parser import parseTerm
+>>> parseTerm('[foo(x), 3, FancyObject("bits", "bobs")]')
+Term('[foo(x), 3, FancyObject("bits", "bobs")]')
+
+>>> t = parseTerm('[foo(x), 3, FancyObject("bits", "bobs")]')
+
+>>> t.arglist
+[Term('foo(x)'), Term('3'), Term('FancyObject("bits", "bobs")')]
+
+>>> t.functor
+Tag('.tuple.')
+
+>>> t.arglist[0]
+Term('foo(x)')
+
+>>> t.arglist[0].functor
+Tag('foo')
+
+
+>>> t2 = parseTerm('{foo: 1, "foo": 11, f(o(o, 1): 1}')
+
+{foo: 1, "foo": 11, f(o(o, 1): 1}
+                     ^
+Parse error at line 1, column 21: expected the token '}'
+
+Traceback (most recent call last):
+  File "<stdin>", line 1, in <module>
+  File "terml/parser.py", line 202, in parseTerm
+    return _parseTerm(termString)
+  File "terml/parser.py", line 186, in _parseTerm
+    result, error = p.apply("term")
+  File "/Users/washort/Projects/PyMeta/trunk/pymeta/runtime.py", line 278, in apply
+    return self._apply(r, ruleName, args)
+  File "/Users/washort/Projects/PyMeta/trunk/pymeta/runtime.py", line 307, in _apply
+    [rule(), self.input])
+  File "/pymeta_generated_code/pymeta_grammar__TermLParser.py", line 483, in rule_term
+  File "/Users/washort/Projects/PyMeta/trunk/pymeta/runtime.py", line 397, in _or
+    raise joinErrors(errors)
+pymeta.runtime.ParseError: (21, [('expected', 'token', "'}'")])
+
+>>> terml.parser.parseTerm("foo(())")
+
+foo(())
+    ^
+Parse error at line 1, column 4: expected one of ')', token '[', token '"', token "'", '0', a digit, a letter, '_', '$', '.', '<', ':', token '${', token '$', token '@{', token '@', token '{', '-', ' ', '\t', '\x0c', or '#'
+
+Traceback (most recent call last):
+  File "<stdin>", line 1, in <module>
+  File "terml/parser.py", line 202, in parseTerm
+    return _parseTerm(termString)
+  File "terml/parser.py", line 192, in _parseTerm
+    raise error
+pymeta.runtime.ParseError: (4, [('expected', None, ')'), ('expected', 'token', '['), ('expected', 'token', '"'), ('expected', 'token', "'"), ('expected', None, '0'), ('expected', 'digit', None), ('expected', 'letter', None), ('expected', None, '_'), ('expected', None, '$'), ('expected', None, '.'), ('expected', None, '<'), ('expected', None, ':'), ('expected', 'token', '${'), ('expected', 'token', '$'), ('expected', 'token', '@{'), ('expected', 'token', '@'), ('expected', 'token', '{'),  [...]
diff --git a/lib/Parsley-1.1/terml/__init__.py b/lib/Parsley-1.1/terml/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Parsley-1.1/terml/_generated/__init__.py b/lib/Parsley-1.1/terml/_generated/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Parsley-1.1/terml/_generated/quasiterm.py b/lib/Parsley-1.1/terml/_generated/quasiterm.py
new file mode 100644
index 0000000..c2b4d9f
--- /dev/null
+++ b/lib/Parsley-1.1/terml/_generated/quasiterm.py
@@ -0,0 +1,417 @@
+def createParserClass(GrammarBase, ruleGlobals):
+    if ruleGlobals is None:
+        ruleGlobals = {}
+    class quasiterm(GrammarBase):
+        def rule_schema(self):
+            _locals = {'self': self}
+            self.locals['schema'] = _locals
+            def _G_many1_1():
+                _G_apply_2, lastError = self._apply(self.rule_production, "production", [])
+                self.considerError(lastError, None)
+                return (_G_apply_2, self.currentError)
+            _G_many1_3, lastError = self.many(_G_many1_1, _G_many1_1())
+            self.considerError(lastError, 'schema')
+            _locals['ps'] = _G_many1_3
+            _G_python_4, lastError = eval('schema(ps)', self.globals, _locals), None
+            self.considerError(lastError, 'schema')
+            return (_G_python_4, self.currentError)
+
+
+        def rule_production(self):
+            _locals = {'self': self}
+            self.locals['production'] = _locals
+            _G_apply_5, lastError = self._apply(self.rule_tag, "tag", [])
+            self.considerError(lastError, 'production')
+            _locals['t'] = _G_apply_5
+            _G_apply_6, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'production')
+            _G_exactly_7, lastError = self.exactly('::=')
+            self.considerError(lastError, 'production')
+            _G_apply_8, lastError = self._apply(self.rule_argList, "argList", [])
+            self.considerError(lastError, 'production')
+            _locals['a'] = _G_apply_8
+            _G_apply_9, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'production')
+            _G_exactly_10, lastError = self.exactly(';')
+            self.considerError(lastError, 'production')
+            _G_python_11, lastError = eval('production(t, a)', self.globals, _locals), None
+            self.considerError(lastError, 'production')
+            return (_G_python_11, self.currentError)
+
+
+        def rule_functor(self):
+            _locals = {'self': self}
+            self.locals['functor'] = _locals
+            def _G_or_12():
+                _G_apply_13, lastError = self._apply(self.rule_spaces, "spaces", [])
+                self.considerError(lastError, None)
+                def _G_or_14():
+                    _G_apply_15, lastError = self._apply(self.rule_functorHole, "functorHole", [])
+                    self.considerError(lastError, None)
+                    _G_apply_16, lastError = self._apply(self.rule_functorHole, "functorHole", [])
+                    self.considerError(lastError, None)
+                    _G_python_17, lastError = eval('reserved("hole-tagged-hole")', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_17, self.currentError)
+                def _G_or_18():
+                    def _G_optional_19():
+                        _G_exactly_20, lastError = self.exactly('.')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_20, self.currentError)
+                    def _G_optional_21():
+                        return (None, self.input.nullError())
+                    _G_or_22, lastError = self._or([_G_optional_19, _G_optional_21])
+                    self.considerError(lastError, None)
+                    _G_apply_23, lastError = self._apply(self.rule_functorHole, "functorHole", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_23, self.currentError)
+                def _G_or_24():
+                    _G_apply_25, lastError = self._apply(self.rule_tag, "tag", [])
+                    self.considerError(lastError, None)
+                    _locals['t'] = _G_apply_25
+                    _G_apply_26, lastError = self._apply(self.rule_functorHole, "functorHole", [])
+                    self.considerError(lastError, None)
+                    _locals['h'] = _G_apply_26
+                    _G_python_27, lastError = eval('taggedHole(t, h)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_27, self.currentError)
+                _G_or_28, lastError = self._or([_G_or_14, _G_or_18, _G_or_24])
+                self.considerError(lastError, None)
+                return (_G_or_28, self.currentError)
+            def _G_or_29():
+                _G_apply_30, lastError = self.superApply("functor", )
+                self.considerError(lastError, None)
+                return (_G_apply_30, self.currentError)
+            _G_or_31, lastError = self._or([_G_or_12, _G_or_29])
+            self.considerError(lastError, 'functor')
+            return (_G_or_31, self.currentError)
+
+
+        def rule_arg(self):
+            _locals = {'self': self}
+            self.locals['arg'] = _locals
+            _G_apply_32, lastError = self._apply(self.rule_interleave, "interleave", [])
+            self.considerError(lastError, 'arg')
+            _locals['l'] = _G_apply_32
+            def _G_many_33():
+                _G_apply_34, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_35, lastError = self.exactly('|')
+                self.considerError(lastError, None)
+                _G_apply_36, lastError = self._apply(self.rule_interleave, "interleave", [])
+                self.considerError(lastError, None)
+                return (_G_apply_36, self.currentError)
+            _G_many_37, lastError = self.many(_G_many_33)
+            self.considerError(lastError, 'arg')
+            _locals['r'] = _G_many_37
+            _G_python_38, lastError = eval('_or(l, *r)', self.globals, _locals), None
+            self.considerError(lastError, 'arg')
+            return (_G_python_38, self.currentError)
+
+
+        def rule_interleave(self):
+            _locals = {'self': self}
+            self.locals['interleave'] = _locals
+            _G_apply_39, lastError = self._apply(self.rule_action, "action", [])
+            self.considerError(lastError, 'interleave')
+            _locals['l'] = _G_apply_39
+            def _G_many_40():
+                _G_apply_41, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_42, lastError = self.exactly('&')
+                self.considerError(lastError, None)
+                _G_apply_43, lastError = self._apply(self.rule_action, "action", [])
+                self.considerError(lastError, None)
+                return (_G_apply_43, self.currentError)
+            _G_many_44, lastError = self.many(_G_many_40)
+            self.considerError(lastError, 'interleave')
+            _locals['r'] = _G_many_44
+            _G_python_45, lastError = eval('interleave(l, *r)', self.globals, _locals), None
+            self.considerError(lastError, 'interleave')
+            return (_G_python_45, self.currentError)
+
+
+        def rule_action(self):
+            _locals = {'self': self}
+            self.locals['action'] = _locals
+            _G_apply_46, lastError = self._apply(self.rule_pred, "pred", [])
+            self.considerError(lastError, 'action')
+            _locals['l'] = _G_apply_46
+            def _G_or_47():
+                _G_apply_48, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_49, lastError = self.exactly('->')
+                self.considerError(lastError, None)
+                _G_apply_50, lastError = self._apply(self.rule_pred, "pred", [])
+                self.considerError(lastError, None)
+                _locals['r'] = _G_apply_50
+                _G_python_51, lastError = eval('action(l, *r)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_51, self.currentError)
+            def _G_or_52():
+                _G_python_53, lastError = eval('l', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_53, self.currentError)
+            _G_or_54, lastError = self._or([_G_or_47, _G_or_52])
+            self.considerError(lastError, 'action')
+            return (_G_or_54, self.currentError)
+
+
+        def rule_pred(self):
+            _locals = {'self': self}
+            self.locals['pred'] = _locals
+            def _G_or_55():
+                _G_apply_56, lastError = self._apply(self.rule_some, "some", [])
+                self.considerError(lastError, None)
+                return (_G_apply_56, self.currentError)
+            def _G_or_57():
+                _G_apply_58, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_59, lastError = self.exactly('!')
+                self.considerError(lastError, None)
+                _G_apply_60, lastError = self._apply(self.rule_some, "some", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_60
+                _G_python_61, lastError = eval('not(x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_61, self.currentError)
+            _G_or_62, lastError = self._or([_G_or_55, _G_or_57])
+            self.considerError(lastError, 'pred')
+            return (_G_or_62, self.currentError)
+
+
+        def rule_some(self):
+            _locals = {'self': self}
+            self.locals['some'] = _locals
+            def _G_or_63():
+                _G_apply_64, lastError = self._apply(self.rule_quant, "quant", [])
+                self.considerError(lastError, None)
+                _locals['q'] = _G_apply_64
+                _G_python_65, lastError = eval('some(None, q)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_65, self.currentError)
+            def _G_or_66():
+                _G_apply_67, lastError = self._apply(self.rule_prim, "prim", [])
+                self.considerError(lastError, None)
+                _locals['l'] = _G_apply_67
+                def _G_optional_68():
+                    def _G_or_69():
+                        _G_apply_70, lastError = self._apply(self.rule_ws, "ws", [])
+                        self.considerError(lastError, None)
+                        _G_exactly_71, lastError = self.exactly('**')
+                        self.considerError(lastError, None)
+                        _G_apply_72, lastError = self._apply(self.rule_prim, "prim", [])
+                        self.considerError(lastError, None)
+                        _locals['r'] = _G_apply_72
+                        _G_python_73, lastError = eval('matchSeparatedSequence(l, r)', self.globals, _locals), None
+                        self.considerError(lastError, None)
+                        return (_G_python_73, self.currentError)
+                    def _G_or_74():
+                        _G_apply_75, lastError = self._apply(self.rule_ws, "ws", [])
+                        self.considerError(lastError, None)
+                        _G_exactly_76, lastError = self.exactly('++')
+                        self.considerError(lastError, None)
+                        _G_apply_77, lastError = self._apply(self.rule_prim, "prim", [])
+                        self.considerError(lastError, None)
+                        _locals['r'] = _G_apply_77
+                        _G_python_78, lastError = eval('matchSeparatedSequence1(l, r)', self.globals, _locals), None
+                        self.considerError(lastError, None)
+                        return (_G_python_78, self.currentError)
+                    _G_or_79, lastError = self._or([_G_or_69, _G_or_74])
+                    self.considerError(lastError, None)
+                    return (_G_or_79, self.currentError)
+                def _G_optional_80():
+                    return (None, self.input.nullError())
+                _G_or_81, lastError = self._or([_G_optional_68, _G_optional_80])
+                self.considerError(lastError, None)
+                _locals['seq'] = _G_or_81
+                def _G_optional_82():
+                    _G_apply_83, lastError = self._apply(self.rule_quant, "quant", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_83, self.currentError)
+                def _G_optional_84():
+                    return (None, self.input.nullError())
+                _G_or_85, lastError = self._or([_G_optional_82, _G_optional_84])
+                self.considerError(lastError, None)
+                _locals['q'] = _G_or_85
+                _G_python_86, lastError = eval('some(seq or l, q)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_86, self.currentError)
+            _G_or_87, lastError = self._or([_G_or_63, _G_or_66])
+            self.considerError(lastError, 'some')
+            return (_G_or_87, self.currentError)
+
+
+        def rule_quant(self):
+            _locals = {'self': self}
+            self.locals['quant'] = _locals
+            _G_apply_88, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'quant')
+            def _G_or_89():
+                _G_exactly_90, lastError = self.exactly('?')
+                self.considerError(lastError, None)
+                return (_G_exactly_90, self.currentError)
+            def _G_or_91():
+                _G_exactly_92, lastError = self.exactly('+')
+                self.considerError(lastError, None)
+                return (_G_exactly_92, self.currentError)
+            def _G_or_93():
+                _G_exactly_94, lastError = self.exactly('*')
+                self.considerError(lastError, None)
+                return (_G_exactly_94, self.currentError)
+            _G_or_95, lastError = self._or([_G_or_89, _G_or_91, _G_or_93])
+            self.considerError(lastError, 'quant')
+            return (_G_or_95, self.currentError)
+
+
+        def rule_prim(self):
+            _locals = {'self': self}
+            self.locals['prim'] = _locals
+            def _G_or_96():
+                _G_apply_97, lastError = self._apply(self.rule_term, "term", [])
+                self.considerError(lastError, None)
+                return (_G_apply_97, self.currentError)
+            def _G_or_98():
+                _G_exactly_99, lastError = self.exactly('.')
+                self.considerError(lastError, None)
+                _G_python_100, lastError = eval('any()', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_100, self.currentError)
+            def _G_or_101():
+                _G_apply_102, lastError = self._apply(self.rule_literal, "literal", [])
+                self.considerError(lastError, None)
+                _locals['l'] = _G_apply_102
+                _G_apply_103, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_104, lastError = self.exactly('..')
+                self.considerError(lastError, None)
+                _G_apply_105, lastError = self._apply(self.rule_literal, "literal", [])
+                self.considerError(lastError, None)
+                _locals['r'] = _G_apply_105
+                _G_python_106, lastError = eval('range(l, r)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_106, self.currentError)
+            def _G_or_107():
+                _G_apply_108, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_109, lastError = self.exactly('^')
+                self.considerError(lastError, None)
+                _G_apply_110, lastError = self._apply(self.rule_string, "string", [])
+                self.considerError(lastError, None)
+                _locals['s'] = _G_apply_110
+                _G_python_111, lastError = eval('anyOf(s)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_111, self.currentError)
+            def _G_or_112():
+                _G_apply_113, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_114, lastError = self.exactly('(')
+                self.considerError(lastError, None)
+                _G_apply_115, lastError = self._apply(self.rule_argList, "argList", [])
+                self.considerError(lastError, None)
+                _locals['l'] = _G_apply_115
+                _G_apply_116, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_117, lastError = self.exactly(')')
+                self.considerError(lastError, None)
+                _G_python_118, lastError = eval('l', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_118, self.currentError)
+            _G_or_119, lastError = self._or([_G_or_96, _G_or_98, _G_or_101, _G_or_107, _G_or_112])
+            self.considerError(lastError, 'prim')
+            return (_G_or_119, self.currentError)
+
+
+        def rule_simpleint(self):
+            _locals = {'self': self}
+            self.locals['simpleint'] = _locals
+            _G_apply_120, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+            self.considerError(lastError, 'simpleint')
+            _locals['ds'] = _G_apply_120
+            _G_python_121, lastError = eval('int(ds)', self.globals, _locals), None
+            self.considerError(lastError, 'simpleint')
+            return (_G_python_121, self.currentError)
+
+
+        def rule_functorHole(self):
+            _locals = {'self': self}
+            self.locals['functorHole'] = _locals
+            def _G_or_122():
+                _G_exactly_123, lastError = self.exactly('$')
+                self.considerError(lastError, None)
+                def _G_or_124():
+                    _G_apply_125, lastError = self._apply(self.rule_simpleint, "simpleint", [])
+                    self.considerError(lastError, None)
+                    _locals['i'] = _G_apply_125
+                    return (_locals['i'], self.currentError)
+                def _G_or_126():
+                    _G_exactly_127, lastError = self.exactly('{')
+                    self.considerError(lastError, None)
+                    _G_apply_128, lastError = self._apply(self.rule_simpleint, "simpleint", [])
+                    self.considerError(lastError, None)
+                    _locals['i'] = _G_apply_128
+                    _G_exactly_129, lastError = self.exactly('}')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_129, self.currentError)
+                def _G_or_130():
+                    _G_apply_131, lastError = self._apply(self.rule_tag, "tag", [])
+                    self.considerError(lastError, None)
+                    _locals['t'] = _G_apply_131
+                    _G_python_132, lastError = eval('t.name', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    _locals['i'] = _G_python_132
+                    return (_locals['i'], self.currentError)
+                _G_or_133, lastError = self._or([_G_or_124, _G_or_126, _G_or_130])
+                self.considerError(lastError, None)
+                _G_python_134, lastError = eval('dollarHole(i)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_134, self.currentError)
+            def _G_or_135():
+                def _G_or_136():
+                    _G_exactly_137, lastError = self.exactly('@')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_137, self.currentError)
+                def _G_or_138():
+                    _G_exactly_139, lastError = self.exactly('=')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_139, self.currentError)
+                _G_or_140, lastError = self._or([_G_or_136, _G_or_138])
+                self.considerError(lastError, None)
+                def _G_or_141():
+                    _G_apply_142, lastError = self._apply(self.rule_simpleint, "simpleint", [])
+                    self.considerError(lastError, None)
+                    _locals['i'] = _G_apply_142
+                    return (_locals['i'], self.currentError)
+                def _G_or_143():
+                    _G_exactly_144, lastError = self.exactly('{')
+                    self.considerError(lastError, None)
+                    _G_apply_145, lastError = self._apply(self.rule_simpleint, "simpleint", [])
+                    self.considerError(lastError, None)
+                    _locals['i'] = _G_apply_145
+                    _G_exactly_146, lastError = self.exactly('}')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_146, self.currentError)
+                def _G_or_147():
+                    _G_apply_148, lastError = self._apply(self.rule_tag, "tag", [])
+                    self.considerError(lastError, None)
+                    _locals['t'] = _G_apply_148
+                    _G_python_149, lastError = eval('t.name', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    _locals['i'] = _G_python_149
+                    return (_locals['i'], self.currentError)
+                _G_or_150, lastError = self._or([_G_or_141, _G_or_143, _G_or_147])
+                self.considerError(lastError, None)
+                _G_python_151, lastError = eval('patternHole(i)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_151, self.currentError)
+            _G_or_152, lastError = self._or([_G_or_122, _G_or_135])
+            self.considerError(lastError, 'functorHole')
+            return (_G_or_152, self.currentError)
+
+
+    if quasiterm.globals is not None:
+        quasiterm.globals = quasiterm.globals.copy()
+        quasiterm.globals.update(ruleGlobals)
+    else:
+        quasiterm.globals = ruleGlobals
+    return quasiterm
\ No newline at end of file
diff --git a/lib/Parsley-1.1/terml/_generated/terml.py b/lib/Parsley-1.1/terml/_generated/terml.py
new file mode 100644
index 0000000..dd2b0ed
--- /dev/null
+++ b/lib/Parsley-1.1/terml/_generated/terml.py
@@ -0,0 +1,1151 @@
+def createParserClass(GrammarBase, ruleGlobals):
+    if ruleGlobals is None:
+        ruleGlobals = {}
+    class terml(GrammarBase):
+        def rule_hspace(self):
+            _locals = {'self': self}
+            self.locals['hspace'] = _locals
+            def _G_or_1():
+                _G_exactly_2, lastError = self.exactly(' ')
+                self.considerError(lastError, None)
+                return (_G_exactly_2, self.currentError)
+            def _G_or_3():
+                _G_exactly_4, lastError = self.exactly('\t')
+                self.considerError(lastError, None)
+                return (_G_exactly_4, self.currentError)
+            def _G_or_5():
+                _G_exactly_6, lastError = self.exactly('\x0c')
+                self.considerError(lastError, None)
+                return (_G_exactly_6, self.currentError)
+            def _G_or_7():
+                _G_exactly_8, lastError = self.exactly('#')
+                self.considerError(lastError, None)
+                def _G_many_9():
+                    def _G_not_10():
+                        _G_apply_11, lastError = self._apply(self.rule_eol, "eol", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_11, self.currentError)
+                    _G_not_12, lastError = self._not(_G_not_10)
+                    self.considerError(lastError, None)
+                    _G_apply_13, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_13, self.currentError)
+                _G_many_14, lastError = self.many(_G_many_9)
+                self.considerError(lastError, None)
+                return (_G_many_14, self.currentError)
+            _G_or_15, lastError = self._or([_G_or_1, _G_or_3, _G_or_5, _G_or_7])
+            self.considerError(lastError, 'hspace')
+            return (_G_or_15, self.currentError)
+
+
+        def rule_ws(self):
+            _locals = {'self': self}
+            self.locals['ws'] = _locals
+            def _G_many_16():
+                def _G_or_17():
+                    _G_exactly_18, lastError = self.exactly('\r')
+                    self.considerError(lastError, None)
+                    _G_exactly_19, lastError = self.exactly('\n')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_19, self.currentError)
+                def _G_or_20():
+                    _G_exactly_21, lastError = self.exactly('\r')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_21, self.currentError)
+                def _G_or_22():
+                    _G_exactly_23, lastError = self.exactly('\n')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_23, self.currentError)
+                def _G_or_24():
+                    _G_apply_25, lastError = self._apply(self.rule_hspace, "hspace", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_25, self.currentError)
+                _G_or_26, lastError = self._or([_G_or_17, _G_or_20, _G_or_22, _G_or_24])
+                self.considerError(lastError, None)
+                return (_G_or_26, self.currentError)
+            _G_many_27, lastError = self.many(_G_many_16)
+            self.considerError(lastError, 'ws')
+            return (_G_many_27, self.currentError)
+
+
+        def rule_number(self):
+            _locals = {'self': self}
+            self.locals['number'] = _locals
+            _G_apply_28, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'number')
+            _G_apply_29, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+            self.considerError(lastError, 'number')
+            return (_G_apply_29, self.currentError)
+
+
+        def rule_barenumber(self):
+            _locals = {'self': self}
+            self.locals['barenumber'] = _locals
+            def _G_optional_30():
+                _G_exactly_31, lastError = self.exactly('-')
+                self.considerError(lastError, None)
+                return (_G_exactly_31, self.currentError)
+            def _G_optional_32():
+                return (None, self.input.nullError())
+            _G_or_33, lastError = self._or([_G_optional_30, _G_optional_32])
+            self.considerError(lastError, 'barenumber')
+            _locals['sign'] = _G_or_33
+            def _G_or_34():
+                _G_exactly_35, lastError = self.exactly('0')
+                self.considerError(lastError, None)
+                def _G_or_36():
+                    def _G_or_37():
+                        _G_exactly_38, lastError = self.exactly('x')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_38, self.currentError)
+                    def _G_or_39():
+                        _G_exactly_40, lastError = self.exactly('X')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_40, self.currentError)
+                    _G_or_41, lastError = self._or([_G_or_37, _G_or_39])
+                    self.considerError(lastError, None)
+                    def _G_many_42():
+                        _G_apply_43, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_43, self.currentError)
+                    _G_many_44, lastError = self.many(_G_many_42)
+                    self.considerError(lastError, None)
+                    _locals['hs'] = _G_many_44
+                    _G_python_45, lastError = eval('makeHex(sign, hs)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_45, self.currentError)
+                def _G_or_46():
+                    _G_python_47, lastError = eval('sign', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    _G_python_48, lastError = '0', None
+                    self.considerError(lastError, None)
+                    _G_apply_49, lastError = self._apply(self.rule_floatPart, "floatPart", [_G_python_47, _G_python_48])
+                    self.considerError(lastError, None)
+                    return (_G_apply_49, self.currentError)
+                def _G_or_50():
+                    def _G_many_51():
+                        _G_apply_52, lastError = self._apply(self.rule_octaldigit, "octaldigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_52, self.currentError)
+                    _G_many_53, lastError = self.many(_G_many_51)
+                    self.considerError(lastError, None)
+                    _locals['ds'] = _G_many_53
+                    _G_python_54, lastError = eval('makeOctal(sign, ds)', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_54, self.currentError)
+                _G_or_55, lastError = self._or([_G_or_36, _G_or_46, _G_or_50])
+                self.considerError(lastError, None)
+                return (_G_or_55, self.currentError)
+            def _G_or_56():
+                _G_apply_57, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+                self.considerError(lastError, None)
+                _locals['ds'] = _G_apply_57
+                _G_python_58, lastError = eval('sign', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_python_59, lastError = eval('ds', self.globals, _locals), None
+                self.considerError(lastError, None)
+                _G_apply_60, lastError = self._apply(self.rule_floatPart, "floatPart", [_G_python_58, _G_python_59])
+                self.considerError(lastError, None)
+                return (_G_apply_60, self.currentError)
+            def _G_or_61():
+                _G_apply_62, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+                self.considerError(lastError, None)
+                _locals['ds'] = _G_apply_62
+                _G_python_63, lastError = eval('signedInt(sign, ds)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_63, self.currentError)
+            _G_or_64, lastError = self._or([_G_or_34, _G_or_56, _G_or_61])
+            self.considerError(lastError, 'barenumber')
+            return (_G_or_64, self.currentError)
+
+
+        def rule_exponent(self):
+            _locals = {'self': self}
+            self.locals['exponent'] = _locals
+            def _G_consumedby_65():
+                def _G_or_66():
+                    _G_exactly_67, lastError = self.exactly('e')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_67, self.currentError)
+                def _G_or_68():
+                    _G_exactly_69, lastError = self.exactly('E')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_69, self.currentError)
+                _G_or_70, lastError = self._or([_G_or_66, _G_or_68])
+                self.considerError(lastError, None)
+                def _G_optional_71():
+                    def _G_or_72():
+                        _G_exactly_73, lastError = self.exactly('+')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_73, self.currentError)
+                    def _G_or_74():
+                        _G_exactly_75, lastError = self.exactly('-')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_75, self.currentError)
+                    _G_or_76, lastError = self._or([_G_or_72, _G_or_74])
+                    self.considerError(lastError, None)
+                    return (_G_or_76, self.currentError)
+                def _G_optional_77():
+                    return (None, self.input.nullError())
+                _G_or_78, lastError = self._or([_G_optional_71, _G_optional_77])
+                self.considerError(lastError, None)
+                _G_apply_79, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+                self.considerError(lastError, None)
+                return (_G_apply_79, self.currentError)
+            _G_consumedby_80, lastError = self.consumedby(_G_consumedby_65)
+            self.considerError(lastError, 'exponent')
+            return (_G_consumedby_80, self.currentError)
+
+
+        def rule_floatPart(self):
+            _locals = {'self': self}
+            self.locals['floatPart'] = _locals
+            _G_apply_81, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'floatPart')
+            _locals['sign'] = _G_apply_81
+            _G_apply_82, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'floatPart')
+            _locals['ds'] = _G_apply_82
+            def _G_consumedby_83():
+                def _G_or_84():
+                    _G_exactly_85, lastError = self.exactly('.')
+                    self.considerError(lastError, None)
+                    _G_apply_86, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+                    self.considerError(lastError, None)
+                    def _G_optional_87():
+                        _G_apply_88, lastError = self._apply(self.rule_exponent, "exponent", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_88, self.currentError)
+                    def _G_optional_89():
+                        return (None, self.input.nullError())
+                    _G_or_90, lastError = self._or([_G_optional_87, _G_optional_89])
+                    self.considerError(lastError, None)
+                    return (_G_or_90, self.currentError)
+                def _G_or_91():
+                    _G_apply_92, lastError = self._apply(self.rule_exponent, "exponent", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_92, self.currentError)
+                _G_or_93, lastError = self._or([_G_or_84, _G_or_91])
+                self.considerError(lastError, None)
+                return (_G_or_93, self.currentError)
+            _G_consumedby_94, lastError = self.consumedby(_G_consumedby_83)
+            self.considerError(lastError, 'floatPart')
+            _locals['tail'] = _G_consumedby_94
+            _G_python_95, lastError = eval('makeFloat(sign, ds, tail)', self.globals, _locals), None
+            self.considerError(lastError, 'floatPart')
+            return (_G_python_95, self.currentError)
+
+
+        def rule_decdigits(self):
+            _locals = {'self': self}
+            self.locals['decdigits'] = _locals
+            _G_apply_96, lastError = self._apply(self.rule_digit, "digit", [])
+            self.considerError(lastError, 'decdigits')
+            _locals['d'] = _G_apply_96
+            def _G_many_97():
+                def _G_or_98():
+                    _G_apply_99, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    _locals['x'] = _G_apply_99
+                    def _G_pred_100():
+                        _G_python_101, lastError = eval('isDigit(x)', self.globals, _locals), None
+                        self.considerError(lastError, None)
+                        return (_G_python_101, self.currentError)
+                    _G_pred_102, lastError = self.pred(_G_pred_100)
+                    self.considerError(lastError, None)
+                    _G_python_103, lastError = eval('x', self.globals, _locals), None
+                    self.considerError(lastError, None)
+                    return (_G_python_103, self.currentError)
+                def _G_or_104():
+                    _G_exactly_105, lastError = self.exactly('_')
+                    self.considerError(lastError, None)
+                    _G_python_106, lastError = "", None
+                    self.considerError(lastError, None)
+                    return (_G_python_106, self.currentError)
+                _G_or_107, lastError = self._or([_G_or_98, _G_or_104])
+                self.considerError(lastError, None)
+                return (_G_or_107, self.currentError)
+            _G_many_108, lastError = self.many(_G_many_97)
+            self.considerError(lastError, 'decdigits')
+            _locals['ds'] = _G_many_108
+            _G_python_109, lastError = eval('concat(d, join(ds))', self.globals, _locals), None
+            self.considerError(lastError, 'decdigits')
+            return (_G_python_109, self.currentError)
+
+
+        def rule_octaldigit(self):
+            _locals = {'self': self}
+            self.locals['octaldigit'] = _locals
+            _G_apply_110, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'octaldigit')
+            _locals['x'] = _G_apply_110
+            def _G_pred_111():
+                _G_python_112, lastError = eval('isOctDigit(x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_112, self.currentError)
+            _G_pred_113, lastError = self.pred(_G_pred_111)
+            self.considerError(lastError, 'octaldigit')
+            _G_python_114, lastError = eval('x', self.globals, _locals), None
+            self.considerError(lastError, 'octaldigit')
+            return (_G_python_114, self.currentError)
+
+
+        def rule_hexdigit(self):
+            _locals = {'self': self}
+            self.locals['hexdigit'] = _locals
+            _G_apply_115, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, 'hexdigit')
+            _locals['x'] = _G_apply_115
+            def _G_pred_116():
+                _G_python_117, lastError = eval('isHexDigit(x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_117, self.currentError)
+            _G_pred_118, lastError = self.pred(_G_pred_116)
+            self.considerError(lastError, 'hexdigit')
+            _G_python_119, lastError = eval('x', self.globals, _locals), None
+            self.considerError(lastError, 'hexdigit')
+            return (_G_python_119, self.currentError)
+
+
+        def rule_string(self):
+            _locals = {'self': self}
+            self.locals['string'] = _locals
+            _G_apply_120, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'string')
+            _G_exactly_121, lastError = self.exactly('"')
+            self.considerError(lastError, 'string')
+            def _G_many_122():
+                def _G_or_123():
+                    _G_apply_124, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_124, self.currentError)
+                def _G_or_125():
+                    def _G_not_126():
+                        _G_exactly_127, lastError = self.exactly('"')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_127, self.currentError)
+                    _G_not_128, lastError = self._not(_G_not_126)
+                    self.considerError(lastError, None)
+                    _G_apply_129, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_129, self.currentError)
+                _G_or_130, lastError = self._or([_G_or_123, _G_or_125])
+                self.considerError(lastError, None)
+                return (_G_or_130, self.currentError)
+            _G_many_131, lastError = self.many(_G_many_122)
+            self.considerError(lastError, 'string')
+            _locals['c'] = _G_many_131
+            _G_exactly_132, lastError = self.exactly('"')
+            self.considerError(lastError, 'string')
+            _G_python_133, lastError = eval('join(c)', self.globals, _locals), None
+            self.considerError(lastError, 'string')
+            return (_G_python_133, self.currentError)
+
+
+        def rule_character(self):
+            _locals = {'self': self}
+            self.locals['character'] = _locals
+            _G_apply_134, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'character')
+            _G_exactly_135, lastError = self.exactly("'")
+            self.considerError(lastError, 'character')
+            def _G_or_136():
+                _G_apply_137, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                self.considerError(lastError, None)
+                return (_G_apply_137, self.currentError)
+            def _G_or_138():
+                def _G_not_139():
+                    def _G_or_140():
+                        _G_exactly_141, lastError = self.exactly("'")
+                        self.considerError(lastError, None)
+                        return (_G_exactly_141, self.currentError)
+                    def _G_or_142():
+                        _G_exactly_143, lastError = self.exactly('\n')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_143, self.currentError)
+                    def _G_or_144():
+                        _G_exactly_145, lastError = self.exactly('\r')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_145, self.currentError)
+                    def _G_or_146():
+                        _G_exactly_147, lastError = self.exactly('\\')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_147, self.currentError)
+                    _G_or_148, lastError = self._or([_G_or_140, _G_or_142, _G_or_144, _G_or_146])
+                    self.considerError(lastError, None)
+                    return (_G_or_148, self.currentError)
+                _G_not_149, lastError = self._not(_G_not_139)
+                self.considerError(lastError, None)
+                _G_apply_150, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError, None)
+                return (_G_apply_150, self.currentError)
+            _G_or_151, lastError = self._or([_G_or_136, _G_or_138])
+            self.considerError(lastError, 'character')
+            _locals['c'] = _G_or_151
+            _G_exactly_152, lastError = self.exactly("'")
+            self.considerError(lastError, 'character')
+            _G_python_153, lastError = eval('Character(c)', self.globals, _locals), None
+            self.considerError(lastError, 'character')
+            return (_G_python_153, self.currentError)
+
+
+        def rule_escapedUnicode(self):
+            _locals = {'self': self}
+            self.locals['escapedUnicode'] = _locals
+            def _G_or_154():
+                _G_exactly_155, lastError = self.exactly('u')
+                self.considerError(lastError, None)
+                def _G_consumedby_156():
+                    _G_apply_157, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_158, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_159, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_160, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_160, self.currentError)
+                _G_consumedby_161, lastError = self.consumedby(_G_consumedby_156)
+                self.considerError(lastError, None)
+                _locals['hs'] = _G_consumedby_161
+                _G_python_162, lastError = eval('unichr(int(hs, 16))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_162, self.currentError)
+            def _G_or_163():
+                _G_exactly_164, lastError = self.exactly('U')
+                self.considerError(lastError, None)
+                def _G_consumedby_165():
+                    _G_apply_166, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_167, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_168, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_169, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_170, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_171, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_172, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    _G_apply_173, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_173, self.currentError)
+                _G_consumedby_174, lastError = self.consumedby(_G_consumedby_165)
+                self.considerError(lastError, None)
+                _locals['hs'] = _G_consumedby_174
+                _G_python_175, lastError = eval('unichr(int(hs, 16))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_175, self.currentError)
+            _G_or_176, lastError = self._or([_G_or_154, _G_or_163])
+            self.considerError(lastError, 'escapedUnicode')
+            return (_G_or_176, self.currentError)
+
+
+        def rule_escapedOctal(self):
+            _locals = {'self': self}
+            self.locals['escapedOctal'] = _locals
+            def _G_or_177():
+                def _G_consumedby_178():
+                    _G_apply_179, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    _locals['a'] = _G_apply_179
+                    def _G_pred_180():
+                        _G_python_181, lastError = eval('contains("0123", a)', self.globals, _locals), None
+                        self.considerError(lastError, None)
+                        return (_G_python_181, self.currentError)
+                    _G_pred_182, lastError = self.pred(_G_pred_180)
+                    self.considerError(lastError, None)
+                    def _G_optional_183():
+                        _G_apply_184, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_184, self.currentError)
+                    def _G_optional_185():
+                        return (None, self.input.nullError())
+                    _G_or_186, lastError = self._or([_G_optional_183, _G_optional_185])
+                    self.considerError(lastError, None)
+                    def _G_optional_187():
+                        _G_apply_188, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_188, self.currentError)
+                    def _G_optional_189():
+                        return (None, self.input.nullError())
+                    _G_or_190, lastError = self._or([_G_optional_187, _G_optional_189])
+                    self.considerError(lastError, None)
+                    return (_G_or_190, self.currentError)
+                _G_consumedby_191, lastError = self.consumedby(_G_consumedby_178)
+                self.considerError(lastError, None)
+                return (_G_consumedby_191, self.currentError)
+            def _G_or_192():
+                def _G_consumedby_193():
+                    _G_apply_194, lastError = self._apply(self.rule_anything, "anything", [])
+                    self.considerError(lastError, None)
+                    _locals['a'] = _G_apply_194
+                    def _G_pred_195():
+                        _G_python_196, lastError = eval('contains("4567", a)', self.globals, _locals), None
+                        self.considerError(lastError, None)
+                        return (_G_python_196, self.currentError)
+                    _G_pred_197, lastError = self.pred(_G_pred_195)
+                    self.considerError(lastError, None)
+                    def _G_optional_198():
+                        _G_apply_199, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_199, self.currentError)
+                    def _G_optional_200():
+                        return (None, self.input.nullError())
+                    _G_or_201, lastError = self._or([_G_optional_198, _G_optional_200])
+                    self.considerError(lastError, None)
+                    return (_G_or_201, self.currentError)
+                _G_consumedby_202, lastError = self.consumedby(_G_consumedby_193)
+                self.considerError(lastError, None)
+                return (_G_consumedby_202, self.currentError)
+            _G_or_203, lastError = self._or([_G_or_177, _G_or_192])
+            self.considerError(lastError, 'escapedOctal')
+            _locals['os'] = _G_or_203
+            _G_python_204, lastError = eval('int(os, 8)', self.globals, _locals), None
+            self.considerError(lastError, 'escapedOctal')
+            return (_G_python_204, self.currentError)
+
+
+        def rule_escapedChar(self):
+            _locals = {'self': self}
+            self.locals['escapedChar'] = _locals
+            _G_exactly_205, lastError = self.exactly('\\')
+            self.considerError(lastError, 'escapedChar')
+            def _G_or_206():
+                _G_exactly_207, lastError = self.exactly('n')
+                self.considerError(lastError, None)
+                _G_python_208, lastError = '\n', None
+                self.considerError(lastError, None)
+                return (_G_python_208, self.currentError)
+            def _G_or_209():
+                _G_exactly_210, lastError = self.exactly('r')
+                self.considerError(lastError, None)
+                _G_python_211, lastError = '\r', None
+                self.considerError(lastError, None)
+                return (_G_python_211, self.currentError)
+            def _G_or_212():
+                _G_exactly_213, lastError = self.exactly('t')
+                self.considerError(lastError, None)
+                _G_python_214, lastError = '\t', None
+                self.considerError(lastError, None)
+                return (_G_python_214, self.currentError)
+            def _G_or_215():
+                _G_exactly_216, lastError = self.exactly('b')
+                self.considerError(lastError, None)
+                _G_python_217, lastError = '\b', None
+                self.considerError(lastError, None)
+                return (_G_python_217, self.currentError)
+            def _G_or_218():
+                _G_exactly_219, lastError = self.exactly('f')
+                self.considerError(lastError, None)
+                _G_python_220, lastError = '\f', None
+                self.considerError(lastError, None)
+                return (_G_python_220, self.currentError)
+            def _G_or_221():
+                _G_exactly_222, lastError = self.exactly('"')
+                self.considerError(lastError, None)
+                _G_python_223, lastError = '"', None
+                self.considerError(lastError, None)
+                return (_G_python_223, self.currentError)
+            def _G_or_224():
+                _G_exactly_225, lastError = self.exactly("'")
+                self.considerError(lastError, None)
+                _G_python_226, lastError = '\'', None
+                self.considerError(lastError, None)
+                return (_G_python_226, self.currentError)
+            def _G_or_227():
+                _G_exactly_228, lastError = self.exactly('?')
+                self.considerError(lastError, None)
+                _G_python_229, lastError = '?', None
+                self.considerError(lastError, None)
+                return (_G_python_229, self.currentError)
+            def _G_or_230():
+                _G_exactly_231, lastError = self.exactly('\\')
+                self.considerError(lastError, None)
+                _G_python_232, lastError = '\\', None
+                self.considerError(lastError, None)
+                return (_G_python_232, self.currentError)
+            def _G_or_233():
+                _G_apply_234, lastError = self._apply(self.rule_escapedUnicode, "escapedUnicode", [])
+                self.considerError(lastError, None)
+                return (_G_apply_234, self.currentError)
+            def _G_or_235():
+                _G_apply_236, lastError = self._apply(self.rule_escapedOctal, "escapedOctal", [])
+                self.considerError(lastError, None)
+                return (_G_apply_236, self.currentError)
+            def _G_or_237():
+                _G_apply_238, lastError = self._apply(self.rule_eol, "eol", [])
+                self.considerError(lastError, None)
+                _G_python_239, lastError = "", None
+                self.considerError(lastError, None)
+                return (_G_python_239, self.currentError)
+            _G_or_240, lastError = self._or([_G_or_206, _G_or_209, _G_or_212, _G_or_215, _G_or_218, _G_or_221, _G_or_224, _G_or_227, _G_or_230, _G_or_233, _G_or_235, _G_or_237])
+            self.considerError(lastError, 'escapedChar')
+            return (_G_or_240, self.currentError)
+
+
+        def rule_eol(self):
+            _locals = {'self': self}
+            self.locals['eol'] = _locals
+            def _G_many_241():
+                _G_apply_242, lastError = self._apply(self.rule_hspace, "hspace", [])
+                self.considerError(lastError, None)
+                return (_G_apply_242, self.currentError)
+            _G_many_243, lastError = self.many(_G_many_241)
+            self.considerError(lastError, 'eol')
+            def _G_or_244():
+                _G_exactly_245, lastError = self.exactly('\r')
+                self.considerError(lastError, None)
+                _G_exactly_246, lastError = self.exactly('\n')
+                self.considerError(lastError, None)
+                return (_G_exactly_246, self.currentError)
+            def _G_or_247():
+                _G_exactly_248, lastError = self.exactly('\r')
+                self.considerError(lastError, None)
+                return (_G_exactly_248, self.currentError)
+            def _G_or_249():
+                _G_exactly_250, lastError = self.exactly('\n')
+                self.considerError(lastError, None)
+                return (_G_exactly_250, self.currentError)
+            _G_or_251, lastError = self._or([_G_or_244, _G_or_247, _G_or_249])
+            self.considerError(lastError, 'eol')
+            return (_G_or_251, self.currentError)
+
+
+        def rule_uriBody(self):
+            _locals = {'self': self}
+            self.locals['uriBody'] = _locals
+            def _G_consumedby_252():
+                def _G_many1_253():
+                    def _G_or_254():
+                        _G_apply_255, lastError = self._apply(self.rule_letterOrDigit, "letterOrDigit", [])
+                        self.considerError(lastError, None)
+                        return (_G_apply_255, self.currentError)
+                    def _G_or_256():
+                        _G_exactly_257, lastError = self.exactly('_')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_257, self.currentError)
+                    def _G_or_258():
+                        _G_exactly_259, lastError = self.exactly(';')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_259, self.currentError)
+                    def _G_or_260():
+                        _G_exactly_261, lastError = self.exactly('/')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_261, self.currentError)
+                    def _G_or_262():
+                        _G_exactly_263, lastError = self.exactly('?')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_263, self.currentError)
+                    def _G_or_264():
+                        _G_exactly_265, lastError = self.exactly(':')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_265, self.currentError)
+                    def _G_or_266():
+                        _G_exactly_267, lastError = self.exactly('@')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_267, self.currentError)
+                    def _G_or_268():
+                        _G_exactly_269, lastError = self.exactly('&')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_269, self.currentError)
+                    def _G_or_270():
+                        _G_exactly_271, lastError = self.exactly('=')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_271, self.currentError)
+                    def _G_or_272():
+                        _G_exactly_273, lastError = self.exactly('+')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_273, self.currentError)
+                    def _G_or_274():
+                        _G_exactly_275, lastError = self.exactly('$')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_275, self.currentError)
+                    def _G_or_276():
+                        _G_exactly_277, lastError = self.exactly(',')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_277, self.currentError)
+                    def _G_or_278():
+                        _G_exactly_279, lastError = self.exactly('-')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_279, self.currentError)
+                    def _G_or_280():
+                        _G_exactly_281, lastError = self.exactly('.')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_281, self.currentError)
+                    def _G_or_282():
+                        _G_exactly_283, lastError = self.exactly('!')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_283, self.currentError)
+                    def _G_or_284():
+                        _G_exactly_285, lastError = self.exactly('~')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_285, self.currentError)
+                    def _G_or_286():
+                        _G_exactly_287, lastError = self.exactly('*')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_287, self.currentError)
+                    def _G_or_288():
+                        _G_exactly_289, lastError = self.exactly("'")
+                        self.considerError(lastError, None)
+                        return (_G_exactly_289, self.currentError)
+                    def _G_or_290():
+                        _G_exactly_291, lastError = self.exactly('(')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_291, self.currentError)
+                    def _G_or_292():
+                        _G_exactly_293, lastError = self.exactly(')')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_293, self.currentError)
+                    def _G_or_294():
+                        _G_exactly_295, lastError = self.exactly('%')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_295, self.currentError)
+                    def _G_or_296():
+                        _G_exactly_297, lastError = self.exactly('\\')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_297, self.currentError)
+                    def _G_or_298():
+                        _G_exactly_299, lastError = self.exactly('|')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_299, self.currentError)
+                    def _G_or_300():
+                        _G_exactly_301, lastError = self.exactly('#')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_301, self.currentError)
+                    _G_or_302, lastError = self._or([_G_or_254, _G_or_256, _G_or_258, _G_or_260, _G_or_262, _G_or_264, _G_or_266, _G_or_268, _G_or_270, _G_or_272, _G_or_274, _G_or_276, _G_or_278, _G_or_280, _G_or_282, _G_or_284, _G_or_286, _G_or_288, _G_or_290, _G_or_292, _G_or_294, _G_or_296, _G_or_298, _G_or_300])
+                    self.considerError(lastError, None)
+                    return (_G_or_302, self.currentError)
+                _G_many1_303, lastError = self.many(_G_many1_253, _G_many1_253())
+                self.considerError(lastError, None)
+                return (_G_many1_303, self.currentError)
+            _G_consumedby_304, lastError = self.consumedby(_G_consumedby_252)
+            self.considerError(lastError, 'uriBody')
+            return (_G_consumedby_304, self.currentError)
+
+
+        def rule_literal(self):
+            _locals = {'self': self}
+            self.locals['literal'] = _locals
+            def _G_or_305():
+                _G_apply_306, lastError = self._apply(self.rule_string, "string", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_306
+                _G_python_307, lastError = eval('leafInternal(Tag(".String."), x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_307, self.currentError)
+            def _G_or_308():
+                _G_apply_309, lastError = self._apply(self.rule_character, "character", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_309
+                _G_python_310, lastError = eval('leafInternal(Tag(".char."), x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_310, self.currentError)
+            def _G_or_311():
+                _G_apply_312, lastError = self._apply(self.rule_number, "number", [])
+                self.considerError(lastError, None)
+                _locals['x'] = _G_apply_312
+                _G_python_313, lastError = eval('leafInternal(Tag(numberType(x)), x)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_313, self.currentError)
+            _G_or_314, lastError = self._or([_G_or_305, _G_or_308, _G_or_311])
+            self.considerError(lastError, 'literal')
+            return (_G_or_314, self.currentError)
+
+
+        def rule_tag(self):
+            _locals = {'self': self}
+            self.locals['tag'] = _locals
+            def _G_or_315():
+                _G_apply_316, lastError = self._apply(self.rule_segment, "segment", [])
+                self.considerError(lastError, None)
+                _locals['seg1'] = _G_apply_316
+                def _G_many_317():
+                    _G_exactly_318, lastError = self.exactly(':')
+                    self.considerError(lastError, None)
+                    _G_exactly_319, lastError = self.exactly(':')
+                    self.considerError(lastError, None)
+                    _G_apply_320, lastError = self._apply(self.rule_sos, "sos", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_320, self.currentError)
+                _G_many_321, lastError = self.many(_G_many_317)
+                self.considerError(lastError, None)
+                _locals['segs'] = _G_many_321
+                _G_python_322, lastError = eval('makeTag(cons(seg1, segs))', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_322, self.currentError)
+            def _G_or_323():
+                def _G_many1_324():
+                    _G_exactly_325, lastError = self.exactly(':')
+                    self.considerError(lastError, None)
+                    _G_exactly_326, lastError = self.exactly(':')
+                    self.considerError(lastError, None)
+                    _G_apply_327, lastError = self._apply(self.rule_sos, "sos", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_327, self.currentError)
+                _G_many1_328, lastError = self.many(_G_many1_324, _G_many1_324())
+                self.considerError(lastError, None)
+                _locals['segs'] = _G_many1_328
+                _G_python_329, lastError = eval('prefixedTag(segs)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_329, self.currentError)
+            _G_or_330, lastError = self._or([_G_or_315, _G_or_323])
+            self.considerError(lastError, 'tag')
+            return (_G_or_330, self.currentError)
+
+
+        def rule_sos(self):
+            _locals = {'self': self}
+            self.locals['sos'] = _locals
+            def _G_or_331():
+                _G_apply_332, lastError = self._apply(self.rule_segment, "segment", [])
+                self.considerError(lastError, None)
+                return (_G_apply_332, self.currentError)
+            def _G_or_333():
+                _G_apply_334, lastError = self._apply(self.rule_string, "string", [])
+                self.considerError(lastError, None)
+                _locals['s'] = _G_apply_334
+                _G_python_335, lastError = eval('tagString(s)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_335, self.currentError)
+            _G_or_336, lastError = self._or([_G_or_331, _G_or_333])
+            self.considerError(lastError, 'sos')
+            return (_G_or_336, self.currentError)
+
+
+        def rule_segment(self):
+            _locals = {'self': self}
+            self.locals['segment'] = _locals
+            def _G_or_337():
+                _G_apply_338, lastError = self._apply(self.rule_ident, "ident", [])
+                self.considerError(lastError, None)
+                return (_G_apply_338, self.currentError)
+            def _G_or_339():
+                _G_apply_340, lastError = self._apply(self.rule_special, "special", [])
+                self.considerError(lastError, None)
+                return (_G_apply_340, self.currentError)
+            def _G_or_341():
+                _G_apply_342, lastError = self._apply(self.rule_uri, "uri", [])
+                self.considerError(lastError, None)
+                return (_G_apply_342, self.currentError)
+            _G_or_343, lastError = self._or([_G_or_337, _G_or_339, _G_or_341])
+            self.considerError(lastError, 'segment')
+            return (_G_or_343, self.currentError)
+
+
+        def rule_ident(self):
+            _locals = {'self': self}
+            self.locals['ident'] = _locals
+            _G_apply_344, lastError = self._apply(self.rule_segStart, "segStart", [])
+            self.considerError(lastError, 'ident')
+            _locals['i1'] = _G_apply_344
+            def _G_many_345():
+                _G_apply_346, lastError = self._apply(self.rule_segPart, "segPart", [])
+                self.considerError(lastError, None)
+                return (_G_apply_346, self.currentError)
+            _G_many_347, lastError = self.many(_G_many_345)
+            self.considerError(lastError, 'ident')
+            _locals['ibits'] = _G_many_347
+            _G_python_348, lastError = eval('join(cons(i1, ibits))', self.globals, _locals), None
+            self.considerError(lastError, 'ident')
+            return (_G_python_348, self.currentError)
+
+
+        def rule_segStart(self):
+            _locals = {'self': self}
+            self.locals['segStart'] = _locals
+            def _G_or_349():
+                _G_apply_350, lastError = self._apply(self.rule_letter, "letter", [])
+                self.considerError(lastError, None)
+                return (_G_apply_350, self.currentError)
+            def _G_or_351():
+                _G_exactly_352, lastError = self.exactly('_')
+                self.considerError(lastError, None)
+                return (_G_exactly_352, self.currentError)
+            def _G_or_353():
+                _G_exactly_354, lastError = self.exactly('$')
+                self.considerError(lastError, None)
+                return (_G_exactly_354, self.currentError)
+            _G_or_355, lastError = self._or([_G_or_349, _G_or_351, _G_or_353])
+            self.considerError(lastError, 'segStart')
+            return (_G_or_355, self.currentError)
+
+
+        def rule_segPart(self):
+            _locals = {'self': self}
+            self.locals['segPart'] = _locals
+            def _G_or_356():
+                _G_apply_357, lastError = self._apply(self.rule_letterOrDigit, "letterOrDigit", [])
+                self.considerError(lastError, None)
+                return (_G_apply_357, self.currentError)
+            def _G_or_358():
+                _G_exactly_359, lastError = self.exactly('_')
+                self.considerError(lastError, None)
+                return (_G_exactly_359, self.currentError)
+            def _G_or_360():
+                _G_exactly_361, lastError = self.exactly('.')
+                self.considerError(lastError, None)
+                return (_G_exactly_361, self.currentError)
+            def _G_or_362():
+                _G_exactly_363, lastError = self.exactly('-')
+                self.considerError(lastError, None)
+                return (_G_exactly_363, self.currentError)
+            def _G_or_364():
+                _G_exactly_365, lastError = self.exactly('$')
+                self.considerError(lastError, None)
+                return (_G_exactly_365, self.currentError)
+            _G_or_366, lastError = self._or([_G_or_356, _G_or_358, _G_or_360, _G_or_362, _G_or_364])
+            self.considerError(lastError, 'segPart')
+            return (_G_or_366, self.currentError)
+
+
+        def rule_special(self):
+            _locals = {'self': self}
+            self.locals['special'] = _locals
+            _G_exactly_367, lastError = self.exactly('.')
+            self.considerError(lastError, 'special')
+            _locals['a'] = _G_exactly_367
+            _G_apply_368, lastError = self._apply(self.rule_ident, "ident", [])
+            self.considerError(lastError, 'special')
+            _locals['b'] = _G_apply_368
+            _G_python_369, lastError = eval('concat(a, b)', self.globals, _locals), None
+            self.considerError(lastError, 'special')
+            return (_G_python_369, self.currentError)
+
+
+        def rule_uri(self):
+            _locals = {'self': self}
+            self.locals['uri'] = _locals
+            _G_exactly_370, lastError = self.exactly('<')
+            self.considerError(lastError, 'uri')
+            def _G_many_371():
+                _G_apply_372, lastError = self._apply(self.rule_uriBody, "uriBody", [])
+                self.considerError(lastError, None)
+                return (_G_apply_372, self.currentError)
+            _G_many_373, lastError = self.many(_G_many_371)
+            self.considerError(lastError, 'uri')
+            _locals['uriChars'] = _G_many_373
+            _G_exactly_374, lastError = self.exactly('>')
+            self.considerError(lastError, 'uri')
+            _G_python_375, lastError = eval('concat(b, uriChars, e)', self.globals, _locals), None
+            self.considerError(lastError, 'uri')
+            return (_G_python_375, self.currentError)
+
+
+        def rule_functor(self):
+            _locals = {'self': self}
+            self.locals['functor'] = _locals
+            _G_apply_376, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'functor')
+            def _G_or_377():
+                _G_apply_378, lastError = self._apply(self.rule_literal, "literal", [])
+                self.considerError(lastError, None)
+                return (_G_apply_378, self.currentError)
+            def _G_or_379():
+                _G_apply_380, lastError = self._apply(self.rule_tag, "tag", [])
+                self.considerError(lastError, None)
+                _locals['t'] = _G_apply_380
+                _G_python_381, lastError = eval('leafInternal(t, None)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_381, self.currentError)
+            _G_or_382, lastError = self._or([_G_or_377, _G_or_379])
+            self.considerError(lastError, 'functor')
+            return (_G_or_382, self.currentError)
+
+
+        def rule_baseTerm(self):
+            _locals = {'self': self}
+            self.locals['baseTerm'] = _locals
+            _G_apply_383, lastError = self._apply(self.rule_functor, "functor", [])
+            self.considerError(lastError, 'baseTerm')
+            _locals['f'] = _G_apply_383
+            def _G_or_384():
+                _G_exactly_385, lastError = self.exactly('(')
+                self.considerError(lastError, None)
+                _G_apply_386, lastError = self._apply(self.rule_argList, "argList", [])
+                self.considerError(lastError, None)
+                _locals['a'] = _G_apply_386
+                _G_apply_387, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                _G_exactly_388, lastError = self.exactly(')')
+                self.considerError(lastError, None)
+                _G_python_389, lastError = eval('makeTerm(f, a)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_389, self.currentError)
+            def _G_or_390():
+                _G_python_391, lastError = eval('makeTerm(f, None)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_391, self.currentError)
+            _G_or_392, lastError = self._or([_G_or_384, _G_or_390])
+            self.considerError(lastError, 'baseTerm')
+            return (_G_or_392, self.currentError)
+
+
+        def rule_arg(self):
+            _locals = {'self': self}
+            self.locals['arg'] = _locals
+            _G_apply_393, lastError = self._apply(self.rule_term, "term", [])
+            self.considerError(lastError, 'arg')
+            return (_G_apply_393, self.currentError)
+
+
+        def rule_argList(self):
+            _locals = {'self': self}
+            self.locals['argList'] = _locals
+            def _G_or_394():
+                _G_apply_395, lastError = self._apply(self.rule_arg, "arg", [])
+                self.considerError(lastError, None)
+                _locals['t'] = _G_apply_395
+                def _G_many_396():
+                    _G_apply_397, lastError = self._apply(self.rule_ws, "ws", [])
+                    self.considerError(lastError, None)
+                    _G_exactly_398, lastError = self.exactly(',')
+                    self.considerError(lastError, None)
+                    _G_apply_399, lastError = self._apply(self.rule_arg, "arg", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_399, self.currentError)
+                _G_many_400, lastError = self.many(_G_many_396)
+                self.considerError(lastError, None)
+                _locals['ts'] = _G_many_400
+                _G_apply_401, lastError = self._apply(self.rule_ws, "ws", [])
+                self.considerError(lastError, None)
+                def _G_optional_402():
+                    _G_exactly_403, lastError = self.exactly(',')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_403, self.currentError)
+                def _G_optional_404():
+                    return (None, self.input.nullError())
+                _G_or_405, lastError = self._or([_G_optional_402, _G_optional_404])
+                self.considerError(lastError, None)
+                _G_python_406, lastError = eval('cons(t, ts)', self.globals, _locals), None
+                self.considerError(lastError, None)
+                return (_G_python_406, self.currentError)
+            def _G_or_407():
+                _G_python_408, lastError = [], None
+                self.considerError(lastError, None)
+                return (_G_python_408, self.currentError)
+            _G_or_409, lastError = self._or([_G_or_394, _G_or_407])
+            self.considerError(lastError, 'argList')
+            return (_G_or_409, self.currentError)
+
+
+        def rule_tupleTerm(self):
+            _locals = {'self': self}
+            self.locals['tupleTerm'] = _locals
+            _G_apply_410, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'tupleTerm')
+            _G_exactly_411, lastError = self.exactly('[')
+            self.considerError(lastError, 'tupleTerm')
+            _G_apply_412, lastError = self._apply(self.rule_argList, "argList", [])
+            self.considerError(lastError, 'tupleTerm')
+            _locals['a'] = _G_apply_412
+            _G_apply_413, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'tupleTerm')
+            _G_exactly_414, lastError = self.exactly(']')
+            self.considerError(lastError, 'tupleTerm')
+            _G_python_415, lastError = eval('Tuple(a)', self.globals, _locals), None
+            self.considerError(lastError, 'tupleTerm')
+            return (_G_python_415, self.currentError)
+
+
+        def rule_bagTerm(self):
+            _locals = {'self': self}
+            self.locals['bagTerm'] = _locals
+            _G_apply_416, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'bagTerm')
+            _G_exactly_417, lastError = self.exactly('{')
+            self.considerError(lastError, 'bagTerm')
+            _G_apply_418, lastError = self._apply(self.rule_argList, "argList", [])
+            self.considerError(lastError, 'bagTerm')
+            _locals['a'] = _G_apply_418
+            _G_apply_419, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'bagTerm')
+            _G_exactly_420, lastError = self.exactly('}')
+            self.considerError(lastError, 'bagTerm')
+            _G_python_421, lastError = eval('Bag(a)', self.globals, _locals), None
+            self.considerError(lastError, 'bagTerm')
+            return (_G_python_421, self.currentError)
+
+
+        def rule_labelledBagTerm(self):
+            _locals = {'self': self}
+            self.locals['labelledBagTerm'] = _locals
+            _G_apply_422, lastError = self._apply(self.rule_functor, "functor", [])
+            self.considerError(lastError, 'labelledBagTerm')
+            _locals['f'] = _G_apply_422
+            _G_apply_423, lastError = self._apply(self.rule_bagTerm, "bagTerm", [])
+            self.considerError(lastError, 'labelledBagTerm')
+            _locals['b'] = _G_apply_423
+            _G_python_424, lastError = eval('LabelledBag(f, b)', self.globals, _locals), None
+            self.considerError(lastError, 'labelledBagTerm')
+            return (_G_python_424, self.currentError)
+
+
+        def rule_extraTerm(self):
+            _locals = {'self': self}
+            self.locals['extraTerm'] = _locals
+            def _G_or_425():
+                _G_apply_426, lastError = self._apply(self.rule_tupleTerm, "tupleTerm", [])
+                self.considerError(lastError, None)
+                return (_G_apply_426, self.currentError)
+            def _G_or_427():
+                _G_apply_428, lastError = self._apply(self.rule_labelledBagTerm, "labelledBagTerm", [])
+                self.considerError(lastError, None)
+                return (_G_apply_428, self.currentError)
+            def _G_or_429():
+                _G_apply_430, lastError = self._apply(self.rule_bagTerm, "bagTerm", [])
+                self.considerError(lastError, None)
+                return (_G_apply_430, self.currentError)
+            def _G_or_431():
+                _G_apply_432, lastError = self._apply(self.rule_baseTerm, "baseTerm", [])
+                self.considerError(lastError, None)
+                return (_G_apply_432, self.currentError)
+            _G_or_433, lastError = self._or([_G_or_425, _G_or_427, _G_or_429, _G_or_431])
+            self.considerError(lastError, 'extraTerm')
+            return (_G_or_433, self.currentError)
+
+
+        def rule_attrTerm(self):
+            _locals = {'self': self}
+            self.locals['attrTerm'] = _locals
+            _G_apply_434, lastError = self._apply(self.rule_extraTerm, "extraTerm", [])
+            self.considerError(lastError, 'attrTerm')
+            _locals['k'] = _G_apply_434
+            _G_apply_435, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'attrTerm')
+            _G_exactly_436, lastError = self.exactly(':')
+            self.considerError(lastError, 'attrTerm')
+            _G_apply_437, lastError = self._apply(self.rule_extraTerm, "extraTerm", [])
+            self.considerError(lastError, 'attrTerm')
+            _locals['v'] = _G_apply_437
+            _G_python_438, lastError = eval('Attr(k, v)', self.globals, _locals), None
+            self.considerError(lastError, 'attrTerm')
+            return (_G_python_438, self.currentError)
+
+
+        def rule_term(self):
+            _locals = {'self': self}
+            self.locals['term'] = _locals
+            _G_apply_439, lastError = self._apply(self.rule_ws, "ws", [])
+            self.considerError(lastError, 'term')
+            def _G_or_440():
+                _G_apply_441, lastError = self._apply(self.rule_attrTerm, "attrTerm", [])
+                self.considerError(lastError, None)
+                return (_G_apply_441, self.currentError)
+            def _G_or_442():
+                _G_apply_443, lastError = self._apply(self.rule_extraTerm, "extraTerm", [])
+                self.considerError(lastError, None)
+                return (_G_apply_443, self.currentError)
+            _G_or_444, lastError = self._or([_G_or_440, _G_or_442])
+            self.considerError(lastError, 'term')
+            return (_G_or_444, self.currentError)
+
+
+    if terml.globals is not None:
+        terml.globals = terml.globals.copy()
+        terml.globals.update(ruleGlobals)
+    else:
+        terml.globals = ruleGlobals
+    return terml
\ No newline at end of file
diff --git a/lib/Parsley-1.1/terml/nodes.py b/lib/Parsley-1.1/terml/nodes.py
new file mode 100644
index 0000000..c22ccaf
--- /dev/null
+++ b/lib/Parsley-1.1/terml/nodes.py
@@ -0,0 +1,141 @@
+from collections import namedtuple
+
+_Term = namedtuple("Term", "tag data args")
+class Term(_Term):
+    def __new__(cls, tag, data, args):
+        #XXX AstroTag tracks (name, tag_code) and source span
+        if data and not isinstance(data, (str, unicode, int, long, float)):
+            raise ValueError("Term data can't be of type %r" % (type(data),))
+        if data and args:
+            raise ValueError("Term %s can't have both data and children" % (tag,))
+        if args is None:
+            args = ()
+        return _Term.__new__(cls, tag, data, args)
+
+    def __iter__(self):
+        #and now I feel a bit silly subclassing namedtuple
+        raise NotImplementedError()
+
+    def __eq__(self, other):
+        return (     self.tag, self.data, self.args
+               ) == (other.tag, other.data, other.args)
+
+
+    def __repr__(self):
+        return "term('%s')" % (self._unparse(4).replace("'", "\\'"))
+
+
+    def _unparse(self, indentLevel=0):
+        newlineAndIndent = '\n' + (' ' * indentLevel)
+        if self.data is not None:
+            if self.tag.name == '.String.':
+                return '"%s"' % repr(self.data)[1:-1].replace("\\'", "'").replace('"', '\\\\"')
+            elif self.tag.name == '.char.':
+                return "'%s'" % repr(self.data)[1:-1].replace("'", "\\'").replace('\\"', '"')
+            else:
+                return str(self.data)
+        args = ', '.join([a._unparse() for a in self.args])
+        if self.tag.name == '.tuple.':
+            return "[%s]" % (args,)
+        elif self.tag.name == '.attr.':
+            return "%s: %s" % (self.args[0]._unparse(indentLevel),
+                               self.args[1]._unparse(indentLevel))
+        elif self.tag.name == '.bag.':
+            return "{%s}" % (args,)
+        elif len(self.args) == 1 and self.args[0].tag.name == '.bag.':
+            return "%s%s" % (self.tag._unparse(indentLevel), args)
+        else:
+            if len(self.args) == 0:
+                return self.tag._unparse(indentLevel)
+            return "%s(%s)" % (self.tag._unparse(indentLevel), args)
+
+
+    def build(self, builder):
+        if self.data is None:
+            f = builder.leafTag(self.tag)
+        else:
+            f = builder.leafData(self.data)
+
+        return builder.term(f, [arg.build(builder) for arg in self.args])
+
+
+    def __cmp__(self, other):
+        tagc = cmp(self.tag, other.tag)
+        if tagc:
+            return tagc
+        datac = cmp(self.data, other.data)
+        if datac:
+            return datac
+        return cmp(self.args, other.args)
+
+    def __int__(self):
+        return int(self.data)
+
+    def __float__(self):
+        return float(self.data)
+
+    def withoutArgs(self):
+        return Term(self.tag, self.data, ())
+
+    def asFunctor(self):
+        if self.args:
+            raise ValueError("Terms with args can't be used as functors")
+        else:
+            return self.tag
+
+
+class Tag(object):
+    def __init__(self, name):
+        if name[0] == '':
+            raise ValueError("Tags must have names")
+        self.name = name
+
+    def __eq__(self, other):
+        return other.__class__ == self.__class__ and self.name == other.name
+
+    def __ne__(self, other):
+        return not self == other
+
+    def __repr__(self):
+        return "Tag(%r)" % (self.name,)
+
+    def _unparse(self, indentLevel=0):
+        return self.name
+
+def coerceToTerm(val):
+    from ometa.runtime import character, unicodeCharacter
+    if isinstance(val, Term):
+        return val
+    if val is None:
+        return Term(Tag("null"), None, None)
+    if val is True:
+        return Term(Tag("true"), None, None)
+    if val is False:
+        return Term(Tag("false"), None, None)
+    if isinstance(val, (int, long)):
+        return Term(Tag(".int."), val, None)
+    if isinstance(val, float):
+        return Term(Tag(".float64."), val, None)
+    if isinstance(val, (character, unicodeCharacter)):
+        return Term(Tag(".char."), val, None)
+    if isinstance(val, basestring):
+        return Term(Tag(".String."), val, None)
+    if isinstance(val, (list, tuple)):
+        return Term(Tag(".tuple."), None, tuple(coerceToTerm(item) for item in val))
+    if isinstance(val, set):
+        return Term(Tag('.bag.'), None, tuple(coerceToTerm(item) for item in val))
+    if isinstance(val, dict):
+        return Term(Tag('.bag.'), None, tuple(Term(Tag('.attr.'), None,
+                                                   (coerceToTerm(k), coerceToTerm(v)))
+                                              for (k, v) in val.iteritems()))
+    raise ValueError("Could not coerce %r to Term" % (val,))
+
+class TermMaker(object):
+    def __getattr__(self, name):
+        def mkterm(*args, **kwargs):
+            return Term(Tag(name), None,
+                        tuple([coerceToTerm(a) for a in args]))
+        return mkterm
+
+termMaker = TermMaker()
+
diff --git a/lib/Parsley-1.1/terml/parser.py b/lib/Parsley-1.1/terml/parser.py
new file mode 100644
index 0000000..746e36e
--- /dev/null
+++ b/lib/Parsley-1.1/terml/parser.py
@@ -0,0 +1,103 @@
+import string
+from ometa.grammar import loadGrammar
+from ometa.runtime import character, EOFError
+import terml
+from terml.nodes import Tag, Term, termMaker
+
+## Functions called from grammar actions
+
+def concat(*bits):
+    return ''.join(map(str, bits))
+
+Character = termMaker.Character
+
+def makeFloat(sign, ds, tail):
+        return float((sign or '') + ds + tail)
+
+def signedInt(sign, x, base=10):
+    return int(str((sign or '')+x), base)
+
+def join(x):
+    return ''.join(x)
+
+def makeHex(sign, hs):
+    return int((sign or '') + ''.join(hs), 16)
+
+def makeOctal(sign, ds):
+    return int((sign or '') + '0'+''.join(ds), 8)
+
+def isDigit(x):
+    return x in string.digits
+
+def isOctDigit(x):
+    return x in string.octdigits
+
+def isHexDigit(x):
+    return x in string.hexdigits
+
+def contains(container, value):
+    return value in container
+
+def cons(first, rest):
+    return [first] + rest
+
+def Character(char):
+    return character(char)
+
+def makeTag(nameSegs):
+    return Tag('::'.join(nameSegs))
+
+def prefixedTag(tagnameSegs):
+    return makeTag([''] + tagnameSegs)
+
+def tagString(string):
+    return '"' + string + '"'
+
+def numberType(n):
+    if isinstance(n, float):
+        return ".float64."
+    elif isinstance(n, (long, int)):
+        return ".int."
+    raise ValueError("wtf")
+
+def leafInternal(tag, data):
+    return Term(tag, data, None)
+
+def makeTerm(t, args=None):
+    if isinstance(t, Term):
+        if t.data is not None:
+            if not args:
+                return t
+            else:
+                raise ValueError("Literal terms can't have arguments")
+    return Term(t.asFunctor(), None, args and tuple(args))
+
+
+def Tuple(args):
+    return Term(Tag(".tuple."), None, tuple(args))
+
+def Bag(args):
+    return Term(Tag(".bag."), None, tuple(args))
+
+def LabelledBag(f, arg):
+    return Term(f.asFunctor(), None, (arg,))
+
+def Attr(k, v):
+    return Term(Tag(".attr."), None, (k, v))
+
+TermLParser = loadGrammar(terml, "terml", globals())
+
+
+def parseTerm(termString):
+    """
+    Build a TermL term tree from a string.
+    """
+    p = TermLParser(termString)
+    result, error = p.apply("term")
+    try:
+        p.input.head()
+    except EOFError:
+        pass
+    else:
+        raise error
+    return result
diff --git a/lib/Parsley-1.1/terml/qnodes.py b/lib/Parsley-1.1/terml/qnodes.py
new file mode 100644
index 0000000..f2207b1
--- /dev/null
+++ b/lib/Parsley-1.1/terml/qnodes.py
@@ -0,0 +1,235 @@
+import itertools
+from collections import namedtuple
+from terml.nodes import Term, Tag, coerceToTerm
+
+class QTerm(namedtuple("QTerm", "functor data args")):
+    """
+    A quasiterm, representing a template or pattern for a term tree.
+    """
+    @property
+    def tag(self):
+        return self.functor.tag
+
+    def _substitute(self, map):
+        candidate = self.functor._substitute(map)[0]
+        args = tuple(itertools.chain.from_iterable(a._substitute(map) for a in self.args))
+        term = Term(candidate.tag, candidate.data, args)
+        return [term]
+
+    def substitute(self, map):
+        """
+        Fill $-holes with named values.
+
+        @param map: A mapping of names to values to be inserted into
+        the term tree.
+        """
+        return self._substitute(map)[0]
+
+    def match(self, specimen, substitutionArgs=()):
+        """
+        Search a term tree for matches to this pattern. Returns a
+        mapping of names to matched values.
+
+        @param specimen: A term tree to extract values from.
+        """
+        bindings = {}
+        if self._match(substitutionArgs, [specimen], bindings, (), 1) == 1:
+            return bindings
+        raise TypeError("%r doesn't match %r" % (self, specimen))
+
+    def _reserve(self):
+        return 1
+
+    def _match(self, args, specimens, bindings, index, max):
+        if not specimens:
+            return -1
+        spec = self._coerce(specimens[0])
+        if spec is None:
+            return -1
+        matches = self.functor._match(args, [spec.withoutArgs()], bindings, index, 1)
+        if not matches:
+            return -1
+        if matches > 1:
+            raise TypeError("Functor may only match 0 or 1 specimen")
+        num = matchArgs(self.args, spec.args, args, bindings, index, len(spec.args))
+        if len(spec.args) == num:
+            if max >= 1:
+                return 1
+        return -1
+
+    def _coerce(self, spec):
+        if isinstance(spec, Term):
+            newf = coerceToQuasiMatch(spec.withoutArgs(),
+                                      self.functor.isFunctorHole,
+                                      self.tag)
+            if newf is None:
+                return None
+            return Term(newf.asFunctor(), None, spec.args)
+        else:
+            return coerceToQuasiMatch(spec, self.functor.isFunctorHole,
+                                      self.tag)
+
+    def __eq__(self, other):
+        return (     self.functor, self.data, self.args
+               ) == (other.functor, other.data, other.args)
+
+    def asFunctor(self):
+        if self.args:
+            raise ValueError("Terms with args can't be used as functors")
+        else:
+            return self.functor
+
+class QFunctor(namedtuple("QFunctor", "tag data")):
+    isFunctorHole = False
+    def _reserve(self):
+        return 1
+
+    @property
+    def name(self):
+        return self.tag.name
+
+    def _unparse(self, indentLevel=0):
+        return self.tag._unparse(indentLevel)
+
+    def _substitute(self, map):
+        return [Term(self.tag, self.data, None)]
+
+    def _match(self, args, specimens, bindings, index, max):
+        if not specimens:
+            return -1
+        spec = coerceToQuasiMatch(specimens[0], False, self.tag)
+        if spec is None:
+            return -1
+        if self.data is not None and self.data != spec.data:
+            return -1
+        if max >= 1:
+            return 1
+        return -1
+
+    def asFunctor(self):
+        return self
+
+def matchArgs(quasiArglist, specimenArglist, args, bindings, index, max):
+    specs = specimenArglist
+    reserves = [q._reserve() for q in quasiArglist]
+    numConsumed = 0
+    for i, qarg in enumerate(quasiArglist):
+        num = qarg._match(args, specs, bindings, index, max - sum(reserves[i + 1:]))
+        if num == -1:
+            return -1
+        specs = specs[num:]
+        max -= num
+        numConsumed += num
+    return numConsumed
+
+
+def coerceToQuasiMatch(val, isFunctorHole, tag):
+    if isFunctorHole:
+        if val is None:
+            result = Term(Tag("null"), None, None)
+        elif isinstance(val, Term):
+            if len(val.args) != 0:
+                return None
+            else:
+                result = val
+        elif isinstance(val, basestring):
+            result = Term(Tag(val), None, None)
+        elif isinstance(val, bool):
+            result = Term(Tag(["false", "true"][val]), None, None)
+        else:
+            return None
+    else:
+        result = coerceToTerm(val)
+    if tag is not None and result.tag != tag:
+        return None
+    return result
+
+class _Hole(namedtuple("_Hole", "tag name isFunctorHole")):
+    def _reserve(self):
+        return 1
+
+    def __repr__(self):
+        return "term('%s')" % (self._unparse(4).replace("'", "\\'"))
+
+    def match(self, specimen, substitutionArgs=()):
+        bindings = {}
+        if self._match(substitutionArgs, [specimen], bindings, (), 1) != -1:
+            return bindings
+        raise TypeError("%r doesn't match %r" % (self, specimen))
+
+
+def _multiget(args, holenum, index, repeat):
+    result = args[holenum]
+    for i in index:
+        if not isinstance(result, list):
+            return result
+        result = result[i]
+    return result
+
+def _multiput(bindings, holenum, index, newval):
+    bits = bindings
+    dest = holenum
+    for it in index:
+        next = bits[dest]
+        if next is None:
+            next = {}
+            bits[dest] = next
+        bits = next
+        dest = it
+    result = None
+    if dest in bits:
+        result = bits[dest]
+    bits[dest] = newval
+    return result
+
+class ValueHole(_Hole):
+    def _unparse(self, indentLevel=0):
+        return "${%s}" % (self.name,)
+
+    def _substitute(self, map):
+        termoid = map[self.name]
+        val = coerceToQuasiMatch(termoid, self.isFunctorHole, self.tag)
+        if val is None:
+            raise TypeError("%r doesn't match %r" % (termoid, self))
+        return [val]
+
+    def asFunctor(self):
+        if self.isFunctorHole:
+            return self
+        else:
+            return ValueHole(self.tag, self.name, True)
+
+
+class PatternHole(_Hole):
+
+    def _unparse(self, indentLevel=0):
+        if self.tag:
+            return "%s@{%s}" % (self.tag.name, self.name)
+        else:
+            return "@{%s}" % (self.name,)
+
+    def _match(self, args, specimens, bindings, index, max):
+        if not specimens:
+            return -1
+        spec = coerceToQuasiMatch(specimens[0], self.isFunctorHole, self.tag)
+        if spec is None:
+            return -1
+        oldval = _multiput(bindings, self.name, index, spec)
+        if oldval is None or oldval != spec:
+            if max >= 1:
+                return 1
+        return -1
+
+
+    def asFunctor(self):
+        if self.isFunctorHole:
+            return self
+        else:
+            return PatternHole(self.tag, self.name, True)
+
+class QSome(namedtuple("_QSome", "value quant")):
+    def _reserve(self):
+        if self.quant == "+":
+            return 1
+        else:
+            return 0
diff --git a/lib/Parsley-1.1/terml/quasiterm.py b/lib/Parsley-1.1/terml/quasiterm.py
new file mode 100644
index 0000000..747d67e
--- /dev/null
+++ b/lib/Parsley-1.1/terml/quasiterm.py
@@ -0,0 +1,66 @@
+from ometa.grammar import loadGrammar
+from ometa.runtime import EOFError
+import terml
+from terml.parser import TermLParser
+from terml.qnodes import ValueHole, PatternHole, QTerm, QSome, QFunctor
+
+
+def interleave(l, *r):
+    if r:
+        raise NotImplementedError()
+    return l
+
+def _or(l, *r):
+    if r:
+        raise NotImplementedError()
+    return l
+
+def some(value, quant):
+    if quant:
+        return QSome(value, quant)
+    else:
+        return value
+
+def dollarHole(i):
+    return ValueHole(None, i, False)
+
+def patternHole(i):
+    return PatternHole(None, i, False)
+
+def taggedHole(t, h):
+    return h.__class__(t, h.name, h.isFunctorHole)
+
+def leafInternal(tag, data):
+    return QFunctor(tag, data)
+
+
+def makeTerm(t, args=None):
+    if args is None:
+        return t
+    else:
+        if isinstance(t, QTerm):
+            if t.data:
+                if not args:
+                    return t
+                else:
+                    raise ValueError("Literal terms can't have arguments")
+    return QTerm(t.asFunctor(), None, args and tuple(args))
+
+
+QTermParser = loadGrammar(terml, "quasiterm", TermLParser.globals, TermLParser)
+QTermParser.globals.update(globals())
+
+
+def quasiterm(termString):
+    """
+    Build a quasiterm from a string.
+    """
+    p = QTermParser(termString)
+    result, error = p.apply("term")
+    try:
+        p.input.head()
+    except EOFError:
+        pass
+    else:
+        raise error
+    return result
diff --git a/lib/Parsley-1.1/terml/test/__init__.py b/lib/Parsley-1.1/terml/test/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/Parsley-1.1/terml/test/test_quasiterm.py b/lib/Parsley-1.1/terml/test/test_quasiterm.py
new file mode 100644
index 0000000..f303ac6
--- /dev/null
+++ b/lib/Parsley-1.1/terml/test/test_quasiterm.py
@@ -0,0 +1,52 @@
+
+from unittest import TestCase
+from terml.parser import parseTerm as term
+from terml.quasiterm import quasiterm
+
+class QuasiTermSubstituteTests(TestCase):
+
+    def test_basic(self):
+        x = quasiterm("foo($x, $y)").substitute({"x": 1, "y": term("baz")})
+        self.assertEqual(x, term("foo(1, baz)"))
+        y = quasiterm("foo($0, ${1})").substitute([1, term("baz")])
+        self.assertEqual(y, term("foo(1, baz)"))
+
+
+    def test_withArgs(self):
+        x = quasiterm("$x(3)").substitute({"x": term("foo")})
+        self.assertEqual(x, term("foo(3)"))
+        x = quasiterm("foo($x)").substitute({"x": term("baz(3)")})
+        self.assertEqual(x, term("foo(baz(3))"))
+        self.assertRaises(TypeError, quasiterm("$x(3)").substitute,
+                          {"x": term("foo(3)")})
+
+
+class QuasiTermMatchTests(TestCase):
+
+    def test_simple(self):
+        self.assertEqual(quasiterm("@foo()").match("hello"),
+                         {"foo": term('hello')})
+        self.assertEqual(quasiterm("@foo").match("hello"),
+                         {"foo": term('"hello"')})
+        self.assertEqual(quasiterm("@foo").match(term("hello")),
+                         {"foo": term('hello')})
+        self.assertRaises(TypeError, quasiterm("hello at foo").match, "hello")
+        self.assertEqual(quasiterm(".String. at foo").match(term('"hello"')),
+                         {"foo": term('"hello"')})
+        self.assertEqual(quasiterm(".String. at foo").match("hello"),
+                         {"foo": term('"hello"')})
+        self.assertEqual(quasiterm("hello at foo").match(term("hello(3, 4)")),
+                         {"foo": term("hello(3, 4)")})
+        self.assertEqual(quasiterm("hello at bar()").match(term("hello")),
+                         {"bar": term("hello")})
+        self.assertEqual(quasiterm("hello at foo()").match("hello"),
+                         {"foo": term("hello")})
+        self.assertEqual(quasiterm("Foo(@x, Bar(1, @y))").match(
+                term("Foo(a, Bar(1, 2))")),
+                         {"x": term("a"), "y": term("2")})
+        self.assertRaises(TypeError, quasiterm("Foo(@x, Bar(3, @y))").match,
+                          term("Foo(a, Bar(1, 2))"))
+        self.assertRaises(TypeError, quasiterm("hello at foo()").match,
+                          term("hello(3, 4)"))
+        self.assertRaises(TypeError, quasiterm("hello at foo").match,
+                          "hello")
diff --git a/lib/Parsley-1.1/terml/test/test_terml.py b/lib/Parsley-1.1/terml/test/test_terml.py
new file mode 100644
index 0000000..efb9991
--- /dev/null
+++ b/lib/Parsley-1.1/terml/test/test_terml.py
@@ -0,0 +1,156 @@
+from twisted.trial import unittest
+from ometa.runtime import ParseError
+from terml.nodes import Tag, Term, coerceToTerm, TermMaker
+from terml.parser import TermLParser, character, parseTerm
+
+
+class TermMakerTests(unittest.TestCase):
+    def test_make(self):
+        m = TermMaker()
+        t1 = m.Foo(1, 'a', m.Baz())
+        self.assertEqual(t1, parseTerm('Foo(1, "a", Baz)'))
+
+
+class ParserTest(unittest.TestCase):
+    """
+    Test TermL parser rules.
+    """
+
+
+    def getParser(self, rule):
+        def parse(src):
+            p = TermLParser(src)
+            result, error = p.apply(rule)
+            return result
+        return parse
+
+
+    def test_literal(self):
+        """
+        Literals are parsed to literal terms.
+        """
+        parse = self.getParser("literal")
+        self.assertEqual(parse('"foo bar"'),
+                         Term(Tag('.String.'), "foo bar", None))
+        self.assertEqual(parse("'x'"),
+                         Term(Tag('.char.'), 'x', None))
+        self.assertEqual(parse("0xDECAFC0FFEEBAD"),
+                         Term(Tag('.int.'), 0xDECAFC0FFEEBAD, None))
+        self.assertEqual(parse("0755"),
+                         Term(Tag('.int.'), 0755, None))
+        self.assertEqual(parse("3.14159E17"),
+                         Term(Tag('.float64.'), 3.14159E17, None))
+        self.assertEqual(parse("1e9"),
+                         Term(Tag('.float64.'), 1e9, None))
+        self.assertEqual(parse("0"), Term(Tag(".int."), 0, None))
+        self.assertEqual(parse("7"), Term(Tag(".int."), 7, None))
+        self.assertEqual(parse("-1"), Term(Tag(".int."), -1, None))
+        self.assertEqual(parse("-3.14"),
+                         Term(Tag('.float64.'), -3.14, None))
+        self.assertEqual(parse("3_000"),
+                         Term(Tag('.int.'), 3000, None))
+        self.assertEqual(parse("0.91"),
+                         Term(Tag('.float64.'), 0.91, None))
+        self.assertEqual(parse("3e-2"),
+                         Term(Tag('.float64.'), 3e-2, None))
+        self.assertEqual(parse("'\\n'"),
+                         Term(Tag('.char.'), character("\n"), None))
+        self.assertEqual(parse('"foo\\nbar"'),
+                         Term(Tag('.String.'), "foo\nbar", None))
+        self.assertEqual(parse("'\\u0061'"),
+                         Term(Tag('.char.'), character("a"), None))
+        self.assertEqual(parse('"z\141p"'),
+                         Term(Tag('.String.'), "zap", None))
+        self.assertEqual(parse('"x\41"'),
+                         Term(Tag('.String.'), "x!", None))
+        self.assertEqual(parse('"foo\\\nbar"'),
+                         Term(Tag('.String.'), "foobar", None))
+
+
+    def test_simpleTag(self):
+        """
+        Tags are parsed properly.
+        """
+
+        parse = self.getParser("tag")
+        self.assertEqual(parse("foo"), Tag("foo"))
+        self.assertEqual(parse('::"foo"'), Tag('::"foo"'))
+        self.assertEqual(parse("::foo"), Tag('::foo'))
+        self.assertEqual(parse("foo::baz"), Tag('foo::baz'))
+        self.assertEqual(parse('foo::"baz"'), Tag('foo::"baz"'))
+        self.assertEqual(parse("biz::baz::foo"), Tag('biz::baz::foo'))
+        self.assertEqual(parse("foo_yay"), Tag('foo_yay'))
+        self.assertEqual(parse("foo$baz32"), Tag('foo$baz32'))
+        self.assertEqual(parse("foo-baz.19"), Tag('foo-baz.19'))
+
+
+    def test_simpleTerm(self):
+        """
+        Kernel syntax for terms is parsed properly.
+        """
+
+        parse = self.getParser("baseTerm")
+        self.assertEqual(parse("x"), Term(Tag("x"), None, None))
+        self.assertEqual(parse("x()"), Term(Tag("x"), None, []))
+        self.assertEqual(parse("x(1)"), Term(Tag("x"), None,
+                                             (Term(Tag(".int."), 1, None),)))
+        self.assertEqual(parse("x(1, 2)"), Term(Tag("x"), None,
+                                                (Term(Tag(".int."), 1,
+                                                      None),
+                                                 Term(Tag(".int."), 2,
+                                                      None))))
+        self.assertEqual(parse("1"), Term(Tag(".int."), 1, None))
+        self.assertEqual(parse('"1"'), Term(Tag(".String."), "1", None))
+        self.assertRaises(ValueError, parse, "'x'(x)")
+        self.assertRaises(ValueError, parse, '3.14(1)')
+        self.assertRaises(ValueError, parse, '"foo"(x)')
+        self.assertRaises(ValueError, parse, "1(2)")
+
+
+    def test_fullTerm(self):
+        """
+        Shortcut syntax for terms is handled.
+        """
+
+        self.assertEqual(parseTerm("[x, y, 1]"), parseTerm(".tuple.(x, y, 1)"))
+        self.assertEqual(parseTerm("{x, y, 1}"), parseTerm(".bag.(x, y, 1)"))
+        self.assertEqual(parseTerm("f {x, y, 1}"), parseTerm("f(.bag.(x, y, 1))"))
+        self.assertEqual(parseTerm("a: b"), parseTerm(".attr.(a, b)"))
+        self.assertEqual(parseTerm('"a": b'), parseTerm('.attr.("a", b)'))
+        self.assertEqual(parseTerm('a: [b]'), parseTerm('.attr.(a, .tuple.(b))'))
+
+
+    def test_multiline(self):
+        """
+        Terms spread across multiple lines are parsed correctly.
+        """
+        single = parseTerm('foo(baz({x: "y", boz: 42}))')
+        multi = parseTerm(
+                """foo(
+                    baz({
+                     x: "y",
+                     boz: 42}
+                   ))""")
+        self.assertEqual(multi, single)
+
+
+    def test_leftovers(self):
+        e = self.assertRaises(ParseError, parseTerm, "foo(x) and stuff")
+        self.assertEqual(e.position, 7)
+
+
+    def test_unparse(self):
+
+        def assertRoundtrip(txt):
+            self.assertEqual('term(%r)' % (txt,), repr(parseTerm(txt)))
+        cases = ["1", "3.25", "f", "f(1)", "f(1, 2)", "f(a, b)",
+                  "{a, b}", "[a, b]", "f{1, 2}",  '''{"name": "Robert", attrs: {'c': 3}}''']
+        for case in cases:
+            assertRoundtrip(case)
+
+
+    def test_coerce(self):
+        self.assertEqual(
+            coerceToTerm({3: 4, "a": character('x'), (2, 3): [4, 5]}),
+            parseTerm('{"a": \'x\', 3: 4, [2, 3]: [4, 5]}'))
+
diff --git a/lib/txsocksx-0.0.2/LICENSE b/lib/txsocksx-0.0.2/LICENSE
new file mode 100644
index 0000000..7f0e46e
--- /dev/null
+++ b/lib/txsocksx-0.0.2/LICENSE
@@ -0,0 +1,10 @@
+Copyright (c) 2013
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROF [...]
+
+
diff --git a/lib/txsocksx-0.0.2/MANIFEST.in b/lib/txsocksx-0.0.2/MANIFEST.in
new file mode 100644
index 0000000..1aba38f
--- /dev/null
+++ b/lib/txsocksx-0.0.2/MANIFEST.in
@@ -0,0 +1 @@
+include LICENSE
diff --git a/lib/txsocksx-0.0.2/PKG-INFO b/lib/txsocksx-0.0.2/PKG-INFO
new file mode 100644
index 0000000..beeeed4
--- /dev/null
+++ b/lib/txsocksx-0.0.2/PKG-INFO
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: txsocksx
+Version: 0.0.2
+Summary: UNKNOWN
+Home-page: UNKNOWN
+Author: UNKNOWN
+Author-email: UNKNOWN
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
diff --git a/lib/txsocksx-0.0.2/setup.cfg b/lib/txsocksx-0.0.2/setup.cfg
new file mode 100644
index 0000000..861a9f5
--- /dev/null
+++ b/lib/txsocksx-0.0.2/setup.cfg
@@ -0,0 +1,5 @@
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/lib/txsocksx-0.0.2/setup.py b/lib/txsocksx-0.0.2/setup.py
new file mode 100644
index 0000000..eb3fc4c
--- /dev/null
+++ b/lib/txsocksx-0.0.2/setup.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+from setuptools import setup
+setup(name='txsocksx',
+    version='0.0.2',
+    packages=['txsocksx'],
+    install_requires=[
+        "parsley",
+        "Twisted>=12.0"
+    ]
+)
diff --git a/lib/txsocksx-0.0.2/txsocksx/__init__.py b/lib/txsocksx-0.0.2/txsocksx/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/txsocksx-0.0.2/txsocksx/auth.py b/lib/txsocksx-0.0.2/txsocksx/auth.py
new file mode 100644
index 0000000..91d6c7e
--- /dev/null
+++ b/lib/txsocksx-0.0.2/txsocksx/auth.py
@@ -0,0 +1,41 @@
+from twisted.internet import defer
+from txsocksx.errors import SOCKSError
+
+class Anonymous(object):
+    """
+    ( 0 )
+    """
+    method = '\x00'
+    def negotiate(self, proto):
+        self.negotiated = True
+        return defer.succeed(None)
+
+class GSSAPI(object):
+    """
+    ( 1 )
+    """
+    method = '\x01'
+    def negotiate(self, proto):
+        raise NotImplemented
+
+class UsernamePasswordAuthFailed(SOCKSError):
+    pass
+
+class UsernamePassword(object):
+    """
+    ( 2 )
+    """
+    method = '\x02'
+    def __init__(self, uname, passwd):
+        self.uname = uname
+        self.passwd = passwd
+
+    def negotiate(self, proto):
+        proto.transport.write(
+            self.method
+            + chr(len(self.uname)) + self.uname
+            + chr(len(self.passwd)) + self.passwd)
+        # XXX implement the reading of the response and make sure
+        # authentication suceeded
+        return defer.succeed(None)
+
diff --git a/lib/txsocksx-0.0.2/txsocksx/client.py b/lib/txsocksx-0.0.2/txsocksx/client.py
new file mode 100644
index 0000000..aa3c999
--- /dev/null
+++ b/lib/txsocksx-0.0.2/txsocksx/client.py
@@ -0,0 +1,195 @@
+import struct
+
+
+from zope.interface import implements
+
+from twisted.internet import interfaces
+from twisted.internet import protocol
+from twisted.internet import defer
+from twisted.python import failure
+
+from ometa.runtime import ParseError
+
+from txsocksx.parser import SOCKSGrammar
+from txsocksx import constants as c
+from txsocksx import errors as e
+from txsocksx import auth
+
+def shortToBytes(i):
+    return chr(i >> 8) + chr(i & 0xff)
+
+class SOCKS5ClientTransport(object):
+    def __init__(self, wrappedClient):
+        self.wrappedClient = wrappedClient
+        self.transport = self.wrappedClient.transport
+
+    def __getattr__(self, attr):
+        return getattr(self.transport, attr)
+
+class SOCKS5Client(protocol.Protocol):
+    implements(interfaces.ITransport)
+
+    otherProtocol = None
+    debug = False
+
+    # We use this internal variable to make sure that we do not fire the
+    # deferred errback twice when an exception is raised while parsing a
+    # response from the server.
+    #
+    # This happens when in dataReceived the errback is trigged and the
+    # connection is then lost. The result is that
+    # self.factory.proxyConnectionFailed is called twice and that leads to it's
+    # errback getting fired twice.
+    # XXX this is not as clean as I would like it.
+    _parseError = False
+
+    def __init__(self):
+        self._state = 'ServerVersionMethod'
+
+    def connectionMade(self):
+        self.writeVersionMethod()
+
+    def writeVersionMethod(self):
+        """
+        This creates:
+            ver octet:nmethods octet{2, 255}:methods
+        """
+        supported_methods = [m.method for m in self.factory.authMethods]
+
+        message = struct.pack('!BB', c.VER_SOCKS5,
+                    len(supported_methods))
+        message += ''.join(supported_methods)
+
+        self.transport.write(message)
+
+    def writeRequest(self, result, cmd=c.CMD_CONNECT):
+        """
+        This creates:
+            clientRequestMessage =
+                ver cmd rsv SOCKSAddress port
+        """
+        # XXX-Security audit makeGrammar
+        message = SOCKSGrammar(self.factory.host)
+        req = struct.pack('!BBB', c.VER_SOCKS5, cmd, 0)
+        self.transport.write(
+                req + \
+                    message.hostToSOCKSAddress() + \
+                        shortToBytes(self.factory.port)
+        )
+        self.log("writeRequest %s" % (repr(req)))
+        self._state = 'ServerReply'
+
+    def readServerVersionMethod(self, message):
+        """
+        This reads the server version method message.
+        Such message will contains the supported SOCKS version of the server
+        and the method selected by the server.
+        """
+        self.log("readServerVersionMethod")
+        try:
+            ver, method = message.serverVersionMethod()
+        except ParseError:
+            raise e.ConnectionError()
+
+        if method not in self.factory.authMethods:
+            raise e.MethodsNotAcceptedError(
+                    'no method proprosed was accepted',
+                        self.factory.authMethods, method)
+        else:
+            auth_method = method()
+            d = defer.maybeDeferred(auth_method.negotiate, self)
+            d.addCallback(self.writeRequest)
+
+    def readServerReply(self, message):
+        try:
+            status, address, port = message.serverReply()
+        except ParseError:
+            raise e.InvalidServerReply()
+
+        self.log("readServerReply %s %s %s" % (status, address, port))
+        if status != 0:
+            raise status
+
+        self._state = 'ProxyData'
+        self.factory.proxyConnectionEstablished(self)
+
+    def readProxyData(self, data):
+        # There really is no reason for this to get called; we shouldn't be in
+        # raw mode until after SOCKS negotiation finishes.
+        assert self.otherProtocol is not None
+        self.otherProtocol.dataReceived(data)
+
+    def dataReceived(self, data):
+        self.log("Got some data %s" % repr(data))
+        if self._state == 'ProxyData':
+            self.readProxyData(data)
+            return
+
+        # XXX-Security audit makeGrammar
+        message = SOCKSGrammar(data)
+
+        current_state_method = getattr(self, 'read' + self._state)
+        d = defer.maybeDeferred(current_state_method,
+                message)
+        @d.addErrback
+        def _errback(reason):
+            self._parseError = True
+            self.factory.proxyConnectionFailed(reason)
+            return
+
+    def proxyEstablished(self, other):
+        self.otherProtocol = other
+        other.makeConnection(SOCKS5ClientTransport(self))
+
+    def connectionLost(self, reason):
+        if self.otherProtocol:
+            self.log("Connection Lost with other protocol")
+            self.otherProtocol.connectionLost(reason)
+        elif not self._parseError:
+            self.log("Connection Lost with no protocol")
+            self.factory.proxyConnectionFailed(
+                failure.Failure(e.ConnectionLostEarly()))
+
+    def log(self, msg):
+        if self.debug:
+            print msg
+
+class SOCKS5ClientFactory(protocol.ClientFactory):
+    protocol = SOCKS5Client
+
+    def __init__(self, host, port, proxiedFactory, authMethods):
+        self.host = host
+        self.port = port
+        self.proxiedFactory = proxiedFactory
+        self.authMethods = authMethods
+        self.deferred = defer.Deferred()
+
+    def proxyConnectionFailed(self, reason):
+        self.deferred.errback(reason)
+
+    def clientConnectionFailed(self, connector, reason):
+        self.proxyConnectionFailed(reason)
+
+    def proxyConnectionEstablished(self, proxyProtocol):
+        proto = self.proxiedFactory.buildProtocol(
+            proxyProtocol.transport.getPeer())
+        # XXX: handle the case of `proto is None`
+        proxyProtocol.proxyEstablished(proto)
+        self.deferred.callback(proto)
+
+class SOCKS5ClientEndpoint(object):
+    implements(interfaces.IStreamClientEndpoint)
+
+    def __init__(self, host, port, proxyEndpoint, authMethods=(auth.Anonymous,)):
+        self.host = host
+        self.port = port
+        self.proxyEndpoint = proxyEndpoint
+        self.authMethods = authMethods
+
+    def connect(self, fac):
+        proxyFac = SOCKS5ClientFactory(self.host, self.port, fac, self.authMethods)
+        d = self.proxyEndpoint.connect(proxyFac)
+        @d.addErrback
+        def _err(reason):
+            proxyFac.deferred.errback(reason)
+        return proxyFac.deferred
diff --git a/lib/txsocksx-0.0.2/txsocksx/constants.py b/lib/txsocksx-0.0.2/txsocksx/constants.py
new file mode 100644
index 0000000..612bfef
--- /dev/null
+++ b/lib/txsocksx-0.0.2/txsocksx/constants.py
@@ -0,0 +1,10 @@
+VER_SOCKS5 = 5
+ATYP_IPV4, ATYP_DOMAINNAME, ATYP_IPV6 = 1, 3, 4
+CMD_CONNECT, CMD_BIND, CMD_UDP_ASSOCIATE = 1, 2, 3
+NO_ACCEPTABLE_METHODS = 255
+RSV = 0
+
+SOCKS5_GRANTED, SOCKS5_GENERAL_FAILURE, SOCKS5_REJECTED = 0, 1, 2
+SOCKS5_NETWORK_UNREACHABLE, SOCKS5_HOST_UNREACHABLE = 3, 4
+SOCKS5_CONNECTION_REFUSED, SOCKS5_TTL_EXPIRED = 5, 6
+SOCKS5_COMMAND_NOT_SUPPORTED, SOCKS5_ADDRESS_NOT_SUPPORTED = 7, 8
diff --git a/lib/txsocksx-0.0.2/txsocksx/errors.py b/lib/txsocksx-0.0.2/txsocksx/errors.py
new file mode 100644
index 0000000..25a66b5
--- /dev/null
+++ b/lib/txsocksx-0.0.2/txsocksx/errors.py
@@ -0,0 +1,73 @@
+from twisted.internet import error
+import txsocksx.constants as c
+
+class ParsingError(Exception):
+    pass
+
+class InvalidServerReply(Exception):
+    pass
+
+class SOCKSError(Exception):
+    pass
+
+class MethodsNotAcceptedError(SOCKSError):
+    pass
+
+class ConnectionError(SOCKSError):
+    pass
+
+class ConnectionLostEarly(SOCKSError, error.ConnectionLost):
+    pass
+
+class StateError(Exception):
+    """
+    There was a problem with the State.
+    """
+    pass
+
+class NoAcceptableMethods(SOCKSError):
+    """
+    No Acceptable Methods ( FF )
+    """
+
+class ServerFailure(SOCKSError):
+    """
+    General SOCKS server failure ( 1 )
+    """
+
+class ConnectionNotAllowed(SOCKSError):
+    """
+    Connection not allowed ( 2 )
+    """
+
+class NetworkUnreachable(SOCKSError):
+    """
+    Network unreachable ( 3 )
+    """
+
+class HostUnreachable(SOCKSError):
+    """
+    Host unreachable ( 4 )
+    """
+
+class ConnectionRefused(SOCKSError):
+    """
+    Connection refused ( 5 )
+    """
+
+class TTLExpired(SOCKSError):
+    """
+    TTL expired ( 6 )
+    """
+
+class CommandNotSupported(SOCKSError):
+    """
+    Command Not Supported ( 7 )
+    """
+
+class AddressNotSupported(SOCKSError):
+    """
+    Address type not supported ( 8 )
+    """
+
+
diff --git a/lib/txsocksx-0.0.2/txsocksx/parser.py b/lib/txsocksx-0.0.2/txsocksx/parser.py
new file mode 100644
index 0000000..10c46cb
--- /dev/null
+++ b/lib/txsocksx-0.0.2/txsocksx/parser.py
@@ -0,0 +1,112 @@
+import parsley
+import struct
+
+from txsocksx import errors, auth
+
+socks_grammar = r"""
+# XXX probably move these to another grammar and inherit from it
+byte = anything:byte -> ord(byte)
+short = byte:high byte:low -> (high << 8) | low
+hexdigit = :x ?(x in '0123456789abcdefABCDEF') -> x
+
+byteToIntStr = anything:b
+    -> str(ord(b))
+
+# IPV4, IPV6 Address in binary form
+IPV4AddrBytes = byte{4}:quads
+    -> '.'.join(str(q) for q in quads)
+# XXX properly parse IPV6
+IPV6AddrBytes = <byte{16}>
+
+# IPV6 Address in the form 'X:X:X::X::X'
+# IPV4 Address in the form '0.0.0.0'
+IPV4AddrStr = <(digit{1, 3} '.'){4}>
+IPV6AddrStr = <(hexdigit{0, 4} ':'){7} hexdigit{1, 4}>
+
+# XXX notes
+# letterOrDigitOrHyphen = letterOrDigit | '-'
+# domainLabel = <(letter letterOrDigitOrHyphen{0, 61} letterOrDigit)>
+# domainName =
+#    < (domainLabel '.'?)* >
+
+# XXX make this stricter
+DomainName = letterOrDigit | '-' | '.'
+
+SOCKSDomainName =
+    byte:len <DomainName{len}>
+
+# Below are SOCKS specific messages
+ver = ('\x05' -> 5)
+      | ('\x04' -> 4)
+
+rsv = <'\x00'>
+
+SOCKSAddress = ('\x01' IPV4AddrBytes:addr
+                    -> addr)
+
+                | ('\x03' SOCKSDomainName:domain
+                    -> domain)
+
+                | ('\x04' IPV6AddrBytes:addr
+                    -> addr)
+
+hostToSOCKSAddress =
+                ( IPV4AddrStr:addr
+                    -> '\x01' + addr )
+
+                | ( <DomainName*>:addr
+                    -> '\x03' + chr(len(addr)) + addr )
+
+                | ( IPV6AddrStr:addr
+                    -> '\x04' + addr )
+
+
+
+port = short:p -> int(p)
+
+# The Client version identified/method selection message
+clientVersionMethod =
+    ver:v anything:nmethods anything{1, 255}:methods
+    -> (v, nmethods, methods)
+
+methods = ('\x00' -> a.Anonymous)
+          | ('\x01' -> a.GSSAPI)
+          | ('\x02' -> a.UsernamePassword)
+          | ('\xFF' -> e.NoAcceptableMethods)
+
+# The Server version identified/method selection message
+serverVersionMethod =
+    ver:v methods:m -> (v, m)
+
+cmd = ('\x01' -> 1)
+      | ('\x02' -> 2)
+      | ('\x03' -> 3)
+
+clientRequest =
+    ver cmd:command byte SOCKSAddress:address port:port
+        -> (command, address, port)
+
+rep = ('\x00' -> 0)
+      | ('\x01' -> e.ServerFailure)
+      | ('\x02' -> e.ConnectionNotAllowed)
+      | ('\x03' -> e.NetworkUnreachable)
+      | ('\x04' -> e.HostUnreachable)
+      | ('\x05' -> e.ConnectionRefused)
+      | ('\x06' -> e.TTLExpired)
+      | ('\x07' -> e.CommandNotSupported)
+      | ('\x08' -> e.AddressNotSupported)
+
+serverReply =
+    ver rep:reply byte SOCKSAddress:address port:port
+    -> (reply, address, port)
+"""
+
+SOCKSGrammar = parsley.makeGrammar(socks_grammar,
+        {"e": errors, "a": auth}
+)
+
+# XXX how do I do the equivalent of the above and generate the grammar to a
+# file?
+# parsley.moduleFromGrammar(socks_grammar, 'SOCKSGrammar',
+#         object, {"e": error, "a": auth})
+
diff --git a/lib/txsocksx-0.0.2/txsocksx/ssl.py b/lib/txsocksx-0.0.2/txsocksx/ssl.py
new file mode 100644
index 0000000..12e706e
--- /dev/null
+++ b/lib/txsocksx-0.0.2/txsocksx/ssl.py
@@ -0,0 +1,14 @@
+from twisted.protocols import tls
+from twisted.internet import interfaces
+from zope.interface import implements
+
+class SSLWrapClientEndpoint(object):
+    implements(interfaces.IStreamClientEndpoint)
+
+    def __init__(self, contextFactory, wrappedEndpoint):
+        self.contextFactory = contextFactory
+        self.wrappedEndpoint = wrappedEndpoint
+
+    def connect(self, fac):
+        fac = tls.TLSMemoryBIOFactory(self.contextFactory, True, fac)
+        return self.wrappedEndpoint.connect(fac)
diff --git a/setup.py b/setup.py
index e487c44..02c25f5 100644
--- a/setup.py
+++ b/setup.py
@@ -27,6 +27,14 @@ OTHER DEALINGS IN THE SOFTWARE.
 """
 
 from distutils.core import setup
+import os
+
+def file_list(path):
+    files = []
+    for filename in os.listdir(path):
+        if os.path.isfile(path+'/'+filename):
+            files.append(path+'/'+filename)
+    return files
 
 setup(name='torbrowser-launcher',
       version='0.0.2',
@@ -49,5 +57,15 @@ Tor Browser Launcher will get updated each time a new version of TBB is released
       data_files=[('/usr/share/applications', ['torbrowser.desktop', 'torbrowser-settings.desktop']),
                   ('/usr/share/pixmaps', ['img/torbrowser32.xpm', 'img/torbrowser80.xpm']),
                   ('/usr/share/torbrowser-launcher', ['keys/erinn.asc', 'keys/sebastian.asc', 'keys/alexandre.asc', 'torproject.pem']),
-                  ('/usr/share/torbrowser-launcher/locale/en', ['locale/en/messages.pot'])]
+                  ('/usr/share/torbrowser-launcher/locale/en', ['locale/en/messages.pot']),
+
+                  # unpackaged third party libraries
+                  ('/usr/share/torbrowser-launcher/lib/txsocksx', file_list('lib/txsocksx-0.0.2/txsocksx')),
+                  ('/usr/share/torbrowser-launcher/lib', ['lib/Parsley-1.1/parsley.py']),
+                  ('/usr/share/torbrowser-launcher/lib/ometa', file_list('lib/Parsley-1.1/ometa')),
+                  ('/usr/share/torbrowser-launcher/lib/ometa/_generated', file_list('lib/Parsley-1.1/ometa/_generated')),
+                  ('/usr/share/torbrowser-launcher/lib/ometa/test', file_list('lib/Parsley-1.1/ometa/test')),
+                  ('/usr/share/torbrowser-launcher/lib/terml', file_list('lib/Parsley-1.1/terml')),
+                  ('/usr/share/torbrowser-launcher/lib/terml/_generated', file_list('lib/Parsley-1.1/terml/_generated')),
+                  ('/usr/share/torbrowser-launcher/lib/terml/test', file_list('lib/Parsley-1.1/terml/test'))]
       )
diff --git a/torbrowser-launcher b/torbrowser-launcher
index ae3b486..c142246 100755
--- a/torbrowser-launcher
+++ b/torbrowser-launcher
@@ -27,6 +27,9 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 """
 
+import sys
+sys.path.append('/usr/share/torbrowser-launcher/lib/')
+
 import gettext
 gettext.install('torbrowser-launcher', '/usr/share/torbrowser-launcher/locale')
 
@@ -38,12 +41,15 @@ import pygtk
 pygtk.require('2.0')
 import gtk
 
-import os, sys, subprocess, locale, urllib2, gobject, time, pickle, json, tarfile, psutil
+import os, subprocess, locale, urllib2, gobject, time, pickle, json, tarfile, psutil
 
 from twisted.web.client import Agent, ResponseDone
 from twisted.web.http_headers import Headers
 from twisted.internet.protocol import Protocol
 from twisted.internet.ssl import ClientContextFactory
+from twisted.internet.endpoints import TCP4ClientEndpoint
+
+from txsocksx.client import SOCKS5ClientEndpoint
 
 from OpenSSL.SSL import Context, VERIFY_PEER, VERIFY_FAIL_IF_NO_PEER_CERT
 from OpenSSL.crypto import load_certificate, FILETYPE_PEM

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list