mode with line continuation
Submitted by Monday, 16 September, 2013 - 16:27
on
Hi mode writers,
I am trying to implement a jedit mode for a tcl like language and am missing a good way to deal with line continuation.
The command syntax is roughly:
command -option1 arg1 -option2 arg2...E.g.
create_variable -name Vg -dataset Data -function "<v:Data>" create_curve -name IVref($P) -dataset Data -axisX "Vg" -axisY "Id"I'd like to provide a bit context sensitivity in the mode, meaning each command should have its on set of valid options. So in above example
- create_variable should have the options -name, -dataset and -function
- create_curve should have the options -name, -dataset, -axisX and -axisY
<EOL_SPAN_REGEXP TYPE="KEYWORD1" DELEGATE="CREATE_VARIABLE">create_variable(?=.*)</EOL_SPAN_REGEXP>and dealing with the options in separate rules.
So far so good, but as the commands typically get pretty long, users typically use line continuation backslash just as common in tcl.
create_variable -name Vg -dataset Data \ -function "<v:Data>" create_curve -name IVref($P) -dataset Data \ -axisX "Vg" -axisY "Id"This of course immediately kills EOL_REGEXP. I tried various other approaches with SEQ... However, it is very hard to keep the right context for the options, without breaking anything else.
I have the feeling that a RULE option LINE_CONTINUATION_CHAR="\" that if present as last char on the line, concatenates the current line with the next line, before further parsing, would be the only way to go here.
Any hints, ideas appreciated
Best regards
Gergoe