Class: Regexp::Expression::Sequence

Inherits:
Subexpression show all
Defined in:
lib/regexp_parser/expression/classes/alternation.rb

Overview

A sequence of expressions, used by alternations as one alternative. TODO: perhaps rename this to Alternative?

Instance Attribute Summary

Attributes inherited from Subexpression

#expressions

Attributes inherited from Base

#level, #options, #quantifier, #text, #token, #ts, #type

Instance Method Summary collapse

Methods inherited from Subexpression

#<<, #[], #clone, #each, #each_with_index, #first, #insert, #last, #length, #to_s

Methods inherited from Base

#case_insensitive?, #clone, #coded_offset, #free_spacing?, #full_length, #greedy?, #multiline?, #offset, #possessive?, #quantified?, #quantity, #reluctant?, #terminal?, #to_re, #to_s

Constructor Details

#initializeSequence

Returns a new instance of Sequence.



34
35
36
# File 'lib/regexp_parser/expression/classes/alternation.rb', line 34

def initialize
  super Regexp::Token.new(:expression, :sequence, '')
end

Instance Method Details

#quantify(token, text, min = nil, max = nil, mode = :greedy) ⇒ Object



42
43
44
# File 'lib/regexp_parser/expression/classes/alternation.rb', line 42

def quantify(token, text, min = nil, max = nil, mode = :greedy)
  last.quantify(token, text, min, max, mode)
end

#starts_atObject



38
39
40
# File 'lib/regexp_parser/expression/classes/alternation.rb', line 38

def starts_at
  @expressions.first.starts_at
end