TokenMgrError.java

00001 /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
00002 package org.objectweb.jonas_ejb.deployment.ejbql;
00003 
00004 public class TokenMgrError extends Error
00005 {
00006    /*
00007     * Ordinals for various reasons why an Error of this type can be thrown.
00008     */
00009 
00013    static final int LEXICAL_ERROR = 0;
00014 
00018    static final int STATIC_LEXER_ERROR = 1;
00019 
00023    static final int INVALID_LEXICAL_STATE = 2;
00024 
00028    static final int LOOP_DETECTED = 3;
00029 
00034    int errorCode;
00035 
00040    protected static final String addEscapes(String str) {
00041       StringBuffer retval = new StringBuffer();
00042       char ch;
00043       for (int i = 0; i < str.length(); i++) {
00044         switch (str.charAt(i))
00045         {
00046            case 0 :
00047               continue;
00048            case '\b':
00049               retval.append("\\b");
00050               continue;
00051            case '\t':
00052               retval.append("\\t");
00053               continue;
00054            case '\n':
00055               retval.append("\\n");
00056               continue;
00057            case '\f':
00058               retval.append("\\f");
00059               continue;
00060            case '\r':
00061               retval.append("\\r");
00062               continue;
00063            case '\"':
00064               retval.append("\\\"");
00065               continue;
00066            case '\'':
00067               retval.append("\\\'");
00068               continue;
00069            case '\\':
00070               retval.append("\\\\");
00071               continue;
00072            default:
00073               if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
00074                  String s = "0000" + Integer.toString(ch, 16);
00075                  retval.append("\\u" + s.substring(s.length() - 4, s.length()));
00076               } else {
00077                  retval.append(ch);
00078               }
00079               continue;
00080         }
00081       }
00082       return retval.toString();
00083    }
00084 
00097    protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
00098       return("Lexical error at line " +
00099            errorLine + ", column " +
00100            errorColumn + ".  Encountered: " +
00101            (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
00102            "after : \"" + addEscapes(errorAfter) + "\"");
00103    }
00104 
00114    public String getMessage() {
00115       return super.getMessage();
00116    }
00117 
00118    /*
00119     * Constructors of various flavors follow.
00120     */
00121 
00122    public TokenMgrError() {
00123    }
00124 
00125    public TokenMgrError(String message, int reason) {
00126       super(message);
00127       errorCode = reason;
00128    }
00129 
00130    public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
00131       this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
00132    }
00133 }

Generated on Tue Feb 15 15:05:47 2005 for JOnAS by  doxygen 1.3.9.1