Skip to main content

Crate zincite_syntax

Crate zincite_syntax 

Source
Expand description

Source-preserving syntax for MiniZinc 2.10.1.

Lexing retains trivia and erroneous input. It does not check model or data grammar, resolve names, or evaluate literals. Interpolated strings retain literal chunks and embedded expression tokens in the same source buffer. Parsing supports scalar and ordinary collection declarations, domains, indexed and matrix literals, dependent indices, cardinalities, array access, operator expressions, calls, interpolated strings, annotations, constraints with optional string labels, comprehensions, generator calls, conditional and let expressions, callable/annotation declarations with generic types and parameter defaults, enums and constructors, type aliases and type-inst concatenation, includes, output items and all solve modes. Compiler-supported extensions include deprecated function declarations without function, anonymous _(expression) constructors in assignments, identifier equality items without constraint, and predicate ann: name capture bindings. These retain their written tokens and expose ordinary callable, call and constraint nodes, plus a distinct annotation-capture binding in the signature. Tuple/record types and literals and chained field access share the CST. Data mode accepts only top-level assignments. Reserved variant_record/case syntax remains unsupported.

Modules§

inputs
Read-only input discovery shared by the formatter and linter.

Structs§

ByteParsedFile
Exact source bytes and their syntax, with a separate UTF-8 analysis view.
Diagnostic
A lexical/parser error or an explicitly unsupported syntax form.
LexedSource
Source text and its tokens. Read-only access keeps their ranges valid.
ParsedFile
Owned source, its lossless tree, and lexical/parser diagnostics.
SyntaxNode
A node’s children retain source order. Each token occurs in exactly one leaf.
Token
A source spelling is available by slicing the source with this byte range.

Enums§

FileMode
The syntax permitted at the top level of a source file.
NodeKind
SyntaxElement
TokenKind
Lexical distinctions for a parser. Unicode operators share their ASCII equivalent’s kind; spelling is always retained in the source.

Functions§

byte_line_column
Return one-based line and column at an original byte boundary. Valid UTF-8 scalars and invalid bytes each occupy one column; CRLF is one break. Panics for an out-of-range offset or one inside a valid UTF-8 scalar.
is_utf8_boundary
Return whether an original-byte offset avoids splitting a valid UTF-8 scalar. Each invalid byte is a boundary; offsets beyond the source are not boundaries.
lex
Tokenize an owned UTF-8 source, retaining every byte in source order.
lexical_protected_ranges
Validate the complete source and return byte ranges of comments and string chunks, including interpolated literals, without retaining every token. Expressions inside interpolation remain editable. Lexical errors, including unterminated interpolation at EOF, reject the complete result.
literal_include_path
Decode a literal include path as bytes without loading files or evaluating interpolations. Unsupported paths return None; source spelling is untouched.
parse
Parse the supported model subset, retaining all tokens even after an error.
parse_bytes
Parse model bytes, accepting invalid UTF-8 only inside comments. Syntax errors remain in the analysis file’s diagnostics. Unsupported byte input returns a diagnostic at its original byte range.
parse_bytes_with_mode
Parse model or assignment-only data bytes without resolving includes. All ranges refer to the supplied bytes; a BOM is not stripped automatically.
parse_with_mode
Parse model syntax or assignment-only data syntax without resolving names. Calls in data expressions are retained: determining whether an operation is user-defined requires the model and is outside syntax checking.