| 5 |
|
* Project led by Terence Parr at http://www.jGuru.com |
| 6 |
|
* Software rights: http://www.antlr.org/license.html |
| 7 |
|
* |
| 8 |
< |
* $Id: CharScanner.hpp,v 1.2 2005-12-15 14:48:26 gezelter Exp $ |
| 8 |
> |
* $Id$ |
| 9 |
|
*/ |
| 10 |
|
|
| 11 |
|
#include <antlr/config.hpp> |
| 12 |
< |
|
| 12 |
> |
#include <cstdio> |
| 13 |
|
#include <map> |
| 14 |
+ |
#include <cstring> |
| 15 |
|
|
| 16 |
|
#ifdef HAS_NOT_CCTYPE_H |
| 17 |
|
#include <ctype.h> |
| 41 |
|
|
| 42 |
|
ANTLR_C_USING(tolower) |
| 43 |
|
|
| 44 |
< |
#if !defined(HAVE_STRCASECMP) && defined(HAVE_STRICMP) && !defined(stricmp) |
| 45 |
< |
#define strcasecmp stricmp |
| 46 |
< |
#endif |
| 46 |
< |
#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP) && !defined(strnicmp) |
| 47 |
< |
#define strncasecmp strnicmp |
| 48 |
< |
#endif |
| 49 |
< |
|
| 50 |
< |
|
| 51 |
< |
#if !defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP) |
| 44 |
> |
#ifdef ANTLR_REALLY_NO_STRCASECMP |
| 45 |
> |
// Apparently, neither strcasecmp nor stricmp is standard, and Codewarrior |
| 46 |
> |
// on the mac has neither... |
| 47 |
|
inline int strcasecmp(const char *s1, const char *s2) |
| 48 |
|
{ |
| 49 |
|
while (true) |
| 55 |
|
if (c1 == 0) return 0; |
| 56 |
|
} |
| 57 |
|
} |
| 58 |
+ |
#else |
| 59 |
+ |
#ifdef NO_STRCASECMP |
| 60 |
+ |
ANTLR_C_USING(stricmp) |
| 61 |
+ |
#else |
| 62 |
+ |
ANTLR_C_USING(strcasecmp) |
| 63 |
|
#endif |
| 64 |
+ |
#endif |
| 65 |
|
|
| 66 |
|
/** Functor for the literals map |
| 67 |
|
*/ |
| 122 |
|
inputState->getInput().commit(); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
+ |
/** called by the generated lexer to do error recovery, override to |
| 126 |
+ |
* customize the behaviour. |
| 127 |
+ |
*/ |
| 128 |
+ |
virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) |
| 129 |
+ |
{ |
| 130 |
+ |
consume(); |
| 131 |
+ |
consumeUntil(tokenSet); |
| 132 |
+ |
} |
| 133 |
+ |
|
| 134 |
|
virtual void consume() |
| 135 |
|
{ |
| 136 |
|
if (inputState->guessing == 0) |