Module: Arrow::Template::Parser::Patterns

Included in:
Arrow::Template::ExportDirective, Arrow::Template::ForDirective, Arrow::Template::ImportDirective, Arrow::Template::IncludeDirective, , State, Arrow::Template::RenderDirective, Arrow::Template::SelectListDirective, Arrow::Template::YieldDirective
Defined in:
lib/arrow/template/parser.rb

Overview

Regexp constants for parsing

Constant Summary

TAGOPEN =

The Regexp that is used to match directive tag openings. Must be at least 2 characters wide.

%r{([<|\[])\?}
TAGMIDDLE =

The Hash that maps tag-closings to tag-middle patterns.

Hash.new {
TAGCLOSE =

The Hash that maps tag openings to matching tag closings with flipped braces.

Hash.new {
CAPTURE =

Paren-group map

Hash.new {
ALTERNATION =
Hash.new {
DOT =

Constant patterns for parsing

/\./
COMMA =
/,/
WHITESPACE =
/\s*/
EQUALS =
/=/
INFIX =
/\.|::|(?>\[)/
IDENTIFIER =
/[a-z]\w*/i
LBRACKET =
/[\[(]/
RBRACKET =
Hash.new {
NUMBER =
/[-+]?\d+(?:\.\d+)?(?:e-?\d+)?/
TICKQSTRING =

> “\“and \“bar\” and baz\” and some \“other stuff\”“

/'((?:[^']|\\')*)'/
DBLQSTRING =
/"((?:[^"]|\\")*)"/
SLASHQSTRING =
%r{/((?:[^/]|\\/)*)/}
QUOTEDSTRING =
ALTERNATION[[ TICKQSTRING, DBLQSTRING, SLASHQSTRING ]]
SYMBOL =
/:[@$]?[a-z]\w+/ | /:/ +
ALTERNATION[[ DBLQSTRING, TICKQSTRING ]]
VARIABLE =
/(?:\$|@@?)?_?/ + IDENTIFIER
REGEXP =
%r{/((?:[^/]|\\.)+)/}
REBINDOP =
/\s*(?:=~|matches)(?=\s)/
PATHNAME =
%r{((?:[-\w.,:+@#$\%\(\)/]|\\ |\?(?!>))+)}
ARGUMENT =
/[*&]?/ + IDENTIFIER
ARGDEFAULT =
EQUALS + WHITESPACE +
ALTERNATION[[ IDENTIFIER, NUMBER, QUOTEDSTRING, SYMBOL, VARIABLE ]]