Class: PgVerify::EbnfParser::ParserResult

Inherits:
Object
  • Object
show all
Defined in:
lib/pg-verify/ebnf_parser/parser_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ast, error) ⇒ ParserResult

Returns a new instance of ParserResult.



9
10
11
# File 'lib/pg-verify/ebnf_parser/parser_result.rb', line 9

def initialize(ast, error)
    @ast, @error = ast, error
end

Instance Attribute Details

#astObject

Returns the value of attribute ast.



6
7
8
# File 'lib/pg-verify/ebnf_parser/parser_result.rb', line 6

def ast
  @ast
end

#errorObject

Returns the value of attribute error.



7
8
9
# File 'lib/pg-verify/ebnf_parser/parser_result.rb', line 7

def error
  @error
end

Instance Method Details

#check!Object

Raises:



13
14
15
16
17
# File 'lib/pg-verify/ebnf_parser/parser_result.rb', line 13

def check!()
    return unless error?()
    # TODO: Custom exception
    raise @error
end

#error?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/pg-verify/ebnf_parser/parser_result.rb', line 19

def error?()
    return !@error.nil?
end