Pushpak Dagade
Pushpak Dagade

Reputation: 6450

End of line character for regular expressions in ml-lex

What is the end of line character for regular expressions in ml-lex?
"$" is used for catching the end of line character in regular expressions in most other languages, but if I use it in case of ml-lex, it gives me an error -

mllex a.lex
ml-lex: error, line 45: lookahead is unimplemented
unhandled exception: Error 

I am currently appending all my regular expressions with an additional \n character for explicitly catching the end of line character. However removing the caught extra \n character is making the code ugly.

I read somewhere that $ is not implemented in ml-lex.
So, can there be any other solution for my problem? Please help.

Upvotes: 3

Views: 824

Answers (1)

summea
summea

Reputation: 7583

Unfortunately, it looks like the $ character is not implemented in ML-Lex according to this manual:

"The dollar sign of C Lex $ is not implemented, since it is an abbreviation for lookahead involving the newline character (that is, it is an abbreviation for /\n)."

And it is also noted in this user guide:

"The dollar sign of C Lex $ is not implemented, since it is an abbreviation for lookahead involving the newline character that is, it is an abbreviation for /\n."

So... that would at least explain (and back up your reading of the $ not being implemented in ML-Lex). Unfortunately, that probably means that for now, at least, you might just need to keep using your existing method for checking those end-of-lines... even it doesn't look super clean.

Upvotes: 1

Related Questions