class Pione::Util::SyntaxErrorAtom

SyntaxErrorAtom is a special parslet atom for on_error helper method.

Public Class Methods

new(msg, expected_elements=[], ignore_error) click to toggle source
# File lib/pione/util/parslet-extension.rb, line 5
def initialize(msg, expected_elements=[], ignore_error)
  @msg = msg
  @expected_elements = expected_elements
  @ignore_error = ignore_error
end

Public Instance Methods

to_s_inner(prec) click to toggle source
# File lib/pione/util/parslet-extension.rb, line 16
def to_s_inner(prec)
  "SYNTAX_ERROR"
end
try(source, context, _) click to toggle source

Raise a ParserError when this atom is touched.

# File lib/pione/util/parslet-extension.rb, line 12
def try(source, context, _)
  raise Lang::ParserError.new(@msg, @expected_elements, source)
end