Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ConditionParser

A recursive decent parser for a SQL condition (WHERE or ON). This parser takes in a set of tokens, as generated by the ConditionLexer.parse method, and makes sure that the condition is valid. If the condition sentence does not match the condition grammer, an exception is raised. Otherwise, a ParseTree is created.

Hierarchy

  • ConditionParser

Index

Methods

Methods

parse

  • Parse the tokens return a ParseTree. The condition must follow the following grammar.

      <condition>                ::= "{" <comparison> | <null-comparison> | <in-comparison> | <logical-condition> "}"
      <comparison>               ::= <comparison-operator> ":" "{" <column> ":" <value> "}"
      <null-comparison>          ::= <null-comparison-operator> ":" "{" <column> ":" <nullable> "}"
      <in-comparison>            ::= <in-comparison-operator> ":" "{" <column> ":" "[" <value> {"," <value>} "]" "}"
      <logical-condition>        ::= <boolean-operator> ":" "[" <condition> {"," <condition>} "]"
      <comparison-operator>      ::= "$eq" | "$neq" | "$lt" | "$lte" | "$gt" | "$gte" | "$like" | "$notlike"
      <in-comparison-operator>   ::= "$in" | "$notIn"
      <null-comparison-operator> ::= "$is" | "$isnt"
      <boolean-operator>         ::= "$and" | "$or"
      <nullable>                 ::= null | <parameter>
      <value>                    ::= <parameter> | <column> | <number>
      <column>                   ::= <string>
      <parameter>                ::= :<string>
    

    Parameters

    Returns ParseTree

    • A parse tree. Each node in the tree has a token and children nodes.

Generated using TypeDoc