mirror of
https://github.com/Noratrieb/brainfuck.git
synced 2026-01-14 13:35:00 +01:00
pretty (OwO)
This commit is contained in:
parent
deefc18959
commit
04dd019806
1 changed files with 3 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ function lex(string) {
|
||||||
if (['+', '-', '>', '<', '.', ',', '[', ']'].includes(char)) {
|
if (['+', '-', '>', '<', '.', ',', '[', ']'].includes(char)) {
|
||||||
tokens.push({
|
tokens.push({
|
||||||
char,
|
char,
|
||||||
span: i
|
span: i,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,13 +29,13 @@ function Parser(tokens) {
|
||||||
this.position = 0;
|
this.position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parser.prototype.next = function() {
|
Parser.prototype.next = function () {
|
||||||
const token = this.tokens[this.position];
|
const token = this.tokens[this.position];
|
||||||
this.position++;
|
this.position++;
|
||||||
return token;
|
return token;
|
||||||
};
|
};
|
||||||
|
|
||||||
Parser.prototype.parse = function(isLoop) {
|
Parser.prototype.parse = function (isLoop) {
|
||||||
const body = [];
|
const body = [];
|
||||||
let nextToken;
|
let nextToken;
|
||||||
while ((nextToken = this.next()) !== undefined) {
|
while ((nextToken = this.next()) !== undefined) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue