Documentation
¶
Index ¶
Constants ¶
const UnterminatedString = "unterminated string literal"
UnterminatedString is the literal of the ILLEGAL token for a string literal with no closing quote.
Variables ¶
This section is empty.
Functions ¶
func AppendEscape ¶ added in v0.28.0
AppendEscape decodes the escape sequence starting at the backslash s[i], writes the result to b and returns the index just past it. Sequences that are not escapes (\d, \N{...}, an incomplete \x) are kept as written, as Python keeps unknown escapes.
func UnescapeString ¶ added in v0.28.0
UnescapeString decodes Python escape sequences in a string literal's content. In bytesMode, \x and octal escapes give raw bytes and \u, \U and \N are not escapes (as in a bytes literal).
Types ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
func (*Lexer) FirstLineIndented ¶ added in v0.37.0
FirstLineIndented reports whether the source's first line holds code and starts with spaces or tabs. The lexer measures indentation after a newline only, so a parser of whole scripts checks this itself (as Python, it refuses an indented first line); an expression ("f'{ x }'") may start so.