Function moparse::parse

source ·
pub fn parse(tokens: &TokenCollection, start: SyntaxKind) -> Vec<SyntaxEvent>
Expand description

Parse tokens and return a list of syntax events indicating scopes of specific productions.

This function takes tokens collection generated by lex() function as well as the starting rule. After all tokens are parsed this function returns flat collection of SyntaxEvent. Each event may mark either start or end of specific syntax rule, or point to the terminal(token) included in such rule (sometimes with an error message if syntax error was met).

  • tokens: reference to tokens collection returned by lex() function
  • start: rule that should act as a entry point of the parsing process