Skip to content

Commit 60511a7

Browse files
committed
fix: temporarily remove multi line expression handling to avoid regression
1 parent 01595dc commit 60511a7

File tree

8 files changed

+44
-5
lines changed

8 files changed

+44
-5
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
1╭─ <div>
2+
│ │ ╰─ openTagEnd
3+
╰─ ╰─ tagName "div"
4+
2╭─ $ let i = 10;
5+
│ │ │ ╰─ scriptlet.value "let i = 10;"
6+
│ │ ╰─ scriptlet "$ let i = 10;"
7+
╰─ ╰─ text "\n "
8+
3╭─ <while(i--)>
9+
│ │ │ ││ ╰─ openTagEnd
10+
│ │ │ │╰─ tagArgs.value "i--"
11+
│ │ │ ╰─ tagArgs "(i--)"
12+
│ │ ╰─ tagName "while"
13+
╰─ ╰─ text "\n "
14+
4╭─ <test/>
15+
│ │ │ ╰─ openTagEnd:selfClosed "/>"
16+
│ │ ╰─ tagName "test"
17+
╰─ ╰─ text "\n "
18+
5╭─ </while>
19+
│ │ │ ╰─ closeTag(while).value "while"
20+
│ │ ╰─ closeTag(while) "</while>"
21+
╰─ ╰─ text "\n "
22+
6╭─ </div>
23+
│ │ ╰─ closeTag(div).value "div"
24+
│ ├─ text "\n"
25+
╰─ ╰─ closeTag(div) "</div>"
26+
7╰─
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div>
2+
$ let i = 10;
3+
<while(i--)>
4+
<test/>
5+
</while>
6+
</div>

src/__tests__/main.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import { createParser, Position, Ranges, Range } from "..";
77
const FIXTURES = path.join(__dirname, "fixtures");
88

99
for (const entry of fs.readdirSync(FIXTURES)) {
10+
if (entry.endsWith(".skip")) {
11+
it.skip(entry.slice(0, -".skip".length));
12+
continue;
13+
}
14+
1015
it(entry, async () => {
1116
const dir = path.join(FIXTURES, entry);
1217
const filename = path.join(dir, "input.marko");

src/states/EXPRESSION.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ export const EXPRESSION: StateDefinition<ExpressionMeta> = {
135135
!expression.groupStack.length &&
136136
(expression.terminatedByWhitespace || expression.terminatedByEOL)
137137
) {
138-
if (checkForOperators(this, expression)) {
139-
this.forward = 1;
140-
} else {
141-
this.exitState();
142-
}
138+
this.exitState();
139+
140+
// TODO: eventually it'd be good to allow multi line expressions.
141+
// This currently has a number of edge cases and likely can only be solved by
142+
// converting the expression state to avoid the look ahead/behind regexp pattern and instead
143+
// check characters as is goes.
144+
// if (checkForOperators(this, expression)) this.forward = 1;
143145
}
144146
},
145147

0 commit comments

Comments
 (0)