|
SciLex
A header-only C++20 lexer built on REAL
|
Classes | |
| struct | grammar_fields |
| The fields of one rule line, split on tabs, with the byte column each starts at. More... | |
| struct | indent_measure |
| A line's indentation under tab_policy::python (tab stops of 8, and tabs as 1). More... | |
| struct | transition_site |
Where a rule's push= or set= option is written. More... | |
Functions | |
| std::string | quoting (std::string_view before, std::string_view word, std::string_view after) |
before, then word in quotes, then after: a cause naming the offending word. | |
| grammar_fields | split_grammar_line (std::string_view line, std::size_t first) |
Splits line on tabs, from first (0-based), keeping each field's column. | |
| std::string_view | checked_mode (std::string_view name, std::string_view word, const std::string &origin, std::size_t line, std::size_t column) |
name, refused when it is empty or holds a comma (which separates the modes of in=). | |
| void | set_transition (rule &out, mode_action::op operation, std::string_view target, const std::string &origin, std::size_t line, std::size_t column) |
Gives out its transition, refusing a second one. | |
| std::size_t | apply_grammar_options (std::string_view options, std::size_t column, const std::string &origin, std::size_t line, rule &out) |
Applies the space-separated options of one rule to out. | |
| void | check_transition_targets (const grammar &parsed, const std::vector< transition_site > &sites, const std::string &origin) |
Refuses a push= or set= whose mode no rule is active in, at the option. | |
| indent_measure | measure_indent (std::string_view source, std::size_t offset) |
Measures the bytes of source between the start of the line holding offset and it. | |
| std::vector< token > | layout_pass (std::span< const token > tokens, const std::vector< bool > &mode_significant, const std::string_view *source, tab_policy tabs) |
|
inline |
Applies the space-separated options of one rule to out.
| [in] | options | The options field. |
| [in] | column | The 1-based column the field starts at. |
| [in] | origin | For errors: where the grammar came from. |
| [in] | line | For errors: the 1-based line. |
| [in,out] | out | The rule being built. |
push= or set= option, or 0 when it has none. | grammar_error | On an unknown option, an empty mode name, or a second transition. |
|
inline |
Refuses a push= or set= whose mode no rule is active in, at the option.
| [in] | parsed | The grammar. |
| [in] | sites | Where each push= and set= is written. |
| [in] | origin | For errors: where the grammar came from. |
| grammar_error | For the first such transition. |
|
inline |
name, refused when it is empty or holds a comma (which separates the modes of in=).
| [in] | name | A mode name from an option. |
| [in] | word | For errors: the whole option. |
| [in] | origin | For errors: where the grammar came from. |
| [in] | line | For errors: the 1-based line. |
| [in] | column | For errors: the 1-based column of the option. |
name. | grammar_error | When name is empty or holds a comma. |
|
inline |
|
inline |
Measures the bytes of source between the start of the line holding offset and it.
|
inline |
before, then word in quotes, then after: a cause naming the offending word.
| [in] | before | The text before the word. |
| [in] | word | The offending word. |
| [in] | after | The text after it. |
|
inline |
Gives out its transition, refusing a second one.
| [in,out] | out | The rule being built. |
| [in] | operation | The transition. |
| [in] | target | The mode it enters (empty for pop). |
| [in] | origin | For errors: where the grammar came from. |
| [in] | line | For errors: the 1-based line. |
| [in] | column | For errors: the 1-based column of the option. |
| grammar_error | When out already has a transition. |
|
inline |
Splits line on tabs, from first (0-based), keeping each field's column.
| [in] | line | The line, trailing blanks already removed. |
| [in] | first | Where the first field starts. |