Simplifies SPARQL-star parsing

Avoid to call IRI validation on nested triple patterns
pull/171/head
Tpt 3 years ago
parent 704f60e094
commit 6469310f76
  1. 19
      spargebra/src/parser.rs

@ -1859,13 +1859,13 @@ parser! {
//[119] //[119]
rule PrimaryExpression() -> Expression = rule PrimaryExpression() -> Expression =
BrackettedExpression() / BrackettedExpression() /
ExprEmbTP() /
iriOrFunction() / iriOrFunction() /
v:Var() { v.into() } / v:Var() { v.into() } /
l:RDFLiteral() { l.into() } / l:RDFLiteral() { l.into() } /
l:NumericLiteral() { l.into() } / l:NumericLiteral() { l.into() } /
l:BooleanLiteral() { l.into() } / l:BooleanLiteral() { l.into() } /
BuiltInCall() / BuiltInCall()
ExprEmbTP()
//[120] //[120]
rule BrackettedExpression() -> Expression = "(" _ e:Expression() _ ")" { e } rule BrackettedExpression() -> Expression = "(" _ e:Expression() _ ")" { e }
@ -2197,13 +2197,14 @@ parser! {
rule EmbTriple_p() -> NamedNode = i: iri() { i } / "a" { iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") } rule EmbTriple_p() -> NamedNode = i: iri() { i } / "a" { iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") }
//[176] //[176]
rule EmbSubjectOrObject() -> TermPattern = v:Var() { v.into() } / rule EmbSubjectOrObject() -> TermPattern =
t:EmbTP() { t.into() } /
v:Var() { v.into() } /
b:BlankNode() { b.into() } / b:BlankNode() { b.into() } /
i:iri() { i.into() } / i:iri() { i.into() } /
l:RDFLiteral() { l.into() } / l:RDFLiteral() { l.into() } /
l:NumericLiteral() { l.into() } / l:NumericLiteral() { l.into() } /
l:BooleanLiteral() { l.into() } / l:BooleanLiteral() { l.into() }
t:EmbTP() { t.into() }
//[177] //[177]
rule DataValueTerm() -> GroundTerm = i:iri() { i.into() } / rule DataValueTerm() -> GroundTerm = i:iri() { i.into() } /
@ -2214,9 +2215,9 @@ parser! {
//[178] //[178]
rule VarOrTermOrEmbTP() -> TermPattern = rule VarOrTermOrEmbTP() -> TermPattern =
t:EmbTP() { t.into() } /
v:Var() { v.into() } / v:Var() { v.into() } /
t:GraphTerm() { t.into() } / t:GraphTerm() { t.into() }
t:EmbTP() { t.into() }
//[179] //[179]
rule AnnotationPattern() -> FocusedTriplePattern<Vec<(NamedNodePattern,Vec<AnnotatedTerm>)>> = "{|" _ a:PropertyListNotEmpty() _ "|}" { a } rule AnnotationPattern() -> FocusedTriplePattern<Vec<(NamedNodePattern,Vec<AnnotatedTerm>)>> = "{|" _ a:PropertyListNotEmpty() _ "|}" { a }
@ -2231,12 +2232,12 @@ parser! {
//[182] //[182]
rule ExprVarOrTerm() -> Expression = rule ExprVarOrTerm() -> Expression =
ExprEmbTP() /
i:iri() { i.into() } / i:iri() { i.into() } /
l:RDFLiteral() { l.into() } / l:RDFLiteral() { l.into() } /
l:NumericLiteral() { l.into() } / l:NumericLiteral() { l.into() } /
l:BooleanLiteral() { l.into() } / l:BooleanLiteral() { l.into() } /
v:Var() { v.into() } / v:Var() { v.into() }
ExprEmbTP()
//space //space
rule _() = quiet! { ([' ' | '\t' | '\n' | '\r'] / comment())* } rule _() = quiet! { ([' ' | '\t' | '\n' | '\r'] / comment())* }

Loading…
Cancel
Save