Branch: Tag:

2007-06-01

2007-06-01 06:13:28 by Martin Bähr <mbaehr@email.archlab.tuwien.ac.at>

Tab-completion for HILFE!
includes Error.mkerror() function and Parser.Pike.UnterminatedStringError class
for more sane error handling

Rev: lib/modules/Error.pmod:1.3
Rev: lib/modules/Parser.pmod/Pike.pmod:1.40
Rev: lib/modules/Tools.pmod/Hilfe.pmod:1.128

4:   //   // #pike __REAL_VERSION__   // - // $Id: Pike.pmod,v 1.39 2005/04/10 17:53:22 nilsson Exp $ + // $Id: Pike.pmod,v 1.40 2007/06/01 06:13:28 mbaehr Exp $      //! This module parses and tokenizes Pike source code.   
18:    string rem;    [ret, rem] = Parser._parser._Pike.tokenize(data);    if(sizeof(rem)) { -  if(rem[0]=='"') error("Unterminated string.\n"); +  if(rem[0]=='"') throw(UnterminatedStringError(data));    if(state) state->remains=rem;    }    return ret;
47:    new += ({ "\n" });    return new;   } +  + class UnterminatedStringError + //! Error thrown when an unterminated string token is encountered. + { +  inherit Error.Generic; +  constant error_type = "unterminated_string"; +  constant is_unterminated_string_error = 1; +  +  string err_str; +  //! The string that failed to be tokenized +  +  static void create(string _err_str, void|array bt) +  { +  err_str = _err_str; +  ::create(sprintf("Unterminated string: %O\n", err_str), bt); +  } + }