In ocamllex, I can use _
as a lexer rule to match any string that does not match previously defined rules, and raise errors. How can achieve this in lex/flex?
Asked
Active
Viewed 2,098 times
5

Jonathan Leffler
- 730,956
- 141
- 904
- 1,278

osolmaz
- 1,873
- 2
- 24
- 41
1 Answers
4
Typically, you would define a rule like this, which would go at the very end:
.|\n { /* process default here */ }
This rule will match any character that wasn't matched by any other rule.
Hope this helps!

templatetypedef
- 362,284
- 104
- 897
- 1,065