18 package com.mysql.clusterj.jdbc.antlr;
20 import org.antlr.runtime.CharStream;
21 import org.antlr.runtime.Lexer;
22 import org.antlr.runtime.NoViableAltException;
23 import org.antlr.runtime.RecognitionException;
24 import org.antlr.runtime.RecognizerSharedState;
26 import java.util.List;
27 import java.util.logging.Level;
28 import java.util.logging.Logger;
36 private static final Logger log = Logger.getLogger(
MySQLLexer.class.getName());
38 boolean nextTokenIsID =
false;
50 return (input.LA(1) !=
'(') ? MySQL51Lexer.ID : proposedType;
55 public MySQLLexer(CharStream input) {
56 this(input,
new RecognizerSharedState());
57 errorListener =
new BaseErrorListener(
this);
60 public MySQLLexer(CharStream input, RecognizerSharedState state) {
62 errorListener =
new BaseErrorListener(
this);
65 public void setErrorListener(ErrorListener listener) {
66 this.errorListener = listener;
69 public ErrorListener getErrorListener() {
78 public String getErrorHeader(RecognitionException e) {
82 public void emitErrorMessage(
String msg) {
87 @SuppressWarnings(
"unchecked")
88 public
String getErrorMessage(RecognitionException re,
String[] tokenNames) {
89 if (log.isLoggable(Level.FINEST)) {
90 List stack = getRuleInvocationStack(re, this.getClass().getName());
92 if (re instanceof NoViableAltException) {
93 NoViableAltException nvae = (NoViableAltException)re;
94 msg =
" no viable alternative for token="+ re.token +
"\n" +
95 " at decision="+nvae.decisionNumber +
" state=" + nvae.stateNumber;
96 if (nvae.grammarDecisionDescription != null && nvae.grammarDecisionDescription.length() > 0)
97 msg = msg +
"\n decision grammar=<< "+ nvae.grammarDecisionDescription +
" >>";
99 msg = super.getErrorMessage(re, tokenNames);
101 return stack +
"\n" + msg;
107 public void reportError(RecognitionException e) {
112 public void originalDisplayError(
String[] tokenNames, RecognitionException e) {
113 super.displayRecognitionError(tokenNames, e);
116 public void originalReportError(RecognitionException e) {
117 super.reportError(e);
120 public String originalGetErrorHeader(RecognitionException e) {
121 return super.getErrorHeader(e);
124 public String originalGetErrorMessage(RecognitionException e,
String[] tokenNames) {
125 return super.getErrorMessage(e, tokenNames);
128 public void originalEmitErrorMessage(
String msg) {