Closed tjvr closed 7 years ago
I think making the keyword behaviour explicit is probably a good idea.
I'm not sure about this API, though. Perhaps it should be a nested object?
moo.compile({
identifier: {match: /[a-zA-Z]+/, keywords: {keyword: ['moo', 'cow']}},
})
Or with individual types:
moo.compile({
identifier: {
match: /[a-zA-Z]+/,
keywords: {
'kw-class': 'class',
'kw-def': 'def',
'kw-if': 'if',
},
},
})
Or with individual types:
itt(['class', 'def', 'if'])
.map(k => ['kw-' + k, k])
.toObject()
(Iterator adaptors solve every* problem!)
Iterator adaptors solve every* problem!
Nice! :-)
keywords: { 'kw-class': 'class',
I'm also not convinced having the object "backwards" like this, for consistency with the outer moo.compile
, is correct.
Let's do this.
Some thoughts on #53.
See the updated readme.