Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 422872

Summary: Allow case insensitive regex pattern in declarative highlight rules
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: EditorAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 5.0   
Target Milestone: 5.0 M2   
Hardware: PC   
OS: All   
Whiteboard:

Description Mark Macdonald CLA 2013-11-29 12:20:33 EST
Orion's new declarative highlighting patterns have syntax similar to this
> {
>     match: "//.*",                // can be "begin","end" for multiline patterns
>     name: "SINGLELINE_COMMENT"
> }

For convenience, it would be nice if the regular expression could be given as case-insensitive. 

This request comes by way of a forum post:
http://www.eclipse.org/forums/index.php/t/576076/
Comment 1 Mark Macdonald CLA 2014-01-10 11:35:09 EST
(In reply to Mark Macdonald from comment #0)
> This request comes by way of a forum post:
> http://www.eclipse.org/forums/index.php/t/576076/

The forum link should be
http://www.eclipse.org/forums/index.php/t/504490/#msg_num_2
Comment 2 Grant Gayed CLA 2014-01-10 13:11:49 EST
Fixed > 20140110, uses (?i).  Unlike TextMate it's not supported for specific capture groups (?i:...), only for the full match, due to JS's RegExp.  Commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=8b8c1b6b38313323add4d96c038513886e0c06ad .
Comment 3 Mark Macdonald CLA 2014-01-10 13:22:56 EST
The old textMateStyler only attempted to support "(?i)" syntax in order to consume TextMate grammars with minimal modification. If I could do it over again I'd probably allow the grammar to provide regexes as an array of [pattern, flags] in addition to a simple string, like this:
> ["foo|bar", "i"]

Any thoughts on that?
Comment 4 Grant Gayed CLA 2014-01-10 14:04:12 EST
(In reply to Mark Macdonald from comment #3)

I'm not opposed to the alternative syntax, but think that it could infer something that's not supported.  As a plug-in writer seeing it I would likely assume that any set of valid RegExp flags could be given as the second arg, but allowing this would cause problems (match/begin/end matches should not span multiple lines, 'y' would likely cause matches to be missed).  So the doc for this arg would be "the flags to create the RegExp with, but can only be 'i'".  For this reason I'm a bit hesitant.