Skip to content

Commit a41afcf

Browse files
committed
[spec/lex] Optional IdentifierStart after string/numeric literal suffix
This is for dlang/dmd#15339.
1 parent e36cd95 commit a41afcf

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

spec/lex.dd

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ $(GNAME IdentifierStart):
268268
$(I Letter)
269269
$(I UniversalAlpha)
270270

271+
$(GNAME IdentifierStartError):
272+
IdentifierStart
273+
271274
$(GNAME IdentifierChar):
272275
$(GLINK IdentifierStart)
273276
$(B 0)
@@ -282,6 +285,10 @@ Identifiers can be arbitrarily long, and are case sensitive.)
282285

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

288+
$(NOTE *IdentifierStartError* exists to enforce that a string or numeric literal
289+
with a suffix is not immediately followed by an identifier without whitespace.)
290+
291+
285292
$(H2 $(LNAME2 string_literals, String Literals))
286293

287294
$(GRAMMAR
@@ -342,9 +349,9 @@ $(GNAME EscapeSequence):
342349
$(B \\) $(GLINK2 entity, NamedCharacterEntity)
343350

344351
$(GNAME StringPostfix):
345-
$(B c)
346-
$(B w)
347-
$(B d)
352+
$(B c) $(GLINK IdentifierStartError)$(OPT)
353+
$(B w) $(GLINK IdentifierStartError)$(OPT)
354+
$(B d) $(GLINK IdentifierStartError)$(OPT)
348355

349356
$(GNAME DelimitedString):
350357
$(B q") $(GLINK Delimiter) $(GLINK WysiwygCharacters)$(OPT) $(GLINK MatchingDelimiter) $(B ") $(GLINK StringPostfix)$(OPT)
@@ -625,7 +632,7 @@ $(H2 $(LNAME2 integerliteral, Integer Literals))
625632
$(GRAMMAR_LEX
626633
$(GNAME IntegerLiteral):
627634
$(GLINK Integer)
628-
$(GLINK Integer) $(GLINK IntegerSuffix)
635+
$(GLINK Integer) $(GLINK IntegerSuffix) $(GLINK IdentifierStartError)$(OPT)
629636

630637
$(GNAME Integer):
631638
$(GLINK DecimalInteger)
@@ -832,8 +839,8 @@ $(H2 $(LNAME2 floatliteral, Floating Point Literals))
832839
$(GRAMMAR_LEX
833840
$(GNAME FloatLiteral):
834841
$(GLINK Float)
835-
$(GLINK Float) $(GLINK Suffix)
836-
$(GLINK Integer) $(GLINK FloatSuffix)
842+
$(GLINK Float) $(GLINK Suffix) $(GLINK IdentifierStartError)$(OPT)
843+
$(GLINK Integer) $(GLINK FloatSuffix) $(GLINK IdentifierStartError)$(OPT)
837844
$(GLINK Integer) $(GLINK ImaginarySuffix)
838845
$(GLINK Integer) $(GLINK FloatSuffix) $(GLINK ImaginarySuffix)
839846
$(GLINK Integer) $(GLINK RealSuffix) $(GLINK ImaginarySuffix)

0 commit comments

Comments
 (0)