Sha256: bd86aa68cb9c3dea851ccb7eb00bfee7ea742a59f014c76f119ba95ff17257df

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

# The MIT License (MIT)
#
# Copyright (c) 2019 NUM Technology Ltd
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

require 'antlr4/runtime/parse_cancellation_exception'

module MODL::Parser
  class ThrowingErrorListener
    include Singleton

    def syntax_error(_recognizer, _offending_symbol, _line, _char_position_in_line, _msg, _e)
      raise Antlr4::Runtime::ParseCancellationException, 'line' + _line.to_s + ':' + _char_position_in_line.to_s + ' ' + _msg.to_s
    end

    def report_ambiguity(_recognizer, _dfa, _start_index, _stop_index, _exact, _ambig_ilts, _configs)
    end

    def report_attempting_full_context(_recognizer, _dfa, _start_index, _stop_index, _conflicting_alts, _configs)
    end

    def report_context_sensitivity(_recognizer, _dfa, _start_index, _stop_index, _prediction, _configs)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
modl-0.3.14 lib/modl/parser/throwing_error_listener.rb
modl-0.3.13 lib/modl/parser/throwing_error_listener.rb
modl-0.3.12 lib/modl/parser/throwing_error_listener.rb
modl-0.3.11 lib/modl/parser/throwing_error_listener.rb
modl-0.3.10 lib/modl/parser/throwing_error_listener.rb
modl-0.3.9 lib/modl/parser/throwing_error_listener.rb
modl-0.3.8 lib/modl/parser/throwing_error_listener.rb