From 952032bc3b5a1b0fc215b677ca1aa32385ba525b Mon Sep 17 00:00:00 2001 From: sienkiew Date: Tue, 27 Sep 2011 17:33:55 +0000 Subject: various explanatory text version number in __version__ AURA copyrights remove code to support importing runtime instead of incorporating it into the generated parser add MANIFEST.in instructions for re-generating the parser that exyapps uses internally git-svn-id: http://svn.stsci.edu/svn/ssb/etal/exyapps/trunk@431 d34015c8-bcbb-4646-8ac8-8ba5febf221d --- exyapps/parsetree.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'exyapps/parsetree.py') diff --git a/exyapps/parsetree.py b/exyapps/parsetree.py index 5e38665..964a74e 100644 --- a/exyapps/parsetree.py +++ b/exyapps/parsetree.py @@ -1,12 +1,16 @@ -# parsetree.py, part of Yapps 2 - yet another python parser system +# parsetree.py, part of exyapps # Copyright 1999-2003 by Amit J. Patel +# Copyright 2011 by Association of Universities for Research in Astronomy # -# This version of the Yapps 2 Runtime can be distributed under the -# terms of the MIT open source license, either found in the LICENSE file -# included with the Yapps distribution -# or at +# This software can be distributed under the terms of the MIT +# open source license, either found in the LICENSE file or at # # +# ----- +# +# Except for changes necessary to incorporate the runtime library directly +# into the generated parser, this file is not substantially changed from +# YAPPS 2. """Classes used to represent parse trees and generate output. @@ -15,14 +19,16 @@ of Python output from a grammar parse tree. It also defines nodes used to represent the parse tree; they are derived from class Node. The main logic of Yapps is in this module. + +This module is used only to compile a parser. """ import sys, re import os.path -# load the contents of the runtime file into memory; it will be -# incorporated into the parser later. +# Load the contents of the runtime file into memory. We always need +# this. It will be incorporated into the generated parser code later. runtime_py_filename = os.path.dirname(__file__)+"/runtime.py" f = open( runtime_py_filename ,"r") runtime_contents = f.read() @@ -42,7 +48,6 @@ class Generator: self.options = options self.preparser = '' self.postparser = None - self.inline_runtime = 1 self.tokens = {} # Map from tokens to regexps self.ignore = {} # List of token names to ignore in parsing, map to statements @@ -286,12 +291,9 @@ class Generator: self.write("import sys, re\n") # - if self.inline_runtime : - self.write("###### included from %s\n"%runtime_py_filename) - self.write(runtime_contents) - self.write("###### end of runtime.py\n") - else : - self.write("from exyapps.runtime import SyntaxError, NoMoreTokens, Token, Scanner, Parser, Context, print_error, wrap_error_reporter\n") + self.write("###### included from %s\n"%runtime_py_filename) + self.write(runtime_contents) + self.write("###### end of runtime.py\n") self.write("\n") -- cgit