You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, first of all, thanks for the cool project.
If you want to structure the parser around a state machine, while keeping the code very similar to what you already have, I recommend checking out https://github.com/UnkindPartition/regex-applicative.
I'm not sure what you mean by the parser being "adhoc".
I guess what I meant by "adhoc" is that the parser doesn't deal with edge cases and errors properly. For example, the way that the parseEscape function falls back to handleSingle I don't think is correct. And when a parse error is detected, it just skips the character, while the correct thing is to perform error recovery according to the link I gave above.
The current parser seems to work well in practice, with lots of apps working. But a few apps don't work properly and I'm not sure if it's because of the parser or other parts of the terminal emulator, but improving the parser feels to me like a good first step.
The current parser is a bit adhoc and doesn't handle invalid escape sequences well.
Here is a document that explains how to implement a proper parser using a state machine: https://vt100.net/emu/dec_ansi_parser
Here is a TypeScript implementation I found: https://github.com/xtermjs/xterm.js/blob/522c8bf3afcc296f7586c21b097025fe3626dc32/src/common/parser/EscapeSequenceParser.ts#L201
The text was updated successfully, but these errors were encountered: