Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 181A3772D for ; Mon, 5 Dec 2011 14:37:24 +0000 (UTC) Received: (qmail 65879 invoked by uid 500); 5 Dec 2011 14:37:24 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 65844 invoked by uid 500); 5 Dec 2011 14:37:23 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 65837 invoked by uid 99); 5 Dec 2011 14:37:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2011 14:37:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2011 14:37:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7CF2523889EC; Mon, 5 Dec 2011 14:36:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1210476 [2/7] - in /jackrabbit/trunk/jackrabbit-spi-commons: ./ src/main/java/org/apache/jackrabbit/spi/commons/query/sql/ src/main/java/org/apache/jackrabbit/spi/commons/query/xpath/ Date: Mon, 05 Dec 2011 14:36:48 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111205143650.7CF2523889EC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTokenManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTokenManager.java?rev=1210476&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTokenManager.java (added) +++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTokenManager.java Mon Dec 5 14:36:46 2011 @@ -0,0 +1,1712 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. JCRSQLParserTokenManager.java */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi.commons.query.sql; +import org.apache.jackrabbit.spi.commons.conversion.NameException; +import org.apache.jackrabbit.spi.commons.conversion.NameResolver; +import org.apache.jackrabbit.spi.commons.query.QueryConstants; +import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl; +import org.apache.jackrabbit.spi.Name; +import javax.jcr.NamespaceException; + +public class JCRSQLParserTokenManager implements JCRSQLParserConstants +{ + public java.io.PrintStream debugStream = System.out; + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private final int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private final int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 9: + jjmatchedKind = 4; + return jjMoveNfa_0(0, 0); + case 10: + jjmatchedKind = 3; + return jjMoveNfa_0(0, 0); + case 13: + jjmatchedKind = 2; + return jjMoveNfa_0(0, 0); + case 32: + jjmatchedKind = 1; + return jjMoveNfa_0(0, 0); + case 34: + jjmatchedKind = 38; + return jjMoveNfa_0(0, 0); + case 37: + jjmatchedKind = 39; + return jjMoveNfa_0(0, 0); + case 38: + jjmatchedKind = 40; + return jjMoveNfa_0(0, 0); + case 39: + jjmatchedKind = 41; + return jjMoveNfa_0(0, 0); + case 40: + jjmatchedKind = 42; + return jjMoveNfa_0(0, 0); + case 41: + jjmatchedKind = 43; + return jjMoveNfa_0(0, 0); + case 42: + jjmatchedKind = 44; + return jjMoveNfa_0(0, 0); + case 43: + jjmatchedKind = 45; + return jjMoveNfa_0(0, 0); + case 44: + jjmatchedKind = 46; + return jjMoveNfa_0(0, 0); + case 45: + jjmatchedKind = 47; + return jjMoveNfa_0(0, 0); + case 46: + jjmatchedKind = 48; + return jjMoveStringLiteralDfa1_0(0x0L, 0x200L); + case 47: + jjmatchedKind = 49; + return jjMoveNfa_0(0, 0); + case 58: + jjmatchedKind = 50; + return jjMoveNfa_0(0, 0); + case 59: + jjmatchedKind = 51; + return jjMoveNfa_0(0, 0); + case 60: + jjmatchedKind = 52; + return jjMoveStringLiteralDfa1_0(0x0L, 0xa0L); + case 61: + jjmatchedKind = 53; + return jjMoveNfa_0(0, 0); + case 62: + jjmatchedKind = 54; + return jjMoveStringLiteralDfa1_0(0x0L, 0x40L); + case 63: + jjmatchedKind = 55; + return jjMoveNfa_0(0, 0); + case 65: + return jjMoveStringLiteralDfa1_0(0x6000L, 0x0L); + case 66: + return jjMoveStringLiteralDfa1_0(0x4000200L, 0x0L); + case 67: + return jjMoveStringLiteralDfa1_0(0x20000000L, 0x0L); + case 68: + return jjMoveStringLiteralDfa1_0(0x10000L, 0x0L); + case 69: + return jjMoveStringLiteralDfa1_0(0x9000000L, 0x0L); + case 70: + return jjMoveStringLiteralDfa1_0(0x80000L, 0x0L); + case 73: + return jjMoveStringLiteralDfa1_0(0x1400L, 0x0L); + case 76: + return jjMoveStringLiteralDfa1_0(0x120000L, 0x0L); + case 78: + return jjMoveStringLiteralDfa1_0(0x48000L, 0x0L); + case 79: + return jjMoveStringLiteralDfa1_0(0x200800L, 0x0L); + case 83: + return jjMoveStringLiteralDfa1_0(0x52000000L, 0x0L); + case 85: + return jjMoveStringLiteralDfa1_0(0x400000L, 0x0L); + case 87: + return jjMoveStringLiteralDfa1_0(0x800000L, 0x0L); + case 91: + jjmatchedKind = 58; + return jjMoveNfa_0(0, 0); + case 93: + jjmatchedKind = 59; + return jjMoveNfa_0(0, 0); + case 95: + jjmatchedKind = 56; + return jjMoveNfa_0(0, 0); + case 97: + return jjMoveStringLiteralDfa1_0(0x6000L, 0x0L); + case 98: + return jjMoveStringLiteralDfa1_0(0x4000200L, 0x0L); + case 99: + return jjMoveStringLiteralDfa1_0(0x20000000L, 0x0L); + case 100: + return jjMoveStringLiteralDfa1_0(0x10000L, 0x0L); + case 101: + return jjMoveStringLiteralDfa1_0(0x9000000L, 0x0L); + case 102: + return jjMoveStringLiteralDfa1_0(0x80000L, 0x0L); + case 105: + return jjMoveStringLiteralDfa1_0(0x1400L, 0x0L); + case 108: + return jjMoveStringLiteralDfa1_0(0x120000L, 0x0L); + case 110: + return jjMoveStringLiteralDfa1_0(0x48000L, 0x0L); + case 111: + return jjMoveStringLiteralDfa1_0(0x200800L, 0x0L); + case 115: + return jjMoveStringLiteralDfa1_0(0x52000000L, 0x0L); + case 117: + return jjMoveStringLiteralDfa1_0(0x400000L, 0x0L); + case 119: + return jjMoveStringLiteralDfa1_0(0x800000L, 0x0L); + case 124: + jjmatchedKind = 57; + return jjMoveStringLiteralDfa1_0(0x0L, 0x100L); + default : + return jjMoveNfa_0(0, 0); + } +} +private final int jjMoveStringLiteralDfa1_0(long active0, long active1) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 0); + } + switch(curChar) + { + case 46: + if ((active1 & 0x200L) != 0L) + { + jjmatchedKind = 73; + jjmatchedPos = 1; + } + break; + case 61: + if ((active1 & 0x40L) != 0L) + { + jjmatchedKind = 70; + jjmatchedPos = 1; + } + else if ((active1 & 0x80L) != 0L) + { + jjmatchedKind = 71; + jjmatchedPos = 1; + } + break; + case 62: + if ((active1 & 0x20L) != 0L) + { + jjmatchedKind = 69; + jjmatchedPos = 1; + } + break; + case 69: + return jjMoveStringLiteralDfa2_0(active0, 0x6010000L, active1, 0L); + case 72: + return jjMoveStringLiteralDfa2_0(active0, 0x800000L, active1, 0L); + case 73: + return jjMoveStringLiteralDfa2_0(active0, 0x10020000L, active1, 0L); + case 78: + if ((active0 & 0x400L) != 0L) + { + jjmatchedKind = 10; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x2000L, active1, 0L); + case 79: + return jjMoveStringLiteralDfa2_0(active0, 0x20108000L, active1, 0L); + case 80: + return jjMoveStringLiteralDfa2_0(active0, 0x40400000L, active1, 0L); + case 82: + if ((active0 & 0x800L) != 0L) + { + jjmatchedKind = 11; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x280000L, active1, 0L); + case 83: + if ((active0 & 0x1000L) != 0L) + { + jjmatchedKind = 12; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x1004000L, active1, 0L); + case 85: + return jjMoveStringLiteralDfa2_0(active0, 0x40000L, active1, 0L); + case 88: + return jjMoveStringLiteralDfa2_0(active0, 0x8000000L, active1, 0L); + case 89: + if ((active0 & 0x200L) != 0L) + { + jjmatchedKind = 9; + jjmatchedPos = 1; + } + break; + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0x6010000L, active1, 0L); + case 104: + return jjMoveStringLiteralDfa2_0(active0, 0x800000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0x10020000L, active1, 0L); + case 110: + if ((active0 & 0x400L) != 0L) + { + jjmatchedKind = 10; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x2000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa2_0(active0, 0x20108000L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa2_0(active0, 0x40400000L, active1, 0L); + case 114: + if ((active0 & 0x800L) != 0L) + { + jjmatchedKind = 11; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x280000L, active1, 0L); + case 115: + if ((active0 & 0x1000L) != 0L) + { + jjmatchedKind = 12; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x1004000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x40000L, active1, 0L); + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x8000000L, active1, 0L); + case 121: + if ((active0 & 0x200L) != 0L) + { + jjmatchedKind = 9; + jjmatchedPos = 1; + } + break; + case 124: + if ((active1 & 0x100L) != 0L) + { + jjmatchedKind = 72; + jjmatchedPos = 1; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 1); +} +private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjMoveNfa_0(0, 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 1); + } + switch(curChar) + { + case 67: + if ((active0 & 0x4000L) != 0L) + { + jjmatchedKind = 14; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0x9000000L); + case 68: + if ((active0 & 0x2000L) != 0L) + { + jjmatchedKind = 13; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0x200000L); + case 69: + return jjMoveStringLiteralDfa3_0(active0, 0x40800000L); + case 75: + return jjMoveStringLiteralDfa3_0(active0, 0x20000L); + case 76: + return jjMoveStringLiteralDfa3_0(active0, 0x2040000L); + case 77: + return jjMoveStringLiteralDfa3_0(active0, 0x10000000L); + case 78: + return jjMoveStringLiteralDfa3_0(active0, 0x20000000L); + case 79: + return jjMoveStringLiteralDfa3_0(active0, 0x80000L); + case 80: + return jjMoveStringLiteralDfa3_0(active0, 0x400000L); + case 83: + return jjMoveStringLiteralDfa3_0(active0, 0x10000L); + case 84: + if ((active0 & 0x8000L) != 0L) + { + jjmatchedKind = 15; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0x4000000L); + case 87: + return jjMoveStringLiteralDfa3_0(active0, 0x100000L); + case 99: + if ((active0 & 0x4000L) != 0L) + { + jjmatchedKind = 14; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0x9000000L); + case 100: + if ((active0 & 0x2000L) != 0L) + { + jjmatchedKind = 13; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0x200000L); + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x40800000L); + case 107: + return jjMoveStringLiteralDfa3_0(active0, 0x20000L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x2040000L); + case 109: + return jjMoveStringLiteralDfa3_0(active0, 0x10000000L); + case 110: + return jjMoveStringLiteralDfa3_0(active0, 0x20000000L); + case 111: + return jjMoveStringLiteralDfa3_0(active0, 0x80000L); + case 112: + return jjMoveStringLiteralDfa3_0(active0, 0x400000L); + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x10000L); + case 116: + if ((active0 & 0x8000L) != 0L) + { + jjmatchedKind = 15; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0x4000000L); + case 119: + return jjMoveStringLiteralDfa3_0(active0, 0x100000L); + default : + break; + } + return jjMoveNfa_0(0, 2); +} +private final int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 2); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 2); + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa4_0(active0, 0x1000000L); + case 67: + if ((active0 & 0x10000L) != 0L) + { + jjmatchedKind = 16; + jjmatchedPos = 3; + } + break; + case 69: + if ((active0 & 0x20000L) != 0L) + { + jjmatchedKind = 17; + jjmatchedPos = 3; + } + return jjMoveStringLiteralDfa4_0(active0, 0xa700000L); + case 73: + return jjMoveStringLiteralDfa4_0(active0, 0x10000000L); + case 76: + if ((active0 & 0x40000L) != 0L) + { + jjmatchedKind = 18; + jjmatchedPos = 3; + } + return jjMoveStringLiteralDfa4_0(active0, 0x40000000L); + case 77: + if ((active0 & 0x80000L) != 0L) + { + jjmatchedKind = 19; + jjmatchedPos = 3; + } + break; + case 82: + return jjMoveStringLiteralDfa4_0(active0, 0x800000L); + case 84: + return jjMoveStringLiteralDfa4_0(active0, 0x20000000L); + case 87: + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L); + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x1000000L); + case 99: + if ((active0 & 0x10000L) != 0L) + { + jjmatchedKind = 16; + jjmatchedPos = 3; + } + break; + case 101: + if ((active0 & 0x20000L) != 0L) + { + jjmatchedKind = 17; + jjmatchedPos = 3; + } + return jjMoveStringLiteralDfa4_0(active0, 0xa700000L); + case 105: + return jjMoveStringLiteralDfa4_0(active0, 0x10000000L); + case 108: + if ((active0 & 0x40000L) != 0L) + { + jjmatchedKind = 18; + jjmatchedPos = 3; + } + return jjMoveStringLiteralDfa4_0(active0, 0x40000000L); + case 109: + if ((active0 & 0x80000L) != 0L) + { + jjmatchedKind = 19; + jjmatchedPos = 3; + } + break; + case 114: + return jjMoveStringLiteralDfa4_0(active0, 0x800000L); + case 116: + return jjMoveStringLiteralDfa4_0(active0, 0x20000000L); + case 119: + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L); + default : + break; + } + return jjMoveNfa_0(0, 3); +} +private final int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 3); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 3); + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa5_0(active0, 0x20000000L); + case 67: + return jjMoveStringLiteralDfa5_0(active0, 0x2000000L); + case 69: + if ((active0 & 0x800000L) != 0L) + { + jjmatchedKind = 23; + jjmatchedPos = 4; + } + return jjMoveStringLiteralDfa5_0(active0, 0x4000000L); + case 76: + return jjMoveStringLiteralDfa5_0(active0, 0x50000000L); + case 80: + return jjMoveStringLiteralDfa5_0(active0, 0x1000000L); + case 82: + if ((active0 & 0x100000L) != 0L) + { + jjmatchedKind = 20; + jjmatchedPos = 4; + } + else if ((active0 & 0x200000L) != 0L) + { + jjmatchedKind = 21; + jjmatchedPos = 4; + } + else if ((active0 & 0x400000L) != 0L) + { + jjmatchedKind = 22; + jjmatchedPos = 4; + } + return jjMoveStringLiteralDfa5_0(active0, 0x8000000L); + case 97: + return jjMoveStringLiteralDfa5_0(active0, 0x20000000L); + case 99: + return jjMoveStringLiteralDfa5_0(active0, 0x2000000L); + case 101: + if ((active0 & 0x800000L) != 0L) + { + jjmatchedKind = 23; + jjmatchedPos = 4; + } + return jjMoveStringLiteralDfa5_0(active0, 0x4000000L); + case 108: + return jjMoveStringLiteralDfa5_0(active0, 0x50000000L); + case 112: + return jjMoveStringLiteralDfa5_0(active0, 0x1000000L); + case 114: + if ((active0 & 0x100000L) != 0L) + { + jjmatchedKind = 20; + jjmatchedPos = 4; + } + else if ((active0 & 0x200000L) != 0L) + { + jjmatchedKind = 21; + jjmatchedPos = 4; + } + else if ((active0 & 0x400000L) != 0L) + { + jjmatchedKind = 22; + jjmatchedPos = 4; + } + return jjMoveStringLiteralDfa5_0(active0, 0x8000000L); + default : + break; + } + return jjMoveNfa_0(0, 4); +} +private final int jjMoveStringLiteralDfa5_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 4); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 4); + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa6_0(active0, 0x10000000L); + case 67: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000L); + case 69: + if ((active0 & 0x1000000L) != 0L) + { + jjmatchedKind = 24; + jjmatchedPos = 5; + } + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L); + case 73: + return jjMoveStringLiteralDfa6_0(active0, 0x20000000L); + case 80: + return jjMoveStringLiteralDfa6_0(active0, 0x8000000L); + case 84: + if ((active0 & 0x2000000L) != 0L) + { + jjmatchedKind = 25; + jjmatchedPos = 5; + } + break; + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x10000000L); + case 99: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000L); + case 101: + if ((active0 & 0x1000000L) != 0L) + { + jjmatchedKind = 24; + jjmatchedPos = 5; + } + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L); + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x20000000L); + case 112: + return jjMoveStringLiteralDfa6_0(active0, 0x8000000L); + case 116: + if ((active0 & 0x2000000L) != 0L) + { + jjmatchedKind = 25; + jjmatchedPos = 5; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 5); +} +private final int jjMoveStringLiteralDfa6_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 5); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 5); + } + switch(curChar) + { + case 72: + return jjMoveStringLiteralDfa7_0(active0, 0x40000000L); + case 78: + if ((active0 & 0x4000000L) != 0L) + { + jjmatchedKind = 26; + jjmatchedPos = 6; + } + return jjMoveStringLiteralDfa7_0(active0, 0x20000000L); + case 82: + if ((active0 & 0x10000000L) != 0L) + { + jjmatchedKind = 28; + jjmatchedPos = 6; + } + break; + case 84: + if ((active0 & 0x8000000L) != 0L) + { + jjmatchedKind = 27; + jjmatchedPos = 6; + } + break; + case 104: + return jjMoveStringLiteralDfa7_0(active0, 0x40000000L); + case 110: + if ((active0 & 0x4000000L) != 0L) + { + jjmatchedKind = 26; + jjmatchedPos = 6; + } + return jjMoveStringLiteralDfa7_0(active0, 0x20000000L); + case 114: + if ((active0 & 0x10000000L) != 0L) + { + jjmatchedKind = 28; + jjmatchedPos = 6; + } + break; + case 116: + if ((active0 & 0x8000000L) != 0L) + { + jjmatchedKind = 27; + jjmatchedPos = 6; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 6); +} +private final int jjMoveStringLiteralDfa7_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 6); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 6); + } + switch(curChar) + { + case 69: + return jjMoveStringLiteralDfa8_0(active0, 0x40000000L); + case 83: + if ((active0 & 0x20000000L) != 0L) + { + jjmatchedKind = 29; + jjmatchedPos = 7; + } + break; + case 101: + return jjMoveStringLiteralDfa8_0(active0, 0x40000000L); + case 115: + if ((active0 & 0x20000000L) != 0L) + { + jjmatchedKind = 29; + jjmatchedPos = 7; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 7); +} +private final int jjMoveStringLiteralDfa8_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 7); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 7); + } + switch(curChar) + { + case 67: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000L); + case 99: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000L); + default : + break; + } + return jjMoveNfa_0(0, 8); +} +private final int jjMoveStringLiteralDfa9_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 8); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 8); + } + switch(curChar) + { + case 75: + if ((active0 & 0x40000000L) != 0L) + { + jjmatchedKind = 30; + jjmatchedPos = 9; + } + break; + case 107: + if ((active0 & 0x40000000L) != 0L) + { + jjmatchedKind = 30; + jjmatchedPos = 9; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 9); +} +private final void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private final void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private final void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} +private final void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} +private final void jjCheckNAddStates(int start) +{ + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); +} +static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec3 = { + 0x0L, 0xffffffffffffc000L, 0xfffff0007fffffffL, 0x7fffffL +}; +static final long[] jjbitVec4 = { + 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec5 = { + 0x7ff3ffffffffffffL, 0x7ffffffffffffdfeL, 0xffffffffffffffffL, 0xfc31ffffffffe00fL +}; +static final long[] jjbitVec6 = { + 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x3L +}; +static final long[] jjbitVec7 = { + 0x0L, 0x0L, 0xfffffffbffffd740L, 0xffffd547f7fffL +}; +static final long[] jjbitVec8 = { + 0xffffffffffffdffeL, 0xffffffffdffeffffL, 0xffffffffffff0003L, 0x33fcfffffff199fL +}; +static final long[] jjbitVec9 = { + 0xfffe000000000000L, 0xfffffffe027fffffL, 0x7fL, 0x707ffffff0000L +}; +static final long[] jjbitVec10 = { + 0x7fffffe00000000L, 0xfffe0000000007feL, 0x7cffffffffffffffL, 0x60002f7fffL +}; +static final long[] jjbitVec11 = { + 0x23ffffffffffffe0L, 0x3ff000000L, 0x3c5fdfffff99fe0L, 0x30003b0000000L +}; +static final long[] jjbitVec12 = { + 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100000000L +}; +static final long[] jjbitVec13 = { + 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L +}; +static final long[] jjbitVec14 = { + 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L +}; +static final long[] jjbitVec15 = { + 0x3fffdfffffddfe0L, 0x300000000L, 0x0L, 0x0L +}; +static final long[] jjbitVec16 = { + 0xd7ffffffffffeL, 0x3fL, 0x200d6caefef02596L, 0x1fL +}; +static final long[] jjbitVec17 = { + 0x0L, 0x3fffffffeffL, 0x0L, 0x0L +}; +static final long[] jjbitVec18 = { + 0x0L, 0x0L, 0xffffffff00000000L, 0x7fffffffff003fL +}; +static final long[] jjbitVec19 = { + 0x500000000007daedL, 0x2c62ab82315001L, 0xf580c90040000000L, 0x201080000000007L +}; +static final long[] jjbitVec20 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL +}; +static final long[] jjbitVec21 = { + 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL +}; +static final long[] jjbitVec22 = { + 0x4c4000000000L, 0x0L, 0x7L, 0x0L +}; +static final long[] jjbitVec23 = { + 0x3fe00000080L, 0xfffffffffffffffeL, 0xfffffffe001fffffL, 0x7ffffffffffffffL +}; +static final long[] jjbitVec24 = { + 0x1fffffffffe0L, 0x0L, 0x0L, 0x0L +}; +static final long[] jjbitVec25 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L +}; +static final long[] jjbitVec26 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L +}; +private final int jjMoveNfa_0(int startState, int curPos) +{ + int strKind = jjmatchedKind; + int strPos = jjmatchedPos; + int seenUpto; + input_stream.backup(seenUpto = curPos + 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error"); } + curPos = 0; + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 109; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 0: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 74) + kind = 74; + jjCheckNAddStates(0, 4); + } + else if ((0x280000000000L & l) != 0L) + jjCheckNAddTwoStates(15, 18); + else if (curChar == 46) + jjCheckNAddTwoStates(26, 27); + else if (curChar == 39) + jjCheckNAddTwoStates(12, 13); + else if (curChar == 34) + jjCheckNAddTwoStates(7, 10); + if (curChar == 45) + jjCheckNAdd(1); + break; + case 1: + if (curChar == 45) + jjCheckNAddStates(5, 7); + break; + case 2: + jjCheckNAddTwoStates(2, 3); + break; + case 3: + if (curChar == 10 && kind > 5) + kind = 5; + break; + case 5: + if ((0x7ff000000000000L & l) == 0L) + break; + if (kind > 60) + kind = 60; + jjAddStates(8, 9); + break; + case 6: + if (curChar == 34) + jjCheckNAddTwoStates(7, 10); + break; + case 7: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddTwoStates(7, 8); + break; + case 8: + if (curChar != 34) + break; + if (kind > 64) + kind = 64; + jjCheckNAdd(9); + break; + case 9: + if (curChar == 34) + jjCheckNAddTwoStates(7, 8); + break; + case 10: + if (curChar == 34) + jjCheckNAdd(9); + break; + case 11: + if (curChar == 39) + jjCheckNAddTwoStates(12, 13); + break; + case 12: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddTwoStates(12, 13); + break; + case 13: + if (curChar != 39) + break; + if (kind > 98) + kind = 98; + jjstateSet[jjnewStateCnt++] = 11; + break; + case 14: + if ((0x280000000000L & l) != 0L) + jjCheckNAddTwoStates(15, 18); + break; + case 15: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 74) + kind = 74; + jjCheckNAddTwoStates(15, 16); + break; + case 16: + if (curChar != 46) + break; + if (kind > 74) + kind = 74; + jjCheckNAdd(17); + break; + case 17: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 74) + kind = 74; + jjCheckNAdd(17); + break; + case 18: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 19: + if (curChar == 46) + jjCheckNAddTwoStates(20, 21); + break; + case 20: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(20, 21); + break; + case 22: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(23); + break; + case 23: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 76) + kind = 76; + jjCheckNAdd(23); + break; + case 24: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 74) + kind = 74; + jjCheckNAddStates(0, 4); + break; + case 25: + if (curChar == 46) + jjCheckNAddTwoStates(26, 27); + break; + case 26: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 74) + kind = 74; + jjCheckNAdd(26); + break; + case 27: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(27, 21); + break; + case 30: + if (curChar == 32) + jjAddStates(13, 14); + break; + case 31: + if (curChar == 39) + jjCheckNAdd(32); + break; + case 32: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(32, 33); + break; + case 33: + if (curChar == 45) + jjCheckNAdd(34); + break; + case 34: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(34, 35); + break; + case 35: + if (curChar == 45) + jjCheckNAdd(36); + break; + case 36: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(36, 37); + break; + case 37: + if (curChar == 39 && kind > 81) + kind = 81; + break; + case 41: + if (curChar == 32) + jjAddStates(15, 16); + break; + case 42: + if (curChar == 39) + jjCheckNAdd(43); + break; + case 43: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(43, 44); + break; + case 44: + if (curChar == 45) + jjCheckNAdd(45); + break; + case 45: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(45, 46); + break; + case 46: + if (curChar == 45) + jjCheckNAdd(47); + break; + case 47: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(47, 48); + break; + case 48: + if (curChar == 39 && kind > 82) + kind = 82; + break; + case 53: + if (curChar == 32) + jjAddStates(17, 18); + break; + case 54: + if (curChar == 39) + jjCheckNAdd(55); + break; + case 55: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(55, 56); + break; + case 56: + if (curChar == 45) + jjCheckNAdd(57); + break; + case 57: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(57, 58); + break; + case 58: + if (curChar == 45) + jjCheckNAdd(59); + break; + case 59: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(59, 60); + break; + case 60: + if (curChar == 32) + jjCheckNAdd(61); + break; + case 61: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(61, 62); + break; + case 62: + if (curChar == 58) + jjCheckNAdd(63); + break; + case 63: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(63, 64); + break; + case 64: + if (curChar == 58) + jjCheckNAdd(65); + break; + case 65: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(19, 23); + break; + case 66: + if (curChar == 46) + jjCheckNAddStates(24, 27); + break; + case 67: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(24, 27); + break; + case 69: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(70); + break; + case 70: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(70, 71); + break; + case 71: + if (curChar == 58) + jjCheckNAdd(72); + break; + case 72: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(72, 37); + break; + case 81: + if (curChar == 32) + jjAddStates(28, 29); + break; + case 82: + if (curChar == 39) + jjCheckNAdd(83); + break; + case 83: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(83, 84); + break; + case 84: + if (curChar == 45) + jjCheckNAdd(85); + break; + case 85: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(85, 86); + break; + case 86: + if (curChar == 45) + jjCheckNAdd(87); + break; + case 87: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(87, 88); + break; + case 88: + if (curChar == 32) + jjCheckNAdd(89); + break; + case 89: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(89, 90); + break; + case 90: + if (curChar == 58) + jjCheckNAdd(91); + break; + case 91: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(91, 92); + break; + case 92: + if (curChar == 58) + jjCheckNAdd(93); + break; + case 93: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(30, 34); + break; + case 94: + if (curChar == 46) + jjCheckNAddStates(35, 38); + break; + case 95: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(35, 38); + break; + case 97: + if (curChar == 39 && kind > 83) + kind = 83; + break; + case 98: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(99); + break; + case 99: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(99, 100); + break; + case 100: + if (curChar == 58) + jjCheckNAdd(101); + break; + case 101: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(101, 97); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 0: + if ((0x7fffffe07fffffeL & l) != 0L) + { + if (kind > 60) + kind = 60; + jjCheckNAddTwoStates(5, 4); + } + if (curChar == 84) + jjAddStates(39, 40); + else if (curChar == 68) + jjAddStates(41, 42); + break; + case 2: + jjAddStates(43, 44); + break; + case 4: + if ((0x7fffffe07fffffeL & l) == 0L) + break; + if (kind > 60) + kind = 60; + jjCheckNAddTwoStates(5, 4); + break; + case 5: + if (curChar != 95) + break; + if (kind > 60) + kind = 60; + jjCheckNAddTwoStates(5, 4); + break; + case 7: + jjAddStates(45, 46); + break; + case 12: + jjAddStates(47, 48); + break; + case 21: + if ((0x2000000020L & l) != 0L) + jjAddStates(49, 50); + break; + case 28: + if (curChar == 68) + jjAddStates(41, 42); + break; + case 29: + if (curChar == 69) + jjstateSet[jjnewStateCnt++] = 30; + break; + case 38: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 29; + break; + case 39: + if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 38; + break; + case 40: + if (curChar == 69) + jjstateSet[jjnewStateCnt++] = 41; + break; + case 49: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 40; + break; + case 50: + if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 49; + break; + case 51: + if (curChar == 84) + jjAddStates(39, 40); + break; + case 52: + if (curChar == 80) + jjstateSet[jjnewStateCnt++] = 53; + break; + case 60: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 61; + break; + case 68: + if (curChar == 90) + jjstateSet[jjnewStateCnt++] = 37; + break; + case 73: + if (curChar == 77) + jjstateSet[jjnewStateCnt++] = 52; + break; + case 74: + if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 73; + break; + case 75: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 74; + break; + case 76: + if (curChar == 83) + jjstateSet[jjnewStateCnt++] = 75; + break; + case 77: + if (curChar == 69) + jjstateSet[jjnewStateCnt++] = 76; + break; + case 78: + if (curChar == 77) + jjstateSet[jjnewStateCnt++] = 77; + break; + case 79: + if (curChar == 73) + jjstateSet[jjnewStateCnt++] = 78; + break; + case 80: + if (curChar == 80) + jjstateSet[jjnewStateCnt++] = 81; + break; + case 88: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 89; + break; + case 96: + if (curChar == 90) + jjstateSet[jjnewStateCnt++] = 97; + break; + case 102: + if (curChar == 77) + jjstateSet[jjnewStateCnt++] = 80; + break; + case 103: + if (curChar == 65) + jjstateSet[jjnewStateCnt++] = 102; + break; + case 104: + if (curChar == 84) + jjstateSet[jjnewStateCnt++] = 103; + break; + case 105: + if (curChar == 83) + jjstateSet[jjnewStateCnt++] = 104; + break; + case 106: + if (curChar == 69) + jjstateSet[jjnewStateCnt++] = 105; + break; + case 107: + if (curChar == 77) + jjstateSet[jjnewStateCnt++] = 106; + break; + case 108: + if (curChar == 73) + jjstateSet[jjnewStateCnt++] = 107; + break; + default : break; + } + } while(i != startsAt); + } + else + { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 0: + case 4: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 60) + kind = 60; + jjCheckNAddTwoStates(5, 4); + break; + case 2: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(43, 44); + break; + case 7: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(45, 46); + break; + case 12: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(47, 48); + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 109 - (jjnewStateCnt = startsAt))) + break; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { break; } + } + if (jjmatchedPos > strPos) + return curPos; + + int toRet = Math.max(curPos, seenUpto); + + if (curPos < toRet) + for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; ) + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); } + + if (jjmatchedPos < strPos) + { + jjmatchedKind = strKind; + jjmatchedPos = strPos; + } + else if (jjmatchedPos == strPos && jjmatchedKind > strKind) + jjmatchedKind = strKind; + + return toRet; +} +static final int[] jjnextStates = { + 15, 16, 18, 19, 21, 1, 2, 3, 5, 4, 18, 19, 21, 30, 31, 41, + 42, 53, 54, 65, 66, 68, 69, 37, 67, 68, 69, 37, 81, 82, 93, 94, + 96, 98, 97, 95, 96, 98, 97, 79, 108, 39, 50, 2, 3, 7, 8, 12, + 13, 22, 23, +}; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec4[i2] & l2) != 0L); + case 1: + return ((jjbitVec5[i2] & l2) != 0L); + case 2: + return ((jjbitVec6[i2] & l2) != 0L); + case 3: + return ((jjbitVec7[i2] & l2) != 0L); + case 4: + return ((jjbitVec8[i2] & l2) != 0L); + case 5: + return ((jjbitVec9[i2] & l2) != 0L); + case 6: + return ((jjbitVec10[i2] & l2) != 0L); + case 9: + return ((jjbitVec11[i2] & l2) != 0L); + case 10: + return ((jjbitVec12[i2] & l2) != 0L); + case 11: + return ((jjbitVec13[i2] & l2) != 0L); + case 12: + return ((jjbitVec14[i2] & l2) != 0L); + case 13: + return ((jjbitVec15[i2] & l2) != 0L); + case 14: + return ((jjbitVec16[i2] & l2) != 0L); + case 15: + return ((jjbitVec17[i2] & l2) != 0L); + case 16: + return ((jjbitVec18[i2] & l2) != 0L); + case 17: + return ((jjbitVec19[i2] & l2) != 0L); + case 30: + return ((jjbitVec20[i2] & l2) != 0L); + case 31: + return ((jjbitVec21[i2] & l2) != 0L); + case 33: + return ((jjbitVec22[i2] & l2) != 0L); + case 48: + return ((jjbitVec23[i2] & l2) != 0L); + case 49: + return ((jjbitVec24[i2] & l2) != 0L); + case 159: + return ((jjbitVec25[i2] & l2) != 0L); + case 215: + return ((jjbitVec26[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, "\42", "\45", +"\46", "\47", "\50", "\51", "\52", "\53", "\54", "\55", "\56", "\57", "\72", "\73", +"\74", "\75", "\76", "\77", "\137", "\174", "\133", "\135", null, null, null, null, +null, null, null, null, null, "\74\76", "\76\75", "\74\75", "\174\174", "\56\56", +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, }; +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0x1fffffc07ffffe01L, 0x4000e17e1L, +}; +static final long[] jjtoSkip = { + 0x3eL, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[109]; +private final int[] jjstateSet = new int[218]; +protected char curChar; +public JCRSQLParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} +public JCRSQLParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private final void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 109; i-- > 0;) + jjrounds[i] = 0x80000000; +} +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +public Token getNextToken() +{ + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +} Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTokenManager.java ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTreeConstants.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTreeConstants.java?rev=1210476&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTreeConstants.java (added) +++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTreeConstants.java Mon Dec 5 14:36:46 2011 @@ -0,0 +1,51 @@ +/* Generated By:JJTree: Do not edit this line. /home/jukka/src/jackrabbit/jackrabbit-spi-commons/target/generated-sources/jjtree/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTreeConstants.java */ + +package org.apache.jackrabbit.spi.commons.query.sql; + +public interface JCRSQLParserTreeConstants +{ + public int JJTQUERY = 0; + public int JJTSELECTLIST = 1; + public int JJTVOID = 2; + public int JJTFROMCLAUSE = 3; + public int JJTWHERECLAUSE = 4; + public int JJTPREDICATE = 5; + public int JJTLOWERFUNCTION = 6; + public int JJTUPPERFUNCTION = 7; + public int JJTOREXPRESSION = 8; + public int JJTANDEXPRESSION = 9; + public int JJTNOTEXPRESSION = 10; + public int JJTBRACKETEXPRESSION = 11; + public int JJTCONTAINSEXPRESSION = 12; + public int JJTLITERAL = 13; + public int JJTIDENTIFIER = 14; + public int JJTEXCERPTFUNCTION = 15; + public int JJTORDERBYCLAUSE = 16; + public int JJTORDERSPEC = 17; + public int JJTASCENDINGORDERSPEC = 18; + public int JJTDESCENDINGORDERSPEC = 19; + + + public String[] jjtNodeName = { + "Query", + "SelectList", + "void", + "FromClause", + "WhereClause", + "Predicate", + "LowerFunction", + "UpperFunction", + "OrExpression", + "AndExpression", + "NotExpression", + "BracketExpression", + "ContainsExpression", + "Literal", + "Identifier", + "ExcerptFunction", + "OrderByClause", + "OrderSpec", + "AscendingOrderSpec", + "DescendingOrderSpec", + }; +} Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserTreeConstants.java ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserVisitor.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserVisitor.java?rev=1210476&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserVisitor.java (added) +++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserVisitor.java Mon Dec 5 14:36:46 2011 @@ -0,0 +1,27 @@ +/* Generated By:JJTree: Do not edit this line. /home/jukka/src/jackrabbit/jackrabbit-spi-commons/target/generated-sources/jjtree/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserVisitor.java */ + +package org.apache.jackrabbit.spi.commons.query.sql; + +public interface JCRSQLParserVisitor +{ + public Object visit(SimpleNode node, Object data); + public Object visit(ASTQuery node, Object data); + public Object visit(ASTSelectList node, Object data); + public Object visit(ASTFromClause node, Object data); + public Object visit(ASTWhereClause node, Object data); + public Object visit(ASTPredicate node, Object data); + public Object visit(ASTLowerFunction node, Object data); + public Object visit(ASTUpperFunction node, Object data); + public Object visit(ASTOrExpression node, Object data); + public Object visit(ASTAndExpression node, Object data); + public Object visit(ASTNotExpression node, Object data); + public Object visit(ASTBracketExpression node, Object data); + public Object visit(ASTContainsExpression node, Object data); + public Object visit(ASTLiteral node, Object data); + public Object visit(ASTIdentifier node, Object data); + public Object visit(ASTExcerptFunction node, Object data); + public Object visit(ASTOrderByClause node, Object data); + public Object visit(ASTOrderSpec node, Object data); + public Object visit(ASTAscendingOrderSpec node, Object data); + public Object visit(ASTDescendingOrderSpec node, Object data); +} Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParserVisitor.java ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JJTJCRSQLParserState.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JJTJCRSQLParserState.java?rev=1210476&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JJTJCRSQLParserState.java (added) +++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JJTJCRSQLParserState.java Mon Dec 5 14:36:46 2011 @@ -0,0 +1,123 @@ +/* Generated By:JJTree: Do not edit this line. /home/jukka/src/jackrabbit/jackrabbit-spi-commons/target/generated-sources/jjtree/org/apache/jackrabbit/spi/commons/query/sql/JJTJCRSQLParserState.java */ + +package org.apache.jackrabbit.spi.commons.query.sql; + +class JJTJCRSQLParserState { + private java.util.Stack nodes; + private java.util.Stack marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + JJTJCRSQLParserState() { + nodes = new java.util.Stack(); + marks = new java.util.Stack(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called + automatically by the parser's ReInit() method. */ + void reset() { + nodes.removeAllElements(); + marks.removeAllElements(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call + this after a successful parse. */ + Node rootNode() { + return (Node)nodes.elementAt(0); + } + + /* Pushes a node on to the stack. */ + void pushNode(Node n) { + nodes.push(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + Node popNode() { + if (--sp < mk) { + mk = ((Integer)marks.pop()).intValue(); + } + return (Node)nodes.pop(); + } + + /* Returns the node currently on the top of the stack. */ + Node peekNode() { + return (Node)nodes.peek(); + } + + /* Returns the number of children on the stack in the current node + scope. */ + int nodeArity() { + return sp - mk; + } + + + void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = ((Integer)marks.pop()).intValue(); + } + + + void openNodeScope(Node n) { + marks.push(new Integer(mk)); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of + children. That number of nodes are popped from the stack and + made the children of the definite node. Then the definite node + is pushed on to the stack. */ + void closeNodeScope(Node n, int num) { + mk = ((Integer)marks.pop()).intValue(); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All + the nodes that have been pushed since the node was opened are + made children of the the conditional node, which is then pushed + on to the stack. If the condition is false the node is not + constructed and they are left on the stack. */ + void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = ((Integer)marks.pop()).intValue(); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = ((Integer)marks.pop()).intValue(); + node_created = false; + } + } +} Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JJTJCRSQLParserState.java ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/Node.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/Node.java?rev=1210476&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/Node.java (added) +++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/Node.java Mon Dec 5 14:36:46 2011 @@ -0,0 +1,37 @@ +/* Generated By:JJTree: Do not edit this line. Node.java */ + +package org.apache.jackrabbit.spi.commons.query.sql; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public interface Node { + + /** This method is called after the node has been made the current + node. It indicates that child nodes can now be added to it. */ + public void jjtOpen(); + + /** This method is called after all the child nodes have been + added. */ + public void jjtClose(); + + /** This pair of methods are used to inform the node of its + parent. */ + public void jjtSetParent(Node n); + public Node jjtGetParent(); + + /** This method tells the node to add its argument to the node's + list of children. */ + public void jjtAddChild(Node n, int i); + + /** This method returns a child node. The children are numbered + from zero, left to right. */ + public Node jjtGetChild(int i); + + /** Return the number of children the node has. */ + public int jjtGetNumChildren(); + + /** Accept the visitor. **/ + public Object jjtAccept(JCRSQLParserVisitor visitor, Object data); +} Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/Node.java ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/ParseException.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/ParseException.java?rev=1210476&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/ParseException.java (added) +++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/ParseException.java Mon Dec 5 14:36:46 2011 @@ -0,0 +1,208 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi.commons.query.sql; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. The boolean + * flag "specialConstructor" is also set to true to indicate that + * this constructor was used to create this object. + * This constructor calls its super class with the empty string + * to force the "toString" method of parent class "Throwable" to + * print the error message in the form: + * ParseException: + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(""); + specialConstructor = true; + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + specialConstructor = false; + } + + public ParseException(String message) { + super(message); + specialConstructor = false; + } + + /** + * This variable determines which constructor was used to create + * this object and thereby affects the semantics of the + * "getMessage" method (see below). + */ + protected boolean specialConstructor; + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * This method has the standard behavior when this object has been + * created using the standard constructors. Otherwise, it uses + * "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser), then this method is called during the printing + * of the final stack trace, and hence the correct error message + * gets displayed. + */ + public String getMessage() { + if (!specialConstructor) { + return super.getMessage(); + } + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" "); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += add_escapes(tok.image); + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + protected String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/ParseException.java ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java?rev=1210476&view=auto ============================================================================== --- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java (added) +++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java Mon Dec 5 14:36:46 2011 @@ -0,0 +1,455 @@ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.spi.commons.query.sql; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (without unicode processing). + */ + +public class SimpleCharStream +{ + public static final boolean staticFlag = false; + int bufsize; + int available; + int tokenBegin; + public int bufpos = -1; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } + + + protected void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, + bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos += (bufsize - tokenBegin)); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos -= tokenBegin); + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + + bufsize += 2048; + available = bufsize; + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException + { + if (maxNextCharInd == available) + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = maxNextCharInd = 0; + available = tokenBegin; + } + else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + int i; + try { + if ((i = inputStream.read(buffer, maxNextCharInd, + available - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + --bufpos; + backup(0); + if (tokenBegin == -1) + tokenBegin = bufpos; + throw e; + } + } + + public char BeginToken() throws java.io.IOException + { + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; + + return c; + } + + protected void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (tabSize - (column % tabSize)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + + public char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + if (++bufpos >= maxNextCharInd) + FillBuff(); + + char c = buffer[bufpos]; + + UpdateLineColumn(c); + return (c); + } + + /** + * @deprecated + * @see #getEndColumn + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + /** + * @deprecated + * @see #getEndLine + */ + + public int getLine() { + return bufline[bufpos]; + } + + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + public int getEndLine() { + return bufline[bufpos]; + } + + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + public int getBeginLine() { + return bufline[tokenBegin]; + } + + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + bufpos = -1; + } + + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, 1, 1, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + public String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + public char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + public void Done() + { + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + */ + public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/SimpleCharStream.java ------------------------------------------------------------------------------ svn:eol-style = native