Module: Regexp::Expression

Included in:
Parser
Defined in:
lib/regexp_parser/expression.rb,
lib/regexp_parser/expression/sequence.rb,
lib/regexp_parser/expression/quantifier.rb,
lib/regexp_parser/expression/classes/set.rb,
lib/regexp_parser/expression/classes/keep.rb,
lib/regexp_parser/expression/classes/root.rb,
lib/regexp_parser/expression/classes/type.rb,
lib/regexp_parser/expression/classes/group.rb,
lib/regexp_parser/expression/methods/tests.rb,
lib/regexp_parser/expression/subexpression.rb,
lib/regexp_parser/expression/classes/anchor.rb,
lib/regexp_parser/expression/classes/escape.rb,
lib/regexp_parser/expression/classes/backref.rb,
lib/regexp_parser/expression/classes/literal.rb,
lib/regexp_parser/expression/classes/property.rb,
lib/regexp_parser/expression/methods/traverse.rb,
lib/regexp_parser/expression/classes/free_space.rb,
lib/regexp_parser/expression/methods/strfregexp.rb,
lib/regexp_parser/expression/classes/alternation.rb,
lib/regexp_parser/expression/classes/conditional.rb

Defined Under Namespace

Modules: Anchor, Assertion, Backreference, CharacterType, Conditional, EscapeSequence, Group, Keep, UnicodeProperty Classes: Alternation, Alternative, Base, CharacterSet, CharacterSubSet, Comment, FreeSpace, Literal, Quantifier, Root, Sequence, Subexpression, WhiteSpace

Class Method Summary collapse

Class Method Details

.parsed(exp) ⇒ Object



155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/regexp_parser/expression.rb', line 155

def self.parsed(exp)
  case exp
  when String
    Regexp::Parser.parse(exp)
  when Regexp
    Regexp::Parser.parse(exp.source)
  when Regexp::Expression
    exp
  else
    raise "Expression.parsed accepts a String, Regexp, or " +
          "a Regexp::Expression as a value for exp, but it " +
          "was given #{exp.class.name}."
  end
end