~ubuntu-branches/ubuntu/trusty/netbeans/trusty

« back to all changes in this revision

Viewing changes to languages/css/src/org/netbeans/modules/languages/css/CSS.nbs

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
4
#
 
5
# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
 
6
# or http://www.netbeans.org/cddl.txt.
 
7
#
 
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]"
 
13
#
 
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.
 
17
 
 
18
 
 
19
########### tokens #############################################################
 
20
 
 
21
TOKEN:css_comment:( "/*" - "*/" )
 
22
TOKEN:css_comment:( "<!--" | "-->" )
 
23
TOKEN:css_whitespace: ([" " "\t" "\n" "\r"]+)
 
24
 
 
25
#119397 hack - <![CDATA[ in <style> tag breaks lexing and parsing
 
26
TOKEN:css_html_cdata_hack:("<![CDATA[")
 
27
TOKEN:css_html_cdata_hack2:("]]>")
 
28
#end of hack
 
29
 
 
30
TOKEN:css_operator:( ["*" "#" "." "," ":" "-" "+" ">" "(" ")" "{" "}" ";" "[" "]" "!" "/" "\\"] )
 
31
TOKEN:css_operator2: ( "~=" | "|=" | "=" )
 
32
TOKEN:css_identifier: (
 
33
    "-"? ["a"-"z" "A"-"Z" "_"]
 
34
         ["a"-"z" "A"-"Z" "_" "0" - "9" "-"]*
 
35
)
 
36
TOKEN:css_keyword: (
 
37
    "@charset" |
 
38
    "@import" |
 
39
    "@media" |
 
40
    "@page" |
 
41
    "important" |
 
42
    "url"
 
43
)
 
44
 
 
45
TOKEN:css_url: (
 
46
    "url" [" " "\t" "\n" "\r"]* ("(" - ")")
 
47
)
 
48
 
 
49
TOKEN:css_number:( 
 
50
    ["0"-"9"]+ 
 
51
    ( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
 
52
      "ex" | "px" | "ms" | "s" | "%"
 
53
    )?
 
54
)
 
55
 
 
56
TOKEN:css_number:(
 
57
    ["0"-"9"]* "." ["0"-"9"]+
 
58
    ( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
 
59
      "ex" | "px" | "ms" | "s" | "%"
 
60
    )?
 
61
)
 
62
 
 
63
TOKEN:css_hash:( "#" ["a"-"z" "A"-"Z" "0"-"9" "-" "_"]+)
 
64
 
 
65
TOKEN:escaped_css_number:( 
 
66
    ("\\")
 
67
    ["0"-"9"]+ 
 
68
    ( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
 
69
      "ex" | "px" | "ms" | "s" | "%"
 
70
    )?
 
71
)
 
72
 
 
73
TOKEN:escaped_css_number:(
 
74
    ("\\")
 
75
    ["0"-"9"]* "." ["0"-"9"]+
 
76
    ( "pt" | "pc" | "in" | "mm" | "cm" | "em" |
 
77
      "ex" | "px" | "ms" | "s" | "%"
 
78
    )?
 
79
)
 
80
 
 
81
TOKEN:css_string: (
 
82
    "\""
 
83
        ( [^ "\"" "\n" "\r"] |
 
84
          ("\\" ["r" "n" "t" "\\" "\'" "\""]) |
 
85
          ("\\" "\n")
 
86
        )*
 
87
    "\""
 
88
)
 
89
TOKEN:css_string: (
 
90
    "\'"
 
91
        ( [^ "\"" "\n" "\r"] |
 
92
          ("\\" ["r" "n" "t" "\\" "\'" "\""]) |
 
93
          ("\\" "\n")
 
94
        )*
 
95
    "\'"
 
96
)
 
97
 
 
98
 
 
99
########### grammar ############################################################
 
100
 
 
101
SKIP:css_comment
 
102
SKIP:css_whitespace
 
103
SKIP:css_html_cdata_hack
 
104
SKIP:css_html_cdata_hack2
 
