Skip to content

Instantly share code, notes, and snippets.

@jpadams
Created August 8, 2017 01:14
Show Gist options
  • Select an option

  • Save jpadams/7d19b4c7bf4f57d111f5435b066caa95 to your computer and use it in GitHub Desktop.

Select an option

Save jpadams/7d19b4c7bf4f57d111f5435b066caa95 to your computer and use it in GitHub Desktop.
<query> = <whitespace>? from <whitespace>?
expr-or = expr-and (<whitespace> or <whitespace> expr-or)*
condexpnull = field <whitespace>? (condisnull | condisnotnull)
condisnull = <"is null">
<dottedfield> = "facts" | "trusted" | "parameters"
<fieldlist> = (field | function) (<whitespace>? <","> <whitespace>? fieldlist)?
condexpression = condexpregexp | condexpregexparray | condexpinequality | condexpmatch | condexpin
<condin> = "in"
true = <"true">
<fieldpath> = <"."> (quotedfield | standardfield | matchfield) fieldpath?
<valueregexp> = string
<lbrace> = "{"
<where> = <lbrace> <whitespace>? expression? <whitespace>? (groupbyclause | (pagingclause <whitespace>?)*)? <whitespace>* <rbrace>
<expression> = expr-or
groupedliterallist = <lbracket> <whitespace>? literallist <whitespace>? <rbracket>
<whitespace> = #"\s+"
limit = <"limit"> <whitespace> integer
<stringwithoutdoublequotes> = #"(?:[^\"\\]|\\.)*"
<condexpin> = (field | groupedfieldlist) <whitespace>? condin <whitespace>? valuein
<valuein> = query | groupedliterallist
offset = <"offset"> <whitespace> integer
<lparens> = "("
<condmatch> = "="
<extractfields> = fieldlist
dqstring = <doublequote> stringwithoutdoublequotes <doublequote>
expr-and = expr-not (<whitespace> and <whitespace> expr-and)*
<expr-rest> = <lparens> <whitespace>? expression <whitespace>? <rparens> | condexpression | condexpnull | subquery
real = negative? digits "." digits exp?
<valuematch> = string | integer | real | boolean
<standardfield> = #"[^\s\.\"]+"
<or> = <"or">
<arglist> = (field | string) (<whitespace>? <","> <whitespace>? stringlist)?
<positive> = "+"
exp = (<"E" | "e">) (negative | positive)? digits
<negative> = "-"
<doublequote> = "\""
<digits> = #"[0-9]+"
not = <"!">
<lbracket> = "["
field = #"[a-zA-Z0-9_]+\??" | dottedfield fieldpath
<stringlist> = string (<whitespace>? <","> <whitespace>? stringlist)?
false = <"false">
groupedfieldlist = <lbracket> <whitespace>? fieldlist <whitespace>? <rbracket>
<condexpregexparray> = field <whitespace>? condregexparray <whitespace>? valueregexparray
<string> = dqstring | sqstring
<literallist> = literal (<whitespace>? <","> <whitespace>? literallist)?
<rbracket> = "]"
groupedregexplist = <lbracket> <whitespace>? regexplist <whitespace>? <rbracket>
function = functionname <whitespace>? groupedarglist
<rparens> = ")"
<condexpmatch> = field <whitespace>? condmatch <whitespace>? valuematch
orderby = <"order by"> <whitespace> orderparam orderparamlist?
<functionname> = "count" | "avg" | "sum" | "min" | "max" | "to_string"
<condexpinequality> = field <whitespace>? condinequality <whitespace>? valueordered
<condregexp> = "~"
expr-not = not <whitespace>? expr-not | expr-rest
<condregexparray> = "~>"
integer = negative? digits
groupby = <"group by"> <whitespace> fieldlist
from = entity (<whitespace>? extract)? <whitespace>? where
subquery = entity <whitespace>? where
<literal> = string | integer | real | boolean
extract = <lbracket> <whitespace>? extractfields? <whitespace>? <rbracket>
condisnotnull = <"is not null">
<and> = <"and">
<orderparamlist> = (<","> <whitespace>? orderparam)+
<rbrace> = "}"
<singlequote> = "'"
<regexplist> = string (<whitespace>? <","> <whitespace>? regexplist)?
<quotedfield> = #"\".*?\"(?=\.|\s)"
groupedarglist = <lparens> <whitespace>? arglist? <whitespace>? <rparens>
orderparam = !("asc" | "desc") field (<whitespace> direction)? <whitespace>?
<condexpregexp> = field <whitespace>? condregexp <whitespace>? valueregexp
<stringwithoutsinglequotes> = #"(?:[^'\\]|\\.)*"
<pagingclause> = limit | offset | orderby
<entity> = "facts" | "reports" | "catalogs" | "packages" | "package_inventory" | "resources" | "nodes" | "environments" | "factsets" | "fact_paths" | "fact_contents" | "inventory" | "edges" | "events"
boolean = true | false
<condinequality> = ">=" | "<=" | "<" | ">"
<valueordered> = integer | real | string
<groupbyclause> = groupby
<direction> = "asc" | "desc"
sqstring = <singlequote> stringwithoutsinglequotes <singlequote>
<valueregexparray> = groupedregexplist
<matchfield> = #"match\(.*?\)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment