codemirror-lang-glimmer 0.0.0-beta.3 → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +2 -2
- package/.turbo/turbo-build.log +5 -21
- package/.turbo/turbo-lint$colon$js$colon$fix.log +7 -0
- package/.turbo/turbo-lint$colon$js.log +7 -0
- package/.turbo/turbo-lint$colon$prettier$colon$fix.log +15 -0
- package/.turbo/turbo-lint$colon$prettier.log +9 -0
- package/.turbo/turbo-lint$colon$types.log +5 -0
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/dev/.eslintcache +1 -0
- package/dev/.eslintrc.cjs +2 -2
- package/dev/CHANGELOG.md +3 -0
- package/dev/index.html +1 -1
- package/dev/index.ts +43 -3
- package/dev/node_modules/.bin/eslint +4 -4
- package/dev/node_modules/.bin/prettier +4 -4
- package/dev/node_modules/.bin/tsc +4 -4
- package/dev/node_modules/.bin/tsserver +4 -4
- package/dev/node_modules/.bin/vite +4 -4
- package/dev/package.json +28 -16
- package/dev/watch.cjs +3 -3
- package/dist/index.cjs +222 -321
- package/dist/index.d.cts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.js +224 -325
- package/package.json +42 -26
- package/src/auto-close.ts +91 -0
- package/src/glimmer.ts +79 -0
- package/src/index.ts +3 -154
- package/src/language.ts +176 -0
- package/src/snippets.ts +48 -0
- package/tsconfig.json +2 -1
- package/.eslintignore +0 -2
- package/.prettierignore +0 -2
- package/.prettierrc.cjs +0 -20
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/src/highlight.ts +0 -57
- package/src/syntax.grammar +0 -139
- package/src/syntax.grammar.d.ts +0 -3
- package/src/syntax.grammar.terms.d.ts +0 -14
- package/src/tokens.ts +0 -277
- package/tests/.eslintrc.cjs +0 -5
- package/tests/comments.txt +0 -116
- package/tests/complex.txt +0 -24
- package/tests/expression.txt +0 -95
- package/tests/literals.txt +0 -78
- package/tests/node_modules/.bin/eslint +0 -17
- package/tests/node_modules/.bin/prettier +0 -17
- package/tests/node_modules/.bin/tsc +0 -17
- package/tests/node_modules/.bin/tsserver +0 -17
- package/tests/numbers.txt +0 -88
- package/tests/package.json +0 -25
- package/tests/property-paths.txt +0 -79
- package/tests/strings.txt +0 -64
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts","../src/tokens.ts","../src/highlight.ts"],"names":[],"mappings":"AACA,OAAO,+BAA6D,MAAM,sBAAsB,CAAC;AAQjG,QAAO,MAAM,aAAa,8BAAS,CAAC;AAEpC,QAAO,MAAM,eAAe,YA0I1B,CAAC;AAEH,iBAAgB,OAAO,oBAEtB"}
|
package/src/highlight.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { styleTags, tags as t } from '@lezer/highlight';
|
|
2
|
-
|
|
3
|
-
export const glimmerHighlighting = styleTags({
|
|
4
|
-
'Text RawText': t.content,
|
|
5
|
-
'StartTag StartCloseTag SelfClosingEndTag EndTag': t.angleBracket,
|
|
6
|
-
TagName: t.tagName,
|
|
7
|
-
'MismatchedCloseTag/TagName': [t.tagName, t.invalid],
|
|
8
|
-
AttributeName: t.attributeName,
|
|
9
|
-
|
|
10
|
-
// Glimmer
|
|
11
|
-
TemplateTag: t.definition(t.annotation),
|
|
12
|
-
'{{ }}': t.bracket,
|
|
13
|
-
'( )': t.paren,
|
|
14
|
-
Function: t.function(t.name),
|
|
15
|
-
Splattributes: t.derefOperator,
|
|
16
|
-
Comment: t.blockComment,
|
|
17
|
-
ShortComment: t.blockComment,
|
|
18
|
-
LongComment: t.blockComment,
|
|
19
|
-
HtmlComment: t.blockComment,
|
|
20
|
-
ArgName: t.attributeName,
|
|
21
|
-
Argument: t.propertyName,
|
|
22
|
-
NamedBlock: t.tagName,
|
|
23
|
-
Is: t.definitionOperator,
|
|
24
|
-
Pipe: t.definitionOperator,
|
|
25
|
-
|
|
26
|
-
as: t.definitionOperator,
|
|
27
|
-
let: t.function(t.definitionOperator),
|
|
28
|
-
this: t.self,
|
|
29
|
-
yield: t.operatorKeyword,
|
|
30
|
-
outlet: t.operatorKeyword,
|
|
31
|
-
|
|
32
|
-
component: t.function(t.definitionKeyword),
|
|
33
|
-
modifier: t.function(t.definitionKeyword),
|
|
34
|
-
helper: t.function(t.definitionKeyword),
|
|
35
|
-
hash: t.function(t.definitionKeyword),
|
|
36
|
-
array: t.function(t.definitionKeyword),
|
|
37
|
-
on: t.function(t.definitionKeyword),
|
|
38
|
-
concat: t.function(t.operatorKeyword),
|
|
39
|
-
'if then catch unless else each each-in': t.controlKeyword,
|
|
40
|
-
|
|
41
|
-
// TODO:
|
|
42
|
-
UnquotedAttributeValue: t.attributeValue,
|
|
43
|
-
'DoubleQuote SingleQuote AttributeValueContent': t.attributeValue,
|
|
44
|
-
'EntityReference CharacterReference': t.character,
|
|
45
|
-
'[ ]': t.squareBracket,
|
|
46
|
-
|
|
47
|
-
ComponentName: t.className,
|
|
48
|
-
StyleAttributeName: t.propertyName,
|
|
49
|
-
BlockType: t.controlKeyword,
|
|
50
|
-
BlockPrefix: t.typeOperator,
|
|
51
|
-
'UnknownBlock/BlockType': t.invalid,
|
|
52
|
-
UnknownBlockContent: t.invalid,
|
|
53
|
-
|
|
54
|
-
Variable: t.variableName,
|
|
55
|
-
Modifier: t.modifier,
|
|
56
|
-
ModifierValue: t.function(t.modifier),
|
|
57
|
-
});
|
package/src/syntax.grammar
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
@top Template { entity* }
|
|
2
|
-
|
|
3
|
-
@skip { whitespace }
|
|
4
|
-
|
|
5
|
-
GlimmerTemplateTag {
|
|
6
|
-
templateTagStart templateTagContent* templateTagEnd
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
entity {
|
|
10
|
-
GlimmerTemplateTag
|
|
11
|
-
| Comment
|
|
12
|
-
| MoustacheExpression
|
|
13
|
-
| Splattributes
|
|
14
|
-
| NamedBlock
|
|
15
|
-
// Arguments needs to be "anywhere", beacuse it can be in Element-space.
|
|
16
|
-
// TODO: only allow within Element-space or in an SExpression
|
|
17
|
-
// TODO: define what Element-space is
|
|
18
|
-
// (more parseMixed logic?)
|
|
19
|
-
| Argument
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Splattributes { "...attributes" }
|
|
23
|
-
NamedBlock { ":" identifier }
|
|
24
|
-
Argument { "@" identifier }
|
|
25
|
-
Function { ~identifier }
|
|
26
|
-
|
|
27
|
-
CallExpression { "(" ~Function SExpression? (identifier Is SExpression)? ")" }
|
|
28
|
-
|
|
29
|
-
SExpression {
|
|
30
|
-
CallExpression
|
|
31
|
-
| identifier
|
|
32
|
-
| Is
|
|
33
|
-
| Pipe
|
|
34
|
-
| Argument
|
|
35
|
-
//| String
|
|
36
|
-
| keywords
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@external tokens shortCommentContent from "./tokens.js" { shortCommentContent }
|
|
40
|
-
@external tokens longCommentContent from "./tokens.js" { longCommentContent }
|
|
41
|
-
@external tokens htmlCommentContent from "./tokens.js" { htmlCommentContent }
|
|
42
|
-
@external tokens templateTagContent from "./tokens.js" { templateTagContent }
|
|
43
|
-
|
|
44
|
-
Comment { ShortComment | LongComment | HtmlComment }
|
|
45
|
-
ShortComment { shortCommentStart shortCommentContent* shortCommentEnd }
|
|
46
|
-
LongComment { longCommentStart longCommentContent* longCommentEnd }
|
|
47
|
-
HtmlComment { htmlCommentStart (htmlCommentContent | MoustacheExpression)* htmlCommentEnd }
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
String {
|
|
51
|
-
"\"" attributeValueContentDouble? "\"" |
|
|
52
|
-
"\'" attributeValueContentSingle? "\'"
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
attributeValueContentDouble[@name=AttributeValueContent] {
|
|
57
|
-
(attributeValueContentCharDouble | attributeValueContentEntity)+
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
attributeValueContentSingle[@name=AttributeValueContent] {
|
|
61
|
-
(attributeValueContentCharSingle | attributeValueContentEntity)+
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
attributeValueContentEntity {
|
|
65
|
-
MoustacheExpression
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@skip {} {
|
|
70
|
-
MoustacheExpression {
|
|
71
|
-
"{{" SExpression* "}}"
|
|
72
|
-
| "{{#" SExpression* "}}"
|
|
73
|
-
| "{{/" identifier "}}"
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
keywords {
|
|
80
|
-
kw<"this">
|
|
81
|
-
| kw<"as">
|
|
82
|
-
| kw<"if"> | kw<"unless">
|
|
83
|
-
| kw<"else">
|
|
84
|
-
| kw<"let">
|
|
85
|
-
| kw<"and"> | kw<"or"> | kw<"not">
|
|
86
|
-
| kw<"eq"> | kw<"neq"> | kw<"not-eq">
|
|
87
|
-
| kw<"gt"> | kw<"gte">
|
|
88
|
-
| kw<"lt"> | kw<"lte">
|
|
89
|
-
| kw<"array">
|
|
90
|
-
| kw<"concat">
|
|
91
|
-
| kw<"hash">
|
|
92
|
-
| kw<"each"> | kw<"each-in">
|
|
93
|
-
| kw<"on">
|
|
94
|
-
| kw<"modifier"> | kw<"component"> | kw<"helper">
|
|
95
|
-
| kw<"in-element">
|
|
96
|
-
| kw<"yield"> | kw<"outlet">
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
kw<term> { @specialize[@name={term}]<identifier, term> }
|
|
100
|
-
|
|
101
|
-
@tokens {
|
|
102
|
-
Text { ![{] Text? | "{" (@eof | ![%{] Text?) }
|
|
103
|
-
space { @whitespace+ }
|
|
104
|
-
whitespace { (std.whitespace | ",")+ }
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"{{"[closedBy="}}"]
|
|
108
|
-
"}}"[openedBy="{{"]
|
|
109
|
-
"("[closedBy="("]
|
|
110
|
-
")"[openedBy=")"]
|
|
111
|
-
Is { "=" }
|
|
112
|
-
Pipe { "|" }
|
|
113
|
-
|
|
114
|
-
templateTagStart[@name="TemplateTag", closedBy=templateTagEnd] { "<template>" }
|
|
115
|
-
templateTagEnd[@name="TemplateTag", openedBy=templateTagStart] { "</template>" }
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
identifierChar { @asciiLetter }
|
|
119
|
-
word { identifierChar (identifierChar | @digit)* }
|
|
120
|
-
identifier { word }
|
|
121
|
-
|
|
122
|
-
attributeValueContentCharDouble { !["&{] }
|
|
123
|
-
attributeValueContentCharSingle { !['&{] }
|
|
124
|
-
|
|
125
|
-
@precedence { attributeValueContentCharDouble whitespace }
|
|
126
|
-
@precedence { attributeValueContentCharSingle whitespace }
|
|
127
|
-
|
|
128
|
-
htmlCommentStart { "<!--" }
|
|
129
|
-
htmlCommentEnd { "-->" }
|
|
130
|
-
|
|
131
|
-
shortCommentStart { "{{!" }
|
|
132
|
-
shortCommentEnd { "}}" }
|
|
133
|
-
|
|
134
|
-
longCommentStart { "{{!--" }
|
|
135
|
-
longCommentEnd { "--}}" }
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@external propSource glimmerHighlighting from "./highlight"
|
package/src/syntax.grammar.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const Comment: 2,
|
|
2
|
-
HtmlComment: 5,
|
|
3
|
-
LongComment: 4,
|
|
4
|
-
MoustacheExpression: 6,
|
|
5
|
-
SExpression: 8,
|
|
6
|
-
ShortComment: 3,
|
|
7
|
-
String: 9,
|
|
8
|
-
Template: 1,
|
|
9
|
-
attributeValueContentDouble: 10,
|
|
10
|
-
attributeValueContentSingle: 11,
|
|
11
|
-
htmlCommentContent: 50,
|
|
12
|
-
longCommentContent: 49,
|
|
13
|
-
shortCommentContent: 48,
|
|
14
|
-
templateTagContent: 55;
|
package/src/tokens.ts
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import { ExternalTokenizer } from '@lezer/lr';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
htmlCommentContent as htmlCommentToken,
|
|
5
|
-
longCommentContent as longCommentToken,
|
|
6
|
-
MoustacheExpression as longExprToken,
|
|
7
|
-
shortCommentContent as shortCommentToken,
|
|
8
|
-
templateTagContent as templateTagToken,
|
|
9
|
-
} from './syntax.grammar.terms';
|
|
10
|
-
|
|
11
|
-
import type { InputStream } from '@lezer/lr';
|
|
12
|
-
|
|
13
|
-
// Ascii values
|
|
14
|
-
const parenOpen = 40;
|
|
15
|
-
const parenClose = 41;
|
|
16
|
-
const squareOpen = 91;
|
|
17
|
-
const squareClose = 93;
|
|
18
|
-
const curlyOpen = 123;
|
|
19
|
-
const curlyClose = 125;
|
|
20
|
-
const colon = 58;
|
|
21
|
-
const hash = 35;
|
|
22
|
-
const at = 64;
|
|
23
|
-
const slash = 47;
|
|
24
|
-
const greaterThan = 62;
|
|
25
|
-
const dash = 45;
|
|
26
|
-
const quoteDouble = 34;
|
|
27
|
-
const quoteSingle = 39;
|
|
28
|
-
const backslash = 92;
|
|
29
|
-
const newline = 10;
|
|
30
|
-
const asterisk = 42;
|
|
31
|
-
const tick = 96;
|
|
32
|
-
|
|
33
|
-
const prefixes = [colon, hash, at, slash];
|
|
34
|
-
|
|
35
|
-
const shortCommentEnd = [curlyClose, curlyClose];
|
|
36
|
-
const longCommentEnd = [dash, dash, curlyClose, curlyClose];
|
|
37
|
-
const htmlCommentEnd = [dash, dash, greaterThan];
|
|
38
|
-
|
|
39
|
-
// Is there a way to make this a build time (rather than eval-time?) operation?
|
|
40
|
-
const closingTemplateTag = '</template>'.split('').map((char) => char.charCodeAt(0));
|
|
41
|
-
|
|
42
|
-
export function matchForComment(commentEndPattern: number[], commentToken: number, input: any) {
|
|
43
|
-
for (let found = 0, i = 0; ; i++) {
|
|
44
|
-
if (input.next < 0) {
|
|
45
|
-
if (i) input.acceptToken(commentToken);
|
|
46
|
-
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let hasMatch = commentEndPattern[found] === input.next;
|
|
51
|
-
|
|
52
|
-
if (!hasMatch) {
|
|
53
|
-
found = 0;
|
|
54
|
-
input.advance();
|
|
55
|
-
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (found === commentEndPattern.length - 1) {
|
|
60
|
-
if (i > commentEndPattern.length - 1) {
|
|
61
|
-
input.acceptToken(commentToken, 1 - commentEndPattern.length);
|
|
62
|
-
|
|
63
|
-
break;
|
|
64
|
-
} else {
|
|
65
|
-
console.warn('Reached end of comment but there is still content left');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
found++;
|
|
72
|
-
input.advance();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const shortCommentContent = new ExternalTokenizer((input) => {
|
|
77
|
-
return matchForComment(shortCommentEnd, shortCommentToken, input);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
export const longCommentContent = new ExternalTokenizer((input) => {
|
|
81
|
-
return matchForComment(longCommentEnd, longCommentToken, input);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
export const htmlCommentContent = new ExternalTokenizer((input) => {
|
|
85
|
-
return matchForComment(htmlCommentEnd, htmlCommentToken, input);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export const templateTagContent = new ExternalTokenizer((input) => {
|
|
89
|
-
return matchForComment(closingTemplateTag, templateTagToken, input);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// TODO: string handler does not handle interpolation
|
|
93
|
-
|
|
94
|
-
function createStringHandler(input: InputStream) {
|
|
95
|
-
let inString = false;
|
|
96
|
-
let inStringType: 'double' | 'single' | 'template' | null = null;
|
|
97
|
-
let inStringIgnoreNext = false;
|
|
98
|
-
|
|
99
|
-
return () => {
|
|
100
|
-
if (inString) {
|
|
101
|
-
if (inStringIgnoreNext) {
|
|
102
|
-
inStringIgnoreNext = false;
|
|
103
|
-
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (input.next === backslash) {
|
|
108
|
-
inStringIgnoreNext = true;
|
|
109
|
-
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (inStringType === 'double' && input.next === quoteDouble) {
|
|
114
|
-
inString = false;
|
|
115
|
-
inStringType = null;
|
|
116
|
-
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (inStringType === 'single' && input.next === quoteSingle) {
|
|
121
|
-
inString = false;
|
|
122
|
-
inStringType = null;
|
|
123
|
-
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (inStringType === 'template' && input.next === tick) {
|
|
128
|
-
inString = false;
|
|
129
|
-
inStringType = null;
|
|
130
|
-
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (input.next === quoteDouble) {
|
|
138
|
-
inString = true;
|
|
139
|
-
inStringType = 'double';
|
|
140
|
-
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (input.next === quoteSingle) {
|
|
145
|
-
inString = true;
|
|
146
|
-
inStringType = 'single';
|
|
147
|
-
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (input.next === tick) {
|
|
152
|
-
inString = true;
|
|
153
|
-
inStringType = 'template';
|
|
154
|
-
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return false;
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function createCommentHandler(input: InputStream) {
|
|
163
|
-
let inLineComment = false;
|
|
164
|
-
let inBlockComment = false;
|
|
165
|
-
|
|
166
|
-
return () => {
|
|
167
|
-
if (inLineComment) {
|
|
168
|
-
if (input.next === newline) {
|
|
169
|
-
inLineComment = false;
|
|
170
|
-
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (inBlockComment) {
|
|
178
|
-
if (input.next === asterisk && input.peek(1) === slash) {
|
|
179
|
-
inBlockComment = false;
|
|
180
|
-
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (input.next === slash && input.peek(1) === slash) {
|
|
188
|
-
inLineComment = true;
|
|
189
|
-
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (input.next === slash && input.peek(1) === asterisk) {
|
|
194
|
-
inBlockComment = true;
|
|
195
|
-
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return false;
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
type ExpressionStack = '(' | '{' | '{{' | '[';
|
|
204
|
-
|
|
205
|
-
// closes on a delimiter that probably isn't in the expression
|
|
206
|
-
export const expression = new ExternalTokenizer((input) => {
|
|
207
|
-
if (prefixes.includes(input.next)) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const commentHandler = createCommentHandler(input);
|
|
212
|
-
const stringHandler = createStringHandler(input);
|
|
213
|
-
|
|
214
|
-
let stack: ExpressionStack[] = [];
|
|
215
|
-
|
|
216
|
-
const popIfMatch = (match: ExpressionStack) => {
|
|
217
|
-
const idx = stack.lastIndexOf(match);
|
|
218
|
-
|
|
219
|
-
if (idx !== -1) {
|
|
220
|
-
while (stack.length > idx) {
|
|
221
|
-
stack.pop();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
for (let pos = 0; ; pos++) {
|
|
227
|
-
// end of input
|
|
228
|
-
if (input.next < 0) {
|
|
229
|
-
if (pos > 0) input.acceptToken(longExprToken);
|
|
230
|
-
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (commentHandler() || stringHandler()) {
|
|
235
|
-
input.advance();
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (
|
|
240
|
-
stack.length === 0 &&
|
|
241
|
-
(input.next === curlyClose || input.next === parenClose || input.next === squareClose)
|
|
242
|
-
) {
|
|
243
|
-
input.acceptToken(longExprToken);
|
|
244
|
-
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
switch (input.next) {
|
|
249
|
-
case parenOpen:
|
|
250
|
-
stack.push('(');
|
|
251
|
-
|
|
252
|
-
break;
|
|
253
|
-
case parenClose:
|
|
254
|
-
popIfMatch('(');
|
|
255
|
-
|
|
256
|
-
break;
|
|
257
|
-
case squareOpen:
|
|
258
|
-
stack.push('[');
|
|
259
|
-
|
|
260
|
-
break;
|
|
261
|
-
case squareClose:
|
|
262
|
-
popIfMatch('[');
|
|
263
|
-
|
|
264
|
-
break;
|
|
265
|
-
case curlyOpen:
|
|
266
|
-
stack.push('{');
|
|
267
|
-
|
|
268
|
-
break;
|
|
269
|
-
case curlyClose:
|
|
270
|
-
popIfMatch('{');
|
|
271
|
-
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
input.advance();
|
|
276
|
-
}
|
|
277
|
-
});
|
package/tests/.eslintrc.cjs
DELETED
package/tests/comments.txt
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# Long
|
|
2
|
-
|
|
3
|
-
{{!-- text here --}}
|
|
4
|
-
|
|
5
|
-
==>
|
|
6
|
-
|
|
7
|
-
Glimmer(
|
|
8
|
-
BlockComment(
|
|
9
|
-
LongComment(
|
|
10
|
-
StartLongComment,
|
|
11
|
-
Text,
|
|
12
|
-
EndLongComment
|
|
13
|
-
)
|
|
14
|
-
)
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# Short
|
|
19
|
-
|
|
20
|
-
{{! text here }}
|
|
21
|
-
|
|
22
|
-
==>
|
|
23
|
-
|
|
24
|
-
Glimmer(
|
|
25
|
-
BlockComment(
|
|
26
|
-
ShortComment(
|
|
27
|
-
StartShortComment,
|
|
28
|
-
Text,
|
|
29
|
-
EndStache
|
|
30
|
-
)
|
|
31
|
-
)
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# Long multiline
|
|
37
|
-
|
|
38
|
-
{{!--
|
|
39
|
-
line 1
|
|
40
|
-
line 2
|
|
41
|
-
|
|
42
|
-
weird indent
|
|
43
|
-
|
|
44
|
-
line 4
|
|
45
|
-
|
|
46
|
-
--}}
|
|
47
|
-
|
|
48
|
-
==>
|
|
49
|
-
|
|
50
|
-
Glimmer(
|
|
51
|
-
BlockComment(
|
|
52
|
-
LongComment(
|
|
53
|
-
StartLongComment,
|
|
54
|
-
Text,
|
|
55
|
-
EndLongComment
|
|
56
|
-
)
|
|
57
|
-
)
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
# Short multiline
|
|
61
|
-
|
|
62
|
-
{{!
|
|
63
|
-
line 1
|
|
64
|
-
line 2
|
|
65
|
-
|
|
66
|
-
weird indent
|
|
67
|
-
|
|
68
|
-
line 4
|
|
69
|
-
|
|
70
|
-
}}
|
|
71
|
-
|
|
72
|
-
==>
|
|
73
|
-
|
|
74
|
-
Glimmer(
|
|
75
|
-
BlockComment(
|
|
76
|
-
ShortComment(
|
|
77
|
-
StartShortComment,
|
|
78
|
-
Text,
|
|
79
|
-
EndStache
|
|
80
|
-
)
|
|
81
|
-
)
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# Long - empty
|
|
86
|
-
|
|
87
|
-
{{!-- --}}
|
|
88
|
-
|
|
89
|
-
==>
|
|
90
|
-
|
|
91
|
-
Glimmer(
|
|
92
|
-
BlockComment(
|
|
93
|
-
LongComment(
|
|
94
|
-
StartLongComment,
|
|
95
|
-
Text,
|
|
96
|
-
EndLongComment
|
|
97
|
-
)
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# Short - empty
|
|
103
|
-
|
|
104
|
-
{{! }}
|
|
105
|
-
|
|
106
|
-
==>
|
|
107
|
-
|
|
108
|
-
Glimmer(
|
|
109
|
-
BlockComment(
|
|
110
|
-
ShortComment(
|
|
111
|
-
StartShortComment,
|
|
112
|
-
Text,
|
|
113
|
-
EndStache
|
|
114
|
-
)
|
|
115
|
-
)
|
|
116
|
-
)
|
package/tests/complex.txt
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Multi-Expression
|
|
2
|
-
|
|
3
|
-
{{#each (someFn foo bar named=(foo bar)) as |a b c|}}
|
|
4
|
-
|
|
5
|
-
{{a}} {{b}} -- {{c}}
|
|
6
|
-
|
|
7
|
-
{{#if a}}
|
|
8
|
-
a
|
|
9
|
-
{{else if b}}
|
|
10
|
-
b
|
|
11
|
-
{{else}}
|
|
12
|
-
the else
|
|
13
|
-
{{/if}}
|
|
14
|
-
{{/each}}
|
|
15
|
-
|
|
16
|
-
==>
|
|
17
|
-
|
|
18
|
-
Glimmer(
|
|
19
|
-
Expression(
|
|
20
|
-
SubExpression(
|
|
21
|
-
Value(Argument)
|
|
22
|
-
)
|
|
23
|
-
)
|
|
24
|
-
)
|