grammar scope: Embedded (inline) code
wion opened this issue · comments
There is a problem with the existing grammar scope for inline code (i.e. @code@
). For the most part it works, but it you happen to use something like follows:
". . . some para text, with a @1@
, and some more text, and then a @3@
, and some more text . . ."
The regular expression reads the two instances of code as a single instance wrapped by the outer most ampersands...
". . . some para text, with a @1@, and some more text, and then a @3@
, and some more text . . ."
This only happens if the single characters are integers, like if indicating attribute values, or whatever.
This regex seems to work better in the grammar: ((?=@)\S.+?\S(?<=@))
. It eliminates the faulty capture across two instances of embedded code having single digits.
The associated grammar entry:
{ name = 'markup.code.textile';
match = '((?=@)\S.+?\S(?<=@))';
},
The only problem noticed so far is in the rare case you might be writing about regular expressions and use a Textile code example like this, @\s(@(\S.+?\S|\S)@)\s
@, it will appear captured like this: @\s(@
(\S.+?\S|\S)@)\s@
.
What are the odds of you ever writing about regular expressions?