Class: Claret::Parsing::Parens
- Inherits:
-
Object
- Object
- Claret::Parsing::Parens
- Defined in:
- lib/claret/parsing/parens.rb
Instance Attribute Summary collapse
-
#scanner ⇒ Object
readonly
Returns the value of attribute scanner.
Instance Method Summary collapse
-
#initialize(scanner) ⇒ Parens
constructor
A new instance of Parens.
- #parse ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize(scanner) ⇒ Parens
Returns a new instance of Parens.
4 5 6 |
# File 'lib/claret/parsing/parens.rb', line 4 def initialize(scanner) @scanner = scanner end |
Instance Attribute Details
#scanner ⇒ Object (readonly)
Returns the value of attribute scanner.
8 9 10 |
# File 'lib/claret/parsing/parens.rb', line 8 def scanner @scanner end |
Instance Method Details
#parse ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/claret/parsing/parens.rb', line 10 def parse reset_parse_result reset_buffer continue_parsing = true until scanner.eos? || continue_parsing == :stop continue_parsing = handle_next_character end # Add anything remaining in current to result (ie after last closing parens) append_buffer_to_result_if_not_empty unless continue_parsing == :stop @result end |
#reset ⇒ Object
24 25 26 27 28 |
# File 'lib/claret/parsing/parens.rb', line 24 def reset reset_parse_result reset_buffer scanner.reset end |