Right now, when you hit ^G, utomatch tries to ignore comments and strings, but its parsing is limited. It doesn't always work properly, as in bug 2220030. This patch allows utomatch to query the syntax highlighter to determine what is a comment or string.
Each highlighter needs context annotations in order to work for that language. I updated c.jsf, python.jsf, and sh.jsf with the context annotations. Eventually, the other languages could use context annotations, but it is not urgent. The others will still use -pound_comment et al.
In addition to the functional changes, I consolidated code from utomatch and tomatch_word in order to reduce a substantial amount of code duplication.
This patch is on top of patch 3459248.
By the way, in this patch, I distinguish between "double_quoted" strings and "single_quoted" strings. Do you think that is desirable, or should they just be "string"s?
Also in the patch, single-quoted strings are only ignored if the -single_quoted option is on, and similarly for double-quoted strings. If -highlighter_context is on, should ^G ignore all strings independent of whether the -single_quoted or -no_double_quoted options are on?
Woohoo! Development activity on JOE!
I refreshed this patch against [7eae68]. It is a fix for bug [#245]. I changed it to not distinguish between single-quoted and double-quoted strings. It also contains patches [#103], [#104], and [#105]. Other freebies in this patch:
Related
Bugs:
#245Patches: #103
Patches: #104
Patches: #105
Commit: [7eae68]
test cases
Thanks for the patch, Charles. I've committed some of those fixes in [e41dd4] and then some more that I missed in [034935]. For a change of this magnitude (file formats), I'd like to get jhallen's approval before proceeding.
But, I've looked at this a bit and come up with a few points...
Lastly, I've attached the updated patch sans what's been committed (through [034935]), plus a small (related) fix to sh.jsf.
Related
Bugs:
#245Commit: [034935]
Commit: [e41dd4]
I applied this patch to mercurial..
I found one bug: it would segfault if highlight_context is enabled, a syntax is defined but highlighting is disabled (so there is no line attribute database and you get a NULL pointer dereference). I fixed this by reverting to the built-in heuristics if highlighting is disabled, but maybe it would better to parse the file the first time you hit Ctrl-G.
Also still thinking if it's a good idea to automatically enable highlight_context if the syntax file is annotated.