-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
216 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const parseComment = (index, input, length) => { | ||
while (index < length) { | ||
const char0 = input[index]; | ||
const char1 = input[index + 1]; | ||
const char2 = input[index + 2]; | ||
|
||
if (char0 === "<" && char1 === "!" && char2 === "-" && input[index + 3] === "-") { | ||
index = parseComment(index + 4, input, length); | ||
} else if (char0 === "-" && char1 === "-" && char2 === ">") { | ||
index += 3; | ||
break; | ||
} else { | ||
index += 1; | ||
} | ||
} | ||
|
||
return index; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { expressionRE, pushChild } from "./util"; | ||
|
||
export const parseExpression = (index, input, length, stack, dependencies, locals) => { | ||
let expression = ""; | ||
|
||
for (; index < length; index++) { | ||
const char = input[index]; | ||
|
||
if (char === "}") { | ||
index += 1; | ||
break; | ||
} else { | ||
expression += char; | ||
} | ||
} | ||
|
||
let info; | ||
while ((info = expressionRE.exec(expression)) !== null) { | ||
let name = info[1]; | ||
if (name !== undefined && locals.indexOf(name) === -1) { | ||
dependencies.push(name); | ||
} | ||
} | ||
|
||
pushChild({ | ||
index: stack.parseIndex++, | ||
type: "m-expression", | ||
content: expression | ||
}, stack); | ||
|
||
return index; | ||
}; |
Oops, something went wrong.