Member Junction
    Preparing search index...

    The MJ Query expression grammar, a small recursive-descent parser:

    expression := or ["if" or ["else" or]]          (inline if: body if condition else otherwise)
    or := and ("or" and)*
    and := not ("and" not)*
    not := "not" not | compare
    compare := additive (("==" | "!=" | "<" | ">" | "<=" | ">=") additive)*
    additive := term (("+" | "-") term)*
    term := unary (("*" | "/" | "%") unary)*
    unary := ("-" | "+") unary | postfix, then filters ("|" name ["(" args ")"])*
    postfix := primary ("." name | "(" args ")" | "[" expression "]")*
    primary := name | number | string | true | false | null | "(" expression ")"

    Filters bind tighter than every binary operator, and every binary operator tighter than the inline if, as in Nunjucks: x | sqlNumber if x else 12 is (x | sqlNumber) if x else 12. Of the postfix forms only Context.<Token>, loop.<member> and <name>.length are in the language. Constructs outside the grammar parse into Unsupported nodes with a diagnostic; parsing never throws.

    Index

    Methods

    • Parses Name = Expression, … from start to end, as in a composition's argument list. An empty range is an empty list. String values accept both a backslash escape ('It\'s') and the SQL doubled quote ('It''s').

      Parameters

      • source: string
      • start: number
      • end: number

      Returns ParsedArguments