577N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 577N/A * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 577N/A * The contents of this file are subject to the terms of either the GNU 577N/A * General Public License Version 2 only ("GPL") or the Common Development 919N/A * and Distribution License("CDDL") (collectively, the "License"). You 919N/A * may not use this file except in compliance with the License. You can 919N/A * obtain a copy of the License at 919N/A * language governing permissions and limitations under the License. 919N/A * When distributing the software, include this License Header Notice in each 919N/A * GPL Classpath Exception: 919N/A * Oracle designates this particular file as subject to the "Classpath" 919N/A * exception as provided by Oracle in the GPL Version 2 section of the License 919N/A * file that accompanied this code. 919N/A * If applicable, add the following below the License Header, with the fields 577N/A * enclosed by brackets [] replaced by your own identifying information: 577N/A * "Portions Copyright [year] [name of copyright owner]" 577N/A * If you wish your version of this file to be governed by only the CDDL or 577N/A * only the GPL Version 2, indicate your decision by adding "[Contributor] 1072N/A * elects to include this software in this distribution under the [CDDL or GPL 577N/A * Version 2] license." If you don't indicate a single choice of license, a 911N/A * recipient has the option to distribute your version of this file under 1072N/A * either the CDDL, the GPL Version 2 or to extend the choice of license to 1072N/A * its licensees as provided above. However, if you add GPL Version 2 code 911N/A * and therefore, elected the GPL Version 2 license, then the option applies 577N/A * only if the new code is made subject to such option by the copyright 577N/A * Created on March 8, 2000 577N/A//===== Lexical Analyzer Class Definitions ===== 1072N/A * This class defines the lexical analysis for the JQL compiler. FLOAT =
"float";
//NOI18N FALSE =
"false";
//NOI18N COUNT =
"count";
//NOI18N * The width of a tab stop. * This value is used to calculate the correct column in a line * conatining a tab character. protected static final int TABSIZE =
4;
* Report lexer exception errors caught in nextToken() * Lexer error-reporting function * Lexer warning-reporting function :
'\'' (
ESC | ~
'\'' )
'\'' :
'"' (
ESC | ~
'"')*
'"' //NOI18N// escape sequence -- note that this is protected; it can only be called // from another lexer rule -- it will not ever directly return a token to // There are various ambiguities hushed in this rule. The optional // '0'...'9' digit matches should be matched here rather than letting // them go back to STRING_LITERAL to be matched. ANTLR does the // right thing by matching immediately; hence, it's ok to shut off // the FOLLOW ambig warnings. // hexadecimal digit (again, note it's protected!) : (
'0'..
'9'|
'A'..
'F'|
'a'..
'f')
| (
'0' {
isDecimal =
true;}
// special case for just '0' // the 'e'|'E' and float suffix stuff look // like hex digits, hence the (...)+ doesn't // know when to stop: ambig. ANTLR resolves // it correctly by matching immediately. It // is therefor ok to hush warning. | (
'1'..
'9') (
'0'..
'9')* {
isDecimal=
true;}
// non-zero decimal // only check to see if it's a float if looks like decimal so far // a couple protected methods to assist in matching floating point numbers : (
'e'|
'E') (
'+'|
'-')? (
'0'..
'9')+
// an identifier. Note that testLiterals is set to true! This means // that after we match the rule, we look in the literals table to see // if it's a literal or really an identifer // problems using ANTLR feature $setText => use generated code //===== Parser Class Definitions ===== * This class defines the syntax analysis (parser) of the JQL compiler. * @author Michael Bouschen k =
2;
// two token lookahead ASTLabelType =
"JQLAST";
// AST variables are defined as JQLAST // "imaginary" tokens, that have no corresponding real input // special dot expressions // non-standard extensions (operators) protected static final int EOF_CHAR =
65535;
// = (char) -1 = EOF * ANTLR method called when an error was detected. * ANTLR method called when an error was detected. * ANTLR method called when a warning was detected. // no special handling from aboves matches the exception if this line is reached => // make it a syntax error // ---------------------------------- // rules: import declaration // ---------------------------------- // ---------------------------------- // rules: parameter declaration // ---------------------------------- // ---------------------------------- // rules: variables declaration // ---------------------------------- // ---------------------------------- // rules ordering specification // ---------------------------------- // ---------------------------------- // rules result expression // ---------------------------------- // create RESULT_DEF node if there was a projection // skip a possible first distinct in case of an aggregate expr // ---------------------------------- // rules filer expression // ---------------------------------- // This is a list of expressions. // bitwise or logical or | // bitwise or logical and & // boolean relational expressions // qualified names, field access, method invocation // the basic element of an expression // strip quotes from the token text // strip quotes from the token text