|
13 | 13 | "include": "#constants"
|
14 | 14 | },
|
15 | 15 | {
|
16 |
| - "include": "#functionParam" |
| 16 | + "include": "#functionCall" |
17 | 17 | },
|
18 | 18 | {
|
19 |
| - "include": "#declarations" |
| 19 | + "include": "#functions" |
20 | 20 | },
|
21 | 21 | {
|
22 |
| - "include": "#functions" |
| 22 | + "include": "#variables" |
23 | 23 | },
|
24 | 24 | {
|
25 | 25 | "include": "#operators"
|
|
91 | 91 | ]
|
92 | 92 | },
|
93 | 93 | "number": {
|
94 |
| - "name": "constant.numeric.decimal.pine", |
95 |
| - "match": "\\b(?:\\d+(?:\\.\\d+)?)\\b" |
| 94 | + "patterns": [ |
| 95 | + { |
| 96 | + "name": "constant.numeric.decimal.pine", |
| 97 | + "match": "\\b(?:\\d+(?:\\.\\d+)?)\\b" |
| 98 | + }, |
| 99 | + { |
| 100 | + "name": "constant.numeric.integer.pine", |
| 101 | + "match": "\\b\\d+\\b" |
| 102 | + } |
| 103 | + ] |
96 | 104 | },
|
97 | 105 | "literals": {
|
98 | 106 | "patterns": [
|
|
127 | 135 | }
|
128 | 136 | },
|
129 | 137 | "paramSeparator": {
|
130 |
| - "name": "punctuation.separator.parameter", |
131 |
| - "match": "\\s*,\\s*" |
| 138 | + "name": "punctuation.separator.parameter.pine", |
| 139 | + "match": "," |
132 | 140 | },
|
133 | 141 | "functionParam": {
|
134 | 142 | "patterns": [
|
|
154 | 162 | },
|
155 | 163 | "patterns": [
|
156 | 164 | {
|
157 |
| - "include": "#string" |
| 165 | + "include": "#literals" |
158 | 166 | },
|
159 | 167 | {
|
160 |
| - "include": "#boolean" |
| 168 | + "include": "constants" |
161 | 169 | },
|
162 | 170 | {
|
163 |
| - "include": "#number" |
| 171 | + "include": "#paramSeparator" |
164 | 172 | }
|
165 | 173 | ],
|
166 | 174 | "end": "(?=\\s*(?:$|,|\\)))"
|
|
185 | 193 | }
|
186 | 194 | ]
|
187 | 195 | },
|
188 |
| - "declarations": { |
| 196 | + "functionParams": { |
| 197 | + "name": "meta.parameters.pine", |
| 198 | + "begin": "\\(", |
| 199 | + "beginCaptures": { |
| 200 | + "0": { |
| 201 | + "name": "punctuation.definition.parameters.begin.pine" |
| 202 | + } |
| 203 | + }, |
| 204 | + "end": "\\)", |
| 205 | + "endCaptures": { |
| 206 | + "0": { |
| 207 | + "name": "punctuation.definition.parameters.end.pine" |
| 208 | + } |
| 209 | + }, |
| 210 | + "patterns": [ |
| 211 | + { |
| 212 | + "include": "#functionParam" |
| 213 | + }, |
| 214 | + { |
| 215 | + "include": "#paramSeparator" |
| 216 | + } |
| 217 | + ] |
| 218 | + }, |
| 219 | + "variables": { |
189 | 220 | "patterns": [
|
190 | 221 | {
|
191 | 222 | "name": "meta.var.expr.pine",
|
|
281 | 312 | }
|
282 | 313 | ]
|
283 | 314 | },
|
| 315 | + "functionCall": { |
| 316 | + "patterns": [ |
| 317 | + { |
| 318 | + "name": "meta.function-call.pine", |
| 319 | + "begin": "(?<=(?:^|=)\\s*|\\w+\\.)(\\w+)(?=\\()", |
| 320 | + "beginCaptures": { |
| 321 | + "1": { "name": "entity.name.function" } |
| 322 | + }, |
| 323 | + "end": "(?<=\\))\\s*$", |
| 324 | + "patterns": [ |
| 325 | + { |
| 326 | + "include": "#literals" |
| 327 | + }, |
| 328 | + { |
| 329 | + "include": "#constants" |
| 330 | + }, |
| 331 | + { |
| 332 | + "include": "#functionCall" |
| 333 | + }, |
| 334 | + { |
| 335 | + "include": "#paramSeparator" |
| 336 | + }, |
| 337 | + { |
| 338 | + "match": "(?<=\\s+|\\(\\s*|,\\s*)(\\w+)(?=\\s*=)", |
| 339 | + "captures": { |
| 340 | + "1" : { |
| 341 | + "name":"entity.name.variable.parameter" |
| 342 | + } |
| 343 | + } |
| 344 | + }, |
| 345 | + { |
| 346 | + "name": "variable.other.readwrite.pine", |
| 347 | + "match": "\\w+" |
| 348 | + } |
| 349 | + ] |
| 350 | + } |
| 351 | + ] |
| 352 | + }, |
284 | 353 | "functions": {
|
285 | 354 | "patterns": [
|
286 | 355 | {
|
287 |
| - "match": "\\b(abs|acos|alertcondition|alma|asin|atan|atr|avg|bar(color|since)|bb|bbw|bgcolor|bool|cci|ceil|change|cmo|cog|color|color\\.new|correlation|cos|cross|crossover|crossunder|cum|dayofmonth|dayofweek|dev|dmi|ema|exp|falling|fill|financial|fixnan|floor|heikinashi|highest|highestbars|hline|hma|hour|iff|input|int|kagi|kc|kcw|label|line|linebreak|linreg|log|log10|lowest|lowestbars|macd|max|max_bars_back|mfi|min|minute|mom|month|na|nz|offset|percentile_linear_interpolation|percentile_nearest_rank|pivothigh|pivotlow|plot|plotarrow|plotbar|plotcandle|plotchar|plotshape|pointfigure|pow|quandl|renko|rising|rma|roc|round|rsi|sar|second|security|sign|sin|sma|sqrt|stdev|stoch|str\\.replace_all|strategy|string|study|sum|supertrend|swma|tan|tickerid|time|timestamp|tostring|tr|tsi|valuewhen|variance|vwma|weekofyear|wma|wpr|year)(?=\\()", |
| 356 | + "name": "meta.definition.function.pine", |
| 357 | + "begin": "^((export)\\s+)?(\\w+)(?=\\()", |
| 358 | + "beginCaptures": { |
| 359 | + "2": { "name": "keyword.control.export.pine" }, |
| 360 | + "3": { "name": "entity.name.function" } |
| 361 | + }, |
| 362 | + "end": "(?<=\\))\\s*=>", |
| 363 | + "patterns": [ |
| 364 | + { |
| 365 | + "include": "#functionParams" |
| 366 | + } |
| 367 | + ] |
| 368 | + } |
| 369 | + ] |
| 370 | + }, |
| 371 | + "functionsX": { |
| 372 | + "patterns": [ |
| 373 | + { |
| 374 | + "match": "\\b(abs|acos|alma|asin|atan|atr|avg|bar(color|since)|bb|bbw|bgcolor|bool|cci|ceil|change|cmo|cog|color|color\\.new|correlation|cos|cross|crossover|crossunder|cum|dayofmonth|dayofweek|dev|dmi|ema|exp|falling|fill|financial|fixnan|floor|heikinashi|highest|highestbars|hline|hma|hour|iff|input|int|kagi|kc|kcw|label|line|linebreak|linreg|log|log10|lowest|lowestbars|macd|max|max_bars_back|mfi|min|minute|mom|month|na|nz|offset|percentile_linear_interpolation|percentile_nearest_rank|pivothigh|pivotlow|plot|plotarrow|plotbar|plotcandle|plotchar|plotshape|pointfigure|pow|quandl|renko|rising|rma|roc|round|rsi|sar|second|security|sign|sin|sma|sqrt|stdev|stoch|str\\.replace_all|strategy|string|study|sum|supertrend|swma|tan|tickerid|time|timestamp|tostring|tr|tsi|valuewhen|variance|vwma|weekofyear|wma|wpr|year)(?=\\()", |
288 | 375 | "captures": {
|
289 | 376 | "1": {
|
290 | 377 | "name": "support.function.pine"
|
|
330 | 417 | "name": "support.function.pine"
|
331 | 418 | }
|
332 | 419 | }
|
333 |
| - }, |
334 |
| - { |
335 |
| - "match": "([a-zA-Z_][a-zA-Z0-9_]*)\\(.*\\)\\s(=>)\\s", |
336 |
| - "captures": { |
337 |
| - "1": { |
338 |
| - "name": "support.function.pine" |
339 |
| - }, |
340 |
| - "2": { |
341 |
| - "name": "keyword.operator.assignment.pine" |
342 |
| - } |
343 |
| - } |
344 | 420 | }
|
345 | 421 | ]
|
346 | 422 | },
|
347 | 423 | "constants": {
|
348 | 424 | "patterns": [
|
349 |
| - { |
350 |
| - "match": "\\b(true|false)\\b", |
351 |
| - "name": "constant.language.pine" |
352 |
| - }, |
353 | 425 | {
|
354 | 426 | "match": "\\b(accdist|bar_index|close|dayofmonth|dayofweek|high|hl2|hlc3|hour|iii|low|minute|month|na|nvi|obv|ohlc4|open|pvi|pvt|second|time|time_close|timenow|tr|volume|vwap|wad|weekofyear|wvad|year)\\b",
|
355 | 427 | "name": "constant.language.pine"
|
|
476 | 548 | },
|
477 | 549 | {
|
478 | 550 | "match": "#[a-fA-F0-9]{6}",
|
479 |
| - "name": "contstant.support.pine" |
480 |
| - }, |
481 |
| - { |
482 |
| - "match": "\\b([0-9]+)\\b", |
483 |
| - "name": "constant.numeric.pine" |
| 551 | + "name": "constant.support.pine" |
484 | 552 | }
|
| 553 | + |
485 | 554 | ]
|
486 | 555 | },
|
487 | 556 | "operators": {
|
|
0 commit comments