Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Import Antlr Lexer grammar in Xtext
Import Antlr Lexer grammar in Xtext [message #650028] Fri, 21 January 2011 13:57 Go to next message
Alexander Floh is currently offline Alexander FlohFriend
Messages: 2
Registered: January 2011
Junior Member
Hi,

first, to give you a bit of context, here's what I want to achieve:
I have an existing DSL, which has indentation based blocks. I've seen ideas floating around here to handle this with a extended character stream, which sacrifices two characters as Indent/Dedent symbols. However, I don't like that solution very much, in my opinion this is a concern which should be handled by the lexer (creating virtual tokens for indent and dedent).

So the actual question: is it possible to have Xtext import another antlr-lexer-grammar into the generated one? I've read mentions of customizing the generation step, can you give me some pointers what I would need to adapt for that?

Thanks in advance,
Alex
Re: Import Antlr Lexer grammar in Xtext [message #650221 is a reply to message #650028] Sun, 23 January 2011 11:12 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 1/21/11 2:57 PM, schrieb Alexander Floh:
> So the actual question: is it possible to have Xtext import another
> antlr-lexer-grammar into the generated one?

No, that's not possible.
However, you can exchange the generated lexer by another one by the
means of guice bindings.

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Import Antlr Lexer grammar in Xtext [message #650840 is a reply to message #650028] Wed, 26 January 2011 18:45 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Alex,

please digg into the ExternalAntlrLexerFragment and it usage in mwe2.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 21.01.11 14:57, schrieb Alexander Floh:
> Hi,
>
> first, to give you a bit of context, here's what I want to achieve:
> I have an existing DSL, which has indentation based blocks. I've seen
> ideas floating around here to handle this with a extended character
> stream, which sacrifices two characters as Indent/Dedent symbols.
> However, I don't like that solution very much, in my opinion this is a
> concern which should be handled by the lexer (creating virtual tokens
> for indent and dedent).
>
> So the actual question: is it possible to have Xtext import another
> antlr-lexer-grammar into the generated one? I've read mentions of
> customizing the generation step, can you give me some pointers what I
> would need to adapt for that?
>
> Thanks in advance,
> Alex
Re: Import Antlr Lexer grammar in Xtext [message #650911 is a reply to message #650840] Thu, 27 January 2011 07:16 Go to previous message
Alexander Floh is currently offline Alexander FlohFriend
Messages: 2
Registered: January 2011
Junior Member
Thanks, I'll try that.

-alex
Previous Topic:Converting someone else's grammar style
Next Topic:[XTEXT] Set lines containing an error to a comment automatically
Goto Forum:
  


Current Time: Sat Apr 20 03:06:03 GMT 2024

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

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

Back to the top