tiny.syn.Mode
Defined in state.
One kind of comment or string that is still open at the end of a line.
API (9)
Actions
Public operations.
admittedBy: Returns true when the scanner forlanguagecan leave this mode open.
Fields and members
Public fields and members.
block_commenthaskell_commentlua_commentmarkup_commentpython_triple_doublepython_triple_singletoml_triple_doubletoml_triple_single
Source
Source: lib/syn/src/state.zig:25
zig
/// One kind of comment or string that is still open at the end of a line. Each mode has its own/// closing delimiter, which the next line looks for. A caller reads it from `State.mode` to learn/// which comment or string a line left open.pub const Mode = enum { /// An open `/*` comment, closed by `*/`. C, C++, C#, Java, JavaScript, TypeScript, Go, Rust, /// PHP, Swift, Kotlin, Scala, Dart, Zig and CSS can leave it open. block_comment, /// An open Haskell `{-` comment, closed by `-}`. haskell_comment, /// An open Lua `--[[` comment, closed by `]]`. lua_comment, /// An open `<!--` comment in HTML, XML, Vue or Svelte, closed by `-->`. markup_comment, /// An open Python string that began with `'''`, closed by `'''`. The opening quotes may follow /// a prefix such as `f` or `rb`. python_triple_single, /// An open Python string that began with `"""`, closed by `"""`. python_triple_double, /// An open TOML literal string that began with `'''`, closed by `'''`. A backslash has no /// special meaning inside it. toml_triple_single, /// An open TOML basic string that began with `"""`, closed by `"""`. A backslash escapes the /// next character, so `\"""` leaves the string open. toml_triple_double, /// Returns true when the scanner for `language` can leave this mode open. `State` checks it /// before it stores a mode, and the tests use it to pin down which language can leave which /// mode open. A test compares the answer for every language and mode against a fixed list of /// pairs. pub fn admittedBy(self: Mode, language: Language) bool { return switch (self) { .block_comment => switch (language) { .zig, .c, .cpp, .csharp, .java, .javascript, .typescript, .go, .rust, .php, .swift, .kotlin, .scala, .dart, .css, => true, else => false, }, .haskell_comment => language == .haskell, .lua_comment => language == .lua, .markup_comment => switch (language) { .html, .xml, .vue, .svelte => true, else => false, }, .python_triple_single, .python_triple_double, => language == .python, .toml_triple_single, .toml_triple_double, => language == .toml, }; }};Source: lib/syn/src/root.zig:53
zig
pub const Mode = state.Mode;Audit
| Definitions | 2 |
|---|---|
| Public names | 4 |
| Members | 8 |
| Version | 26.7.0 |
| Revision | daab053ee433 |