m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-07-12 22:54:43 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-07-12 22:54:43 -0400
commit80c3d09308d4d168658ee7af34e026ff37e1e2ce (patch)
tree74a4a0485bacfe1f6fa267d6bfa910c8e6e2e67c /src
parent38e82ade6fd207af21f2df6a3e98298338e85eb8 (diff)
Ignore whitespace
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 = []