Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace interpretation #1

Closed
philanc opened this issue Oct 25, 2022 · 3 comments
Closed

Whitespace interpretation #1

philanc opened this issue Oct 25, 2022 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@philanc
Copy link

philanc commented Oct 25, 2022

I am not sure I understand the "whitespace rule":

There are no special rules for whitespace. All whitespace characters are captured by the Character rule.

Considering the dog example. In the following fragment:

Conservation status [Domesticated]
Scientific classification [
  Kingdom [Animalia]
  ...

The "Scientific classification" key, according to the rule is actually the string "\nScientific classification " (with a trailing space) and the key "Kingdom" is actually "\n Kingdom ", right?

And on Windows where the end of line is "\r\n", this document would have different key values...

Is it what you intended?

Shouldn't the specification clarify how leading and trailing whitespaces (including newlines) are to be interpreted?

Phil

@djedr
Copy link
Member

djedr commented Oct 25, 2022

Hello,

Thanks for the question!

Indeed there are no rules for whitespace -- this is by design.

You point out a good reason why this might be the right choice: operating system differences.

Whitespace is the concern of one level above Jevko, which should ideally be occupied by standardized formats.

One such format, which does not have a spec yet, but is pretty much defined is codenamed Easy Jevko. Here are libraries for working with it in JS and Lua that I wrote (~ v0.1.0):

This format specifies how to interpret the different parts of Jevko into programming language data structures, such as tables/maps/objects, arrays/lists, and strings. This includes the treatment of whitespace in a sensible way: in your example Scientific classification and Kingdom would be keys in a map and they would be properly trimmed. Notice that this format does that automatically and disallows untrimmed keys entirely (which is a good thing in 99.9% of cases).

This should certainly be clarified somewhere. I'm not sure specification is the right place, but I'll figure something out.

Thanks again for your input!

@philanc
Copy link
Author

philanc commented Oct 25, 2022

Thanks for your prompt response. I will have a look at Easy Jevko!

@djedr djedr self-assigned this Oct 27, 2022
@djedr djedr added the documentation Improvements or additions to documentation label Oct 31, 2022
@djedr
Copy link
Member

djedr commented Sep 8, 2023

Huh, I forgot about this issue. Found it today and it inspired me to write this: https://github.com/jevko/writing/blob/main/2023-09-08-jevko-whitespace.md

With that I'm closing the issue.

@djedr djedr closed this as completed Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants