Class: PgVerify::EbnfParser::ExpressionParser2
- Inherits:
-
Object
- Object
- PgVerify::EbnfParser::ExpressionParser2
- Includes:
- EBNF::PEG::Parser
- Defined in:
- lib/pg-verify/ebnf_parser/expression_parser2.rb
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Abstract syntax tree from parse.
-
#options ⇒ Object
Returns the value of attribute options.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type: :Expression) ⇒ ExpressionParser2
constructor
A new instance of ExpressionParser2.
- #parse!(input) ⇒ Object
Constructor Details
#initialize(type: :Expression) ⇒ ExpressionParser2
Returns a new instance of ExpressionParser2.
386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/pg-verify/ebnf_parser/expression_parser2.rb', line 386 def initialize(type: :Expression) @type = type @options = {} # @options[:logger] = Logger.new(STDERR) # @options[:logger].level = :info # @options[:logger].formatter = lambda {|severity, datetime, progname, msg| "#{severity} #{msg}\n"} # Intantiate the grammar ebnf_file = File.("expressions.ebnf", __dir__) # Perform PEG-specific transformation to the associated rules, which will be passed directly to the parser. @rules = EBNF.parse(File.open(ebnf_file)).make_peg.ast end |
Instance Attribute Details
#ast ⇒ Object (readonly)
Abstract syntax tree from parse
8 9 10 |
# File 'lib/pg-verify/ebnf_parser/expression_parser2.rb', line 8 def ast @ast end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/pg-verify/ebnf_parser/expression_parser2.rb', line 10 def @options end |
#rules ⇒ Object
Returns the value of attribute rules.
9 10 11 |
# File 'lib/pg-verify/ebnf_parser/expression_parser2.rb', line 9 def rules @rules end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/pg-verify/ebnf_parser/expression_parser2.rb', line 11 def type @type end |