1
# The contents of this file are subject to the terms of the Common Development
2
# and Distribution License (the License). You may not use this file except in
3
# compliance with the License.
5
# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
6
# or http://www.netbeans.org/cddl.txt.
8
# When distributing Covered Code, include this CDDL Header Notice in each file
9
# and include the License file at http://www.netbeans.org/cddl.txt.
10
# If applicable, add the following below the CDDL Header, with the fields
11
# enclosed by brackets [] replaced by your own identifying information:
12
# "Portions Copyrighted [year] [name of copyright owner]"
14
# The Original Software is NetBeans. The Initial Developer of the Original
15
# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
16
# Microsystems, Inc. All Rights Reserved.
19
########### tokens #############################################################
21
TOKEN:css_comment:( "/*" - "*/" )
22
TOKEN:css_comment:( "<!--" | "-->" )
23
TOKEN:css_whitespace: ([" " "\t" "\n" "\r"]+)
25
#119397 hack - <![CDATA[ in <style> tag breaks lexing and parsing
26
TOKEN:css_html_cdata_hack:("<![CDATA[")
27
TOKEN:css_html_cdata_hack2:("]]>")
30
TOKEN:css_operator:( ["*" "#" "." "," ":" "-" "+" ">" "(" ")" "{" "}" ";" "[" "]" "!" "/" "\\"] )
31
TOKEN:css_operator2: ( "~=" | "|=" | "=" )
32
TOKEN:css_identifier: (
33
"-"? ["a"-"z" "A"-"Z" "_"]
34
["a"-"z" "A"-"Z" "_" "0" - "9" "-"]*
46
"url" [" " "\t" "\n" "\r"]* ("(" - ")")
51
( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
52
"ex" | "px" | "ms" | "s" | "%"
57
["0"-"9"]* "." ["0"-"9"]+
58
( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
59
"ex" | "px" | "ms" | "s" | "%"
63
TOKEN:css_hash:( "#" ["a"-"z" "A"-"Z" "0"-"9" "-" "_"]+)
65
TOKEN:escaped_css_number:(
68
( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
69
"ex" | "px" | "ms" | "s" | "%"
73
TOKEN:escaped_css_number:(
75
["0"-"9"]* "." ["0"-"9"]+
76
( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
77
"ex" | "px" | "ms" | "s" | "%"
83
( [^ "\"" "\n" "\r"] |
84
("\\" ["r" "n" "t" "\\" "\'" "\""]) |
91
( [^ "\"" "\n" "\r"] |
92
("\\" ["r" "n" "t" "\\" "\'" "\""]) |
99
########### grammar ############################################################
103
SKIP:css_html_cdata_hack
104
SKIP:css_html_cdata_hack2
106
S = [charset] (import)* (ruleset | media | page)*;
107
charset = "@charset" <css_string> ";";
108
import = "@import" (<css_string> | <css_url>) mediaList ";";
109
mediaList = (<css_identifier>)*;
110
mediaList = (<css_identifier> ",")*;
111
media = "@media" mediaName mediaBody;
112
mediaName = <css_identifier> ("," <css_identifier>)*;
113
mediaBody = "{" (ruleset)* "}";
114
page = "@page" [":" <css_identifier>] body;
116
ruleset = selectors body;
117
body = "{" declarations "}";
118
selectors = selector ("," selector)*;
119
selector = simple_selector (combinator simple_selector)*;
120
combinator = ">" | "+" | ;
122
simple_selector = element_name | hash | class | attrib | pseudo;
123
element_name = <css_identifier> | "*" | ("." <escaped_css_number> <css_identifier>) | (<css_number> <css_identifier>);
125
class = "." <css_identifier>;
126
attrib = "[" <css_identifier> [ ("=" | "~=" | "|=") (<css_identifier> | <css_string>) ] "]";
127
pseudo = ":" <css_identifier> ["(" <css_identifier> ")"];
129
declarations = declaration declarations1;
132
declarations1 = ";" declarations2;
133
declarations2 = declaration declarations1;
135
declaration = <GAP> | key ":" expr [prio];
136
key = <css_identifier>;
137
expr = gap | term (operator term)*;
138
gap = <GAP> ["pt" | "pc" | "in" | "mm" | "cm" | "em" |
139
"ex" | "px" | "ms" | "s"];
140
term = ["-" | "+"] (<css_number> | <css_string> | <css_url> | <css_hash> | function);
141
operator = "/" | "," |;
142
function = <css_identifier> ["(" expr ")"];
143
prio = "!" "important";
145
########### color ##############################################################
147
COLOR:element_name: {
148
color_name: "css_selector";
149
default_coloring: "identifier";
150
foreground_color: "#007c00";
155
color_name: "css_selector";
156
default_coloring: "identifier";
157
foreground_color: "#007c00";
162
color_name: "css_selector";
163
default_coloring: "identifier";
164
foreground_color: "#007c00";
169
color_name: "css_key";
170
default_coloring: "keyword";
171
foreground_color:"blue";
174
########### code folding #######################################################
177
expand_type_action_name:"LBL_Expand_Rulesets";
178
collapse_type_action_name:"LBL_Collapse_Rulesets";
181
expand_type_action_name:"LBL_Expand_Rulesets";
182
collapse_type_action_name:"LBL_Collapse_Rulesets";
185
expand_type_action_name:"LBL_Expand_Comments";
186
collapse_type_action_name:"LBL_Collapse_Comments";
189
########### navigator ##########################################################
192
display_name: "@media $mediaName$";
193
icon: "org/netbeans/modules/languages/resources/style_sheet_16.png";
197
display_name: "$selectors$";
198
tooltip: org.netbeans.modules.languages.css.CSS.navigatorTooltip;
199
icon: "org/netbeans/modules/languages/resources/style_sheet_16.png";
202
HYPERLINK:string: org.netbeans.modules.languages.css.CSS.hyperlink
213
REFORMAT:declarations:"++i"
219
########### completion #########################################################
221
COMPLETION:css_identifier, css_operator, css_operator2, css_comment, css_whitespace: {
224
text2: "background-attachment";
225
text3: "background-color";
226
text4: "background-image";
227
text5: "background-position";
228
text6: "background-repeat";
230
text8: "border-collapse";
231
text9: "border-color";
232
text10: "border-spacing";
233
text11: "border-style";
234
text12: "border-top";
235
text13: "border-right";
236
text14: "border-bottom";
237
text15: "border-left";
238
text16: "border-top-color";
239
text17: "border-right-color";
240
text18: "border-bottom-color";
241
text19: "border-left-color";
242
text20: "border-top-style";
243
text21: "border-right-style";
244
text22: "border-bottom-style";
245
text23: "border-left-style";
246
text24: "border-top-width";
247
text25: "border-right-width";
248
text26: "border-bottom-width";
249
text27: "border-left-width";
250
text28: "border-width";
253
text31: "caption-side";
258
text36: "counter-increment";
259
text37: "counter-reset";
261
text39: "cue-before";
267
text45: "empty-cells";
269
text47: "font-family";
271
text49: "font-style";
272
text50: "font-variant";
273
text51: "font-weight";
277
text55: "letter-spacing";
278
text56: "line-height";
279
text57: "list-style-image";
280
text58: "list-style-position";
281
text59: "list-style-type";
282
text60: "list-style";
283
text61: "margin-right";
284
text62: "margin-left";
285
text63: "margin-top";
286
text64: "margin-bottom";
288
text66: "max-height";
290
text68: "min-height";
293
text71: "outline-color";
294
text72: "outline-style";
295
text73: "outline-width";
298
text76: "padding-top";
299
text77: "padding-right";
300
text78: "padding-bottom";
301
text79: "padding-left";
303
text81: "page-break-after";
304
text82: "page-break-before";
305
text83: "page-break-inside";
306
text84: "pause-after";
307
text85: "pause-before";
309
text87: "pitch-range";
311
text89: "play-during";
316
text94: "speak-header";
317
text95: "speak-numeral";
318
text96: "speak-punctuation";
320
text98: "speech-rate";
322
text100: "table-layout";
323
text101: "text-align";
324
text102: "text-decoration";
325
text103: "text-indent";
326
text104: "text-transform";
328
text106: "unicode-bidi";
329
text107: "vertical-align";
330
text108: "visibility";
331
text109: "voice-family";
333
text111: "white-space";
336
text114: "word-spacing";
342
message:"LBL_SYNTAX_ERROR";
346
navigator_sort:"true";
352
BUNDLE "org.netbeans.modules.languages.css.Bundle"
b'\\ No newline at end of file'