Struct flycatcher_parser::Parser [−][src]
pub struct Parser<'a> {
pub filename: &'a str,
pub source: &'a str,
pub diagnostics: Vec<Diagnostic<()>>,
// some fields omitted
}Expand description
A Parser struct that takes an input string, tokenizes it and parses it into a more or less readable AST tree.
Fields
filename: &'a strThe name of the input file that is being parsed. This property helps make more precise diagnostic messages, by providing the name of the file that the diagnostic originated from.
source: &'a strThe string of Flycatcher input that is tokenized and parsed by the parser. The source is also used to emit code snippets in diagnostic messages.
diagnostics: Vec<Diagnostic<()>>A list of diagnostics that were created during parsing. These are not logged to the console by the parser, so they can be used to recieve information for IDEs and such.
Implementations
Allocates a new parser object. This does not start the parsing process, it only initializes a lexer and parser and returns the parser.
Arguments
filename: The absolute file path to the file being parsed, if any. If you don’t have an actual file to put here, put@anonymous.source: The string that will be tokenized and parsed by the parser that is allocated by this function.
Parses a single expression from the lexer, returning a single AST object that represents
it, or an ErrorKind enum object describing how it ended. If Err(ErrorKind::EndOfFile)
was returned, that only means that there was no expression left, not that an actual
error occurred.