符号
源 notation Commit: a2405b970b7c8222a483b82213adcb17d646c75d
语法
Lexer和Syntax语法片段使用以下符号表示法:
| 符号 | 示例 | 意义 |
|---|---|---|
| CAPITAL | KW_IF, INTEGER_LITERAL | 词法分析器生成的标记 |
| ItalicCamelCase | LetStatement, Item | 语法产生 |
string |
x, while, * |
确切的字符 |
| \x | \n, \r, \t, \0 | 此字符的转义表示 |
| x? | pub? |
可选项 |
| x* | OuterAttribute* | 0或多个 |
| x+ | MacroMatch+ | 1或多个 |
| xa..b | HEX_DIGIT1..6 | a to b repetitions of x |
| | | u8 | u16, Block | Item |
Either one or another |
| [ ] | [b B] |
Any of the characters listed |
| [ - ] | [a-z] |
Any of the characters in the range |
| ~[ ] | ~[b B] |
Any characters, except those listed |
~string |
~\n, ~*/ |
Any characters, except this sequence |
| ( ) | (, Parameter)? |
Groups items |
String table productions
语法中的一些规则 - 特别是一元运算符,二元运算符和关键字 - 以简化形式给出:作为可打印字符串的列表。这些情况构成了关于token规则的规则的子集 ,并且被假定为由DFA驱动的解析器的词法分析阶段的结果,其在所有这样的字符串表条目的分离上操作。
当等宽字体中的这种字符串出现在语法内部时,它是对这种字符串表生成的单个成员的隐式引用。 有关更多信息,请参阅tokens。