thank for explanation. Now I see why I could not get it working.
The problem with "/" as pattern is that / is also division sign. Compare
letters. For test2 type of expressions, even patters like
/[a-zA-Z0-9\?......]+/ might not work correctly.
colouring will apply to both / and what is inside /.../ . Would be that OK?
any example with such a colour manipulation inside found pattern...
Post by Olivier SessinkSorry for my late reply, I was very busy the last days.
I think I understand the issue. Your pattern makes the DFA engine go into
a separate path of states after it encounters =+-\*. It will then scan for
spacing until it encounters a /. If it encounters something else than a /,
there is no match, so it will reset the DFA state to the startstate of the
context.
So if you have the text "a=1;" it will reset to the startstate *after* it
has encountered the '1'. So the 1 is not scanned, the scanning resumes at
';'. And thus the text 1 is not detected as 'js-value'.
So this pattern concept what you use cannot be used in Bluefish,
essentially because we use a pure DFA implementation, without lookahead or
lookbehind or backtracking. Very fast but limited if you want to use these
kind of constructions....
Can we in some way create a pattern that starts at the first '/' character?
Olivier
Olivier,
please find attached test file (which was prepared by Ur Balazs). I added
number of regex expressions at the end of the file.
I also including my latest versions of lang definitions I am complaining
about, which generally highlights regex correctly, but introduces other
issues: note colouring of objects and constants after '= '. Hopefully with
more debugging output we will be able to find the cause.
Andrius
On Sun, Aug 24, 2014 at 10:51 PM, Olivier Sessink <
Post by Andrius RinkeviciusOlivier,
I already made too many promises for code fixing, one more would be
difficult to me.
At the moment I am trying to crack regex highlighting (there are also
more issues) in javascript bflang2 files. I fixed most of issues, like
correct highlighting of
document.location.search.match(/module=([a-zA-Z0-9_]*)/)) ? tmp[1] : '';
and so on.
There is one pattern that still do not works, like
var test = /word\//; - here I am trying to search for pattern "word/".
The point is that when we have two "//" the code always selects the first
"/". I could not find the way to define context for "\/" since it can have
any context symbol. If pattern scanner would have negated lookahead
capability like /(?!/) that would solve issue.
The definition I am current using is
<element id="js.regex" pattern="(=|+|-|\*)[ #	 ]*/"
is_regex="1" highlight="js-brackets" >
<context symbols="/ ;.#	 " highlight="js-string">
<element pattern="/[gimy]*" is_regex="1" highlight="js-brackets"
ends_context="1" />
</context>
</element>
Any suggestions?
do you have some test files so I can see the working and non-working
examples?
(this reminds me that we should really start to collect test-files in
subversion, so we can test various language files before release)
Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/