Class: Ruby::Rego::Builtins::Regex::GlobIntersection::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/rego/builtins/regex/glob_intersection.rb

Overview

A glob atom plus its flag. type ∈ :char/:dot/:set; flag ∈ :none/:plus/:star. rune is set for :char, runes for :set.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, rune, runes, flag) ⇒ Token

Returns a new instance of Token.



77
78
79
80
81
82
# File 'lib/ruby/rego/builtins/regex/glob_intersection.rb', line 77

def initialize(type, rune, runes, flag)
  @type = type
  @rune = rune
  @runes = runes
  @flag = flag
end

Instance Attribute Details

#flagObject

Returns the value of attribute flag.



75
76
77
# File 'lib/ruby/rego/builtins/regex/glob_intersection.rb', line 75

def flag
  @flag
end

#runeObject

Returns the value of attribute rune.



75
76
77
# File 'lib/ruby/rego/builtins/regex/glob_intersection.rb', line 75

def rune
  @rune
end

#runesObject

Returns the value of attribute runes.



75
76
77
# File 'lib/ruby/rego/builtins/regex/glob_intersection.rb', line 75

def runes
  @runes
end

#typeObject

Returns the value of attribute type.



75
76
77
# File 'lib/ruby/rego/builtins/regex/glob_intersection.rb', line 75

def type
  @type
end

Instance Method Details

#flagged?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/ruby/rego/builtins/regex/glob_intersection.rb', line 84

def flagged?
  flag != :none
end

#same_atom?(other) ⇒ Boolean

Same atom ignoring flag (used by Simplify).

Returns:

  • (Boolean)


89
90
91
# File 'lib/ruby/rego/builtins/regex/glob_intersection.rb', line 89

def same_atom?(other)
  type == other.type && rune == other.rune && runes == other.runes
end