Class: Language::Atom::Str
- Inherits:
-
Language::Atom
- Object
- Language::Atom
- Language::Atom::Str
- Defined in:
- lib/language/atom/str.rb
Instance Method Summary collapse
-
#initialize(string:) ⇒ Str
constructor
A new instance of Str.
- #parse(parser) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Language::Atom
#<<, #>>, #absent, #aka, #any, #ignore, #inspect, #maybe, #repeat, #str, #then, #|
Constructor Details
#initialize(string:) ⇒ Str
Returns a new instance of Str.
6 7 8 |
# File 'lib/language/atom/str.rb', line 6 def initialize(string:) @string = string end |
Instance Method Details
#parse(parser) ⇒ Object
10 11 12 13 14 |
# File 'lib/language/atom/str.rb', line 10 def parse(parser) raise Parser::Str::NotFound.new(parser, @string) unless parser.next?(@string) parser.consume(@string.size) end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/language/atom/str.rb', line 16 def to_s "str(#{@string.inspect})" end |