Class: Puppet::Parser::Lexer::Token
- Defined in:
- lib/vendor/puppet/parser/lexer.rb
Instance Attribute Summary collapse
-
#accumulate ⇒ Object
Returns the value of attribute accumulate.
-
#incr_line ⇒ Object
Returns the value of attribute incr_line.
-
#name ⇒ Object
Returns the value of attribute name.
-
#regex ⇒ Object
Returns the value of attribute regex.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#skip_text ⇒ Object
Returns the value of attribute skip_text.
-
#string ⇒ Object
Returns the value of attribute string.
Instance Method Summary collapse
- #acceptable?(context = {}) ⇒ Boolean
-
#initialize(regex, name) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(regex, name) ⇒ Token
Returns a new instance of Token.
25 26 27 28 29 30 31 32 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 25 def initialize(regex, name) if regex.is_a?(String) @name, @string = name, regex @regex = Regexp.new(Regexp.escape(@string)) else @name, @regex = name, regex end end |
Instance Attribute Details
#accumulate ⇒ Object
Returns the value of attribute accumulate.
23 24 25 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 23 def accumulate @accumulate end |
#incr_line ⇒ Object
Returns the value of attribute incr_line.
23 24 25 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 23 def incr_line @incr_line end |
#name ⇒ Object
Returns the value of attribute name.
23 24 25 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 23 def name @name end |
#regex ⇒ Object
Returns the value of attribute regex.
23 24 25 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 23 def regex @regex end |
#skip ⇒ Object
Returns the value of attribute skip.
23 24 25 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 23 def skip @skip end |
#skip_text ⇒ Object
Returns the value of attribute skip_text.
23 24 25 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 23 def skip_text @skip_text end |
#string ⇒ Object
Returns the value of attribute string.
23 24 25 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 23 def string @string end |
Instance Method Details
#acceptable?(context = {}) ⇒ Boolean
49 50 51 52 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 49 def acceptable?(context={}) # By default tokens are aceeptable in any context true end |
#to_s ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/vendor/puppet/parser/lexer.rb', line 41 def to_s if self.string @string else @name.to_s end end |