Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Allow whitespace around section headers #9

Merged
merged 2 commits into from
Oct 13, 2016
Merged

Allow whitespace around section headers #9

merged 2 commits into from
Oct 13, 2016

Conversation

stasm
Copy link
Contributor

@stasm stasm commented Sep 14, 2016

Fixes #5. @zbraniecki -- this implements the changes we talked about last week to characters allowed in keywords, including white-space. Note that currently the l20n.js parser doesn't allow non-Latin characters in keywords. Should we update the spec here for now?


identifier ::= [a-zA-Z_.?-] ([a-zA-Z0-9_.?-])*;
identifier ::= identifier-head (identifier-tail)*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you don't use identifier-head or identifier-tail, what's the value of it over:

identifier ::= [a-zA-Z_.?-] [a-zA-Z0-9_.?-]*;

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean I don't use it? I use it right in the line you commented on

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's much more readable that way and consistent with keyword- chars. it makes it clear to the reader that there are different set of characters involved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean - this is the only place where you use it. Since it's not shared with other bits, I'm not sure if there's a value in keeping it as a separate entity.

I believe that it's clear that there are different characters involved since instead of [...]+ we give [...] [...]*.

variable ::= '$' identifier;
keyword ::= [^=|#{}\[\]()]+;
keyword ::= keyword-head (keyword-tail* keyword-last)?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same of keywords

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that the following will look cryptic:

keyword ::= [^=|#/{}\[\]()0-9] ([^=|#/{}\[\]() ]* [^=|#/{}\[\]()])?;

Then again, the grammar is intended at parsers not humans, so maybe that's okay. I would leave it in the clearer form at least for now since we don't use this grammar yet to generate parsers which in turn would allow us to fix bugs in the grammar itself. Thus readable-by-human is still pretty important to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I disagree but not gonna block on this. :)

@stasm
Copy link
Contributor Author

stasm commented Sep 14, 2016

@zbraniecki what are you thoughts on the current behavior of the l20n.js parser wrt. the chars allowed in keywords?

@zbraniecki
Copy link
Member

umm, not sure what are you asking about. The l20n.js parser handles characters allowed in keywords?

@stasm
Copy link
Contributor Author

stasm commented Sep 14, 2016

The grammar specifies that all possible characters except a shorthand of special ones like /, # etc. are allowed as keywords. However, the following doesn't parse in the l20n.js's parsers (ast and runtime):

foo =
    [ą] Ą

I'm asking if you have cycles to fix this in the parser or would you rater have me change the grammar for now and limit keywords to ASCII chars. Allowing more chars in the future will be backwards-compatible.

@zbraniecki
Copy link
Member

I think I'd prefer to limit the chars in the spec for now. I'm concerned about non-ascii character being more confusing than helpful at this point.

@stasm
Copy link
Contributor Author

stasm commented Sep 16, 2016

I removed the additional symbols for allowed characters and also restricted keywords to ASCII for now. I'd like to go back to being more lax in the future. I also considered using named character classes like [:alpha:] but they're locale-dependent.

@stasm
Copy link
Contributor Author

stasm commented Sep 16, 2016

@zbraniecki can you take another look?

@stasm
Copy link
Contributor Author

stasm commented Oct 10, 2016

@zbraniecki ping

@zbraniecki
Copy link
Member

looks great! Sorry for holding you for so long.

@stasm stasm merged commit 126b422 into master Oct 13, 2016
@stasm stasm deleted the member-key branch October 13, 2016 12:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants