pub enum Rule {
Show 18 variants
EOI,
WHITESPACE,
line_comment,
file,
command,
definition,
properties,
property,
query_get,
query_count,
where_clause,
condition,
operator,
ident,
value,
string_literal,
number,
number_with_unit,
}Variants§
EOI
End-of-input
WHITESPACE
Ignores whitespace, tabs, and newlines
line_comment
Ignores single-line comments (from // to the end of the line)
file
A file is the start of input (SOI), followed by zero or more commands, and ending with the end of input (EOI).
command
A command is either a definition (DEFINE) or a query (GET).
definition
Defines a new bike. Example: DEFINE bike “Honda CBR” { year: 2021 }
properties
A list of one or more properties, separated by commas.
property
A single property in the format ‘key: value’. Example: year: 2021
query_get
Query ‘GET BIKES’, which can have additional clause ‘WHERE’.
query_count
Query ‘COUNT BIKES’, which can have additional clause ‘WHERE’.
where_clause
additional clause’WHERE’, which contains one condition.
condition
A filter condition ‘key
operator
A comparison operator.
ident
An identifier (field name or type). Starts with a letter or ‘’, followed by letters, digits, or ‘’.
value
A value, which can be a number with a unit (cc), just a number, a quoted string, or an identifier (e.g., ‘sport’).
string_literal
A text string in double quotes. Example: “Honda CBR600RR”
number
An integer. Example: 2021
number_with_unit
A number with the ‘cc’ suffix . Example: 599cc