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

Wiring in Generalized Identifiers #167

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
47 changes: 37 additions & 10 deletions query-languages/m/m-spec-consolidated-grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,6 @@ identifier-part-character:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connecting-character<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;combining-character<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;formatting-character<br/>
generalized-identifier:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generalized-identifier-part<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generalized-identifier_ separated only by blanks (`U+0020`) _generalized-identifier-part<br/>
generalized-identifier-part:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generalized-identifier-segment<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;decimal-digit-character generalized-identifier-segment<br/>
generalized-identifier-segment:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyword-or-identifier<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyword-or-identifier dot-character keyword-or-identifier<br/>
dot-character:_<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`.` (`U+002E`)<br/>
_underscore-character:_<br/>
Expand Down Expand Up @@ -385,8 +376,13 @@ _field-list:<br/>
field:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;field-name_ `=` _expression<br/>
field-name:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;identifier<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quoted-identifier<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generalized-identifier<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quoted-identifier_<br/>
generalized-identifier:_<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The range of text spanned by a sequence of one or more tokens, other than `=`, `,` or `]`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;but only if that text complies with the generalized identifier grammar.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(This grammar token is contextual; it is only relevant in the context of when a `field-name` is expected.)

#### Item access expression

Expand Down Expand Up @@ -607,3 +603,34 @@ any-literal:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;number-literal<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text-literal<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;null-literal_


## Generalized identifer grammar

Compliance with this grammar can be validated using the following regular expression:
````
(?x)^
# generalized-identifier-always-valid-character
[(\p{L})|(\p{Nl})|(\p{Nd})|(\p{Mn})|(\p{Mc})|(\p{Pc})(\p{Cf})]

# (generalized-identifier-inner-valid-segment* period? generalized-identifier-always-valid-character)?
(?:
# generalized-identifier-inner-valid-segment
(?:.?[(\p{L})|(\p{Nl})|(\p{Nd})|(\p{Mn})|(\p{Mc})|(\p{Pc})(\p{Cf})\s])*

# period? generalized-identifier-always-valid-character
.?[(\p{L})|(\p{Nl})|(\p{Nd})|(\p{Mn})|(\p{Mc})|(\p{Pc})(\p{Cf})]
)?
$
````

_space:_<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Space character (`U+0020`)<br/>
_period:_<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Period character (`U+002E`))<br/>
_generalized-identifier-always-valid-character_:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Any character in the following Unicode classes: Lu (Uppercase Letter), Ll (Lowercase Letter), Lt (Titlecase Letter), Lm (Modifier Letter), Lo (Other Letter), Nl (Letter Number), Nd (Decimal Number), Mn (Nonspacing Mark), Mc (Spacing Mark), Pc (Connector Punctuation), Cf (Format)<br/>
_generalized-identifier-inner-valid-segment:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;period? (generalized-identifier-always-valid-character | space)<br/>
generalized-identifier-syntax:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generalized-identifier-always-valid-character (generalized-identifier-inner-valid-segment* period? generalized-identifier-always-valid-character)?_