<commit_before>%%%
%%% Author:
%%%   <NAME> <<EMAIL>>
%%%
%%% Copyright:
%%%   <NAME>, 1998
%%%
%%% Last change:
%%%   $Date$ by $Author$
%%%   $Revision$
%%%
%%% This file is part of Mozart, an implementation of Oz 3:
%%%    http://mozart.ps.uni-sb.de
%%%
%%% See the file "LICENSE" or
%%%    http://mozart.ps.uni-sb.de/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%

functor
import
   Error(messageToVirtualString)
   System(printError)
   Listener('class')
export
   'class': ErrorListener
define
   fun {MessageToVS Item}
      case Item of info(VS) then VS
      [] info(VS _) then VS
      [] message(Record _) then {Error.messageToVirtualString Record}
      end
   end

   fun {HistoryToVS History}
      {FoldL History
       fun {$ In M}
          {MessageToVS M}#In
       end ""}
   end

   class ErrorListener from Listener.'class'
      attr
         Fallback: unit
         Verbose: false History: nil
         HasErrors: false IsActive: false
      meth init(NarratorObject ServeOne <= unit DoVerbose <= false)
         Fallback <- ServeOne
         Verbose <- DoVerbose
         Listener.'class', init(NarratorObject Serve)
      end
      meth reset()
         skip
      end
      meth Serve(Ms)
         case Ms of M|Mr then OutputMessage in
            case M of info(_) then
               OutputMessage = M
            [] info(_ _) then
               OutputMessage = M
            [] attention() then
               IsActive <- true
               OutputMessage = unit
            [] message(M1 _) then
               IsActive <- true
               case M1 of error(...) then
                  HasErrors <- true
               end
               OutputMessage = M
            [] close() then
               History <- nil
               HasErrors <- false
               IsActive <- false
               {self reset()}<commit_msg>Oops.<commit_after>%%%
%%% Author:
%%%   <NAME> <<EMAIL>.uni-sb.de>
%%%
%%% Copyright:
%%%   <NAME>, 1998
%%%
%%% Last change:
%%%   $Date$ by $Author$
%%%   $Revision$
%%%
%%% This file is part of Mozart, an implementation of Oz 3:
%%%    http://mozart.ps.uni-sb.de
%%%
%%% See the file "LICENSE" or
%%%    http://mozart.ps.uni-sb.de/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%

functor
import
   Error(messageToVirtualString)
   System(printError)
   Listener('class')
export
   'class': ErrorListener
define
   fun {MessageToVS Item}
      case Item of info(VS) then VS
      [] info(VS _) then VS
      [] message(Record _) then {Error.messageToVirtualString Record}
      end
   end

   fun {HistoryToVS History}
      {FoldL History
       fun {$ In M}
          {MessageToVS M}#In
       end ""}
   end

   class ErrorListener from Listener.'class'
      attr
         Fallback: unit
         Verbose: false History: nil
         HasErrors: false IsActive: false
      meth init(NarratorObject ServeOne <= unit DoVerbose <= false)
         Fallback <- ServeOne
         Verbose <- DoVerbose
         Listener.'class', init(NarratorObject Serve)
      end
      meth reset()
         skip
      end
      meth Serve(Ms)
         case Ms of M|Mr then OutputMessage in
            case M of info(_) then
               OutputMessage = M
            [] info(_ _) then
               OutputMessage = M
            [] attention() then
               IsActive <- true
               OutputMessage = unit
            [] message(M1 _) then
               IsActive <- true
               case M1 of error(...) then
                  HasErrors <- true
               else skip
               end
               OutputMessage = M
            [] close() then
               History <- nil
               HasErrors <- false
               IsActive <- false
               {self reset()}
{'fraction_non_alphanumeric': 0.11034128817038748, 'fraction_numerical': 0.00359250705671029, 'mean_word_length': 1.7182705718270572, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4871437', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1100, 'n_words': 339}