Module: ShEx::Terminals

Included in:
Parser
Defined in:
lib/shex/terminals.rb

Constant Summary collapse

U_CHARS1 =

Unicode regular expressions for Ruby 1.9+ with the Oniguruma engine.

Regexp.compile(<<-EOS.gsub(/\s+/, ''))
  [\\u00C0-\\u00D6]|[\\u00D8-\\u00F6]|[\\u00F8-\\u02FF]|
  [\\u0370-\\u037D]|[\\u037F-\\u1FFF]|[\\u200C-\\u200D]|
  [\\u2070-\\u218F]|[\\u2C00-\\u2FEF]|[\\u3001-\\uD7FF]|
  [\\uF900-\\uFDCF]|[\\uFDF0-\\uFFFD]|[\\u{10000}-\\u{EFFFF}]
EOS
U_CHARS2 =
Regexp.compile("\\u00B7|[\\u0300-\\u036F]|[\\u203F-\\u2040]").freeze
IRI_RANGE =
Regexp.compile("[[^<>\"{}|^`\\\\]&&[^\\x00-\\x20]]").freeze
UCHAR4 =

87

/\\u([0-9A-Fa-f]{4,4})/.freeze
UCHAR8 =
/\\U([0-9A-Fa-f]{8,8})/.freeze
UCHAR =
Regexp.union(UCHAR4, UCHAR8).freeze
PERCENT =

171s

/%\h\h/.freeze
PN_LOCAL_ESC =

173s

/\\[_~\.\-\!$\&'\(\)\*\+,;=\/\?\#@%]/.freeze
PLX =

170s

/#{PERCENT}|#{PN_LOCAL_ESC}/.freeze.freeze
PN_CHARS_BASE =

164s

/[A-Za-z]|#{U_CHARS1}/.freeze
PN_CHARS_U =

165s

/_|#{PN_CHARS_BASE}/.freeze
PN_CHARS =

167s

/[\d-]|#{PN_CHARS_U}|#{U_CHARS2}/.freeze
PN_LOCAL_BODY =
/(?:(?:\.|:|#{PN_CHARS}|#{PLX})*(?:#{PN_CHARS}|:|#{PLX}))?/.freeze
PN_CHARS_BODY =
/(?:(?:\.|#{PN_CHARS})*#{PN_CHARS})?/.freeze
PN_PREFIX =

168s

/#{PN_CHARS_BASE}#{PN_CHARS_BODY}/.freeze
PN_LOCAL =

169s

/(?:[\d|]|#{PN_CHARS_U}|#{PLX})#{PN_LOCAL_BODY}/.freeze
EXPONENT =

155s

/[eE][+-]?\d+/
ECHAR =

160s

/\\[tbnrf\\"']/
WS =
%r((
  \s
| (?:\#[^\n\r]*)
| (?:/\*(?:(?:\*[^/])|[^*])*\*/)
)+)xmu.freeze
RDF_TYPE =

69

/a/.freeze
IRIREF =

18t

/<(?:#{IRI_RANGE}|#{UCHAR})*>/.freeze
PNAME_NS =

73

/#{PN_PREFIX}?:/.freeze
PNAME_LN =

74

/#{PNAME_NS}#{PN_LOCAL}/.freeze
ATPNAME_NS =

75

/@#{WS}*#{PN_PREFIX}?:/m.freeze
ATPNAME_LN =

76

/@#{WS}*#{PNAME_NS}#{PN_LOCAL}/m.freeze
BLANK_NODE_LABEL =

77

/_:(?:\d|#{PN_CHARS_U})(?:(?:#{PN_CHARS}|\.)*#{PN_CHARS})?/.freeze
LANGTAG =

78

/@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*/.freeze
INTEGER =

79

/[+-]?\d+/.freeze
DECIMAL =

80

/[+-]?(?:\d*\.\d+)/.freeze
DOUBLE =

81

/[+-]?(?:\d+\.\d*#{EXPONENT}|\.?\d+#{EXPONENT})/.freeze
STRING_LITERAL1 =

83

/'(?:[^\'\\\n\r]|#{ECHAR}|#{UCHAR})*'/.freeze
STRING_LITERAL2 =

84

/"(?:[^\"\\\n\r]|#{ECHAR}|#{UCHAR})*"/.freeze
STRING_LITERAL_LONG1 =

85

/'''(?:(?:'|'')?(?:[^'\\]|#{ECHAR}|#{UCHAR}))*'''/m.freeze
STRING_LITERAL_LONG2 =

86

/"""(?:(?:"|"")?(?:[^"\\]|#{ECHAR}|#{UCHAR}))*"""/m.freeze
LANG_STRING_LITERAL1 =

83l

/'(?:[^\'\\\n\r]|#{ECHAR}|#{UCHAR})*'#{LANGTAG}/.freeze
LANG_STRING_LITERAL2 =

84l

/"(?:[^\"\\\n\r]|#{ECHAR}|#{UCHAR})*"#{LANGTAG}/.freeze
LANG_STRING_LITERAL_LONG1 =

85l

/'''(?:(?:'|'')?(?:[^'\\]|#{ECHAR}|#{UCHAR}))*'''#{LANGTAG}/m.freeze
LANG_STRING_LITERAL_LONG2 =

86l

/"""(?:(?:"|"")?(?:[^"\\]|#{ECHAR}|#{UCHAR}))*"""#{LANGTAG}/m.freeze
REGEXP =

XX

%r(/(?:[^/\\\n\r]|\\[nrt\\|.?*+(){}$-\[\]^/]|#{UCHAR})+/[smix]*).freeze
CODE =

68

/\{(?:[^%\\]|\\[%\\]|#{UCHAR})*%#{WS}*\}/m.freeze
REPEAT_RANGE =

70

/\{\s*#{INTEGER}(?:,#{WS}*(?:#{INTEGER}|\*)?)?#{WS}*\}/.freeze