1

I'm currently creating a language with a friend and I would like to provide a highlighting for it in jEdit. It's syntax is actually quite simple. The functions can only match this pattern: $function_name(arguments)

Note that our parser is currently working without closing tag like the C-style semi-column and that we would like to keep this feature.

I created my jEdit mode and (almost) succeeded in highligting my pattern with <SPAN_REGEXP>. Here's how I did it:

<SPAN_REGEXP HASH_CAR="\$" TYPE="KEYWORD3" DELEGATE="ARGS">

<BEGIN>\$[A-Za_z0-9_]*\s*\(</BEGIN>

<END>)</END>

</SPAN_REGEXP>

But It's not good enough.

Here's what I would like:

  • Same color for the entire function skeleton : $func( )
  • Special highlighting (already defined within the ARGS rules set) for %content1% in $func(%content1%)
  • No highlighting for brackets not following a $func
  • Authorize alternative multiline syntax like

$func

(

args

)

which is for now not highlighted. I guessed I needed to change my <BEGIN> regexp to accept newlines, but it seems that jEdit is unable to match multiline regexp for highlighting although he does it perfectly for search&replace !

I tried the (?s) and (?m) flags, the [\d\D]* workaround, even [\r\n]* but it never works.

So, here are my questions:

  • Does anyone know how to match multiline regexp in jEdit modes <SPAN_REGEXP> ?
  • If not, does anyone have any idea how to do what I need ?
Romain360
  • 282
  • 1
  • 4
  • 11
  • At the risk of stating the obvious, have you looked at the other editing modes that come with jedit in the `modes` directory? I wish you the best on `span_regexp`. I wrested with that construct and lost, so I can't be of help to you. Sry. – Ross Rogers Aug 19 '11 at 16:19
  • Thanks for your answer ! Yes I did. Found nothing interesting :/ – Romain360 Aug 19 '11 at 22:47

1 Answers1

1

As stated in the help, the SPAN_REGEXP does not support multi-line regexes. You can of course specify multi-line regexes, but they are only checked against individual lines and thus will then never match. You could post a Feature Request to the Feature Request Tracker of jEdit though if there is none for it yet.

Vampire
  • 35,631
  • 4
  • 76
  • 102