Seven-Streams opened a new pull request, #736:
URL: https://github.com/apache/tvm-ffi/pull/736

   ## Summary
   
   Generalize parsing and dispatch for standalone one-line `tvm-ffi-stubgen`
   directives. Pipeline-owned and generator-owned directives now share one
   `CodeBlock` representation, while each layer remains responsible for its own
   payload grammar. This lets a target generator add directives without 
extending
   the language-neutral file parser.
   
   ## Changes
   
   - Add `MarkerSyntax.directive(name)` for constructing standalone directive
     markers with either Python or Rust comment syntax.
   - Parse standalone directives uniformly as
     `CodeBlock(kind="directive", param=(name, payload))` and preserve their 
source
     lines when rewriting files.
   - Add `PIPELINE_DIRECTIVE_KINDS` for directives consumed by the common 
pipeline.
     `ty-map` remains pipeline-owned and is processed before init-mode 
generation.
   - Add `Generator.directive_kinds` and `Generator.add_directive` so each 
target
     declares and handles its own directive names. Undeclared names fail with 
their
     source line number.
   - Route the existing Python `import-object` support through `add_directive`, 
and
     move its semicolon-delimited payload parsing from the common parser into 
the
     Python generator.
   
   ## Compatibility
   
   The undocumented `tvm-ffi-stubgen(begin): ty-map/...` block form is no longer
   accepted; `ty-map` is a standalone one-line directive. Out-of-tree 
`Generator`
   implementations must provide `directive_kinds` and `add_directive`;
   `add_imported_object` is no longer called by the pipeline.
   
   ## Tests
   
   - `uv run pytest -q tests/python/test_stubgen.py` (43 passed)
   - `uv run ruff check` on all changed Python files
   - `git diff --check`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to