From 18bf38370190a6aa486da42fc971307859637544 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Fri, 19 Jan 2024 14:58:46 -0500 Subject: [PATCH] Remove tabs from BNF comments Minor cleanup on the BNF comments - get rid of tabs and align them --- lib/oxsdatatypes/src/duration.rs | 20 +-- lib/oxttl/src/lexer.rs | 43 +++-- lib/oxttl/src/n3.rs | 60 +++---- lib/oxttl/src/terse.rs | 68 ++++---- lib/oxttl/src/trig.rs | 8 +- lib/sparesults/src/csv.rs | 8 +- lib/sparql-smith/src/lib.rs | 290 +++++++++++++++---------------- 7 files changed, 248 insertions(+), 249 deletions(-) diff --git a/lib/oxsdatatypes/src/duration.rs b/lib/oxsdatatypes/src/duration.rs index efb92b62..863fcb38 100644 --- a/lib/oxsdatatypes/src/duration.rs +++ b/lib/oxsdatatypes/src/duration.rs @@ -713,16 +713,16 @@ impl PartialOrd for YearMonthDuration { } } -// [6] duYearFrag ::= unsignedNoDecimalPtNumeral 'Y' -// [7] duMonthFrag ::= unsignedNoDecimalPtNumeral 'M' -// [8] duDayFrag ::= unsignedNoDecimalPtNumeral 'D' -// [9] duHourFrag ::= unsignedNoDecimalPtNumeral 'H' -// [10] duMinuteFrag ::= unsignedNoDecimalPtNumeral 'M' -// [11] duSecondFrag ::= (unsignedNoDecimalPtNumeral | unsignedDecimalPtNumeral) 'S' -// [12] duYearMonthFrag ::= (duYearFrag duMonthFrag?) | duMonthFrag -// [13] duTimeFrag ::= 'T' ((duHourFrag duMinuteFrag? duSecondFrag?) | (duMinuteFrag duSecondFrag?) | duSecondFrag) -// [14] duDayTimeFrag ::= (duDayFrag duTimeFrag?) | duTimeFrag -// [15] durationLexicalRep ::= '-'? 'P' ((duYearMonthFrag duDayTimeFrag?) | duDayTimeFrag) +// [6] duYearFrag ::= unsignedNoDecimalPtNumeral 'Y' +// [7] duMonthFrag ::= unsignedNoDecimalPtNumeral 'M' +// [8] duDayFrag ::= unsignedNoDecimalPtNumeral 'D' +// [9] duHourFrag ::= unsignedNoDecimalPtNumeral 'H' +// [10] duMinuteFrag ::= unsignedNoDecimalPtNumeral 'M' +// [11] duSecondFrag ::= (unsignedNoDecimalPtNumeral | unsignedDecimalPtNumeral) 'S' +// [12] duYearMonthFrag ::= (duYearFrag duMonthFrag?) | duMonthFrag +// [13] duTimeFrag ::= 'T' ((duHourFrag duMinuteFrag? duSecondFrag?) | (duMinuteFrag duSecondFrag?) | duSecondFrag) +// [14] duDayTimeFrag ::= (duDayFrag duTimeFrag?) | duTimeFrag +// [15] durationLexicalRep ::= '-'? 'P' ((duYearMonthFrag duDayTimeFrag?) | duDayTimeFrag) struct DurationParts { year_month: Option, day_time: Option, diff --git a/lib/oxttl/src/lexer.rs b/lib/oxttl/src/lexer.rs index fd8341a2..d11bd2fe 100644 --- a/lib/oxttl/src/lexer.rs +++ b/lib/oxttl/src/lexer.rs @@ -179,7 +179,7 @@ impl N3Lexer { data: &[u8], options: &N3LexerOptions, ) -> Option<(usize, Result, TokenRecognizerError>)> { - // [18] IRIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>' /* #x00=NULL #01-#x1F=control codes #x20=space */ + // [18] IRIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>' /* #x00=NULL #01-#x1F=control codes #x20=space */ let mut string = Vec::new(); let mut i = 1; loop { @@ -238,10 +238,9 @@ impl N3Lexer { data: &'a [u8], is_ending: bool, ) -> Option<(usize, Result, TokenRecognizerError>)> { - // [139s] PNAME_NS ::= PN_PREFIX? ':' - // [140s] PNAME_LN ::= PNAME_NS PN_LOCAL - - // [167s] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)? + // [139s] PNAME_NS ::= PN_PREFIX? ':' + // [140s] PNAME_LN ::= PNAME_NS PN_LOCAL + // [167s] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)? let mut i = 0; loop { if let Some(r) = Self::recognize_unicode_char(&data[i..], i) { @@ -330,7 +329,7 @@ impl N3Lexer { data: &'a [u8], is_ending: bool, ) -> Option<(usize, Result, TokenRecognizerError>)> { - // [36] QUICK_VAR_NAME ::= "?" PN_LOCAL + // [36] QUICK_VAR_NAME ::= "?" PN_LOCAL let (consumed, result) = self.recognize_optional_pn_local(&data[1..], is_ending)?; Some(( consumed + 1, @@ -349,7 +348,7 @@ impl N3Lexer { data: &'a [u8], is_ending: bool, ) -> Option<(usize, Result<(Cow<'a, str>, bool), TokenRecognizerError>)> { - // [168s] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))? + // [168s] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))? let mut i = 0; let mut buffer = None; // Buffer if there are some escaped characters let mut position_that_is_already_in_buffer = 0; @@ -503,7 +502,7 @@ impl N3Lexer { fn recognize_blank_node_label( data: &[u8], ) -> Option<(usize, Result, TokenRecognizerError>)> { - // [141s] BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)? + // [141s] BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)? let mut i = 2; loop { match Self::recognize_unicode_char(&data[i..], i)? { @@ -548,7 +547,7 @@ impl N3Lexer { &self, data: &'a [u8], ) -> Option<(usize, Result, TokenRecognizerError>)> { - // [144s] LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* + // [144s] LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* let mut is_last_block_empty = true; for (i, c) in data[1..].iter().enumerate() { if c.is_ascii_alphabetic() { @@ -588,8 +587,8 @@ impl N3Lexer { data: &[u8], delimiter: u8, ) -> Option<(usize, Result, TokenRecognizerError>)> { - // [22] STRING_LITERAL_QUOTE ::= '"' ([^#x22#x5C#xA#xD] | ECHAR | UCHAR)* '"' /* #x22=" #x5C=\ #xA=new line #xD=carriage return */ - // [23] STRING_LITERAL_SINGLE_QUOTE ::= "'" ([^#x27#x5C#xA#xD] | ECHAR | UCHAR)* "'" /* #x27=' #x5C=\ #xA=new line #xD=carriage return */ + // [22] STRING_LITERAL_QUOTE ::= '"' ([^#x22#x5C#xA#xD] | ECHAR | UCHAR)* '"' /* #x22=" #x5C=\ #xA=new line #xD=carriage return */ + // [23] STRING_LITERAL_SINGLE_QUOTE ::= "'" ([^#x27#x5C#xA#xD] | ECHAR | UCHAR)* "'" /* #x27=' #x5C=\ #xA=new line #xD=carriage return */ let mut string = String::new(); let mut i = 1; loop { @@ -626,8 +625,8 @@ impl N3Lexer { data: &[u8], delimiter: u8, ) -> Option<(usize, Result, TokenRecognizerError>)> { - // [24] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? ([^'\] | ECHAR | UCHAR))* "'''" - // [25] STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? ([^"\] | ECHAR | UCHAR))* '"""' + // [24] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? ([^'\] | ECHAR | UCHAR))* "'''" + // [25] STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? ([^"\] | ECHAR | UCHAR))* '"""' let mut string = String::new(); let mut i = 3; loop { @@ -661,10 +660,10 @@ impl N3Lexer { } fn recognize_number(data: &[u8]) -> Option<(usize, Result, TokenRecognizerError>)> { - // [19] INTEGER ::= [+-]? [0-9]+ - // [20] DECIMAL ::= [+-]? [0-9]* '.' [0-9]+ - // [21] DOUBLE ::= [+-]? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT) - // [154s] EXPONENT ::= [eE] [+-]? [0-9]+ + // [19] INTEGER ::= [+-]? [0-9]+ + // [20] DECIMAL ::= [+-]? [0-9]* '.' [0-9]+ + // [21] DOUBLE ::= [+-]? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT) + // [154s] EXPONENT ::= [eE] [+-]? [0-9]+ let mut i = 0; let c = *data.first()?; if matches!(c, b'+' | b'-') { @@ -764,8 +763,8 @@ impl N3Lexer { position: usize, with_echar: bool, ) -> Option<(usize, Result)> { - // [26] UCHAR ::= '\u' HEX HEX HEX HEX | '\U' HEX HEX HEX HEX HEX HEX HEX HEX - // [159s] ECHAR ::= '\' [tbnrf"'\] + // [26] UCHAR ::= '\u' HEX HEX HEX HEX | '\U' HEX HEX HEX HEX HEX HEX HEX HEX + // [159s] ECHAR ::= '\' [tbnrf"'\] match *data.get(1)? { b'u' => match Self::recognize_hex_char(&data[2..], 4, 'u', position) { Ok(c) => Some((5, Ok(c?))), @@ -895,7 +894,7 @@ impl N3Lexer { ) } - // [157s] PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] + // [157s] PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] fn is_possible_pn_chars_base(c: char) -> bool { matches!(c, 'A'..='Z' @@ -914,12 +913,12 @@ impl N3Lexer { | '\u{10000}'..='\u{EFFFF}') } - // [158s] PN_CHARS_U ::= PN_CHARS_BASE | '_' | ':' + // [158s] PN_CHARS_U ::= PN_CHARS_BASE | '_' | ':' fn is_possible_pn_chars_u(c: char) -> bool { Self::is_possible_pn_chars_base(c) || c == '_' } - // [160s] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] + // [160s] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] fn is_possible_pn_chars(c: char) -> bool { Self::is_possible_pn_chars_u(c) || matches!(c, diff --git a/lib/oxttl/src/n3.rs b/lib/oxttl/src/n3.rs index 233edccc..8b70a01e 100644 --- a/lib/oxttl/src/n3.rs +++ b/lib/oxttl/src/n3.rs @@ -744,14 +744,14 @@ impl RuleRecognizer for N3Recognizer { ) -> Self { while let Some(rule) = self.stack.pop() { match rule { - // [1] n3Doc ::= ( ( n3Statement ".") | sparqlDirective) * - // [2] n3Statement ::= n3Directive | triples - // [3] n3Directive ::= prefixID | base - // [4] sparqlDirective ::= sparqlBase | sparqlPrefix - // [5] sparqlBase ::= BASE IRIREF - // [6] sparqlPrefix ::= PREFIX PNAME_NS IRIREF - // [7] prefixID ::= "@prefix" PNAME_NS IRIREF - // [8] base ::= "@base" IRIREF + // [1] n3Doc ::= ( ( n3Statement ".") | sparqlDirective) * + // [2] n3Statement ::= n3Directive | triples + // [3] n3Directive ::= prefixID | base + // [4] sparqlDirective ::= sparqlBase | sparqlPrefix + // [5] sparqlBase ::= BASE IRIREF + // [6] sparqlPrefix ::= PREFIX PNAME_NS IRIREF + // [7] prefixID ::= "@prefix" PNAME_NS IRIREF + // [8] base ::= "@base" IRIREF N3State::N3Doc => { self.stack.push(N3State::N3Doc); match token { @@ -818,7 +818,7 @@ impl RuleRecognizer for N3Recognizer { } _ => self.error(errors, "The PREFIX declaration should be followed by a prefix and its value as an IRI"), }, - // [9] triples ::= subject predicateObjectList? + // [9] triples ::= subject predicateObjectList? N3State::Triples => { self.stack.push(N3State::TriplesMiddle); self.stack.push(N3State::Path); @@ -830,7 +830,7 @@ impl RuleRecognizer for N3Recognizer { N3State::TriplesEnd => { self.terms.pop(); } - // [10] predicateObjectList ::= verb objectList ( ";" ( verb objectList) ? ) * + // [10] predicateObjectList ::= verb objectList ( ";" ( verb objectList) ? ) * N3State::PredicateObjectList => { self.stack.push(N3State::PredicateObjectListEnd); self.stack.push(N3State::ObjectsList); @@ -851,7 +851,7 @@ impl RuleRecognizer for N3Recognizer { self.stack.push(N3State::ObjectsList); self.stack.push(N3State::Verb); }, - // [11] objectList ::= object ( "," object) * + // [11] objectList ::= object ( "," object) * N3State::ObjectsList => { self.stack.push(N3State::ObjectsListEnd); self.stack.push(N3State::Path); @@ -877,8 +877,8 @@ impl RuleRecognizer for N3Recognizer { return self; } } - // [12] verb ::= predicate | "a" | ( "has" expression) | ( "is" expression "of") | "=" | "<=" | "=>" - // [14] predicate ::= expression | ( "<-" expression) + // [12] verb ::= predicate | "a" | ( "has" expression) | ( "is" expression "of") | "=" | "<=" | "=>" + // [14] predicate ::= expression | ( "<-" expression) N3State::Verb => match token { N3Token::PlainKeyword("a") => { self.predicates.push(Predicate::Regular(rdf::TYPE.into())); @@ -931,10 +931,10 @@ impl RuleRecognizer for N3Recognizer { self.error(errors, "The keyword 'is' should be followed by a predicate then by the keyword 'of'") } }, - // [13] subject ::= expression - // [15] object ::= expression - // [16] expression ::= path - // [17] path ::= pathItem ( ( "!" path) | ( "^" path) ) ? + // [13] subject ::= expression + // [15] object ::= expression + // [16] expression ::= path + // [17] path ::= pathItem ( ( "!" path) | ( "^" path) ) ? N3State::Path => { self.stack.push(N3State::PathFollowUp); self.stack.push(N3State::PathItem); @@ -960,18 +960,18 @@ impl RuleRecognizer for N3Recognizer { self.terms.push(current.into()); self.stack.push(N3State::PathFollowUp); } - // [18] pathItem ::= iri | blankNode | quickVar | collection | blankNodePropertyList | iriPropertyList | literal | formula - // [19] literal ::= rdfLiteral | numericLiteral | BOOLEAN_LITERAL - // [20] blankNodePropertyList ::= "[" predicateObjectList "]" - // [21] iriPropertyList ::= IPLSTART iri predicateObjectList "]" - // [22] collection ::= "(" object* ")" - // [23] formula ::= "{" formulaContent? "}" - // [25] numericLiteral ::= DOUBLE | DECIMAL | INTEGER - // [26] rdfLiteral ::= STRING ( LANGTAG | ( "^^" iri) ) ? - // [27] iri ::= IRIREF | prefixedName - // [28] prefixedName ::= PNAME_LN | PNAME_NS - // [29] blankNode ::= BLANK_NODE_LABEL | ANON - // [30] quickVar ::= QUICK_VAR_NAME + // [18] pathItem ::= iri | blankNode | quickVar | collection | blankNodePropertyList | iriPropertyList | literal | formula + // [19] literal ::= rdfLiteral | numericLiteral | BOOLEAN_LITERAL + // [20] blankNodePropertyList ::= "[" predicateObjectList "]" + // [21] iriPropertyList ::= IPLSTART iri predicateObjectList "]" + // [22] collection ::= "(" object* ")" + // [23] formula ::= "{" formulaContent? "}" + // [25] numericLiteral ::= DOUBLE | DECIMAL | INTEGER + // [26] rdfLiteral ::= STRING ( LANGTAG | ( "^^" iri) ) ? + // [27] iri ::= IRIREF | prefixedName + // [28] prefixedName ::= PNAME_LN | PNAME_NS + // [29] blankNode ::= BLANK_NODE_LABEL | ANON + // [30] quickVar ::= QUICK_VAR_NAME N3State::PathItem => { return match token { N3Token::IriRef(iri) => { @@ -1149,7 +1149,7 @@ impl RuleRecognizer for N3Recognizer { } } } - // [24] formulaContent ::= ( n3Statement ( "." formulaContent? ) ? ) | ( sparqlDirective formulaContent? ) + // [24] formulaContent ::= ( n3Statement ( "." formulaContent? ) ? ) | ( sparqlDirective formulaContent? ) N3State::FormulaContent => { match token { N3Token::Punctuation("}") => { diff --git a/lib/oxttl/src/terse.rs b/lib/oxttl/src/terse.rs index a8a72c1a..c233c735 100644 --- a/lib/oxttl/src/terse.rs +++ b/lib/oxttl/src/terse.rs @@ -57,13 +57,13 @@ impl RuleRecognizer for TriGRecognizer { ) -> Self { if let Some(rule) = self.stack.pop() { match rule { - // [1g] trigDoc ::= (directive | block)* - // [2g] block ::= triplesOrGraph | wrappedGraph | triples2 | "GRAPH" labelOrSubject wrappedGraph - // [3] directive ::= prefixID | base | sparqlPrefix | sparqlBase - // [4] prefixID ::= '@prefix' PNAME_NS IRIREF '.' - // [5] base ::= '@base' IRIREF '.' - // [5s] sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF - // [6s] sparqlBase ::= "BASE" IRIREF + // [1g] trigDoc ::= (directive | block)* + // [2g] block ::= triplesOrGraph | wrappedGraph | triples2 | "GRAPH" labelOrSubject wrappedGraph + // [3] directive ::= prefixID | base | sparqlPrefix | sparqlBase + // [4] prefixID ::= '@prefix' PNAME_NS IRIREF '.' + // [5] base ::= '@base' IRIREF '.' + // [5s] sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF + // [6s] sparqlBase ::= "BASE" IRIREF TriGState::TriGDoc => { self.cur_graph = GraphName::DefaultGraph; self.stack.push(TriGState::TriGDoc); @@ -142,8 +142,8 @@ impl RuleRecognizer for TriGRecognizer { } } _ => self.error(errors, "The PREFIX declaration should be followed by a prefix and its value as an IRI"), }, - // [3g] triplesOrGraph ::= labelOrSubject ( wrappedGraph | predicateObjectList '.' ) | quotedTriple predicateObjectList '.' - // [4g] triples2 ::= blankNodePropertyList predicateObjectList? '.' | collection predicateObjectList '.' + // [3g] triplesOrGraph ::= labelOrSubject ( wrappedGraph | predicateObjectList '.' ) | quotedTriple predicateObjectList '.' + // [4g] triples2 ::= blankNodePropertyList predicateObjectList? '.' | collection predicateObjectList '.' TriGState::TriplesOrGraph => match token { N3Token::IriRef(iri) => { self.stack.push(TriGState::WrappedGraphOrPredicateObjectList { @@ -267,8 +267,8 @@ impl RuleRecognizer for TriGRecognizer { self.recognize_next(token, context,results, errors) } } - // [5g] wrappedGraph ::= '{' triplesBlock? '}' - // [6g] triplesBlock ::= triples ('.' triplesBlock?)? + // [5g] wrappedGraph ::= '{' triplesBlock? '}' + // [6g] triplesBlock ::= triples ('.' triplesBlock?)? TriGState::WrappedGraph => if token == N3Token::Punctuation("{") { self.stack.push(TriGState::WrappedGraphPossibleEnd); self.stack.push(TriGState::Triples); @@ -293,8 +293,8 @@ impl RuleRecognizer for TriGRecognizer { } } } - // [6] triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList? - // [10] subject ::= iri | BlankNode | collection | quotedTriple + // [6] triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList? + // [10] subject ::= iri | BlankNode | collection | quotedTriple TriGState::Triples => match token { N3Token::Punctuation("}") => { self.recognize_next(token, context,results, errors) // Early end @@ -348,7 +348,7 @@ impl RuleRecognizer for TriGRecognizer { self.stack.push(TriGState::PredicateObjectList); self.recognize_next(token, context,results, errors) } - // [7g] labelOrSubject ::= iri | BlankNode + // [7g] labelOrSubject ::= iri | BlankNode TriGState::GraphName => match token { N3Token::IriRef(iri) => { self.cur_graph = NamedNode::new_unchecked(iri).into(); @@ -379,7 +379,7 @@ impl RuleRecognizer for TriGRecognizer { } else { self.error(errors, "Anonymous blank node with a property list are not allowed as graph name") } - // [7] predicateObjectList ::= verb objectList (';' (verb objectList)?)* + // [7] predicateObjectList ::= verb objectList (';' (verb objectList)?)* TriGState::PredicateObjectList => { self.stack.push(TriGState::PredicateObjectListEnd); self.stack.push(TriGState::ObjectsList); @@ -406,8 +406,8 @@ impl RuleRecognizer for TriGRecognizer { self.stack.push(TriGState::Verb); self.recognize_next(token, context,results, errors) }, - // [8] objectList ::= object annotation? ( ',' object annotation? )* - // [30t] annotation ::= '{|' predicateObjectList '|}' + // [8] objectList ::= object annotation? ( ',' object annotation? )* + // [30t] annotation ::= '{|' predicateObjectList '|}' TriGState::ObjectsList => { self.stack.push(TriGState::ObjectsListEnd); self.stack.push(TriGState::Object); @@ -457,8 +457,8 @@ impl RuleRecognizer for TriGRecognizer { } else { self.recognize_next(token, context,results, errors) }, - // [9] verb ::= predicate | 'a' - // [11] predicate ::= iri + // [9] verb ::= predicate | 'a' + // [11] predicate ::= iri TriGState::Verb => match token { N3Token::PlainKeyword("a") => { self.cur_predicate.push(rdf::TYPE.into()); @@ -479,18 +479,18 @@ impl RuleRecognizer for TriGRecognizer { self.error(errors, "TOKEN is not a valid predicate") } } - // [12] object ::= iri | BlankNode | collection | blankNodePropertyList | literal | quotedTriple - // [13] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral - // [14] blank ::= BlankNode | collection - // [15] blankNodePropertyList ::= '[' predicateObjectList ']' - // [16] collection ::= '(' object* ')' - // [17] NumericLiteral ::= INTEGER | DECIMAL | DOUBLE - // [128s] RDFLiteral ::= String (LANGTAG | '^^' iri)? - // [133s] BooleanLiteral ::= 'true' | 'false' - // [18] String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE - // [135s] iri ::= IRIREF | PrefixedName - // [136s] PrefixedName ::= PNAME_LN | PNAME_NS - // [137s] BlankNode ::= BLANK_NODE_LABEL | ANON + // [12] object ::= iri | BlankNode | collection | blankNodePropertyList | literal | quotedTriple + // [13] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral + // [14] blank ::= BlankNode | collection + // [15] blankNodePropertyList ::= '[' predicateObjectList ']' + // [16] collection ::= '(' object* ')' + // [17] NumericLiteral ::= INTEGER | DECIMAL | DOUBLE + // [128s] RDFLiteral ::= String (LANGTAG | '^^' iri)? + // [133s] BooleanLiteral ::= 'true' | 'false' + // [18] String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE + // [135s] iri ::= IRIREF | PrefixedName + // [136s] PrefixedName ::= PNAME_LN | PNAME_NS + // [137s] BlankNode ::= BLANK_NODE_LABEL | ANON TriGState::Object => match token { N3Token::IriRef(iri) => { self.cur_object.push(NamedNode::new_unchecked(iri).into()); @@ -661,7 +661,7 @@ impl RuleRecognizer for TriGRecognizer { } } } - // [27t] quotedTriple ::= '<<' qtSubject verb qtObject '>>' + // [27t] quotedTriple ::= '<<' qtSubject verb qtObject '>>' #[cfg(feature = "rdf-star")] TriGState::SubjectQuotedTripleEnd => { let triple = Triple::new( @@ -693,7 +693,7 @@ impl RuleRecognizer for TriGRecognizer { self.error(errors, "Expecting '>>' to close a quoted triple, found TOKEN") } } - // [28t] qtSubject ::= iri | BlankNode | quotedTriple + // [28t] qtSubject ::= iri | BlankNode | quotedTriple #[cfg(feature = "rdf-star")] TriGState::QuotedSubject => match token { N3Token::Punctuation("[") => { @@ -725,7 +725,7 @@ impl RuleRecognizer for TriGRecognizer { } _ => self.error(errors, "TOKEN is not a valid RDF quoted triple subject: TOKEN") } - // [29t] qtObject ::= iri | BlankNode | literal | quotedTriple + // [29t] qtObject ::= iri | BlankNode | literal | quotedTriple #[cfg(feature = "rdf-star")] TriGState::QuotedObject => match token { N3Token::Punctuation("[") => { diff --git a/lib/oxttl/src/trig.rs b/lib/oxttl/src/trig.rs index 77decffd..a27dd24d 100644 --- a/lib/oxttl/src/trig.rs +++ b/lib/oxttl/src/trig.rs @@ -940,7 +940,7 @@ fn is_turtle_boolean(value: &str) -> bool { } fn is_turtle_integer(value: &str) -> bool { - // [19] INTEGER ::= [+-]? [0-9]+ + // [19] INTEGER ::= [+-]? [0-9]+ let mut value = value.as_bytes(); if let Some(v) = value.strip_prefix(b"+") { value = v; @@ -951,7 +951,7 @@ fn is_turtle_integer(value: &str) -> bool { } fn is_turtle_decimal(value: &str) -> bool { - // [20] DECIMAL ::= [+-]? [0-9]* '.' [0-9]+ + // [20] DECIMAL ::= [+-]? [0-9]* '.' [0-9]+ let mut value = value.as_bytes(); if let Some(v) = value.strip_prefix(b"+") { value = v; @@ -968,8 +968,8 @@ fn is_turtle_decimal(value: &str) -> bool { } fn is_turtle_double(value: &str) -> bool { - // [21] DOUBLE ::= [+-]? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT) - // [154s] EXPONENT ::= [eE] [+-]? [0-9]+ + // [21] DOUBLE ::= [+-]? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT) + // [154s] EXPONENT ::= [eE] [+-]? [0-9]+ let mut value = value.as_bytes(); if let Some(v) = value.strip_prefix(b"+") { value = v; diff --git a/lib/sparesults/src/csv.rs b/lib/sparesults/src/csv.rs index 7cf6059e..bd2fe4b1 100644 --- a/lib/sparesults/src/csv.rs +++ b/lib/sparesults/src/csv.rs @@ -359,7 +359,7 @@ fn is_turtle_boolean(value: &str) -> bool { } fn is_turtle_integer(value: &str) -> bool { - // [19] INTEGER ::= [+-]? [0-9]+ + // [19] INTEGER ::= [+-]? [0-9]+ let mut value = value.as_bytes(); if let Some(v) = value.strip_prefix(b"+") { value = v; @@ -370,7 +370,7 @@ fn is_turtle_integer(value: &str) -> bool { } fn is_turtle_decimal(value: &str) -> bool { - // [20] DECIMAL ::= [+-]? [0-9]* '.' [0-9]+ + // [20] DECIMAL ::= [+-]? [0-9]* '.' [0-9]+ let mut value = value.as_bytes(); if let Some(v) = value.strip_prefix(b"+") { value = v; @@ -387,8 +387,8 @@ fn is_turtle_decimal(value: &str) -> bool { } fn is_turtle_double(value: &str) -> bool { - // [21] DOUBLE ::= [+-]? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT) - // [154s] EXPONENT ::= [eE] [+-]? [0-9]+ + // [21] DOUBLE ::= [+-]? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT) + // [154s] EXPONENT ::= [eE] [+-]? [0-9]+ let mut value = value.as_bytes(); if let Some(v) = value.strip_prefix(b"+") { value = v; diff --git a/lib/sparql-smith/src/lib.rs b/lib/sparql-smith/src/lib.rs index 3bc99c0b..a57fe006 100644 --- a/lib/sparql-smith/src/lib.rs +++ b/lib/sparql-smith/src/lib.rs @@ -35,8 +35,8 @@ pub struct Query { #[derive(Arbitrary)] struct QueryContent { - // [1] QueryUnit ::= Query - // [2] Query ::= Prologue ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) ValuesClause + // [1] QueryUnit ::= Query + // [2] Query ::= Prologue ( SelectQuery | ConstructQuery | DescribeQuery | AskQuery ) ValuesClause variant: QueryVariant, values_clause: ValuesClause, } @@ -82,7 +82,7 @@ impl fmt::Debug for Query { #[derive(Arbitrary)] struct SelectQuery { - // [7] SelectQuery ::= SelectClause DatasetClause* WhereClause SolutionModifier + // [7] SelectQuery ::= SelectClause DatasetClause* WhereClause SolutionModifier select_clause: SelectClause, where_clause: WhereClause, solution_modifier: SolutionModifier, @@ -100,7 +100,7 @@ impl fmt::Display for SelectQuery { #[derive(Arbitrary)] struct SubSelect { - // [8] SubSelect ::= SelectClause WhereClause SolutionModifier ValuesClause + // [8] SubSelect ::= SelectClause WhereClause SolutionModifier ValuesClause select_clause: SelectClause, where_clause: WhereClause, solution_modifier: SolutionModifier, @@ -119,7 +119,7 @@ impl fmt::Display for SubSelect { #[derive(Arbitrary)] struct SelectClause { - // [9] SelectClause ::= 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( ( Var | ( '(' Expression 'AS' Var ')' ) )+ | '*' ) + // [9] SelectClause ::= 'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( ( Var | ( '(' Expression 'AS' Var ')' ) )+ | '*' ) option: Option, values: SelectValues, } @@ -171,7 +171,7 @@ impl fmt::Display for SelectClause { #[derive(Arbitrary)] struct WhereClause { - // [17] WhereClause ::= 'WHERE'? GroupGraphPattern + // [17] WhereClause ::= 'WHERE'? GroupGraphPattern with_where: bool, group_graph_pattern: GroupGraphPattern, } @@ -187,7 +187,7 @@ impl fmt::Display for WhereClause { #[derive(Arbitrary)] struct SolutionModifier { - // [18] SolutionModifier ::= GroupClause? HavingClause? OrderClause? LimitOffsetClauses? + // [18] SolutionModifier ::= GroupClause? HavingClause? OrderClause? LimitOffsetClauses? group: Option, having: Option, #[cfg(feature = "order")] @@ -218,7 +218,7 @@ impl fmt::Display for SolutionModifier { #[derive(Arbitrary)] struct GroupClause { - // [19] GroupClause ::= 'GROUP' 'BY' GroupCondition+ + // [19] GroupClause ::= 'GROUP' 'BY' GroupCondition+ start: GroupCondition, others: Vec, } @@ -235,7 +235,7 @@ impl fmt::Display for GroupClause { #[derive(Arbitrary)] enum GroupCondition { - // [20] GroupCondition ::= BuiltInCall | FunctionCall | '(' Expression ( 'AS' Var )? ')' | Var + // [20] GroupCondition ::= BuiltInCall | FunctionCall | '(' Expression ( 'AS' Var )? ')' | Var BuiltInCall(BuiltInCall), // TODO FunctionCall(FunctionCall) Projection(Expression, Option), @@ -261,7 +261,7 @@ impl fmt::Display for GroupCondition { #[derive(Arbitrary)] struct HavingClause { - // [21] HavingClause ::= 'HAVING' HavingCondition+ + // [21] HavingClause ::= 'HAVING' HavingCondition+ start: HavingCondition, others: Vec, } @@ -276,13 +276,13 @@ impl fmt::Display for HavingClause { } } -// [22] HavingCondition ::= Constraint +// [22] HavingCondition ::= Constraint type HavingCondition = Constraint; #[cfg(feature = "order")] #[derive(Arbitrary)] struct OrderClause { - // [23] OrderClause ::= 'ORDER' 'BY' OrderCondition+ + // [23] OrderClause ::= 'ORDER' 'BY' OrderCondition+ start: OrderCondition, others: Vec, } @@ -301,7 +301,7 @@ impl fmt::Display for OrderClause { #[cfg(feature = "order")] #[derive(Arbitrary)] enum OrderCondition { - // [24] OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var ) + // [24] OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var ) BrackettedExpression { is_asc: bool, inner: BrackettedExpression, @@ -330,7 +330,7 @@ impl fmt::Display for OrderCondition { #[cfg(feature = "limit-offset")] #[derive(Arbitrary)] enum LimitOffsetClauses { - // [25] LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause? + // [25] LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause? LimitOffset(LimitClause, Option), OffsetLimit(OffsetClause, Option), } @@ -350,7 +350,7 @@ impl fmt::Display for LimitOffsetClauses { #[cfg(feature = "limit-offset")] #[derive(Arbitrary)] struct LimitClause { - // [26] LimitClause ::= 'LIMIT' INTEGER + // [26] LimitClause ::= 'LIMIT' INTEGER value: u8, } @@ -364,7 +364,7 @@ impl fmt::Display for LimitClause { #[cfg(feature = "limit-offset")] #[derive(Arbitrary)] struct OffsetClause { - // [27] OffsetClause ::= 'OFFSET' INTEGER + // [27] OffsetClause ::= 'OFFSET' INTEGER value: u8, } @@ -377,7 +377,7 @@ impl fmt::Display for OffsetClause { #[derive(Arbitrary)] struct ValuesClause { - // [28] ValuesClause ::= ( 'VALUES' DataBlock )? + // [28] ValuesClause ::= ( 'VALUES' DataBlock )? value: Option, } @@ -393,7 +393,7 @@ impl fmt::Display for ValuesClause { #[derive(Arbitrary)] enum GroupGraphPattern { - // [53] GroupGraphPattern ::= '{' ( SubSelect | GroupGraphPatternSub ) '}' + // [53] GroupGraphPattern ::= '{' ( SubSelect | GroupGraphPatternSub ) '}' GroupGraphPatternSub(GroupGraphPatternSub), SubSelect(Box), } @@ -411,7 +411,7 @@ impl fmt::Display for GroupGraphPattern { #[derive(Arbitrary)] struct GroupGraphPatternSub { - // [54] GroupGraphPatternSub ::= TriplesBlock? ( GraphPatternNotTriples '.'? TriplesBlock? )* + // [54] GroupGraphPatternSub ::= TriplesBlock? ( GraphPatternNotTriples '.'? TriplesBlock? )* start: Option, others: Vec, } @@ -443,7 +443,7 @@ impl fmt::Display for GroupGraphPatternSub { #[derive(Arbitrary)] struct TriplesBlock { - // [55] TriplesBlock ::= TriplesSameSubjectPath ( '.' TriplesBlock? )? + // [55] TriplesBlock ::= TriplesSameSubjectPath ( '.' TriplesBlock? )? start: TriplesSameSubjectPath, end: Option>>, } @@ -463,7 +463,7 @@ impl fmt::Display for TriplesBlock { #[derive(Arbitrary)] enum GraphPatternNotTriples { - // [56] GraphPatternNotTriples ::= GroupOrUnionGraphPattern | OptionalGraphPattern | MinusGraphPattern | GraphGraphPattern | ServiceGraphPattern | Filter | Bind | InlineData + // [56] GraphPatternNotTriples ::= GroupOrUnionGraphPattern | OptionalGraphPattern | MinusGraphPattern | GraphGraphPattern | ServiceGraphPattern | Filter | Bind | InlineData GroupOrUnion(GroupOrUnionGraphPattern), Optional(OptionalGraphPattern), Minus(MinusGraphPattern), @@ -493,7 +493,7 @@ impl fmt::Display for GraphPatternNotTriples { #[derive(Arbitrary)] struct OptionalGraphPattern { - // [57] OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern + // [57] OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern inner: GroupGraphPattern, } @@ -505,7 +505,7 @@ impl fmt::Display for OptionalGraphPattern { #[derive(Arbitrary)] struct LateralGraphPattern { - // [] LateralGraphPattern ::= 'LATERAL' GroupGraphPattern + // [] LateralGraphPattern ::= 'LATERAL' GroupGraphPattern inner: GroupGraphPattern, } @@ -517,7 +517,7 @@ impl fmt::Display for LateralGraphPattern { #[derive(Arbitrary)] struct GraphGraphPattern { - // [58] GraphGraphPattern ::= 'GRAPH' VarOrIri GroupGraphPattern + // [58] GraphGraphPattern ::= 'GRAPH' VarOrIri GroupGraphPattern graph: VarOrIri, inner: GroupGraphPattern, } @@ -530,7 +530,7 @@ impl fmt::Display for GraphGraphPattern { #[derive(Arbitrary)] struct Bind { - // [60] Bind ::= 'BIND' '(' Expression 'AS' Var ')' + // [60] Bind ::= 'BIND' '(' Expression 'AS' Var ')' expression: Expression, var: Var, } @@ -543,7 +543,7 @@ impl fmt::Display for Bind { #[derive(Arbitrary)] struct InlineData { - // [61] InlineData ::= 'VALUES' DataBlock + // [61] InlineData ::= 'VALUES' DataBlock inner: DataBlock, } @@ -555,7 +555,7 @@ impl fmt::Display for InlineData { #[derive(Arbitrary)] enum DataBlock { - // [62] DataBlock ::= InlineDataOneVar | InlineDataFull + // [62] DataBlock ::= InlineDataOneVar | InlineDataFull OneVar(InlineDataOneVar), Full(InlineDataFull), } @@ -571,7 +571,7 @@ impl fmt::Display for DataBlock { #[derive(Arbitrary)] struct InlineDataOneVar { - // [63] InlineDataOneVar ::= Var '{' DataBlockValue* '}' + // [63] InlineDataOneVar ::= Var '{' DataBlockValue* '}' var: Var, values: Vec, } @@ -587,7 +587,7 @@ impl fmt::Display for InlineDataOneVar { } struct InlineDataFull { - // [64] InlineDataFull ::= ( NIL | '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' | NIL )* '}' + // [64] InlineDataFull ::= ( NIL | '(' Var* ')' ) '{' ( '(' DataBlockValue* ')' | NIL )* '}' vars: Vec, values: Vec>, } @@ -635,7 +635,7 @@ impl fmt::Display for InlineDataFull { #[derive(Arbitrary)] enum DataBlockValue { - // [65] DataBlockValue ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | 'UNDEF' + // [65] DataBlockValue ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | 'UNDEF' Iri(Iri), Literal(Literal), Undef, @@ -653,7 +653,7 @@ impl fmt::Display for DataBlockValue { #[derive(Arbitrary)] struct MinusGraphPattern { - // [66] MinusGraphPattern ::= 'MINUS' GroupGraphPattern + // [66] MinusGraphPattern ::= 'MINUS' GroupGraphPattern inner: GroupGraphPattern, } @@ -665,7 +665,7 @@ impl fmt::Display for MinusGraphPattern { #[derive(Arbitrary)] struct GroupOrUnionGraphPattern { - // [67] GroupOrUnionGraphPattern ::= GroupGraphPattern ( 'UNION' GroupGraphPattern )* + // [67] GroupOrUnionGraphPattern ::= GroupGraphPattern ( 'UNION' GroupGraphPattern )* start: GroupGraphPattern, others: Vec, } @@ -682,7 +682,7 @@ impl fmt::Display for GroupOrUnionGraphPattern { #[derive(Arbitrary)] struct Filter { - // [68] Filter ::= 'FILTER' Constraint + // [68] Filter ::= 'FILTER' Constraint constraint: Constraint, } @@ -694,7 +694,7 @@ impl fmt::Display for Filter { #[derive(Arbitrary)] enum Constraint { - // [69] Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall + // [69] Constraint ::= BrackettedExpression | BuiltInCall | FunctionCall BrackettedExpression(BrackettedExpression), BuiltInCall(BuiltInCall), // TODO FunctionCall(FunctionCall), @@ -712,7 +712,7 @@ impl fmt::Display for Constraint { #[derive(Arbitrary)] struct FunctionCall { - // [70] FunctionCall ::= iri ArgList + // [70] FunctionCall ::= iri ArgList iri: Iri, args: ArgList, } @@ -725,7 +725,7 @@ impl fmt::Display for FunctionCall { #[derive(Arbitrary)] enum ArgList { - // [71] ArgList ::= NIL | '(' 'DISTINCT'? Expression ( ',' Expression )* ')' + // [71] ArgList ::= NIL | '(' 'DISTINCT'? Expression ( ',' Expression )* ')' Nil, NotNil { // TODO: DISTINCT @@ -749,7 +749,7 @@ impl fmt::Display for ArgList { #[derive(Arbitrary)] struct ExpressionList { - // [72] ExpressionList ::= NIL | '(' Expression ( ',' Expression )* ')' + // [72] ExpressionList ::= NIL | '(' Expression ( ',' Expression )* ')' inner: Vec, } @@ -768,7 +768,7 @@ impl fmt::Display for ExpressionList { #[derive(Arbitrary)] struct PropertyListNotEmpty { - // [77] PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )* + // [77] PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )* start_predicate: Verb, start_object: Box, others: Vec>, @@ -795,7 +795,7 @@ impl fmt::Display for PropertyListNotEmpty { #[derive(Arbitrary)] enum Verb { - // [78] Verb ::= VarOrIri | 'a' + // [78] Verb ::= VarOrIri | 'a' VarOrIri(VarOrIri), A, } @@ -811,7 +811,7 @@ impl fmt::Display for Verb { #[derive(Arbitrary)] struct ObjectList { - // [79] ObjectList ::= Object ( ',' Object )* + // [79] ObjectList ::= Object ( ',' Object )* start: Object, others: Vec, } @@ -827,12 +827,12 @@ impl fmt::Display for ObjectList { } } -// [80] Object ::= GraphNode +// [80] Object ::= GraphNode type Object = GraphNode; #[derive(Arbitrary)] enum TriplesSameSubjectPath { - // [81] TriplesSameSubjectPath ::= VarOrTerm PropertyListPathNotEmpty | TriplesNodePath PropertyListPath + // [81] TriplesSameSubjectPath ::= VarOrTerm PropertyListPathNotEmpty | TriplesNodePath PropertyListPath Atomic { subject: VarOrTerm, predicate_object: PropertyListPathNotEmpty, @@ -864,7 +864,7 @@ impl fmt::Display for TriplesSameSubjectPath { #[derive(Arbitrary)] struct PropertyListPath { - // [82] PropertyListPath ::= PropertyListPathNotEmpty? + // [82] PropertyListPath ::= PropertyListPathNotEmpty? inner: Option, } @@ -880,7 +880,7 @@ impl fmt::Display for PropertyListPath { #[derive(Arbitrary)] struct PropertyListPathNotEmpty { - // [83] PropertyListPathNotEmpty ::= ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectListPath )? )* + // [83] PropertyListPathNotEmpty ::= ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectListPath )? )* start_predicate: PropertyListPathNotEmptyVerb, start_object: Box, others: Vec>, @@ -919,15 +919,15 @@ impl fmt::Display for PropertyListPathNotEmpty { } } -// [84] VerbPath ::= Path +// [84] VerbPath ::= Path type VerbPath = Path; -// [85] VerbSimple ::= Var +// [85] VerbSimple ::= Var type VerbSimple = Var; #[derive(Arbitrary)] struct ObjectListPath { - // [86] ObjectListPath ::= ObjectPath ( ',' ObjectPath )* + // [86] ObjectListPath ::= ObjectPath ( ',' ObjectPath )* start: ObjectPath, others: Vec, } @@ -942,15 +942,15 @@ impl fmt::Display for ObjectListPath { } } -// [87] ObjectPath ::= GraphNodePath +// [87] ObjectPath ::= GraphNodePath type ObjectPath = GraphNodePath; -// [88] Path ::= PathAlternative +// [88] Path ::= PathAlternative type Path = PathAlternative; #[derive(Arbitrary)] struct PathAlternative { - // [89] PathAlternative ::= PathSequence ( '|' PathSequence )* + // [89] PathAlternative ::= PathSequence ( '|' PathSequence )* start: PathSequence, others: Vec, } @@ -967,7 +967,7 @@ impl fmt::Display for PathAlternative { #[derive(Arbitrary)] struct PathSequence { - // [90] PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* + // [90] PathSequence ::= PathEltOrInverse ( '/' PathEltOrInverse )* start: PathEltOrInverse, others: Vec, } @@ -984,7 +984,7 @@ impl fmt::Display for PathSequence { #[derive(Arbitrary)] struct PathElt { - // [91] PathElt ::= PathPrimary PathMod? + // [91] PathElt ::= PathPrimary PathMod? path: PathPrimary, mode: Option, } @@ -1001,7 +1001,7 @@ impl fmt::Display for PathElt { #[derive(Arbitrary)] enum PathEltOrInverse { - // [92] PathEltOrInverse ::= PathElt | '^' PathElt + // [92] PathEltOrInverse ::= PathElt | '^' PathElt PathElt(PathElt), Inverse(PathElt), } @@ -1017,7 +1017,7 @@ impl fmt::Display for PathEltOrInverse { #[derive(Arbitrary)] enum PathMod { - // [93] PathMod ::= '?' | '*' | '+' + // [93] PathMod ::= '?' | '*' | '+' ZeroOrOne, ZeroOrMore, OneOrMore, @@ -1035,7 +1035,7 @@ impl fmt::Display for PathMod { #[derive(Arbitrary)] enum PathPrimary { - // [94] PathPrimary ::= iri | 'a' | '!' PathNegatedPropertySet | '(' Path ')' + // [94] PathPrimary ::= iri | 'a' | '!' PathNegatedPropertySet | '(' Path ')' Iri(Iri), A, Negated(PathNegatedPropertySet), @@ -1055,7 +1055,7 @@ impl fmt::Display for PathPrimary { #[derive(Arbitrary)] enum PathNegatedPropertySet { - // [95] PathNegatedPropertySet ::= PathOneInPropertySet | '(' ( PathOneInPropertySet ( '|' PathOneInPropertySet )* )? ')' + // [95] PathNegatedPropertySet ::= PathOneInPropertySet | '(' ( PathOneInPropertySet ( '|' PathOneInPropertySet )* )? ')' Single(PathOneInPropertySet), Multiple { start: PathOneInPropertySet, @@ -1080,7 +1080,7 @@ impl fmt::Display for PathNegatedPropertySet { #[derive(Arbitrary)] enum PathOneInPropertySet { - // [96] PathOneInPropertySet ::= iri | 'a' | '^' ( iri | 'a' ) + // [96] PathOneInPropertySet ::= iri | 'a' | '^' ( iri | 'a' ) Iri(Iri), A, NegatedIri(Iri), @@ -1100,7 +1100,7 @@ impl fmt::Display for PathOneInPropertySet { #[derive(Arbitrary)] enum TriplesNode { - // [98] TriplesNode ::= Collection | BlankNodePropertyList + // [98] TriplesNode ::= Collection | BlankNodePropertyList Collection(Collection), BlankNodePropertyList(BlankNodePropertyList), } @@ -1116,7 +1116,7 @@ impl fmt::Display for TriplesNode { #[derive(Arbitrary)] struct BlankNodePropertyList { - // [99] BlankNodePropertyList ::= '[' PropertyListNotEmpty ']' + // [99] BlankNodePropertyList ::= '[' PropertyListNotEmpty ']' inner: PropertyListNotEmpty, } @@ -1128,7 +1128,7 @@ impl fmt::Display for BlankNodePropertyList { #[derive(Arbitrary)] enum TriplesNodePath { - // [100] TriplesNodePath ::= CollectionPath | BlankNodePropertyListPath + // [100] TriplesNodePath ::= CollectionPath | BlankNodePropertyListPath CollectionPath(CollectionPath), BlankNodePropertyListPath(BlankNodePropertyListPath), } @@ -1144,7 +1144,7 @@ impl fmt::Display for TriplesNodePath { #[derive(Arbitrary)] struct BlankNodePropertyListPath { - // [101] BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']' + // [101] BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']' inner: PropertyListPathNotEmpty, } @@ -1156,7 +1156,7 @@ impl fmt::Display for BlankNodePropertyListPath { #[derive(Arbitrary)] struct Collection { - // [102] Collection ::= '(' GraphNode+ ')' + // [102] Collection ::= '(' GraphNode+ ')' start: Box, others: Vec, } @@ -1173,7 +1173,7 @@ impl fmt::Display for Collection { #[derive(Arbitrary)] struct CollectionPath { - // [103] CollectionPath ::= '(' GraphNodePath+ ')' + // [103] CollectionPath ::= '(' GraphNodePath+ ')' start: Box, others: Vec, } @@ -1190,7 +1190,7 @@ impl fmt::Display for CollectionPath { #[derive(Arbitrary)] enum GraphNode { - // [104] GraphNode ::= VarOrTerm | TriplesNode + // [104] GraphNode ::= VarOrTerm | TriplesNode VarOrTerm(VarOrTerm), TriplesNode(TriplesNode), } @@ -1206,7 +1206,7 @@ impl fmt::Display for GraphNode { #[derive(Arbitrary)] enum GraphNodePath { - // [105] GraphNodePath ::= VarOrTerm | TriplesNodePath + // [105] GraphNodePath ::= VarOrTerm | TriplesNodePath VarOrTerm(VarOrTerm), TriplesNodePath(TriplesNodePath), } @@ -1222,7 +1222,7 @@ impl fmt::Display for GraphNodePath { #[derive(Arbitrary)] enum VarOrTerm { - // [106] VarOrTerm ::= Var | GraphTerm + // [106] VarOrTerm ::= Var | GraphTerm Var(Var), GraphTerm(GraphTerm), } @@ -1238,7 +1238,7 @@ impl fmt::Display for VarOrTerm { #[derive(Arbitrary)] enum VarOrIri { - // [107] VarOrIri ::= Var | iri + // [107] VarOrIri ::= Var | iri Var(Var), Iri(Iri), } @@ -1253,7 +1253,7 @@ impl fmt::Display for VarOrIri { } struct Var { - // [108] Var ::= VAR1 | VAR2 + // [108] Var ::= VAR1 | VAR2 value: u8, } @@ -1277,7 +1277,7 @@ impl fmt::Display for Var { #[derive(Arbitrary)] enum GraphTerm { - // [109] GraphTerm ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL + // [109] GraphTerm ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL Iri(Iri), Literal(Literal), Nil, @@ -1294,12 +1294,12 @@ impl fmt::Display for GraphTerm { } } -// [110] Expression ::= ConditionalOrExpression +// [110] Expression ::= ConditionalOrExpression type Expression = ConditionalOrExpression; #[derive(Arbitrary)] struct ConditionalOrExpression { - // [111] ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* + // [111] ConditionalOrExpression ::= ConditionalAndExpression ( '||' ConditionalAndExpression )* start: ConditionalAndExpression, others: Vec, } @@ -1316,7 +1316,7 @@ impl fmt::Display for ConditionalOrExpression { #[derive(Arbitrary)] struct ConditionalAndExpression { - // [112] ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* + // [112] ConditionalAndExpression ::= ValueLogical ( '&&' ValueLogical )* start: ValueLogical, others: Vec, } @@ -1331,12 +1331,12 @@ impl fmt::Display for ConditionalAndExpression { } } -// [113] ValueLogical ::= RelationalExpression +// [113] ValueLogical ::= RelationalExpression type ValueLogical = RelationalExpression; #[derive(Arbitrary)] enum RelationalExpression { - // [114] RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? + // [114] RelationalExpression ::= NumericExpression ( '=' NumericExpression | '!=' NumericExpression | '<' NumericExpression | '>' NumericExpression | '<=' NumericExpression | '>=' NumericExpression | 'IN' ExpressionList | 'NOT' 'IN' ExpressionList )? Base(NumericExpression), Equal(NumericExpression, NumericExpression), NotEqual(NumericExpression, NumericExpression), @@ -1364,12 +1364,12 @@ impl fmt::Display for RelationalExpression { } } -// [115] NumericExpression ::= AdditiveExpression +// [115] NumericExpression ::= AdditiveExpression type NumericExpression = AdditiveExpression; #[derive(Arbitrary)] enum AdditiveExpression { - // [116] AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* + // [116] AdditiveExpression ::= MultiplicativeExpression ( '+' MultiplicativeExpression | '-' MultiplicativeExpression | ( NumericLiteralPositive | NumericLiteralNegative ) ( ( '*' UnaryExpression ) | ( '/' UnaryExpression ) )* )* Base(MultiplicativeExpression), Plus(MultiplicativeExpression, MultiplicativeExpression), Minus(MultiplicativeExpression, MultiplicativeExpression), // TODO: Prefix + and - @@ -1387,7 +1387,7 @@ impl fmt::Display for AdditiveExpression { #[derive(Arbitrary)] enum MultiplicativeExpression { - // [117] MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* + // [117] MultiplicativeExpression ::= UnaryExpression ( '*' UnaryExpression | '/' UnaryExpression )* Base(UnaryExpression), Mul(UnaryExpression, UnaryExpression), Div(UnaryExpression, UnaryExpression), @@ -1405,7 +1405,7 @@ impl fmt::Display for MultiplicativeExpression { #[derive(Arbitrary)] enum UnaryExpression { - // [118] UnaryExpression ::= '!' PrimaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression + // [118] UnaryExpression ::= '!' PrimaryExpression | '+' PrimaryExpression | '-' PrimaryExpression | PrimaryExpression Not(PrimaryExpression), Plus(PrimaryExpression), Minus(PrimaryExpression), @@ -1425,7 +1425,7 @@ impl fmt::Display for UnaryExpression { #[derive(Arbitrary)] enum PrimaryExpression { - // [119] PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var + // [119] PrimaryExpression ::= BrackettedExpression | BuiltInCall | iriOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var Bracketted(BrackettedExpression), BuiltInCall(BuiltInCall), IriOrFunction(IriOrFunction), @@ -1447,7 +1447,7 @@ impl fmt::Display for PrimaryExpression { #[derive(Arbitrary)] struct BrackettedExpression { - // [120] BrackettedExpression ::= '(' Expression ')' + // [120] BrackettedExpression ::= '(' Expression ')' inner: Box, } @@ -1459,61 +1459,61 @@ impl fmt::Display for BrackettedExpression { #[derive(Arbitrary)] enum BuiltInCall { - // [121] BuiltInCall ::= Aggregate - // | 'STR' '(' Expression ')' - // | 'LANG' '(' Expression ')' - // | 'LANGMATCHES' '(' Expression ',' Expression ')' - // | 'DATATYPE' '(' Expression ')' - // | 'BOUND' '(' Var ')' - // | 'IRI' '(' Expression ')' - // | 'URI' '(' Expression ')' - // | 'BNODE' ( '(' Expression ')' | NIL ) - // | 'RAND' NIL - // | 'ABS' '(' Expression ')' - // | 'CEIL' '(' Expression ')' - // | 'FLOOR' '(' Expression ')' - // | 'ROUND' '(' Expression ')' - // | 'CONCAT' ExpressionList - // | SubstringExpression - // | 'STRLEN' '(' Expression ')' - // | StrReplaceExpression - // | 'UCASE' '(' Expression ')' - // | 'LCASE' '(' Expression ')' - // | 'ENCODE_FOR_URI' '(' Expression ')' - // | 'CONTAINS' '(' Expression ',' Expression ')' - // | 'STRSTARTS' '(' Expression ',' Expression ')' - // | 'STRENDS' '(' Expression ',' Expression ')' - // | 'STRBEFORE' '(' Expression ',' Expression ')' - // | 'STRAFTER' '(' Expression ',' Expression ')' - // | 'YEAR' '(' Expression ')' - // | 'MONTH' '(' Expression ')' - // | 'DAY' '(' Expression ')' - // | 'HOURS' '(' Expression ')' - // | 'MINUTES' '(' Expression ')' - // | 'SECONDS' '(' Expression ')' - // | 'TIMEZONE' '(' Expression ')' - // | 'TZ' '(' Expression ')' - // | 'NOW' NIL - // | 'UUID' NIL - // | 'STRUUID' NIL - // | 'MD5' '(' Expression ')' - // | 'SHA1' '(' Expression ')' - // | 'SHA256' '(' Expression ')' - // | 'SHA384' '(' Expression ')' - // | 'SHA512' '(' Expression ')' - // | 'COALESCE' ExpressionList - // | 'IF' '(' Expression ',' Expression ',' Expression ')' - // | 'STRLANG' '(' Expression ',' Expression ')' - // | 'STRDT' '(' Expression ',' Expression ')' - // | 'sameTerm' '(' Expression ',' Expression ')' - // | 'isIRI' '(' Expression ')' - // | 'isURI' '(' Expression ')' - // | 'isBLANK' '(' Expression ')' - // | 'isLITERAL' '(' Expression ')' - // | 'isNUMERIC' '(' Expression ')' - // | RegexExpression - // | ExistsFunc - // | NotExistsFunc + // [121] BuiltInCall ::= Aggregate + // | 'STR' '(' Expression ')' + // | 'LANG' '(' Expression ')' + // | 'LANGMATCHES' '(' Expression ',' Expression ')' + // | 'DATATYPE' '(' Expression ')' + // | 'BOUND' '(' Var ')' + // | 'IRI' '(' Expression ')' + // | 'URI' '(' Expression ')' + // | 'BNODE' ( '(' Expression ')' | NIL ) + // | 'RAND' NIL + // | 'ABS' '(' Expression ')' + // | 'CEIL' '(' Expression ')' + // | 'FLOOR' '(' Expression ')' + // | 'ROUND' '(' Expression ')' + // | 'CONCAT' ExpressionList + // | SubstringExpression + // | 'STRLEN' '(' Expression ')' + // | StrReplaceExpression + // | 'UCASE' '(' Expression ')' + // | 'LCASE' '(' Expression ')' + // | 'ENCODE_FOR_URI' '(' Expression ')' + // | 'CONTAINS' '(' Expression ',' Expression ')' + // | 'STRSTARTS' '(' Expression ',' Expression ')' + // | 'STRENDS' '(' Expression ',' Expression ')' + // | 'STRBEFORE' '(' Expression ',' Expression ')' + // | 'STRAFTER' '(' Expression ',' Expression ')' + // | 'YEAR' '(' Expression ')' + // | 'MONTH' '(' Expression ')' + // | 'DAY' '(' Expression ')' + // | 'HOURS' '(' Expression ')' + // | 'MINUTES' '(' Expression ')' + // | 'SECONDS' '(' Expression ')' + // | 'TIMEZONE' '(' Expression ')' + // | 'TZ' '(' Expression ')' + // | 'NOW' NIL + // | 'UUID' NIL + // | 'STRUUID' NIL + // | 'MD5' '(' Expression ')' + // | 'SHA1' '(' Expression ')' + // | 'SHA256' '(' Expression ')' + // | 'SHA384' '(' Expression ')' + // | 'SHA512' '(' Expression ')' + // | 'COALESCE' ExpressionList + // | 'IF' '(' Expression ',' Expression ',' Expression ')' + // | 'STRLANG' '(' Expression ',' Expression ')' + // | 'STRDT' '(' Expression ',' Expression ')' + // | 'sameTerm' '(' Expression ',' Expression ')' + // | 'isIRI' '(' Expression ')' + // | 'isURI' '(' Expression ')' + // | 'isBLANK' '(' Expression ')' + // | 'isLITERAL' '(' Expression ')' + // | 'isNUMERIC' '(' Expression ')' + // | RegexExpression + // | ExistsFunc + // | NotExistsFunc Str(Box), Lang(Box), Datatype(Box), @@ -1559,7 +1559,7 @@ impl fmt::Display for BuiltInCall { #[derive(Arbitrary)] struct ExistsFunc { - // [125] ExistsFunc ::= 'EXISTS' GroupGraphPattern + // [125] ExistsFunc ::= 'EXISTS' GroupGraphPattern pattern: GroupGraphPattern, } @@ -1571,7 +1571,7 @@ impl fmt::Display for ExistsFunc { #[derive(Arbitrary)] struct NotExistsFunc { - // [126] NotExistsFunc ::= 'NOT' 'EXISTS' GroupGraphPattern + // [126] NotExistsFunc ::= 'NOT' 'EXISTS' GroupGraphPattern pattern: GroupGraphPattern, } @@ -1583,7 +1583,7 @@ impl fmt::Display for NotExistsFunc { #[derive(Arbitrary)] struct IriOrFunction { - // [128] iriOrFunction ::= iri ArgList? + // [128] iriOrFunction ::= iri ArgList? iri: Iri, // TODO args: Option, } @@ -1599,12 +1599,12 @@ impl fmt::Display for IriOrFunction { } struct Literal { - // [129] RDFLiteral ::= String ( LANGTAG | ( '^^' iri ) )? - // [130] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative - // [131] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE - // [132] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE - // [133] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE - // [134] BooleanLiteral ::= 'true' | 'false' + // [129] RDFLiteral ::= String ( LANGTAG | ( '^^' iri ) )? + // [130] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative + // [131] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE + // [132] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE + // [133] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE + // [134] BooleanLiteral ::= 'true' | 'false' value: &'static str, } @@ -1627,7 +1627,7 @@ impl fmt::Display for Literal { } struct Iri { - // [136] iri ::= IRIREF | PrefixedName + // [136] iri ::= IRIREF | PrefixedName value: u8, }