diff options
Diffstat (limited to 'src/lexer.js')
-rw-r--r-- | src/lexer.js | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lexer.js b/src/lexer.js index fd0d0a3..8635e4a 100644 --- a/src/lexer.js +++ b/src/lexer.js @@ -14,19 +14,15 @@ const newValueLexeme = (type, regex, converter = v => v) => { }) } -const newSkippableLexeme = (type, regex) => { - newLexemeType(type, regex, () => {}) -} - newValueLexeme('constant', '\\d+', Number) newLexemeType('d', 'd') -newLexemeType('+', '\\+') -newLexemeType('-', '-') +newLexemeType('bigPlus', ' \\+ ' ) +newLexemeType('bigMinus', ' - ') +newLexemeType('minus', '-') newLexemeType('(', '\\(') newLexemeType(')', '\\)') newLexemeType('E', 'E') newLexemeType('K', 'K') -newSkippableLexeme('whitespace', '\\s+') const lex = (expressionString) => { let lexemes = [] |