jEdit Community - Resources for users of the jEdit Text Editor
mode with line continuation
Submitted by captainhunt on Monday, 16 September, 2013 - 16:27
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
but
  • create_curve should have the options -name, -dataset, -axisX and -axisY
I can acomplish this with
<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

Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
I cannot believe that nobody
by captainhunt on Wed, 23/10/2013 - 14:49
I cannot believe that nobody has run into a similar problem with line continuation before? Puzzled

Gergoe
User login
Browse archives
« September 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   98100
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17480
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300