NUBIC / lunokhod

Parsing and compilation tools for Surveyor surveys
MIT License
0 stars 0 forks source link

Permit questions and answers to be freely interlaced in grids #7

Open hannahwhy opened 11 years ago

hannahwhy commented 11 years ago

Surveyor's grid syntax is unexpectedly rigid. You must write it like this:

grid "title" do
  a "Answer one"
  # ...
  a "Answer n"
  q "Question one"
  # ...
  q "Question n"
end

If you try to write something like this

grid "title" do
  q "Question one"
  # ...
  q "Question n"
  a "Answer one"
  # ...
  a "Answer n"
end

or this

grid "title" do
  q "Question one"
  a "Answer one"
  # ...
  q "Question n"
  a "Answer n"
end

you're going to get undefined (and useless) behavior, in both Surveyor and current Lunokhod master.

But you shouldn't; all three grid specifications above can trivially be made equivalent.

5 addresses Surveyor compatibility. This issue is about changing the language (and is therefore really about breaking Surveyor compatibility, but for a good cause).

hannahwhy commented 11 years ago

A little more formally:

A grid's contents should be represented as a list G consisting only of questions and answers; G can be split into two ordered lists Q and A respectively containing questions and answers. The split is done by partitioning G from left-to-right on whether or not the list element is a question.

Questions may have attached dependencies, and answers may have attached validations.