Class: Pione::Util::SyntaxErrorAtom
- Inherits:
-
Parslet::Atoms::Base
- Object
- Parslet::Atoms::Base
- Pione::Util::SyntaxErrorAtom
- Defined in:
- lib/pione/util/parslet-extension.rb
Overview
SyntaxErrorAtom is a special parslet atom for +on_error+ helper method.
Instance Method Summary collapse
-
#initialize(msg, expected_elements = [], ignore_error) ⇒ SyntaxErrorAtom
constructor
A new instance of SyntaxErrorAtom.
- #to_s_inner(prec) ⇒ Object
-
#try(source, context, _) ⇒ Object
Raise a +ParserError+ when this atom is touched.
Constructor Details
#initialize(msg, expected_elements = [], ignore_error) ⇒ SyntaxErrorAtom
Returns a new instance of SyntaxErrorAtom.
5 6 7 8 9 |
# 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 |
Instance Method Details
#to_s_inner(prec) ⇒ Object
16 17 18 |
# File 'lib/pione/util/parslet-extension.rb', line 16 def to_s_inner(prec) "SYNTAX_ERROR" end |
#try(source, context, _) ⇒ Object
Raise a +ParserError+ when this atom is touched.
12 13 14 |
# File 'lib/pione/util/parslet-extension.rb', line 12 def try(source, context, _) raise Lang::ParserError.new(@msg, @expected_elements, source) end |