Menu

#592 Patch for groovy mode

None
closed-accepted
None
5
2017-03-19
2016-09-06
No

Problem:
Regular expressions in Groovy break highlighting.
For example, see the following code that would be highlighted incorrectly:

def matcher = s =~ /\'([a-zA-Z_]+)\'/
if (matcher.size()==0) {
println "Skipping line $lno: $t"
} else {
result.add(matcher[0][1]);
}

Fix:
Regexp delimiters should be added to "groovy.xml":

<SPAN TYPE="LITERAL1" ESCAPE="\\">
<BEGIN>/</BEGIN>
<END>/</END>
</SPAN>

1 Attachments

Discussion

  • Egor Abramovich

    Egor Abramovich - 2016-09-14

    Just noticed that the patch above breaks one-line comments. This should be handled the same way as in JavaScript. Patch should be

    <EOL_SPAN TYPE="COMMENT1">//</EOL_SPAN>

    <SEQ_REGEXP TYPE="MARKUP" HASH_CHAR="/" AT_WORD_START="TRUE">/[^\p{Blank}]*?/</SEQ_REGEXP>

     
  • Alan Ezust

    Alan Ezust - 2017-03-19
    • status: open --> closed-accepted
    • assigned_to: Alan Ezust
    • Group: -->
     
  • Alan Ezust

    Alan Ezust - 2017-03-19

    Committed 24658

     

Log in to post a comment.