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

Bug 408368

Summary: [textmatestyler] Regex that uses combined global flags like (?ix) will break the styler
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: Project Inbox <orion.client-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2013-05-17 16:53:01 EDT
1. Take this file
https://github.com/pvl/abap.tmbundle/blob/master/Syntaxes/ABAP.tmLanguage
2. Convert it to a JSON grammar using the TextMate-to-Orion grammar converter
( http://mamacdon.github.io/tools/grammar/ )
3. Put it into a plugin with an orion.edit.highlighter service extension with the service properties:
>  type: "grammar", 
>  fileTypes: ["abap"]
4. Install the plugin you created
5. Create a .abap file, and try to type in it
6. Styler throws an exception and breaks the editor

For example one problematic regex is
> (?ix)\s(string|xstring|any|c|n|i|p|f|d|t|x)(?=\s|\.)
> ^^^^^ 
> this part

The TextMateStyler has extremely naive support for global flags. It can only deal with them if they appear individually, not combined, and (?x) must appear before (?i) -- yes, really. So this equivalent regex will be accepted by the styler:

> (?x)(?i)\s(string|xstring|any|c|n|i|p|f|d|t|x)(?=\s|\.)

The treatment of global flags should be fixed.
Comment 1 John Arthorne CLA 2015-05-05 14:43:22 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:

https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html