Force CL-Lex to read whole word
- by Flávio Cruz
I'm using CL-Lex to implement a lexer (as input for CL-YACC) and my language has several keywords such as "let" and "in". However, while the lexer recognizes such keywords, it does too much. When it finds words such as "init", it returns the first token as IN, while it should return a "CONST" token for the "init" word.
This is a simple version of the lexer:
(define-string-lexer lexer
(...)
("in" (return (values :in $@)))
("[a-z]([a-z]|[A-Z]|\_)" (return (values :const $@))))
How do I force the lexer to fully read the whole word until some whitespace appears?