A clause is some text interspersed with placeholders
. _placeholders, which will get
their values when the clause is created.
Tags are specified with the following syntax:
[<name>: <source> { <field-path> <operator> <value> }]
The complete grammar can be found in grammar.pegjs
Here's a sample clause with placeholders:
The weather at
[city: city{name = "Bengaluru", country.name = "India"}] is
[temp: city{temperature > 0}]°[unit: temperatureUnit{unit != ""}]
- PegJS for parsing
- MobX, React and Styled-Components for the demo
View the demo