[Laszlo-dev] For Review: Change 20090303-dda-0 Summary: Capture filename information in parser errors (with addendum 1)
P T Withington
ptw at laszlosystems.com
Thu Mar 5 11:53:55 PST 2009
Approved!
On 2009-03-05, at 11:57EST, Donald Anderson wrote:
> 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 (with
> addendum 1)
>
> New Features:
>
> Bugs Fixed: LPP-7839: Compiler does not show file name containing
> the parsing error
>
> Technical Reviewer: ptw (pending)
> QA Reviewer: (pending)
> Doc Reviewer: (pending)
>
> Documentation:
>
> Release Notes:
>
> Details:
> Addendum 1 - changed NodeModel.java and CompilationError.java:
> the original changeset caused most errors to no longer show the
> line numbers.
> That was because a workaround the insert the line number was
> removed because it was no longer needed,
> at least for the original test case. This addendum leaves the
> workaround removed, but file/line information
> is now correctly copied from a ParseException to a
> CompilationError. In NodeModel, we catch
> compilation errors for dependencies so they can be displayed
> normally instead of receiving a stack trace.
>
> 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/sc/CompilationError.java
>
> When wrapping a ParseException in a CompilationError,
> correctly copy line number/file name from
> one to another.
>
> WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
>
> When parsing a dependency expression, add the current
> filename location information.
>
> For compilation errors that happen during creation of
> dependencies, add the error to the environment,
> rather than let a stack trace appear.
>
> 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
>
>
> Tests:
> Test case from JIRA now produces a message (not with a stack trace)
> that includes the filename, and
> correct line and column numbers. Works with lzc and in server.
> <canvas>
> <class name="test" width="1 0"/>
> </canvas>
> LPP-7839.lzx:2:36: Syntax error: the token "0" was not expected at
> this position.
>
> Test case with a compilation error not in a dependency also (still)
> gives a correct error message.
> canvas>
> <class name="test" width="1"/>
> <script>
> var z = 422 9;
> </script>
> </canvas>
> LPP-7839b.lzx:4:19: Syntax error: the token "9" was not expected at
> this position.
>
> 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/src/org/openlaszlo/compiler/
> CompilationError.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
>
>
>
>
>
More information about the Laszlo-dev
mailing list