[Laszlo-dev] For Review: Change 20090303-dda-0 Summary: Capture filename information in parser errors
Donald Anderson
dda at ddanderson.com
Wed Mar 4 08:51:03 PST 2009
Change 20090303-dda-0 by dda at lester-2.local on 2009-03-03 09:29:19 PST
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-b
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Capture filename information in parser errors
New Features:
Bugs Fixed:
Technical Reviewer: ptw (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/Token.java
WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
ParseException.java
WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
This introduce of a better way to track filenames in the
parser.
Javacc does not have a direct way to track filename
information for use in error messages, etc.
Since it already keeps line/column information in tokens, it
seems sensible to keep that information there, too.
These changes overrides the standard Javacc Token.java with
our own version that contains the filename,
and a way to set it from the Parser. It removes the
knowledge of the current filename from the
TokenManager.
A ParseException, which only has access to the token, not the
tokenmanager, is now equipped to tag
an error message to include the file name.
WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
When parsing a dependency expression, add the current
filename location information.
WEB-INF/lps/server/src/org/openlaszlo/compiler/Main.java
WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
Added a 'dumpSourceInput' which is turned on when using -SS
that dumps that exact input source
that the script compiler sees into <name>-src-<count>.txt
Note - this change leaves in place the behavior that a stack trace
is produced. A simple attempt
at modifying this to producing a normal error message resulted in a
message with the line/file information
removed(!) This can be addressed via a separate JIRA.
Tests:
Test case now produces a message (still with a stack trace) that
includes the filename, and
correct line and column numbers.
Compiling: LPP-7839.lzx to LPP-7839.swf9.swf
Exception in thread "main"
org.openlaszlo.sc.parser.ParseException: Syntax error: the token "0"
was not expected at this position at file LPP-7839.lzx, line 2, column
36.
Usual regression tests: (smokecheck,weather,lzpix on all platforms).
Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/Main.java
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
A WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/Token.java
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
ParseException.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090303-dda-0.tar
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-306-2057
email: dda at ddanderson.com
www: http://www.ddanderson.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20090304/ecfa73d9/attachment-0001.html
More information about the Laszlo-dev
mailing list