Enum ludtwig_parser::ast::SyntaxNode[][src]

pub enum SyntaxNode {
    Root(Vec<SyntaxNode>),
    Tag(Tag),
    Plain(Plain),
    Whitespace,
    HtmlComment(HtmlComment),
    OutputExpression(OutputExpression),
    TwigComment(TwigComment),
    TwigStatement(TwigStatement),
    TwigStructure(TwigStructure<SyntaxNode>),
}

The base enum for each syntax element in a document. Each variant represents some sort of structured representation of the document syntax. This is the foundation for the AST (abstract syntax tree) that is produced by the parser.

Variants

The root of the AST which contains other SyntaxNode values.

Tag(Tag)

Plain old Html tag that can have any value as a name (even vue components for example). It may also have attributes. It can also have children which are only a list of SyntaxNode instances. For example <h2 class="bold">...</h2>

Plain(Plain)

Basically only plain text but does only represent text without line break characters or indentation.

Whitespace

Some sort of whitespace (can be anything from spaces to tabs to line breaks). Multiple sequential forms of whitespace will always result in only one instance of this.

HtmlComment(HtmlComment)

Comments in Html that look like <!-- some comment -->

OutputExpression(OutputExpression)

Some expression to output something like
twig: {{ my_counter|e }} (can be php)
vue: {{ myCounter.count }} (can be javascript)

TwigComment(TwigComment)

Comment in twig syntax: {# some comment #}

TwigStatement(TwigStatement)

Some execute statement that has no children / has no closing syntax.

Examples

{% set foo = 'foo' %}

or {% parent %}

or ...

TwigStructure(TwigStructure<SyntaxNode>)

Some hierarchical twig syntax.

Examples

{% block my_block_name %}...{% endblock %}

Notes

This is preferred over TwigStatement by the parser if it sees special keywords like block right after the {% .

Trait Implementations

impl Clone for SyntaxNode[src]

impl Debug for SyntaxNode[src]

impl Eq for SyntaxNode[src]

impl HasChildren<SyntaxNode> for Tag[src]

impl PartialEq<SyntaxNode> for SyntaxNode[src]

impl StructuralEq for SyntaxNode[src]

impl StructuralPartialEq for SyntaxNode[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.