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 ofast.Span
objects for eachast.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
orast.Term
start. Returnast.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.
-