Module: PgVerify::EbnfParser

Defined in:
lib/pg-verify/ebnf_parser/ast.rb,
lib/pg-verify/ebnf_parser/ebnf_parser.rb,
lib/pg-verify/ebnf_parser/parser_result.rb,
lib/pg-verify/ebnf_parser/expression_parser.rb,
lib/pg-verify/ebnf_parser/expression_parser2.rb

Defined Under Namespace

Classes: Ast, ExpressionParser, ExpressionParser2, ParserResult

Class Method Summary collapse

Class Method Details

.parse_expression(expression, type: :Expression) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/pg-verify/ebnf_parser/ebnf_parser.rb', line 14

def self.parse_expression(expression, type: :Expression)
    parser = ExpressionParser.new(type: type)
    error, ast = nil, nil
    begin
        ast = parser.parse!(expression)
    rescue EBNF::PEG::Parser::Error => e 
        error = e
    end
    return ParserResult.new(ast, error)
end