Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Embedding ANTLR3 Island Parser in Xtext
Embedding ANTLR3 Island Parser in Xtext [message #1765462] Fri, 09 June 2017 19:16 Go to next message
Justin Szaday is currently offline Justin SzadayFriend
Messages: 2
Registered: June 2017
Junior Member
I am working on converting a grammar from ANTLR3 to Xtext. The ANTLR3 grammar uses an 'island parser' for a certain rule, I will refer to them as CustomLexer and customRule. In ANTLR3, this looks like:

customRule
  @init { CommonTree custom = null; }
  : PREFIX { custom = invokeCustomLexer(); } -> ^( {custom} )
  ;

Where invokeCustomLexer() is a function that invokes the CustomLexer at the current position in the stream and then shifts the stream to the position it returns after it completes.

It does not seem like there is a good way to convert this rule to Xtext since it does not appear to support inline ANTLR. Is there a way I can either have an automated task append this rule to the or otherwise append/embed this code in/to the generated ANTLR? Any help here would be greatly appreciated.

Yes, island parsers are bad and I do not like them whatsoever but given the structure of the language and the need for legacy support, there is simply no way around using one in this context.
Re: Embedding ANTLR3 Island Parser in Xtext [message #1766092 is a reply to message #1765462] Thu, 15 June 2017 15:10 Go to previous message
Justin Szaday is currently offline Justin SzadayFriend
Messages: 2
Registered: June 2017
Junior Member
Anyone have any insights here? Sorry to bump the post, it just seems like the forums are relatively active so this may have gotten passed over.
Previous Topic:Trouble with a JvmModelInferrer using Maven
Next Topic:language server output directory and builds
Goto Forum:
  


Current Time: Sun Jun 04 20:23:59 GMT 2023

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

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

Back to the top