1+ {
2+ "$schema" : " https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json" ,
3+ "name" : " Pine Script" ,
4+ "patterns" : [
5+ {
6+ "match" : " //.*" ,
7+ "name" : " comment.pine"
8+ },
9+ {
10+ "include" : " #constants"
11+ },
12+ {
13+ "include" : " #functions"
14+ },
15+ {
16+ "include" : " #operators"
17+ },
18+ {
19+ "include" : " #keywords"
20+ },
21+ {
22+ "include" : " #strings"
23+ }
24+ ],
25+ "repository" : {
26+ "strings" : {
27+ "patterns" : [
28+ {
29+ "begin" : " \" " ,
30+ "beginCaptures" : {
31+ "1" : {
32+ "name" : " punctuation.definition.string.begin.pine"
33+ }
34+ },
35+ "end" : " \" " ,
36+ "endCaptures" : {
37+ "1" : {
38+ "name" : " punctuation.definition.string.end.pine"
39+ }
40+ },
41+ "name" : " string.quoted.double.pine" ,
42+ "patterns" : [
43+ {
44+ "match" : " \\\\ ." ,
45+ "name" : " constant.character.escaped.pine"
46+ }
47+ ]
48+ },
49+ {
50+ "begin" : " '" ,
51+ "beginCaptures" : {
52+ "1" : {
53+ "name" : " punctuation.definition.string.begin.pine"
54+ }
55+ },
56+ "end" : " '" ,
57+ "endCaptures" : {
58+ "1" : {
59+ "name" : " punctuation.definition.string.end.pine"
60+ }
61+ },
62+ "name" : " string.quoted.double.pine" ,
63+ "patterns" : [
64+ {
65+ "match" : " \\\\ ." ,
66+ "name" : " constant.character.escaped.pine"
67+ }
68+ ]
69+ }
70+ ]
71+ },
72+ "functions" : {
73+ "patterns" : [
74+ {
75+ "match" : " \\ b(avg|bar(color|since)|bgcolor|change|cross|donchian|falling|fill|highest|iff|input|lowest|m(ax|in)|plot(arrow|bar|candle|char|shape|figure)?|rising|security|tostring|(e|s)ma|study|valuewhen)(?=\\ ()" ,
76+ "captures" : {
77+ "1" : {
78+ "name" : " support.function.pine"
79+ }
80+ }
81+ },
82+ {
83+ "match" : " [a-zA-Z_][a-zA-Z0-9_]*\\ s*(?=\\ =)" ,
84+ "name" : " variable.parameter.pine"
85+ },
86+ {
87+ "match" : " ([a-zA-Z_][a-zA-Z0-9_]*)\\ (.*\\ )\\ s(=>)\\ s" ,
88+ "captures" : {
89+ "1" : {
90+ "name" : " support.function.pine"
91+ },
92+ "2" : {
93+ "name" : " keyword.operator.assignment.pine"
94+ }
95+ }
96+ }
97+ ]
98+ },
99+ "constants" : {
100+ "patterns" :[
101+ {
102+ "match" : " \\ b(true|false)\\ b" ,
103+ "name" : " constant.language.pine"
104+ },
105+ {
106+ "match" : " \\ b(open|high|low|close|volume|na|len|period|tikerid)\\ b" ,
107+ "name" : " constant.language.pine"
108+ },
109+ {
110+ "match" : " \\ b(monday|tuesday|wednesday|thursday|friday|saturday|sunday|dayofweek)\\ b" ,
111+ "name" : " constant.language.pine"
112+ },
113+ {
114+ "match" : " \\ b(line|histogram|cross|area|columns|circles)\\ b" ,
115+ "name" : " constant.language.pine"
116+ },
117+ {
118+ "match" : " \\ blocation\\ .(abovebar|belowbar|top|bottom|absolute)\\ b" ,
119+ "name" : " constant.language.pine"
120+ },
121+ {
122+ "match" : " \\ bshape\\ .(x(cross)?|(triangle|arrow|label)(up|down)|flag|circle|square|diamond)\\ b" ,
123+ "name" : " constant.language.pine"
124+ },
125+ {
126+ "match" : " \\ b(aqua|black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|orange)\\ b" ,
127+ "name" : " constant.language.pine"
128+ },
129+ {
130+ "match" : " #[a-fA-F0-9]{6}" ,
131+ "name" : " contstant.support.pine"
132+ },
133+ {
134+ "match" : " \\ b([0-9]+)\\ b" ,
135+ "name" : " constant.numeric.pine"
136+ }
137+ ]
138+ },
139+ "operators" : {
140+ "patterns" : [
141+ {
142+ "match" : " (\\ -|\\ +|\\ *|/|%)" ,
143+ "name" : " keyword.operator.arithmetic.pine"
144+ },
145+ {
146+ "match" : " (==|!=|<=|>=|<|>)" ,
147+ "name" : " keyword.operator.comparison.pine"
148+ },
149+ {
150+ "match" : " (\\ ?|\\ :)" ,
151+ "name" : " keyword.operator.ternary.pine"
152+ },
153+ {
154+ "match" : " \\ b(and|or|not)\\ b" ,
155+ "name" : " keyword.operator.logical.pine"
156+ },
157+ {
158+ "match" : " =" ,
159+ "name" : " keyword.operator.assignment.pine"
160+ }
161+ ]
162+ },
163+ "keywords" : {
164+ "patterns" : [{
165+ "name" : " keyword.control.pine" ,
166+ "match" : " \\ b(if|else|while|for|return)\\ b"
167+ }]
168+ }
169+ },
170+ "scopeName" : " source.pine"
171+ }
0 commit comments