Module: Saxon::ItemType::LexicalStringConversion::Patterns

Defined in:
lib/saxon/item_type/lexical_string_conversion.rb

Overview

A collection of lexical space patterns for XDM types

Constant Summary collapse

DATE =
build(PatternFragments::DATE, PatternFragments::TIME_ZONE)
DATE_TIME =
build(PatternFragments::DATE, 'T', PatternFragments::TIME, PatternFragments::TIME_ZONE)
TIME =
build(PatternFragments::TIME, PatternFragments::TIME_ZONE)
DURATION =
build(/-?P(?!\z)(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?/, PatternFragments::TIME_DURATION)
DAY_TIME_DURATION =
build(/-?P(?!\z)(?:[0-9]+D)?/, PatternFragments::TIME_DURATION)
YEAR_MONTH_DURATION =
/\A-?P(?!\z)(?:[0-9]+Y)?(?:[0-9]+M)?\z/
G_DAY =
build(/---([0-9]{2})/, PatternFragments::TIME_ZONE)
G_MONTH =
build(/--([0-9]{2})/, PatternFragments::TIME_ZONE)
G_YEAR =
build(/(-?[0-9]{4,})/, PatternFragments::TIME_ZONE)
G_YEAR_MONTH =
build(/-?([0-9]{4,})-([0-9]{2})/, PatternFragments::TIME_ZONE)
G_MONTH_DAY =
build(/--([0-9]{2})-([0-9]{2})/, PatternFragments::TIME_ZONE)
INTEGER =
/\A[+-]?[0-9]+\z/
DECIMAL =
/\A[+-]?[0-9]+(?:\.[0-9]+)?\z/
FLOAT =
/\A(?:[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][0-9]+)?|-?INF|NaN)\z/
NCNAME =
build("(?:#{PatternFragments::NCNAME_START_CHAR})", "(?:#{PatternFragments::NCNAME_CHAR})*")
NAME =
build("(?:#{PatternFragments::NAME_START_CHAR})", "(?:#{PatternFragments::NAME_CHAR})*")
TOKEN =
/\A[^\u0020\u000A\u000D\u0009]+(?: [^\u0020\u000A\u000D\u0009]+)*\z/
NORMALIZED_STRING =
/\A[^\u000A\u000D\u0009]+\z/
NMTOKEN =
build("(?:#{PatternFragments::NAME_CHAR})+")
LANGUAGE =
/\A[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*\z/
BASE64_BINARY =
/\A(?:(?:[A-Za-z0-9+\/] ?){4})*(?:(?:[A-Za-z0-9+\/] ?){3}[A-Za-z0-9+\/]|(?:[A-Za-z0-9+\/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+\/] ?[AQgw] ?= ?=)?\z/

Class Method Summary collapse

Class Method Details

.build(*patterns) ⇒ Regexp

Construct a Regexp from an array of patterns

Parameters:

  • patterns (Array<String>)

Returns:

  • (Regexp)


257
258
259
# File 'lib/saxon/item_type/lexical_string_conversion.rb', line 257

def self.build(*patterns)
  Regexp.new((['\A'] + patterns.map(&:to_s) + ['\z']).join(''))
end