0
votes

Is it possible to create grammar with multilingual keywords? I'm implementing a dsl language with over 100 keywords, which have to be translated in multiple languages. Is there a way to achieve that with XText? Below is an example of the dsl. The first line describes the keyword language. The second and the third line are examples of keywords in english and german

..language english 
.help 'index.html'
.select '1_2'

..language german 
.hilfe 'index.html'
.hole '1_2'

The dsl grammar is already defined and there are already files in different languages. Thus I have to create the editor and cannot change the grammar and the keywords.

1

1 Answers

0
votes

What you ask for is certainly possible with Xtext. You can use a custom lexer yet have to make sure that you produce the very same token types as the original lexer does. You may want to check out the org.eclipse.xtext.generator.parser.antlr.ex.ExternalAntlrLexerFragment.