1+ {
2+ "$schema" : " https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json" ,
3+ "name" : " Pine Script" ,
4+ "patterns" : [
5+ {
6+ "match" : " //.*" ,
7+ "name" : " comment.line.double-slash.pine"
8+ },
9+ {
10+ "include" : " #strings"
11+ },
12+ {
13+ "include" : " #keywords"
14+ },
15+ {
16+ "include" : " #constants"
17+ },
18+ {
19+ "include" : " #variables"
20+ },
21+ {
22+ "include" : " #functions"
23+ },
24+ {
25+ "include" : " #operators"
26+ }
27+ ],
28+ "repository" : {
29+ "strings" : {
30+ "patterns" : [
31+ {
32+ "begin" : " \" " ,
33+ "beginCaptures" : {
34+ "1" : {
35+ "name" : " punctuation.definition.string.begin.pine"
36+ }
37+ },
38+ "end" : " \" " ,
39+ "endCaptures" : {
40+ "1" : {
41+ "name" : " punctuation.definition.string.end.pine"
42+ }
43+ },
44+ "name" : " string.quoted.double.pine" ,
45+ "patterns" : [
46+ {
47+ "match" : " \\\\ ." ,
48+ "name" : " constant.character.escaped.pine"
49+ }
50+ ]
51+ },
52+ {
53+ "begin" : " '" ,
54+ "beginCaptures" : {
55+ "1" : {
56+ "name" : " punctuation.definition.string.begin.pine"
57+ }
58+ },
59+ "end" : " '" ,
60+ "endCaptures" : {
61+ "1" : {
62+ "name" : " punctuation.definition.string.end.pine"
63+ }
64+ },
65+ "name" : " string.quoted.single.pine" ,
66+ "patterns" : [
67+ {
68+ "match" : " \\\\ ." ,
69+ "name" : " constant.character.escaped.pine"
70+ }
71+ ]
72+ }
73+ ]
74+ },
75+ "keywords" : {
76+ "patterns" : [
77+ {
78+ "match" : " \\ b(if|else|continue|break|for|return)\\ b" ,
79+ "name" : " keyword.control.pine"
80+ }
81+ ]
82+ },
83+ "constants" : {
84+ "patterns" : [
85+ {
86+ "match" : " \\ b(adjustment|barmerge|barstate|currency|color|format|location|scale|session|shape|size|strategy|syminfo)\\ b(?!\\ ()(?=\\ .)" ,
87+ "name" : " support.class.pine"
88+ },
89+ {
90+ "match" : " \\ b(risk|commission|direction|oca)\\ b(?!\\ ()(?=\\ .)" ,
91+ "name" : " support.class.pine"
92+ },
93+ {
94+ "match" : " \\ b(true|false)\\ b(?!\\ ()" ,
95+ "name" : " constant.language.pine"
96+ },
97+ {
98+ "match" : " \\ b(open|high|low|close|volume|na|len|period)\\ b(?!\\ ()" ,
99+ "name" : " constant.language.pine"
100+ },
101+ {
102+ "match" : " \\ b(monday|tuesday|wednesday|thursday|friday|saturday|sunday|second|minute|hour|month|dayofweek|dayofmonth|weekofyear|year)\\ b(?!\\ ()" ,
103+ "name" : " constant.language.pine"
104+ },
105+ {
106+ "match" : " \\ b(line|linebr|histogram|cross|area|areabr|columns|circles)\\ b(?!\\ ()" ,
107+ "name" : " constant.language.pine"
108+ },
109+ {
110+ "match" : " \\ bis(daily|dwm|intraday|minutes|monthly|seconds|weekly)?\\ b(?!\\ ()" ,
111+ "name" : " constant.language.pine"
112+ },
113+ {
114+ "match" : " \\ b(string|symbol|bool|integer|float)\\ b(?!\\ ()" ,
115+ "name" : " constant.language.pine"
116+ },
117+ {
118+ "match" : " \\ b(dotted|dashed)\\ b(?!\\ ()" ,
119+ "name" : " constant.language.pine"
120+ },
121+ {
122+ "match" : " \\ b(aqua|black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|orange)\\ b(?!\\ ()" ,
123+ "name" : " constant.language.pine"
124+ },
125+ {
126+ "match" : " \\ b(accdist|hl2|hlc3|interval|n|ohlc4|resolution|session|solid|source|stepline|ticker|tickerid|time|timenow|tr|vwap)\\ b(?!\\ ()" ,
127+ "name" : " constant.language.pine"
128+ },
129+ {
130+ "match" : " \\ b(dividends|none|splits|gaps_off|gaps_on|lookahead_off|lookahead_on|isconfirmed|isfirst|ishistory|islast|isnew|isrealtime|AUD|CAD|CHF|EUR|GBP|HKD|JPY|NOK|NONE|NZD|RUB|SEK|SGD|TRY|USD|ZAR|abovebar|absolute|belowbar|bottom|top|left|right|extended|regular|arrowdown|arrowup|circle|diamond|flag|labeldown|labelup|square|triangledown|triangleup|xcross|auto|huge|large|normal|small|tiny|cash|closedtrades|cash_per_contract|cash_per_order|percent|price|all|long|short|equity|eventrades|fixed|grossloss|grossprofit|initial_capital|losstrades|max_contracts_held_all|max_contracts_held_long|max_contracts_held_short|max_drawdown|netprofit|cancel|reduce|openprofit|opentrades|percent_of_equity|position_avg_price|position_entry_name|position_size|wintrades|mintick|pointvalue|prefix|root|timezone)\\ b(?!\\ ()" ,
131+ "name" : " constant.language.pine"
132+ },
133+ {
134+ "match" : " \\ b([0-9]+)\\ b" ,
135+ "name" : " constant.numeric.pine"
136+ },
137+ {
138+ "match" : " #[a-fA-F0-9]{6}" ,
139+ "name" : " contstant.other.pine"
140+ }
141+ ]
142+ },
143+ "variables" : {
144+ "patterns" : [
145+ {
146+ "match" : " [a-zA-Z_][a-zA-Z0-9_]*\\ s*(?=\\ =)" ,
147+ "name" : " variable.other.pine"
148+ }
149+ ]
150+ },
151+ "functions" : {
152+ "patterns" : [
153+ {
154+ "match" : " \\ b(abs|acros|alertcondition|alma|asin|atan|atr|avg|barcolor|barssince|bgcolor|cci|ceil|change|cog|color|correlation|cos|cross|crossover|crossunder|cum|dayofmonth|dayofweek|dev|ema|exp|falling|fill|fixnan|floor|heikinashi|highest|highestbars|hline|hour|iff|input|kagi|linebreak|linreg|log|log10|lowest|lowestbars|macd|max|min|minute|mom|month|na|nz|offset|percentile_linear_interpolation|percentile_nearest_rank|percentrank|pivothigh|pivotlow|plot(arrow|bar|candle|char|shape)?|pointfigure|pow|renko|rising|rma|roc|round|rsi|sar|second|security|sign|sin|sma|sqrt|stdev|stoch|strategy|cancel|cancel_all|close|close_all|entry|exit|order|allow_entry_in|max_cons_loss_days|max_intraday_filled_orders|max_intraday_loss|max_position_size|study|sum|swma|tan|tickerid|time|timestamp|tostring|tr|tsi|valuewhen|variance|vwap|vwma|weekofyear|wma|year)+?(?=\\ ()" ,
155+ "name" : " entity.name.function.pine"
156+ },
157+ {
158+ "match" : " ([a-zA-Z_][a-zA-Z0-9_]*)\\ (.*\\ )\\ s(=>)\\ s" ,
159+ "captures" : {
160+ "1" : {
161+ "name" : " support.function.pine"
162+ },
163+ "2" : {
164+ "name" : " keyword.operator.assignment.pine"
165+ }
166+ }
167+ }
168+ ]
169+ },
170+ "operators" : {
171+ "patterns" : [
172+ {
173+ "match" : " (\\ -|\\ +|\\ *|/|%)" ,
174+ "name" : " keyword.operator.arithmetic.pine"
175+ },
176+ {
177+ "match" : " (==|!=|<=|>=|<|>)" ,
178+ "name" : " keyword.operator.comparison.pine"
179+ },
180+ {
181+ "match" : " (\\ ?|\\ :)" ,
182+ "name" : " keyword.operator.ternary.pine"
183+ },
184+ {
185+ "match" : " \\ b(and|or|not)\\ b" ,
186+ "name" : " keyword.operator.logical.pine"
187+ },
188+ {
189+ "match" : " =" ,
190+ "name" : " keyword.operator.assignment.pine"
191+ }
192+ ]
193+ }
194+ },
195+ "scopeName" : " source.pine"
196+ }
0 commit comments