ml-lex 中正则表达式的行结束符是什么?
“$
”用于捕获大多数其他语言的正则表达式中的行尾字符,但是如果我在 ml-lex 的情况下使用它,它会给我一个错误 -
mllex a.lex
ml-lex: error, line 45: lookahead is unimplemented
unhandled exception: Error
我目前正在为所有正则表达式附加一个额外的 \n
字符,以显式捕获行尾字符。然而,删除捕获的额外 \n
字符会使代码变得丑陋。
我在某处读到 $
未在 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.
发布评论
评论(1)
不幸的是,根据 $ 字符="nofollow">本手册:
本用户指南中也注明了这一点:
所以...这至少可以解释(并支持您对 ML-Lex 中未实现的
$
的阅读)。不幸的是,这可能意味着至少现在,您可能只需要继续使用现有的方法来检查这些行尾......即使它看起来不太干净。Unfortunately, it looks like the
$
character is not implemented in ML-Lex according to this manual:And it is also noted in this user guide:
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.