Skip to main content

Module parser

Module parser 

Source
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§

ParseError
A parse error with source location.

Functions§

parse
Parse a full source string into a Picture with 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/for block) with the macro table in scope, expanding macro calls (and copy includes) 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 to base.