Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

空白

Lexer
WHITESPACE
      U+0009 // Horizontal tab, '\t'
    | U+000A // Line feed, '\n'
    | U+000B // Vertical tab
    | U+000C // Form feed
    | U+000D // Carriage return, '\r'
    | U+0020 // Space, ' '
    | U+0085 // Next line
    | U+200E // Left-to-right mark
    | U+200F // Right-to-left mark
    | U+2028 // Line separator
    | U+2029 // Paragraph separator

TAB → U+0009 // Horizontal tab, '\t'

LF → U+000A // Line feed, '\n'

CR → U+000D // Carriage return, '\r'

WHITESPACE U+0009 U+000A U+000B U+000C U+000D U+0020 U+0085 U+200E U+200F U+2028 U+2029
TAB U+0009
LF U+000A
CR U+000D

空白是任何非空字符串,仅包含具有 Pattern_White_Space Unicode 属性的字符。

Rust 是一种“自由形式“语言,这意味着所有形式的空白仅用于在语法中分隔_词法单元_,没有语义意义。

如果每个空白元素被任何其他合法空白元素(如单个空格字符)替换,Rust 程序具有相同的含义。