105
 
 
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;
 
115
 
 
116
ruleset = selectors body;
 
117
body = "{" declarations "}";
 
118
selectors = selector ("," selector)*;
 
119
selector = simple_selector (combinator simple_selector)*;
 
120
combinator = ">" | "+" | ;
 
121
#attrib removed!!!
 
122
simple_selector = element_name | hash | class | attrib | pseudo;
 
123
element_name = <css_identifier> | "*" | ("." <escaped_css_number> <css_identifier>) | (<css_number> <css_identifier>);
 
124
hash = <css_hash>;
 
125
class = "." <css_identifier>;
 
126
attrib = "[" <css_identifier> [ ("=" | "~=" | "|=") (<css_identifier> | <css_string>) ] "]";
 
127
pseudo = ":" <css_identifier> ["(" <css_identifier> ")"];
 
128
 
 
129
declarations = declaration declarations1;
 
130
declarations = ;
 
131
declarations1 = ;
 
132
declarations1 = ";" declarations2;
 
133
declarations2 = declaration declarations1;
 
134
declarations2 = ;
 
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";
 
144
 
 
145
########### color ##############################################################
 
146
 
 
147
COLOR:element_name: {
 
148
    color_name: "css_selector";
 
149
    default_coloring: "identifier";
 
150
    foreground_color: "#007c00";
 
151
    font_type:"bold";
 
152
 
153
 
 
154
COLOR:hash: {
 
155
    color_name: "css_selector";
 
156
    default_coloring: "identifier";
 
157
    foreground_color: "#007c00";
 
158
    font_type:"bold";
 
159
 
160
 
 
161
COLOR:class: {
 
162
    color_name: "css_selector";
 
163
    default_coloring: "identifier";
 
164
    foreground_color: "#007c00";
 
165
    font_type:"bold";
 
166
 
167
 
 
168
COLOR:key: {
 
169
    color_name: "css_key";
 
170
    default_coloring: "keyword";
 
171
    foreground_color:"blue";
 
172
 
173
 
 
174
########### code folding #######################################################
 
175
 
 
176
FOLD:body: {
 
177
    expand_type_action_name:"LBL_Expand_Rulesets";
 
178
    collapse_type_action_name:"LBL_Collapse_Rulesets";
 
179
}
 
180
FOLD:mediaBody: {
 
181
    expand_type_action_name:"LBL_Expand_Rulesets";
 
182
    collapse_type_action_name:"LBL_Collapse_Rulesets";
 
183
}
 
184
FOLD:css_comment: {
 
185
    expand_type_action_name:"LBL_Expand_Comments";
 
186
    collapse_type_action_name:"LBL_Collapse_Comments";
 
187
}
 
188
 
 
189
########### navigator ##########################################################
 
190
 
 
191
NAVIGATOR:media: {
 
192
    display_name: "@media $mediaName$";
 
193
    icon: "org/netbeans/modules/languages/resources/style_sheet_16.png";
 
194
}
 
195
 
 
196
NAVIGATOR:ruleset: {
 
197
    display_name: "$selectors$";
 
198
    tooltip: org.netbeans.modules.languages.css.CSS.navigatorTooltip;
 
199
    icon: "org/netbeans/modules/languages/resources/style_sheet_16.png";
 
200
}
 
201
 
 
202
HYPERLINK:string: org.netbeans.modules.languages.css.CSS.hyperlink  
 
203
 
 
204
COMPLETE "(:)"
 
205
COMPLETE "{:}"
 
206
COMPLETE "\":\""
 
207
COMPLETE "':'"
 
208
 
 
209
INDENT "(:)"
 
210
INDENT "{:}"
 
211
 
 
212
REFORMAT:ruleset:"i"
 
213
REFORMAT:declarations:"++i"
 
214
REFORMAT:css_key:"i"
 
215
REFORMAT:body:" "
 
216
REFORMAT:value:" "
 
217
 
 
218
 
 
219
########### completion #########################################################
 
220
 
 
221
COMPLETION:css_identifier, css_operator, css_operator2, css_comment, css_whitespace: {
 
222
    recursive:    "true";
 
223
    text1: "azimuth";
 
224
    text2: "background-attachment";
 
225
    text3: "background-color";
 
226
    text4: "background-image";
 
227
    text5: "background-position";
 
228
    text6: "background-repeat";
 
229
    text7: "background";
 
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";
 
251
    text29: "border";
 
252
    text30: "bottom";
 
253
    text31: "caption-side";
 
254
    text32: "clear";
 
255
    text33: "clip";
 
256
    text34: "color";
 
257
    text35: "content";
 
258
    text36: "counter-increment";
 
259
    text37: "counter-reset";
 
260
    text38: "cue-after";
 
261
    text39: "cue-before";
 
262
    text40: "cue";
 
263
    text41: "cursor";
 
264
    text42: "direction";
 
265
    text43: "display";
 
266
    text44: "elevation";        
 
267
    text45: "empty-cells";      
 
268
    text46: "float";    
 
269
    text47: "font-family";      
 
270
    text48: "font-size";
 
271
    text49: "font-style";       
 
272
    text50: "font-variant";     
 
273
    text51: "font-weight";      
 
274
    text52: "font";     
 
275
    text53: "height";   
 
276
    text54: "left";     
 
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";    
 
287
    text65: "margin";   
 
288
    text66: "max-height";       
 
289
    text67: "max-width";        
 
290
    text68: "min-height";       
 
291
    text69: "min-width";        
 
292
    text70: "orphans";  
 
293
    text71: "outline-color";    
 
294
    text72: "outline-style";    
 
295
    text73: "outline-width";    
 
296
    text74: "outline";  
 
297
    text75: "overflow";         
 
298
    text76: "padding-top"; 
 
299
    text77: "padding-right"; 
 
300
    text78: "padding-bottom"; 
 
301
    text79: "padding-left";     
 
302
    text80: "padding";  
 
303
    text81: "page-break-after";         
 
304
    text82: "page-break-before";        
 
305
    text83: "page-break-inside";        
 
306
    text84: "pause-after";      
 
307
    text85: "pause-before";     
 
308
    text86: "pause";    
 
309
    text87: "pitch-range";      
 
310
    text88: "pitch";    
 
311
    text89: "play-during";      
 
312
    text90: "position";         
 
313
    text91: "quotes";   
 
314
    text92: "richness";         
 
315
    text93: "right";    
 
316
    text94: "speak-header";     
 
317
    text95: "speak-numeral";    
 
318
    text96: "speak-punctuation";        
 
319
    text97: "speak";    
 
320
    text98: "speech-rate";      
 
321
    text99: "stress";   
 
322
    text100: "table-layout";    
 
323
    text101: "text-align";      
 
324
    text102: "text-decoration";         
 
325
    text103: "text-indent";     
 
326
    text104: "text-transform";  
 
327
    text105: "top";     
 
328
    text106: "unicode-bidi";    
 
329
    text107: "vertical-align";  
 
330
    text108: "visibility";      
 
331
    text109: "voice-family";    
 
332
    text110: "volume";  
 
333
    text111: "white-space";     
 
334
    text112: "widows";  
 
335
    text113: "width";   
 
336
    text114: "word-spacing";    
 
337
    text115: "z-index"; 
 
338
}
 
339
 
 
340
MARK:ERROR: {
 
341
    type:"Error";
 
342
    message:"LBL_SYNTAX_ERROR";
 
343
}
 
344
 
 
345
PROPERTIES {
 
346
    navigator_sort:"true"; 
 
347
    #traceSteps:"true";
 
348
    #printRules:"true";
 
349
    #printFirst:"true";
 
350
}
 
351
 
 
352
BUNDLE "org.netbeans.modules.languages.css.Bundle"
 
353
 
 
354
COMMENT_LINE {
 
355
    prefix:"/*";
 
356
    suffix:"*/";
 
357
}
 
 
b'\\ No newline at end of file'