swagr 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +20 -0
- data/bin/swagr +37 -9
- data/examples/examples01/app.rb +5 -1
- data/examples/examples01/views/edit.slim +31 -0
- data/examples/examples01/views/footer.slim +1 -1
- data/examples/examples01/views/layout.slim +23 -5
- data/examples/examples01/views/navbar.slim +17 -16
- data/lib/swagr/version.rb +3 -1
- data/templates/app.rb +5 -1
- data/templates/static/js/codemirror/keymap/vim.js +279 -66
- data/templates/static/js/codemirror/lib/codemirror.css +10 -9
- data/templates/static/js/codemirror/lib/codemirror.js +385 -152
- data/templates/static/js/codemirror/mode/apl/apl.js +160 -0
- data/templates/static/js/codemirror/mode/apl/index.html +61 -0
- data/templates/static/js/codemirror/mode/asterisk/asterisk.js +183 -0
- data/templates/static/js/codemirror/mode/asterisk/index.html +142 -0
- data/templates/static/js/codemirror/mode/clike/clike.js +2 -0
- data/templates/static/js/codemirror/mode/clike/index.html +1 -1
- data/templates/static/js/codemirror/mode/clike/scala.html +1 -1
- data/templates/static/js/codemirror/mode/clojure/clojure.js +3 -3
- data/templates/static/js/codemirror/mode/css/css.js +2 -2
- data/templates/static/js/codemirror/mode/css/test.js +76 -471
- data/templates/static/js/codemirror/mode/d/d.js +205 -0
- data/templates/static/js/codemirror/mode/d/index.html +262 -0
- data/templates/static/js/codemirror/mode/erlang/index.html +1 -1
- data/templates/static/js/codemirror/mode/gfm/gfm.js +2 -1
- data/templates/static/js/codemirror/mode/gfm/index.html +1 -2
- data/templates/static/js/codemirror/mode/gfm/test.js +84 -225
- data/templates/static/js/codemirror/mode/go/index.html +1 -1
- data/templates/static/js/codemirror/mode/groovy/index.html +1 -1
- data/templates/static/js/codemirror/mode/haskell/index.html +1 -1
- data/templates/static/js/codemirror/mode/javascript/index.html +2 -2
- data/templates/static/js/codemirror/mode/javascript/javascript.js +13 -2
- data/templates/static/js/codemirror/mode/less/index.html +1 -1
- data/templates/static/js/codemirror/mode/lua/index.html +1 -1
- data/templates/static/js/codemirror/mode/markdown/index.html +1 -1
- data/templates/static/js/codemirror/mode/markdown/markdown.js +8 -7
- data/templates/static/js/codemirror/mode/markdown/test.js +579 -1266
- data/templates/static/js/codemirror/mode/meta.js +71 -0
- data/templates/static/js/codemirror/mode/mysql/index.html +2 -0
- data/templates/static/js/codemirror/mode/ocaml/index.html +1 -1
- data/templates/static/js/codemirror/mode/php/index.html +1 -1
- data/templates/static/js/codemirror/mode/plsql/index.html +2 -0
- data/templates/static/js/codemirror/mode/python/index.html +1 -1
- data/templates/static/js/codemirror/mode/ruby/index.html +1 -1
- data/templates/static/js/codemirror/mode/sass/index.html +54 -0
- data/templates/static/js/codemirror/mode/sass/sass.js +349 -0
- data/templates/static/js/codemirror/mode/shell/index.html +1 -1
- data/templates/static/js/codemirror/mode/sieve/LICENSE +0 -4
- data/templates/static/js/codemirror/mode/sieve/sieve.js +37 -10
- data/templates/static/js/codemirror/mode/smalltalk/index.html +1 -1
- data/templates/static/js/codemirror/mode/sparql/index.html +1 -1
- data/templates/static/js/codemirror/mode/sql/index.html +68 -0
- data/templates/static/js/codemirror/mode/sql/sql.js +268 -0
- data/templates/static/js/codemirror/mode/stex/test.js +104 -343
- data/templates/static/js/codemirror/mode/tiddlywiki/index.html +1 -1
- data/templates/static/js/codemirror/mode/vb/index.html +1 -1
- data/templates/static/js/codemirror/mode/xquery/test.js +54 -67
- data/templates/static/js/codemirror/mode/xquery/xquery.js +8 -8
- data/templates/static/js/crossfilter.min.js +1 -0
- data/templates/views/edit.slim +31 -0
- data/templates/views/footer.slim +1 -1
- data/templates/views/layout.slim +23 -5
- data/templates/views/navbar.slim +17 -16
- metadata +16 -30
- data/examples/examples01/static/css/codemirror.css +0 -1247
- data/examples/examples01/static/js/codemirror-compressed-3-0.js +0 -5
- data/examples/examples01/views/about.slim +0 -15
- data/examples/examples01/views/application.slim +0 -0
- data/examples/examples01/views/layout_cm.slim +0 -17
- data/templates/static/js/codemirror/lib/util/closetag.js +0 -85
- data/templates/static/js/codemirror/lib/util/colorize.js +0 -29
- data/templates/static/js/codemirror/lib/util/continuecomment.js +0 -36
- data/templates/static/js/codemirror/lib/util/continuelist.js +0 -28
- data/templates/static/js/codemirror/lib/util/dialog.css +0 -32
- data/templates/static/js/codemirror/lib/util/dialog.js +0 -75
- data/templates/static/js/codemirror/lib/util/foldcode.js +0 -182
- data/templates/static/js/codemirror/lib/util/formatting.js +0 -108
- data/templates/static/js/codemirror/lib/util/javascript-hint.js +0 -137
- data/templates/static/js/codemirror/lib/util/loadmode.js +0 -51
- data/templates/static/js/codemirror/lib/util/match-highlighter.js +0 -46
- data/templates/static/js/codemirror/lib/util/matchbrackets.js +0 -63
- data/templates/static/js/codemirror/lib/util/multiplex.js +0 -95
- data/templates/static/js/codemirror/lib/util/overlay.js +0 -59
- data/templates/static/js/codemirror/lib/util/pig-hint.js +0 -117
- data/templates/static/js/codemirror/lib/util/runmode-standalone.js +0 -90
- data/templates/static/js/codemirror/lib/util/runmode.js +0 -52
- data/templates/static/js/codemirror/lib/util/search.js +0 -119
- data/templates/static/js/codemirror/lib/util/searchcursor.js +0 -119
- data/templates/static/js/codemirror/lib/util/simple-hint.css +0 -16
- data/templates/static/js/codemirror/lib/util/simple-hint.js +0 -102
- data/templates/static/js/codemirror/lib/util/xml-hint.js +0 -131
- data/templates/views/about.slim +0 -15
@@ -1,6 +1,7 @@
|
|
1
1
|
CodeMirror.defineMode("clike", function(config, parserConfig) {
|
2
2
|
var indentUnit = config.indentUnit,
|
3
3
|
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
|
4
|
+
dontAlignCalls = parserConfig.dontAlignCalls,
|
4
5
|
keywords = parserConfig.keywords || {},
|
5
6
|
builtin = parserConfig.builtin || {},
|
6
7
|
blockKeywords = parserConfig.blockKeywords || {},
|
@@ -149,6 +150,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
149
150
|
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
150
151
|
var closing = firstChar == ctx.type;
|
151
152
|
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
153
|
+
else if (dontAlignCalls && ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
|
152
154
|
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
153
155
|
else return ctx.indented + (closing ? 0 : indentUnit);
|
154
156
|
},
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<title>CodeMirror: C-like mode</title>
|
6
6
|
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
7
|
<script src="../../lib/codemirror.js"></script>
|
8
|
-
<script src="../../
|
8
|
+
<script src="../../addon/edit/matchbrackets.js"></script>
|
9
9
|
<script src="clike.js"></script>
|
10
10
|
<link rel="stylesheet" href="../../doc/docs.css">
|
11
11
|
<style>.CodeMirror {border: 2px inset #dee;}</style>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
7
|
<link rel="stylesheet" href="../../theme/ambiance.css">
|
8
8
|
<script src="../../lib/codemirror.js"></script>
|
9
|
-
<script src="../../
|
9
|
+
<script src="../../addon/edit/matchbrackets.js"></script>
|
10
10
|
<script src="clike.js"></script>
|
11
11
|
<link rel="stylesheet" href="../../doc/docs.css">
|
12
12
|
<style>
|
@@ -142,7 +142,7 @@ CodeMirror.defineMode("clojure", function () {
|
|
142
142
|
returnType = COMMENT;
|
143
143
|
} else if (isNumber(ch,stream)){
|
144
144
|
returnType = NUMBER;
|
145
|
-
} else if (ch == "(" || ch == "[") {
|
145
|
+
} else if (ch == "(" || ch == "[" || ch == "{" ) {
|
146
146
|
var keyWord = '', indentTemp = stream.column(), letter;
|
147
147
|
/**
|
148
148
|
Either
|
@@ -172,9 +172,9 @@ CodeMirror.defineMode("clojure", function () {
|
|
172
172
|
stream.backUp(stream.current().length - 1); // undo all the eating
|
173
173
|
|
174
174
|
returnType = BRACKET;
|
175
|
-
} else if (ch == ")" || ch == "]") {
|
175
|
+
} else if (ch == ")" || ch == "]" || ch == "}") {
|
176
176
|
returnType = BRACKET;
|
177
|
-
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
|
177
|
+
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : (ch == "]" ? "[" :"{"))) {
|
178
178
|
popStack(state);
|
179
179
|
}
|
180
180
|
} else if ( ch == ":" ) {
|
@@ -222,14 +222,14 @@ CodeMirror.defineMode("css", function(config) {
|
|
222
222
|
stream.eatWhile(/[\w.%]/);
|
223
223
|
return ret("number", "unit");
|
224
224
|
} else if (stream.match(/^[^-]+-/)) {
|
225
|
-
return ret("meta",
|
225
|
+
return ret("meta", "meta");
|
226
226
|
}
|
227
227
|
}
|
228
228
|
else if (/[,+>*\/]/.test(ch)) {
|
229
229
|
return ret(null, "select-op");
|
230
230
|
}
|
231
231
|
else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
|
232
|
-
return ret("qualifier",
|
232
|
+
return ret("qualifier", "qualifier");
|
233
233
|
}
|
234
234
|
else if (ch == ":") {
|
235
235
|
return ret("operator", ch);
|
@@ -1,501 +1,106 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
MT.
|
4
|
-
MT.modeOptions = {};
|
1
|
+
(function() {
|
2
|
+
var mode = CodeMirror.getMode({tabSize: 4}, "css");
|
3
|
+
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 2)); }
|
5
4
|
|
6
|
-
// Requires at least one media query
|
7
|
-
MT
|
8
|
-
|
9
|
-
'@media { }',
|
10
|
-
[
|
11
|
-
'def', '@media',
|
12
|
-
null, ' ',
|
13
|
-
'error', '{',
|
14
|
-
null, ' }'
|
15
|
-
]
|
16
|
-
);
|
5
|
+
// Requires at least one media query
|
6
|
+
MT("atMediaEmpty",
|
7
|
+
"[def @media] [error {] }");
|
17
8
|
|
18
|
-
MT
|
19
|
-
|
20
|
-
'@media not screen and (color), not print and (color) { }',
|
21
|
-
[
|
22
|
-
'def', '@media',
|
23
|
-
null, ' ',
|
24
|
-
'keyword', 'not',
|
25
|
-
null, ' ',
|
26
|
-
'attribute', 'screen',
|
27
|
-
null, ' ',
|
28
|
-
'operator', 'and',
|
29
|
-
null, ' (',
|
30
|
-
'property', 'color',
|
31
|
-
null, '), ',
|
32
|
-
'keyword', 'not',
|
33
|
-
null, ' ',
|
34
|
-
'attribute', 'print',
|
35
|
-
null, ' ',
|
36
|
-
'operator', 'and',
|
37
|
-
null, ' (',
|
38
|
-
'property', 'color',
|
39
|
-
null, ') { }'
|
40
|
-
]
|
41
|
-
);
|
9
|
+
MT("atMediaMultiple",
|
10
|
+
"[def @media] [keyword not] [attribute screen] [operator and] ([property color]), [keyword not] [attribute print] [operator and] ([property color]) { }");
|
42
11
|
|
43
|
-
MT
|
44
|
-
|
45
|
-
'@media screen { } foo { }',
|
46
|
-
[
|
47
|
-
'def', '@media',
|
48
|
-
null, ' ',
|
49
|
-
'attribute', 'screen',
|
50
|
-
null, ' { } ',
|
51
|
-
'tag', 'foo',
|
52
|
-
null, ' { }'
|
53
|
-
]
|
54
|
-
);
|
12
|
+
MT("atMediaCheckStack",
|
13
|
+
"[def @media] [attribute screen] { } [tag foo] { }");
|
55
14
|
|
56
|
-
MT
|
57
|
-
|
58
|
-
'@media screen (color) { } foo { }',
|
59
|
-
[
|
60
|
-
'def', '@media',
|
61
|
-
null, ' ',
|
62
|
-
'attribute', 'screen',
|
63
|
-
null, ' (',
|
64
|
-
'property', 'color',
|
65
|
-
null, ') { } ',
|
66
|
-
'tag', 'foo',
|
67
|
-
null, ' { }'
|
68
|
-
]
|
69
|
-
);
|
15
|
+
MT("atMediaCheckStack",
|
16
|
+
"[def @media] [attribute screen] ([property color]) { } [tag foo] { }");
|
70
17
|
|
71
|
-
MT
|
72
|
-
|
73
|
-
'@media foobarhello { } foo { }',
|
74
|
-
[
|
75
|
-
'def', '@media',
|
76
|
-
null, ' ',
|
77
|
-
'attribute error', 'foobarhello',
|
78
|
-
null, ' { } ',
|
79
|
-
'tag', 'foo',
|
80
|
-
null, ' { }'
|
81
|
-
]
|
82
|
-
);
|
18
|
+
MT("atMediaCheckStackInvalidAttribute",
|
19
|
+
"[def @media] [attribute&error foobarhello] { } [tag foo] { }");
|
83
20
|
|
84
|
-
// Error, because "and" is only allowed immediately preceding a media expression
|
85
|
-
MT
|
86
|
-
|
87
|
-
'@media foobarhello { }',
|
88
|
-
[
|
89
|
-
'def', '@media',
|
90
|
-
null, ' ',
|
91
|
-
'attribute error', 'foobarhello',
|
92
|
-
null, ' { }'
|
93
|
-
]
|
94
|
-
);
|
21
|
+
// Error, because "and" is only allowed immediately preceding a media expression
|
22
|
+
MT("atMediaInvalidAttribute",
|
23
|
+
"[def @media] [attribute&error foobarhello] { }");
|
95
24
|
|
96
|
-
// Error, because "and" is only allowed immediately preceding a media expression
|
97
|
-
MT
|
98
|
-
|
99
|
-
'@media and screen { }',
|
100
|
-
[
|
101
|
-
'def', '@media',
|
102
|
-
null, ' ',
|
103
|
-
'error', 'and',
|
104
|
-
null, ' ',
|
105
|
-
'attribute', 'screen',
|
106
|
-
null, ' { }'
|
107
|
-
]
|
108
|
-
);
|
25
|
+
// Error, because "and" is only allowed immediately preceding a media expression
|
26
|
+
MT("atMediaInvalidAnd",
|
27
|
+
"[def @media] [error and] [attribute screen] { }");
|
109
28
|
|
110
|
-
// Error, because "not" is only allowed as the first item in each media query
|
111
|
-
MT
|
112
|
-
|
113
|
-
'@media screen not (not) { }',
|
114
|
-
[
|
115
|
-
'def', '@media',
|
116
|
-
null, ' ',
|
117
|
-
'attribute', 'screen',
|
118
|
-
null, ' ',
|
119
|
-
'error', 'not',
|
120
|
-
null, ' (',
|
121
|
-
'error', 'not',
|
122
|
-
null, ') { }'
|
123
|
-
]
|
124
|
-
);
|
29
|
+
// Error, because "not" is only allowed as the first item in each media query
|
30
|
+
MT("atMediaInvalidNot",
|
31
|
+
"[def @media] [attribute screen] [error not] ([error not]) { }");
|
125
32
|
|
126
|
-
// Error, because "only" is only allowed as the first item in each media query
|
127
|
-
MT
|
128
|
-
|
129
|
-
'@media screen only (only) { }',
|
130
|
-
[
|
131
|
-
'def', '@media',
|
132
|
-
null, ' ',
|
133
|
-
'attribute', 'screen',
|
134
|
-
null, ' ',
|
135
|
-
'error', 'only',
|
136
|
-
null, ' (',
|
137
|
-
'error', 'only',
|
138
|
-
null, ') { }'
|
139
|
-
]
|
140
|
-
);
|
33
|
+
// Error, because "only" is only allowed as the first item in each media query
|
34
|
+
MT("atMediaInvalidOnly",
|
35
|
+
"[def @media] [attribute screen] [error only] ([error only]) { }");
|
141
36
|
|
142
|
-
// Error, because "foobarhello" is neither a known type or property, but
|
143
|
-
// property was expected (after "and"), and it should be in parenthese.
|
144
|
-
MT
|
145
|
-
|
146
|
-
'@media screen and foobarhello { }',
|
147
|
-
[
|
148
|
-
'def', '@media',
|
149
|
-
null, ' ',
|
150
|
-
'attribute', 'screen',
|
151
|
-
null, ' ',
|
152
|
-
'operator', 'and',
|
153
|
-
null, ' ',
|
154
|
-
'error', 'foobarhello',
|
155
|
-
null, ' { }'
|
156
|
-
]
|
157
|
-
);
|
37
|
+
// Error, because "foobarhello" is neither a known type or property, but
|
38
|
+
// property was expected (after "and"), and it should be in parenthese.
|
39
|
+
MT("atMediaUnknownType",
|
40
|
+
"[def @media] [attribute screen] [operator and] [error foobarhello] { }");
|
158
41
|
|
159
|
-
// Error, because "color" is not a known type, but is a known property, and
|
160
|
-
// should be in parentheses.
|
161
|
-
MT
|
162
|
-
|
163
|
-
'@media screen and color { }',
|
164
|
-
[
|
165
|
-
'def', '@media',
|
166
|
-
null, ' ',
|
167
|
-
'attribute', 'screen',
|
168
|
-
null, ' ',
|
169
|
-
'operator', 'and',
|
170
|
-
null, ' ',
|
171
|
-
'error', 'color',
|
172
|
-
null, ' { }'
|
173
|
-
]
|
174
|
-
);
|
42
|
+
// Error, because "color" is not a known type, but is a known property, and
|
43
|
+
// should be in parentheses.
|
44
|
+
MT("atMediaInvalidType",
|
45
|
+
"[def @media] [attribute screen] [operator and] [error color] { }");
|
175
46
|
|
176
|
-
// Error, because "print" is not a known property, but is a known type,
|
177
|
-
// and should not be in parenthese.
|
178
|
-
MT
|
179
|
-
|
180
|
-
'@media screen and (print) { }',
|
181
|
-
[
|
182
|
-
'def', '@media',
|
183
|
-
null, ' ',
|
184
|
-
'attribute', 'screen',
|
185
|
-
null, ' ',
|
186
|
-
'operator', 'and',
|
187
|
-
null, ' (',
|
188
|
-
'error', 'print',
|
189
|
-
null, ') { }'
|
190
|
-
]
|
191
|
-
);
|
47
|
+
// Error, because "print" is not a known property, but is a known type,
|
48
|
+
// and should not be in parenthese.
|
49
|
+
MT("atMediaInvalidProperty",
|
50
|
+
"[def @media] [attribute screen] [operator and] ([error print]) { }");
|
192
51
|
|
193
|
-
// Soft error, because "foobarhello" is not a known property or type.
|
194
|
-
MT
|
195
|
-
|
196
|
-
'@media screen and (foobarhello) { }',
|
197
|
-
[
|
198
|
-
'def', '@media',
|
199
|
-
null, ' ',
|
200
|
-
'attribute', 'screen',
|
201
|
-
null, ' ',
|
202
|
-
'operator', 'and',
|
203
|
-
null, ' (',
|
204
|
-
'property error', 'foobarhello',
|
205
|
-
null, ') { }'
|
206
|
-
]
|
207
|
-
);
|
52
|
+
// Soft error, because "foobarhello" is not a known property or type.
|
53
|
+
MT("atMediaUnknownProperty",
|
54
|
+
"[def @media] [attribute screen] [operator and] ([property&error foobarhello]) { }");
|
208
55
|
|
209
|
-
MT
|
210
|
-
|
211
|
-
'foo { }',
|
212
|
-
[
|
213
|
-
'tag', 'foo',
|
214
|
-
null, ' { }'
|
215
|
-
]
|
216
|
-
);
|
56
|
+
MT("tagSelector",
|
57
|
+
"[tag foo] { }");
|
217
58
|
|
218
|
-
MT
|
219
|
-
|
220
|
-
'.foo-bar_hello { }',
|
221
|
-
[
|
222
|
-
'qualifier', '.foo-bar_hello',
|
223
|
-
null, ' { }'
|
224
|
-
]
|
225
|
-
);
|
59
|
+
MT("classSelector",
|
60
|
+
"[qualifier .foo-bar_hello] { }");
|
226
61
|
|
227
|
-
MT
|
228
|
-
|
229
|
-
'#foo { #foo }',
|
230
|
-
[
|
231
|
-
'builtin', '#foo',
|
232
|
-
null, ' { ',
|
233
|
-
'error', '#foo',
|
234
|
-
null, ' }'
|
235
|
-
]
|
236
|
-
);
|
62
|
+
MT("idSelector",
|
63
|
+
"[builtin #foo] { [error #foo] }");
|
237
64
|
|
238
|
-
MT
|
239
|
-
|
240
|
-
'foo { margin: 0 } bar { }',
|
241
|
-
[
|
242
|
-
'tag', 'foo',
|
243
|
-
null, ' { ',
|
244
|
-
'property', 'margin',
|
245
|
-
'operator', ':',
|
246
|
-
null, ' ',
|
247
|
-
'number', '0',
|
248
|
-
null, ' } ',
|
249
|
-
'tag', 'bar',
|
250
|
-
null, ' { }'
|
251
|
-
]
|
252
|
-
);
|
65
|
+
MT("tagSelectorUnclosed",
|
66
|
+
"[tag foo] { [property margin][operator :] [number 0] } [tag bar] { }");
|
253
67
|
|
254
|
-
MT
|
255
|
-
|
256
|
-
'foo { font-family: hello world; }',
|
257
|
-
[
|
258
|
-
'tag', 'foo',
|
259
|
-
null, ' { ',
|
260
|
-
'property', 'font-family',
|
261
|
-
'operator', ':',
|
262
|
-
null, ' ',
|
263
|
-
'variable-2', 'hello',
|
264
|
-
null, ' ',
|
265
|
-
'variable-2', 'world',
|
266
|
-
null, '; }'
|
267
|
-
]
|
268
|
-
);
|
68
|
+
MT("tagStringNoQuotes",
|
69
|
+
"[tag foo] { [property font-family][operator :] [variable-2 hello] [variable-2 world]; }");
|
269
70
|
|
270
|
-
MT
|
271
|
-
|
272
|
-
'foo { font-family: "hello world"; }',
|
273
|
-
[
|
274
|
-
'tag', 'foo',
|
275
|
-
null, ' { ',
|
276
|
-
'property', 'font-family',
|
277
|
-
'operator', ':',
|
278
|
-
null, ' ',
|
279
|
-
'string', '"hello world"',
|
280
|
-
null, '; }'
|
281
|
-
]
|
282
|
-
);
|
71
|
+
MT("tagStringDouble",
|
72
|
+
"[tag foo] { [property font-family][operator :] [string \"hello world\"]; }");
|
283
73
|
|
284
|
-
MT
|
285
|
-
|
286
|
-
'foo { font-family: \'hello world\'; }',
|
287
|
-
[
|
288
|
-
'tag', 'foo',
|
289
|
-
null, ' { ',
|
290
|
-
'property', 'font-family',
|
291
|
-
'operator', ':',
|
292
|
-
null, ' ',
|
293
|
-
'string', '\'hello world\'',
|
294
|
-
null, '; }'
|
295
|
-
]
|
296
|
-
);
|
74
|
+
MT("tagStringSingle",
|
75
|
+
"[tag foo] { [property font-family][operator :] [string 'hello world']; }");
|
297
76
|
|
298
|
-
MT
|
299
|
-
|
300
|
-
'foo { color: black; }',
|
301
|
-
[
|
302
|
-
'tag', 'foo',
|
303
|
-
null, ' { ',
|
304
|
-
'property', 'color',
|
305
|
-
'operator', ':',
|
306
|
-
null, ' ',
|
307
|
-
'keyword', 'black',
|
308
|
-
null, '; }'
|
309
|
-
]
|
310
|
-
);
|
77
|
+
MT("tagColorKeyword",
|
78
|
+
"[tag foo] { [property color][operator :] [keyword black]; }");
|
311
79
|
|
312
|
-
MT
|
313
|
-
|
314
|
-
'foo { background: #fff; }',
|
315
|
-
[
|
316
|
-
'tag', 'foo',
|
317
|
-
null, ' { ',
|
318
|
-
'property', 'background',
|
319
|
-
'operator', ':',
|
320
|
-
null, ' ',
|
321
|
-
'atom', '#fff',
|
322
|
-
null, '; }'
|
323
|
-
]
|
324
|
-
);
|
80
|
+
MT("tagColorHex3",
|
81
|
+
"[tag foo] { [property background][operator :] [atom #fff]; }");
|
325
82
|
|
326
|
-
MT
|
327
|
-
|
328
|
-
'foo { background: #ffffff; }',
|
329
|
-
[
|
330
|
-
'tag', 'foo',
|
331
|
-
null, ' { ',
|
332
|
-
'property', 'background',
|
333
|
-
'operator', ':',
|
334
|
-
null, ' ',
|
335
|
-
'atom', '#ffffff',
|
336
|
-
null, '; }'
|
337
|
-
]
|
338
|
-
);
|
83
|
+
MT("tagColorHex6",
|
84
|
+
"[tag foo] { [property background][operator :] [atom #ffffff]; }");
|
339
85
|
|
340
|
-
MT
|
341
|
-
|
342
|
-
'foo { background: #ffff; }',
|
343
|
-
[
|
344
|
-
'tag', 'foo',
|
345
|
-
null, ' { ',
|
346
|
-
'property', 'background',
|
347
|
-
'operator', ':',
|
348
|
-
null, ' ',
|
349
|
-
'atom error', '#ffff',
|
350
|
-
null, '; }'
|
351
|
-
]
|
352
|
-
);
|
86
|
+
MT("tagColorHex4",
|
87
|
+
"[tag foo] { [property background][operator :] [atom&error #ffff]; }");
|
353
88
|
|
354
|
-
MT
|
355
|
-
|
356
|
-
'foo { background: #ffg; }',
|
357
|
-
[
|
358
|
-
'tag', 'foo',
|
359
|
-
null, ' { ',
|
360
|
-
'property', 'background',
|
361
|
-
'operator', ':',
|
362
|
-
null, ' ',
|
363
|
-
'atom error', '#ffg',
|
364
|
-
null, '; }'
|
365
|
-
]
|
366
|
-
);
|
89
|
+
MT("tagColorHexInvalid",
|
90
|
+
"[tag foo] { [property background][operator :] [atom&error #ffg]; }");
|
367
91
|
|
368
|
-
MT
|
369
|
-
|
370
|
-
'foo { margin: -5px; }',
|
371
|
-
[
|
372
|
-
'tag', 'foo',
|
373
|
-
null, ' { ',
|
374
|
-
'property', 'margin',
|
375
|
-
'operator', ':',
|
376
|
-
null, ' ',
|
377
|
-
'number', '-5px',
|
378
|
-
null, '; }'
|
379
|
-
]
|
380
|
-
);
|
92
|
+
MT("tagNegativeNumber",
|
93
|
+
"[tag foo] { [property margin][operator :] [number -5px]; }");
|
381
94
|
|
382
|
-
MT
|
383
|
-
|
384
|
-
'foo { padding: 5px; }',
|
385
|
-
[
|
386
|
-
'tag', 'foo',
|
387
|
-
null, ' { ',
|
388
|
-
'property', 'padding',
|
389
|
-
'operator', ':',
|
390
|
-
null, ' ',
|
391
|
-
'number', '5px',
|
392
|
-
null, '; }'
|
393
|
-
]
|
394
|
-
);
|
95
|
+
MT("tagPositiveNumber",
|
96
|
+
"[tag foo] { [property padding][operator :] [number 5px]; }");
|
395
97
|
|
396
|
-
MT
|
397
|
-
|
398
|
-
'foo { -foo-box-sizing: -foo-border-box; }',
|
399
|
-
[
|
400
|
-
'tag', 'foo',
|
401
|
-
null, ' { ',
|
402
|
-
'meta', '-foo-',
|
403
|
-
'property', 'box-sizing',
|
404
|
-
'operator', ':',
|
405
|
-
null, ' ',
|
406
|
-
'meta', '-foo-',
|
407
|
-
'string-2', 'border-box',
|
408
|
-
null, '; }'
|
409
|
-
]
|
410
|
-
);
|
98
|
+
MT("tagVendor",
|
99
|
+
"[tag foo] { [meta -foo-][property box-sizing][operator :] [meta -foo-][string-2 border-box]; }");
|
411
100
|
|
412
|
-
MT
|
413
|
-
|
414
|
-
'foo { barhelloworld: 0; }',
|
415
|
-
[
|
416
|
-
'tag', 'foo',
|
417
|
-
null, ' { ',
|
418
|
-
'property error', 'barhelloworld',
|
419
|
-
'operator', ':',
|
420
|
-
null, ' ',
|
421
|
-
'number', '0',
|
422
|
-
null, '; }'
|
423
|
-
]
|
424
|
-
);
|
101
|
+
MT("tagBogusProperty",
|
102
|
+
"[tag foo] { [property&error barhelloworld][operator :] [number 0]; }");
|
425
103
|
|
426
|
-
MT
|
427
|
-
|
428
|
-
|
429
|
-
[
|
430
|
-
'tag', 'foo',
|
431
|
-
null, ' { ',
|
432
|
-
'property', 'margin',
|
433
|
-
'operator', ':',
|
434
|
-
null, ' ',
|
435
|
-
'number', '0',
|
436
|
-
null, '; ',
|
437
|
-
'property', 'padding',
|
438
|
-
'operator', ':',
|
439
|
-
null, ' ',
|
440
|
-
'number', '0',
|
441
|
-
null, '; }'
|
442
|
-
]
|
443
|
-
);
|
444
|
-
//
|
445
|
-
//MT.testMode(
|
446
|
-
// 'tagClass',
|
447
|
-
// '@media only screen and (min-width: 500px), print {foo.bar#hello { color: black !important; background: #f00; margin: -5px; padding: 5px; -foo-box-sizing: border-box; } /* world */}',
|
448
|
-
// [
|
449
|
-
// 'def', '@media',
|
450
|
-
// null, ' ',
|
451
|
-
// 'keyword', 'only',
|
452
|
-
// null, ' ',
|
453
|
-
// 'attribute', 'screen',
|
454
|
-
// null, ' ',
|
455
|
-
// 'operator', 'and',
|
456
|
-
// null, ' ',
|
457
|
-
// 'bracket', '(',
|
458
|
-
// 'property', 'min-width',
|
459
|
-
// 'operator', ':',
|
460
|
-
// null, ' ',
|
461
|
-
// 'number', '500px',
|
462
|
-
// 'bracket', ')',
|
463
|
-
// null, ', ',
|
464
|
-
// 'attribute', 'print',
|
465
|
-
// null, ' {',
|
466
|
-
// 'tag', 'foo',
|
467
|
-
// 'qualifier', '.bar',
|
468
|
-
// 'header', '#hello',
|
469
|
-
// null, ' { ',
|
470
|
-
// 'property', 'color',
|
471
|
-
// 'operator', ':',
|
472
|
-
// null, ' ',
|
473
|
-
// 'keyword', 'black',
|
474
|
-
// null, ' ',
|
475
|
-
// 'keyword', '!important',
|
476
|
-
// null, '; ',
|
477
|
-
// 'property', 'background',
|
478
|
-
// 'operator', ':',
|
479
|
-
// null, ' ',
|
480
|
-
// 'atom', '#f00',
|
481
|
-
// null, '; ',
|
482
|
-
// 'property', 'padding',
|
483
|
-
// 'operator', ':',
|
484
|
-
// null, ' ',
|
485
|
-
// 'number', '5px',
|
486
|
-
// null, '; ',
|
487
|
-
// 'property', 'margin',
|
488
|
-
// 'operator', ':',
|
489
|
-
// null, ' ',
|
490
|
-
// 'number', '-5px',
|
491
|
-
// null, '; ',
|
492
|
-
// 'meta', '-foo-',
|
493
|
-
// 'property', 'box-sizing',
|
494
|
-
// 'operator', ':',
|
495
|
-
// null, ' ',
|
496
|
-
// 'string-2', 'border-box',
|
497
|
-
// null, '; } ',
|
498
|
-
// 'comment', '/* world */',
|
499
|
-
// null, '}'
|
500
|
-
// ]
|
501
|
-
//);
|
104
|
+
MT("tagTwoProperties",
|
105
|
+
"[tag foo] { [property margin][operator :] [number 0]; [property padding][operator :] [number 0]; }");
|
106
|
+
})();
|