Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [XTEXT] Set lines containing an error to a comment automatically
[XTEXT] Set lines containing an error to a comment automatically [message #650944] Thu, 27 January 2011 04:14
Sascha Vetter is currently offline Sascha Vetter
Messages: 1
Registered: January 2011
Junior Member
Hi all,

I'm trying to transform a report file into my personal language and every unknown input should be transformed to a comment in the new document. In the report file every line is one command. For example, if the input looks like:

Quote:

Initialize
Action xyz
Wait 500 ms
Main action finished



The output should be:

Quote:

"Block - Initialize"
// Action xyz
Process wait 500 milliseconds.
// Main action finished



My first idea was to generate a state which handles all the unknown lines, e.g.:

Quote:

Model:
'Initialize' EOF
(initCommands+=AbstractCommand)*;

AbstractCommand: WaitTime | Misc;

WaitTime : 'Process wait' value=BigDecimalType unit=TimeUnit EOF;

Misc : line=LINE;

terminal LINE : !('\n'|'\r')* ('\r'? '\n')?;



But the result doesn't satisfy me. There are several problems with the editor (e.g. if the "Misc" line starts with a known word) and the transformation to the new language is buggy too.

Are there any ideas/examples how to handle such a problem (maybe a quick fix which sets all the lines containing an error to a comment)?
Previous Topic:Import Antlr Lexer grammar in Xtext
Next Topic:Need suggestion on how to create unique ids for tokens (or rules)
Goto Forum:
  


Current Time: Mon May 20 20:50:01 EDT 2013

Powered by FUDForum. Page generated in 0.02374 seconds