Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Stream.Error当解析器内部发生 a 时,如何显示位置信息?例如:
Stream.Error
let p = parser | [< '1; '2 ?? "1 expected at line L, column C" >] -> ()
如何获取流中的位置?有没有办法Stream.count不用手动计算换行符?
Stream.count
您必须手动建立职位(Lexing.position例如表示)。不过,我不会触及词法分析器/解析器本身,而是编写一个简单的函数,将文件偏移量(用 表示Stream.count)转换为(行、列)坐标系。
Lexing.position