Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unquoted literals as name or number #553

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

Merged
merged 9 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions spec/message.abnf
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ quoted-char = %x0-5B ; omit \
/ %x7D-D7FF ; omit surrogates
/ %xE000-10FFFF

unquoted = unquoted-start *(name-char / ":")
unquoted-start = name-start / DIGIT / "."
/ %xB7 / %x300-36F / %x203F-2040
unquoted = name
/ number-literal
; number-literal matches JSON number
; https://www.rfc-editor.org/rfc/rfc8259#section-6
number-literal = ["-"] (0 / ([1-9] *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT]

; Reserve additional .keywords for use by future versions of this specification.
reserved-statement = reserved-keyword [s reserved-body] 1*([s] expression)
Expand Down
18 changes: 9 additions & 9 deletions spec/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,9 @@ Any _unquoted_ literal MAY be _quoted_.
Implementations MUST NOT distinguish between _quoted_ and _unquoted_ literals
that have the same sequence of code points.

_Unquoted_ literals have a much more restricted range that
is intentionally close to the XML's [Nmtoken](https://www.w3.org/TR/xml/#NT-Nmtoken),
with the restriction that it MUST NOT start with `-` or `:`,
as those would conflict with _function_ start characters.
_Unquoted_ literals can contain a _name_ or consist of a _number-literal_.
A _number-literal_ uses the same syntax as JSON and is intended for the encoding
of number values in _operands_ or _options_, or as _keys_ for _variants_.

```abnf
literal = quoted / unquoted
Expand All @@ -713,9 +712,9 @@ quoted-char = %x0-5B ; omit \
/ %x7D-D7FF ; omit surrogates
/ %xE000-10FFFF

unquoted = unquoted-start *name-char
unquoted-start = name-start / DIGIT / "."
/ %xB7 / %x300-36F / %x203F-2040
unquoted = name
/ number-literal
number-literal = ["-"] (0 / ([1-9] *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT]
```

### Names and Identifiers
Expand All @@ -732,10 +731,11 @@ _Function_ _identifiers_ are prefixed with `:`, `+`, or `-`.
_Option_ _identifiers_ have no prefix.

A **_<dfn>name</dfn>_** is a character sequence used in an _identifier_
or as the name for for a _variable_.
or as the name for a _variable_
or the value of an _unquoted_ _literal_.

_Variable_ names are prefixed with `$`.
for a _function_ (prefixed with `:`, `+` or `-`),
_Function_ names are prefixed with `:`, `+` or `-`.

Valid content for _names_ is based on <cite>Namespaces in XML 1.0</cite>'s
[NCName](https://www.w3.org/TR/xml-names/#NT-NCName).
Expand Down