mdaines / grammophone

A tool for analyzing and transforming context-free grammars.
https://mdaines.github.io/grammophone
MIT License
205 stars 23 forks source link

Spaces are replaced with `⬚`. #46

Closed modulovalue closed 7 months ago

modulovalue commented 7 months ago

Consider:

S -> "foo bar".

On Grammophone

Screenshot 2024-02-08 at 00 15 20

Notice how the space character is not a space character (or some placeholder such as ), but .

mdaines commented 7 months ago

It is actually a placeholder I chose: https://github.com/mdaines/grammophone/blob/1fe29c76b6cb6ace8213fac95d97f9233da3f6f8/src/components/helpers.js#L6

The replacement is done here: https://github.com/mdaines/grammophone/blob/1fe29c76b6cb6ace8213fac95d97f9233da3f6f8/src/components/helpers.js#L47

Something like a middle dot in a different color might be clearer, for example:

Screenshot 2024-02-07 at 8 06 52 PM
mdaines commented 7 months ago

Another example that should maybe be different:

https://mdaines.github.io/grammophone/?s=UyAtPiAiZm9vIFwKYmFyIi4=

S -> "foo \
bar".
Screenshot 2024-02-07 at 8 14 15 PM
modulovalue commented 7 months ago

Oh, I see.

FYI: about escaping newlines, there are special characters for that: https://www.compart.com/en/unicode/block/U+2400, e.g., ␤

about escaping spaces, see: https://en.wikipedia.org/wiki/

Screenshot 2024-02-08 at 12 44 00
mdaines commented 7 months ago

about escaping spaces, see: https://en.wikipedia.org/wiki/␣

Somehow I'd never noticed that. But curiously, this week I noticed that a paper used ␣ for spaces. So it does seem like a good choice in this context.

mdaines commented 7 months ago

I've deployed #48 which should address this.