AST

class fluent.syntax.ast.BaseNode[source]

Bases: object

Base class for all Fluent AST nodes.

All productions described in the ASDL subclass BaseNode, including Span and Annotation. Implements __str__, to_json and traverse.

clone()[source]

Create a deep clone of the current node.

equals(other, ignored_fields=['span'])[source]

Compare two nodes.

Nodes are deeply compared on a field by field basis. If possible, False is returned early. When comparing attributes and variants in SelectExpressions, the order doesn’t matter. By default, spans are not taken into account.

class fluent.syntax.ast.SyntaxNode(span=None, **kwargs)[source]

Bases: fluent.syntax.ast.BaseNode

Base class for AST nodes which can have Spans.

class fluent.syntax.ast.Resource(body=None, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.Entry(span=None, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

An abstract base class for useful elements of Resource.body.

class fluent.syntax.ast.Message(id, value=None, attributes=None, comment=None, **kwargs)[source]

Bases: fluent.syntax.ast.Entry

class fluent.syntax.ast.Term(id, value, attributes=None, comment=None, **kwargs)[source]

Bases: fluent.syntax.ast.Entry

class fluent.syntax.ast.Pattern(elements, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.PatternElement(span=None, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

An abstract base class for elements of Patterns.

class fluent.syntax.ast.TextElement(value, **kwargs)[source]

Bases: fluent.syntax.ast.PatternElement

class fluent.syntax.ast.Placeable(expression, **kwargs)[source]

Bases: fluent.syntax.ast.PatternElement

class fluent.syntax.ast.Expression(span=None, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

An abstract base class for expressions.

class fluent.syntax.ast.Literal(value, **kwargs)[source]

Bases: fluent.syntax.ast.Expression

An abstract base class for literals.

class fluent.syntax.ast.StringLiteral(value, **kwargs)[source]

Bases: fluent.syntax.ast.Literal

class fluent.syntax.ast.NumberLiteral(value, **kwargs)[source]

Bases: fluent.syntax.ast.Literal

class fluent.syntax.ast.MessageReference(id, attribute=None, **kwargs)[source]

Bases: fluent.syntax.ast.Expression

class fluent.syntax.ast.TermReference(id, attribute=None, arguments=None, **kwargs)[source]

Bases: fluent.syntax.ast.Expression

class fluent.syntax.ast.VariableReference(id, **kwargs)[source]

Bases: fluent.syntax.ast.Expression

class fluent.syntax.ast.FunctionReference(id, arguments, **kwargs)[source]

Bases: fluent.syntax.ast.Expression

class fluent.syntax.ast.SelectExpression(selector, variants, **kwargs)[source]

Bases: fluent.syntax.ast.Expression

class fluent.syntax.ast.CallArguments(positional=None, named=None, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.Attribute(id, value, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.Variant(key, value, default=False, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.NamedArgument(name, value, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.Identifier(name, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.BaseComment(content=None, **kwargs)[source]

Bases: fluent.syntax.ast.Entry

class fluent.syntax.ast.Comment(content=None, **kwargs)[source]

Bases: fluent.syntax.ast.BaseComment

class fluent.syntax.ast.GroupComment(content=None, **kwargs)[source]

Bases: fluent.syntax.ast.BaseComment

class fluent.syntax.ast.ResourceComment(content=None, **kwargs)[source]

Bases: fluent.syntax.ast.BaseComment

class fluent.syntax.ast.Junk(content=None, annotations=None, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode

class fluent.syntax.ast.Span(start, end, **kwargs)[source]

Bases: fluent.syntax.ast.BaseNode

class fluent.syntax.ast.Annotation(code, arguments=None, message=None, **kwargs)[source]

Bases: fluent.syntax.ast.SyntaxNode