[sword-devel] engine reference parsing

Troy A. Griffitts scribe at crosswire.org
Thu Nov 4 04:20:14 MST 2010


Dear Peter,

You should get no joy from using '.' as a list separator.  Currently the
engine parser uses ':' and '.' as separators between chapter and verse.

Scope should work well in your examples if you change your punctuation
to swap '.' for ',' and ',' for ':'.

http://crosswire.org/study/examples/parsevs.jsp?vs=Ps+35%3A1%3B90%3A2%3BJoh+1%3A1%3B&co=gen.1.1&lo=en


When we internationalize the separator characters, as discussed about 3
weeks ago on the '-' in bookname thread, then your syntax should work
fine.  Another issue DM pointed out we'll need to deal with is which
'mode' to use when parsing references.  No longer can we try to handle
any mode, as frequently used characters like ',.:' will mean different
things depending on which mode you are in.  I'm of the same mind that
new modules should use osisRef syntax which explicitly specifies the
list, range, and chap/verse divider character.  Then in the pros, the
module can have anything they want, e.g.,

<reference osisRef="Ps.35.1 Ps.90.2 John.1.1">Ps 35,1;90,2;Joh
1,1;</reference>

But currently we just throw anything at the parse and it will try to use
your currently locale AND the English locale to parse reference or
osisRef.  osisRef and German, for example, if we localize the '.' as the
list separator, will no longer live happily together.

Noted.  On my list to think about.  Thanks for the input.

Troy



On 11/04/2010 09:01 AM, Peter von Kaehne wrote:
> A recent thread referred to some necessary/useful enhancements.
> 
> Here are a couple of cases which get currently handled badly and would
> be really useful if handled correctly:
> 
> 1) lists of verses within the current scope
> 
> V. 6.9.11.14;V. 20.24.26;V. 29;
> 
> Trying to parse this with (in Perl)
> 
>> Sword::VerseKey::convertToOSIS($_, $scope)
> 
> results in only the last reference being recognised but all initial ones
> being ignored or are read as Rev.22.21 depending on what separation
> markers I use.
> 
> 2) several references from same book in row:
> 
> Ps 35,1;90,2;Joh 1,1;
> 
> The middle Psalm 90.2 is not recognised.
> 
> Peter
> 
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list