Skip to main content

Module parser

Module parser 

Source
Expand description

Rust source code parser for extracting FORGE schema definitions.

Parses Rust source files using syn to extract model, enum, and function definitions without requiring compilation.

Key design decisions:

  • Context arguments are matched against KNOWN_CONTEXT_TYPES, a fixed list of the 8 Forge context types. User-defined types like AppContext are not accidentally skipped.
  • Result<T, E> extraction uses syn::TypePath recursion, handling arbitrarily nested generics.
  • Unparseable inner types become RustType::Custom(original_string) instead of silently falling back to String.
  • NaiveTime correctly maps to RustType::LocalTime.

Structs§

ParseOutcome
Schema registry plus file-level parse failures from parse_project.

Functions§

find_duplicate_handlers
Scan a source directory and return every (kind, name) pair that appears in more than one file. Map key is "kind:name", value is the list of file paths.
parse_project
validate_registry
Validate every function uses types the emitters support.