Loading ...
Sorry, an error occurred while loading the content.

Re: [antlr-interest] handling error messages

Expand Messages
  • Ross Bencina
    ... A while back I made a proposal to add a MessageLog class which recieves all error messages (search the archive to see my explanation, it was quite
    Message 1 of 4 , Feb 1, 2001
    • 0 Attachment
      rennen_c@... wrote:
      > I'm working in a development project in C++ and i'm using ANTLR as
      > part of it to certify validation of text grammer entered by the
      > applications users.
      > The users open an editbox, write text and run it.
      > When the entered text grammer is invalid (E.g. "unexpected
      > token\char")I would like to inform the users with the max infomation,
      > in hebrew language, not english, Therefore, i can't use ANTLR built-
      > in error messages.

      A while back I made a proposal to add a "MessageLog" class which recieves
      all error messages (search the archive to see my explanation, it was quite
      extensive) - that way users could derive a custom error log class which
      could for example display the error messages somewhere other than on the
      standard output. I'm still planning on implementing this MessageLog
      functionality when I get to it.

      This dosn't quite solve your problem of non-standard (non-english) error
      messages but it seems to be a related functionality. Perhaps error reporting
      needs further consideration - for example rather than the MessageLog object
      containing generic message(), error(), panic() methods it could actually
      contain specific methods for each type of error (perhaps overloaded by the
      exception type a-la the Visitor Design Pattern) that would solve your
      problem - comments anyone?

      Best wishes,

      Ross Bencina
    • rennen_c@hotmail.com
      ... infomation, ... built- ... recieves ... was quite ... which ... on the ... error ... reporting ... MessageLog object ... actually ... by the ... your ...
      Message 2 of 4 , Mar 20, 2001
      • 0 Attachment
        --- In antlr-interest@y..., "Ross Bencina" <rossb@a...> wrote:
        > rennen_c@h... wrote:
        > > I'm working in a development project in C++ and i'm using ANTLR as
        > > part of it to certify validation of text grammer entered by the
        > > applications users.
        > > The users open an editbox, write text and run it.
        > > When the entered text grammer is invalid (E.g. "unexpected
        > > token\char")I would like to inform the users with the max
        infomation,
        > > in hebrew language, not english, Therefore, i can't use ANTLR
        built-
        > > in error messages.
        >
        > A while back I made a proposal to add a "MessageLog" class which
        recieves
        > all error messages (search the archive to see my explanation, it
        was quite
        > extensive) - that way users could derive a custom error log class
        which
        > could for example display the error messages somewhere other than
        on the
        > standard output. I'm still planning on implementing this MessageLog
        > functionality when I get to it.
        >
        > This dosn't quite solve your problem of non-standard (non-english)
        error
        > messages but it seems to be a related functionality. Perhaps error
        reporting
        > needs further consideration - for example rather than the
        MessageLog object
        > containing generic message(), error(), panic() methods it could
        actually
        > contain specific methods for each type of error (perhaps overloaded
        by the
        > exception type a-la the Visitor Design Pattern) that would solve
        your
        > problem - comments anyone?
        >
        > Best wishes,
        >
        > Ross Bencina

        Sorry for replying so late, i've been very busy lately. I hope you
        still remember this message :)
        I've implemented a simple single-ton class that contains the list of
        errors, so it can be used not only in the standart console output.
        But i think the right design would be a unique number for each type
        of error, Even if the error number is not presented to the users, and
        another list of error number all wraped in a singleton error handling
        class.
        This way it would be easier to change the text, check for and add
        errors from all the classes of ANTLR.
      Your message has been successfully submitted and would be delivered to recipients shortly.