haku: a very shitty tree-walk interpreter
This commit is contained in:
parent
d813675d47
commit
b505c1bcfe
8 changed files with 403 additions and 26 deletions
|
@ -42,8 +42,16 @@ function tokenize(text, syntax) {
|
|||
for (let i = 1; i < match.indices.length; ++i) {
|
||||
let [start, end] = match.indices[i];
|
||||
if (match.indices[i] != null) {
|
||||
pushToken(tokens, pattern.is.default, text.substring(lastMatchEnd, start));
|
||||
pushToken(tokens, pattern.is.captures[i], text.substring(start, end));
|
||||
pushToken(
|
||||
tokens,
|
||||
pattern.is.default,
|
||||
text.substring(lastMatchEnd, start),
|
||||
);
|
||||
pushToken(
|
||||
tokens,
|
||||
pattern.is.captures[i - 1],
|
||||
text.substring(start, end),
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue