Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » IMP » IMP LPG editor syntax errors on %options declarations
IMP LPG editor syntax errors on %options declarations [message #485190] Thu, 10 September 2009 18:55 Go to next message
Brian Payton is currently offline Brian PaytonFriend
Messages: 152
Registered: July 2009
Senior Member
Hi,

I'm starting to use the IMP LPG source editor, and I noticed the editor
shows syntax errors on certain input that LPG accepts, particularly in
the %options declarations. Here's the lines showing errors, plus the
error messages.

Line:
%options action=("DB2ZQueryParser.java", "/.", "./")
Error:
Multiple messages: misplaced construct(s): "ERROR_TOKEN" {0} is
invalid: "%options action" {0}
expected after this token: "DISJOINTPREDECESSORSETS_KEY"

Line:
%options ParseTable=%options ParseTable=lpg.lpgjavaruntime.ParseTable
(Note: this options line doesn't make much sense to me, so it might be
an error in the source file. However LPG doesn't complain about it.)
Error:
Multiple messages: {0} unexpected token(s) ignored: "ERROR_TOKEN" {0}
is invalid: "%options ParseTable=%options "

Line:
%options var=nt,automatic_ast,visitor,parent_save
Error:
{0} is invalid: "%options var"

Line:
%options or_marker='|'
Error:
{0} is invalid: "%options or_marker='"

I also noticed that the editor doesn't hilight as keywords the "no"
prefix on keywords such as "noserialize", "nogoto_default", and
"noerror-maps"

Brian Payton
SQL Tools Development
IBM
Re: IMP LPG editor syntax errors on %options declarations [message #485248 is a reply to message #485190] Thu, 10 September 2009 22:34 Go to previous messageGo to next message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Hi there,

Thanks for the bug reports!

The LPG parser generator and the LPG IDE use different parsers (even slightly
different grammars), partly since the parser generator hand-rolls its scanner,
while the IDE uses LPG itself to generate the scanner. This difference shows
up particularly for the %options directives. In theory, they should be in
perfect agreement, but obviously they're not quite.

More details below...

Brian Payton wrote:
> Hi,
>
> I'm starting to use the IMP LPG source editor, and I noticed the editor
> shows syntax errors on certain input that LPG accepts, particularly in
> the %options declarations. Here's the lines showing errors, plus the
> error messages.
>
> Line:
> %options action=("DB2ZQueryParser.java", "/.", "./")
> Error:
> Multiple messages: misplaced construct(s): "ERROR_TOKEN" {0} is
> invalid: "%options action" {0}
> expected after this token: "DISJOINTPREDECESSORSETS_KEY"

I'm looking into this.

> Line:
> %options ParseTable=%options ParseTable=lpg.lpgjavaruntime.ParseTable
> (Note: this options line doesn't make much sense to me, so it might be
> an error in the source file. However LPG doesn't complain about it.)
> Error:
> Multiple messages: {0} unexpected token(s) ignored: "ERROR_TOKEN" {0}
> is invalid: "%options ParseTable=%options "

Such a line is really two ParseTable options specifications, the first
with a bogus empty value that gets overridden by the second, which has
the value "lpg.lpgjavaruntime.ParseTable". You can safely delete the
initial "%options ParseTable=" prefix.

I don't think it really makes much sense to change the IDE parser to
accept this (erroneous) options specification. If anything, I'd argue
that we should change the parser generator to flag it as an error.

> Line:
> %options var=nt,automatic_ast,visitor,parent_save
> Error:
> {0} is invalid: "%options var"

You're right - we missed the "var" option. I'll fix that.

> Line:
> %options or_marker='|'
> Error:
> {0} is invalid: "%options or_marker='"

In this case, the grammar used by the IDE doesn't seem to permit a
quoted character. As a workaround, removing the quotes should work.
Of course, I'll fix the IDE's grammar to allow the quoting.

> I also noticed that the editor doesn't hilight as keywords the "no"
> prefix on keywords such as "noserialize", "nogoto_default", and
> "noerror-maps"

I'll have to look into this as well.

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: IMP LPG editor syntax errors on %options declarations [message #485256 is a reply to message #485190] Fri, 11 September 2009 00:36 Go to previous messageGo to next message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Brian Payton wrote:
> Hi,
>
> I'm starting to use the IMP LPG source editor, and I noticed the editor
> shows syntax errors on certain input that LPG accepts, particularly in
> the %options declarations. Here's the lines showing errors, plus the
> error messages.
>
> Line:
> %options action=("DB2ZQueryParser.java", "/.", "./")
> Error:
> Multiple messages: misplaced construct(s): "ERROR_TOKEN" {0} is
> invalid: "%options action" {0}
> expected after this token: "DISJOINTPREDECESSORSETS_KEY"

Ah, the problem in this case is the use of the shorthand "action" in
lieu of "action-block". The IDE should properly handle "action-block".
I'll check with Philippe to make sure that they really mean the same
thing, and if so, I'll augment the IDE's grammar to suit.

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: IMP LPG editor syntax errors on %options declarations [message #485456 is a reply to message #485248] Fri, 11 September 2009 18:56 Go to previous message
Brian Payton is currently offline Brian PaytonFriend
Messages: 152
Registered: July 2009
Senior Member
Thanks. I agree that the double ParseTable option should be marked as
an error in the editor.

Robert M. Fuhrer wrote:
> Hi there,
>
> Thanks for the bug reports!
>
> The LPG parser generator and the LPG IDE use different parsers (even
> slightly
> different grammars), partly since the parser generator hand-rolls its
> scanner,
> while the IDE uses LPG itself to generate the scanner. This difference
> shows
> up particularly for the %options directives. In theory, they should be in
> perfect agreement, but obviously they're not quite.
>
> More details below...
>
> Brian Payton wrote:
>> Hi,
>>
>> I'm starting to use the IMP LPG source editor, and I noticed the
>> editor shows syntax errors on certain input that LPG accepts,
>> particularly in the %options declarations. Here's the lines showing
>> errors, plus the error messages.
>>
>> Line:
>> %options action=("DB2ZQueryParser.java", "/.", "./")
>> Error:
>> Multiple messages: misplaced construct(s): "ERROR_TOKEN" {0} is
>> invalid: "%options action" {0}
>> expected after this token: "DISJOINTPREDECESSORSETS_KEY"
>
> I'm looking into this.
>
>> Line:
>> %options ParseTable=%options ParseTable=lpg.lpgjavaruntime.ParseTable
>> (Note: this options line doesn't make much sense to me, so it might be
>> an error in the source file. However LPG doesn't complain about it.)
>> Error:
>> Multiple messages: {0} unexpected token(s) ignored: "ERROR_TOKEN"
>> {0} is invalid: "%options ParseTable=%options "
>
> Such a line is really two ParseTable options specifications, the first
> with a bogus empty value that gets overridden by the second, which has
> the value "lpg.lpgjavaruntime.ParseTable". You can safely delete the
> initial "%options ParseTable=" prefix.
>
> I don't think it really makes much sense to change the IDE parser to
> accept this (erroneous) options specification. If anything, I'd argue
> that we should change the parser generator to flag it as an error.
>
>> Line:
>> %options var=nt,automatic_ast,visitor,parent_save
>> Error:
>> {0} is invalid: "%options var"
>
> You're right - we missed the "var" option. I'll fix that.
>
>> Line:
>> %options or_marker='|'
>> Error:
>> {0} is invalid: "%options or_marker='"
>
> In this case, the grammar used by the IDE doesn't seem to permit a
> quoted character. As a workaround, removing the quotes should work.
> Of course, I'll fix the IDE's grammar to allow the quoting.
>
>> I also noticed that the editor doesn't hilight as keywords the "no"
>> prefix on keywords such as "noserialize", "nogoto_default", and
>> "noerror-maps"
>
> I'll have to look into this as well.
>
Re: IMP LPG editor syntax errors on %options declarations [message #576506 is a reply to message #485190] Thu, 10 September 2009 22:34 Go to previous message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Hi there,

Thanks for the bug reports!

The LPG parser generator and the LPG IDE use different parsers (even slightly
different grammars), partly since the parser generator hand-rolls its scanner,
while the IDE uses LPG itself to generate the scanner. This difference shows
up particularly for the %options directives. In theory, they should be in
perfect agreement, but obviously they're not quite.

More details below...

Brian Payton wrote:
> Hi,
>
> I'm starting to use the IMP LPG source editor, and I noticed the editor
> shows syntax errors on certain input that LPG accepts, particularly in
> the %options declarations. Here's the lines showing errors, plus the
> error messages.
>
> Line:
> %options action=("DB2ZQueryParser.java", "/.", "./")
> Error:
> Multiple messages: misplaced construct(s): "ERROR_TOKEN" {0} is
> invalid: "%options action" {0}
> expected after this token: "DISJOINTPREDECESSORSETS_KEY"

I'm looking into this.

> Line:
> %options ParseTable=%options ParseTable=lpg.lpgjavaruntime.ParseTable
> (Note: this options line doesn't make much sense to me, so it might be
> an error in the source file. However LPG doesn't complain about it.)
> Error:
> Multiple messages: {0} unexpected token(s) ignored: "ERROR_TOKEN" {0}
> is invalid: "%options ParseTable=%options "

Such a line is really two ParseTable options specifications, the first
with a bogus empty value that gets overridden by the second, which has
the value "lpg.lpgjavaruntime.ParseTable". You can safely delete the
initial "%options ParseTable=" prefix.

I don't think it really makes much sense to change the IDE parser to
accept this (erroneous) options specification. If anything, I'd argue
that we should change the parser generator to flag it as an error.

> Line:
> %options var=nt,automatic_ast,visitor,parent_save
> Error:
> {0} is invalid: "%options var"

You're right - we missed the "var" option. I'll fix that.

> Line:
> %options or_marker='|'
> Error:
> {0} is invalid: "%options or_marker='"

In this case, the grammar used by the IDE doesn't seem to permit a
quoted character. As a workaround, removing the quotes should work.
Of course, I'll fix the IDE's grammar to allow the quoting.

> I also noticed that the editor doesn't hilight as keywords the "no"
> prefix on keywords such as "noserialize", "nogoto_default", and
> "noerror-maps"

I'll have to look into this as well.

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: IMP LPG editor syntax errors on %options declarations [message #576518 is a reply to message #485190] Fri, 11 September 2009 00:36 Go to previous message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Brian Payton wrote:
> Hi,
>
> I'm starting to use the IMP LPG source editor, and I noticed the editor
> shows syntax errors on certain input that LPG accepts, particularly in
> the %options declarations. Here's the lines showing errors, plus the
> error messages.
>
> Line:
> %options action=("DB2ZQueryParser.java", "/.", "./")
> Error:
> Multiple messages: misplaced construct(s): "ERROR_TOKEN" {0} is
> invalid: "%options action" {0}
> expected after this token: "DISJOINTPREDECESSORSETS_KEY"

Ah, the problem in this case is the use of the shorthand "action" in
lieu of "action-block". The IDE should properly handle "action-block".
I'll check with Philippe to make sure that they really mean the same
thing, and if so, I'll augment the IDE's grammar to suit.

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: IMP LPG editor syntax errors on %options declarations [message #576541 is a reply to message #485248] Fri, 11 September 2009 18:56 Go to previous message
Brian Payton is currently offline Brian PaytonFriend
Messages: 152
Registered: July 2009
Senior Member
Thanks. I agree that the double ParseTable option should be marked as
an error in the editor.

Robert M. Fuhrer wrote:
> Hi there,
>
> Thanks for the bug reports!
>
> The LPG parser generator and the LPG IDE use different parsers (even
> slightly
> different grammars), partly since the parser generator hand-rolls its
> scanner,
> while the IDE uses LPG itself to generate the scanner. This difference
> shows
> up particularly for the %options directives. In theory, they should be in
> perfect agreement, but obviously they're not quite.
>
> More details below...
>
> Brian Payton wrote:
>> Hi,
>>
>> I'm starting to use the IMP LPG source editor, and I noticed the
>> editor shows syntax errors on certain input that LPG accepts,
>> particularly in the %options declarations. Here's the lines showing
>> errors, plus the error messages.
>>
>> Line:
>> %options action=("DB2ZQueryParser.java", "/.", "./")
>> Error:
>> Multiple messages: misplaced construct(s): "ERROR_TOKEN" {0} is
>> invalid: "%options action" {0}
>> expected after this token: "DISJOINTPREDECESSORSETS_KEY"
>
> I'm looking into this.
>
>> Line:
>> %options ParseTable=%options ParseTable=lpg.lpgjavaruntime.ParseTable
>> (Note: this options line doesn't make much sense to me, so it might be
>> an error in the source file. However LPG doesn't complain about it.)
>> Error:
>> Multiple messages: {0} unexpected token(s) ignored: "ERROR_TOKEN"
>> {0} is invalid: "%options ParseTable=%options "
>
> Such a line is really two ParseTable options specifications, the first
> with a bogus empty value that gets overridden by the second, which has
> the value "lpg.lpgjavaruntime.ParseTable". You can safely delete the
> initial "%options ParseTable=" prefix.
>
> I don't think it really makes much sense to change the IDE parser to
> accept this (erroneous) options specification. If anything, I'd argue
> that we should change the parser generator to flag it as an error.
>
>> Line:
>> %options var=nt,automatic_ast,visitor,parent_save
>> Error:
>> {0} is invalid: "%options var"
>
> You're right - we missed the "var" option. I'll fix that.
>
>> Line:
>> %options or_marker='|'
>> Error:
>> {0} is invalid: "%options or_marker='"
>
> In this case, the grammar used by the IDE doesn't seem to permit a
> quoted character. As a workaround, removing the quotes should work.
> Of course, I'll fix the IDE's grammar to allow the quoting.
>
>> I also noticed that the editor doesn't hilight as keywords the "no"
>> prefix on keywords such as "noserialize", "nogoto_default", and
>> "noerror-maps"
>
> I'll have to look into this as well.
>
Previous Topic:Missing lpg Fragment
Next Topic:Missing lpg Fragment
Goto Forum:
  


Current Time: Fri Dec 19 15:13:30 GMT 2014

Powered by FUDForum. Page generated in 0.02220 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software