com.thoughtworks.qdox.parser.impl.Parser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qdox Show documentation
Show all versions of qdox Show documentation
QDox is a high speed, small footprint parser for extracting class/interface/method definitions from source files
complete with JavaDoc @tags. It is designed to be used by active code generators or documentation tools.
//### This file created by BYACC 1.8(/Java extension 1.15)
//### Java capabilities added 7 Jan 97, Bob Jamison
//### Updated : 27 Nov 97 -- Bob Jamison, Joe Nieten
//### 01 Jan 98 -- Bob Jamison -- fixed generic semantic constructor
//### 01 Jun 99 -- Bob Jamison -- added Runnable support
//### 06 Aug 00 -- Bob Jamison -- made state variables class-global
//### 03 Jan 01 -- Bob Jamison -- improved flags, tracing
//### 16 May 01 -- Bob Jamison -- added custom stack sizing
//### 04 Mar 02 -- Yuval Oren -- improved java performance, added options
//### 14 Mar 02 -- Tomas Hurka -- -d support, static initializer workaround
//### Please send bug reports to [email protected]
//### static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90";
package com.thoughtworks.qdox.parser.impl;
//#line 2 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
/*
* 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.
*/
import com.thoughtworks.qdox.builder.Builder;
import com.thoughtworks.qdox.parser.*;
import com.thoughtworks.qdox.parser.expression.*;
import com.thoughtworks.qdox.parser.structs.*;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
//#line 45 "Parser.java"
public class Parser
implements CommentHandler
{
boolean yydebug; //do I want debug output?
int yynerrs; //number of errors so far
int yyerrflag; //was there an error?
int yychar; //the current working character
//########## MESSAGES ##########
//###############################################################
// method: debug
//###############################################################
void debug(String msg)
{
if (yydebug)
System.out.println(msg);
}
//########## STATE STACK ##########
final static int YYSTACKSIZE = 500; //maximum stack size
int statestk[] = new int[YYSTACKSIZE]; //state stack
int stateptr;
int stateptrmax; //highest index of stackptr
int statemax; //state when highest index reached
//###############################################################
// methods: state stack push,pop,drop,peek
//###############################################################
final void state_push(int state)
{
try {
stateptr++;
statestk[stateptr]=state;
}
catch (ArrayIndexOutOfBoundsException e) {
int oldsize = statestk.length;
int newsize = oldsize * 2;
int[] newstack = new int[newsize];
System.arraycopy(statestk,0,newstack,0,oldsize);
statestk = newstack;
statestk[stateptr]=state;
}
}
final int state_pop()
{
return statestk[stateptr--];
}
final void state_drop(int cnt)
{
stateptr -= cnt;
}
final int state_peek(int relative)
{
return statestk[stateptr-relative];
}
//###############################################################
// method: init_stacks : allocate and prepare stacks
//###############################################################
final boolean init_stacks()
{
stateptr = -1;
val_init();
return true;
}
//###############################################################
// method: dump_stacks : show n levels of the stacks
//###############################################################
void dump_stacks(int count)
{
int i;
System.out.println("=index==state====value= s:"+stateptr+" v:"+valptr);
for (i=0;i moduleTargets = new LinkedList();
private List typeParams = new LinkedList(); //for both JavaClass and JavaMethod
private LinkedList annotationStack = new LinkedList(); // Use LinkedList instead of Stack because it is unsynchronized
private List> annoValueListStack = new LinkedList>(); // Use LinkedList instead of Stack because it is unsynchronized
private List annoValueList = null;
private FieldDef param = new FieldDef();
private java.util.Set modifiers = new java.util.LinkedHashSet();
private TypeDef fieldType;
private TypeVariableDef typeVariable;
private Stack typeStack = new Stack();
private List typeList = new LinkedList();
private int line;
private int column;
private boolean debugLexer;
private void appendToBuffer(String word) {
if (textBuffer.length() > 0) {
char lastChar = textBuffer.charAt(textBuffer.length() - 1);
if (!Character.isWhitespace(lastChar)) {
textBuffer.append(' ');
}
}
textBuffer.append(word);
}
private String buffer() {
String result = textBuffer.toString().trim();
textBuffer.setLength(0);
return result;
}
public Parser( JavaLexer lexer, Builder builder )
{
lexer.addCommentHandler( this );
this.lexer = lexer;
this.builder = builder;
}
public void setDebugParser(boolean debug) {
yydebug = debug;
}
public void setDebugLexer(boolean debug) {
debugLexer = debug;
}
/**
* Parse file. Return true if successful.
*/
public boolean parse() {
return yyparse() == 0;
}
private int yylex() {
try {
final int result = lexer.lex();
yylval = new Value();
yylval.sval = lexer.text();
if (debugLexer) {
System.err.println("Token: " + yyname[result] + " \"" + yylval.sval + "\"");
}
return result;
}
catch(IOException e) {
return 0;
}
}
private void yyerror(String msg) {
throw new ParseException(msg, lexer.getLine(), lexer.getColumn());
}
private class Value {
Object oval;
String sval;
int ival;
boolean bval;
TypeDef type;
ElemValueDef annoval;
}
private void makeField(TypeDef field, String body, boolean enumConstant) {
fd = new FieldDef( field.getName() );
fd.setName(field.getName());
fd.setLineNumber(line);
fd.getModifiers().addAll(modifiers);
fd.setType( fieldType );
fd.setDimensions(field.getDimensions());
fd.setEnumConstant(enumConstant);
fd.setBody(body);
}
public void onComment( String comment, int line, int column ) {
DefaultJavaCommentLexer commentLexer = new DefaultJavaCommentLexer( new java.io.StringReader( comment ) );
commentLexer.setLineOffset( line );
commentLexer.setColumnOffset( column );
DefaultJavaCommentParser commentParser = new DefaultJavaCommentParser( commentLexer, builder);
commentParser.setDebugLexer( this.debugLexer );
commentParser.setDebugParser( this.yydebug );
commentParser.parse();
}
//#line 1748 "Parser.java"
//###############################################################
// method: yylexdebug : check lexer state
//###############################################################
void yylexdebug(int state,int ch)
{
String s=null;
if (ch < 0) ch=0;
if (ch <= YYMAXTOKEN) //check index bounds
s = yyname[ch]; //now get it
if (s==null)
s = "illegal-symbol";
debug("state "+state+", reading "+ch+" ("+s+")");
}
//The following are now global, to aid in error reporting
int yyn; //next next thing to do
int yym; //
int yystate; //current parsing state from state table
String yys; //current token string
//###############################################################
// method: yyparse : parse input and execute indicated items
//###############################################################
int yyparse()
{
boolean doaction;
init_stacks();
yynerrs = 0;
yyerrflag = 0;
yychar = -1; //impossible char forces a read
yystate=0; //initial state
state_push(yystate); //save it
val_push(yylval); //save empty value
while (true) //until parsing is done, either correctly, or w/error
{
doaction=true;
if (yydebug) debug("loop");
//#### NEXT ACTION (from reduction table)
for (yyn=yydefred[yystate];yyn==0;yyn=yydefred[yystate])
{
if (yydebug) debug("yyn:"+yyn+" state:"+yystate+" yychar:"+yychar);
if (yychar < 0) //we want a char?
{
yychar = yylex(); //get next token
if (yydebug) debug(" next yychar:"+yychar);
//#### ERROR CHECK ####
if (yychar < 0) //it it didn't work/error
{
yychar = 0; //change it to default string (no -1!)
if (yydebug)
yylexdebug(yystate,yychar);
}
}//yychar<0
yyn = yysindex[yystate]; //get amount to shift by (shift index)
if ((yyn != 0) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
if (yydebug)
debug("state "+yystate+", shifting to state "+yytable[yyn]);
//#### NEXT STATE ####
yystate = yytable[yyn];//we are in a new state
state_push(yystate); //save it
val_push(yylval); //push our lval as the input for next rule
yychar = -1; //since we have 'eaten' a token, say we need another
if (yyerrflag > 0) //have we recovered an error?
--yyerrflag; //give ourselves credit
doaction=false; //but don't process yet
break; //quit the yyn=0 loop
}
yyn = yyrindex[yystate]; //reduce
if ((yyn !=0 ) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{ //we reduced!
if (yydebug) debug("reduce");
yyn = yytable[yyn];
doaction=true; //get ready to execute
break; //drop down to actions
}
else //ERROR RECOVERY
{
if (yyerrflag==0)
{
yyerror("syntax error");
yynerrs++;
}
if (yyerrflag < 3) //low error count?
{
yyerrflag = 3;
while (true) //do until break
{
if (stateptr<0) //check for under & overflow here
{
yyerror("stack underflow. aborting..."); //note lower case 's'
return 1;
}
yyn = yysindex[state_peek(0)];
if ((yyn != 0) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
if (yydebug)
debug("state "+state_peek(0)+", error recovery shifting to state "+yytable[yyn]+" ");
yystate = yytable[yyn];
state_push(yystate);
val_push(yylval);
doaction=false;
break;
}
else
{
if (yydebug)
debug("error recovery discarding state "+state_peek(0)+" ");
if (stateptr<0) //check for under & overflow here
{
yyerror("Stack underflow. aborting..."); //capital 'S'
return 1;
}
state_pop();
val_pop();
}
}
}
else //discard this token
{
if (yychar == 0)
return 1; //yyabort
if (yydebug)
{
yys = null;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (yys == null) yys = "illegal-symbol";
debug("state "+yystate+", error recovery discards token "+yychar+" ("+yys+")");
}
yychar = -1; //read another
}
}//end error recovery
}//yyn=0 loop
if (!doaction) //any reason not to proceed?
continue; //skip action
yym = yylen[yyn]; //get count of terminals on rhs
if (yydebug)
debug("state "+yystate+", reducing "+yym+" by rule "+yyn+" ("+yyrule[yyn]+")");
if (yym>0) //if count of rhs not 'nil'
yyval = val_peek(yym-1); //get current semantic value
yyval = dup_yyval(yyval); //duplicate yyval if ParserVal is used as semantic value
switch(yyn)
{
//########## USER-SUPPLIED ACTIONS ##########
case 8:
//#line 94 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
ModuleDef module = new ModuleDef(val_peek(0).sval);
module.setOpen(true);
builder.setModule(module);
}
break;
case 10:
//#line 101 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.setModule(new ModuleDef(val_peek(0).sval));
}
break;
case 13:
//#line 112 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
moduleTargets.add(val_peek(0).sval);
}
break;
case 14:
//#line 115 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
moduleTargets.add(val_peek(0).sval);
}
break;
case 15:
//#line 127 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
ModuleDef.RequiresDef req = new ModuleDef.RequiresDef(val_peek(1).sval, modifiers);
modifiers = new java.util.LinkedHashSet();
req.setLineNumber(line);
builder.addRequires(req);
}
break;
case 16:
//#line 134 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
exp = new ModuleDef.ExportsDef(val_peek(0).sval);
exp.setLineNumber(line);
}
break;
case 17:
//#line 139 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
exp.getTargets().addAll(moduleTargets);
moduleTargets = new LinkedList();
builder.addExports(exp);
}
break;
case 18:
//#line 145 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
opn = new ModuleDef.OpensDef(val_peek(0).sval);
opn.setLineNumber(line);
}
break;
case 19:
//#line 150 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
opn.getTargets().addAll(moduleTargets);
moduleTargets = new LinkedList();
builder.addOpens(opn);
}
break;
case 20:
//#line 155 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
ModuleDef.UsesDef uss = new ModuleDef.UsesDef(val_peek(1).type);
uss.setLineNumber(line);
builder.addUses(uss);
}
break;
case 21:
//#line 161 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
prv = new ModuleDef.ProvidesDef(val_peek(0).type);
prv.setLineNumber(line);
}
break;
case 22:
//#line 166 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
prv.getImplementations().addAll(typeList);
builder.addProvides(prv);
}
break;
case 25:
//#line 175 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{ modifiers.add("transitive"); }
break;
case 26:
//#line 176 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{ modifiers.add("static"); }
break;
case 31:
//#line 191 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
line = lexer.getLine();
}
break;
case 32:
//#line 195 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.addPackage(new PackageDef(val_peek(1).sval, line));
}
break;
case 37:
//#line 214 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.addImport( val_peek(1).sval );
}
break;
case 38:
//#line 222 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.addImport( val_peek(3).sval + ".*" );
}
break;
case 39:
//#line 230 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.addImport( "static " + val_peek(1).sval);
}
break;
case 40:
//#line 238 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.addImport( "static " + val_peek(3).sval + ".*" );
}
break;
case 46:
//#line 266 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.setType(ClassDef.CLASS);
cls.setLineNumber(lexer.getLine());
cls.getModifiers().addAll(modifiers); modifiers.clear();
cls.setName( val_peek(0).sval );
}
break;
case 47:
//#line 273 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.setTypeParameters(typeParams);
builder.beginClass(cls);
cls = new ClassDef();
}
break;
case 48:
//#line 279 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.endClass();
}
break;
case 49:
//#line 287 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeParams = new LinkedList();
}
break;
case 56:
//#line 306 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.getExtends().add(val_peek(0).type);
}
break;
case 58:
//#line 315 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.getImplements().addAll( typeList );
}
break;
case 66:
//#line 344 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
line = lexer.getLine();
}
break;
case 73:
//#line 366 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
fieldType = val_peek(1).type;
/* we're doing some lexer magic: lexer.getCodeBody() contains [= VariableInitializer]*/
makeField(val_peek(0).type, lexer.getCodeBody(), false);
builder.beginField(fd);
builder.endField();
}
break;
case 74:
//#line 374 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.clear();
}
break;
case 76:
//#line 381 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
line = lexer.getLine();
}
break;
case 77:
//#line 385 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
/* we're doing some lexer magic: lexer.getCodeBody() contains [= VariableInitializer]*/
makeField(val_peek(0).type, lexer.getCodeBody(), false);
builder.beginField(fd);
builder.endField();
}
break;
case 78:
//#line 396 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef(val_peek(1).sval,val_peek(0).ival);
}
break;
case 79:
//#line 404 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.setBody(val_peek(0).sval);
builder.endMethod(mth);
mth = new MethodDef();
}
break;
case 82:
//#line 425 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.beginMethod();
mth.setLineNumber(lexer.getLine());
mth.getModifiers().addAll(modifiers); modifiers.clear();
mth.setTypeParams(typeParams);
mth.setReturnType(val_peek(1).type);
mth.setName(val_peek(0).sval);
}
break;
case 83:
//#line 434 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.setDimensions(val_peek(1).ival);
}
break;
case 84:
//#line 438 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.beginMethod();
mth.setLineNumber(lexer.getLine());
mth.getModifiers().addAll(modifiers); modifiers.clear();
mth.setTypeParams(typeParams);
mth.setReturnType(val_peek(1).type);
mth.setName(val_peek(0).sval);
}
break;
case 85:
//#line 447 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.setDimensions(val_peek(1).ival);
}
break;
case 86:
//#line 451 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.beginMethod();
mth.setLineNumber(lexer.getLine());
mth.getModifiers().addAll(modifiers); modifiers.clear();
mth.setReturnType(val_peek(1).type);
mth.setName(val_peek(0).sval);
}
break;
case 87:
//#line 459 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.setDimensions(val_peek(1).ival);
}
break;
case 94:
//#line 485 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
param.getModifiers().addAll(modifiers); modifiers.clear();
param.setType(val_peek(1).type);
param.setName(val_peek(0).type.getName());
param.setDimensions(val_peek(0).type.getDimensions());
param.setVarArgs(false);
builder.addParameter(param);
param = new FieldDef();
}
break;
case 95:
//#line 500 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
param.getModifiers().addAll(modifiers); modifiers.clear();
param.setType(val_peek(2).type);
param.setName(val_peek(0).type.getName());
param.setDimensions(val_peek(0).type.getDimensions());
param.setVarArgs(true);
builder.addParameter(param);
param = new FieldDef();
}
break;
case 99:
//#line 525 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.getExceptions().add(val_peek(0).type);
}
break;
case 100:
//#line 529 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.getExceptions().add(val_peek(0).type);
}
break;
case 101:
//#line 538 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.sval = lexer.getCodeBody();
}
break;
case 102:
//#line 542 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.sval = "";
}
break;
case 103:
//#line 558 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
InitDef def = new InitDef();
def.setStatic(modifiers.contains("static"));modifiers.clear();
def.setBlockContent(lexer.getCodeBody());
builder.addInitializer(def);
}
break;
case 104:
//#line 569 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.beginConstructor();
mth.setLineNumber(lexer.getLine());
mth.getModifiers().addAll(modifiers); modifiers.clear();
mth.setConstructor(true);
mth.setName(val_peek(0).sval);
}
break;
case 105:
//#line 577 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.setBody(val_peek(0).sval);
builder.endConstructor(mth);
mth = new MethodDef();
}
break;
case 106:
//#line 583 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.beginConstructor();
mth.setLineNumber(lexer.getLine());
mth.setTypeParams(typeParams);
mth.getModifiers().addAll(modifiers); modifiers.clear();
mth.setConstructor(true);
mth.setName(val_peek(0).sval);
}
break;
case 107:
//#line 592 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
mth.setBody(lexer.getCodeBody());
builder.endConstructor(mth);
mth = new MethodDef();
}
break;
case 108:
//#line 613 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.setLineNumber(line);
cls.getModifiers().addAll(modifiers);
cls.setName( val_peek(1).sval );
cls.setType(ClassDef.ENUM);
builder.beginClass(cls);
cls = new ClassDef();
fieldType = new TypeDef(val_peek(1).sval, 0);
}
break;
case 110:
//#line 631 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.endClass();
fieldType = null;
modifiers.clear();
}
break;
case 114:
//#line 652 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
TypeDef td = new TypeDef(val_peek(0).sval, 0);
typeStack.push(td);
makeField( td, "", true );
builder.beginField( fd );
}
break;
case 115:
//#line 659 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.endField();
typeStack.pop();
}
break;
case 120:
//#line 685 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.setType(ClassDef.INTERFACE);
cls.setLineNumber(line);
cls.getModifiers().addAll(modifiers); modifiers.clear();
cls.setName( val_peek(2).sval );
cls.setTypeParameters(typeParams);
builder.beginClass(cls);
cls = new ClassDef();
}
break;
case 121:
//#line 695 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.endClass();
}
break;
case 122:
//#line 703 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.getExtends().addAll( typeList );
typeList.clear();
}
break;
case 125:
//#line 734 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
cls.setType(ClassDef.ANNOTATION_TYPE);
cls.setLineNumber(line);
cls.getModifiers().addAll(modifiers); modifiers.clear();
cls.setName( val_peek(0).sval );
builder.beginClass(cls);
cls = new ClassDef();
}
break;
case 126:
//#line 743 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.endClass();
}
break;
case 127:
//#line 775 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
AnnoDef annotation = new AnnoDef( new TypeDef(val_peek(0).sval) );
annotation.setLineNumber(lexer.getLine());
annotationStack.addFirst(annotation);
}
break;
case 128:
//#line 781 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
AnnoDef annotation = annotationStack.removeFirst();
if(annotationStack.isEmpty())
{
builder.addAnnotation(annotation);
}
yyval.annoval = annotation;
}
break;
case 131:
//#line 800 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
annotationStack.getFirst().getArgs().put(val_peek(2).sval, val_peek(0).annoval);
}
break;
case 135:
//#line 820 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
annoValueListStack.add(annoValueList);
annoValueList = new LinkedList();
}
break;
case 136:
//#line 825 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ElemValueListDef(annoValueList);
annoValueList = annoValueListStack.remove(annoValueListStack.size() - 1);
}
break;
case 139:
//#line 838 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
annotationStack.getFirst().getArgs().put("value", val_peek(0).annoval);
}
break;
case 141:
//#line 846 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
annoValueList.add(val_peek(0).annoval);
}
break;
case 155:
//#line 902 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new TypeRefDef(new TypeDef(val_peek(3).type.getName(), val_peek(2).ival));
}
break;
case 156:
//#line 906 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ParenExpressionDef(val_peek(1).annoval);
}
break;
case 158:
//#line 911 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new TypeRefDef(new TypeDef(val_peek(2).sval, 0));
}
break;
case 159:
//#line 915 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new TypeRefDef(new TypeDef(val_peek(3).sval, val_peek(2).ival));
}
break;
case 162:
//#line 921 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new FieldRefDef(val_peek(0).sval);
}
break;
case 163:
//#line 932 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
CreatorDef creator = new CreatorDef();
creator.setCreatedName( val_peek(5).sval );
yyval.annoval = creator;
}
break;
case 164:
//#line 938 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
CreatorDef creator = new CreatorDef();
creator.setCreatedName( val_peek(5).sval );
yyval.annoval = creator;
}
break;
case 171:
//#line 975 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodInvocationDef(val_peek(3).sval, null);
}
break;
case 172:
//#line 979 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodInvocationDef(val_peek(3).sval, null);
}
break;
case 173:
//#line 983 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodInvocationDef(val_peek(6).sval, null);
}
break;
case 174:
//#line 987 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodInvocationDef("super." + val_peek(6).sval, null);
}
break;
case 175:
//#line 991 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodInvocationDef(val_peek(8).sval + ".super", null);
}
break;
case 176:
//#line 999 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.addArgument( (ExpressionDef) val_peek(0).annoval);
}
break;
case 177:
//#line 1003 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
builder.addArgument( (ExpressionDef) val_peek(0).annoval);
}
break;
case 180:
//#line 1020 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodReferenceDef();
}
break;
case 181:
//#line 1024 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodReferenceDef();
}
break;
case 182:
//#line 1028 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodReferenceDef();
}
break;
case 183:
//#line 1032 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MethodReferenceDef();
}
break;
case 184:
//#line 1043 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
CreatorDef creator = new CreatorDef();
creator.setCreatedName( val_peek(2).type.getName() );
yyval.annoval = creator;
}
break;
case 185:
//#line 1049 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
CreatorDef creator = new CreatorDef();
creator.setCreatedName( val_peek(2).type.getName() );
yyval.annoval = creator;
}
break;
case 186:
//#line 1055 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
CreatorDef creator = new CreatorDef();
creator.setCreatedName( val_peek(2).type.getName() );
yyval.annoval = creator;
}
break;
case 187:
//#line 1061 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
CreatorDef creator = new CreatorDef();
creator.setCreatedName( val_peek(2).type.getName() );
yyval.annoval = creator;
}
break;
case 194:
//#line 1110 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new AssignmentDef(val_peek(2).annoval, val_peek(1).sval, val_peek(0).annoval);
}
break;
case 195:
//#line 1120 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new FieldRefDef(val_peek(0).sval);
}
break;
case 209:
//#line 1157 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new QueryDef(val_peek(4).annoval, val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 211:
//#line 1167 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new LogicalOrDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 213:
//#line 1177 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new LogicalAndDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 215:
//#line 1187 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new OrDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 217:
//#line 1197 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ExclusiveOrDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 219:
//#line 1207 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new AndDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 221:
//#line 1218 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new EqualsDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 222:
//#line 1222 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new NotEqualsDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 224:
//#line 1236 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new LessThanDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 225:
//#line 1240 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new GreaterThanDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 226:
//#line 1244 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new LessEqualsDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 227:
//#line 1248 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new GreaterEqualsDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 229:
//#line 1260 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ShiftLeftDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 230:
//#line 1264 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ShiftRightDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 231:
//#line 1268 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new UnsignedShiftRightDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 233:
//#line 1279 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new AddDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 234:
//#line 1283 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new SubtractDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 236:
//#line 1295 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MultiplyDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 237:
//#line 1299 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new DivideDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 238:
//#line 1303 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new RemainderDef(val_peek(2).annoval, val_peek(0).annoval);
}
break;
case 241:
//#line 1317 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new PlusSignDef(val_peek(0).annoval);
}
break;
case 242:
//#line 1321 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new MinusSignDef(val_peek(0).annoval);
}
break;
case 244:
//#line 1330 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new PreIncrementDef(val_peek(0).annoval);
}
break;
case 245:
//#line 1338 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new PreDecrementDef(val_peek(0).annoval);
}
break;
case 247:
//#line 1350 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new NotDef(val_peek(0).annoval);
}
break;
case 248:
//#line 1354 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new LogicalNotDef(val_peek(0).annoval);
}
break;
case 253:
//#line 1373 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new PostIncrementDef(val_peek(1).annoval);
}
break;
case 254:
//#line 1381 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new PostDecrementDef(val_peek(1).annoval);
}
break;
case 255:
//#line 1391 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new CastDef(new TypeDef(val_peek(3).type.getName(), val_peek(2).ival), val_peek(0).annoval);
}
break;
case 256:
//#line 1395 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new CastDef(new TypeDef(val_peek(2).sval, 0), val_peek(0).annoval);
}
break;
case 257:
//#line 1399 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new CastDef(new TypeDef(val_peek(3).sval, val_peek(2).ival), val_peek(0).annoval);
}
break;
case 262:
//#line 1451 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
TypeDef td = val_peek(1).type;
td.setDimensions(val_peek(0).ival);
yyval.type = td;
}
break;
case 263:
//#line 1457 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
TypeDef td = val_peek(1).type;
td.setDimensions(val_peek(0).ival);
yyval.type = td;
}
break;
case 264:
//#line 1467 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.ival = 1;
}
break;
case 265:
//#line 1471 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.ival = val_peek(2).ival + 1;
}
break;
case 266:
//#line 1474 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.ival = 0;
}
break;
case 268:
//#line 1483 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeVariable = new TypeVariableDef(val_peek(0).sval);
typeVariable.setBounds(new LinkedList());
}
break;
case 269:
//#line 1488 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeParams.add(typeVariable);
typeVariable = null;
}
break;
case 270:
//#line 1497 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeVariable.setBounds(new LinkedList());
typeVariable.getBounds().add(val_peek(0).type);
}
break;
case 274:
//#line 1510 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeVariable.getBounds().add(val_peek(0).type);
}
break;
case 277:
//#line 1521 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeStack.peek().setActualArgumentTypes(new LinkedList());
}
break;
case 281:
//#line 1533 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
(typeStack.peek()).getActualArgumentTypes().add(val_peek(0).type);
}
break;
case 282:
//#line 1537 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
(typeStack.peek()).getActualArgumentTypes().add(val_peek(0).type);
}
break;
case 285:
//#line 1552 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = val_peek(0).type;
}
break;
case 286:
//#line 1556 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new WildcardTypeDef();
}
break;
case 287:
//#line 1565 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new WildcardTypeDef(val_peek(0).type, "extends" );
}
break;
case 288:
//#line 1569 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new WildcardTypeDef(val_peek(0).type, "super" );
}
break;
case 290:
//#line 1579 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.sval = val_peek(2).sval + '.' + val_peek(0).sval;
}
break;
case 291:
//#line 1605 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("byte");
}
break;
case 292:
//#line 1609 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("short");
}
break;
case 293:
//#line 1613 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("char");
}
break;
case 294:
//#line 1617 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("int");
}
break;
case 295:
//#line 1621 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("long");
}
break;
case 296:
//#line 1625 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("float");
}
break;
case 297:
//#line 1629 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("double");
}
break;
case 298:
//#line 1633 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = new TypeDef("boolean");
}
break;
case 299:
//#line 1644 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
TypeDef td = new TypeDef(val_peek(0).sval,0);
yyval.type = typeStack.push(td);
}
break;
case 300:
//#line 1649 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.type = typeStack.pop();
}
break;
case 302:
//#line 1657 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.sval = val_peek(2).type.getName() + '.' + val_peek(0).sval;
}
break;
case 303:
//#line 1670 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeList.add( val_peek(0).type );
}
break;
case 304:
//#line 1674 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
typeList.add( val_peek(0).type );
}
break;
case 308:
//#line 1697 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("public");
}
break;
case 309:
//#line 1701 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("protected");
}
break;
case 310:
//#line 1705 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("private");
}
break;
case 311:
//#line 1709 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("static");
}
break;
case 312:
//#line 1713 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("final");
}
break;
case 313:
//#line 1717 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("abstract");
}
break;
case 314:
//#line 1721 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("native");
}
break;
case 315:
//#line 1725 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("synchronized");
}
break;
case 316:
//#line 1729 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("volatile");
}
break;
case 317:
//#line 1733 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("transient");
}
break;
case 318:
//#line 1737 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("strictfp");
}
break;
case 319:
//#line 1741 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
modifiers.add("default");
}
break;
case 322:
//#line 1764 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ConstantDef(val_peek(0).sval, Integer.class);
}
break;
case 323:
//#line 1768 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ConstantDef(val_peek(0).sval, Float.class);
}
break;
case 324:
//#line 1772 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
String s = lexer.getCodeBody();
yyval.annoval = new ConstantDef(s, Character.class);
}
break;
case 325:
//#line 1777 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
String s = lexer.getCodeBody();
yyval.annoval = new ConstantDef(s, String.class);
}
break;
case 326:
//#line 1782 "E:\java-workspace\github\qdox\target\checkout/src/grammar/parser.y"
{
yyval.annoval = new ConstantDef(val_peek(0).sval, Boolean.class);
}
break;
//#line 3027 "Parser.java"
//########## END OF USER-SUPPLIED ACTIONS ##########
}//switch
//#### Now let's reduce... ####
if (yydebug) debug("reduce");
state_drop(yym); //we just reduced yylen states
yystate = state_peek(0); //get new state
val_drop(yym); //corresponding value drop
yym = yylhs[yyn]; //select next TERMINAL(on lhs)
if (yystate == 0 && yym == 0)//done? 'rest' state and at first TERMINAL
{
if (yydebug) debug("After reduction, shifting from state 0 to state "+YYFINAL+"");
yystate = YYFINAL; //explicitly say we're done
state_push(YYFINAL); //and save it
val_push(yyval); //also save the semantic value of parsing
if (yychar < 0) //we want another character?
{
yychar = yylex(); //get next character
if (yychar<0) yychar=0; //clean, if necessary
if (yydebug)
yylexdebug(yystate,yychar);
}
if (yychar == 0) //Good exit (if lex returns 0 ;-)
break; //quit the loop--all DONE
}//if yystate
else //else not done yet
{ //get next state and push, for next yydefred[]
yyn = yygindex[yym]; //find out where to go
if ((yyn != 0) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
yystate = yytable[yyn]; //get new state
else
yystate = yydgoto[yym]; //else go to new defred
if (yydebug) debug("after reduction, shifting from state "+state_peek(0)+" to state "+yystate+"");
state_push(yystate); //going again, so push state & val...
val_push(yyval); //for next action
}
}//main loop
return 0;//yyaccept!!
}
//## end of method parse() ######################################
//## run() --- for Thread #######################################
//## The -Jnorun option was used ##
//## end of method run() ########################################
//## Constructors ###############################################
//## The -Jnoconstruct option was used ##
//###############################################################
}
//################### END OF CLASS ##############################