@@ -27,8 +27,10 @@ variables:
27
27
lookBehindTypeof : ' ^typeof|{{nonPropertyLookBehind}}typeof'
28
28
lookBehindCase : ' ^case|{{nonPropertyLookBehind}}case'
29
29
matchingParenthesis : (\([^\(\)]*\))
30
+ matchingBraces : (\{[^\{\}]*\})
31
+ matchingBrackets : (\[[^\[\]]*\])
30
32
# Identifier start | matching braces | matching parenthesis | matching square brackets
31
- typeParamersStart : ([_$[:alpha:]]|(\{[^\{\}]*\}) |{{matchingParenthesis}}|(\[[^\[\]]*\]) )
33
+ typeParamersStart : ([_$[:alpha:]]|{{matchingBraces}} |{{matchingParenthesis}}|{{matchingBrackets}} )
32
34
typeParameters : (<\s*{{typeParamersStart}}([^=<>]|=[^<]|\<\s*{{typeParamersStart}}([^=<>]|=[^<])*\>)*>\s*)
33
35
# Identifier start | matching braces | matching parenthesis | matching square brackets | matching strings
34
36
typeArgumentsStart : ({{typeParamersStart}}|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))
@@ -40,19 +42,19 @@ variables:
40
42
(
41
43
[(]\s*
42
44
(
43
- ([)]\s*:) | # ():
44
- ((\.\.\.\s*)?{{identifier}}\s*:) # [(]param: | [(]...param:
45
+ ([)]\s*:) | # ():
46
+ ((\.\.\.\s*)?{{identifier}}\s*:) # [(]param: | [(]...param:
45
47
)
46
48
) |
47
49
(
48
- [<]\s*{{identifier}}\s+extends\s*[^=>] # < typeparam extends
50
+ [<]\s*{{identifier}}\s+extends\s*[^=>] # < typeparam extends
49
51
) |
50
52
# arrow function possible to detect only with => on same line
51
53
(
52
- {{typeParameters}}? # typeparameters
53
- \(\s*([_$[:alpha:]\{\[] ([^()]|\((\s*[^()] *)?\))*)?\) # parameteres
54
- (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
55
- \s*=> # arrow operator
54
+ {{typeParameters}}? # typeparameters
55
+ \(\s*(( [_$[:alpha:]]|{{matchingBraces}}|{{matchingBrackets}}) ([^()]|{{matchingParenthesis}}) *)?\) # parameters
56
+ (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type
57
+ \s*=> # arrow operator
56
58
)
57
59
functionOrArrowLookup : |-
58
60
\s*(
0 commit comments