pub struct Flags(/* private fields */);Expand description
What the lexer noticed about a token that its kind doesn’t say.
Implementations§
Source§impl Flags
impl Flags
Sourcepub const NEWLINE_BEFORE: Flags
pub const NEWLINE_BEFORE: Flags
A line terminator came before the token; see Token::newline_before.
Sourcepub const ESCAPED: Flags
pub const ESCAPED: Flags
An identifier, string or template part with a backslash escape in
it, so its value isn’t its text. An escaped identifier is never a
Kind::Keyword: \u0076ar is Kind::Ident with this flag,
which the parser has to reject where var would be reserved.
Sourcepub const LEGACY_OCTAL: Flags
pub const LEGACY_OCTAL: Flags
A legacy octal literal (017), a decimal literal with a leading
zero (08), or a string with a legacy octal escape ("\01",
"\8"): allowed in sloppy scripts, a syntax error in strict code.
The lexer can’t tell whether a script is strict, so it flags these
and leaves the error to the parser; in a module, which is always
strict, it reports them itself.
Sourcepub const INVALID_ESCAPE: Flags
pub const INVALID_ESCAPE: Flags
A template part with an escape that isn’t one (`\01`,
`\xg`). A tagged template allows it, and its cooked value is
undefined; anywhere else it’s a syntax error, which the parser
reports, since only it knows whether the template is tagged.