r-lib / ansistrings

Manipulation of ANSI colored strings
Other
9 stars 5 forks source link

Implement a Parser for ANSI CSI Escape Sequences #10

Open brodieG opened 7 years ago

brodieG commented 7 years ago

For high performance code we will probably need a non-regex parser.

I have an early C version baked in my repo.

@gaborcsardi is interested in a more formal (e.g. Yacc/Bison) grammar based version.

I will probably not implement the latter because I don't have any experience with formal parser so I'd have to spend more time than I'm willing to dedicate at this point to get up to speed. Additionally it feels a bit overkill for such a simple parsing task. Finally, a big part of the complexity here is interpreting the contextual semantics of the ANSI CSI tags, which I don't think would be addressed by the parser (my lack of knowledge in the area notwithstanding).

Making this into it's own issue instead of burying it #8 since it is a pretty complex topic.