List Info

Thread: Parse Exception




Parse Exception
user name
2007-07-16 10:02:41
Hi, 

The ParseException can result in the infuriating message 

Encountered "V" at line 1, column 29.
Was expecting one of:
    <NUMBER> ...
    "V" ...
    "C" ...
    "X" ...
    "D" ...
    "N" ...
    "S" ...
    "T" ...
    "M" ...


This can be easily modified to produce the less infuriating
message: 

ParseException: Encountered  <IDENTIFIER>
"V" at line 1, column 29.
Was expecting one of:
    <NUMBER> ...
    "V" ...
    "C" ...
    "X" ...
    "D" ...
    "N" ...
    "S" ...
    "T" ...
    "M" ...

by the addition of the following to the generated
ParseException: 

      retval += " " + tokenImage[tok.kind];
      retval += " "";
      retval += add_escapes(tok.image);
      retval += "" ";

Would others see this as an improvement?

TimP


------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
For additional commands, e-mail: users-helpjavacc.dev.java.net


Re: Parse Exception
user name
2007-07-16 10:10:45
I would see that as an improvement, particularly since I
have  
encountered similar error messages. However, keep in mind
that not  
all tokens need be named, which may complicate things a
bit.

Nathan


On Jul 16, 2007, at 9.02, TimP wrote:

> Hi,
>
> The ParseException can result in the infuriating
message
>
> Encountered "V" at line 1, column 29.
> Was expecting one of:
>     <NUMBER> ...
>     "V" ...
>     "C" ...
>     "X" ...
>     "D" ...
>     "N" ...
>     "S" ...
>     "T" ...
>     "M" ...
>
>
> This can be easily modified to produce the less
infuriating message:
>
> ParseException: Encountered  <IDENTIFIER>
"V" at line 1, column 29.
> Was expecting one of:
>     <NUMBER> ...
>     "V" ...
>     "C" ...
>     "X" ...
>     "D" ...
>     "N" ...
>     "S" ...
>     "T" ...
>     "M" ...
>
> by the addition of the following to the generated
ParseException:
>
>       retval += " " + tokenImage[tok.kind];
>       retval += " "";
>       retval += add_escapes(tok.image);
>       retval += "" ";
>
> Would others see this as an improvement?
>
> TimP
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
> For additional commands, e-mail: users-helpjavacc.dev.java.net
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
For additional commands, e-mail: users-helpjavacc.dev.java.net


Re: Parse Exception
user name
2007-07-16 10:32:04
May be improve the code generation to pass in the line/col
where the token
definition of the matched token occurs (in addition to the
kind).

Sreeni.

> I would see that as an improvement, particularly since
I have
> encountered similar error messages. However, keep in
mind that not
> all tokens need be named, which may complicate things a
bit.
>
> Nathan
>
>
> On Jul 16, 2007, at 9.02, TimP wrote:
>
>> Hi,
>>
>> The ParseException can result in the infuriating
message
>>
>> Encountered "V" at line 1, column 29.
>> Was expecting one of:
>>     <NUMBER> ...
>>     "V" ...
>>     "C" ...
>>     "X" ...
>>     "D" ...
>>     "N" ...
>>     "S" ...
>>     "T" ...
>>     "M" ...
>>
>>
>> This can be easily modified to produce the less
infuriating message:
>>
>> ParseException: Encountered  <IDENTIFIER>
"V" at line 1, column 29.
>> Was expecting one of:
>>     <NUMBER> ...
>>     "V" ...
>>     "C" ...
>>     "X" ...
>>     "D" ...
>>     "N" ...
>>     "S" ...
>>     "T" ...
>>     "M" ...
>>
>> by the addition of the following to the generated
ParseException:
>>
>>       retval += " " +
tokenImage[tok.kind];
>>       retval += " "";
>>       retval += add_escapes(tok.image);
>>       retval += "" ";
>>
>> Would others see this as an improvement?
>>
>> TimP
>>
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
>> For additional commands, e-mail: users-helpjavacc.dev.java.net
>>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
> For additional commands, e-mail: users-helpjavacc.dev.java.net
>
>


------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
For additional commands, e-mail: users-helpjavacc.dev.java.net


Re: Parse Exception
user name
2007-07-16 10:32:04
May be improve the code generation to pass in the line/col
where the token
definition of the matched token occurs (in addition to the
kind).

Sreeni.

> I would see that as an improvement, particularly since
I have
> encountered similar error messages. However, keep in
mind that not
> all tokens need be named, which may complicate things a
bit.
>
> Nathan
>
>
> On Jul 16, 2007, at 9.02, TimP wrote:
>
>> Hi,
>>
>> The ParseException can result in the infuriating
message
>>
>> Encountered "V" at line 1, column 29.
>> Was expecting one of:
>>     <NUMBER> ...
>>     "V" ...
>>     "C" ...
>>     "X" ...
>>     "D" ...
>>     "N" ...
>>     "S" ...
>>     "T" ...
>>     "M" ...
>>
>>
>> This can be easily modified to produce the less
infuriating message:
>>
>> ParseException: Encountered  <IDENTIFIER>
"V" at line 1, column 29.
>> Was expecting one of:
>>     <NUMBER> ...
>>     "V" ...
>>     "C" ...
>>     "X" ...
>>     "D" ...
>>     "N" ...
>>     "S" ...
>>     "T" ...
>>     "M" ...
>>
>> by the addition of the following to the generated
ParseException:
>>
>>       retval += " " +
tokenImage[tok.kind];
>>       retval += " "";
>>       retval += add_escapes(tok.image);
>>       retval += "" ";
>>
>> Would others see this as an improvement?
>>
>> TimP
>>
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
>> For additional commands, e-mail: users-helpjavacc.dev.java.net
>>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
> For additional commands, e-mail: users-helpjavacc.dev.java.net
>
>


------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribejavacc.dev.java.net
For additional commands, e-mail: users-helpjavacc.dev.java.net


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )