|Backslashes as line ending characters [message #1045133]
||Fri, 19 April 2013 20:44
| Brad Riching
Registered: May 2012
Greetings Xtext world,|
Is it possible to implement a language in Xtext that supports optional backslash line endings? Our legacy language needs to be able to put a backslash anywhere in the file to signal to the external compiler tools that it should continue parsing on the next line. I would eventually like to implement a formatter that adds these backslash line endings to help organize long lines of similar data into a column.
I tried to include a backslash in the whitespace rule, which has the obvious consequence that Xtext does not care if anything comes after the backslash - it's hidden after all. I then thought I could implement a value converter for the whitespace rule and check that only a newline character exists after the backslash, but the corresponding toValue(String string, INode node) method is never called. This is probably because the whitespace rule is hidden.
I need to be able to detect the backslash character and then flag an error or warning in the editor if anything besides a newline occurs after the backslash. Does anyone know if this is possible in Xtext or could offer some advice?
Thanks in advance!
Powered by FUDForum
. Page generated in 0.02005 seconds