Skip to content

Commit

Permalink
LANGDIR => LANG_DIR.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Jul 23, 2023
1 parent 0dd3ed0 commit 4e2630b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
[SPARQL doc]: https://ruby-rdf.github.io/sparql
[RDF 1.0]: https://www.w3.org/TR/2004/REC-rdf-concepts-20040210/
[RDF 1.1]: https://www.w3.org/TR/rdf11-concepts/
[RDF 1.1]: https://www.w3.org/TR/rdf12-concepts/
[RDF 1.2]: https://www.w3.org/TR/rdf12-concepts/
[SPARQL 1.1]: https://www.w3.org/TR/sparql11-query/
[RDF.rb]: https://ruby-rdf.github.io/
[RDF::DO]: https://ruby-rdf.github.io/rdf-do
Expand Down
4 changes: 2 additions & 2 deletions etc/n-triples.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ triple ::= subject predicate object '.'
subject ::= IRIREF | BLANK_NODE_LABEL | quotedTriple
predicate ::= IRIREF
object ::= IRIREF | BLANK_NODE_LABEL | literal | quotedTriple
literal ::= STRING_LITERAL_QUOTE ('^^' IRIREF | LANGDIR )?
literal ::= STRING_LITERAL_QUOTE ('^^' IRIREF | LANG_DIR )?
quotedTriple ::= '<<' subject predicate object '>>'

@terminals

IRIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>'
BLANK_NODE_LABEL ::= '_:' ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?
LANGDIR ::= "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )* ('--' [a-zA-Z]+)?`
LANG_DIR ::= "@" [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )* ('--' [a-zA-Z]+)?`
STRING_LITERAL_QUOTE ::= '"' ( [^#x22#x5C#xA#xD] | ECHAR | UCHAR )* '"'
UCHAR ::= ( "\u" HEX HEX HEX HEX )
| ( "\U" HEX HEX HEX HEX HEX HEX HEX HEX )
Expand Down
8 changes: 4 additions & 4 deletions lib/rdf/ntriples/reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Reader < RDF::Reader

IRIREF = /<((?:#{IRI_RANGE}|#{UCHAR})*)>/.freeze
BLANK_NODE_LABEL = /_:((?:[0-9]|#{PN_CHARS_U})(?:(?:#{PN_CHARS}|\.)*#{PN_CHARS})?)/.freeze
LANGDIR = /@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*(?:--[a-zA-Z]+)?)/.freeze
LANG_DIR = /@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*(?:--[a-zA-Z]+)?)/.freeze
STRING_LITERAL_QUOTE = /"((?:[^\"\\\n\r]|#{ECHAR}|#{UCHAR})*)"/.freeze

ST_START = /^<</.freeze
Expand All @@ -78,7 +78,7 @@ class Reader < RDF::Reader
NODEID = /^#{BLANK_NODE_LABEL}/.freeze
URIREF = /^#{IRIREF}/.freeze
LITERAL_PLAIN = /^#{STRING_LITERAL_QUOTE}/.freeze
LITERAL_WITH_LANGUAGE = /^#{STRING_LITERAL_QUOTE}#{LANGDIR}/.freeze
LITERAL_WITH_LANGUAGE = /^#{STRING_LITERAL_QUOTE}#{LANG_DIR}/.freeze
LITERAL_WITH_DATATYPE = /^#{STRING_LITERAL_QUOTE}\^\^#{IRIREF}/.freeze
DATATYPE_URI = /^\^\^#{IRIREF}/.freeze
LITERAL = Regexp.union(LITERAL_WITH_LANGUAGE, LITERAL_WITH_DATATYPE, LITERAL_PLAIN).freeze
Expand All @@ -88,7 +88,7 @@ class Reader < RDF::Reader
END_OF_STATEMENT = /^\s*\.\s*(?:#.*)?$/.freeze

# LANGTAG is deprecated
LANGTAG = LANGDIR
LANGTAG = LANG_DIR

##
# Reconstructs an RDF value from its serialized N-Triples
Expand Down Expand Up @@ -294,7 +294,7 @@ def read_literal
if literal_str = match(LITERAL_PLAIN)
literal_str = self.class.unescape(literal_str)
literal = case
when lang_dir = match(LANGDIR)
when lang_dir = match(LANG_DIR)
language, direction = lang_dir.split('--')
RDF::Literal.new(literal_str, language: language, direction: direction)
when datatype = match(/^(\^\^)/) # FIXME
Expand Down

0 comments on commit 4e2630b

Please sign in to comment.