Class: SimpleLogic::Parser
- Inherits:
-
Object
- Object
- SimpleLogic::Parser
- Defined in:
- lib/simple_logic/parser.rb
Constant Summary collapse
- @@parser =
SimpleLogicParser.new
Class Method Summary collapse
Class Method Details
.parse(data) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/simple_logic/parser.rb', line 10 def self.parse(data) # Pass the data over to the parser instance tree = @@parser.parse(data) # If the AST is nil then there was an error during parsing # we need to report a simple error message to help the user if(tree.nil?) raise ParseError.new(@@parser.index), "Parse error at offset: #{@@parser.index}" end return tree end |