Skip to content

Commit 0fc2278

Browse files
committed
[textmate] Fix multiline arithmetic operations and regex string collisions
1 parent 99b7ad5 commit 0fc2278

2 files changed

Lines changed: 31 additions & 10 deletions

File tree

syntaxes/ruby.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
]
430430
},
431431
{
432-
"begin": "(?x)\n(?<![\\w)])((/))(?![?*+])\n(?=\n (?:\\\\/|[^/])*+ # Do NOT change the order\n /[eimnosux]*\\s*\n (?:\n [)\\]}#.,?:]|\\|\\||&&|<=>|=>|==|=~|!~|!=|;|$|\n if|else|elsif|then|do|end|unless|while|until|or|and\n )\n |\n $\n)",
432+
"begin": "(?x)\n (?:\n ^ # beginning of line\n |\n (?<= # or look-behind on:\n [=>~(?:\\[,|&;]\n | [\\s;]if\\s # keywords\n | [\\s;]elsif\\s\n | [\\s;]while\\s\n | [\\s;]unless\\s\n | [\\s;]when\\s\n | [\\s;]assert_match\\s\n | [\\s;]or\\s # boolean operators\n | [\\s;]and\\s\n | [\\s;]not\\s\n | [\\s.]index\\s # methods\n | [\\s.]scan\\s\n | [\\s.]sub\\s\n | [\\s.]sub!\\s\n | [\\s.]gsub\\s\n | [\\s.]gsub!\\s\n | [\\s.]match\\s\n )\n |\n (?<= # or a look-behind with line anchor:\n ^when\\s # duplication necessary due to limits of regex\n | ^if\\s\n | ^elsif\\s\n | ^while\\s\n | ^unless\\s\n )\n )\n \\s*((\\/))(?![*+{}?]) # match a forward slash not followed by quantifiers",
433433
"captures": {
434434
"1": {
435435
"name": "string.regexp.interpolated.ruby"

syntaxes/yamls/ruby.tmLanguage.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,38 @@ patterns:
322322
- include: '#escaped_char'
323323
- begin: |-
324324
(?x)
325-
(?<![\w)])((/))(?![?*+])
326-
(?=
327-
(?:\\/|[^/])*+ # Do NOT change the order
328-
/[eimnosux]*\s*
329325
(?:
330-
[)\]}#.,?:]|\|\||&&|<=>|=>|==|=~|!~|!=|;|$|
331-
if|else|elsif|then|do|end|unless|while|until|or|and
326+
^ # beginning of line
327+
|
328+
(?<= # or look-behind on:
329+
[=>~(?:\[,|&;]
330+
| [\s;]if\s # keywords
331+
| [\s;]elsif\s
332+
| [\s;]while\s
333+
| [\s;]unless\s
334+
| [\s;]when\s
335+
| [\s;]assert_match\s
336+
| [\s;]or\s # boolean operators
337+
| [\s;]and\s
338+
| [\s;]not\s
339+
| [\s.]index\s # methods
340+
| [\s.]scan\s
341+
| [\s.]sub\s
342+
| [\s.]sub!\s
343+
| [\s.]gsub\s
344+
| [\s.]gsub!\s
345+
| [\s.]match\s
346+
)
347+
|
348+
(?<= # or a look-behind with line anchor:
349+
^when\s # duplication necessary due to limits of regex
350+
| ^if\s
351+
| ^elsif\s
352+
| ^while\s
353+
| ^unless\s
354+
)
332355
)
333-
|
334-
$
335-
)
356+
\s*((\/))(?![*+{}?]) # match a forward slash not followed by quantifiers
336357
captures:
337358
'1':
338359
name: string.regexp.interpolated.ruby

0 commit comments

Comments
 (0)