Class: RLSM::RegExp::PrimExp
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #first ⇒ Object
- #follow ⇒ Object
-
#initialize(parent, str) ⇒ PrimExp
constructor
A new instance of PrimExp.
- #lambda? ⇒ Boolean
- #last ⇒ Object
- #null? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(parent, str) ⇒ PrimExp
Returns a new instance of PrimExp.
225 226 227 228 229 230 231 232 233 234 |
# File 'lib/rlsm_regexp.rb', line 225 def initialize(parent, str) @parent = parent if str == '&' or str == ['&'] @content = '&' @null = true else @content = str.reject { |c| c == '&' } @null = false end end |
Instance Method Details
#empty? ⇒ Boolean
266 267 268 |
# File 'lib/rlsm_regexp.rb', line 266 def empty? @content == '' or @content == [] end |
#first ⇒ Object
240 241 242 |
# File 'lib/rlsm_regexp.rb', line 240 def first @null ? [] : @content[0,1] end |
#follow ⇒ Object
248 249 250 251 252 253 254 255 256 |
# File 'lib/rlsm_regexp.rb', line 248 def follow res = [] (1...@content.length).each do |i| res << [@content[i-1,1], @content[i,1]] end res end |
#lambda? ⇒ Boolean
262 263 264 |
# File 'lib/rlsm_regexp.rb', line 262 def lambda? @null end |
#last ⇒ Object
244 245 246 |
# File 'lib/rlsm_regexp.rb', line 244 def last @null ? [] : @content[-1,1] end |
#null? ⇒ Boolean
236 237 238 |
# File 'lib/rlsm_regexp.rb', line 236 def null? @null end |
#to_s ⇒ Object
258 259 260 |
# File 'lib/rlsm_regexp.rb', line 258 def to_s @content.to_s end |