openbibleinfo / Bible-Passage-Reference-Parser

Coffeescript to identify and understand Bible references like "John 3:16."
223 stars 65 forks source link

Mandatory variable usage not readily apparent #15

Open alerque opened 9 years ago

alerque commented 9 years ago

In trying to add Turkish language support I've run a cross a couple anomalies in the input data format that are tough to tease out what's happening.

  1. The usage of the $TO parameter is not apparent. Well it's plain enough in most languages, sadly for Turkish you can't stick a word between two values to make a range. So I fudged and commented out that line. Everything appeared to work, but no matching happened. No error was thrown during compiles, but all the tests failed and there was no indication why. I was able to make this work only by throwing a garbage value in this parameter even though it won't be much use in actually matching anything.

  2. The same goes for the $VERSE field. I accidentally made this $VERSES. Again no error that a required field was missing, but none of my strings would match anything.

My suggestion is that required parameters like these should throw an error during compile if missing.