hg: kulla/dev/langtools: Fix handling of input that starts with syntax error

bitter_fox bitterfoxc at gmail.com
Thu Dec 4 01:39:56 UTC 2014


Hi, Robert
Thank you for your fix.

I think we need a more fix about this.

Now, when we meet these AssertErrorable token, the following tokens of
AssertErrorable token is not parsed and any error is not reported:

-> [];#this#would#be#syntax#error;
|  Error --
|  illegal start of expression
|  [];#this#would#be#syntax#error;
|  ^

When "[]" is another token such as "#", all of syntax errors are reported:
|  Error --
|  illegal character: '#'
|  #;#this#would#be#syntax#error;
|  ^
(...)
|  Error --
|  illegal start of expression
|  #;#this#would#be#syntax#error;
|                               ^
We should remove the cause of the AssertError.

Please review my patch:
webrev: http://cr.openjdk.java.net/~shinyafox/kulla/0/webrev.00/

The cause of the AssertError is failing in skipping tokens.

When AssertErrorable tokens is first token(token.pos is 0), the token is
not skipped because the boolean expression will never be true:
            if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) {
                 // error recovery
                 skip(true, false, false, false);

So I added the fix for the boolean expression.

Regrads,
shinyafox
Shinya Yoshida(@bitter_fox)

2014-12-04 2:57 GMT+09:00 <robert.field at oracle.com>:

> Changeset: 9158820f3cc0
> Author:    rfield
> Date:      2014-12-03 09:56 -0800
> URL:       http://hg.openjdk.java.net/kulla/dev/langtools/rev/9158820f3cc0
>
> Fix handling of input that starts with syntax error
>
> ! repl/src/tool/Repl.java
> ! repl/src/tool/ReplParser.java
>
>


More information about the kulla-dev mailing list