KEYWORDS

Constant KEYWORDS 

Source
pub const KEYWORDS: &[&str];
Expand description

The words the Python surface reads as syntax rather than as names.

The lexer does not distinguish them — def is an Raw::Ident like any other, and the parser is what decides that this one starts a definition. So this is a list, and a list is a second place for the truth to live unless something holds it to the first: the_keyword_table_is_the_one_the_parser_matches reads every at_kw("…") and eat_kw("…") out of the parser’s own source and asserts the two sets are equal. A keyword the parser gains and this does not is a red test rather than a word an editor quietly stops colouring.

It is here rather than in the parser because its consumers are editors — highlighting and completion (beck_core::editor) — and an editor should not have to depend on a parser to know which words are keywords.