m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lexer.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lexer.js b/src/lexer.js
index ff7b0d4..7d876fb 100644
--- a/src/lexer.js
+++ b/src/lexer.js
@@ -14,8 +14,13 @@ const newValueLexeme = (type, regex, converter = v => v) => {
})
}
+const newSkippableLexeme = (type, regex) => {
+ newLexemeType(type, regex, () => {})
+}
+
newValueLexeme('number', '\\d+', Number)
newLexemeType('d', 'd')
+newSkippableLexeme('whitespace', '\\s+')
const lex = (expressionString) => {
let lexemes = []