src code

class method SpahQL.QueryParser.parseQuery

SpahQL.QueryParser.parseQuery(str) → SpahQL.Query instance
  • str (String) – The string query e.g. “/foo/bar == 3”

Parses a string query and returns a parsed SpahQL.Query instance.

Uses control characters such as set openers, comparison operators and path delimiters to throw the tokenizer into a variety of states. The actual parsing of each token is handed by a set of functions with naming convention readAhead, e.g. readAheadStringLiteral. These methods are responsible for identifying the token, reading ahead to parse it, and returning the found object to the tokenizer along with an updated index at which the tokenizer may resume parsing.