Skip to content

Feature Request: Expose AST Root Node to Enable Custom NodeVisitor Implementation #701

@Ryokki

Description

@Ryokki

I am using Pebble version 3.2.2.

My goal is to implement a custom NodeVisitor for static analysis, such as collecting all variable names used within a template.

Pebble provides the NodeVisitor interface, which is perfect for this. However, there is no public API to access the AST's root node from a compiled PebbleTemplate. The implementation class, PebbleTemplateImpl, holds rootNode as a private field without a public getter.

This makes it impossible to initiate the AST traversal (i.e., rootNode.accept(myVisitor)), preventing the use of custom visitors.

To enable this powerful feature, could you please consider adding a public getter for the root node to PebbleTemplateImpl?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions