Expand description
Recursive-descent parser for the pic drawing core.
Follows dpic’s grammar.txt. Implemented: pictures (.PS … .PE), primitives
with the full attribute set, positions (pairs, places, corners, ordinals,
between, ± shifts), expressions with proper precedence, [ … ] blocks,
{ … } groups, labels, assignments, macros, includes, conditionals, loops,
print and exec.
Structs§
- Parse
Error - A parse error with source location.
file(viaParseError::span) isNonefor the user’s own input, or thecopyinclude / library name the position is relative to.
Functions§
- parse
- Parse a full source string into a
Picturewith no filesystem context.copy "file"includes are unavailable (they require a base directory). - parse_
body_ tokens - Parse a deferred body (the raw tokens of an
if/forblock) with the macro table in scope, expanding macro calls (andcopyincludes) along this executed path. Used by the evaluator so dead branches and recursive macros are never parsed. - parse_
in_ dir - Parse pic source, resolving
copy "file"includes relative tobasewith the default (unrestricted) include policy. - parse_
with_ prelude - Parse pic source with optional preludes:
circuitsloads the embedded circuit-element library andtexlabelsinjectstexlabels = 1— the library equivalents of the CLI-c/-tflags. Each prelude is lexed as its own named source unit (not text glued in front ofsrc), so every diagnostic position stays relative to the source it belongs to: the user’s own input reports user lines, and library problems name the library.