Skip to content

Commit

Permalink
Update n3.pest
Browse files Browse the repository at this point in the history
For the tbox rule `{?X :src_advisor ?Y} => {?X :advisor ?Y}.`
we currently get
```
Loading data ABox and TBox
thread 'main' panicked at 'Unable to read: Error { variant: ParsingError { positives: [WS], negatives: [] }, location: Pos(161), line_col: Pos((5, 9)), path: None, line: "{?X :src_advisor ?Y} => {?X :advisor ?Y}.␊", continued_line: None }', lib/src/n3_parser.rs:44:71
```
Underscores are allowed in local name part of a qname and this PR is a quick hack to adsress that.
  • Loading branch information
josd authored Jun 23, 2022
1 parent 7ba626f commit c3f7e7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/src/parsing/n3.pest
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ NewLine = { "\r" | "\n" }
Var = {"?"~ASCII_ALPHA+~ASCII_ALPHANUMERIC*}
Prefix = {"@prefix"~SPACE+~PrefixIdentifier~":"~SPACE+~"<"~Iri~">"~WS* ~"."~WS*}
PrefixIdentifier = {ASCII_ALPHANUMERIC*}
Prefixed = {PrefixIdentifier ~":"~ASCII_ALPHANUMERIC+}
LocalNameChar = {ASCII_ALPHANUMERIC | "_"}
Prefixed = {PrefixIdentifier ~":"~LocalNameChar+}
Term = {"<"~Iri~">" | Prefixed}
varOrTerm = { Term | Var}
Subject = { Term | Var}
Expand All @@ -85,4 +86,4 @@ TP = { WS*~Subject ~WS+~ Property ~WS+~ Object ~WS* ~"."? ~WS* }
Body = {"{"~TP+~"}"}
Head = {"{"~WS*~TP~WS*~"}"}
rule = { Body~WS*~"=>"~WS*~Head~WS*~"."? ~WS*}
document = {Prefix* ~ NewLine* ~rule+}
document = {Prefix* ~ NewLine* ~rule+}

0 comments on commit c3f7e7c

Please sign in to comment.