Skip to content

Commit

Permalink
[spec/lex] Optional IdentifierStart after string/numeric literal suffix
Browse files Browse the repository at this point in the history
This is for dlang/dmd#15339.

I have ignored the ImaginarySuffix FloatLiteral variants,
as they are deprecated.
  • Loading branch information
ntrel committed Jun 22, 2023
1 parent e36cd95 commit 8d9bb15
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions spec/lex.dd
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ $(GNAME IdentifierStart):
$(I Letter)
$(I UniversalAlpha)

$(GNAME IdentifierStartError):
IdentifierStart

$(GNAME IdentifierChar):
$(GLINK IdentifierStart)
$(B 0)
Expand All @@ -282,6 +285,11 @@ Identifiers can be arbitrarily long, and are case sensitive.)

$(IMPLEMENTATION_DEFINED Identifiers starting with $(D __) (two underscores) are reserved.)

$(NOTE *IdentifierStartError* exists to enforce that a $(GLINK StringPostfix)
or numeric literal with a suffix is not immediately followed by an identifier
without whitespace.)


$(H2 $(LNAME2 string_literals, String Literals))

$(GRAMMAR
Expand Down Expand Up @@ -342,9 +350,9 @@ $(GNAME EscapeSequence):
$(B \\) $(GLINK2 entity, NamedCharacterEntity)

$(GNAME StringPostfix):
$(B c)
$(B w)
$(B d)
$(B c) $(GLINK IdentifierStartError)$(OPT)
$(B w) $(GLINK IdentifierStartError)$(OPT)
$(B d) $(GLINK IdentifierStartError)$(OPT)

$(GNAME DelimitedString):
$(B q") $(GLINK Delimiter) $(GLINK WysiwygCharacters)$(OPT) $(GLINK MatchingDelimiter) $(B ") $(GLINK StringPostfix)$(OPT)
Expand Down Expand Up @@ -625,7 +633,7 @@ $(H2 $(LNAME2 integerliteral, Integer Literals))
$(GRAMMAR_LEX
$(GNAME IntegerLiteral):
$(GLINK Integer)
$(GLINK Integer) $(GLINK IntegerSuffix)
$(GLINK Integer) $(GLINK IntegerSuffix) $(GLINK IdentifierStartError)$(OPT)

$(GNAME Integer):
$(GLINK DecimalInteger)
Expand Down Expand Up @@ -832,8 +840,8 @@ $(H2 $(LNAME2 floatliteral, Floating Point Literals))
$(GRAMMAR_LEX
$(GNAME FloatLiteral):
$(GLINK Float)
$(GLINK Float) $(GLINK Suffix)
$(GLINK Integer) $(GLINK FloatSuffix)
$(GLINK Float) $(GLINK Suffix) $(GLINK IdentifierStartError)$(OPT)
$(GLINK Integer) $(GLINK FloatSuffix) $(GLINK IdentifierStartError)$(OPT)
$(GLINK Integer) $(GLINK ImaginarySuffix)
$(GLINK Integer) $(GLINK FloatSuffix) $(GLINK ImaginarySuffix)
$(GLINK Integer) $(GLINK RealSuffix) $(GLINK ImaginarySuffix)
Expand Down

0 comments on commit 8d9bb15

Please sign in to comment.