@@ -8966,30 +8966,28 @@ \subsection{Symbols}
8966
8966
\LMHash{}%
8967
8967
A \IndexCustom{symbol literal}{literal!symbol}
8968
8968
denotes a name that would be either
8969
- a valid declaration name or a valid library name in a Dart program .
8969
+ a valid declaration name, a valid library name, or \VOID .
8970
8970
8971
8971
\begin{grammar}
8972
- <symbolLiteral> ::= `#' (<operator> | (<identifier> (`.' <identifier>)*))
8972
+ <symbolLiteral> ::=
8973
+ `#' (<identifier> (`.' <identifier>)* | <operator> | \VOID)
8973
8974
\end{grammar}
8974
8975
8975
8976
\LMHash{}%
8976
- A symbol literal \code{\#\id} where \id{} is an identifier
8977
- that does not begin with an underscore (`\code{\_}'),
8978
- evaluates to an instance of \code{Symbol} representing the identifier \id.
8979
- All occurrences of \code{\#\id} evaluate to the same instance
8980
- \commentary{(symbol instances are canonicalized)},
8981
- and no other symbol literals evaluate to that \code{Symbol} instance
8982
- or to a \code{Symbol} instance that is equal
8983
- (according to the \lit{==} operator \ref{equality}) to that instance .
8977
+ The static type of a symbol literal is \code{Symbol}.
8978
+
8979
+ \LMHash{}%
8980
+ Let \id{} be an identifier that does not begin with an underscore
8981
+ (`\code{\_}').
8982
+ The symbol literal \code{\#\id}
8983
+ evaluates to an instance of \code{Symbol}
8984
+ representing the identifier \id .
8984
8985
8985
8986
\LMHash{}%
8986
- A symbol literal \code{\#$\id.\id_2\ldots\id_n$}
8987
- where $\id{} \ldots \id_n$ are identifiers,
8988
- evaluates to an instance of \code{Symbol} representing that particular sequence of identifiers.
8989
- All occurrences of \code{\#$\id.\id_2\ldots\id_n$} with the same sequence of identifiers
8990
- evaluate to the same instance,
8991
- and no other symbol literals evaluate to that \code{Symbol} instance
8992
- or to a \code{Symbol} instance that is \lit{==} to that instance.
8987
+ A symbol literal \code{\#$\id_1$.$\id_2$.$\cdots$.$\id_n$}
8988
+ where \List{\id}{1}{n} are identifiers
8989
+ evaluates to an instance of \code{Symbol}
8990
+ representing that particular sequence of identifiers.
8993
8991
\commentary{%
8994
8992
This kind of symbol literal denotes the name of a library declaration,
8995
8993
as specified in a \synt{libraryName}.
@@ -8998,18 +8996,39 @@ \subsection{Symbols}
8998
8996
}
8999
8997
9000
8998
\LMHash{}%
9001
- A symbol literal \code{\#\metavar{operator}} evaluates to an instance of \code{Symbol}
8999
+ A symbol literal \code{\#\metavar{op}}
9000
+ where \metavar{op} is derived from \synt{operator}
9001
+ evaluates to an instance of \code{Symbol}
9002
9002
representing that particular operator name.
9003
- All occurrences of \code{\#\metavar{operator}} evaluate to the same instance,
9004
- and no other symbol literals evaluate to that \code{Symbol} instance
9005
- or to a \code{Symbol} instance that is \lit{==} to that instance.
9006
9003
9007
9004
\LMHash{}%
9008
- A symbol literal \code{\#\_\id}, evaluates to an instance of \code{Symbol}
9005
+ The symbol literal \code{\#void}
9006
+ evaluates to an instance of \code{Symbol}
9007
+ representing the reserved word \VOID.
9008
+
9009
+ \LMHash{}%
9010
+ Assume that the term $t$ is an identifier \id{}
9011
+ that does not start with an underscore,
9012
+ that $t$ is \VOID,
9013
+ that $t$ is a period separated sequence of identifiers
9014
+ \code{$id_1$.$id_2$.$\cdots$.$id_n$},
9015
+ or that $t$ is derived from \synt{operator}.
9016
+ Any two occurrences of \code{\#t} evaluate to the same object
9017
+ (\commentary{that is, symbol instances are canonicalized}),
9018
+ and no other symbol literals evaluate to that object,
9019
+ nor to a \code{Symbol} instance that is equal to that object
9020
+ according to the \lit{==} operator
9021
+ (\ref{equality}).
9022
+
9023
+ \LMHash{}%
9024
+ A symbol literal \code{\#\_\id} where \id{} is an identifier
9025
+ evaluates to an instance of \code{Symbol}
9009
9026
representing the private identifier \code{\_\id} of the containing library.
9010
- All occurrences of \code{\#\_\id} \emph{in the same library} evaluate to the same instance,
9011
- and no other symbol literals evaluate to that \code{Symbol} instance
9012
- or to a \code{Symbol} instance that is \lit{==} to that instance.
9027
+ All occurrences of \code{\#\_\id} \emph{in the same library} evaluate to
9028
+ the same object,
9029
+ and no other symbol literals evaluate to the same object,
9030
+ nor to a \code{Symbol} instance that is equal to that object
9031
+ according to the \lit{==} operator.
9013
9032
9014
9033
\LMHash{}%
9015
9034
The objects created by symbol literals all override
@@ -9043,9 +9062,6 @@ \subsection{Symbols}
9043
9062
convenient substitutes for enums are secondary benefits.%
9044
9063
}
9045
9064
9046
- \LMHash{}%
9047
- The static type of a symbol literal is \code{Symbol}.
9048
-
9049
9065
9050
9066
\subsection{Collection Literals}
9051
9067
\LMLabel{collectionLiterals}
@@ -16048,6 +16064,13 @@ \subsection{Identifier Reference}
16048
16064
16049
16065
<qualifiedName> ::= <typeIdentifier> `.' <identifier>
16050
16066
\alt <typeIdentifier> `.' <typeIdentifier> `.' <identifier>
16067
+
16068
+ <LETTER> ::= `a' .. `z'
16069
+ \alt `A' .. `Z'
16070
+
16071
+ <DIGIT> ::= `0' .. `9'
16072
+
16073
+ <WHITESPACE> ::= (`\\t' | ` ' | <NEWLINE>)+
16051
16074
\end{grammar}
16052
16075
16053
16076
\LMHash{}%
@@ -21424,17 +21447,28 @@ \subsubsection{Reserved Words}
21424
21447
\LMLabel{reservedWords}
21425
21448
21426
21449
\LMHash{}%
21427
- A \Index{reserved word} may not be used as an identifier; it is a compile-time error if a reserved word is used where an identifier is expected.
21450
+ A \Index{reserved word} can only be used in the syntactic positions
21451
+ specified by the grammar.
21452
+ In particular, a compile-time error occurs if a reserved word is used
21453
+ where an identifier is expected.
21428
21454
21429
- \ASSERT{}, \BREAK{}, \CASE{}, \CATCH{}, \CLASS{}, \CONST{}, \CONTINUE{}, \DEFAULT{}, \DO{}, \ELSE{}, \ENUM{}, \EXTENDS{}, \FALSE{}, \FINAL{}, \FINALLY{}, \FOR{}, \IF{}, \IN{}, \IS{}, \NEW{}, \NULL{}, \RETHROW, \RETURN{}, \SUPER{}, \SWITCH{}, \THIS{}, \THROW{}, \TRUE{}, \TRY{}, \VAR{}, \VOID{}, \WHILE{}, \WITH{}.
21455
+ \commentary{%
21456
+ Note that reserved words occur bold and unquoted in grammar rules
21457
+ (e.g., \ASSERT{})
21458
+ even though the consistent notation would use quotes
21459
+ (e.g., \lit{assert}).
21460
+ This notational abuse occurs because we believe
21461
+ it makes the grammar rules more readable.%
21462
+ }
21430
21463
21431
21464
\begin{grammar}
21432
- <LETTER> ::= `a' .. `z'
21433
- \alt `A' .. `Z'
21434
-
21435
- <DIGIT> ::= `0' .. `9'
21436
-
21437
- <WHITESPACE> ::= (`\\t' | ` ' | <NEWLINE>)+
21465
+ <reservedWord> ::= \ASSERT{} | \BREAK{} | \CASE{} | \CATCH{} |
21466
+ \CLASS{} | \CONST{} | \CONTINUE{}
21467
+ \alt\hspace{-3mm} \DEFAULT{} | \DO{} | \ELSE{} | \ENUM{} | \EXTENDS{} |
21468
+ \FALSE{} | \FINAL{} | \FINALLY{} | \FOR{} | \IF{} | \IN{} | \IS{}
21469
+ \alt\hspace{-3mm} \NEW{} | \NULL{} | \RETHROW{} | \RETURN{} | \SUPER{} |
21470
+ \SWITCH{} | \THIS{} | \THROW{} | \TRUE{} | \TRY{}
21471
+ \alt\hspace{-3mm} \VAR{} | \VOID{} | \WHILE{} | \WITH{}
21438
21472
\end{grammar}
21439
21473
21440
21474
0 commit comments