Parsing

class fluent.syntax.parser.FluentParser(with_spans=True)[source]

This class is used to parse Fluent source content.

with_spans enables source information in the form of ast.Span objects for each ast.SyntaxNode.

parse(source)[source]

Create a ast.Resource from a Fluent source.

parse_entry(source)[source]

Parse the first ast.Entry in source.

Skip all encountered comments and start parsing at the first ast.Message or ast.Term start. Return ast.Junk if the parsing is not successful.

Preceding comments are ignored unless they contain syntax errors themselves, in which case ast.Junk for the invalid comment is returned.