--- trunk/src/antlr/CharScanner.hpp 2005/12/15 14:48:26 812 +++ branches/development/src/antlr/CharScanner.hpp 2011/09/15 13:39:36 1633 @@ -5,7 +5,7 @@ * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * - * $Id: CharScanner.hpp,v 1.2 2005-12-15 14:48:26 gezelter Exp $ + * $Id$ */ #include @@ -40,15 +40,9 @@ ANTLR_C_USING(tolower) ANTLR_C_USING(tolower) -#if !defined(HAVE_STRCASECMP) && defined(HAVE_STRICMP) && !defined(stricmp) -#define strcasecmp stricmp -#endif -#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP) && !defined(strnicmp) -#define strncasecmp strnicmp -#endif - - -#if !defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP) +#ifdef ANTLR_REALLY_NO_STRCASECMP +// Apparently, neither strcasecmp nor stricmp is standard, and Codewarrior +// on the mac has neither... inline int strcasecmp(const char *s1, const char *s2) { while (true) @@ -60,7 +54,13 @@ inline int strcasecmp(const char *s1, const char *s2) if (c1 == 0) return 0; } } +#else +#ifdef NO_STRCASECMP +ANTLR_C_USING(stricmp) +#else +ANTLR_C_USING(strcasecmp) #endif +#endif /** Functor for the literals map */ @@ -119,6 +119,15 @@ class ANTLR_API CharScanner : public TokenStream { (pu virtual void commit() { inputState->getInput().commit(); + } + + /** called by the generated lexer to do error recovery, override to + * customize the behaviour. + */ + virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) + { + consume(); + consumeUntil(tokenSet); } virtual void consume()