|
741 | 741 | } |
742 | 742 | ] |
743 | 743 | }, |
| 744 | + "type-argument-brackets": { |
| 745 | + "patterns": [ |
| 746 | + { |
| 747 | + "comment": "Type arguments. This is complicated since we don't want to match things like foo < 123 || bar > baz", |
| 748 | + "name": "meta.type-arguments.flowtype", |
| 749 | + "begin": "\\s*+(<)(?=((?:(?>[^<>]+)|<\\g<-1>>)*)>)", |
| 750 | + "end": "\\s*(>)", |
| 751 | + "endCaptures": { |
| 752 | + "1": { "name": "punctuation.flowtype" } |
| 753 | + }, |
| 754 | + "beginCaptures": { |
| 755 | + "1": { "name": "punctuation.flowtype" } |
| 756 | + }, |
| 757 | + "patterns": [ |
| 758 | + { |
| 759 | + "include": "#flowtype-parse-types" |
| 760 | + }, |
| 761 | + { |
| 762 | + "include": "#literal-comma" |
| 763 | + } |
| 764 | + ] |
| 765 | + } |
| 766 | + ] |
| 767 | + }, |
744 | 768 | "square-brackets": { |
745 | 769 | "patterns": [ |
746 | 770 | { |
|
2146 | 2170 | "include": "#literal-keywords" |
2147 | 2171 | }, |
2148 | 2172 | { |
| 2173 | + "comment": "A new expression with no type params or arguments, like new Foo()", |
| 2174 | + "name": "meta.new-class.without-arguments.js", |
2149 | 2175 | "match": "(?<!\\.)\\s*+(\\bnew\\b)\\s*+((\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?(\\()\\s*+(\\)))", |
2150 | 2176 | "captures": { |
2151 | 2177 | "1": { |
|
2172 | 2198 | } |
2173 | 2199 | }, |
2174 | 2200 | { |
2175 | | - "begin": "(?<!\\.)\\s*+(\\bnew\\b)\\s*+((\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?(?=\\())", |
| 2201 | + "comment": "A new expression with type params and no arguments, like new Foo<string>()", |
| 2202 | + "name": "meta.new-class.without-arguments.js", |
| 2203 | + "begin": "(?<!\\.)\\s*+(\\bnew\\b)\\s*+((\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)\\s*+(\\()\\s*+(\\))))", |
| 2204 | + "end": "(?=.)", |
| 2205 | + "applyEndPatternLast": 1, |
| 2206 | + "beginCaptures": { |
| 2207 | + "1": { "name": "keyword.operator.new.js" }, |
| 2208 | + "2": { "name": "meta.function-call.without-arguments.js" }, |
| 2209 | + "3": { "name": "keyword.operator.private.js" }, |
| 2210 | + "4": { "name": "entity.name.type.instance.js" }, |
| 2211 | + "5": { "name": "keyword.operator.existential.js" } |
| 2212 | + }, |
| 2213 | + "patterns": [{ "include": "#type-argument-brackets" }, { "include": "#round-brackets" }] |
| 2214 | + }, |
| 2215 | + { |
| 2216 | + "comment": "A new expression with arguments and maybe type params, like new Foo<string>(123)", |
| 2217 | + "name": "meta.new-class.with-arguments.js", |
| 2218 | + "begin": "(?<!\\.)\\s*+(\\bnew\\b)\\s*+((\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+\\())", |
2176 | 2219 | "end": "(?=.)", |
2177 | 2220 | "applyEndPatternLast": 1, |
2178 | 2221 | "beginCaptures": { |
|
2193 | 2236 | } |
2194 | 2237 | }, |
2195 | 2238 | "patterns": [ |
| 2239 | + { |
| 2240 | + "include": "#type-argument-brackets" |
| 2241 | + }, |
2196 | 2242 | { |
2197 | 2243 | "include": "#round-brackets" |
2198 | 2244 | } |
|
2202 | 2248 | "include": "#literal-operators" |
2203 | 2249 | }, |
2204 | 2250 | { |
| 2251 | + "comment": "A call expression with no type params or arguments, like foo()", |
2205 | 2252 | "name": "meta.function-call.without-arguments.js", |
2206 | 2253 | "match": "(?<!\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?(\\()\\s*+(\\))", |
2207 | 2254 | "captures": { |
|
2223 | 2270 | } |
2224 | 2271 | }, |
2225 | 2272 | { |
2226 | | - "comment": "maybe in array form e.g. foo[bar]()", |
| 2273 | + "comment": "A call expression with type params and no arguments, like foo<string>()", |
2227 | 2274 | "name": "meta.function-call.without-arguments.js", |
2228 | | - "begin": "(?<!\\.)\\s*+((\\bnew\\b)*)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)(?=\\s*(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*+\\(\\s*+\\))", |
| 2275 | + "begin": "(?<!\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)\\s*+(\\()\\s*+(\\)))", |
| 2276 | + "end": "(?=.)", |
| 2277 | + "applyEndPatternLast": 1, |
| 2278 | + "beginCaptures": { |
| 2279 | + "1": { "name": "keyword.operator.private.js" }, |
| 2280 | + "2": { "name": "entity.name.function.js" }, |
| 2281 | + "3": { "name": "keyword.operator.existential.js" } |
| 2282 | + }, |
| 2283 | + "patterns": [{ "include": "#type-argument-brackets" }, { "include": "#round-brackets" }] |
| 2284 | + }, |
| 2285 | + { |
| 2286 | + "comment": "maybe in array form e.g. foo[bar]() or foo[bar]<string>()", |
| 2287 | + "name": "meta.function-call.without-arguments.js", |
| 2288 | + "begin": "(?<!\\.)\\s*+((\\bnew\\b)*)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)(?=\\s*(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+\\(\\s*+\\))", |
2229 | 2289 | "end": "(?=.)", |
2230 | 2290 | "applyEndPatternLast": 1, |
2231 | 2291 | "beginCaptures": { |
|
2243 | 2303 | { |
2244 | 2304 | "include": "#square-brackets" |
2245 | 2305 | }, |
| 2306 | + { |
| 2307 | + "include": "#type-argument-brackets" |
| 2308 | + }, |
2246 | 2309 | { |
2247 | 2310 | "include": "#round-brackets" |
2248 | 2311 | } |
2249 | 2312 | ] |
2250 | 2313 | }, |
2251 | 2314 | { |
| 2315 | + "comment": "A call expression with arguments and maybe type params, like foo(123) or foo<string>(123)", |
2252 | 2316 | "name": "meta.function-call.with-arguments.js", |
2253 | | - "begin": "(?<!\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?(?=\\()", |
| 2317 | + "begin": "(?<!\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(\\?\\.)?\\s*+(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+\\()", |
2254 | 2318 | "end": "(?=.)", |
2255 | 2319 | "applyEndPatternLast": 1, |
2256 | 2320 | "beginCaptures": { |
|
2265 | 2329 | } |
2266 | 2330 | }, |
2267 | 2331 | "patterns": [ |
| 2332 | + { |
| 2333 | + "include": "#type-argument-brackets" |
| 2334 | + }, |
2268 | 2335 | { |
2269 | 2336 | "include": "#round-brackets" |
2270 | 2337 | } |
2271 | 2338 | ] |
2272 | 2339 | }, |
2273 | 2340 | { |
2274 | | - "comment": "maybe in array form e.g. foo[bar]()", |
2275 | | - "name": "meta.function-call.without-arguments.js", |
2276 | | - "begin": "(?<!\\.)\\s*+((\\bnew\\b)*)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*+\\()", |
| 2341 | + "comment": "maybe in array form e.g. foo[bar](123)", |
| 2342 | + "name": "meta.function-call.with-arguments.js", |
| 2343 | + "begin": "(?<!\\.)\\s*+((\\bnew\\b)*)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\g<-1>)*\\])\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+\\()", |
2277 | 2344 | "end": "(?=.)", |
2278 | 2345 | "applyEndPatternLast": 1, |
2279 | 2346 | "beginCaptures": { |
|
2291 | 2358 | { |
2292 | 2359 | "include": "#square-brackets" |
2293 | 2360 | }, |
| 2361 | + { |
| 2362 | + "include": "#type-argument-brackets" |
| 2363 | + }, |
2294 | 2364 | { |
2295 | 2365 | "include": "#round-brackets" |
2296 | 2366 | } |
|
2704 | 2774 | { |
2705 | 2775 | "name": "meta.method-call.without-arguments.js", |
2706 | 2776 | "comment": "e.g CONSTNAME.method() or CONST.method[p]()", |
2707 | | - "begin": "\\s*+(\\#?)((?:[\\p{Lu}])(?:[$_\\p{Lu}\\p{Nd}])*+)\\s*+(?:(\\?\\.)|(\\.))\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+(\\(\\s*+\\)))", |
| 2777 | + "begin": "\\s*+(\\#?)((?:[\\p{Lu}])(?:[$_\\p{Lu}\\p{Nd}])*+)\\s*+(?:(\\?\\.)|(\\.))\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\(\\s*+\\)))", |
2708 | 2778 | "end": "(?=.)", |
2709 | 2779 | "applyEndPatternLast": 1, |
2710 | 2780 | "beginCaptures": { |
|
2731 | 2801 | { |
2732 | 2802 | "include": "#square-brackets" |
2733 | 2803 | }, |
| 2804 | + { |
| 2805 | + "include": "#type-argument-brackets" |
| 2806 | + }, |
2734 | 2807 | { |
2735 | 2808 | "include": "#round-brackets" |
2736 | 2809 | } |
|
2774 | 2847 | { |
2775 | 2848 | "name": "meta.method-call.with-arguments.js", |
2776 | 2849 | "comment": "e.g CONSTNAME.method()", |
2777 | | - "begin": "\\s*+(\\#?)((?:[\\p{Lu}])(?:[$_\\p{Lu}\\p{Nd}])*+)\\s*+(?:(\\?\\.)|(\\.))\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+\\()", |
| 2850 | + "begin": "\\s*+(\\#?)((?:[\\p{Lu}])(?:[$_\\p{Lu}\\p{Nd}])*+)\\s*+(?:(\\?\\.)|(\\.))\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+\\()", |
2778 | 2851 | "end": "(?=.)", |
2779 | 2852 | "applyEndPatternLast": 1, |
2780 | 2853 | "beginCaptures": { |
|
2801 | 2874 | { |
2802 | 2875 | "include": "#square-brackets" |
2803 | 2876 | }, |
| 2877 | + { |
| 2878 | + "include": "#type-argument-brackets" |
| 2879 | + }, |
2804 | 2880 | { |
2805 | 2881 | "include": "#round-brackets" |
2806 | 2882 | } |
|
2809 | 2885 | { |
2810 | 2886 | "name": "meta.method-call.with-arguments.js", |
2811 | 2887 | "comment": "e.g Abc.aaa()", |
2812 | | - "begin": "\\s*+(\\#?)((?:[\\p{Lu}])(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?:(\\?\\.)|(\\.))\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+\\()", |
| 2888 | + "begin": "\\s*+(\\#?)((?:[\\p{Lu}])(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?:(\\?\\.)|(\\.))\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+\\()", |
2813 | 2889 | "end": "(?=.)", |
2814 | 2890 | "applyEndPatternLast": 1, |
2815 | 2891 | "beginCaptures": { |
|
2835 | 2911 | "patterns": [ |
2836 | 2912 | { |
2837 | 2913 | "include": "#round-brackets" |
| 2914 | + }, |
| 2915 | + { |
| 2916 | + "include": "#type-argument-brackets" |
2838 | 2917 | } |
2839 | 2918 | ] |
2840 | 2919 | }, |
2841 | 2920 | { |
2842 | 2921 | "name": "meta.method-call.without-arguments.js", |
2843 | 2922 | "comment": "e.g .aaa()", |
2844 | | - "begin": "(?<=\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+(\\(\\s*+\\)))", |
| 2923 | + "begin": "(?<=\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+(\\(\\s*+\\)))", |
2845 | 2924 | "end": "(?=.)", |
2846 | 2925 | "applyEndPatternLast": 1, |
2847 | 2926 | "beginCaptures": { |
|
2859 | 2938 | { |
2860 | 2939 | "include": "#square-brackets" |
2861 | 2940 | }, |
| 2941 | + { |
| 2942 | + "include": "#type-argument-brackets" |
| 2943 | + }, |
2862 | 2944 | { |
2863 | 2945 | "include": "#round-brackets" |
2864 | 2946 | } |
|
2867 | 2949 | { |
2868 | 2950 | "name": "meta.method-call.with-arguments.js", |
2869 | 2951 | "comment": "e.g .aaa()", |
2870 | | - "begin": "(?<=\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+\\()", |
| 2952 | + "begin": "(?<=\\.)\\s*+(\\#?)((?:[$_\\p{L}\\p{Nl}]|\\\\u\\h{4}|\\\\u{\\h+})(?:[$_\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}\\x{200C}\\x{200D}]|\\\\u\\h{4}|\\\\u{\\h+})*+)\\s*+(?=(\\[(?:(?>[^\\[\\]]+)|\\\\g<-1>)*\\])?+\\s*+(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*+\\()", |
2871 | 2953 | "end": "(?=.)", |
2872 | 2954 | "applyEndPatternLast": 1, |
2873 | 2955 | "beginCaptures": { |
|
2882 | 2964 | { |
2883 | 2965 | "include": "#square-brackets" |
2884 | 2966 | }, |
| 2967 | + { |
| 2968 | + "include": "#type-argument-brackets" |
| 2969 | + }, |
2885 | 2970 | { |
2886 | 2971 | "include": "#round-brackets" |
2887 | 2972 | } |
|
0 commit comments