Class: Choosy::SuperParser
- Inherits:
-
Object
- Object
- Choosy::SuperParser
- Defined in:
- lib/choosy/super_parser.rb
Instance Attribute Summary collapse
-
#terminals ⇒ Object
readonly
Returns the value of attribute terminals.
-
#verifier ⇒ Object
readonly
Returns the value of attribute verifier.
Instance Method Summary collapse
-
#initialize(super_command) ⇒ SuperParser
constructor
A new instance of SuperParser.
- #parse!(args) ⇒ Object
Constructor Details
#initialize(super_command) ⇒ SuperParser
Returns a new instance of SuperParser.
5 6 7 8 9 |
# File 'lib/choosy/super_parser.rb', line 5 def initialize(super_command) @super_command = super_command @verifier = Verifier.new generate_terminals end |
Instance Attribute Details
#terminals ⇒ Object (readonly)
Returns the value of attribute terminals.
3 4 5 |
# File 'lib/choosy/super_parser.rb', line 3 def terminals @terminals end |
#verifier ⇒ Object (readonly)
Returns the value of attribute verifier.
3 4 5 |
# File 'lib/choosy/super_parser.rb', line 3 def verifier @verifier end |
Instance Method Details
#parse!(args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/choosy/super_parser.rb', line 11 def parse!(args) result = parse_globals(args) unparsed = result.unparsed while unparsed.length > 0 command_result = parse_command(unparsed, terminals) result.subresults << command_result unparsed = command_result.unparsed end result.subresults.each do |subresult| if subresult.command.name == Choosy::DSL::SuperCommandBuilder::HELP verifier.verify!(subresult) end end verifier.verify!(result) result.subresults.each do |subresult| subresult..merge!(result.) verifier.verify!(subresult) end result end |