Module: DefMastership::DMRegexp

Defined in:
lib/defmastership/constants.rb

Overview

set of regexp of added asciidoctor constructions This module smells of :reek:TooManyConstants

Constant Summary collapse

SINGLE_LINE_COMMENT =
%r{^//[^/]}.freeze
DEF_BEFORE_REF =
<<~'BEF'
  ^\s*
  \[\s*define\s*,
  \s*(?<type>[\w:_-]+)\s*,
  \s*
BEF
DEF_AFTER_REF =
<<~'AFT'
  \s*
  (,\s*\[\s*(?<labels>.*?)\s*\])?\s*\]
AFT
DEF_VERSION_AND_CHECKSUM =
'(?<version_and_checksum>' \
'\((?<explicit_version>[^~]+)?(?<explicit_checksum>~[[:alnum:]]+)?\)' \
')?'
DEFINITION =
Regexp.new(
  "#{DEF_BEFORE_REF}(?<reference>[\\w:_-]+)#{DEF_VERSION_AND_CHECKSUM}#{DEF_AFTER_REF}",
  Regexp::EXTENDED
)
VARIABLE_DEF =
/^\s*:(?<varname>[\w:_-]+):\s+
(?<value>\S.*\S)\s*$/x.freeze
VARIABLE_USE =
/{(?<varname>[\w:_-]+)}/x.freeze
EREF_CONFIG =
/^\s*:eref-(?<refname>[\w:_-]+)-(?<symb>prefix|url):\s*
\s*(?<value>\S.*\S)\s*/x.freeze
EREF_DEF =
/^\s*
defs:eref\[
\s*(?<refname>[\w:_-]+)\s*,
\s*\[\s*(?<extrefs>[^\]]+?)\s*\]\s*\]/x.freeze
BLOCK =
/^--\s*$/.freeze
IREF_DEF_BEF =
'defs:iref\[\s*'
IREF_DEF_AFT =
'\s*\]'
IREF_DEF =
Regexp.new(
  "#{IREF_DEF_BEF}(?<intref>[\\w:_-]+)#{IREF_DEF_AFT}",
  Regexp::EXTENDED
)
ATTR_CONFIG =
/\s*:attr-(?<attr>[\w:_-]+)-prefix:
\s+(?<prefix>.+?)\s*$/x.freeze
ATTR_SET =
/\s*
defs:attribute\[
\s*(?<attr>[\w:_-]+)\s*,
\s*(?<value>.+?)\s*\]/x.freeze
EMPTY_LINE =
/^\s*$/.freeze
WHATEVER =
//.freeze
INCLUDE_KEYWORD =
'\binclude::'
INCLUDE_PATH =
'(?<path>.*/)?'
INCLUDE_FILENAME =
'(?<filename>[^\\/]+)'
INCLUDE_OPTIONS =
'\[(?<options>[^\]]*)\]'
INCLUDE =
Regexp.new(
  INCLUDE_KEYWORD + INCLUDE_PATH + INCLUDE_FILENAME + INCLUDE_OPTIONS,
  Regexp::EXTENDED
)