samvera-labs / ldpath

Ruby parser for the LDPath language
http://marmotta.apache.org/ldpath/language.html
Other
9 stars 5 forks source link

ascii tree parse error for complex ldpath #4

Closed elrayle closed 5 years ago

elrayle commented 5 years ago

Descriptive summary

A complex ldpath including a long path (separated by /) combined with a second long path using | results in an ascii tree parse error.

Expected behavior

"madsrdf:identifiesRWO/madsrdf:fieldOfActivity/rdfs:label | madsrdf:identifiesRWO/madsrdf:fieldOfActivity/madsrdf:authoritativeLabel :: xsd:string" 

The ldpath should be parsable and return results.

Actual behavior

Ldpath::Program.parse program_code raises ParseError, e.cause.ascii_tree

Supporting Spec

Gist with spec demonstrating the ascii tree parse error... https://gist.github.com/elrayle/7d747ee952efd3413903a9d21323206a

The spec tests...

elrayle commented 5 years ago

This is addressed by using parentheses for precedence. Changing ldpath under Expected behavior in the original report of this issue to use parentheses, it no longer gets a parse error.

Example:

"(madsrdf:identifiesRWO/madsrdf:fieldOfActivity/rdfs:label) | (madsrdf:identifiesRWO/madsrdf:fieldOfActivity/madsrdf:authoritativeLabel) :: xsd:string"