breck7 / scroll

Scroll is a language for scientists of all ages. Scroll includes a command line app that builds static blogs, websites, CSVs, text files, and more.
https://scroll.pub
Other
445 stars 18 forks source link

Adding conditional logic to forms #134

Open breck7 opened 2 months ago

breck7 commented 2 months ago

Branching can be done when defining your parsers. Should be a 1 liner. Perhaps we'll use the term "requiredIf" or "inScopeIf". Approach is collect a lot of data on forms in the wild and find the smallest change we can make to support most/all of them.

nameParser
 extends abstractIdParser
 description What is your name?

specialtyCell
 enum Frontend Backend

specialtyParser
 extends abstractEnumMeasureParser
 cells commandWord specialtyCell
 description What is your specialty?

frontendParser
 extends abstractUrlMeasureParser
 description What is your favorite JS frontend?
 requiredIf specialty = Frontend