Re: [JavaCC-Dev] Wrong line/column number reported in javacc error message

View: New views
3 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [JavaCC-Dev] Wrong line/column number reported in javacc error message

by Paul Cager-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, June 16, 2008 10:40, Stefan Hong wrote:

> Hi,
>
> I am using JavaCC with JJTree, it seems that the grammar errors
> reported by JavaCC frequently points to the wrong position in the
> source code. I am aware that the line/column numbers refer to the
> original *.jjt file instead of *.jj file generated by JJTree, but in
> my grammar, it is completely off (points to empty line etc). I can't
> reproduce this problem in smaller grammar file, but it happens
> regularly in grammar that I am working on,  making it very hard to
> debug.  A quick search through the issue database doesn't find
> anything related... am I doing anything wrong? Has anyone encountered
> similar problems?
>
>
> Thanks,
> Stefan

Hi Stefan,

Thanks for your email.

This is a known problem in JavaCC 4.0 (see issue
https://javacc.dev.java.net/issues/show_bug.cgi?id=80), and has been fixed
in release 4.1. (By default the "Issue List" does not display issues that
have been fixed in CVS).

There is a beta version of 4.1 available for download (see
https://javacc.dev.java.net/servlets/ProjectDocumentList). I'd be
interested to know if 4.1 fixes your problem.

Thanks,
Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


An unreachable error

by aaron792 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi, all!
I am writing a .jj file. The function is:
 
void Start():{}{
(
          LOOKAHEAD(3)
// Only do someting when sequence  <A><B><D> and <A><C><D> appear
<A>{do something} <B>{do something} <D>{do something}
|
<A>{do something} <C>{do something} <D>{do something}
|
      <B>{do nothing}
|
<C>{do nothing}
|
      <D>{do nothing}
|
<A>{do nothing}
)*
}
 
JavaCC compiler reports an error that <A> is unreachable.
But I can't see why it is unreachable, because there are obvious other combinations of <A>, <B>, <C> and <D> other than <A><B><D> and <A><C><D>.
Can anyone give some hint?
Thanks!
 
Aaron
 
 

aaron792
2008-06-25

发件人: Paul Cager
发送时间: 2008-06-16 22:27:00
收件人: dev@...; Stefan Hong
抄送: users@...
主题: [JavaCC] Re: [JavaCC-Dev] Wrong line/column number reported in javacc errormessage
 
On Mon, June 16, 2008 10:40, Stefan Hong wrote:
> Hi,
>
> I am using JavaCC with JJTree, it seems that the grammar errors
> reported by JavaCC frequently points to the wrong position in the
> source code. I am aware that the line/column numbers refer to the
> original *.jjt file instead of *.jj file generated by JJTree, but in
> my grammar, it is completely off (points to empty line etc). I can't
> reproduce this problem in smaller grammar file, but it happens
> regularly in grammar that I am working on,  making it very hard to
> debug.  A quick search through the issue database doesn't find
> anything related... am I doing anything wrong? Has anyone encountered
> similar problems?
>
>
> Thanks,
> Stefan
 
Hi Stefan,
 
Thanks for your email.
 
This is a known problem in JavaCC 4.0 (see issue
https://javacc.dev.java.net/issues/show_bug.cgi?id=80), and has been fixed
in release 4.1. (By default the "Issue List" does not display issues that
have been fixed in CVS).
 
There is a beta version of 4.1 available for download (see
https://javacc.dev.java.net/servlets/ProjectDocumentList). I'd be
interested to know if 4.1 fixes your problem.
 
Thanks,
Paul
 
 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...
 

Re: An unreachable error

by aaron792 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Very sorry for the annoyment, I fogot add an LOOKHEAD(3) command on this statement.
 
LOOKHEAD(3)
<A>{do something} <C>{do something} <D>{do something}
 

aaron792
2008-06-25

发件人: aaron792
发送时间: 2008-06-25 17:05:34
收件人: users@...
抄送: aaron792
主题: [JavaCC] An unreachable error
 
Hi, all!
I am writing a .jj file. The function is:
 
void Start():{}{
(
          LOOKAHEAD(3)
// Only do someting when sequence  <A><B><D> and <A><C><D> appear
<A>{do something} <B>{do something} <D>{do something}
|
<A>{do something} <C>{do something} <D>{do something}
|
      <B>{do nothing}
|
<C>{do nothing}
|
      <D>{do nothing}
|
<A>{do nothing}
)*
}
 
JavaCC compiler reports an error that <A> is unreachable.
But I can't see why it is unreachable, because there are obvious other combinations of <A>, <B>, <C> and <D> other than <A><B><D> and <A><C><D>.
Can anyone give some hint?
Thanks!
 
Aaron
 
 

aaron792
2008-06-25

发件人: Paul Cager
发送时间: 2008-06-16 22:27:00
收件人: dev@...; Stefan Hong
抄送: users@...
主题: [JavaCC] Re: [JavaCC-Dev] Wrong line/column number reported in javacc errormessage
 
On Mon, June 16, 2008 10:40, Stefan Hong wrote:
> Hi,
>
> I am using JavaCC with JJTree, it seems that the grammar errors
> reported by JavaCC frequently points to the wrong position in the
> source code. I am aware that the line/column numbers refer to the
> original *.jjt file instead of *.jj file generated by JJTree, but in
> my grammar, it is completely off (points to empty line etc). I can't
> reproduce this problem in smaller grammar file, but it happens
> regularly in grammar that I am working on,  making it very hard to
> debug.  A quick search through the issue database doesn't find
> anything related... am I doing anything wrong? Has anyone encountered
> similar problems?
>
>
> Thanks,
> Stefan
 
Hi Stefan,
 
Thanks for your email.
 
This is a known problem in JavaCC 4.0 (see issue
https://javacc.dev.java.net/issues/show_bug.cgi?id=80), and has been fixed
in release 4.1. (By default the "Issue List" does not display issues that
have been fixed in CVS).
 
There is a beta version of 4.1 available for download (see
https://javacc.dev.java.net/servlets/ProjectDocumentList). I'd be
interested to know if 4.1 fixes your problem.
 
Thanks,
Paul
 
 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...