kristoff-it / ziggy

A data serialization language for expressing clear API messages, config files, etc.
https://ziggy-lang.io
MIT License
285 stars 15 forks source link

real support for strings #2

Open kristoff-it opened 8 months ago

kristoff-it commented 8 months ago

Right now string parsing is PoC quality.

Goal is to support everything that Zig supports, ideally by leveraging the Zig stdlib parser.

Related design question: we want to be able to report an error at a given line and column. What's the correct way or reporting column number in the presence of things like emojis?

kristoff-it commented 8 months ago

The tree sitter grammar has been updated to support Zig escapes, the handwritten Tokenizer remains TODO.

bortzmeyer commented 7 months ago

reporting column number in the presence of things like emojis

If the text encoding of Ziggy is always an Unicode encoding (it does not seem to be specified in the current README, IMHO, it should), then the simplest solution is to report column number as a number of Unicode code points. It may not match the number of glyphs as seen by the human eye, but it is simple and predictible. Any other semantics would require to implement a lot of Unicode stuff. (Something which is not (yet?) done by Zig standard library, which instead spends time dealing with the very poor encoding UTF-16.)