-
-
Notifications
You must be signed in to change notification settings - Fork 36
Implement code more introducer #529
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
Changes from all commits
94b7859
915cbb7
1b79024
84ed2f1
9e1d775
2220367
49bb6e5
2340a17
ecc9711
e4f3c36
c73e72d
80722d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,43 +1,46 @@ | ||||||||||||||||||
message = pattern / complex-message | ||||||||||||||||||
message = simple-message / complex-message | ||||||||||||||||||
|
||||||||||||||||||
complex-message = "{{" [s] *(declaration [s]) body [s] "}}" | ||||||||||||||||||
simple-message = [simple-start pattern] | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, let's make sure this is called out in |
||||||||||||||||||
simple-start = simple-start-char / text-escape / expression | ||||||||||||||||||
pattern = *(text-char / text-escape / expression) | ||||||||||||||||||
eemeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
||||||||||||||||||
declaration = input-declaration / local-declaration | ||||||||||||||||||
complex-message = *(declaration [s]) complex-body | ||||||||||||||||||
eemeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
declaration = input-declaration / local-declaration / reserved-statement | ||||||||||||||||||
input-declaration = input [s] variable-expression | ||||||||||||||||||
local-declaration = local s variable [s] "=" [s] expression | ||||||||||||||||||
|
||||||||||||||||||
body = quoted-pattern | ||||||||||||||||||
/ (selectors 1*([s] variant)) | ||||||||||||||||||
|
||||||||||||||||||
complex-body = quoted-pattern | ||||||||||||||||||
/ ((selectors / reserved-statement) 1*([s] variant)) | ||||||||||||||||||
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may prove valuable to establish a greater separation between
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you say why? The two expressions are wholly synonymous, and I don't really see why we should prefer one over the other. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I expect the latter to diverge—I don't think we should treat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the motiviation for putting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I now see that @gibson042 mentions this as one of the issues to work on as follow-ups in his review. How about we land this PR without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tbh, I would find it easier to include it, show what impact it has across the stack, and then evaluate whether to drop it. We have already agreed on having two follow up PRs to this that will both re-tread this ground. Could we agree that this will be considered more in both of those, and accept having it in the ABNF for now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We should do things exactly the other way. I also don't appreciate pushing hard for merging. We should merge when things look good to merge. |
||||||||||||||||||
quoted-pattern = "{{" pattern "}}" | ||||||||||||||||||
pattern = *(text / expression) | ||||||||||||||||||
|
||||||||||||||||||
selectors = match 1*([s] expression) | ||||||||||||||||||
variant = when 1*(s key) [s] quoted-pattern | ||||||||||||||||||
variant = key *(s key) [s] quoted-pattern | ||||||||||||||||||
key = literal / "*" | ||||||||||||||||||
|
||||||||||||||||||
expression = literal-expression / variable-expression / function-expression | ||||||||||||||||||
literal-expression = "{" [s] literal [s annotation] [s] "}" | ||||||||||||||||||
variable-expression = "{" [s] variable [s annotation] [s] "}" | ||||||||||||||||||
function-expression = "{" [s] annotation [s] "}" | ||||||||||||||||||
annotation = (function *(s option)) / reserved / private-use | ||||||||||||||||||
annotation = (function *(s option)) | ||||||||||||||||||
/ reserved-annotation | ||||||||||||||||||
/ private-use-annotation | ||||||||||||||||||
|
||||||||||||||||||
literal = quoted / unquoted | ||||||||||||||||||
variable = "$" name | ||||||||||||||||||
function = (":" / "+" / "-") identifier | ||||||||||||||||||
option = identifier [s] "=" [s] (literal / variable) | ||||||||||||||||||
|
||||||||||||||||||
; reserved keywords are always lowercase | ||||||||||||||||||
input = %s"input" | ||||||||||||||||||
local = %s"local" | ||||||||||||||||||
match = %s"match" | ||||||||||||||||||
when = %s"when" | ||||||||||||||||||
input = %s".input" | ||||||||||||||||||
local = %s".local" | ||||||||||||||||||
match = %s".match" | ||||||||||||||||||
|
||||||||||||||||||
text = 1*(text-char / text-escape) | ||||||||||||||||||
text-char = %x0-5B ; omit \ | ||||||||||||||||||
/ %x5D-7A ; omit { | ||||||||||||||||||
/ %x7C ; omit } | ||||||||||||||||||
/ %x7E-D7FF ; omit surrogates | ||||||||||||||||||
/ %xE000-10FFFF | ||||||||||||||||||
simple-start-char = %x0-2D ; omit . | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: it looks like we don't append
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that there already is another rule that's called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. I'll open a new PR for this. |
||||||||||||||||||
/ %x2F-5B ; omit \ | ||||||||||||||||||
/ %x5D-7A ; omit { | ||||||||||||||||||
/ %x7C ; omit } | ||||||||||||||||||
/ %x7E-D7FF ; omit surrogates | ||||||||||||||||||
/ %xE000-10FFFF | ||||||||||||||||||
text-char = simple-start-char / "." | ||||||||||||||||||
|
||||||||||||||||||
quoted = "|" *(quoted-char / quoted-escape) "|" | ||||||||||||||||||
quoted-char = %x0-5B ; omit \ | ||||||||||||||||||
|
@@ -49,16 +52,19 @@ unquoted = unquoted-start *(name-char / ":") | |||||||||||||||||
unquoted-start = name-start / DIGIT / "." | ||||||||||||||||||
/ %xB7 / %x300-36F / %x203F-2040 | ||||||||||||||||||
|
||||||||||||||||||
; reserve sigils for private-use by implementations | ||||||||||||||||||
private-use = private-start reserved-body | ||||||||||||||||||
private-start = "^" / "&" | ||||||||||||||||||
; Reserve additional .keywords for use by future versions of this specification. | ||||||||||||||||||
reserved-statement = reserved-keyword [s reserved-body] 1*([s] expression) | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replying to @gibson042 from #529 (comment):
Could we merge this PR with this note in the ABNF, in expectation of getting a PR from @gibson042 that could update all reserved content holistically?
Suggested change
ps. I had not considered statements like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason statements end with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While that's true with the current state of this PR, I believe @gibson042 would like us to drop My request here is for us to find a way to not block this PR on that discussion, and to have it instead separately so that the syntax of both reserved statements and annotations could be considered in one package. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with finalizing this PR. I don't think the reserved-statement discussion (were we to change something) needs to be in the way of that. It should be a separate conversation. If we want to pursue a change, it should be at least an issue if not a design document. That said, I would not include the proposed note in this comment thread. Any changes we consider or make will be done in the near future. If we include text about it, put it in syntax.md. |
||||||||||||||||||
; Note that the following expression is a simplification, | ||||||||||||||||||
; as this rule MUST NOT be considered to match existing keywords | ||||||||||||||||||
; (`.input`, `.local`, and `.match`). | ||||||||||||||||||
reserved-keyword = "." name | ||||||||||||||||||
|
||||||||||||||||||
; reserve additional sigils for use by | ||||||||||||||||||
; future versions of this specification | ||||||||||||||||||
reserved = reserved-start reserved-body | ||||||||||||||||||
reserved-start = "!" / "@" / "#" / "%" / "*" / "<" / ">" / "/" / "?" / "~" | ||||||||||||||||||
reserved-body = *( [s] 1*(reserved-char / reserved-escape / quoted)) | ||||||||||||||||||
; Reserve additional sigils for use by future versions of this specification. | ||||||||||||||||||
reserved-annotation = reserved-annotation-start reserved-body | ||||||||||||||||||
reserved-annotation-start = "!" / "@" / "#" / "%" / "*" | ||||||||||||||||||
/ "<" / ">" / "/" / "?" / "~" | ||||||||||||||||||
gibson042 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
||||||||||||||||||
reserved-body = *([s] 1*(reserved-char / reserved-escape / quoted)) | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be separate productions for reserved statement bodies and reserved annotation bodies, so the body of reserved/private-use annotations better aligns with that of function annotations.
Suggested change
|
||||||||||||||||||
reserved-char = %x00-08 ; omit HTAB and LF | ||||||||||||||||||
/ %x0B-0C ; omit CR | ||||||||||||||||||
/ %x0E-19 ; omit SP | ||||||||||||||||||
Comment on lines
68
to
70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
And accordingly, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this precludes syntax like that used now in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it will need further tweaking to match |
||||||||||||||||||
|
@@ -67,6 +73,10 @@ reserved-char = %x00-08 ; omit HTAB and LF | |||||||||||||||||
/ %x7E-D7FF ; omit surrogates | ||||||||||||||||||
/ %xE000-10FFFF | ||||||||||||||||||
|
||||||||||||||||||
; Reserve sigils for private-use by implementations. | ||||||||||||||||||
private-use-annotation = private-start reserved-body | ||||||||||||||||||
private-start = "^" / "&" | ||||||||||||||||||
|
||||||||||||||||||
; identifier matches https://www.w3.org/TR/REC-xml-names/#NT-QName | ||||||||||||||||||
; name matches https://www.w3.org/TR/REC-xml-names/#NT-NCName | ||||||||||||||||||
identifier = [namespace ":"] name | ||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.