simplify code using ternary operator in lexer.js
after12am opened this issue · comments
Satoshi Okami commented
Lexer.prototype.consume = function() {
if (this.c == '\n' || this.c == '\r') {
this.column = 1;
} else {
this.column++;
}
this.p++;
if (this.p < this.source.length) {
this.c = this.source[this.p];
} else {
this.c = Token.EOF;
}
}
like this:
this.column = (this.c == '\n' || this.c == '\r') ? 1 : this.column + 1;
this.p++;
this.c = (this.p < this.source.length) ? this.source[this.p] : Token.EOF;