lib/shex/terminals.rb in shex-0.6.3 vs lib/shex/terminals.rb in shex-0.6.4

- old
+ new

@@ -41,11 +41,15 @@ # 155s EXPONENT = /[eE][+-]?\d+/ # 160s ECHAR = /\\[tbnrf\\"']/ - WS = /(?:\s|(?:#[^\n\r]*))+/m.freeze + WS = %r(( + \s + | (?:\#[^\n\r]*) + | (?:/\*(?:(?:\*[^/])|[^*])*\*/) + )+)xmu.freeze # 69 RDF_TYPE = /a/.freeze # 18t IRIREF = /<(?:#{IRI_RANGE}|#{UCHAR})*>/.freeze @@ -90,32 +94,8 @@ # 68 CODE = /\{(?:[^%\\]|\\[%\\]|#{UCHAR})*%#{WS}*\}/m.freeze # 70 REPEAT_RANGE = /\{\s*#{INTEGER}(?:,#{WS}*(?:#{INTEGER}|\*)?)?#{WS}*\}/.freeze - - # String terminals, mixed case sensitivity - STR_EXPR = %r(true|false - |\^\^|\/\/ - |[\(\)\{\}\[\],\.;\=\-\~!\|\&\@\$\?\+\*\%\^a]| - (?i:OR|AND|NOT - |BASE|PREFIX - |IRI|BNODE|NONLITERAL - |MINLENGTH|MAXLENGTH|LENGTH - |MAXINCLUSIVE|MAXEXCLUSIVE - |MININCLUSIVE|MINEXCLUSIVE - |TOTALDIGITS|FRACTIONDIGITS - |START - |EXTERNAL|CLOSED|EXTRA|LITERAL - ) - )x.freeze - - # Map terminals to canonical form - STR_MAP = %w{OR AND NOT BASE PREFIX IRI BNODE NONLITERAL - MINLENGTH MAXLENGTH LENGTH MININCLUSIVE MAXINCLUSIVE MINEXCLUSIVE MAXEXCLUSIVE - TOTALDIGITS FRACTIONDIGITS START EXTERNAL CLOSED EXTRA LITERAL}. - inject({}) do |memo, t| - memo.merge(t.downcase => t) - end end end