Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
October 2009
- 3 participants
- 80 discussions
r1600 - in branches/jaxx-2.X/jaxx-demo/src: main/java/jaxx/demo main/java/jaxx/demo/component/jaxx/editor main/java/jaxx/demo/component/jaxx/navigation main/java/jaxx/demo/component/jaxx/navigation/content main/java/jaxx/demo/component/jaxx/navigation/item main/java/jaxx/demo/feature/validation main/java/jaxx/demo/fun test/java/jaxx/demo
by tchemit@users.nuiton.org 26 Oct '09
by tchemit@users.nuiton.org 26 Oct '09
26 Oct '09
Author: tchemit
Date: 2009-10-26 20:08:21 +0100 (Mon, 26 Oct 2009)
New Revision: 1600
Modified:
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java
branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java
branches/jaxx-2.X/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java
Log:
update license header
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/**
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,3 +1,23 @@
+/*
+ * *##%
+ * JAXX Demo
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
package jaxx.demo.component.jaxx.navigation;
import jaxx.runtime.JAXXContext;
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,3 +1,23 @@
+/*
+ * *##%
+ * JAXX Demo
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
package jaxx.demo.component.jaxx.navigation.content;
import java.util.List;
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,6 +1,6 @@
/*
* *##%
- * jaxx-demo
+ * JAXX Demo
* Copyright (C) 2008 - 2009 CodeLutin
*
* This program is free software: you can redistribute it and/or modify
Modified: branches/jaxx-2.X/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java
===================================================================
--- branches/jaxx-2.X/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java 2009-10-26 02:47:48 UTC (rev 1599)
+++ branches/jaxx-2.X/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java 2009-10-26 19:08:21 UTC (rev 1600)
@@ -1,3 +1,23 @@
+/*
+ * *##%
+ * JAXX Demo
+ * Copyright (C) 2008 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * ##%*
+ */
package jaxx.demo;
import jaxx.demo.feature.validation.Model;
1
0
Author: tchemit
Date: 2009-10-26 03:47:48 +0100 (Mon, 26 Oct 2009)
New Revision: 1599
Modified:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java
branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx
Log:
- remove commented unused code, clean code, add javadoc
- improve warning and error management in JAXXEngine and plugin
- improve databinding generation (do not test nullity on root object)
- remove when possible the root object prefix in method invocation
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -17,6 +17,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang.StringUtils;
/**
* Represents an object in the <code>.java</code> file being generated during compilation. There is
@@ -25,21 +26,34 @@
*/
public class CompiledObject {
- /** The object's id. */
+ /**
+ * The object's id.
+ */
private String id;
- /** Java code referring to the object. */
+ /**
+ * Java code referring to the object.
+ */
private String javaCode;
- /** The object's class. */
+ /**
+ * The object's class.
+ */
private ClassDescriptor objectClass;
- /** The style class. */
+ /**
+ * The style class.
+ */
private String styleClass;
- /** The container containing this CompiledObject. */
+ /**
+ * The container containing this CompiledObject.
+ */
private CompiledObject parent;
- /** true if this object overrides an object of the same id in a superclass of the object being compiled */
+ /**
+ * true if this object overrides an object of the same id in a superclass
+ * of the object being compiled
+ */
private boolean override;
/**
- * Comma-separated Java code snippets representing the parameters that should be passed to the object's
- * constructor.
+ * Comma-separated Java code snippets representing the parameters that
+ * should be passed to the object's constructor.
*/
private String constructorParams;
/**
@@ -54,17 +68,30 @@
* CompiledObjects from initializationCode -- you must refer to them from additionCode instead.
*/
private StringBuffer additionCode = new StringBuffer();
- /** List of all registered event handlers. */
+ /**
+ * List of all registered event handlers.
+ */
private List<EventHandler> eventHandlers = new ArrayList<EventHandler>();
- /** All properties that have been applied to this CompiledObject. */
+ /**
+ * All properties that have been applied to this CompiledObject.
+ */
private Map<String, String> properties = new HashMap<String, String>();
- /** generic types of the compiled object */
+ /**
+ * generic types of the compiled object
+ */
private String[] genericTypes;
- /** a flag to indicate if javaBean full support must be support for this object by root object */
+ /**
+ * a flag to indicate if javaBean full support must be support for this
+ * object by root object
+ */
private boolean javaBean;
- /** code to initialize the bean (can be null) */
+ /**
+ * code to initialize the bean (can be null)
+ */
private String javaBeanInitCode;
- /** the type of the override object (can be null if no oveeride) */
+ /**
+ * the type of the override object (can be null if no overide)
+ */
private ClassDescriptor overrideType;
/**
* the decorator
@@ -121,11 +148,20 @@
this.delegateCode = delegateCode;
}
- public void addToAdditionCode(StringBuffer buffer) {
+ public void addToAdditionCode(StringBuffer buffer, boolean isRootObject) {
+ //TC-20091026 do not prefix if on root object
+ String prefix;
+ if (isRootObject) {
+ prefix = "";
+ } else {
+ prefix = javaCode + delegateCode + ".";
+ }
if (constraints != null) {
- buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(", ").append(constraints).append(");");
+// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(", ").append(constraints).append(");");
+ buffer.append(prefix).append("add(").append(childJavaCode).append(", ").append(constraints).append(");");
} else {
- buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(");");
+// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(");");
+ buffer.append(prefix).append("add(").append(childJavaCode).append(");");
}
buffer.append(JAXXCompiler.getLineSeparator());
}
@@ -209,8 +245,9 @@
}
/**
- * True if this object overrides an object in the superclass of the class being compiled. For this to be true, the
- * class currently being compiled must be a subclass of another <code>JAXXObject</code> which has an
+ * True if this object overrides an object in the superclass of the class
+ * being compiled. For this to be true, the class currently being compiled
+ * must be a subclass of another <code>JAXXObject</code> which has an
* identically-named object.
*
* @return <code>true</code> if this object is an override
@@ -221,7 +258,8 @@
}
/**
- * Sets whether this class overrides an identically-named object in the parent class.
+ * Sets whether this class overrides an identically-named object in the
+ * parent class.
*
* @param override <code>true</code> if this object is an override
* @see #isOverride
@@ -249,7 +287,8 @@
}
/**
- * Returns this object's parent container. Non-visual components (and the root container) return <code>null</code>.
+ * Returns this object's parent container. Non-visual components (and
+ * the root container) return <code>null</code>.
*
* @return the object's parent container
*/
@@ -261,8 +300,9 @@
* Sets this object's parent container.
*
* @param parent the parent container
+ * @throws IllegalArgumentException if parent is not a {@link Container}
*/
- public void setParent(CompiledObject parent) {
+ public void setParent(CompiledObject parent) throws IllegalArgumentException {
if (!ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) {
throw new IllegalArgumentException("parent must descend from java.awt.Container");
}
@@ -270,23 +310,26 @@
}
/**
- * Returns the name of the method that should be generated in the compiled <code>.java</code> file
- * in order to create this object. This is just a suggestion and may be ignored.
+ * Returns the name of the method that should be generated in the compiled
+ * <code>.java</code> file
+ * in order to create this object. This is just a suggestion and may be
+ * ignored.
*
* @return the suggested name of the method which initializes this object
*/
public String getCreationMethodName() {
- return "create" + org.apache.commons.lang.StringUtils.capitalize(getId());
+ return "create" + StringUtils.capitalize(getId());
}
/**
- * Returns the name of the method that should be generated in the compiled <code>.java</code> file
- * in order to add children to this object. This is just a suggestion and may be ignored.
+ * Returns the name of the method that should be generated in the compiled
+ * <code>.java</code> file in order to add children to this object. This
+ * is just a suggestion and may be ignored.
*
* @return the suggested name of the method which completes this object's setup
*/
public String getAdditionMethodName() {
- return "addChildrenTo" + org.apache.commons.lang.StringUtils.capitalize(getId());
+ return "addChildrenTo" + StringUtils.capitalize(getId());
}
/**
@@ -299,7 +342,8 @@
}
/**
- * Returns this object's id. Generally, a field with this name will be created in the compiled <code>.java</code>
+ * Returns this object's id. Generally, a field with this name will be
+ * created in the compiled <code>.java</code>
* file in order to represent this object.
*
* @return the id used to refer to this object
@@ -309,8 +353,8 @@
}
/**
- * Returns Java code used to refer to this object in the compiled Java file. This is usually the same as its
- * id.
+ * Returns Java code used to refer to this object in the compiled Java file.
+ * This is usually the same as its id.
*
* @return the Java code for this object
*/
@@ -329,7 +373,7 @@
}
String result = "((" + JAXXCompiler.getCanonicalName(getObjectClass()) + ") " + javaCode + ")";
- String methodName = org.apache.commons.lang.StringUtils.capitalize(property);
+ String methodName = StringUtils.capitalize(property);
try {
MethodDescriptor methodDescriptor = overrideType.getMethodDescriptor("get" + methodName);
if (methodDescriptor != null) {
@@ -345,8 +389,8 @@
}
/**
- * Returns a list of comma-separated Java code snippets that represent the parameters to pass to this
- * object's constructor.
+ * Returns a list of comma-separated Java code snippets that represent the
+ * parameters to pass to this object's constructor.
*
* @return the raw constructor params
* @see #setConstructorParams
@@ -358,7 +402,8 @@
/**
* Sets the parameters to pass to this object's constructor.
*
- * @param constructorParams comma-separated Java code snippets representing constructor params
+ * @param constructorParams comma-separated Java code snippets representing
+ * constructor params
* @see #getConstructorParams
*/
public void setConstructorParams(String constructorParams) {
@@ -366,9 +411,10 @@
}
/**
- * Returns the code that performs basic initialization of this object, after it has already been constructed.
- * This basic code should not reference any other <code>CompiledObjects</code> as they may not have
- * been created yet.
+ * Returns the code that performs basic initialization of this object,
+ * after it has already been constructed.
+ * This basic code should not reference any other
+ * <code>CompiledObjects</code> as they may not have been created yet.
*
* @param compiler compiler to use
* @return the code which initializes this object
@@ -385,15 +431,18 @@
protected String getInitializationCode(EventHandler handler, JAXXCompiler compiler) {
MethodDescriptor addMethod = handler.getAddMethod();
ClassDescriptor listenerClass = addMethod.getParameterTypes()[0];
+ //TC-20091026 use 'this' instead of root object javaCode
return getJavaCode() + '.' + addMethod.getName() + "((" + JAXXCompiler.getCanonicalName(listenerClass) +
") jaxx.runtime.Util.getEventListener(" + JAXXCompiler.getCanonicalName(listenerClass) + ".class, " +
- compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " +
+ compiler.getJavaCode(handler.getListenerMethod().getName()) + ", this, " +
+ // compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " +
compiler.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator();
}
/**
- * Returns Java code to complete final setup on this object. This code may reference other
- * <code>CompiledObjects</code>, as they are guaranteed to have all been created by this point.
+ * Returns Java code to complete final setup on this object. This code may
+ * reference other <code>CompiledObjects</code>, as they are guaranteed to
+ * have all been created by this point.
*
* @return code which adds children and performs final setup
*/
@@ -402,7 +451,8 @@
}
/**
- * Appends code to the initialization code block. A line separator is automatically appended to the end.
+ * Appends code to the initialization code block. A line separator is
+ * automatically appended to the end.
*
* @param code the code to add to the initialization block
* @see #getInitializationCode
@@ -415,7 +465,8 @@
}
/**
- * Appends code to the addition code block. A line separator is automatically appended to the end.
+ * Appends code to the addition code block. A line separator is
+ * automatically appended to the end.
*
* @param code the code to add to the addition block
* @see #getAdditionCode
@@ -428,8 +479,8 @@
}
/**
- * Stores a property for this object. The only effect of calling this method is that the property will
- * be returned by <code>getProperties()</code>.
+ * Stores a property for this object. The only effect of calling this
+ * method is that the property will be returned by {@code getProperties()}.
*
* @param property the name of the property
* @param value the property's value
@@ -486,7 +537,8 @@
}
/**
- * Adds an event listener to this object. The generated code will appear in the initialization block.
+ * Adds an event listener to this object. The generated code will appear
+ * in the initialization block.
*
* @param eventId unique (per CompiledObject) identifier for the event handler
* @param addMethod the method which adds the event listener
@@ -500,13 +552,15 @@
compiler.registerEventHandler(handler);
eventHandlers.add(handler);
- if (getJavaCode().indexOf(".") != -1) { // object lives in another JAXX file and consequently its initialization code won't be output
+ if (getJavaCode().indexOf(".") != -1) {
+ // object lives in another JAXX file and consequently its initialization code won't be output
compiler.appendInitializerCode(getInitializationCode(handler, compiler));
}
}
/**
- * Adds a child component to this container. The child is added without layout constraints.
+ * Adds a child component to this container. The child is added without
+ * layout constraints.
*
* @param child the component to add
* @param compiler the current <code>JAXXCompiler</code>
@@ -518,8 +572,8 @@
}
/**
- * Adds a child component to this container. This variant allows the Java code for a layout constraints
- * object to be specified.
+ * Adds a child component to this container. This variant allows the Java
+ * code for a layout constraints object to be specified.
*
* @param child the component to add
* @param constraints Java code for the layout constraints object
@@ -538,7 +592,8 @@
if (!child.isOverride()) {
TagHandler tagHandler = TagManager.getTagHandler(getObjectClass());
- if (tagHandler instanceof DefaultComponentHandler && !((DefaultComponentHandler) tagHandler).isContainer()) {
+ if (tagHandler instanceof DefaultComponentHandler &&
+ !((DefaultComponentHandler) tagHandler).isContainer()) {
compiler.reportError("component " + this + " may not have children");
}
@@ -556,10 +611,6 @@
return getObjectClass().getName() + "[id='" + id + "']";
}
-// public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException {
-// compiler.registerDataBinding(src, getId() + "." + property, assignment);
-// }
-
public String getGenericTypes() {
if (getGenericTypesLength() == 0) {
// not using it
@@ -619,19 +670,18 @@
this.decorator = decorator;
}
- public void finalizeCompiler() {
- StringBuffer buffer = new StringBuffer();
+ public void finalizeCompiler(JAXXCompiler compiler) {
List<CompiledObject.ChildRef> refList = getChilds();
- if (refList == null || refList.isEmpty()) {
+ if (refList != null && !refList.isEmpty()) {
+ // compute additionCode for all childs
+ StringBuffer buffer = new StringBuffer();
+ for (ChildRef childRef : refList) {
+ childRef.addToAdditionCode(buffer, compiler.getRootObject() == this);
+ }
+ additionCode = buffer.append(additionCode);
return;
}
-
- for (ChildRef childRef : refList) {
- childRef.addToAdditionCode(buffer);
- }
-
- additionCode = buffer.append(additionCode);
}
public int getGenericTypesLength() {
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1,27 +1,31 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
package jaxx.compiler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
- * Represents a data binding in a JAXX file. <code>DataBinding</code> uses {@link DataSource} to
- * track changes to a source expression and update the destination.
+ * Represents a data binding in a JAXX file. <code>DataBinding</code> uses
+ * {@link DataSource} to track changes to a source expression and update the destination.
*/
public class DataBinding {
+ /**
+ * Logger
+ */
+ protected static final Log log = LogFactory.getLog(DataBinding.class);
+ /**
+ * Id of the data binding
+ */
private String id;
- /** The DatSource which tracks source expression changes. */
- private DataSource dataSource;
- /** The data binding destination in the form <code><id>.<propertyName></code>. */
- private String dest;
/**
+ * source of the data binding
+ */
+ private String source;
+ /**
* A Java snippet which will cause the destination property to be updated with the current value of
* the binding.
*/
private String assignment;
- /** The current <code>JAXXCompiler</code>. */
- private JAXXCompiler compiler;
/**
* Creates a new data binding.
@@ -29,14 +33,14 @@
* @param source the Java source code for the data binding expression
* @param dest the data binding destination in the form <code><id>.<propertyName></code>
* @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding
- * @param compiler the current <code>JAXXCompiler</code>
*/
- public DataBinding(String source, String dest, String assignment, JAXXCompiler compiler) {
+ public DataBinding(String source, String dest, String assignment) {
this.id = dest;
- this.dataSource = new DataSource(id, source, compiler);
- this.dest = dest;
+ this.source = source;
this.assignment = assignment;
- this.compiler = compiler;
+ if (log.isDebugEnabled()) {
+ log.debug("id=" + id + " assignement=" + assignment + " source=" + source);
+ }
}
public String getId() {
@@ -44,21 +48,29 @@
}
/**
- * Compiles the data binding expression. This method calls methods in <code>JAXXCompiler</code>
- * to add the Java code that performs the data binding setup.
+ * Compiles the data binding expression. This method calls methods in
+ * <code>JAXXCompiler</code> to add the Java code that performs the data
+ * binding setup.
*
+ * @param compiler compiler which includes the data binding
* @param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time
* @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
* @throws CompilerException if a compilation error occurs
*/
- public boolean compile(boolean quickNoDependencies) throws CompilerException {
- // DataSource.compile handles all of the listener additions
- boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")");
+ public boolean compile(JAXXCompiler compiler, boolean quickNoDependencies) throws CompilerException {
+ DataSource dataSource = new DataSource(id, source, compiler);
+
+ // handles all of the listener additions
+ //TC-20091026 use 'this' instead of root object javaCode
+// boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")");
+ boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(this, " + compiler.getJavaCode(id) + ")");
+
+ String eol = JAXXCompiler.getLineSeparator();
if (!result && quickNoDependencies) {
- if (!dest.endsWith(".layout")) // layout is specially handled early in the chain
- {
- compiler.appendInitDataBindings(assignment + JAXXCompiler.getLineSeparator());
+ // layout is specially handled early in the chain
+ if (!id.endsWith(".layout")) {
+ compiler.appendInitDataBindings(assignment + eol);
}
return false; // no dependencies, just a static expression
}
@@ -67,17 +79,20 @@
} else {
compiler.appendProcessDataBinding(" ");
}
- compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + JAXXCompiler.getLineSeparator());
+ compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol);
String objectCode = dataSource.getObjectCode();
- if (objectCode != null) {
- compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + JAXXCompiler.getLineSeparator());
+ //TC-20091026 no need to test objectCode not null if on root object
+// boolean needTest = objectCode != null;
+ boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode);
+ if (needTest) {
+ compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + eol);
compiler.appendProcessDataBinding(" ");
}
- compiler.appendProcessDataBinding(" " + assignment.trim());
- if (objectCode != null) {
- compiler.appendProcessDataBinding(JAXXCompiler.getLineSeparator() + " }");
+ compiler.appendProcessDataBinding(" " + assignment.trim());
+ if (needTest) {
+ compiler.appendProcessDataBinding(eol + " }");
}
- compiler.appendProcessDataBinding(JAXXCompiler.getLineSeparator() + " }");
+ compiler.appendProcessDataBinding(eol + " }");
return true;
}
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -34,19 +34,42 @@
*/
public class DataSource {
+ /**
+ * type attached to "null" constants in parsed expressions
+ */
private class NULL {
- } // type attached to "null" constants in parsed expressions
+ }
+ /**
+ * id of data source
+ */
private String id;
- /** The Java source code for the expression. */
+ /**
+ * The Java source code for the expression.
+ */
private String source;
- /** The current <code>JAXXCompiler</code>. */
+ /**
+ * The current <code>JAXXCompiler</code>.
+ */
private JAXXCompiler compiler;
- /** List of symbols which this data source expression depends on. */
+ /**
+ * List of symbols which this data source expression depends on.
+ */
private List<String> dependencySymbols = new ArrayList<String>();
+ /**
+ *
+ */
private StringBuffer addListenerCode = new StringBuffer();
+ /**
+ *
+ */
private StringBuffer removeListenerCode = new StringBuffer();
+ /**
+ *
+ */
private boolean compiled;
- /** the delegate of property to be required */
+ /**
+ * the delegate of property to be required
+ */
private String objectCode;
/**
@@ -85,8 +108,9 @@
* @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code>
* @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
* @throws CompilerException if a compilation error occurs
+ * @throws IllegalStateException if data source was already compiled
*/
- public boolean compile(String propertyChangeListenerCode) throws CompilerException {
+ public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException {
if (compiled) {
throw new IllegalStateException(this + " has already been compiled");
}
@@ -100,7 +124,7 @@
if (dependencySymbols.size() > 0) {
//TC 20081108 prefer add a real JavaField instead of raw code
//compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n");
- compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getName(), autoId,false, propertyChangeListenerCode));
+ compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), autoId, false, propertyChangeListenerCode));
}
compileListeners();
@@ -287,7 +311,8 @@
for (int i = 1; i < expression.jjtGetNumChildren(); i++) {
SimpleNode suffix = expression.getChild(i);
if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) {
- if (suffix.getChild(0).jjtGetNumChildren() == 0) { // at the moment only no-argument methods are trackable
+ if (suffix.getChild(0).jjtGetNumChildren() == 0) {
+ // at the moment only no-argument methods are trackable
contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId);
if (contextClass == null) {
return null;
@@ -339,9 +364,10 @@
}
private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) {
- if (objectClass.isInterface()) // might be technically possible to track in some cases, but for now
- {
- return; // we can't create a DefaultObjectHandler for interfaces
+ if (objectClass.isInterface()) {
+ // might be technically possible to track in some cases, but for now
+ // we can't create a DefaultObjectHandler for interfaces
+ return;
}
DefaultObjectHandler handler = TagManager.getTagHandler(objectClass);
@@ -389,25 +415,30 @@
private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) {
this.objectCode = objectCode;
+ //TC-20091026 no need to test objectCode not null if on root object
+ boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode);
+// boolean needTest = objectCode != null;
if (!dependencySymbols.contains(dependencySymbol)) {
dependencySymbols.add(dependencySymbol);
String eol = JAXXCompiler.getLineSeparator();
- if (objectCode != null) {
- addListenerCode.append("if (").append(objectCode).append(" != null) {").append(eol);
+ addListenerCode.append(eol);
+ if (needTest) {
+ addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol);
addListenerCode.append(" ");
}
- addListenerCode.append(" ").append(addCode);
- if (objectCode != null) {
- addListenerCode.append(" ").append("}");
+ addListenerCode.append(" ").append(addCode.trim());
+ if (needTest) {
+ addListenerCode.append(eol).append(" }");
}
- if (objectCode != null) {
- removeListenerCode.append("if (").append(objectCode).append(" != null) {").append(eol);
+ removeListenerCode.append(eol);
+ if (needTest) {
+ removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol);
removeListenerCode.append(" ");
}
- removeListenerCode.append(" ").append(removeCode);
- if (objectCode != null) {
- removeListenerCode.append(" }");
+ removeListenerCode.append(" ").append(removeCode.trim());
+ if (needTest) {
+ removeListenerCode.append(eol).append(" }");
}
}
}
@@ -419,28 +450,20 @@
if (compiler.hasApplyDataBinding()) {
compiler.appendApplyDataBinding(" else ");
}
- compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
+// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
+ compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {");
compiler.appendApplyDataBinding(" " + addListenerCode + eol);
compiler.appendApplyDataBinding("}");
- //if (compiler.applyDataBinding.length() > 0)
- // compiler.applyDataBinding.append("else ");
- //compiler.applyDataBinding.append("if ($binding.equals(").append(TypeManager.getJavaCode(id)).append(")) {").append(JAXXCompiler.getLineSeparator());
- //compiler.applyDataBinding.append(" ").append(addListenerCode).append(JAXXCompiler.getLineSeparator());
- //compiler.applyDataBinding.append("}").append(JAXXCompiler.getLineSeparator());
}
if (removeListenerCode.length() > 0) {
if (compiler.hasRemoveDataBinding()) {
compiler.appendRemoveDataBinding(" else ");
}
- compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
+// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
+ compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {");
compiler.appendRemoveDataBinding(" " + removeListenerCode + eol);
compiler.appendRemoveDataBinding("}");
- //if (compiler.removeDataBinding.length() > 0)
- // compiler.removeDataBinding.append("else ");
- //compiler.removeDataBinding.append("if ($binding.equals(").append(TypeManager.getJavaCode(id)).append(")) {").append(JAXXCompiler.getLineSeparator());
- //compiler.removeDataBinding.append(" ").append(removeListenerCode).append(JAXXCompiler.getLineSeparator());
- //compiler.removeDataBinding.append("}").append(JAXXCompiler.getLineSeparator());
}
}
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -67,6 +67,7 @@
import java.util.regex.Pattern;
import jaxx.compiler.java.JavaFileGenerator;
import jaxx.compiler.types.TypeManager;
+import org.apache.commons.lang.StringUtils;
/**
* Compiles JAXX files into Java classes.
@@ -99,6 +100,10 @@
*/
public static final int INLINE_THRESHOLD = 300;
/**
+ * Line separator cached value
+ */
+ protected static String lineSeparator = System.getProperty("line.separator", "\n");
+ /**
* The unique object handler used in first pass
*/
protected final DefaultObjectHandler firstPassClassTagHandler;
@@ -107,7 +112,7 @@
/*-- compiler fields -----------------------------------------------------*/
/*------------------------------------------------------------------------*/
/**
- * flag to detec if an error occurs while compiling jaxx file
+ * flag to detect if an error occurs while compiling jaxx file
*/
protected boolean failed;
/**
@@ -131,7 +136,7 @@
*/
protected int autogenID = 0;
/**
- *
+ * data bindings detected
*/
protected List<DataBinding> dataBindings = new ArrayList<DataBinding>();
/**
@@ -385,10 +390,10 @@
if (symbolTable.getSuperclassName() == null) {
symbolTable.setSuperclassName(fullClassName);
}
- String id = tag.getAttribute("id");
+ String id = tag.getAttribute(DefaultObjectHandler.ID_ATTRIBUTE);
if (id.length() > 0) {
symbolTable.getClassTagIds().put(id, fullClassName);
- if (tag.getAttributeNode("javaBean") != null) {
+ if (tag.getAttributeNode(DefaultObjectHandler.JAVA_BEAN_ATTRIBUTE) != null) {
// add java bean support for this property
String capitalizeName = org.apache.commons.lang.StringUtils.capitalize(id);
// add method
@@ -582,6 +587,10 @@
/*------------------------------------------------------------------------*/
/*-- DataBinding methods -------------------------------------------------*/
/*------------------------------------------------------------------------*/
+ public List<DataBinding> getDataBindings() {
+ return dataBindings;
+ }
+
/**
* Examine an attribute value for data binding expressions. Returns a 'cooked' expression which
* can be used to determine the resulting value. It is expected that this expression will be used
@@ -647,7 +656,8 @@
// if (log.isDebugEnabled()) {
// log.info(getRootObject().getId() + " src=" + src + ", dst=" + dest.trim());
// }
- dataBindings.add(new DataBinding(src, dest, assignment, this));
+ dataBindings.add(new DataBinding(src, dest, assignment));
+// dataBindings.add(new DataBinding(src, dest, assignment, this));
} catch (CompilerException e) {
reportError("While parsing data binding for '" + dest.substring(dest.lastIndexOf(".") + 1) + "': " + e.getMessage());
}
@@ -679,8 +689,7 @@
// to make possible inheritance
String id = handler.getEventId().substring(0, handler.getEventId().indexOf("."));
- result = "do" + org.apache.commons.lang.StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + id;
- //result = "do" + org.apache.commons.lang.StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + handler.getObjectCode();
+ result = "do" + StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + id;
}
eventHandlerMethodNames.put(handler, result);
}
@@ -776,16 +785,12 @@
}
StringBuilder buffer = new StringBuilder();
buffer.append(srcFile);
-// System.err.print(srcFile);
if (lineNumber != null) {
buffer.append(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1));
-// System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1));
}
buffer.append(getLineSeparator()).append(warning.trim());
-// System.err.println(": Warning: " + warning);
if (engine != null) {
engine.addWarning(buffer.toString());
-// engine.warningCount++;
} else {
System.err.println(buffer.toString());
}
@@ -848,16 +853,12 @@
}
StringBuilder buffer = new StringBuilder();
buffer.append(errorFile != null ? errorFile.getPath() : "<unknown source>");
-// System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>");
if (lineNumber > 0) {
buffer.append(":" + lineNumber);
-// System.err.print(":" + lineNumber);
}
buffer.append(getLineSeparator()).append(": " + error);
-// System.err.println(": " + error);
if (engine != null) {
engine.addError(buffer.toString());
-// engine.errorCount++;
} else {
System.err.println(buffer.toString());
}
@@ -871,10 +872,6 @@
return objects;
}
- public List<DataBinding> getDataBindings() {
- return dataBindings;
- }
-
public Map<String, Map<ClassDescriptor, List<EventHandler>>> getEventHandlers() {
return eventHandlers;
}
@@ -1064,49 +1061,45 @@
}
public void appendInitializerCode(String code) {
- getInitializer().append(code);
+ initializer.append(code);
}
public void appendBodyCode(String code) {
- getBodyCode().append(code);
+ bodyCode.append(code);
}
public void appendInitDataBindings(String code) {
- getInitDataBindings().append(code);
+ initDataBindings.append(code);
}
public void appendProcessDataBinding(String code) {
- getProcessDataBinding().append(code);
+ processDataBinding.append(code);
}
public void appendApplyDataBinding(String code) {
- getApplyDataBinding().append(code);
+ applyDataBinding.append(code);
}
public void appendRemoveDataBinding(String code) {
- getRemoveDataBinding().append(code);
+ removeDataBinding.append(code);
}
public void appendLateInitializer(String code) {
- getLateInitializer().append(code);
+ lateInitializer.append(code);
}
public boolean hasProcessDataBinding() {
- return getProcessDataBinding().length() > 0;
+ return processDataBinding.length() > 0;
}
public boolean hasApplyDataBinding() {
- return getApplyDataBinding().length() > 0;
+ return applyDataBinding.length() > 0;
}
public boolean hasRemoveDataBinding() {
- return getRemoveDataBinding().length() > 0;
+ return removeDataBinding.length() > 0;
}
- public void addMethodToJavaFile(JavaMethod method) {
- getJavaFile().addMethod(method);
- }
-
public boolean hasMethod(String methodName) {
for (JavaMethod method : getJavaFile().getMethods()) {
if (methodName.equals(method.getName())) {
@@ -1370,7 +1363,7 @@
}
for (CompiledObject object : getObjects().values()) {
- object.finalizeCompiler();
+ object.finalizeCompiler(this);
}
for (JAXXCompilerFinalizer generator : generatorIterator) {
@@ -1404,8 +1397,6 @@
}
}
}
- /** line separator cached value */
- protected static String lineSeparator = System.getProperty("line.separator", "\n");
/**
* Returns the system line separator string.
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -134,46 +134,38 @@
initializer.initialize();
}
}
- /**
+ /**
* configuration of the launchor and underlines compilers
*/
protected CompilerConfiguration configuration;
- /**
+ /**
* original list of files to run
*/
protected final File[] files;
- /**
+ /**
* original list of classes to run
*/
protected final String[] classNames;
- /**
+ /**
* Files to be treated while compilation.
*/
private List<File> jaxxFiles = new ArrayList<File>();
- /**
+ /**
* Class names corresponding to the files in the jaxxFiles list.
*/
private List<String> jaxxFileClassNames = new ArrayList<String>();
- /**
+ /**
* Maps the names of classes being compiled to the compiler instance handling the compilation.
*/
protected Map<String, JAXXCompiler> compilers = new HashMap<String, JAXXCompiler>();
- /**
+ /**
* Maps the names of classes being compiled to their symbol tables (created after the first compiler pass).
*/
protected Map<File, SymbolTable> symbolTables = new HashMap<File, SymbolTable>();
/**
- *
+ * current pass of the engine
*/
private LifeCycle currentPass;
-// /**
-// *
-// */
-// protected int errorCount;
-// /**
-// *
-// */
-// protected int warningCount;
/**
* Warnings detected while running.
*/
@@ -183,10 +175,6 @@
*/
protected List<String> errors = new ArrayList<String>();
/**
- * number of registred compiler
- */
- protected int compilerCount;
- /**
* profile attached to the engine (can be null)
*/
protected JAXXProfile profiler;
@@ -215,7 +203,6 @@
@Override
public boolean run(JAXXEngine engine) {
boolean success = true;
- engine.compilerCount = 0;
engine.warnings.clear();
engine.errors.clear();
// init decorators
@@ -226,7 +213,6 @@
engine.decorators.put(decorator.getName(), decorator);
}
}
-
// init finalizers
engine.finalizers = new ArrayList<JAXXCompilerFinalizer>();
for (JAXXCompilerFinalizer finalizer : ServiceLoader.load(JAXXCompilerFinalizer.class)) {
@@ -274,8 +260,6 @@
log.warn("could not create directory " + destDir);
continue;
}
- } else {
- //destDir = file.getParentFile();
}
JAXXCompiler compiler = engine.newCompiler(file.getParentFile(), file, className);
addStartProfileTime(engine, compiler);
@@ -393,7 +377,7 @@
}
},
/**
- * display profile
+ * display profile results
*/
profile_pass {
@@ -408,6 +392,13 @@
}
};
+ /**
+ * Run the pass.
+ *
+ * @param engine the engine to use
+ * @return {@code true} if pass was ok, {@ocde false} otherwise
+ * @throws Exception if any pb
+ */
public abstract boolean run(JAXXEngine engine) throws Exception;
void addStartProfileTime(JAXXEngine engine, JAXXCompiler compiler) {
@@ -431,9 +422,10 @@
}
}
- /** Resets all state in preparation for a new compilation session. */
+ /**
+ * Resets all state in preparation for a new compilation session.
+ */
protected void reset() {
-// errorCount = warningCount = 0;
jaxxFiles.clear();
jaxxFileClassNames.clear();
symbolTables.clear();
@@ -457,7 +449,8 @@
}
/**
- * Creates a dummy Compiler for use in unit testing.
+ * Creates a dummy Compiler for use in unit testing or dettached use of an
+ * engine.
*
* @param classLoader class loader to use
* @return the compiler
@@ -469,6 +462,8 @@
}
/**
+ * Obtain the jaxx compiler of the given class name.
+ *
* @param className the name of the class to use
* @return the compiler instance which is processing the specified JAXX class. Each class is compiled by a
* different compiler instance.
@@ -478,6 +473,8 @@
}
/**
+ * Obtain the symbo table for the given class name.
+ *
* @param className the name of the class to use
* @return the symbol table for the specified JAXX class. Must be called during the second compiler pass.
* Returns <code>null</code> if no such symbol table could be found.
@@ -490,14 +487,27 @@
return compiler.getSymbolTable();
}
- public CompiledObjectDecorator getDecorator(String name) {
+ /**
+ * Obtain the decorator of the given name.
+ *
+ * @param name the name of the decorator
+ * @return the decorator found.
+ * @throws IllegalArgumentException if decorator not found for the given name.
+ */
+ public CompiledObjectDecorator getDecorator(String name) throws IllegalArgumentException {
CompiledObjectDecorator decorator = decorators.get(name);
if (decorator == null) {
- throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + decorators.keySet());
+ throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + decorators.keySet() + ")");
}
return decorator;
}
+ /**
+ * Obtain the decorator of the given type.
+ *
+ * @param type the type of the decorator (syas his fqn)
+ * @return the decorator found
+ */
public CompiledObjectDecorator getDecorator(Class<?> type) {
for (CompiledObjectDecorator decorator : decorators.values()) {
if (type == decorator.getClass()) {
@@ -507,18 +517,34 @@
return null;
}
+ /**
+ * Add a warning to the engine.
+ *
+ * @param warning the warning to add
+ */
public void addWarning(String warning) {
warnings.add(warning);
}
+ /**
+ * Add an error to the engine.
+ *
+ * @param error the error to add
+ */
public void addError(String error) {
errors.add(error);
}
+ /**
+ * @return the errors of the engine
+ */
public List<String> getErrors() {
return errors;
}
+ /**
+ * @return the warnings of the engine
+ */
public List<String> getWarnings() {
return warnings;
}
@@ -526,34 +552,35 @@
/**
* Compiled a set of files.
*
- * @return <code>true</code> if compilation succeeds, <code>false</code> otherwise
+ * @return {@code -1} if errors appears, the number of generated files
+ * otherwise.
*/
- public synchronized boolean run() {
+ public synchronized int run() {
try {
boolean success = true;
for (LifeCycle state : LifeCycle.values()) {
if (!success) {
- return false;
+ // stop as soon as a engine phase failed
+ break;
}
currentPass = state;
if (configuration.isVerbose()) {
- log.info("start " + state + " on " + jaxxFiles.size() + " file(s)");
+ log.info("'" + state + "' on " + jaxxFiles.size() + " file(s)");
}
success = state.run(this);
}
- return success;
+ return success ? compilers.size() : -1;
//FIXME : deal better the exception treatment...
} catch (CompilerException e) {
System.err.println(e.getMessage());
e.printStackTrace();
- return false;
+ return -1;
} catch (Throwable e) {
e.printStackTrace();
- return false;
+ return -1;
} finally {
- compilerCount = compilers.size();
//TC - 20081018 only reset when no error was detected
if (configuration.isResetAfterCompile() && errors.isEmpty()) {
reset();
@@ -561,11 +588,15 @@
}
}
- public int getCompilerCount() {
- return compilerCount;
- }
-
- protected JAXXCompiler getCompiler(String className, String message) {
+ /**
+ * Obtain the compiler for the given class name.
+ *
+ * @param className the class name of the searched compiler
+ * @param message the message to throw if compiler not found
+ * @return the compiler found
+ * @throws CompilerException if compiler not found
+ */
+ protected JAXXCompiler getCompiler(String className, String message) throws CompilerException {
JAXXCompiler compiler = compilers.get(className);
if (compiler == null) {
throw new CompilerException(message);
@@ -573,6 +604,18 @@
return compiler;
}
+ /**
+ * Create a new compiler.
+ *
+ * @param parentFile
+ * @param file
+ * @param className
+ * @return the new compiler
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ * @throws NoSuchMethodException
+ */
protected JAXXCompiler newCompiler(File parentFile, File file, String className) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(JAXXEngine.class, File.class, File.class, String.class, CompilerConfiguration.class, List.class);
return cons.newInstance(this, parentFile, file, className, configuration, Arrays.asList(new String[]{
@@ -594,6 +637,14 @@
}));
}
+ /**
+ * Add a profile time for the given compiler and key.
+ *
+ * Note: if {@link #profiler} is {@code null}, do nothing
+ *
+ * @param compiler the compiler to profile
+ * @param key the key of profiling
+ */
public void addProfileTime(JAXXCompiler compiler, String key) {
if (profiler != null) {
profiler.addTime(compiler, key);
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -82,7 +82,7 @@
//TC-20091025 generate client properties at creation time (not at setup time)
// in some case can save to create a setup method (when there is only client properties
// to store)
- addClientProperties(object);
+ addClientProperties(object, result, eol);
return result.toString();
}
@@ -124,7 +124,7 @@
//TC-20091025 generate client properties at creation time (not at setup time)
// in some case can save to create a setup method (when there is only client properties
// to store)
- addClientProperties(object);
+ addClientProperties(object, code, eol);
code.append(eol);
}
} else {
@@ -144,12 +144,12 @@
return lastWasMethodCall;
}
- protected void addClientProperties(CompiledObject object) {
+ protected void addClientProperties(CompiledObject object, StringBuffer code, String eol) {
//TC-20090327 generate client properties
if (object.hasClientProperties()) {
// generate putClientProperty invocations
for (Entry<String, String> entry : object.getClientProperties().entrySet()) {
- object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");");
+ code.append(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");").append(eol);
}
}
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -129,7 +129,6 @@
registerTag(JAXXCompiler.JAXX_NAMESPACE, FieldValidatorHandler.TAG, new FieldValidatorHandler());
registerTag(JAXXCompiler.JAXX_NAMESPACE, ExcludeFieldValidatorHandler.TAG, new FieldValidatorHandler());
-
//
// Register beans
//
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -29,8 +29,25 @@
public class DefaultComponentHandler extends DefaultObjectHandler {
- /** log */
+ public static final String ACTION_ICON_ATTRIBUTE = "actionIcon";
+ public static final String CONTAINER_DELEGATE_ATTRIBUTE = "containerDelegate";
+ public static final String FONT_FACE_ATTRIBUTE = "font-face";
+ public static final String FONT_SIZE_ATTRIBUTE = "font-size";
+ public static final String FONT_STYLE_ATTRIBUTE = "font-style";
+ public static final String FONT_WEIGHT_ATTRIBUTE = "font-weight";
+ public static final String HEIGHT_ATTRIBUTE = "height";
+ public static final String ICON_ATTRIBUTE = "icon";
+ public static final String NAME_ATTRIBUTE = "name";
+ public static final String WIDTH_ATTRIBUTE = "width";
+ public static final String X_ATTRIBUTE = "x";
+ public static final String Y_ATTRIBUTE = "y";
+ /**
+ * Logger
+ */
protected static final Log log = LogFactory.getLog(DefaultComponentHandler.class);
+ /**
+ * container delegate (if any)
+ */
private String containerDelegate;
public DefaultComponentHandler(ClassDescriptor beanClass) {
@@ -43,7 +60,7 @@
if (jaxxBeanInfo == null) {
super.init();
- containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate");
+ containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE);
if (containerDelegate == null && ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass().getSuperclass())) {
containerDelegate = ((DefaultComponentHandler) TagManager.getTagHandler(getBeanClass().getSuperclass())).getContainerDelegate();
}
@@ -71,7 +88,7 @@
@Override
protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException {
super.setDefaults(object, tag, compiler);
- setAttribute(object, "name", object.getId(), false, compiler);
+ setAttribute(object, NAME_ATTRIBUTE, object.getId(), false, compiler);
openComponent(object, tag, compiler);
}
@@ -87,7 +104,7 @@
}
protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException {
- String constraints = tag.getAttribute("constraints");
+ String constraints = tag.getAttribute(CONSTRAINTS_ATTRIBUTE);
if (constraints != null && constraints.length() > 0) {
compiler.openComponent(object, constraints);
} else {
@@ -106,11 +123,16 @@
@Override
public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException {
- if (propertyName.equals("x") || propertyName.equals("y") || propertyName.equals("width") || propertyName.equals("height") ||
- "font-size".equals(propertyName)) {
+ if (propertyName.equals(X_ATTRIBUTE) ||
+ propertyName.equals(Y_ATTRIBUTE) ||
+ propertyName.equals(WIDTH_ATTRIBUTE) ||
+ propertyName.equals(HEIGHT_ATTRIBUTE) ||
+ FONT_SIZE_ATTRIBUTE.equals(propertyName)) {
return ClassDescriptorLoader.getClassDescriptor(Integer.class);
}
- if (propertyName.equals("font-face") || propertyName.equals("font-style") || propertyName.equals("font-weight")) {
+ if (propertyName.equals(FONT_FACE_ATTRIBUTE) ||
+ propertyName.equals(FONT_STYLE_ATTRIBUTE) ||
+ propertyName.equals(FONT_WEIGHT_ATTRIBUTE)) {
return ClassDescriptorLoader.getClassDescriptor(String.class);
}
return super.getPropertyType(object, propertyName, compiler);
@@ -118,16 +140,16 @@
@Override
public String getGetPropertyCode(String id, String name, JAXXCompiler compiler) throws CompilerException {
- if (name.equals("font-face")) {
+ if (name.equals(FONT_FACE_ATTRIBUTE)) {
return id + ".getFont().getFontName()";
}
- if (name.equals("font-size")) {
+ if (name.equals(FONT_SIZE_ATTRIBUTE)) {
return id + ".getFont().getSize()";
}
- if (name.equals("font-weight")) {
+ if (name.equals(FONT_WEIGHT_ATTRIBUTE)) {
return "(" + id + ".getFont().getStyle() & Font.BOLD) != 0 ? \"bold\" : \"normal\"";
}
- if (name.equals("font-style")) {
+ if (name.equals(FONT_STYLE_ATTRIBUTE)) {
return "(" + id + ".getFont().getStyle() & Font.ITALIC) != 0 ? \"italic\" : \"normal\"";
}
return super.getGetPropertyCode(id, name, compiler);
@@ -135,25 +157,26 @@
@Override
public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException {
- if (name.equals("x")) {
+ if (name.equals(X_ATTRIBUTE)) {
return id + ".setLocation(" + valueCode + ", " + id + ".getY());";
}
- if (name.equals("y")) {
+ if (name.equals(Y_ATTRIBUTE)) {
return id + ".setLocation(" + id + ".getX(), " + valueCode + ");";
}
- if (name.equals("width")) { // need to optimize case when both width and height are being assigned
+ if (name.equals(WIDTH_ATTRIBUTE)) {
+ // need to optimize case when both width and height are being assigned
return Util.class.getName() + ".setComponentWidth(" + id + "," + valueCode + ");";
}
- if (name.equals("height")) {
+ if (name.equals(HEIGHT_ATTRIBUTE)) {
return Util.class.getName() + ".setComponentHeight(" + id + "," + valueCode + ");";
}
- if (name.equals("font-face")) {
+ if (name.equals(FONT_FACE_ATTRIBUTE)) {
return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));\n}";
}
- if (name.equals("font-size")) {
+ if (name.equals(FONT_SIZE_ATTRIBUTE)) {
return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));\n}";
}
- if (name.equals("font-weight")) {
+ if (name.equals(FONT_WEIGHT_ATTRIBUTE)) {
if (valueCode.equals("\"bold\"")) {
return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n}";
}
@@ -168,7 +191,7 @@
compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode);
return "";
}
- if (name.equals("font-style")) {
+ if (name.equals(FONT_STYLE_ATTRIBUTE)) {
if (valueCode.equals("\"italic\"")) {
return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n}";
}
@@ -183,8 +206,9 @@
compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode);
return "";
}
- if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals("layout")) { // handle containerDelegate (e.g. contentPane on JFrame)
- String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate");
+ if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals(LAYOUT_ATTRIBUTE)) {
+ // handle containerDelegate (e.g. contentPane on JFrame)
+ String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE);
if (cDelegate != null) {
return id + '.' + cDelegate + "().setLayout(" + valueCode + ");";
}
@@ -210,27 +234,27 @@
//object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + propertyName.substring(1) + "\", " + stringValue + ");");
return;
}
- if ("icon".equals(propertyName)) {
+ if (ICON_ATTRIBUTE.equals(propertyName)) {
if (!(stringValue.startsWith("{") || stringValue.endsWith("}"))) {
// this is a customized icon, add the icon creation code
if (compiler.getConfiguration().isUseUIManagerForIcon()) {
- stringValue = "{" + jaxx.runtime.Util.class.getName() + ".getUIManagerIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + Util.class.getName() + ".getUIManagerIcon(\"" + stringValue + "\")}";
} else {
- stringValue = "{" + jaxx.runtime.Util.class.getName() + ".createImageIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + Util.class.getName() + ".createImageIcon(\"" + stringValue + "\")}";
}
}
- } else if ("actionIcon".equals(propertyName)) {
+ } else if (ACTION_ICON_ATTRIBUTE.equals(propertyName)) {
// customized actionIcon property
if (stringValue.startsWith("{") && stringValue.endsWith("}")) {
// there is a script to define the action icon, this is forbidden
compiler.reportError("the actionIcon does not support script, remove braces..., fix the file " + compiler.getOutputClassName());
return;
}
- propertyName = "icon";
+ propertyName = ICON_ATTRIBUTE;
if (compiler.getConfiguration().isUseUIManagerForIcon()) {
- stringValue = "{" + jaxx.runtime.Util.class.getName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + Util.class.getName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}";
} else {
- stringValue = "{" + jaxx.runtime.Util.class.getName() + ".createActionIcon(\"" + stringValue + "\")}";
+ stringValue = "{" + Util.class.getName() + ".createActionIcon(\"" + stringValue + "\")}";
}
}
super.setAttribute(object, propertyName, stringValue, inline, compiler);
@@ -273,7 +297,7 @@
*/
@Override
protected int constantValue(String key, String value) {
- if ((key.equals("mnemonic") || key.equals("displayedMnemonic"))) {
+ if ((key.equals(MNEMONIC_ATTRIBUTE) || key.equals(DISPLAYED_MNEMONIC_ATTRIBUTE))) {
if (value.length() == 1) {
return value.charAt(0);
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -7,13 +7,13 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.UnsupportedAttributeException;
import jaxx.compiler.CompiledObject;
+import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.beans.JAXXBeanInfo;
import jaxx.compiler.beans.JAXXEventSetDescriptor;
import jaxx.compiler.beans.JAXXIntrospector;
import jaxx.compiler.beans.JAXXPropertyDescriptor;
import jaxx.compiler.css.StylesheetHelper;
-import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.java.JavaArgument;
import jaxx.compiler.java.JavaMethod;
import jaxx.compiler.reflect.ClassDescriptor;
@@ -24,6 +24,7 @@
import jaxx.runtime.ComponentDescriptor;
import jaxx.runtime.JAXXObject;
import jaxx.runtime.JAXXObjectDescriptor;
+import jaxx.runtime.Util;
import jaxx.runtime.css.Stylesheet;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
@@ -44,7 +45,7 @@
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
-import jaxx.runtime.Util;
+import org.apache.commons.lang.StringUtils;
/**
* Default handler for class tags. Class tags are tags which represent instances of Java classes,
@@ -59,17 +60,43 @@
*/
public class DefaultObjectHandler implements TagHandler {
- /** The class that this handler provides support for. */
+ public static final String ABSTRACT_ATTRIBUTE = "abstract";
+ public static final String CONSTRAINTS_ATTRIBUTE = "constraints";
+ public static final String CONSTRUCTOR_PARAMS_ATTRIBUTE = "constructorParams";
+ public static final String DECORATOR_ATTRIBUTE = "decorator";
+ public static final String DISPLAYED_MNEMONIC_ATTRIBUTE = "displayedMnemonic";
+ public static final String DISPLAYED_MNEMONIC_INDEX_ATTRIBUTE = "displayedMnemonicIndex";
+ public static final String GENERICTYPE_ATTRIBUTE = "genericType";
+ public static final String ID_ATTRIBUTE = "id";
+ public static final String IMPLEMENTS_ATTRIBUTE = "implements";
+ public static final String JAVA_BEAN_ATTRIBUTE = "javaBean";
+ public static final String LAYOUT_ATTRIBUTE = "layout";
+ public static final String MNEMONIC_ATTRIBUTE = "mnemonic";
+ public static final String STYLE_CLASS_ATTRIBUTE = "styleClass";
+ public static final String SUPER_GENERIC_TYPE_ATTRIBUTE = "superGenericType";
+ /**
+ * The class that this handler provides support for.
+ */
private ClassDescriptor beanClass;
- /** The JAXXBeanInfo for the beanClass. */
+ /**
+ * The JAXXBeanInfo for the beanClass.
+ */
protected JAXXBeanInfo jaxxBeanInfo;
- /** Maps property names to their respective JAXXPropertyDescriptors. */
+ /**
+ * Maps property names to their respective JAXXPropertyDescriptors.
+ */
private Map<String, JAXXPropertyDescriptor> properties;
- /** Maps event names to their respective JAXXEventSetDescriptors. */
+ /**
+ * Maps event names to their respective JAXXEventSetDescriptors.
+ */
private Map<String, JAXXEventSetDescriptor> events;
- /** Maps property names to their respective ProxyEventInfos. */
+ /**
+ * Maps property names to their respective ProxyEventInfos.
+ */
private Map<String, ProxyEventInfo> eventInfos;
- /** Maps XML tags to the CompiledObjects created from them. */
+ /**
+ * Maps XML tags to the CompiledObjects created from them.
+ */
protected static Map<Element, CompiledObject> objectMap = new WeakHashMap<Element, CompiledObject>();
/**
@@ -80,9 +107,13 @@
*/
private class ProxyEventInfo {
- /** The name of the method or field being proxied, e.g. "getText". */
+ /**
+ * The name of the method or field being proxied, e.g. "getText".
+ */
String memberName;
- /** The "actual" event listener for the property in question, e.g. DocumentListener. */
+ /**
+ * The "actual" event listener for the property in question, e.g. DocumentListener.
+ */
ClassDescriptor listenerClass;
/**
* In cases where a different object (such as a model) is more directly responsible for
@@ -93,9 +124,13 @@
* attached to the new value, and the data binding to be processed.
*/
String modelName;
- /** The name of the method used to add the "native" event listener, e.g. "addDocumentListener". */
+ /**
+ * The name of the method used to add the "native" event listener, e.g. "addDocumentListener".
+ */
String addMethod;
- /** The name of the method used to remove the "native" event listener, e.g. "removeDocumentListener". */
+ /**
+ * The name of the method used to remove the "native" event listener, e.g. "removeDocumentListener".
+ */
String removeMethod;
}
@@ -112,8 +147,7 @@
/**
* Performs introspection on the beanClass and stores the results.
*
- * @throws java.beans.IntrospectionException
- * TODO
+ * @throws java.beans.IntrospectionException if any pb
*/
protected void init() throws IntrospectionException {
if (jaxxBeanInfo == null) {
@@ -164,8 +198,7 @@
*
* @param beanClass the bean class for which to retrieve <code>JAXXBeanInfo</code>
* @return the class' <code>JAXXBeanInfo</code>
- * @throws java.beans.IntrospectionException
- * ?
+ * @throws java.beans.IntrospectionException if any pb
*/
public static JAXXBeanInfo getJAXXBeanInfo(ClassDescriptor beanClass) throws IntrospectionException {
return JAXXIntrospector.getJAXXBeanInfo(beanClass);
@@ -196,14 +229,13 @@
}
/**
- * @param name ?
+ * @param name name of the property
* @return <code>true</code> if the named member is <i>bound</i> (fires <code>PropertyChangeEvent</code>
* when modified). Members are either fields (represented by the simple name of the field) or <code>get/is</code>
* methods (represented by the simple name of the method, <b>not</b> the simplified JavaBeans-style name).
* Methods which are not actually bound in their native class, but for which proxy events have been
* configured (such as <code>JTextField.getText</code>, return <code>true</code>.
- * @throws UnsupportedAttributeException
- * ?
+ * @throws UnsupportedAttributeException if attribute is not supported
*/
public boolean isMemberBound(String name) throws UnsupportedAttributeException {
try {
@@ -282,15 +314,15 @@
boolean methodExists = compiler.hasMethod(methodName);
ClassDescriptor eventClass = getEventClass(eventInfo.listenerClass);
if (!methodExists) {
- compiler.addMethodToJavaFile(new JavaMethod(Modifier.PUBLIC, "void", methodName,
+ compiler.getJavaFile().addMethod(new JavaMethod(Modifier.PUBLIC, "void", methodName,
new JavaArgument[]{new JavaArgument(JAXXCompiler.getCanonicalName(eventClass), "event")}, null,
propertyChangeListenerCode + ".propertyChange(null);", false));
}
- String code = objectCode + (eventInfo.modelName != null ? ".get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName) + "()" : "");
+ String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : "");
result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator());
result.append(code).append('.').append(eventInfo.addMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n");
if (eventInfo.modelName != null) {
- result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName),
+ result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
Util.class.getName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
compiler));
}
@@ -310,14 +342,21 @@
}
}
if (propertyName != null) {
+ //TC-20091026 when on root object, do not prefix with objectCode
+ String prefix = objectCode.trim() + ".";
+ if (objectCode.equals(compiler.getRootObject().getJavaCode())) {
+ prefix = "";
+ }
try {
// check for property-specific addPropertyChangeListener method
getBeanClass().getMethodDescriptor("addPropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class),
ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class));
- return objectCode + ".addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
+// return objectCode + ".addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
+ return prefix + "addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
} catch (NoSuchMethodException e) {
// no property-specific method, use general one
- return objectCode + ".addPropertyChangeListener(" + propertyChangeListenerCode + ");\n";
+// return objectCode + ".addPropertyChangeListener(" + propertyChangeListenerCode + ");\n";
+ return prefix + "addPropertyChangeListener(" + propertyChangeListenerCode + ");\n";
}
}
return null;
@@ -330,23 +369,25 @@
}
ProxyEventInfo eventInfo = eventInfos != null ? eventInfos.get(memberName) : null;
- if (eventInfo != null) { // a "proxied" event is one that doesn't fire PropertyChangeEvent, so we need to convert its native event type into PropertyChangeEvents
+ if (eventInfo != null) {
+ // a "proxied" event is one that doesn't fire PropertyChangeEvent,
+ // so we need to convert its native event type into PropertyChangeEvents
StringBuffer result = new StringBuffer();
String methodName = "$pr" + compiler.getUniqueId(propertyChangeListenerCode);
boolean methodExists = compiler.hasMethod(methodName);
if (!methodExists) {
ClassDescriptor eventClass = getEventClass(eventInfo.listenerClass);
- compiler.addMethodToJavaFile(new JavaMethod(Modifier.PUBLIC, "void", methodName,
+ compiler.getJavaFile().addMethod(new JavaMethod(Modifier.PUBLIC, "void", methodName,
new JavaArgument[]{new JavaArgument(JAXXCompiler.getCanonicalName(eventClass), "event")}, null,
propertyChangeListenerCode + ".propertyChange(null);", false));
}
try {
- String modelMemberName = eventInfo.modelName != null ? "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName) : null;
+ String modelMemberName = eventInfo.modelName != null ? "get" + StringUtils.capitalize(eventInfo.modelName) : null;
String modelClassName = modelMemberName != null ? getBeanClass().getMethodDescriptor(modelMemberName).getReturnType().getName() : JAXXCompiler.getCanonicalName(getBeanClass());
String code = objectCode + (eventInfo.modelName != null ? "." + modelMemberName + "()" : "");
result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n");
if (eventInfo.modelName != null) {
- result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName),
+ result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName),
Util.class.getName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
compiler));
}
@@ -369,14 +410,21 @@
}
}
if (propertyName != null) {
+ //TC-20091026 when on root object, do not prefix with objectCode
+ String prefix = objectCode.trim() + ".";
+ if (objectCode.equals(compiler.getRootObject().getJavaCode())) {
+ prefix = "";
+ }
try {
// check for property-specific removePropertyChangeListener method
getBeanClass().getMethodDescriptor("removePropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class),
ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class));
- return objectCode + ".removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
+// return objectCode + ".removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
+ return prefix + "removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n";
} catch (NoSuchMethodException e) {
// no property-specific method, use general one
- return objectCode + ".removePropertyChangeListener(" + propertyChangeListenerCode + ");\n";
+// return objectCode + ".removePropertyChangeListener(" + propertyChangeListenerCode + ");\n";
+ return prefix + "removePropertyChangeListener(" + propertyChangeListenerCode + ");\n";
}
}
return null;
@@ -505,7 +553,7 @@
throw new IllegalStateException("unable to find CompiledObject associated with tag <" + tag.getTagName() + ">; should have been registered before second pass");
}
compiler.checkOverride(object);
- String constructorParams = tag.getAttribute("constructorParams");
+ String constructorParams = tag.getAttribute(CONSTRUCTOR_PARAMS_ATTRIBUTE);
if (constructorParams != null && constructorParams.length() > 0) {
object.setConstructorParams(compiler.getScriptManager().trimScript(constructorParams));
}
@@ -522,13 +570,13 @@
}
public void registerCompiledObject(Element tag, JAXXCompiler compiler) {
- String id = tag.getAttribute("id");
+ String id = tag.getAttribute(ID_ATTRIBUTE);
if (id == null || id.length() == 0) {
id = compiler.getAutoId(getBeanClass());
}
CompiledObject object = createCompiledObject(id, compiler);
objectMap.put(tag, object);
- String styleClass = tag.getAttribute("styleClass").trim();
+ String styleClass = tag.getAttribute(STYLE_CLASS_ATTRIBUTE).trim();
if (styleClass.length() > 0) {
object.setStyleClass(styleClass);
}
@@ -536,7 +584,8 @@
}
/**
- * Creates the <code>CompiledObject</code> which will represent the object created by this <code>TagHandler</code>.
+ * Creates the <code>CompiledObject</code> which will represent the object
+ * created by this <code>TagHandler</code>.
*
* @param id the <code>CompiledObject's</code> ID.
* @param compiler compiler to use
@@ -547,8 +596,8 @@
}
/**
- * Initializes the default settings of the object, prior to setting its attribute values. The default
- * implementation does nothing.
+ * Initializes the default settings of the object, prior to setting its
+ * attribute values. The default implementation does nothing.
*
* @param object the object to initialize
* @param tag the tag being compiled
@@ -561,8 +610,7 @@
* @param property property name to test
* @return <code>true</code> if the specified property should be inherited by child components when specified
* via CSS.
- * @throws UnsupportedAttributeException
- * ?
+ * @throws UnsupportedAttributeException if attribute is not supported
*/
public boolean isPropertyInherited(String property) throws UnsupportedAttributeException {
return false;
@@ -596,13 +644,13 @@
for (Attr attribute : attributes) {
String name = attribute.getName();
String value = attribute.getValue();
- if (name.equals("javaBean")) {
+ if (name.equals(JAVA_BEAN_ATTRIBUTE)) {
//compiler.preprocessScript(value);
continue;
}
- if (name.equals("constraints") || isEventHandlerName(name)) {
+ if (name.equals(CONSTRAINTS_ATTRIBUTE) || isEventHandlerName(name)) {
compiler.preprocessScript(value); // adds dependencies as a side effect
- } else if (name.equals("constructorParams")) {
+ } else if (name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE)) {
for (String param : value.split("\\s*,\\s*")) {
compiler.preprocessScript(param);
}
@@ -633,22 +681,26 @@
for (Attr attribute : attributes) {
String name = attribute.getName();
String value = attribute.getValue().trim();
- if (name.equals("id") || name.equals("constraints") || name.equals("constructorParams") || name.equals("styleClass") ||
- name.startsWith("xmlns") || JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) {
+ if (name.equals(ID_ATTRIBUTE) ||
+ name.equals(CONSTRAINTS_ATTRIBUTE) ||
+ name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE) ||
+ name.equals(STYLE_CLASS_ATTRIBUTE) ||
+ name.startsWith(XMLNS_ATTRIBUTE) ||
+ JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) {
// ignore, already handled
continue;
}
- if (name.equals("javaBean")) {
+ if (name.equals(JAVA_BEAN_ATTRIBUTE)) {
object.setJavaBean(true);
if (!value.isEmpty()) {
object.setJavaBeanInitCode(value);
}
continue;
}
- if (name.equals("implements")) {
+ if (name.equals(IMPLEMENTS_ATTRIBUTE)) {
if (object != compiler.getRootObject()) {
// can ony be apply to root object
- compiler.reportError("'implements' attribute can only be found on root tag but was found on tag " + tag);
+ compiler.reportError("'" + IMPLEMENTS_ATTRIBUTE + "' attribute can only be found on root tag but was found on tag " + tag);
return;
}
String[] interfaces = value.split(",");
@@ -656,17 +708,17 @@
continue;
}
- if (name.equals("abstract")) {
+ if (name.equals(ABSTRACT_ATTRIBUTE)) {
if (object != compiler.getRootObject()) {
// can ony be apply to root object
- compiler.reportError("'abstract' attribute can only be found on root tag but was found on tag " + tag);
+ compiler.reportError("'" + ABSTRACT_ATTRIBUTE + "' attribute can only be found on root tag but was found on tag " + tag);
return;
}
compiler.setAbstractClass(true);
continue;
}
- if (name.equals("genericType")) {
+ if (name.equals(GENERICTYPE_ATTRIBUTE)) {
//TC-20090313 check after all atributes been processed
if (object == compiler.getRootObject()) {
compiler.setGenericType(value);
@@ -676,17 +728,17 @@
continue;
}
- if (name.equals("superGenericType")) {
+ if (name.equals(SUPER_GENERIC_TYPE_ATTRIBUTE)) {
if (object != compiler.getRootObject()) {
// can ony be apply to root object
- compiler.reportError("'superGenericType' attribute can only be found on root tag but was found on tag " + tag);
+ compiler.reportError("'" + SUPER_GENERIC_TYPE_ATTRIBUTE + "' attribute can only be found on root tag but was found on tag " + tag);
return;
}
compiler.setSuperGenericType(value);
continue;
}
- if (name.equals("decorator")) {
+ if (name.equals(DECORATOR_ATTRIBUTE)) {
if (!value.isEmpty()) {
CompiledObjectDecorator decorator = compiler.getEngine().getDecorator(value);
object.setDecorator(decorator);
@@ -734,7 +786,9 @@
* @return the attribute's priority
*/
protected int getAttributeOrdering(Attr attr) {
- if (attr.getName().equals("displayedMnemonicIndex") || attr.getName().equals("displayedMnemonic") || attr.getName().equals("mnemonic")) {
+ if (attr.getName().equals(DISPLAYED_MNEMONIC_INDEX_ATTRIBUTE) ||
+ attr.getName().equals(DISPLAYED_MNEMONIC_ATTRIBUTE) ||
+ attr.getName().equals(MNEMONIC_ATTRIBUTE)) {
return 1;
}
return 0;
@@ -776,7 +830,15 @@
// check for data binding & remove if found
JAXXObjectDescriptor jaxxObjectDescriptor = object.getObjectClass().getJAXXObjectDescriptor();
ComponentDescriptor root = jaxxObjectDescriptor.getComponentDescriptors()[0];
- object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");");
+ //TC-20091026 do not prefix binding by object id if on root object
+ String prefix;
+ if (object == compiler.getRootObject()) {
+ prefix = "";
+ } else {
+ prefix = object.getId() + ".";
+ }
+ object.appendInitializationCode(prefix + "removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");");
+// object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");");
}
object.addProperty(propertyName, stringValue);
ClassDescriptor type = getPropertyType(object, propertyName, compiler);
@@ -796,7 +858,7 @@
propertyType != ClassDescriptorLoader.getClassDescriptor(Character.class)) {
//binding = "((" + propertyType.getName() + ") " + binding + ")";
}
- if (propertyName.equals("layout")) { // handle containerDelegate (e.g. contentPane on JFrame)
+ if (propertyName.equals(LAYOUT_ATTRIBUTE)) { // handle containerDelegate (e.g. contentPane on JFrame)
// have to set layout early, before children are added
object.appendInitializationCode(getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler));
}
@@ -959,7 +1021,15 @@
JAXXPropertyDescriptor property = properties.get(name);
if (property != null) {
if (property.getWriteMethodDescriptor() != null) {
- return javaCode + '.' + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");";
+ //TC-20091026 do not prefix by javaCode if on root object
+ String prefix;
+ if (compiler.getRootObject().getJavaCode().equals(javaCode)) {
+ prefix = "";
+ } else {
+ prefix = javaCode + ".";
+ }
+ return prefix + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");";
+// return javaCode + '.' + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");";
}
throw new UnsupportedAttributeException("property '" + name + "' of " + getBeanClass().getName() + " is read-only");
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -27,6 +27,8 @@
*/
public class ScriptHandler implements TagHandler {
+ public static final String SOURCE_ATTRIBUTE = "source";
+
@Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
File scriptFile = null;
@@ -35,7 +37,7 @@
Attr attribute = (Attr) attributes.item(i);
String name = attribute.getName();
String attrValue = attribute.getValue();
- if (name.equals("source")) {
+ if (name.equals(SOURCE_ATTRIBUTE)) {
scriptFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar));
StringWriter scriptBuffer = new StringWriter();
try {
@@ -49,7 +51,8 @@
compiler.reportError("script file not found: " + scriptFile);
}
compiler.registerScript(scriptBuffer.toString(), scriptFile);
- } else if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) {
+ } else if (!name.startsWith(XMLNS_ATTRIBUTE) &&
+ !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) {
throw new UnsupportedAttributeException(name);
}
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -38,6 +38,7 @@
* @author Ethan Nicholas
*/
public class StyleHandler implements TagHandler {
+ public static final String SOURCE_ATTRIBUTE = "source";
@Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
@@ -47,7 +48,7 @@
Attr attribute = (Attr) attributes.item(i);
String name = attribute.getName();
String attrValue = attribute.getValue();
- if (name.equals("source")) {
+ if (name.equals(SOURCE_ATTRIBUTE)) {
source = true;
File styleFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar));
StringWriter styleBuffer = new StringWriter();
@@ -64,7 +65,8 @@
compiler.getSourceFiles().push(styleFile);
compiler.registerStylesheet(processStylesheet(styleBuffer.toString()));
compiler.getSourceFiles().pop();
- } else if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) {
+ } else if (!name.startsWith(XMLNS_ATTRIBUTE) &&
+ !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) {
throw new UnsupportedAttributeException(name);
}
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -20,6 +20,8 @@
*/
public interface TagHandler {
+ String XMLNS_ATTRIBUTE = "xmlns";
+
/**
* Performs the first pass of compilation on an XML tag from a JAXX source file.
* <code>TagHandler</code> implementations affect the generated <code>.java</code>
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -18,21 +18,32 @@
import java.util.Map;
import java.util.Set;
-/** Manages TagHandlers, including automatically compiling .jaxx files corresponding to class tags. */
+/**
+ * Manages TagHandlers, including automatically compiling .jaxx files
+ * corresponding to class tags.
+ */
public class TagManager {
- /** log */
+ /**
+ * Logger
+ */
protected static final Log log = LogFactory.getLog(TagManager.class);
/**
* Namespace for JAXX's non-class tags, such as <script;>. The namespace normally does not
* need to be specified but can be used to resolve ambiguities.
*/
public static final String JAXX_NAMESPACE = "http://www.jaxxframework.org/";
- /** Maps simple tag names to their default namespaces (package names). */
+ /**
+ * Maps simple tag names to their default namespaces (package names).
+ */
private static Map<String, String> defaultNamespaces = new HashMap<String, String>();
- /** Maps qualified tag names to the TagHandlers responsible for processing them. */
+ /**
+ * Maps qualified tag names to the TagHandlers responsible for processing them.
+ */
private static Map<QName, TagHandler> registeredTags = new HashMap<QName, TagHandler>();
- /** Keeps track of whether or not named classes exist. */
+ /**
+ * Keeps track of whether or not named classes exist.
+ */
private static Map<String, Boolean> classExistenceCache = new HashMap<String, Boolean>();
/**
* Maps bean classes to their TagHandler classes. The mapping is to TagHandler classes, rather than to
@@ -233,21 +244,23 @@
boolean found = false;
ClassLoader classLoader = compiler.getClassLoader();
try {
- Class.forName(className, true,classLoader);
+ Class.forName(className, true, classLoader);
found = true;
} catch (ClassNotFoundException e) {
// ignore ?
- } catch (NoClassDefFoundError e) {
+ } catch (NoClassDefFoundError e) {
// we obtain this instead of ClassNotFoundException on case-insensitive file systems when
// looking up a class with the wrong case
}
- if (!found) { // couldn't find .class, check for .java
+ if (!found) {
+ // couldn't find .class, check for .java
URL javaURL = classLoader.getResource(className.replace('.', '/') + ".java");
found = javaURL != null;
}
- if (!found) { // couldn't find .java, check for .jaxx
+ if (!found) {
+ // couldn't find .java, check for .jaxx
URL jaxxURL = classLoader.getResource(className.replace('.', '/') + ".jaxx");
found = jaxxURL != null;
}
@@ -260,12 +273,14 @@
private static String determinePackage(String simpleClassName, String defaultPackage, JAXXCompiler compiler) {
String namespace = null;
Set<String> classes = compiler.getImportedClasses();
- for (String className : classes) { // search class imports (e.g. import java.util.Date;)
+ for (String className : classes) {
+ // search class imports (e.g. import java.util.Date;)
if (className.equals(simpleClassName) || className.endsWith("." + simpleClassName)) {
namespace = className.substring(0, className.lastIndexOf(".") + 1) + "*";
}
}
- if (namespace == null) { // search package imports (e.g. import java.util.*;)
+ if (namespace == null) {
+ // search package imports (e.g. import java.util.*;)
Set<String> searchList = compiler.getImportedPackages();
if (defaultPackage != null) {
if (!defaultPackage.endsWith("*")) {
@@ -278,7 +293,8 @@
for (String currentPackage : searchList) {
String className = currentPackage + simpleClassName;
if (classExists(className, compiler)) {
- if (namespace != null) { // we've already found the same name in another package
+ if (namespace != null) {
+ // we've already found the same name in another package
compiler.reportError("symbol '" + simpleClassName + "' is ambiguous, found matching classes " + namespace.substring(0, namespace.length() - 1) + simpleClassName + " and " + currentPackage + simpleClassName + ". Use fully-qualified name to disambiguate.");
return null;
}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -37,8 +37,6 @@
import java.io.File;
import java.io.IOException;
import java.util.Map;
-import java.net.URL;
-import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
@@ -379,7 +377,11 @@
}
if (verbose) {
- printInit();
+ getLog().info(toString());
+ getLog().info("includes : " + Arrays.toString(includes));
+ for (String file : files) {
+ getLog().info("will parse " + file);
+ }
}
return true;
}
@@ -400,12 +402,12 @@
TagManager.reset(verbose);
engine = JAXXEngine.newLaunchor(src, files, this);
- boolean success = engine.run();
+ int nbFiles = engine.run();
report(engine);
- if (!success) {
+ if (nbFiles == -1) {
throw new MojoExecutionException("Aborting due to errors reported by jaxxc");
}
- getLog().info("Generated " + engine.getCompilerCount() + " file(s). ");
+ getLog().info("Generated " + nbFiles + " file(s). ");
if (generateHelp) {
// generate help
@@ -540,34 +542,6 @@
}
}
- protected void printInit() {
- getLog().info(toString());
- getLog().info("includes : " + Arrays.toString(includes));
- for (String file : files) {
- getLog().info("will parse " + file);
- }
-
- ClassLoader threadLoader = Thread.currentThread().getContextClassLoader();
- getLog().info(threadLoader.toString());
- if (threadLoader.getClass().getSimpleName().equals("RealmClassLoader")) {
- try {
- java.lang.reflect.Method m = threadLoader.getClass().getDeclaredMethod("getURLs");
- m.setAccessible(true);
- URL[] urls = (URL[]) m.invoke(threadLoader);
-
- for (URL url : urls) {
- getLog().info("url in class loader " + url);
- }
- } catch (Exception e) {
- getLog().warn("??? : " + e.getMessage(), e);
- }
- } else if (threadLoader instanceof URLClassLoader) {
- for (URL u : ((URLClassLoader) threadLoader).getURLs()) {
- getLog().info("url in class loader " + u);
- }
- }
- }
-
protected void generateHelp() throws IOException {
Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds();
if (helpIds.isEmpty()) {
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -12,7 +12,7 @@
assertNumberJaxxFiles(3);
checkPattern(mojo, "implements java.io.Serializable", true);
- checkPattern(mojo, "label.setText(_(\"test\"))", true);
+ checkPattern(mojo, "setText(_(\"test\"))", true);
}
}
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -9,7 +9,7 @@
GenerateMojo mojo = getMojo();
mojo.execute();
assertNumberJaxxFiles(1);
- checkPattern(mojo, "root.add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true);
+ checkPattern(mojo, "add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true);
}
}
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java 2009-10-26 02:47:48 UTC (rev 1599)
@@ -9,11 +9,11 @@
GenerateMojo mojo = getMojo();
mojo.i18nable = false;
mojo.execute();
- checkPattern(mojo, "testId.setText(_(\"test.text\"));", false);
+ checkPattern(mojo, "setText(_(\"test.text\"));", false);
mojo.i18nable = true;
mojo.execute();
- checkPattern(mojo, "testId.setText(_(\"test.text\"));", true);
+ checkPattern(mojo, "setText(_(\"test.text\"));", true);
checkPattern(mojo, "\"_(\\\"test.text\\\")\"", false);
}
@@ -22,11 +22,11 @@
GenerateMojo mojo = getMojo();
mojo.i18nable = false;
mojo.execute();
- checkPattern(mojo, "testId.setTitle(_(\"test.title\"));", false);
+ checkPattern(mojo, "setTitle(_(\"test.title\"));", false);
mojo.i18nable = true;
mojo.execute();
- checkPattern(mojo, "testId.setTitle(_(\"test.title\"));", true);
+ checkPattern(mojo, "setTitle(_(\"test.title\"));", true);
checkPattern(mojo, "\"_(\\\"test.title\\\")\"", false);
}
@@ -35,11 +35,11 @@
GenerateMojo mojo = getMojo();
mojo.i18nable = false;
mojo.execute();
- checkPattern(mojo, "testId.setToolTipText(_(\"test.toolTipText\"));", false);
+ checkPattern(mojo, "setToolTipText(_(\"test.toolTipText\"));", false);
mojo.i18nable = true;
mojo.execute();
- checkPattern(mojo, "testId.setToolTipText(_(\"test.toolTipText\"));", true);
+ checkPattern(mojo, "setToolTipText(_(\"test.toolTipText\"));", true);
checkPattern(mojo, "\"_(\\\"test.toolTipText\\\")\"", false);
}
}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1 +1 @@
-<JLabel id='label' implements="java.io.Serializable" text='test'/>
\ No newline at end of file
+<JLabel implements="java.io.Serializable" text='test'/>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1 +1 @@
-<JLabel id='label' text='test' implements="java.io.Serializable"/>
\ No newline at end of file
+<JLabel text='test' implements="java.io.Serializable"/>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1 +1 @@
-<JLabel implements="java.io.Serializable" text='test' id='label'/>
\ No newline at end of file
+<JLabel implements="java.io.Serializable" text='test'/>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1,3 +1,3 @@
-<JPanel id='root'>
+<JPanel>
<JButton id='boxedButton' decorator='boxed'/>
</JPanel>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1 +1 @@
-<javax.swing.JButton id='testId' text='test.text'/>
\ No newline at end of file
+<javax.swing.JButton text='test.text'/>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1 +1 @@
-<JDialog id='testId' title='test.title'/>
+<JDialog title='test.title'/>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1,3 +1,3 @@
<JTabbedPane>
- <tab id="testId" title='test.title'/>
+ <tab title='test.title'/>
</JTabbedPane>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1,5 +1,5 @@
<JTabbedPane>
- <tab id="testId" title='test.title'>
+ <tab title='test.title'>
<JLabel text='testLabel'/>
</tab>
</JTabbedPane>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1 +1 @@
-<javax.swing.JButton id='testId' toolTipText='test.toolTipText'/>
\ No newline at end of file
+<javax.swing.JButton toolTipText='test.toolTipText'/>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1,3 +1,3 @@
- <JTabbedPane id="testId" toolTipText='test.toolTipText'>
+ <JTabbedPane toolTipText='test.toolTipText'>
<tab title="text"/>
</JTabbedPane>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1,3 +1,3 @@
<JTabbedPane>
- <tab id="testId" toolTipText='test.toolTipText'/>
+ <tab toolTipText='test.toolTipText'/>
</JTabbedPane>
\ No newline at end of file
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx 2009-10-26 02:45:10 UTC (rev 1598)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx 2009-10-26 02:47:48 UTC (rev 1599)
@@ -1,5 +1,5 @@
<JTabbedPane>
- <tab id="testId" toolTipText='test.toolTipText'>
+ <tab toolTipText='test.toolTipText'>
<JLabel text='yo'/>
</tab>
</JTabbedPane>
\ No newline at end of file
1
0
r1598 - branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers
by tchemit@users.nuiton.org 26 Oct '09
by tchemit@users.nuiton.org 26 Oct '09
26 Oct '09
Author: tchemit
Date: 2009-10-26 03:45:10 +0100 (Mon, 26 Oct 2009)
New Revision: 1598
Modified:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
Log:
remove commented unused code
clean code
add javadoc
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2009-10-26 02:40:51 UTC (rev 1597)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2009-10-26 02:45:10 UTC (rev 1598)
@@ -40,77 +40,160 @@
*/
public class DefaultFinalizer implements JAXXCompilerFinalizer {
- /** log */
+ /**
+ * Logger
+ */
protected static final Log log = LogFactory.getLog(DefaultFinalizer.class);
+ /**
+ * serialVersionUID field
+ */
protected static final JavaField SERIAL_VERSION_UID_FIELD = newField(PRIVATE | STATIC | FINAL,
"long", "serialVersionUID", false, "1L");
+ /**
+ * $activeBindings field
+ */
protected static final JavaField ACTIVE_BINDINGS_FIELD = newField(PROTECTED,
"java.util.List<Object>", "$activeBindings", false, "new ArrayList<Object>()");
+ /**
+ *
+ */
protected static final JavaField BINDING_SOURCES_FIELD = newField(PROTECTED,
"java.util.Map<String,Object>", "$bindingSources", false, "new HashMap<String,Object>()");
+ /**
+ *
+ */
protected static final JavaField OBJECT_MAP_FIELD = newField(PROTECTED,
"Map<String,Object>", "$objectMap", true, "new HashMap<String,Object>()");
+ /**
+ *
+ */
protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = newField(PRIVATE,
"boolean", "allComponentsCreated", false);
+ /**
+ *
+ */
protected static final JavaField CONTEXT_INITIALIZED = newField(PRIVATE,
"boolean", "contextInitialized", false, "true");
+ /**
+ *
+ */
protected static final JavaField PREVIOUS_VALUES_FIELD = newField(PROTECTED,
"java.util.Map<?,?>", "$previousValues", false, "new java.util.HashMap<Object,Object>()");
+ /**
+ *
+ */
protected static final JavaField DELEGATE_CONTEXT_FIELD = newField(PROTECTED,
JAXXContext.class.getName(), "delegateContext", true);
+ /**
+ *
+ */
protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = newField(0,
"java.beans.PropertyChangeSupport", "$propertyChangeSupport", false);
+ /**
+ *
+ */
protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue",
"return delegateContext.getContextValue(clazz, null);", true,
new JavaArgument("Class<T>", "clazz"));
+ /**
+ *
+ */
protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue",
"return delegateContext.getContextValue(clazz, name);", true,
new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name"));
+ /**
+ *
+ */
protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue",
"delegateContext.setContextValue(o, name);", true,
new JavaArgument("T", "o"), new JavaArgument("String", "name"));
+ /**
+ *
+ */
protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue",
"delegateContext.setContextValue(o, null);", true,
new JavaArgument("T", "o"));
+ /**
+ *
+ */
protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue",
"delegateContext.removeContextValue(clazz, name);", true,
new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name"));
+ /**
+ *
+ */
protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue",
"delegateContext.removeContextValue(clazz, null);", true,
new JavaArgument("Class<T>", "clazz"));
+ /**
+ *
+ */
protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer",
"return delegateContext.getParentContainer(source, clazz);", true,
new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz"));
+ /**
+ *
+ */
protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer",
"return delegateContext.getParentContainer(clazz);", true,
new JavaArgument("Class<O>", "clazz"));
+ /**
+ *
+ */
protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = newMethod(PUBLIC, "java.lang.Object", "getObjectById",
"return $objectMap.get(id);", true,
new JavaArgument("String", "id"));
+ /**
+ *
+ */
protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor",
"return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);", false);
+ /**
+ *
+ */
protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = newMethod(PUBLIC, "void", "processDataBinding",
"processDataBinding(dest, false);", true,
new JavaArgument("String", "dest"));
+ /**
+ *
+ */
protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = newMethod(PUBLIC, "void", "firePropertyChange",
"super.firePropertyChange(propertyName, oldValue, newValue);", true,
new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue"));
+ /**
+ *
+ */
protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = newMethod(PUBLIC, "void", "firePropertyChange",
"$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", true,
new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue"));
+ /**
+ *
+ */
protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport",
"if ($propertyChangeSupport == null)\n" +
" $propertyChangeSupport = new PropertyChangeSupport(this);\n" +
"return $propertyChangeSupport;", false);
+ /**
+ *
+ */
protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener",
"$getPropertyChangeSupport().addPropertyChangeListener(listener);", true,
new JavaArgument("java.beans.PropertyChangeListener", "listener"));
+ /**
+ *
+ */
protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener",
"$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", true,
new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener"));
+ /**
+ *
+ */
protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener",
"$getPropertyChangeSupport().removePropertyChangeListener(listener);", true,
new JavaArgument("java.beans.PropertyChangeListener", "listener"));
+ /**
+ *
+ */
protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener",
"$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", true,
new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener"));
@@ -122,7 +205,6 @@
if (root == null) {
throw new CompilerException("root tag must be a class tag");
}
- //Map<String, CompiledObject> objects = compiler.getObjects();
ClassDescriptor superclass = root.getObjectClass();
boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(superclass);
javaFile.setModifiers(PUBLIC);
@@ -144,13 +226,13 @@
// DataBinding
for (DataBinding dataBinding : compiler.getDataBindings()) {
- if (dataBinding.compile(true)) {
- compiler.getInitDataBindings().append("applyDataBinding(").append(compiler.getJavaCode(dataBinding.getId())).append(");").append(eol);
+ if (dataBinding.compile(compiler, true)) {
+ String expression = "applyDataBinding(" + compiler.getJavaCode(dataBinding.getId()) + ");" + eol;
+ compiler.appendInitDataBindings(expression);
}
}
if (superclassIsJAXXObject) {
-// boolean hasBind = compiler.getApplyDataBinding().length() > 0;
boolean hasBind = compiler.hasApplyDataBinding();
if (hasBind) {
compiler.appendApplyDataBinding(" else {");
@@ -167,7 +249,6 @@
}
hasBind = compiler.hasRemoveDataBinding();
-// hasBind = compiler.getRemoveDataBinding().length() > 0;
if (hasBind) {
compiler.appendRemoveDataBinding(" else {");
compiler.appendRemoveDataBinding(eol);
@@ -250,7 +331,6 @@
needField = parentCompiler.getStylesheet() == null;
} else {
try {
-
superclass.getDeclaredFieldDescriptor(PREVIOUS_VALUES_FIELD.getName());
needField = false;
} catch (NoSuchFieldException ex) {
@@ -327,19 +407,19 @@
int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit
if (data.length() < sizeLimit) {
- return newField(PRIVATE | STATIC, "java.lang.String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data));
+ return newField(PRIVATE | STATIC, "String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data));
} else {
StringBuffer initializer = new StringBuffer();
for (int i = 0; i < data.length(); i += sizeLimit) {
String name = "$jaxxObjectDescriptor" + i;
- javaFile.addField(new JavaField(PRIVATE | STATIC, "java.lang.String", name, false,
+ javaFile.addField(new JavaField(PRIVATE | STATIC, "String", name, false,
compiler.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length())))));
if (initializer.length() > 0) {
initializer.append(" + ");
}
initializer.append("String.valueOf(").append(name).append(")");
}
- return newField(PRIVATE | STATIC | FINAL, "java.lang.String", "$jaxxObjectDescriptor", false, initializer.toString());
+ return newField(PRIVATE | STATIC | FINAL, "String", "$jaxxObjectDescriptor", false, initializer.toString());
}
} catch (IOException e) {
throw new RuntimeException("Internal error: can't-happen error", e);
@@ -464,10 +544,8 @@
lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall);
}
root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall);
-// code.append(eol);
if (compiler.getInitializer().length() > 0) {
code.append(compiler.getInitializer());
-// code.append(eol);
}
code.append("$completeSetup();");
code.append(eol);
1
0
r1597 - branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css
by tchemit@users.nuiton.org 26 Oct '09
by tchemit@users.nuiton.org 26 Oct '09
26 Oct '09
Author: tchemit
Date: 2009-10-26 03:40:51 +0100 (Mon, 26 Oct 2009)
New Revision: 1597
Modified:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
Log:
remove commented unused code
clean code
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2009-10-26 02:36:35 UTC (rev 1596)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2009-10-26 02:40:51 UTC (rev 1597)
@@ -158,70 +158,6 @@
} catch (NoSuchMethodException e) {
compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
}
-
- /*if (pseudoClass.equals("mouseover")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseout")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- compiler.appendInitDataBindings("{" + propertyCode + "}");
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mousedown")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseup")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- compiler.appendInitDataBindings("{" + propertyCode + "}");
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.startsWith("{")) {
- pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
- pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
- String dest = object.getId() + ".style." + pseudoClass + ".add";
- String destCode = TypeManager.getJavaCode(dest);
- if (compiler.hasProcessDataBinding()) {
- compiler.appendProcessDataBinding("else ");
- }
- compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }");
- new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
- compiler.appendInitDataBindings("applyDataBinding("+ destCode + ");");
- } else
- throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);*/
}
public static void compilePseudoClassRemove(String pseudoClass, CompiledObject object, String propertyCode, JAXXCompiler compiler) throws CompilerException {
@@ -268,69 +204,6 @@
} catch (NoSuchMethodException e) {
compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
}
-
- /*if (pseudoClass.equals("mouseover")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseout")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mousedown")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseup")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.startsWith("{")) {
- pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
- pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
- String dest = object.getId() + ".style." + pseudoClass + ".remove";
- String destCode = TypeManager.getJavaCode(dest);
- if (compiler.hasProcessDataBinding()) {
- compiler.appendProcessDataBinding("else ");
- }
- compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
- new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
- compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");");
- } else {
- throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);
- }*/
}
public static String invert(String javaCode) {
@@ -366,9 +239,10 @@
pseudoClass = pseudoClass.substring(0, pseudoClass.indexOf("["));
}
final StringBuffer buffer = new StringBuffer();
-
+
DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass());
boolean valueDeclared = false;
+ String eol = JAXXCompiler.getLineSeparator();
for (Map.Entry<String, String> e : properties.entrySet()) {
String property = e.getKey();
ClassDescriptor type = handler.getPropertyType(object, property, compiler);
@@ -376,8 +250,8 @@
String valueCode;
if (dataBinding != null) {
valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
- new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
- property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false);
+ DataBinding dataBinding1 = new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler));
+ dataBinding1.compile(compiler, false);
} else {
try {
Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
@@ -391,12 +265,12 @@
buffer.append("java.lang.Object ");
valueDeclared = true;
}
- buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator());
- buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator());
+ buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(eol);
+ buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(eol);
String unwrappedValue = unwrap(type, "value");
buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
- ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator());
- buffer.append("}").append(JAXXCompiler.getLineSeparator());
+ ") " + unwrappedValue, compiler)).append(eol);
+ buffer.append("}").append(eol);
}
if (pseudoClass.equals("focused")) {
@@ -424,8 +298,8 @@
String valueCode;
if (dataBinding != null) {
valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
- new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
- property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false);
+ DataBinding dataBinding1 = new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler));
+ dataBinding1.compile(compiler, false);
} else {
try {
Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
@@ -439,12 +313,12 @@
buffer.append("java.lang.Object ");
valueDeclared = true;
}
- buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator());
- buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator());
+ buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(eol);
+ buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(eol);
String unwrappedValue = unwrap(type, "value");
buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
- ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator());
- buffer.append("}").append(JAXXCompiler.getLineSeparator());
+ ") " + unwrappedValue, compiler)).append(eol);
+ buffer.append("}").append(eol);
}
compilePseudoClassRemove(pseudoClass, object, buffer.toString(), compiler);
}
1
0
r1596 - branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script
by tchemit@users.nuiton.org 26 Oct '09
by tchemit@users.nuiton.org 26 Oct '09
26 Oct '09
Author: tchemit
Date: 2009-10-26 03:36:35 +0100 (Mon, 26 Oct 2009)
New Revision: 1596
Modified:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
Log:
remove commented unused code
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2009-10-25 19:49:15 UTC (rev 1595)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2009-10-26 02:36:35 UTC (rev 1596)
@@ -49,7 +49,6 @@
script = trimScript(script);
StringBuffer result = new StringBuffer();
JavaParser p = new JavaParser(new StringReader(script));
- //JavaParser p = new JavaParser(new StringReader(script + ";"));
while (!p.Line()) {
SimpleNode node = p.popNode();
if (node != null) {
@@ -186,7 +185,6 @@
}
compiler.appendBodyCode(modifiers + " " + node.getText().substring(0, node.getText().length() - 1) + code + "}");
- //compiler.bodyCode.append(";\n");
}
private void scanScriptNode(SimpleNode node) throws CompilerException {
@@ -239,7 +237,6 @@
}
}
compiler.appendBodyCode(node.getText());
- //compiler.bodyCode.append(";\n");
compiler.addScriptMethod(new MethodDescriptor(name, Modifier.PUBLIC, returnType, parameterTypes.toArray(new String[parameterTypes.size()]), compiler.getClassLoader()));
} else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION ||
nodeType == JavaParserTreeConstants.JJTINITIALIZER) {
@@ -248,7 +245,6 @@
str += ";";
}
compiler.appendBodyCode(str);
- //compiler.bodyCode.append(";\n");
} else if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) {
processConstructor(node.getChild(0).getChild(0).getText(), node.getChild(0).getChild(1));
} else if (nodeType == JavaParserTreeConstants.JJTLOCALVARIABLEDECLARATION || nodeType == JavaParserTreeConstants.JJTFIELDDECLARATION) {
@@ -276,7 +272,6 @@
String type = TagManager.resolveClassName(className, compiler);
compiler.addScriptField(new FieldDescriptor(name, Modifier.PUBLIC, type, compiler.getClassLoader())); // TODO: determine the actual modifiers
if (equals != -1 && !isFinal && !isStatic) { // declare the field in the class body, but wait to actually initialize it
- //compiler.bodyCode.append(text.substring(0, equals).trim());
compiler.appendBodyCode(text.substring(0, equals).trim() + ";");
String initializer = text.substring(equals + 1).trim();
if (type.endsWith("[]")) {
@@ -294,7 +289,6 @@
compiler.appendBodyCode(text);
}
compiler.appendBodyCode("\n");
- //compiler.bodyCode.append(";\n");
} else {
String text = node.getText().trim();
if (text.length() > 0) {
@@ -302,14 +296,12 @@
text += ";";
}
compiler.appendInitializerCode(text);
- //compiler.initializer.append(";\n");
}
}
}
public void registerScript(String script) throws CompilerException {
JavaParser p = new JavaParser(new StringReader(script));
- //JavaParser p = new JavaParser(new StringReader(script + ";"));
while (!p.Line()) {
SimpleNode node = p.popNode();
if (node != null) {
1
0
Author: tchemit
Date: 2009-10-25 20:49:15 +0100 (Sun, 25 Oct 2009)
New Revision: 1595
Added:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jj
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jjt
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jj
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jjt
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.CompiledObjectDecorator
branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.JAXXCompilerFinalizer
Removed:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator
branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator
Modified:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java
branches/jaxx-2.X/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java
Log:
- Evolution #100: am?\195?\169lioration du design du compilateur
- Evolution #99: Am?\195?\169liorer le code g?\195?\169n?\195?\169r?\195?\169
- amelioration des test dans le plugin
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -4,7 +4,6 @@
*/
package jaxx.compiler;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorLoader;
import jaxx.compiler.reflect.MethodDescriptor;
@@ -409,8 +408,10 @@
* @see #getInitializationCode
*/
public void appendInitializationCode(String code) {
- this.initializationCode.append(code);
- this.initializationCode.append(JAXXCompiler.getLineSeparator());
+ if (!code.isEmpty()) {
+ this.initializationCode.append(code);
+ this.initializationCode.append(JAXXCompiler.getLineSeparator());
+ }
}
/**
@@ -420,8 +421,10 @@
* @see #getAdditionCode
*/
public void appendAdditionCode(String code) {
- this.additionCode.append(code);
- this.additionCode.append(JAXXCompiler.getLineSeparator());
+ if (!code.isEmpty()) {
+ this.additionCode.append(code);
+ this.additionCode.append(JAXXCompiler.getLineSeparator());
+ }
}
/**
@@ -553,9 +556,9 @@
return getObjectClass().getName() + "[id='" + id + "']";
}
- public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException {
- compiler.registerDataBinding(src, getId() + "." + property, assignment);
- }
+// public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException {
+// compiler.registerDataBinding(src, getId() + "." + property, assignment);
+// }
public String getGenericTypes() {
if (getGenericTypesLength() == 0) {
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,64 @@
+package jaxx.compiler;
+
+import jaxx.compiler.java.JavaFile;
+
+/**
+ *
+ * Contract of compiled object decorator at generation time.
+ *
+ * Note : The implementation of this class must be stateless.
+ *
+ * @author tony
+ * @since 1.2
+ */
+public interface CompiledObjectDecorator {
+
+ /**
+ *
+ * @return the name of the decorator (match the content of a decorator
+ * attribute value in a JAXX file)
+ */
+ String getName();
+
+ /**
+ *
+ * @param compiler
+ * @param object
+ * @param javaFile
+ * @param initDataBindings
+ * @return
+ */
+ String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings);
+
+ /**
+ *
+ * @param compiler
+ * @param root
+ * @param object
+ * @param code
+ * @param lastWasMethodCall
+ * @return
+ */
+ boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall);
+
+ /**
+ *
+ * @param compiler
+ * @param root
+ * @param object
+ * @param javaFile
+ * @param packageName
+ * @param className
+ * @param fullClassName
+ */
+ void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName);
+
+ /**
+ *
+ * @param compiler
+ * @param object
+ * @return
+ * @throws CompilerException
+ */
+ String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException;
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,7 +1,6 @@
package jaxx.compiler;
import java.io.File;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
import jaxx.runtime.JAXXContext;
/**
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -62,7 +62,7 @@
}
return false; // no dependencies, just a static expression
}
- if (compiler.haveProcessDataBinding()) {
+ if (compiler.hasProcessDataBinding()) {
compiler.appendProcessDataBinding(" else ");
} else {
compiler.appendProcessDataBinding(" ");
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -4,11 +4,11 @@
*/
package jaxx.compiler;
-import jaxx.compiler.io.JavaField;
-import jaxx.compiler.parser.java.JavaParser;
-import jaxx.compiler.parser.java.JavaParserConstants;
-import jaxx.compiler.parser.java.JavaParserTreeConstants;
-import jaxx.compiler.parser.java.SimpleNode;
+import jaxx.compiler.java.JavaField;
+import jaxx.compiler.java.parser.JavaParser;
+import jaxx.compiler.java.parser.JavaParserConstants;
+import jaxx.compiler.java.parser.JavaParserTreeConstants;
+import jaxx.compiler.java.parser.SimpleNode;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorLoader;
import jaxx.compiler.reflect.FieldDescriptor;
@@ -416,7 +416,7 @@
String javaCodeId = TypeManager.getJavaCode(id);
String eol = JAXXCompiler.getLineSeparator();
if (addListenerCode.length() > 0) {
- if (compiler.haveApplyDataBinding()) {
+ if (compiler.hasApplyDataBinding()) {
compiler.appendApplyDataBinding(" else ");
}
compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
@@ -430,7 +430,7 @@
}
if (removeListenerCode.length() > 0) {
- if (compiler.haveRemoveDataBinding()) {
+ if (compiler.hasRemoveDataBinding()) {
compiler.appendRemoveDataBinding(" else ");
}
compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol);
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,6 +1,5 @@
package jaxx.compiler;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -4,12 +4,12 @@
*/
package jaxx.compiler;
-import jaxx.compiler.io.JavaMethod;
-import jaxx.compiler.io.JavaField;
-import jaxx.compiler.io.JavaFile;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
-import jaxx.compiler.generators.Generator;
-import jaxx.compiler.parser.java.ParseException;
+import jaxx.compiler.css.StylesheetHelper;
+import jaxx.compiler.script.ScriptManager;
+import jaxx.compiler.java.JavaMethod;
+import jaxx.compiler.java.JavaField;
+import jaxx.compiler.java.JavaFile;
+import jaxx.compiler.java.parser.ParseException;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorLoader;
import jaxx.compiler.reflect.FieldDescriptor;
@@ -65,12 +65,13 @@
import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import jaxx.compiler.java.JavaFileGenerator;
import jaxx.compiler.types.TypeManager;
/**
* Compiles JAXX files into Java classes.
* <p/>
- * use {@link Generator} ... todo finish javadoc
+ * use {@link JAXXCompilerFinalizer} ... todo finish javadoc
*/
public class JAXXCompiler {
@@ -82,7 +83,7 @@
* True to throw exceptions when we encounter unresolvable classes, false to ignore.
* This is currently set to false until JAXX has full support for inner classes
* (including enumerations), because currently they don't always resolve (but will
- * generally compile without error anyway).
+ * generally run without error anyway).
*/
public static final boolean STRICT_CHECKS = false;
/**
@@ -101,14 +102,10 @@
* The unique object handler used in first pass
*/
protected final DefaultObjectHandler firstPassClassTagHandler;
-// /**
-// * list of static imports
-// */
-// protected List<String> staticImports = new ArrayList<String>();
- /*---------------------------------------------------------------------------------*/
- /*-- compiler fields --------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- compiler fields -----------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
/**
* flag to detec if an error occurs while compiling jaxx file
*/
@@ -147,7 +144,7 @@
*/
protected File baseDir;
/**
- * .jaxx file being compiled.
+ * jaxx file being compiled.
*/
protected File src;
/**
@@ -234,23 +231,23 @@
* Code to initialize data bindings.
*/
protected StringBuffer initDataBindings = new StringBuffer();
- /**
+ /**
* Body of the applyDataBinding method.
*/
protected StringBuffer applyDataBinding = new StringBuffer();
- /**
+ /**
* Body of the removeDataBinding method.
*/
protected StringBuffer removeDataBinding = new StringBuffer();
- /**
+ /**
* Body of the processDataBinding method.
*/
protected StringBuffer processDataBinding = new StringBuffer();
- /**
+ /**
* true if a main() method has been declared in a script
*/
protected boolean mainDeclared;
- /**
+ /**
* the file to be generated
*/
protected JavaFile javaFile;
@@ -258,19 +255,19 @@
* configuration of the compiler
*/
protected CompilerConfiguration configuration;
- /**
+ /**
* Used for error reporting purposes, so we can report the right line number.
*/
protected Stack<Element> tagsBeingCompiled = new Stack<Element>();
- /**
+ /**
* Used for error reporting purposes, so we can report the right source file.
*/
protected Stack<File> sourceFiles = new Stack<File>();
- /**
+ /**
* Maps object ID strings to the objects themselves. These are created during the second compilation pass.
*/
protected Map<String, CompiledObject> objects = new LinkedHashMap<String, CompiledObject>();
- /**
+ /**
* Maps objects to their ID strings. These are created during the second compilation pass.
*/
protected Map<CompiledObject, String> ids = new LinkedHashMap<CompiledObject, String>();
@@ -283,39 +280,12 @@
*/
protected final JAXXEngine engine;
- /*---------------------------------------------------------------------------------*/
- /*-- Constructor methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-// protected JAXXCompiler(ClassLoader classLoader) {
-//
-// this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class));
-// this.configuration = new DefaultCompilerConfiguration();
-// this.classLoader = classLoader;
-//// this.staticImports = Arrays.asList(new String[]{
-//// "java.awt.*",
-//// "java.awt.event.*",
-//// "java.beans.*",
-//// "java.io.*",
-//// "java.lang.*",
-//// "java.util.*",
-//// "javax.swing.*",
-//// "javax.swing.border.*",
-//// "javax.swing.event.*",
-//// "jaxx.runtime.swing.JAXXButtonGroup",
-//// "jaxx.runtime.swing.HBox",
-//// "jaxx.runtime.swing.VBox",
-//// "jaxx.runtime.swing.Table",
-//// "static org.nuiton.i18n.I18n._",
-//// "static jaxx.runtime.Util.createImageIcon"
-//// });
-// addImport("java.lang.*");
-// }
/**
* Creates a new JAXXCompiler.
*
* @param engine engine which use the compiler (could be null if not attach to any engine)
* @param baseDir classpath location
- * @param src location of file to compile
+ * @param src location of file to run
* @param outputClassName the out file name
* @param configuration configuration to pass to javac
* @param defaultImports list of default imports to add to java files
@@ -325,23 +295,6 @@
this.baseDir = baseDir;
this.src = src;
this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class));
-// this.staticImports = Arrays.asList(new String[]{
-// "java.awt.*",
-// "java.awt.event.*",
-// "java.beans.*",
-// "java.io.*",
-// "java.lang.*",
-// "java.util.*",
-// "javax.swing.*",
-// "javax.swing.border.*",
-// "javax.swing.event.*",
-// "jaxx.runtime.swing.JAXXButtonGroup",
-// "jaxx.runtime.swing.HBox",
-// "jaxx.runtime.swing.VBox",
-// "jaxx.runtime.swing.Table",
-// "static org.nuiton.i18n.I18n._",
-// "static jaxx.runtime.Util.createImageIcon"
-// });
sourceFiles.push(src);
this.outputClassName = outputClassName;
this.configuration = configuration;
@@ -368,9 +321,9 @@
}
}
- /*---------------------------------------------------------------------------------*/
- /*-- Initializer methods -----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Initializer methods -------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void runInitializers() {
for (Runnable runnable : initializers) {
if (log.isDebugEnabled()) {
@@ -397,9 +350,9 @@
initializers.add(r);
}
- /*---------------------------------------------------------------------------------*/
- /*-- Compile methods --------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Compile methods -----------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void compileFirstPass(final Element tag) throws IOException {
tagsBeingCompiled.push(tag);
@@ -505,7 +458,6 @@
if (finished != tag) {
throw new RuntimeException("internal error: just finished compiling " + tag + ", but top of tagsBeingCompiled stack is " + finished);
}
-
}
protected void compileFirstPass() throws IOException {
@@ -528,9 +480,9 @@
compileSecondPass(document.getDocumentElement());
}
- /*---------------------------------------------------------------------------------*/
- /*-- CompiledObject methods -------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- CompiledObject methods ----------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void openComponent(CompiledObject component) throws CompilerException {
openComponent(component, null);
}
@@ -579,7 +531,7 @@
objects.put(id, object);
ids.put(object, id);
if (object.getDecorator() == null) {
- // use compiler decorator
+ // use default decorator
object.setDecorator(defaultDecorator);
}
}
@@ -627,9 +579,9 @@
return result;
}
- /*---------------------------------------------------------------------------------*/
- /*-- DataBinding methods ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- DataBinding methods -------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
/**
* Examine an attribute value for data binding expressions. Returns a 'cooked' expression which
* can be used to determine the resulting value. It is expected that this expression will be used
@@ -692,6 +644,9 @@
public void registerDataBinding(String src, String dest, String assignment) {
try {
src = checkJavaCode(src);
+// if (log.isDebugEnabled()) {
+// log.info(getRootObject().getId() + " src=" + src + ", dst=" + dest.trim());
+// }
dataBindings.add(new DataBinding(src, dest, assignment, this));
} catch (CompilerException e) {
reportError("While parsing data binding for '" + dest.substring(dest.lastIndexOf(".") + 1) + "': " + e.getMessage());
@@ -732,9 +687,9 @@
return result;
}
- /*---------------------------------------------------------------------------------*/
- /*-- Script methods ---------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Script methods ------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void addScriptField(FieldDescriptor field) {
symbolTable.getScriptFields().add(field);
}
@@ -772,9 +727,9 @@
return scriptManager.preprocessScript(script);
}
- /*---------------------------------------------------------------------------------*/
- /*-- StyleSheet methods -----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- StyleSheet methods --------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void applyStylesheets() {
for (Object o : new ArrayList<CompiledObject>(objects.values())) {
CompiledObject object = (CompiledObject) o;
@@ -794,9 +749,9 @@
inlineStyles.add(StylesheetHelper.inlineAttribute(object, propertyName, dataBinding));
}
- /*---------------------------------------------------------------------------------*/
- /*-- Report methods ---------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Report methods ------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void reportWarning(String warning) {
Element currentTag = null;
if (!tagsBeingCompiled.isEmpty()) {
@@ -819,16 +774,21 @@
} catch (IOException e) {
// ignore ?
}
-
- System.err.print(srcFile);
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(srcFile);
+// System.err.print(srcFile);
if (lineNumber != null) {
- System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1));
+ buffer.append(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1));
+// System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1));
}
- System.err.println(": Warning: " + warning);
+ buffer.append(getLineSeparator()).append(warning.trim());
+// System.err.println(": Warning: " + warning);
if (engine != null) {
- engine.warningCount++;
+ engine.addWarning(buffer.toString());
+// engine.warningCount++;
+ } else {
+ System.err.println(buffer.toString());
}
-// JAXXEngine.get().warningCount++;
}
public void reportError(String error) {
@@ -886,22 +846,27 @@
} catch (IOException e) {
// ignore ?
}
-
- System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>");
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(errorFile != null ? errorFile.getPath() : "<unknown source>");
+// System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>");
if (lineNumber > 0) {
- System.err.print(":" + lineNumber);
+ buffer.append(":" + lineNumber);
+// System.err.print(":" + lineNumber);
}
- System.err.println(": " + error);
+ buffer.append(getLineSeparator()).append(": " + error);
+// System.err.println(": " + error);
if (engine != null) {
- engine.errorCount++;
+ engine.addError(buffer.toString());
+// engine.errorCount++;
+ } else {
+ System.err.println(buffer.toString());
}
-// JAXXEngine.get().errorCount++;
failed = true;
}
- /*---------------------------------------------------------------------------------*/
- /*-- Getter methods ---------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Getter methods ------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public Map<String, CompiledObject> getObjects() {
return objects;
}
@@ -910,9 +875,6 @@
return dataBindings;
}
- /*public List<CompiledBeanValidator> getValidators() {
- return validators;
- }*/
public Map<String, Map<ClassDescriptor, List<EventHandler>>> getEventHandlers() {
return eventHandlers;
}
@@ -1055,16 +1017,16 @@
return new JAXXObjectDescriptor(descriptors, css);
}
- /*---------------------------------------------------------------------------------*/
- /*-- Setter methods ---------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Setter methods ------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void setFailed(boolean failed) {
this.failed = failed;
}
- /*---------------------------------------------------------------------------------*/
- /*-- Buffer ------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Buffer --------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public StringBuffer getInitializer() {
return initializer;
}
@@ -1129,15 +1091,15 @@
getLateInitializer().append(code);
}
- public boolean haveProcessDataBinding() {
+ public boolean hasProcessDataBinding() {
return getProcessDataBinding().length() > 0;
}
- public boolean haveApplyDataBinding() {
+ public boolean hasApplyDataBinding() {
return getApplyDataBinding().length() > 0;
}
- public boolean haveRemoveDataBinding() {
+ public boolean hasRemoveDataBinding() {
return getRemoveDataBinding().length() > 0;
}
@@ -1146,8 +1108,7 @@
}
public boolean hasMethod(String methodName) {
- JavaMethod[] methods = getJavaFile().getMethods();
- for (JavaMethod method : methods) {
+ for (JavaMethod method : getJavaFile().getMethods()) {
if (methodName.equals(method.getName())) {
return true;
}
@@ -1155,9 +1116,9 @@
return false;
}
- /*---------------------------------------------------------------------------------*/
- /*-- Other methods ----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
+ /*-- Other methods -------------------------------------------------------*/
+ /*------------------------------------------------------------------------*/
public void addImport(String text) {
if (text.endsWith("*")) {
importedPackages.add(text.substring(0, text.length() - 1));
@@ -1172,8 +1133,7 @@
public void addDependencyClass(String className) {
-// if (!JAXXEngine.get().jaxxFileClassNames.contains(className)) {
- if (!engine.jaxxFileClassNames.contains(className)) {
+ if (!engine.containsJaxxFileClassName(className)) {
URL jaxxURL = getClassLoader().getResource(className.replace('.', '/') + ".jaxx");
URL classURL = getClassLoader().getResource(className.replace('.', '/') + ".class");
if (jaxxURL != null && classURL != null) {
@@ -1198,14 +1158,11 @@
assert jaxxFile.getName().equalsIgnoreCase(className.substring(className.lastIndexOf(".") + 1) + ".jaxx") :
"expecting file name to match " + className + ", but found " + jaxxFile.getName();
if (jaxxFile.getName().equals(className.substring(className.lastIndexOf(".") + 1) + ".jaxx")) { // check case match
-// if (JAXXEngine.get().currentPass != JAXXEngine.LifeCycle.compile_first_pass) {
- if (engine.currentPass != JAXXEngine.LifeCycle.compile_first_pass) {
+ if (engine.getCurrentPass() != JAXXEngine.LifeCycle.compile_first_pass) {
throw new AssertionError("Internal error: adding dependency class " + className + " during second compilation pass");
}
-// JAXXEngine.get().jaxxFileClassNames.add(className);
-// JAXXEngine.get().jaxxFiles.add(jaxxFile);
- engine.jaxxFileClassNames.add(className);
- engine.jaxxFiles.add(jaxxFile);
+ engine.addJaxxFileClassName(className);
+ engine.addJaxxFile(jaxxFile);
}
}
}
@@ -1402,7 +1359,26 @@
return javaFile;
}
- public void generateCode(Iterable<Generator> generatorIterator) throws IOException {
+ public void finalizeCompilers(Iterable<JAXXCompilerFinalizer> generatorIterator) throws Exception {
+
+ int dotPos = getOutputClassName().lastIndexOf(".");
+ String packageName = dotPos != -1 ? getOutputClassName().substring(0, dotPos) : null;
+ String simpleClassName = getOutputClassName().substring(dotPos + 1);
+ CompiledObject compiledObject = getRootObject();
+ for (JAXXCompilerFinalizer generator : generatorIterator) {
+ generator.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName);
+ }
+
+ for (CompiledObject object : getObjects().values()) {
+ object.finalizeCompiler();
+ }
+
+ for (JAXXCompilerFinalizer generator : generatorIterator) {
+ generator.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName);
+ }
+ }
+
+ public void generate(JavaFileGenerator generator, Iterable<JAXXCompilerFinalizer> generatorIterator) throws IOException {
File dest;
if (getConfiguration().getTargetDirectory() != null) {
dest = new File(getConfiguration().getTargetDirectory(), getOutputClassName().replace('.', File.separatorChar) + ".java");
@@ -1412,37 +1388,20 @@
if (dest.exists() && !dest.setLastModified(System.currentTimeMillis())) {
log.warn("could not touch file " + dest);
}
+ PrintWriter out = null;
try {
- PrintWriter out = new PrintWriter(new FileWriter(dest));
- int dotPos = getOutputClassName().lastIndexOf(".");
- String packageName = dotPos != -1 ? getOutputClassName().substring(0, dotPos) : null;
- String simpleClassName = getOutputClassName().substring(dotPos + 1);
- CompiledObject compiledObject = getRootObject();
- for (Generator generator : generatorIterator) {
- generator.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName);
- }
-
- for (CompiledObject object : getObjects().values()) {
- object.finalizeCompiler();
- }
-
- for (Generator generator : generatorIterator) {
- generator.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName);
- }
- out.println(javaFile.toString());
- out.close();
- } catch (RuntimeException e) {
+ out = new PrintWriter(new FileWriter(dest));
+ generator.generateFile(javaFile, out);
+ } catch (IOException e) {
// file could not be generated, so delete it...
if (!dest.delete()) {
log.warn("could not delete file " + dest);
}
throw e;
- } catch (ClassNotFoundException e) {
- // file could not be generated, so delete it...
- if (!dest.delete()) {
- log.warn("could not delete file " + dest);
+ } finally {
+ if (out != null) {
+ out.close();
}
- throw new CompilerException(e);
}
}
/** line separator cached value */
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,39 @@
+package jaxx.compiler;
+
+import jaxx.compiler.java.JavaFile;
+
+/**
+ * Contract of any object to interact with a {@link JAXXCompiler} before the
+ * generation pass.
+ *
+ * @author chemit
+ * @since 2.0.0
+ */
+public interface JAXXCompilerFinalizer {
+
+ /**
+ * Finalize compiler for a given compiler on the finalizer pass before any
+ * generation.
+ *
+ * @param root the root object
+ * @param compiler the current compiler
+ * @param javaFile the java file to generate
+ * @param packageName the package name of the file to generate
+ * @param className the class name of the file to generate
+ * @throws Exception
+ */
+ void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws Exception;
+
+ /**
+ * Prepare java file after any compiler finalizer pass, says the last
+ * action before generation.
+ *
+ * @param root the root object
+ * @param compiler the current compiler
+ * @param javaFile the java file to generate
+ * @param packageName the package name of the file to generate
+ * @param className the class name of the file to generate
+ * @throws Exception
+ */
+ void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws Exception;
+}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,6 +1,6 @@
package jaxx.compiler;
-import jaxx.compiler.generators.Generator;
+import jaxx.compiler.java.JavaFileGenerator;
import jaxx.compiler.spi.Initializer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -15,7 +15,6 @@
import java.util.Map;
import java.util.ServiceLoader;
import java.util.TreeMap;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
/**
* @author chemit
@@ -28,15 +27,21 @@
*/
protected static final Log log = LogFactory.getLog(JAXXEngine.class);
- protected enum LifeCycle {
+ public void addJaxxFileClassName(String className) {
+ jaxxFileClassNames.add(className);
+ }
- init,// state before compilation
- compile_first_pass, // state when first pass of compilation
- compile_second_pass, // state when second pass of compilation
- stylesheet_pass, // state when applygin stylesheet phase after compilation
- generate_pass, // state when generation phase
- profile_pass // state when profile
+ public void addJaxxFile(File jaxxFile) {
+ jaxxFiles.add(jaxxFile);
}
+
+ public boolean containsJaxxFileClassName(String className) {
+ return jaxxFileClassNames.contains(className);
+ }
+
+ public LifeCycle getCurrentPass() {
+ return currentPass;
+ }
/** shared instance of unique launchor at a givne time. */
protected static JAXXEngine singleton;
@@ -52,7 +57,7 @@
/**
* Create a new launchor and set it as current launchor accessible via method {@link #get()}.
* <p/>
- * The launchor will be prepared to compile a set of files, expressed as paths relative to a base directory.
+ * The launchor will be prepared to run a set of files, expressed as paths relative to a base directory.
* The class names of the compiled files are derived from the relative path strings
* (e.g. "example/Foo.jaxx" compiles into a class named "example.Foo").
*
@@ -78,10 +83,10 @@
/**
* Create a new launchor and set it as current launchor accessible via method {@link #get()}.
* <p/>
- * The launchor will be prepared to compile a set of files, with the class names specified explicitly.
+ * The launchor will be prepared to run a set of files, with the class names specified explicitly.
* The class compiled from files[i] will be named classNames[i].
*
- * @param files the .jaxx files to compile
+ * @param files the .jaxx files to run
* @param classNames the names of the classes being compiled
* @param configuration the compiler configuration to use
* @return the new instanciated launchor
@@ -134,21 +139,21 @@
*/
protected CompilerConfiguration configuration;
/**
- * original list of files to compile
+ * original list of files to run
*/
protected final File[] files;
/**
- * original list of classes to compile
+ * original list of classes to run
*/
protected final String[] classNames;
/**
* Files to be treated while compilation.
*/
- protected List<File> jaxxFiles = new ArrayList<File>();
+ private List<File> jaxxFiles = new ArrayList<File>();
/**
* Class names corresponding to the files in the jaxxFiles list.
*/
- protected List<String> jaxxFileClassNames = new ArrayList<String>();
+ private List<String> jaxxFileClassNames = new ArrayList<String>();
/**
* Maps the names of classes being compiled to the compiler instance handling the compilation.
*/
@@ -160,15 +165,23 @@
/**
*
*/
- protected LifeCycle currentPass;
+ private LifeCycle currentPass;
+// /**
+// *
+// */
+// protected int errorCount;
+// /**
+// *
+// */
+// protected int warningCount;
/**
- *
+ * Warnings detected while running.
*/
- protected int errorCount;
+ protected List<String> warnings = new ArrayList<String>();
/**
- *
+ * Errors detected while running.
*/
- protected int warningCount;
+ protected List<String> errors = new ArrayList<String>();
/**
* number of registred compiler
*/
@@ -182,31 +195,245 @@
*/
protected Map<String, CompiledObjectDecorator> decorators;
/**
- * generators available in engine
+ * finalizers available in engine
*/
- protected List<Generator> generators;
+ protected List<JAXXCompilerFinalizer> finalizers;
+ /**
+ * Different passes of the engine.
+ *
+ * Each pass defines the {@link #run(JAXXEngine)} method which implements
+ * the logic of the pass.
+ */
+ protected enum LifeCycle {
+
+ /**
+ * state before compilation
+ */
+ init {
+
+ @Override
+ public boolean run(JAXXEngine engine) {
+ boolean success = true;
+ engine.compilerCount = 0;
+ engine.warnings.clear();
+ engine.errors.clear();
+ // init decorators
+ if (engine.decorators == null) {
+ engine.decorators = new TreeMap<String, CompiledObjectDecorator>();
+ // load decorators
+ for (CompiledObjectDecorator decorator : ServiceLoader.load(CompiledObjectDecorator.class)) {
+ engine.decorators.put(decorator.getName(), decorator);
+ }
+ }
+
+ // init finalizers
+ engine.finalizers = new ArrayList<JAXXCompilerFinalizer>();
+ for (JAXXCompilerFinalizer finalizer : ServiceLoader.load(JAXXCompilerFinalizer.class)) {
+ engine.finalizers.add(finalizer);
+ }
+
+ engine.jaxxFiles.addAll(Arrays.asList(engine.files));
+ engine.jaxxFileClassNames.addAll(Arrays.asList(engine.classNames));
+ return success;
+ }
+ },
+ /**
+ * first pass of compilation
+ */
+ compile_first_pass {
+
+ @Override
+ public boolean run(JAXXEngine engine) throws Exception {
+ boolean success = true;
+ boolean compiled;
+ do {
+ compiled = false;
+ assert engine.jaxxFiles.size() == engine.jaxxFileClassNames.size();
+ java.util.Iterator<File> filesIterator = new ArrayList<File>(engine.jaxxFiles).iterator(); // clone it so it can safely be modified while we're iterating
+ java.util.Iterator<String> classNamesIterator = new ArrayList<String>(engine.jaxxFileClassNames).iterator();
+ while (filesIterator.hasNext()) {
+ File file = filesIterator.next();
+ String className = classNamesIterator.next();
+ if (log.isDebugEnabled()) {
+ log.debug("compile first pass for " + className);
+ }
+ if (engine.symbolTables.get(file) == null) {
+ compiled = true;
+ if (engine.compilers.containsKey(className)) {
+ throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again");
+ }
+
+ File destDir = engine.configuration.getTargetDirectory();
+ if (destDir != null) {
+ int dotPos = className.lastIndexOf(".");
+ if (dotPos != -1) {
+ destDir = new File(destDir, className.substring(0, dotPos).replace('.', File.separatorChar));
+ }
+ if (!destDir.exists() && !destDir.mkdirs()) {
+ log.warn("could not create directory " + destDir);
+ continue;
+ }
+ } else {
+ //destDir = file.getParentFile();
+ }
+ JAXXCompiler compiler = engine.newCompiler(file.getParentFile(), file, className);
+ addStartProfileTime(engine, compiler);
+ engine.compilers.put(className, compiler);
+ compiler.compileFirstPass();
+ addEndProfileTime(engine, compiler);
+ assert !engine.symbolTables.values().contains(compiler.getSymbolTable()) : "symbolTable is already registered";
+ engine.symbolTables.put(file, compiler.getSymbolTable());
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
+ }
+
+ } while (compiled);
+ return success;
+ }
+ },
+ /**
+ * second pass of compilation
+ */
+ compile_second_pass {
+
+ @Override
+ public boolean run(JAXXEngine engine) throws Exception {
+ boolean success = true;
+ List<File> jaxxFilesClone = new ArrayList<File>(engine.jaxxFiles);
+ for (String className : engine.jaxxFileClassNames) {
+ JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass");
+ addStartProfileTime(engine, compiler);
+ if (log.isDebugEnabled()) {
+ log.debug("runInitializers for " + className);
+ }
+ if (!compiler.isFailed()) {
+ compiler.runInitializers();
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("compile second pass for " + className);
+ }
+ compiler.compileSecondPass();
+ addEndProfileTime(engine, compiler);
+ if (log.isDebugEnabled()) {
+ log.debug("done with result [" + !compiler.isFailed() + "] for " + className);
+ }
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
+ if (!jaxxFilesClone.equals(engine.jaxxFiles)) {
+ throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + engine.jaxxFiles + ")");
+ }
+ return success;
+ }
+ },
+ /**
+ * applying stylesheet
+ */
+ stylesheet_pass {
+
+ @Override
+ public boolean run(JAXXEngine engine) throws Exception {
+ boolean success = true;
+ for (String className : engine.jaxxFileClassNames) {
+ JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application");
+ addStartProfileTime(engine, compiler);
+ compiler.applyStylesheets();
+ addEndProfileTime(engine, compiler);
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
+ return success;
+ }
+ },
+ /**
+ * finalize compiler
+ */
+ finalize_compiler {
+
+ @Override
+ public boolean run(JAXXEngine engine) throws Exception {
+ boolean success = true;
+ for (String className : engine.jaxxFileClassNames) {
+ JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation");
+ addStartProfileTime(engine, compiler);
+ compiler.finalizeCompilers(engine.finalizers);
+ addEndProfileTime(engine, compiler);
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
+ return success;
+ }
+ },
+ /**
+ * generate java file
+ */
+ generate_pass {
+
+ @Override
+ public boolean run(JAXXEngine engine) throws Exception {
+ boolean success = true;
+ JavaFileGenerator generator = new JavaFileGenerator(JAXXCompiler.getLineSeparator(), engine.configuration.isVerbose());
+
+ for (String className : engine.jaxxFileClassNames) {
+ JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation");
+ addStartProfileTime(engine, compiler);
+ compiler.generate(generator, engine.finalizers);
+ addEndProfileTime(engine, compiler);
+ if (compiler.isFailed()) {
+ success = false;
+ }
+ }
+ return success;
+ }
+ },
+ /**
+ * display profile
+ */
+ profile_pass {
+
+ @Override
+ public boolean run(JAXXEngine engine) throws Exception {
+ boolean success = true;
+ if (engine.configuration.isProfile()) {
+ StringBuilder buffer = engine.profiler.computeProfileReport();
+ log.info(buffer.toString());
+ }
+ return success;
+ }
+ };
+
+ public abstract boolean run(JAXXEngine engine) throws Exception;
+
+ void addStartProfileTime(JAXXEngine engine, JAXXCompiler compiler) {
+ engine.addProfileTime(compiler, name() + "_start");
+ }
+
+ void addEndProfileTime(JAXXEngine engine, JAXXCompiler compiler) {
+ engine.addProfileTime(compiler, name() + "_end");
+ }
+ }
+
protected JAXXEngine(File[] files, String[] classNames, CompilerConfiguration options) {
this.configuration = options == null ? new DefaultCompilerConfiguration() : options;
this.files = files;
this.classNames = classNames;
- if (this.configuration.isVerbose()) {
- log.info("files : " + Arrays.toString(files));
+ if (log.isDebugEnabled()) {
+ log.debug("files : " + Arrays.toString(files));
}
if (this.configuration.isProfile()) {
profiler = new JAXXProfile();
}
}
- public void init() {
- compilerCount = 0;
- jaxxFiles.addAll(Arrays.asList(files));
- jaxxFileClassNames.addAll(Arrays.asList(classNames));
- }
-
/** Resets all state in preparation for a new compilation session. */
protected void reset() {
- errorCount = warningCount = 0;
+// errorCount = warningCount = 0;
jaxxFiles.clear();
jaxxFileClassNames.clear();
symbolTables.clear();
@@ -219,9 +446,9 @@
decorators.clear();
decorators = null;
}
- if (generators != null) {
- generators.clear();
- generators = null;
+ if (finalizers != null) {
+ finalizers.clear();
+ finalizers = null;
}
}
@@ -229,14 +456,6 @@
return "2.0.0";
}
-// /**
-// * Creates a dummy Compiler for use in unit testing.
-// *
-// * @return the compiler
-// */
-// public static JAXXCompiler createDummyCompiler() {
-// return createDummyCompiler(JAXXCompiler.class.getClassLoader());
-// }
/**
* Creates a dummy Compiler for use in unit testing.
*
@@ -271,25 +490,16 @@
return compiler.getSymbolTable();
}
- /**
- * Returns the system line separator string.
- *
- * @return the string used to separate lines
- */
- public String getLineSeparator() {
- return System.getProperty("line.separator", "\n");
- }
-
public CompiledObjectDecorator getDecorator(String name) {
- CompiledObjectDecorator decorator = getDecorators().get(name);
+ CompiledObjectDecorator decorator = decorators.get(name);
if (decorator == null) {
- throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getDecorators().keySet());
+ throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + decorators.keySet());
}
return decorator;
}
public CompiledObjectDecorator getDecorator(Class<?> type) {
- for (CompiledObjectDecorator decorator : getDecorators().values()) {
+ for (CompiledObjectDecorator decorator : decorators.values()) {
if (type == decorator.getClass()) {
return decorator;
}
@@ -297,77 +507,43 @@
return null;
}
- protected synchronized Map<String, CompiledObjectDecorator> getDecorators() {
- if (decorators == null) {
- decorators = new TreeMap<String, CompiledObjectDecorator>();
- // load decorators
- ServiceLoader<CompiledObjectDecorator> loader = ServiceLoader.load(CompiledObjectDecorator.class);
- for (CompiledObjectDecorator c : loader) {
- decorators.put(c.getName(), c);
- }
- }
- return decorators;
+ public void addWarning(String warning) {
+ warnings.add(warning);
}
- public List<Generator> getGenerators() {
- if (generators == null) {
- generators = new ArrayList<Generator>();
- for (Generator generator : ServiceLoader.load(Generator.class)) {
- generators.add(generator);
- }
- }
- return generators;
+ public void addError(String error) {
+ errors.add(error);
}
+ public List<String> getErrors() {
+ return errors;
+ }
+
+ public List<String> getWarnings() {
+ return warnings;
+ }
+
/**
* Compiled a set of files.
*
* @return <code>true</code> if compilation succeeds, <code>false</code> otherwise
*/
- public synchronized boolean compile() {
-
- init();
+ public synchronized boolean run() {
try {
boolean success = true;
- // pass 1
- if (!nextStep(LifeCycle.compile_first_pass, success)) {
- return false;
- }
- success = firstPass();
-
- // pass 2
- if (!nextStep(LifeCycle.compile_second_pass, success)) {
- return false;
- }
- assert jaxxFiles.size() == jaxxFileClassNames.size();
- success = secondPass();
-
- // stylesheet application
- if (!nextStep(LifeCycle.stylesheet_pass, success)) {
- return false;
- }
- assert jaxxFiles.size() == jaxxFileClassNames.size();
- success = applyCss();
-
- // code generation
- if (!nextStep(LifeCycle.generate_pass, success)) {
- return false;
- }
- assert jaxxFiles.size() == jaxxFileClassNames.size();
- success = generate();
-
- if (configuration.isProfile()) {
- // profile pass (only if succes compile)
- if (!nextStep(LifeCycle.profile_pass, success)) {
+ for (LifeCycle state : LifeCycle.values()) {
+ if (!success) {
return false;
}
- StringBuilder buffer = profiler.computeProfileReport();
- log.info(buffer.toString());
+ currentPass = state;
+ if (configuration.isVerbose()) {
+ log.info("start " + state + " on " + jaxxFiles.size() + " file(s)");
+ }
+ success = state.run(this);
}
+ return success;
- return report(success);
-
//FIXME : deal better the exception treatment...
} catch (CompilerException e) {
System.err.println(e.getMessage());
@@ -379,122 +555,12 @@
} finally {
compilerCount = compilers.size();
//TC - 20081018 only reset when no error was detected
- if (configuration.isResetAfterCompile() && errorCount == 0) {
+ if (configuration.isResetAfterCompile() && errors.isEmpty()) {
reset();
}
}
}
- protected boolean firstPass() throws Exception {
- boolean success = true;
- boolean compiled;
- do {
- compiled = false;
- assert jaxxFiles.size() == jaxxFileClassNames.size();
- java.util.Iterator<File> filesIterator = new ArrayList<File>(jaxxFiles).iterator(); // clone it so it can safely be modified while we're iterating
- java.util.Iterator<String> classNamesIterator = new ArrayList<String>(jaxxFileClassNames).iterator();
- while (filesIterator.hasNext()) {
- File file = filesIterator.next();
- String className = classNamesIterator.next();
- if (log.isDebugEnabled()) {
- log.debug("compile first pass for " + className);
- }
- if (symbolTables.get(file) == null) {
- compiled = true;
- if (compilers.containsKey(className)) {
- throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again");
- }
-
- File destDir = configuration.getTargetDirectory();
- if (destDir != null) {
- int dotPos = className.lastIndexOf(".");
- if (dotPos != -1) {
- destDir = new File(destDir, className.substring(0, dotPos).replace('.', File.separatorChar));
- }
- if (!destDir.exists() && !destDir.mkdirs()) {
- log.warn("could not create directory " + destDir);
- continue;
- }
- } else {
- //destDir = file.getParentFile();
- }
- JAXXCompiler compiler = newCompiler(file.getParentFile(), file, className);
- addProfileTime(compiler, currentPass.name() + "_start");
- compilers.put(className, compiler);
- compiler.compileFirstPass();
- addProfileTime(compiler, currentPass.name() + "_end");
- assert !symbolTables.values().contains(compiler.getSymbolTable()) : "symbolTable is already registered";
- symbolTables.put(file, compiler.getSymbolTable());
- if (compiler.isFailed()) {
- success = false;
- }
- }
- }
-
- } while (compiled);
- return success;
- }
-
- protected boolean secondPass() throws Exception {
- boolean success = true;
- List<File> jaxxFilesClone = new ArrayList<File>(jaxxFiles);
- for (String className : jaxxFileClassNames) {
- JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass");
- addProfileTime(compiler, currentPass.name() + "_start");
- if (log.isDebugEnabled()) {
- log.debug("runInitializers for " + className);
- }
- if (!compiler.isFailed()) {
- compiler.runInitializers();
- }
- if (log.isDebugEnabled()) {
- log.debug("compile second pass for " + className);
- }
- compiler.compileSecondPass();
- addProfileTime(compiler, currentPass.name() + "_end");
- if (log.isDebugEnabled()) {
- log.debug("done with result [" + !compiler.isFailed() + "] for " + className);
- }
- if (compiler.isFailed()) {
- success = false;
- }
- }
- if (!jaxxFilesClone.equals(jaxxFiles)) {
- throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + jaxxFiles + ")");
- }
- return success;
- }
-
- protected boolean applyCss() throws Exception {
- boolean success = true;
-
- for (String className : jaxxFileClassNames) {
- JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application");
- addProfileTime(compiler, currentPass.name() + "_start");
- compiler.applyStylesheets();
- addProfileTime(compiler, currentPass.name() + "_end");
- if (compiler.isFailed()) {
- success = false;
- }
- }
- return success;
- }
-
- protected boolean generate() throws Exception {
- boolean success = true;
- List<Generator> gens = getGenerators();
- for (String className : jaxxFileClassNames) {
- JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation");
- addProfileTime(compiler, currentPass.name() + "_start");
- compiler.generateCode(gens);
- addProfileTime(compiler, currentPass.name() + "_end");
- if (compiler.isFailed()) {
- success = false;
- }
- }
- return success;
- }
-
public int getCompilerCount() {
return compilerCount;
}
@@ -507,28 +573,6 @@
return compiler;
}
- protected boolean nextStep(LifeCycle nextCycle, boolean success) {
- if (!success) {
- return report(false);
- }
- currentPass = nextCycle;
- return true;
- }
-
- protected boolean report(boolean success) {
- if (warningCount == 1) {
- System.err.println("1 warning");
- } else if (warningCount > 0) {
- System.err.println(warningCount + " warnings");
- }
- if (errorCount == 1) {
- System.err.println("1 error");
- } else if (errorCount > 0) {
- System.err.println(errorCount + " errors");
- }
- return success;
- }
-
protected JAXXCompiler newCompiler(File parentFile, File file, String className) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(JAXXEngine.class, File.class, File.class, String.class, CompilerConfiguration.class, List.class);
return cons.newInstance(this, parentFile, file, className, configuration, Arrays.asList(new String[]{
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -150,10 +150,11 @@
ProfileResult cfp = newProfileResult(LifeCycle.compile_first_pass);
ProfileResult csp = newProfileResult(LifeCycle.compile_second_pass);
ProfileResult ssp = newProfileResult(LifeCycle.stylesheet_pass);
+ ProfileResult fp = newProfileResult(LifeCycle.finalize_compiler);
ProfileResult gp = newProfileResult(LifeCycle.generate_pass);
- ProfileResult total = newProfileResult(cfp, csp, ssp, gp);
+ ProfileResult total = newProfileResult(cfp, csp, ssp,fp, gp);
- String reportPattern = "\n|%1$-" + maxLength + "s|%2$15s|%3$15s|%4$15s|%5$15s|%6$15s|";
+ String reportPattern = "\n|%1$-" + maxLength + "s|%2$15s|%3$15s|%4$15s|%5$15s|%6$15s|%7$15s|";
char[] tmpC = new char[maxLength];
Arrays.fill(tmpC, '-');
@@ -163,32 +164,33 @@
"---------------",
"---------------",
"---------------",
+ "---------------",
"---------------");
buffer.append(line);
buffer.append(String.format(reportPattern,
"(files / stats) \\ passes",
- "compile round 1", "compile round 2", "stylesheet", "generation", "all passes"));
+ "compile round 1", "compile round 2", "stylesheet", "finalize", "generation", "all passes"));
buffer.append(line);
// affiche les temps de tous les fichiers en temp total croissant
for (Long l : total.times) {
JAXXCompiler c = total.getCompiler(l);
- printReportLine(buffer, reportPattern, c.getOutputClassName(), cfp.getTime(c), csp.getTime(c), ssp.getTime(c), gp.getTime(c), total.getTime(c));
+ printReportLine(buffer, reportPattern, c.getOutputClassName(), cfp.getTime(c), csp.getTime(c), ssp.getTime(c), fp.getTime(c), gp.getTime(c), total.getTime(c));
}
buffer.append(line);
if (compilers.size() > 1) {
- printReportLine(buffer, reportPattern, "total (" + compilers.size() + " files)", cfp.total, csp.total, ssp.total, gp.total, total.total);
+ printReportLine(buffer, reportPattern, "total (" + compilers.size() + " files)", cfp.total, csp.total, ssp.total, fp.total, gp.total, total.total);
buffer.append(line);
- printReportLine2(buffer, reportPattern, "min", cfp.min, csp.min, ssp.min, gp.min, total.min);
- printReportLine2(buffer, reportPattern, "max", cfp.max, csp.max, ssp.max, gp.max, total.max);
- printReportLine(buffer, reportPattern, "average", cfp.average, csp.average, ssp.average, gp.average, total.average);
+ printReportLine2(buffer, reportPattern, "min", cfp.min, csp.min, ssp.min, fp.min, gp.min, total.min);
+ printReportLine2(buffer, reportPattern, "max", cfp.max, csp.max, ssp.max, fp.max, gp.max, total.max);
+ printReportLine(buffer, reportPattern, "average", cfp.average, csp.average, ssp.average, fp.average, gp.average, total.average);
buffer.append(line);
}
cfp.clear();
@@ -201,21 +203,23 @@
}
public static final String TIME_PATTERN = "%1$9s - %2$2d%%";
- protected void printReportLine(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long generatorCounter, long totalCounter) {
+ protected void printReportLine(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long finalizeCounter, long generatorCounter, long totalCounter) {
float percentCFP = ((float) firstPassCounter / totalCounter) * 100;
float percentCSP = ((float) secondPassCounter / totalCounter) * 100;
float percentCSSP = ((float) cssCounter / totalCounter) * 100;
+ float percentFP = ((float) finalizeCounter / totalCounter) * 100;
float percentGP = ((float) generatorCounter / totalCounter) * 100;
String strCFP = String.format(TIME_PATTERN, StringUtil.convertTime(firstPassCounter), (int) percentCFP);
String strCSP = String.format(TIME_PATTERN, StringUtil.convertTime(secondPassCounter), (int) percentCSP);
String strCSSP = String.format(TIME_PATTERN, StringUtil.convertTime(cssCounter), (int) percentCSSP);
+ String strFP = String.format(TIME_PATTERN, StringUtil.convertTime(finalizeCounter), (int) percentFP);
String strGP = String.format(TIME_PATTERN, StringUtil.convertTime(generatorCounter), (int) percentGP);
- buffer.append(String.format(reportPattern, label, strCFP, strCSP, strCSSP, strGP, StringUtil.convertTime(totalCounter)));
+ buffer.append(String.format(reportPattern, label, strCFP, strCSP, strCSSP, strFP, strGP, StringUtil.convertTime(totalCounter)));
}
- protected void printReportLine2(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long generatorCounter, long totalCounter) {
- buffer.append(String.format(reportPattern, label, StringUtil.convertTime(firstPassCounter), StringUtil.convertTime(secondPassCounter), StringUtil.convertTime(cssCounter), StringUtil.convertTime(generatorCounter), StringUtil.convertTime(totalCounter)));
+ protected void printReportLine2(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long finalizeCounter, long generatorCounter, long totalCounter) {
+ buffer.append(String.format(reportPattern, label, StringUtil.convertTime(firstPassCounter), StringUtil.convertTime(secondPassCounter), StringUtil.convertTime(cssCounter), StringUtil.convertTime(finalizeCounter), StringUtil.convertTime(generatorCounter), StringUtil.convertTime(totalCounter)));
}
protected CompilerEntry getEntry(JAXXCompiler compiler) {
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,21 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.compiler;
-
-import jaxx.compiler.reflect.ClassDescriptorLoader;
-
-/**
- * A dummy CompiledObject which serves to initialize scripted field. This is handled by
- * a CompiledObject rather than (say) simply inlining the initialization code in order to
- * ensure that the field is initialized in document order.
- */
-public class ScriptInitializer extends CompiledObject {
-
- public ScriptInitializer(String initializer, JAXXCompiler compiler) {
- super(compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class)),
- ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class), compiler, false);
- appendInitializationCode(initializer);
- }
-}
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,319 +0,0 @@
-package jaxx.compiler;
-
-import jaxx.compiler.parser.java.JavaParser;
-import jaxx.compiler.parser.java.JavaParserTreeConstants;
-import jaxx.compiler.parser.java.SimpleNode;
-import jaxx.compiler.reflect.FieldDescriptor;
-import jaxx.compiler.reflect.MethodDescriptor;
-import jaxx.compiler.tags.TagManager;
-
-import java.io.StringReader;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class ScriptManager {
-
- private JAXXCompiler compiler;
-
- ScriptManager(JAXXCompiler compiler) {
- this.compiler = compiler;
- }
-
- /**
- * Strips unnecessary curly braces from around the script, generating a warning if they are found.
- *
- * @param script script to trim
- * @return the trimed script
- */
- public String trimScript(String script) {
- script = script.trim();
- if (script.startsWith("{") && script.endsWith("}")) {
- compiler.reportWarning("curly braces are unnecessary for script '" + script + "'");
- script = script.substring(1, script.length() - 1);
- }
- return script;
- }
-
- public void checkParse(String script) throws CompilerException {
- script = trimScript(script);
- JavaParser p = new JavaParser(new StringReader(script));
- while (!p.Line()) {
- // ???
- }
- }
-
- public String preprocessScript(String script) throws CompilerException {
- script = trimScript(script);
- StringBuffer result = new StringBuffer();
- JavaParser p = new JavaParser(new StringReader(script));
- //JavaParser p = new JavaParser(new StringReader(script + ";"));
- while (!p.Line()) {
- SimpleNode node = p.popNode();
- if (node != null) {
- preprocessScriptNode(node, false);
- result.append(node.getText());
- }
- }
- return result.toString();
- }
-
- /**
- * Scans through a compound symbol (foo.bar.baz) to identify and compile the JAXX class it refers to, if any.
- *
- * @param symbol symbol to scan
- */
- private void scanCompoundSymbol(String symbol) {
- String[] tokens = symbol.split("\\.");
- StringBuffer currentSymbol = new StringBuffer();
- for (String token : tokens) {
- if (currentSymbol.length() > 0) {
- currentSymbol.append('.');
- }
- currentSymbol.append(token.trim());
-
- String contextClass = TagManager.resolveClassName(currentSymbol.toString(), compiler);
- if (contextClass != null) {
- compiler.addDependencyClass(contextClass);
- }
- }
- }
-
- private void preprocessScriptNode(SimpleNode node, boolean staticContext) throws CompilerException {
- // identify static methods and initializers -- we can't fire events statically
- if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION) {
- if (node.getParent().getChild(0).getText().indexOf("static") != -1) {
- staticContext = true;
- }
- } else if (node.getId() == JavaParserTreeConstants.JJTINITIALIZER) {
- if (node.getText().trim().startsWith("static")) {
- staticContext = true;
- }
- }
-
- int count = node.jjtGetNumChildren();
- for (int i = 0; i < count; i++) {
- preprocessScriptNode(node.getChild(i), staticContext);
- }
-
- int id = node.getId();
- if (id == JavaParserTreeConstants.JJTNAME || id == JavaParserTreeConstants.JJTCLASSORINTERFACETYPE) {
- scanCompoundSymbol(node.getText());
- }
- if (!staticContext) {
- String lhs = null;
- if (id == JavaParserTreeConstants.JJTASSIGNMENTEXPRESSION || (id == JavaParserTreeConstants.JJTPOSTFIXEXPRESSION && node.jjtGetNumChildren() == 2)) {
- lhs = ((SimpleNode) node.jjtGetChild(0)).getText().trim();
- } else if (id == JavaParserTreeConstants.JJTPREINCREMENTEXPRESSION || id == JavaParserTreeConstants.JJTPREDECREMENTEXPRESSION) {
- lhs = ((SimpleNode) node.jjtGetChild(0)).getText().trim();
- }
- if (lhs != null) {
- FieldDescriptor[] fields = compiler.getScriptFields();
- for (FieldDescriptor field : fields) {
- if (field.getName().equals(lhs)) {
- //lhs.substring(lhs.lastIndexOf(".") + 1);
- node.firstToken.image = "jaxx.runtime.Util.assignment(" + node.firstToken.image;
- String outputClassName = compiler.getOutputClassName();
- node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
- }
- }
- }
- }
- }
-
- /**
- * Examines a Line to determine its real type. As all tokens returned by the parser are Lines, and
- * they are just a tiny wrapper around the real node, this method strips off the wrapper layers to identify
- * the real type of a node.
- *
- * @param line line to scan
- * @return the line type
- */
- private int getLineType(SimpleNode line) {
- if (line.jjtGetNumChildren() == 1) {
- SimpleNode node = line.getChild(0);
- if (node.getId() == JavaParserTreeConstants.JJTBLOCKSTATEMENT) {
- if (node.jjtGetNumChildren() == 1) {
- return node.getChild(0).getId();
- }
- } else if (node.getId() == JavaParserTreeConstants.JJTCLASSORINTERFACEBODYDECLARATION) {
- int id = node.getChild(0).getId();
- if (id == JavaParserTreeConstants.JJTMODIFIERS) {
- return node.getChild(1).getId();
- }
- if (id == JavaParserTreeConstants.JJTINITIALIZER) {
- return id;
- }
- }
- return node.getId();
- }
- return JavaParserTreeConstants.JJTLINE; // generic value implying that it's okay to put into the initializer block
- }
-
- private SimpleNode findExplicitConstructorInvocation(SimpleNode parent) {
- if (parent.getId() == JavaParserTreeConstants.JJTEXPLICITCONSTRUCTORINVOCATION) {
- return parent;
- }
-
- int count = parent.jjtGetNumChildren();
- for (int i = 0; i < count; i++) {
- SimpleNode result = findExplicitConstructorInvocation(parent.getChild(i));
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- private void processConstructor(String modifiers, SimpleNode node) {
- assert node.getId() == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION : "expected node to be ConstructorDeclaration, found " + JavaParserTreeConstants.jjtNodeName[node.getId()] + " instead";
- assert node.getChild(0).getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS : "expected node 0 to be FormalParameters, found " + JavaParserTreeConstants.jjtNodeName[node.getChild(1).getId()] + " instead";
- String code = "";
- if (node.getChild(0).jjtGetNumChildren() == 0) {
- compiler.reportError("The default no-argument constructor may not be redefined");
- } else {
- SimpleNode explicitConstructorInvocation = findExplicitConstructorInvocation(node);
- if (explicitConstructorInvocation == null || explicitConstructorInvocation.getText().trim().startsWith("super(")) {
- code = "$initialize();" + JAXXCompiler.getLineSeparator();
- if (explicitConstructorInvocation == null) {
- node.getChild(1).firstToken.image = node.getChild(1).firstToken.image;
- } else {
- explicitConstructorInvocation.lastToken.image += code;
- }
- }
- }
-
- compiler.appendBodyCode(modifiers + " " + node.getText().substring(0, node.getText().length() - 1) + code + "}");
- //compiler.bodyCode.append(";\n");
- }
-
- private void scanScriptNode(SimpleNode node) throws CompilerException {
- int nodeType = getLineType(node);
- if (nodeType == JavaParserTreeConstants.JJTIMPORTDECLARATION) { // have to handle imports early so the preprocessing takes them into account
- String text = node.getChild(0).getText().trim();
- if (text.startsWith("import")) {
- text = text.substring("import".length()).trim();
- }
- if (text.endsWith(";")) {
- text = text.substring(0, text.length() - 1);
- }
- compiler.addImport(text);
- }
-
- preprocessScriptNode(node, false);
-
- if (nodeType == JavaParserTreeConstants.JJTIMPORTDECLARATION) {
- // do nothing, already handled above
- } else if (nodeType == JavaParserTreeConstants.JJTMETHODDECLARATION) {
- String returnType = null;
- String name = null;
- List<String> parameterTypes = new ArrayList<String>();
- //List<String> parameterNames = new ArrayList<String>();
- SimpleNode methodDeclaration = node.getChild(0).getChild(1);
- assert methodDeclaration.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION;
- for (int i = 0; i < methodDeclaration.jjtGetNumChildren(); i++) {
- SimpleNode child = methodDeclaration.getChild(i);
- int type = child.getId();
- if (type == JavaParserTreeConstants.JJTRESULTTYPE) {
- String rawReturnType = child.getText().trim();
- returnType = TagManager.resolveClassName(rawReturnType, compiler);
- // FIXME: this check fails for inner classes defined in this file
- //if (returnType == null)
- // throw new CompilerException("could not find class '" + rawReturnType + "'");
- } else if (type == JavaParserTreeConstants.JJTMETHODDECLARATOR) {
- name = child.firstToken.image.trim();
- SimpleNode formalParameters = child.getChild(0);
- assert formalParameters.getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS;
- for (int j = 0; j < formalParameters.jjtGetNumChildren(); j++) {
- SimpleNode parameter = formalParameters.getChild(j);
- String rawParameterType = parameter.getChild(1).getText().trim().replaceAll("\\.\\.\\.", "[]");
- String parameterType = TagManager.resolveClassName(rawParameterType, compiler);
- // FIXME: this check fails for inner classes defined in this file
- //if (parameterType == null)
- // throw new CompilerException("could not find class '" + rawParameterType + "'");
- parameterTypes.add(parameterType);
- //parameterNames.add(parameter.getChild(2).getText().trim());
- }
- }
- }
- compiler.appendBodyCode(node.getText());
- //compiler.bodyCode.append(";\n");
- compiler.addScriptMethod(new MethodDescriptor(name, Modifier.PUBLIC, returnType, parameterTypes.toArray(new String[parameterTypes.size()]), compiler.getClassLoader()));
- } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION ||
- nodeType == JavaParserTreeConstants.JJTINITIALIZER) {
- String str = node.getText().trim();
- if (str.endsWith(";")) {
- str += ";";
- }
- compiler.appendBodyCode(str);
- //compiler.bodyCode.append(";\n");
- } else if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) {
- processConstructor(node.getChild(0).getChild(0).getText(), node.getChild(0).getChild(1));
- } else if (nodeType == JavaParserTreeConstants.JJTLOCALVARIABLEDECLARATION || nodeType == JavaParserTreeConstants.JJTFIELDDECLARATION) {
- // the "local" variable declarations in this expression aren't actually local -- they are flagged local
- // just because there isn't an enclosing class scope visible to the parser. "Real" local variable
- // declarations won't show up here, because they will be buried inside of methods.
- String text = node.getText().trim();
- if (!text.endsWith(";")) {
- text += ";";
- }
- String declaration = text;
- int equals = text.indexOf("=");
- if (equals != -1) {
- declaration = declaration.substring(0, equals);
- }
- declaration = declaration.trim();
- String[] declarationTokens = declaration.split("\\s");
- boolean isFinal = Arrays.asList(declarationTokens).contains("final");
- boolean isStatic = Arrays.asList(declarationTokens).contains("static");
- String name = declarationTokens[declarationTokens.length - 1];
- if (name.endsWith(";")) {
- name = name.substring(0, name.length() - 1).trim();
- }
- String className = declarationTokens[declarationTokens.length - 2];
- String type = TagManager.resolveClassName(className, compiler);
- compiler.addScriptField(new FieldDescriptor(name, Modifier.PUBLIC, type, compiler.getClassLoader())); // TODO: determine the actual modifiers
- if (equals != -1 && !isFinal && !isStatic) { // declare the field in the class body, but wait to actually initialize it
- //compiler.bodyCode.append(text.substring(0, equals).trim());
- compiler.appendBodyCode(text.substring(0, equals).trim() + ";");
- String initializer = text.substring(equals + 1).trim();
- if (type.endsWith("[]")) {
- initializer = "new " + type + " " + initializer;
- }
- final String finalInitializer = name + " = " + initializer;
- compiler.registerInitializer(new Runnable() {
-
- @Override
- public void run() {
- compiler.registerCompiledObject(new ScriptInitializer(finalInitializer, compiler));
- }
- });
- } else {
- compiler.appendBodyCode(text);
- }
- compiler.appendBodyCode("\n");
- //compiler.bodyCode.append(";\n");
- } else {
- String text = node.getText().trim();
- if (text.length() > 0) {
- if (!text.endsWith(";")) {
- text += ";";
- }
- compiler.appendInitializerCode(text);
- //compiler.initializer.append(";\n");
- }
- }
- }
-
- public void registerScript(String script) throws CompilerException {
- JavaParser p = new JavaParser(new StringReader(script));
- //JavaParser p = new JavaParser(new StringReader(script + ";"));
- while (!p.Line()) {
- SimpleNode node = p.popNode();
- if (node != null) {
- scanScriptNode(node);
- }
- }
- }
-}
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,558 +0,0 @@
-package jaxx.compiler;
-
-import jaxx.runtime.css.Selector;
-import jaxx.runtime.css.Rule;
-import jaxx.runtime.css.Stylesheet;
-import jaxx.compiler.parser.java.JavaParser;
-import jaxx.compiler.parser.java.JavaParserTreeConstants;
-import jaxx.compiler.parser.java.SimpleNode;
-import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
-import jaxx.compiler.reflect.MethodDescriptor;
-import jaxx.compiler.tags.DefaultObjectHandler;
-import jaxx.compiler.tags.TagManager;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A helper class to compute {@link Stylesheet}, {@link Rule} and {@link Selector}
- * and extract all the compiler logic from this class.
- * <p/>
- * In that way we can make the compiler as a single module and a runtime as another module.
- *
- * @author chemit
- */
-public class StylesheetHelper {
-
- public static void applyTo(CompiledObject object, JAXXCompiler compiler, Stylesheet stylesheet, Stylesheet overrides) throws CompilerException {
- Map<String, String> overriddenProperties;
- if (overrides != null) {
- overriddenProperties = getApplicableProperties(overrides, object);
- //overriddenProperties = overrides.getApplicableProperties(s,object);
- } else {
- overriddenProperties = null;
- }
-
- Map<String, String> properties = getApplicableProperties(stylesheet, object);
- if (properties != null) {
- if (overriddenProperties != null) {
- properties.keySet().removeAll(overriddenProperties.keySet());
- }
- DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass());
- for (Map.Entry<String, String> e : properties.entrySet()) {
- String value = e.getValue();
- if (value.equals(Rule.INLINE_ATTRIBUTE) || value.equals(Rule.DATA_BINDING)) {
- continue;
- }
- handler.setAttribute(object, e.getKey(), e.getValue(), false, compiler);
- }
- }
-
- Rule[] pseudoClasses = getApplicablePseudoClasses(stylesheet, object);
- if (pseudoClasses != null) {
- Map<String, Map<String, String>> combinedPseudoClasses = new LinkedHashMap<String, Map<String, String>>();
- for (Rule pseudoClass1 : pseudoClasses) {
- Selector[] selectors = pseudoClass1.getSelectors();
- for (Selector selector : selectors) {
- if (appliesTo(selector, object) == Selector.PSEUDOCLASS_APPLIES) {
- properties = pseudoClass1.getProperties();
- String pseudoClass = selector.getPseudoClass();
- // TODO: overrides by downstream pseudoclasses are not handled
- Map<String, String> combinedProperties = combinedPseudoClasses.get(pseudoClass);
- if (combinedProperties == null) {
- combinedProperties = new HashMap<String, String>();
- combinedPseudoClasses.put(pseudoClass, combinedProperties);
- }
- combinedProperties.putAll(properties);
- }
- }
- }
-
- int count = 0;
- for (Map.Entry<String, Map<String, String>> e : combinedPseudoClasses.entrySet()) {
- applyPseudoClass(e.getKey(), e.getValue(), object, compiler, count++);
- }
- }
- }
-
- /**
- * Replaces all references to the variable "object" with the actual object ID.
- *
- * @param code ?
- * @param id ?
- * @return ?
- * @throws CompilerException ?
- */
- public static String replaceObjectReferences(String code, String id) throws CompilerException {
- JavaParser p = new JavaParser(new StringReader(code + ";"));
- p.Expression();
- jaxx.compiler.parser.java.SimpleNode node = p.popNode();
- scanNode(node, id);
- return node.getText();
- }
-
- public static void scanNode(SimpleNode node, String id) {
- if (node.getId() == JavaParserTreeConstants.JJTNAME) {
- String name = node.getText();
- if (name.equals("object") || (name.indexOf(".") != -1 && name.substring(0, name.indexOf(".")).trim().equals("object"))) {
- node.firstToken.image = id;
- }
- } else {
- int count = node.jjtGetNumChildren();
- for (int i = 0; i < count; i++) {
- scanNode(node.getChild(i), id);
- }
- }
- }
-
- public static void compilePseudoClassAdd(String pseudoClass, CompiledObject object, String propertyCode, JAXXCompiler compiler) throws CompilerException {
-
- if (pseudoClass.startsWith("{")) {
- pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
- pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
- String dest = object.getId() + ".style." + pseudoClass + ".add";
- String destCode = compiler.getJavaCode(dest);
- if (compiler.haveProcessDataBinding()) {
- compiler.appendProcessDataBinding("else ");
- }
- compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { " + propertyCode + "} }");
- new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
- compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");");
- return;
- }
-
- MouseEventEnum constant = MouseEventEnum.valueOf(pseudoClass);
-
- String property = null;
- switch (constant) {
- case mousedown:
- property = "mousePressed";
- break;
- case mouseout:
- property = "mouseExited";
- break;
- case mouseover:
- property = "mouseEntered";
- break;
- case mouseup:
- property = "mouseReleased";
- break;
- }
-
- ClassDescriptor mouseListenerDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseListener.class);
- ClassDescriptor mouseEventDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseEvent.class);
-
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", mouseListenerDescriptor);
- MethodDescriptor methodDescriptor = mouseListenerDescriptor.getMethodDescriptor(property, mouseEventDescriptor);
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, methodDescriptor, propertyCode, compiler);
-
- } catch (NoSuchMethodException e) {
- compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
-
- /*if (pseudoClass.equals("mouseover")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseout")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- compiler.appendInitDataBindings("{" + propertyCode + "}");
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mousedown")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseup")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- compiler.appendInitDataBindings("{" + propertyCode + "}");
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.startsWith("{")) {
- pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
- pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
- String dest = object.getId() + ".style." + pseudoClass + ".add";
- String destCode = TypeManager.getJavaCode(dest);
- if (compiler.haveProcessDataBinding()) {
- compiler.appendProcessDataBinding("else ");
- }
- compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }");
- new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
- compiler.appendInitDataBindings("applyDataBinding("+ destCode + ");");
- } else
- throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);*/
- }
-
- public static void compilePseudoClassRemove(String pseudoClass, CompiledObject object, String propertyCode, JAXXCompiler compiler) throws CompilerException {
- if (pseudoClass.startsWith("{")) {
- pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
- pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
- String dest = object.getId() + ".style." + pseudoClass + ".remove";
- String destCode = compiler.getJavaCode(dest);
- if (compiler.haveProcessDataBinding()) {
- compiler.appendProcessDataBinding("else ");
- }
- compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
- new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
- compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");");
- return;
- }
-
- MouseEventEnum constant = MouseEventEnum.valueOf(pseudoClass);
-
- String property = null;
- switch (constant) {
- case mousedown:
- property = "mousePressed";
- break;
- case mouseout:
- property = "mouseReleased";
- break;
- case mouseover:
- property = "mouseExited";
- break;
- case mouseup:
- property = "mousePressed";
- break;
- }
-
- ClassDescriptor mouseListenerDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseListener.class);
- ClassDescriptor mouseEventDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseEvent.class);
-
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", mouseListenerDescriptor);
- MethodDescriptor methodDescriptor = mouseListenerDescriptor.getMethodDescriptor(property, mouseEventDescriptor);
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, methodDescriptor, propertyCode, compiler);
-
- } catch (NoSuchMethodException e) {
- compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
-
- /*if (pseudoClass.equals("mouseover")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseout")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mousedown")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.equals("mouseup")) {
- try {
- MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
- object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
- ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed",
- new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
- propertyCode, compiler);
- }
- catch (NoSuchMethodException e) {
- compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
- }
- } else if (pseudoClass.startsWith("{")) {
- pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
- pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
- String dest = object.getId() + ".style." + pseudoClass + ".remove";
- String destCode = TypeManager.getJavaCode(dest);
- if (compiler.haveProcessDataBinding()) {
- compiler.appendProcessDataBinding("else ");
- }
- compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
- new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
- compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");");
- } else {
- throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);
- }*/
- }
-
- public static String invert(String javaCode) {
- javaCode = javaCode.trim();
- return javaCode.startsWith("!") ? javaCode.substring(1) : "!(" + javaCode + ")";
- }
-
- public static String unwrap(ClassDescriptor type, String valueCode) {
- if (type == ClassDescriptorLoader.getClassDescriptor(boolean.class)) {
- return "((java.lang.Boolean) " + valueCode + ").booleanValue()";
- } else if (type == ClassDescriptorLoader.getClassDescriptor(byte.class)) {
- return "((java.lang.Byte) " + valueCode + ").byteValue()";
- } else if (type == ClassDescriptorLoader.getClassDescriptor(short.class)) {
- return "((java.lang.Short) " + valueCode + ").shortValue()";
- } else if (type == ClassDescriptorLoader.getClassDescriptor(int.class)) {
- return "((java.lang.Integer) " + valueCode + ").intValue()";
- } else if (type == ClassDescriptorLoader.getClassDescriptor(long.class)) {
- return "((java.lang.Long) " + valueCode + ").longValue()";
- } else if (type == ClassDescriptorLoader.getClassDescriptor(float.class)) {
- return "((java.lang.Float) " + valueCode + ").floatValue()";
- } else if (type == ClassDescriptorLoader.getClassDescriptor(double.class)) {
- return "((java.lang.Double) " + valueCode + ").doubleValue()";
- } else if (type == ClassDescriptorLoader.getClassDescriptor(char.class)) {
- return "((java.lang.Character) " + valueCode + ").charValue()";
- } else {
- return valueCode;
- }
- }
-
- public static void applyPseudoClass(String pseudoClass, Map<String, String> properties,
- CompiledObject object, JAXXCompiler compiler, int priority) throws CompilerException {
- if (pseudoClass.indexOf("[") != -1) {
- pseudoClass = pseudoClass.substring(0, pseudoClass.indexOf("["));
- }
- final StringBuffer buffer = new StringBuffer();
- /*CompiledObject bufferObject = new CompiledObject(object.getId(), object.getJavaCode(), object.getObjectClass(), compiler, true) {
- public void appendInitializationCode(String code) {
- buffer.append(code);
- }
- public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException {
- buffer.append(assignment);
- }
- };*/
-
- DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass());
- boolean valueDeclared = false;
- for (Map.Entry<String, String> e : properties.entrySet()) {
- String property = e.getKey();
- ClassDescriptor type = handler.getPropertyType(object, property, compiler);
- String dataBinding = compiler.processDataBindings(e.getValue(), type);
- String valueCode;
- if (dataBinding != null) {
- valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
- new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
- property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false);
- } else {
- try {
- Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
- valueCode = compiler.getJavaCode(compiler.convertFromString(e.getValue(), typeClass));
- } catch (ClassNotFoundException ex) {
- compiler.reportError("could not find class " + type.getName());
- return;
- }
- }
- if (!valueDeclared) {
- buffer.append("java.lang.Object ");
- valueDeclared = true;
- }
- buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator());
- buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator());
- String unwrappedValue = unwrap(type, "value");
- buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
- ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator());
- buffer.append("}").append(JAXXCompiler.getLineSeparator());
- }
-
- if (pseudoClass.equals("focused")) {
- pseudoClass = "{ object.hasFocus() }";
- } else if (pseudoClass.equals("unfocused")) {
- pseudoClass = "{ !object.hasFocus() }";
- } else if (pseudoClass.equals("enabled")) {
- pseudoClass = "{ object.isEnabled() }";
- } else if (pseudoClass.equals("disabled")) {
- pseudoClass = "{ !object.isEnabled() }";
- } else if (pseudoClass.equals("selected")) {
- pseudoClass = "{ object.isSelected() }";
- } else if (pseudoClass.equals("deselected")) {
- pseudoClass = "{ !object.isSelected() }";
- }
-
- compilePseudoClassAdd(pseudoClass, object, buffer.toString(), compiler);
-
- buffer.setLength(0);
- valueDeclared = false;
- for (Map.Entry<String, String> e : properties.entrySet()) {
- String property = e.getKey();
- ClassDescriptor type = handler.getPropertyType(object, property, compiler);
- String dataBinding = compiler.processDataBindings(e.getValue(), type);
- String valueCode;
- if (dataBinding != null) {
- valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
- new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
- property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false);
- } else {
- try {
- Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
- valueCode = compiler.getJavaCode(compiler.convertFromString(e.getValue(), typeClass));
- } catch (ClassNotFoundException ex) {
- compiler.reportError("could not find class " + type.getName());
- return;
- }
- }
- if (!valueDeclared) {
- buffer.append("java.lang.Object ");
- valueDeclared = true;
- }
- buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator());
- buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator());
- String unwrappedValue = unwrap(type, "value");
- buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
- ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator());
- buffer.append("}").append(JAXXCompiler.getLineSeparator());
- }
- compilePseudoClassRemove(pseudoClass, object, buffer.toString(), compiler);
- }
-
- public static Map<String, String> getApplicableProperties(Stylesheet s, CompiledObject object) throws CompilerException {
- DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass());
- Map<String, String> result = null;
- for (Rule rule : s.getRules()) {
- int apply = appliesTo(rule, object);
- if (apply == Selector.ALWAYS_APPLIES || apply == Selector.ALWAYS_APPLIES_INHERIT_ONLY) {
- if (result == null) {
- result = new HashMap<String, String>();
- }
- for (Map.Entry<String, String> entry : rule.getProperties().entrySet()) {
- String property = entry.getKey();
- if (apply == Selector.ALWAYS_APPLIES || handler.isPropertyInherited(property)) {
- result.put(property, entry.getValue());
- }
- }
- }
- }
- return result;
- }
-
- public static Rule[] getApplicablePseudoClasses(Stylesheet s, CompiledObject object) throws CompilerException {
- List<Rule> result = null;
- for (Rule rule : s.getRules()) {
- if (appliesTo(rule, object) == Selector.PSEUDOCLASS_APPLIES) {
- if (result == null) {
- result = new ArrayList<Rule>();
- }
- result.add(rule);
- }
- }
- return result != null ? result.toArray(new Rule[result.size()]) : null;
- }
-
- public static Rule inlineAttribute(CompiledObject object, String propertyName, boolean dataBinding) {
- Map<String, String> properties = new HashMap<String, String>();
- properties.put(propertyName, dataBinding ? Rule.DATA_BINDING : Rule.INLINE_ATTRIBUTE);
- return new Rule(new Selector[]{new Selector(null, null, null, object.getId(), true)}, properties);
- }
-
- public static int appliesTo(Rule rule, CompiledObject object) throws CompilerException {
- int appliesTo = Selector.NEVER_APPLIES;
- for (Selector selector : rule.getSelectors()) {
- appliesTo = Math.max(appliesTo(selector, object), appliesTo);
- if (appliesTo == Selector.ALWAYS_APPLIES || appliesTo == Selector.ALWAYS_APPLIES_INHERIT_ONLY) {
- break;
- }
- }
- return appliesTo;
- }
-
- public static int appliesTo(Selector selector, CompiledObject object) {
- boolean inheritOnly = false;
- CompiledObject parent = object;
- String javaClassName = selector.getJavaClassName();
- String styleClass = selector.getStyleClass();
- String pseudoClass = selector.getPseudoClass();
- String id = selector.getId();
-
- while (parent != null) {
- boolean classMatch = (javaClassName == null);
- if (!classMatch) {
- ClassDescriptor javaClass = parent.getObjectClass();
- do {
- String name = javaClass.getName();
- if (name.equals(javaClassName) || name.substring(name.lastIndexOf(".") + 1).equals(javaClassName)) {
- classMatch = true;
- break;
- }
- javaClass = javaClass.getSuperclass();
- } while (javaClass != null);
- }
-
- boolean styleClassMatch = (styleClass == null || styleClass.equals(parent.getStyleClass()));
-
- String objectId = parent.getId();
- objectId = objectId.substring(objectId.lastIndexOf(".") + 1);
- boolean idMatch = (id == null || (' ' + objectId + ' ').indexOf(' ' + id + ' ') > -1);
-
- if (classMatch && styleClassMatch && idMatch) {
- if (pseudoClass != null) {
- return inheritOnly ? Selector.PSEUDOCLASS_APPLIES_INHERIT_ONLY : Selector.PSEUDOCLASS_APPLIES;
- } else {
- return inheritOnly ? Selector.ALWAYS_APPLIES_INHERIT_ONLY : Selector.ALWAYS_APPLIES;
- }
- }
-
- parent = parent.getParent();
- inheritOnly = true;
- }
- return Selector.NEVER_APPLIES;
- }
-
- public enum MouseEventEnum {
-
- mouseover,
- mouseout,
- mousedown,
- mouseup
- }
-}
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,551 @@
+package jaxx.compiler.css;
+
+import jaxx.compiler.*;
+import jaxx.runtime.css.Selector;
+import jaxx.runtime.css.Rule;
+import jaxx.runtime.css.Stylesheet;
+import jaxx.compiler.java.parser.JavaParser;
+import jaxx.compiler.java.parser.JavaParserTreeConstants;
+import jaxx.compiler.java.parser.SimpleNode;
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.compiler.tags.DefaultObjectHandler;
+import jaxx.compiler.tags.TagManager;
+
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A helper class to compute {@link Stylesheet}, {@link Rule} and {@link Selector}
+ * and extract all the compiler logic from this class.
+ * <p/>
+ * In that way we can make the compiler as a single module and a runtime as another module.
+ *
+ * @author chemit
+ */
+public class StylesheetHelper {
+
+ public static void applyTo(CompiledObject object, JAXXCompiler compiler, Stylesheet stylesheet, Stylesheet overrides) throws CompilerException {
+ Map<String, String> overriddenProperties;
+ if (overrides != null) {
+ overriddenProperties = getApplicableProperties(overrides, object);
+ //overriddenProperties = overrides.getApplicableProperties(s,object);
+ } else {
+ overriddenProperties = null;
+ }
+
+ Map<String, String> properties = getApplicableProperties(stylesheet, object);
+ if (properties != null) {
+ if (overriddenProperties != null) {
+ properties.keySet().removeAll(overriddenProperties.keySet());
+ }
+ DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass());
+ for (Map.Entry<String, String> e : properties.entrySet()) {
+ String value = e.getValue();
+ if (value.equals(Rule.INLINE_ATTRIBUTE) || value.equals(Rule.DATA_BINDING)) {
+ continue;
+ }
+ handler.setAttribute(object, e.getKey(), e.getValue(), false, compiler);
+ }
+ }
+
+ Rule[] pseudoClasses = getApplicablePseudoClasses(stylesheet, object);
+ if (pseudoClasses != null) {
+ Map<String, Map<String, String>> combinedPseudoClasses = new LinkedHashMap<String, Map<String, String>>();
+ for (Rule pseudoClass1 : pseudoClasses) {
+ Selector[] selectors = pseudoClass1.getSelectors();
+ for (Selector selector : selectors) {
+ if (appliesTo(selector, object) == Selector.PSEUDOCLASS_APPLIES) {
+ properties = pseudoClass1.getProperties();
+ String pseudoClass = selector.getPseudoClass();
+ // TODO: overrides by downstream pseudoclasses are not handled
+ Map<String, String> combinedProperties = combinedPseudoClasses.get(pseudoClass);
+ if (combinedProperties == null) {
+ combinedProperties = new HashMap<String, String>();
+ combinedPseudoClasses.put(pseudoClass, combinedProperties);
+ }
+ combinedProperties.putAll(properties);
+ }
+ }
+ }
+
+ int count = 0;
+ for (Map.Entry<String, Map<String, String>> e : combinedPseudoClasses.entrySet()) {
+ applyPseudoClass(e.getKey(), e.getValue(), object, compiler, count++);
+ }
+ }
+ }
+
+ /**
+ * Replaces all references to the variable "object" with the actual object ID.
+ *
+ * @param code ?
+ * @param id ?
+ * @return ?
+ * @throws CompilerException ?
+ */
+ public static String replaceObjectReferences(String code, String id) throws CompilerException {
+ JavaParser p = new JavaParser(new StringReader(code + ";"));
+ p.Expression();
+ jaxx.compiler.java.parser.SimpleNode node = p.popNode();
+ scanNode(node, id);
+ return node.getText();
+ }
+
+ public static void scanNode(SimpleNode node, String id) {
+ if (node.getId() == JavaParserTreeConstants.JJTNAME) {
+ String name = node.getText();
+ if (name.equals("object") || (name.indexOf(".") != -1 && name.substring(0, name.indexOf(".")).trim().equals("object"))) {
+ node.firstToken.image = id;
+ }
+ } else {
+ int count = node.jjtGetNumChildren();
+ for (int i = 0; i < count; i++) {
+ scanNode(node.getChild(i), id);
+ }
+ }
+ }
+
+ public static void compilePseudoClassAdd(String pseudoClass, CompiledObject object, String propertyCode, JAXXCompiler compiler) throws CompilerException {
+
+ if (pseudoClass.startsWith("{")) {
+ pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
+ pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
+ String dest = object.getId() + ".style." + pseudoClass + ".add";
+ String destCode = compiler.getJavaCode(dest);
+ if (compiler.hasProcessDataBinding()) {
+ compiler.appendProcessDataBinding("else ");
+ }
+ compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { " + propertyCode + "} }");
+ new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
+ compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");");
+ return;
+ }
+
+ MouseEventEnum constant = MouseEventEnum.valueOf(pseudoClass);
+
+ String property = null;
+ switch (constant) {
+ case mousedown:
+ property = "mousePressed";
+ break;
+ case mouseout:
+ property = "mouseExited";
+ break;
+ case mouseover:
+ property = "mouseEntered";
+ break;
+ case mouseup:
+ property = "mouseReleased";
+ break;
+ }
+
+ ClassDescriptor mouseListenerDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseListener.class);
+ ClassDescriptor mouseEventDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseEvent.class);
+
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", mouseListenerDescriptor);
+ MethodDescriptor methodDescriptor = mouseListenerDescriptor.getMethodDescriptor(property, mouseEventDescriptor);
+ object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, methodDescriptor, propertyCode, compiler);
+
+ } catch (NoSuchMethodException e) {
+ compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+
+ /*if (pseudoClass.equals("mouseover")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.equals("mouseout")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ compiler.appendInitDataBindings("{" + propertyCode + "}");
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.equals("mousedown")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.equals("mouseup")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".add", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ compiler.appendInitDataBindings("{" + propertyCode + "}");
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.startsWith("{")) {
+ pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
+ pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
+ String dest = object.getId() + ".style." + pseudoClass + ".add";
+ String destCode = TypeManager.getJavaCode(dest);
+ if (compiler.hasProcessDataBinding()) {
+ compiler.appendProcessDataBinding("else ");
+ }
+ compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }");
+ new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
+ compiler.appendInitDataBindings("applyDataBinding("+ destCode + ");");
+ } else
+ throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);*/
+ }
+
+ public static void compilePseudoClassRemove(String pseudoClass, CompiledObject object, String propertyCode, JAXXCompiler compiler) throws CompilerException {
+ if (pseudoClass.startsWith("{")) {
+ pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
+ pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
+ String dest = object.getId() + ".style." + pseudoClass + ".remove";
+ String destCode = compiler.getJavaCode(dest);
+ if (compiler.hasProcessDataBinding()) {
+ compiler.appendProcessDataBinding("else ");
+ }
+ compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
+ new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
+ compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");");
+ return;
+ }
+
+ MouseEventEnum constant = MouseEventEnum.valueOf(pseudoClass);
+
+ String property = null;
+ switch (constant) {
+ case mousedown:
+ property = "mousePressed";
+ break;
+ case mouseout:
+ property = "mouseReleased";
+ break;
+ case mouseover:
+ property = "mouseExited";
+ break;
+ case mouseup:
+ property = "mousePressed";
+ break;
+ }
+
+ ClassDescriptor mouseListenerDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseListener.class);
+ ClassDescriptor mouseEventDescriptor = ClassDescriptorLoader.getClassDescriptor(MouseEvent.class);
+
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", mouseListenerDescriptor);
+ MethodDescriptor methodDescriptor = mouseListenerDescriptor.getMethodDescriptor(property, mouseEventDescriptor);
+ object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, methodDescriptor, propertyCode, compiler);
+
+ } catch (NoSuchMethodException e) {
+ compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+
+ /*if (pseudoClass.equals("mouseover")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.equals("mouseout")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.equals("mousedown")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.equals("mouseup")) {
+ try {
+ MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)});
+ object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener,
+ ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed",
+ new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}),
+ propertyCode, compiler);
+ }
+ catch (NoSuchMethodException e) {
+ compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)");
+ }
+ } else if (pseudoClass.startsWith("{")) {
+ pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim();
+ pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode());
+ String dest = object.getId() + ".style." + pseudoClass + ".remove";
+ String destCode = TypeManager.getJavaCode(dest);
+ if (compiler.hasProcessDataBinding()) {
+ compiler.appendProcessDataBinding("else ");
+ }
+ compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }");
+ new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")");
+ compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");");
+ } else {
+ throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);
+ }*/
+ }
+
+ public static String invert(String javaCode) {
+ javaCode = javaCode.trim();
+ return javaCode.startsWith("!") ? javaCode.substring(1) : "!(" + javaCode + ")";
+ }
+
+ public static String unwrap(ClassDescriptor type, String valueCode) {
+ if (type == ClassDescriptorLoader.getClassDescriptor(boolean.class)) {
+ return "((java.lang.Boolean) " + valueCode + ").booleanValue()";
+ } else if (type == ClassDescriptorLoader.getClassDescriptor(byte.class)) {
+ return "((java.lang.Byte) " + valueCode + ").byteValue()";
+ } else if (type == ClassDescriptorLoader.getClassDescriptor(short.class)) {
+ return "((java.lang.Short) " + valueCode + ").shortValue()";
+ } else if (type == ClassDescriptorLoader.getClassDescriptor(int.class)) {
+ return "((java.lang.Integer) " + valueCode + ").intValue()";
+ } else if (type == ClassDescriptorLoader.getClassDescriptor(long.class)) {
+ return "((java.lang.Long) " + valueCode + ").longValue()";
+ } else if (type == ClassDescriptorLoader.getClassDescriptor(float.class)) {
+ return "((java.lang.Float) " + valueCode + ").floatValue()";
+ } else if (type == ClassDescriptorLoader.getClassDescriptor(double.class)) {
+ return "((java.lang.Double) " + valueCode + ").doubleValue()";
+ } else if (type == ClassDescriptorLoader.getClassDescriptor(char.class)) {
+ return "((java.lang.Character) " + valueCode + ").charValue()";
+ } else {
+ return valueCode;
+ }
+ }
+
+ public static void applyPseudoClass(String pseudoClass, Map<String, String> properties,
+ CompiledObject object, JAXXCompiler compiler, int priority) throws CompilerException {
+ if (pseudoClass.indexOf("[") != -1) {
+ pseudoClass = pseudoClass.substring(0, pseudoClass.indexOf("["));
+ }
+ final StringBuffer buffer = new StringBuffer();
+
+ DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass());
+ boolean valueDeclared = false;
+ for (Map.Entry<String, String> e : properties.entrySet()) {
+ String property = e.getKey();
+ ClassDescriptor type = handler.getPropertyType(object, property, compiler);
+ String dataBinding = compiler.processDataBindings(e.getValue(), type);
+ String valueCode;
+ if (dataBinding != null) {
+ valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
+ new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
+ property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false);
+ } else {
+ try {
+ Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
+ valueCode = compiler.getJavaCode(compiler.convertFromString(e.getValue(), typeClass));
+ } catch (ClassNotFoundException ex) {
+ compiler.reportError("could not find class " + type.getName());
+ return;
+ }
+ }
+ if (!valueDeclared) {
+ buffer.append("java.lang.Object ");
+ valueDeclared = true;
+ }
+ buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator());
+ buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator());
+ String unwrappedValue = unwrap(type, "value");
+ buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
+ ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator());
+ buffer.append("}").append(JAXXCompiler.getLineSeparator());
+ }
+
+ if (pseudoClass.equals("focused")) {
+ pseudoClass = "{ object.hasFocus() }";
+ } else if (pseudoClass.equals("unfocused")) {
+ pseudoClass = "{ !object.hasFocus() }";
+ } else if (pseudoClass.equals("enabled")) {
+ pseudoClass = "{ object.isEnabled() }";
+ } else if (pseudoClass.equals("disabled")) {
+ pseudoClass = "{ !object.isEnabled() }";
+ } else if (pseudoClass.equals("selected")) {
+ pseudoClass = "{ object.isSelected() }";
+ } else if (pseudoClass.equals("deselected")) {
+ pseudoClass = "{ !object.isSelected() }";
+ }
+
+ compilePseudoClassAdd(pseudoClass, object, buffer.toString(), compiler);
+
+ buffer.setLength(0);
+ valueDeclared = false;
+ for (Map.Entry<String, String> e : properties.entrySet()) {
+ String property = e.getKey();
+ ClassDescriptor type = handler.getPropertyType(object, property, compiler);
+ String dataBinding = compiler.processDataBindings(e.getValue(), type);
+ String valueCode;
+ if (dataBinding != null) {
+ valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")";
+ new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(),
+ property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false);
+ } else {
+ try {
+ Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null;
+ valueCode = compiler.getJavaCode(compiler.convertFromString(e.getValue(), typeClass));
+ } catch (ClassNotFoundException ex) {
+ compiler.reportError("could not find class " + type.getName());
+ return;
+ }
+ }
+ if (!valueDeclared) {
+ buffer.append("java.lang.Object ");
+ valueDeclared = true;
+ }
+ buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator());
+ buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator());
+ String unwrappedValue = unwrap(type, "value");
+ buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) +
+ ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator());
+ buffer.append("}").append(JAXXCompiler.getLineSeparator());
+ }
+ compilePseudoClassRemove(pseudoClass, object, buffer.toString(), compiler);
+ }
+
+ public static Map<String, String> getApplicableProperties(Stylesheet s, CompiledObject object) throws CompilerException {
+ DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass());
+ Map<String, String> result = null;
+ for (Rule rule : s.getRules()) {
+ int apply = appliesTo(rule, object);
+ if (apply == Selector.ALWAYS_APPLIES || apply == Selector.ALWAYS_APPLIES_INHERIT_ONLY) {
+ if (result == null) {
+ result = new HashMap<String, String>();
+ }
+ for (Map.Entry<String, String> entry : rule.getProperties().entrySet()) {
+ String property = entry.getKey();
+ if (apply == Selector.ALWAYS_APPLIES || handler.isPropertyInherited(property)) {
+ result.put(property, entry.getValue());
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ public static Rule[] getApplicablePseudoClasses(Stylesheet s, CompiledObject object) throws CompilerException {
+ List<Rule> result = null;
+ for (Rule rule : s.getRules()) {
+ if (appliesTo(rule, object) == Selector.PSEUDOCLASS_APPLIES) {
+ if (result == null) {
+ result = new ArrayList<Rule>();
+ }
+ result.add(rule);
+ }
+ }
+ return result != null ? result.toArray(new Rule[result.size()]) : null;
+ }
+
+ public static Rule inlineAttribute(CompiledObject object, String propertyName, boolean dataBinding) {
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(propertyName, dataBinding ? Rule.DATA_BINDING : Rule.INLINE_ATTRIBUTE);
+ return new Rule(new Selector[]{new Selector(null, null, null, object.getId(), true)}, properties);
+ }
+
+ public static int appliesTo(Rule rule, CompiledObject object) throws CompilerException {
+ int appliesTo = Selector.NEVER_APPLIES;
+ for (Selector selector : rule.getSelectors()) {
+ appliesTo = Math.max(appliesTo(selector, object), appliesTo);
+ if (appliesTo == Selector.ALWAYS_APPLIES || appliesTo == Selector.ALWAYS_APPLIES_INHERIT_ONLY) {
+ break;
+ }
+ }
+ return appliesTo;
+ }
+
+ public static int appliesTo(Selector selector, CompiledObject object) {
+ boolean inheritOnly = false;
+ CompiledObject parent = object;
+ String javaClassName = selector.getJavaClassName();
+ String styleClass = selector.getStyleClass();
+ String pseudoClass = selector.getPseudoClass();
+ String id = selector.getId();
+
+ while (parent != null) {
+ boolean classMatch = (javaClassName == null);
+ if (!classMatch) {
+ ClassDescriptor javaClass = parent.getObjectClass();
+ do {
+ String name = javaClass.getName();
+ if (name.equals(javaClassName) || name.substring(name.lastIndexOf(".") + 1).equals(javaClassName)) {
+ classMatch = true;
+ break;
+ }
+ javaClass = javaClass.getSuperclass();
+ } while (javaClass != null);
+ }
+
+ boolean styleClassMatch = (styleClass == null || styleClass.equals(parent.getStyleClass()));
+
+ String objectId = parent.getId();
+ objectId = objectId.substring(objectId.lastIndexOf(".") + 1);
+ boolean idMatch = (id == null || (' ' + objectId + ' ').indexOf(' ' + id + ' ') > -1);
+
+ if (classMatch && styleClassMatch && idMatch) {
+ if (pseudoClass != null) {
+ return inheritOnly ? Selector.PSEUDOCLASS_APPLIES_INHERIT_ONLY : Selector.PSEUDOCLASS_APPLIES;
+ } else {
+ return inheritOnly ? Selector.ALWAYS_APPLIES_INHERIT_ONLY : Selector.ALWAYS_APPLIES;
+ }
+ }
+
+ parent = parent.getParent();
+ inheritOnly = true;
+ }
+ return Selector.NEVER_APPLIES;
+ }
+
+ public enum MouseEventEnum {
+
+ mouseover,
+ mouseout,
+ mousedown,
+ mouseup
+ }
+}
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jj
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jj (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jj 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,587 @@
+/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. .\CSS.jj */
+/*@egen*//*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+// I would love to have used an existing CSS parser, but all of the ones I could
+// find are licensed under the LGPL. As JAXX is BSD licensed and I'm not a big
+// fan of the LGPL, unfortunately that won't work.
+options {
+ STATIC = false;
+ JDK_VERSION = "1.4";
+}
+
+PARSER_BEGIN(CSSParser)
+package jaxx.css;
+
+public class CSSParser/*@bgen(jjtree)*/implements CSSParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
+ protected JJTCSSParserState jjtree = new JJTCSSParserState();
+
+/*@egen*/
+ public SimpleNode popNode() {
+ if ( jjtree.nodeArity() > 0) // number of child nodes
+ return (SimpleNode)jjtree.popNode();
+ else
+ return null;
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode) n).firstToken = getToken(1);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode) n).lastToken = getToken(0);
+ }
+
+ public static void main(String args[]) {
+ System.out.println("Reading from standard input...");
+ CSSParser css = new CSSParser(System.in);
+ try {
+ SimpleNode n = css.Stylesheet();
+ n.dump("");
+ System.out.println("Thank you.");
+ } catch (Exception e) {
+ System.out.println("Oops.");
+ System.out.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
+
+PARSER_END(CSSParser)
+
+
+<DEFAULT, IN_RULE> SKIP :
+{
+ " "
+| "\t"
+| "\n"
+| "\r"
+| <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
+| <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/">
+}
+
+<*> TOKEN : /* LITERALS */
+{
+ <DECIMAL_LITERAL: <INTEGER_LITERAL> ("." <INTEGER_LITERAL>)?>
+|
+ <#INTEGER_LITERAL: (["0"-"9"])+>
+}
+
+<DEFAULT, IN_RULE> TOKEN : /* IDENTIFIER */
+{
+ <IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)*>
+|
+ <#LETTER: ["_", "-", "a"-"z", "A"-"Z"]>
+|
+ <#DIGIT: ["0"-"9"]>
+}
+
+<IN_PSEUDOCLASS> TOKEN : /* PSEUDOCLASS_IDENTIFIER */
+{
+ <PSEUDOCLASS_IDENTIFIER: <IDENTIFIER>> : DEFAULT
+}
+
+<DEFAULT> TOKEN: /* COLON */
+{
+ <PSEUDOCLASS_COLON: ":"> : IN_PSEUDOCLASS
+}
+
+<IN_RULE> TOKEN: /* COLON_IN_RULE */
+{
+ <COLON: ":">
+}
+
+<*> TOKEN: /* SEMICOLON */
+{
+ <SEMICOLON: ";">
+}
+
+TOKEN : /* LEFT BRACE */
+{
+ <LEFT_BRACE: "{"> : IN_RULE
+}
+
+<IN_RULE> TOKEN : /* RIGHT BRACE */
+{
+ <RIGHT_BRACE: "}"> : DEFAULT
+}
+
+<IN_RULE> TOKEN : /* JAVA_CODE_RULE START */
+{
+ <JAVA_CODE_START: <LEFT_BRACE>> : JAVA_CODE_RULE
+}
+
+<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE */
+{
+ <JAVA_CODE: (~["}"])+ >
+}
+
+<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE END */
+{
+ <JAVA_CODE_END: <RIGHT_BRACE>> : IN_RULE
+}
+
+
+<IN_PSEUDOCLASS> TOKEN : /* PROGRAMMATIC_PSEUDOCLASS */
+{
+ <PROGRAMMATIC_PSEUDOCLASS: "{" (~["}"])+ "}"> : DEFAULT
+}
+
+<IN_RULE> TOKEN : /* STRINGS */
+{
+ <STRING: "\"" (~["\"", "\\", "\n", "\r"])* "\"">
+}
+
+<IN_RULE> TOKEN : /* COLORS */
+{
+ <HEXCOLOR: "#" <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> (<HEXDIGIT> <HEXDIGIT> <HEXDIGIT>)?>
+|
+ <#HEXDIGIT: ["0"-"9", "a"-"f", "A"-"F"]>
+}
+
+
+<IN_RULE> TOKEN : /* EMS */
+{
+ <EMS: <DECIMAL_LITERAL> "em">
+}
+
+
+<IN_RULE> TOKEN : /* EXS */
+{
+ <EXS: <DECIMAL_LITERAL> "ex">
+}
+
+
+<IN_RULE> TOKEN : /* LENGTH */
+{
+ <LENGTH: <DECIMAL_LITERAL> ("pt" | "mm" | "cm" | "pc" | "in")>
+}
+
+
+SimpleNode Stylesheet() : {/*@bgen(jjtree) Stylesheet */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Stylesheet */
+ try {
+/*@egen*/
+ (Rule())*/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/
+ { return jjtn000; }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Rule() : {/*@bgen(jjtree) Rule */
+ SimpleNode jjtn000 = new SimpleNode(JJTRULE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Rule */
+ try {
+/*@egen*/
+ Selectors()
+ <LEFT_BRACE> Declaration() (";" (Declaration())?)* <RIGHT_BRACE>/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Selectors() : {/*@bgen(jjtree) Selectors */
+ SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Selectors */
+ try {
+/*@egen*/
+ Selector() ("," Selector())*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Selector() : {/*@bgen(jjtree) Selector */
+ SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Selector */
+ try {
+/*@egen*/
+ JavaClass() (Id())? (Class())? (PseudoClass())?
+|
+ Id() (Class())? (PseudoClass())?
+|
+ Class() (PseudoClass())?
+|
+ PseudoClass()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void JavaClass() : {/*@bgen(jjtree) JavaClass */
+ SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) JavaClass */
+ try {
+/*@egen*/
+ <IDENTIFIER> | "*"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Id() : {/*@bgen(jjtree) Id */
+ SimpleNode jjtn000 = new SimpleNode(JJTID);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Id */
+ try {
+/*@egen*/
+ "#" <IDENTIFIER>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Class() : {/*@bgen(jjtree) Class */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Class */
+ try {
+/*@egen*/
+ "." <IDENTIFIER>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void PseudoClass() : {/*@bgen(jjtree) PseudoClass */
+ SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PseudoClass */
+ try {
+/*@egen*/
+ <PSEUDOCLASS_COLON> (<PSEUDOCLASS_IDENTIFIER> | <PROGRAMMATIC_PSEUDOCLASS>) (AnimationProperties())?/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void AnimationProperties() : {/*@bgen(jjtree) AnimationProperties */
+ SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AnimationProperties */
+ try {
+/*@egen*/
+ "[" AnimationProperty() ("," AnimationProperty())* "]"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void AnimationProperty() : {/*@bgen(jjtree) AnimationProperty */
+ SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AnimationProperty */
+ try {
+/*@egen*/
+ <IDENTIFIER> "=" <DECIMAL_LITERAL> (<IDENTIFIER>)?/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Declaration() : {/*@bgen(jjtree) Declaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Declaration */
+ try {
+/*@egen*/
+ Property() <COLON> Expression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Property() : {/*@bgen(jjtree) Property */
+ SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Property */
+ try {
+/*@egen*/
+ <IDENTIFIER>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Expression() : {/*@bgen(jjtree) Expression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Expression */
+ try {
+/*@egen*/
+ (<DECIMAL_LITERAL> | <STRING> | <IDENTIFIER> | <HEXCOLOR> | <EMS> | <EXS> | <LENGTH> |
+ JavaCode())/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void JavaCode() : {/*@bgen(jjtree) JavaCode */
+ SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) JavaCode */
+ try {
+/*@egen*/
+ <JAVA_CODE_START> <JAVA_CODE> <JAVA_CODE_END>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void Identifier() : {/*@bgen(jjtree) Identifier */
+ SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Identifier */
+ try {
+/*@egen*/
+ <IDENTIFIER>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jjt
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jjt (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jjt 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,256 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+// I would love to have used an existing CSS parser, but all of the ones I could
+// find are licensed under the LGPL. As JAXX is BSD licensed and I'm not a big
+// fan of the LGPL, unfortunately that won't work.
+options {
+ STATIC = false;
+ JDK_VERSION = "1.4";
+ NODE_SCOPE_HOOK = true;
+}
+
+PARSER_BEGIN(CSSParser)
+package jaxx.css;
+
+public class CSSParser {
+ public SimpleNode popNode() {
+ if ( jjtree.nodeArity() > 0) // number of child nodes
+ return (SimpleNode)jjtree.popNode();
+ else
+ return null;
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode) n).firstToken = getToken(1);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode) n).lastToken = getToken(0);
+ }
+
+ public static void main(String args[]) {
+ System.out.println("Reading from standard input...");
+ CSSParser css = new CSSParser(System.in);
+ try {
+ SimpleNode n = css.Stylesheet();
+ n.dump("");
+ System.out.println("Thank you.");
+ } catch (Exception e) {
+ System.out.println("Oops.");
+ System.out.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
+
+PARSER_END(CSSParser)
+
+
+<DEFAULT, IN_RULE> SKIP :
+{
+ " "
+| "\t"
+| "\n"
+| "\r"
+| <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
+| <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/">
+}
+
+<*> TOKEN : /* LITERALS */
+{
+ <DECIMAL_LITERAL: <INTEGER_LITERAL> ("." <INTEGER_LITERAL>)?>
+|
+ <#INTEGER_LITERAL: (["0"-"9"])+>
+}
+
+<DEFAULT, IN_RULE> TOKEN : /* IDENTIFIER */
+{
+ <IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)*>
+|
+ <#LETTER: ["_", "-", "a"-"z", "A"-"Z"]>
+|
+ <#DIGIT: ["0"-"9"]>
+}
+
+<IN_PSEUDOCLASS> TOKEN : /* PSEUDOCLASS_IDENTIFIER */
+{
+ <PSEUDOCLASS_IDENTIFIER: <IDENTIFIER>> : DEFAULT
+}
+
+<DEFAULT> TOKEN: /* COLON */
+{
+ <PSEUDOCLASS_COLON: ":"> : IN_PSEUDOCLASS
+}
+
+<IN_RULE> TOKEN: /* COLON_IN_RULE */
+{
+ <COLON: ":">
+}
+
+<*> TOKEN: /* SEMICOLON */
+{
+ <SEMICOLON: ";">
+}
+
+TOKEN : /* LEFT BRACE */
+{
+ <LEFT_BRACE: "{"> : IN_RULE
+}
+
+<IN_RULE> TOKEN : /* RIGHT BRACE */
+{
+ <RIGHT_BRACE: "}"> : DEFAULT
+}
+
+<IN_RULE> TOKEN : /* JAVA_CODE_RULE START */
+{
+ <JAVA_CODE_START: <LEFT_BRACE>> : JAVA_CODE_RULE
+}
+
+<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE */
+{
+ <JAVA_CODE: (~["}"])+ >
+}
+
+<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE END */
+{
+ <JAVA_CODE_END: <RIGHT_BRACE>> : IN_RULE
+}
+
+
+<IN_PSEUDOCLASS> TOKEN : /* PROGRAMMATIC_PSEUDOCLASS */
+{
+ <PROGRAMMATIC_PSEUDOCLASS: "{" (~["}"])+ "}"> : DEFAULT
+}
+
+<IN_RULE> TOKEN : /* STRINGS */
+{
+ <STRING: "\"" (~["\"", "\\", "\n", "\r"])* "\"">
+}
+
+<IN_RULE> TOKEN : /* COLORS */
+{
+ <HEXCOLOR: "#" <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> (<HEXDIGIT> <HEXDIGIT> <HEXDIGIT>)?>
+|
+ <#HEXDIGIT: ["0"-"9", "a"-"f", "A"-"F"]>
+}
+
+
+<IN_RULE> TOKEN : /* EMS */
+{
+ <EMS: <DECIMAL_LITERAL> "em">
+}
+
+
+<IN_RULE> TOKEN : /* EXS */
+{
+ <EXS: <DECIMAL_LITERAL> "ex">
+}
+
+
+<IN_RULE> TOKEN : /* LENGTH */
+{
+ <LENGTH: <DECIMAL_LITERAL> ("pt" | "mm" | "cm" | "pc" | "in")>
+}
+
+
+SimpleNode Stylesheet() : {}
+{
+ (Rule())*
+ { return jjtThis; }
+}
+
+
+void Rule() : {}
+{
+ Selectors()
+ <LEFT_BRACE> Declaration() (";" (Declaration())?)* <RIGHT_BRACE>
+}
+
+
+void Selectors() : {}
+{
+ Selector() ("," Selector())*
+}
+
+
+void Selector() : {}
+{
+ JavaClass() (Id())? (Class())? (PseudoClass())?
+|
+ Id() (Class())? (PseudoClass())?
+|
+ Class() (PseudoClass())?
+|
+ PseudoClass()
+}
+
+
+void JavaClass() : {}
+{
+ <IDENTIFIER> | "*"
+}
+
+
+void Id() : {}
+{
+ "#" <IDENTIFIER>
+}
+
+
+void Class() : {}
+{
+ "." <IDENTIFIER>
+}
+
+
+void PseudoClass() : {}
+{
+ <PSEUDOCLASS_COLON> (<PSEUDOCLASS_IDENTIFIER> | <PROGRAMMATIC_PSEUDOCLASS>) (AnimationProperties())?
+}
+
+
+void AnimationProperties() : {}
+{
+ "[" AnimationProperty() ("," AnimationProperty())* "]"
+}
+
+
+void AnimationProperty() : {}
+{
+ <IDENTIFIER> "=" <DECIMAL_LITERAL> (<IDENTIFIER>)?
+}
+
+
+void Declaration() : {}
+{
+ Property() <COLON> Expression()
+}
+
+
+void Property() : {}
+{
+ <IDENTIFIER>
+}
+
+
+void Expression() : {}
+{
+ (<DECIMAL_LITERAL> | <STRING> | <IDENTIFIER> | <HEXCOLOR> | <EMS> | <EXS> | <LENGTH> |
+ JavaCode())
+}
+
+
+void JavaCode() : {}
+{
+ <JAVA_CODE_START> <JAVA_CODE> <JAVA_CODE_END>
+}
+
+
+void Identifier() : {}
+{
+ <IDENTIFIER>
+}
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,799 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParser.java */
+package jaxx.compiler.css.parser;
+
+public class CSSParser/*@bgen(jjtree)*/ implements CSSParserTreeConstants, CSSParserConstants {/*@bgen(jjtree)*/
+ protected JJTCSSParserState jjtree = new JJTCSSParserState();
+
+ public SimpleNode popNode() {
+ if (jjtree.nodeArity() > 0) // number of child nodes
+ return (SimpleNode) jjtree.popNode();
+ else
+ return null;
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode) n).firstToken = getToken(1);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode) n).lastToken = getToken(0);
+ }
+
+ public static void main(String args[]) {
+ System.out.println("Reading from standard input...");
+ CSSParser css = new CSSParser(System.in);
+ try {
+ SimpleNode n = css.Stylesheet();
+ n.dump("");
+ System.out.println("Thank you.");
+ } catch (Exception e) {
+ System.out.println("Oops.");
+ System.out.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ final public SimpleNode Stylesheet() throws ParseException {
+ /*@bgen(jjtree) Stylesheet */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ label_1:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ case PSEUDOCLASS_COLON:
+ case 29:
+ case 30:
+ case 31:
+ ;
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ break label_1;
+ }
+ Rule();
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return jjtn000;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public void Rule() throws ParseException {
+ /*@bgen(jjtree) Rule */
+ SimpleNode jjtn000 = new SimpleNode(JJTRULE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Selectors();
+ jj_consume_token(LEFT_BRACE);
+ Declaration();
+ label_2:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SEMICOLON:
+ ;
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ break label_2;
+ }
+ jj_consume_token(SEMICOLON);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ Declaration();
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ ;
+ }
+ }
+ jj_consume_token(RIGHT_BRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Selectors() throws ParseException {
+ /*@bgen(jjtree) Selectors */
+ SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Selector();
+ label_3:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 28:
+ ;
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ break label_3;
+ }
+ jj_consume_token(28);
+ Selector();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Selector() throws ParseException {
+ /*@bgen(jjtree) Selector */
+ SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ case 29:
+ JavaClass();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 30:
+ Id();
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 31:
+ Class();
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PSEUDOCLASS_COLON:
+ PseudoClass();
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ ;
+ }
+ break;
+ case 30:
+ Id();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 31:
+ Class();
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PSEUDOCLASS_COLON:
+ PseudoClass();
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ ;
+ }
+ break;
+ case 31:
+ Class();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PSEUDOCLASS_COLON:
+ PseudoClass();
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ ;
+ }
+ break;
+ case PSEUDOCLASS_COLON:
+ PseudoClass();
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void JavaClass() throws ParseException {
+ /*@bgen(jjtree) JavaClass */
+ SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ jj_consume_token(IDENTIFIER);
+ break;
+ case 29:
+ jj_consume_token(29);
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Id() throws ParseException {
+ /*@bgen(jjtree) Id */
+ SimpleNode jjtn000 = new SimpleNode(JJTID);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(30);
+ jj_consume_token(IDENTIFIER);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Class() throws ParseException {
+ /*@bgen(jjtree) Class */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(31);
+ jj_consume_token(IDENTIFIER);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PseudoClass() throws ParseException {
+ /*@bgen(jjtree) PseudoClass */
+ SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(PSEUDOCLASS_COLON);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PSEUDOCLASS_IDENTIFIER:
+ jj_consume_token(PSEUDOCLASS_IDENTIFIER);
+ break;
+ case PROGRAMMATIC_PSEUDOCLASS:
+ jj_consume_token(PROGRAMMATIC_PSEUDOCLASS);
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 32:
+ AnimationProperties();
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AnimationProperties() throws ParseException {
+ /*@bgen(jjtree) AnimationProperties */
+ SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(32);
+ AnimationProperty();
+ label_4:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 28:
+ ;
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ break label_4;
+ }
+ jj_consume_token(28);
+ AnimationProperty();
+ }
+ jj_consume_token(33);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AnimationProperty() throws ParseException {
+ /*@bgen(jjtree) AnimationProperty */
+ SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ jj_consume_token(34);
+ jj_consume_token(DECIMAL_LITERAL);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ jj_consume_token(IDENTIFIER);
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ ;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Declaration() throws ParseException {
+ /*@bgen(jjtree) Declaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Property();
+ jj_consume_token(COLON);
+ Expression();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Property() throws ParseException {
+ /*@bgen(jjtree) Property */
+ SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Expression() throws ParseException {
+ /*@bgen(jjtree) Expression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case DECIMAL_LITERAL:
+ jj_consume_token(DECIMAL_LITERAL);
+ break;
+ case STRING:
+ jj_consume_token(STRING);
+ break;
+ case IDENTIFIER:
+ jj_consume_token(IDENTIFIER);
+ break;
+ case HEXCOLOR:
+ jj_consume_token(HEXCOLOR);
+ break;
+ case EMS:
+ jj_consume_token(EMS);
+ break;
+ case EXS:
+ jj_consume_token(EXS);
+ break;
+ case LENGTH:
+ jj_consume_token(LENGTH);
+ break;
+ case JAVA_CODE_START:
+ JavaCode();
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void JavaCode() throws ParseException {
+ /*@bgen(jjtree) JavaCode */
+ SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(JAVA_CODE_START);
+ jj_consume_token(JAVA_CODE);
+ jj_consume_token(JAVA_CODE_END);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Identifier() throws ParseException {
+ /*@bgen(jjtree) Identifier */
+ SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ public CSSParserTokenManager token_source;
+ SimpleCharStream jj_input_stream;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[17];
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+
+ static {
+ jj_la1_0();
+ jj_la1_1();
+ }
+
+ private static void jj_la1_0() {
+ jj_la1_0 = new int[]{0xe0002200, 0x8000, 0x200, 0x10000000, 0x40000000, 0x80000000, 0x2000, 0x80000000, 0x2000, 0x2000, 0xe0002200, 0x20000200, 0x201000, 0x0, 0x10000000, 0x200, 0xec40280,};
+ }
+
+ private static void jj_la1_1() {
+ jj_la1_1 = new int[]{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,};
+ }
+
+ public CSSParser(java.io.InputStream stream) {
+ this(stream, null);
+ }
+
+ public CSSParser(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source = new CSSParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 17; i++) jj_la1[i] = -1;
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ ReInit(stream, null);
+ }
+
+ public void ReInit(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream.ReInit(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 17; i++) jj_la1[i] = -1;
+ }
+
+ public CSSParser(java.io.Reader stream) {
+ jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new CSSParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 17; i++) jj_la1[i] = -1;
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 17; i++) jj_la1[i] = -1;
+ }
+
+ public CSSParser(CSSParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 17; i++) jj_la1[i] = -1;
+ }
+
+ public void ReInit(CSSParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ jj_gen = 0;
+ for (int i = 0; i < 17; i++) jj_la1[i] = -1;
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final private int jj_ntk() {
+ if ((jj_nt = token.next) == null)
+ return (jj_ntk = (token.next = token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.Vector jj_expentries = new java.util.Vector();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+
+ public ParseException generateParseException() {
+ Token errortok = token.next;
+ int line = errortok.beginLine, column = errortok.beginColumn;
+ String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
+ return new ParseException("Parse error. Encountered: " + mess, line, column);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,72 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */
+package jaxx.compiler.css.parser;
+
+public interface CSSParserConstants {
+
+ int EOF = 0;
+ int DECIMAL_LITERAL = 7;
+ int INTEGER_LITERAL = 8;
+ int IDENTIFIER = 9;
+ int LETTER = 10;
+ int DIGIT = 11;
+ int PSEUDOCLASS_IDENTIFIER = 12;
+ int PSEUDOCLASS_COLON = 13;
+ int COLON = 14;
+ int SEMICOLON = 15;
+ int LEFT_BRACE = 16;
+ int RIGHT_BRACE = 17;
+ int JAVA_CODE_START = 18;
+ int JAVA_CODE = 19;
+ int JAVA_CODE_END = 20;
+ int PROGRAMMATIC_PSEUDOCLASS = 21;
+ int STRING = 22;
+ int HEXCOLOR = 23;
+ int HEXDIGIT = 24;
+ int EMS = 25;
+ int EXS = 26;
+ int LENGTH = 27;
+
+ int DEFAULT = 0;
+ int IN_RULE = 1;
+ int JAVA_CODE_RULE = 2;
+ int IN_PSEUDOCLASS = 3;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "\" \"",
+ "\"\\t\"",
+ "\"\\n\"",
+ "\"\\r\"",
+ "<token of kind 5>",
+ "<token of kind 6>",
+ "<DECIMAL_LITERAL>",
+ "<INTEGER_LITERAL>",
+ "<IDENTIFIER>",
+ "<LETTER>",
+ "<DIGIT>",
+ "<PSEUDOCLASS_IDENTIFIER>",
+ "\":\"",
+ "\":\"",
+ "\";\"",
+ "\"{\"",
+ "\"}\"",
+ "<JAVA_CODE_START>",
+ "<JAVA_CODE>",
+ "<JAVA_CODE_END>",
+ "<PROGRAMMATIC_PSEUDOCLASS>",
+ "<STRING>",
+ "<HEXCOLOR>",
+ "<HEXDIGIT>",
+ "<EMS>",
+ "<EXS>",
+ "<LENGTH>",
+ "\",\"",
+ "\"*\"",
+ "\"#\"",
+ "\".\"",
+ "\"[\"",
+ "\"]\"",
+ "\"=\"",
+ };
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,1152 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserTokenManager.java */
+package jaxx.compiler.css.parser;
+
+public class CSSParserTokenManager implements CSSParserConstants {
+ public java.io.PrintStream debugStream = System.out;
+
+ public void setDebugStream(java.io.PrintStream ds) {
+ debugStream = ds;
+ }
+
+ private int jjStopStringLiteralDfa_0(int pos, long active0) {
+ switch (pos) {
+ default:
+ return -1;
+ }
+ }
+
+ private int jjStartNfa_0(int pos, long active0) {
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+ }
+
+ private int jjStopAtPos(int pos, int kind) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+ }
+
+ private int jjStartNfaWithStates_0(int pos, int kind, int state) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return pos + 1;
+ }
+ return jjMoveNfa_0(state, pos + 1);
+ }
+
+ private int jjMoveStringLiteralDfa0_0() {
+ switch (curChar) {
+ case 35:
+ return jjStopAtPos(0, 30);
+ case 42:
+ return jjStopAtPos(0, 29);
+ case 44:
+ return jjStopAtPos(0, 28);
+ case 46:
+ return jjStopAtPos(0, 31);
+ case 58:
+ return jjStopAtPos(0, 13);
+ case 59:
+ return jjStopAtPos(0, 15);
+ case 61:
+ return jjStopAtPos(0, 34);
+ case 91:
+ return jjStopAtPos(0, 32);
+ case 93:
+ return jjStopAtPos(0, 33);
+ case 123:
+ return jjStopAtPos(0, 16);
+ default:
+ return jjMoveNfa_0(3, 0);
+ }
+ }
+
+ private void jjCheckNAdd(int state) {
+ if (jjrounds[state] != jjround) {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+ }
+
+ private void jjAddStates(int start, int end) {
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+ }
+
+ private void jjCheckNAddTwoStates(int state1, int state2) {
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+ }
+
+ private void jjCheckNAddStates(int start, int end) {
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+ }
+
+ private void jjCheckNAddStates(int start) {
+ jjCheckNAdd(jjnextStates[start]);
+ jjCheckNAdd(jjnextStates[start + 1]);
+ }
+
+ static final long[] jjbitVec0 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+ };
+
+ private int jjMoveNfa_0(int startState, int curPos) {
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 17;
+ 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 3:
+ if ((0x3ff000000000000L & l) != 0L) {
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(0, 1);
+ } else if (curChar == 47)
+ jjAddStates(0, 1);
+ else if (curChar == 45) {
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(4);
+ }
+ break;
+ case 0:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(0, 1);
+ break;
+ case 1:
+ if (curChar == 46)
+ jjCheckNAdd(2);
+ break;
+ case 2:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAdd(2);
+ break;
+ case 4:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(4);
+ break;
+ case 5:
+ if (curChar == 47)
+ jjAddStates(0, 1);
+ break;
+ case 6:
+ if (curChar == 47)
+ jjCheckNAddStates(2, 4);
+ break;
+ case 7:
+ if ((0xffffffffffffdbffL & l) != 0L)
+ jjCheckNAddStates(2, 4);
+ break;
+ case 8:
+ if ((0x2400L & l) != 0L && kind > 5)
+ kind = 5;
+ break;
+ case 9:
+ if (curChar == 10 && kind > 5)
+ kind = 5;
+ break;
+ case 10:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 9;
+ break;
+ case 11:
+ if (curChar == 42)
+ jjCheckNAddTwoStates(12, 13);
+ break;
+ case 12:
+ if ((0xfffffbffffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(12, 13);
+ break;
+ case 13:
+ if (curChar == 42)
+ jjAddStates(5, 6);
+ break;
+ case 14:
+ if ((0xffff7fffffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(15, 13);
+ break;
+ case 15:
+ if ((0xfffffbffffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(15, 13);
+ break;
+ case 16:
+ if (curChar == 47 && kind > 6)
+ kind = 6;
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else if (curChar < 128) {
+ long l = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 3:
+ case 4:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(4);
+ break;
+ case 7:
+ jjAddStates(2, 4);
+ break;
+ case 12:
+ jjCheckNAddTwoStates(12, 13);
+ break;
+ case 14:
+ case 15:
+ jjCheckNAddTwoStates(15, 13);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 7:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(2, 4);
+ break;
+ case 12:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddTwoStates(12, 13);
+ break;
+ case 14:
+ case 15:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddTwoStates(15, 13);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ }
+ if (kind != 0x7fffffff) {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 17 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return curPos;
+ }
+ }
+ }
+
+ private int jjStopStringLiteralDfa_3(int pos, long active0) {
+ switch (pos) {
+ default:
+ return -1;
+ }
+ }
+
+ private int jjStartNfa_3(int pos, long active0) {
+ return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1);
+ }
+
+ private int jjStartNfaWithStates_3(int pos, int kind, int state) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return pos + 1;
+ }
+ return jjMoveNfa_3(state, pos + 1);
+ }
+
+ private int jjMoveStringLiteralDfa0_3() {
+ switch (curChar) {
+ case 59:
+ return jjStopAtPos(0, 15);
+ default:
+ return jjMoveNfa_3(3, 0);
+ }
+ }
+
+ private int jjMoveNfa_3(int startState, int curPos) {
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 8;
+ 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 3:
+ if ((0x3ff000000000000L & l) != 0L) {
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(0, 1);
+ } else if (curChar == 45) {
+ if (kind > 12)
+ kind = 12;
+ jjCheckNAdd(4);
+ }
+ break;
+ case 0:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(0, 1);
+ break;
+ case 1:
+ if (curChar == 46)
+ jjCheckNAdd(2);
+ break;
+ case 2:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAdd(2);
+ break;
+ case 4:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 12)
+ kind = 12;
+ jjCheckNAdd(4);
+ break;
+ case 6:
+ jjAddStates(7, 8);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else if (curChar < 128) {
+ long l = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 3:
+ if ((0x7fffffe87fffffeL & l) != 0L) {
+ if (kind > 12)
+ kind = 12;
+ jjCheckNAdd(4);
+ } else if (curChar == 123)
+ jjCheckNAdd(6);
+ break;
+ case 4:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 12)
+ kind = 12;
+ jjCheckNAdd(4);
+ break;
+ case 5:
+ if (curChar == 123)
+ jjCheckNAdd(6);
+ break;
+ case 6:
+ if ((0xdfffffffffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(6, 7);
+ break;
+ case 7:
+ if (curChar == 125)
+ kind = 21;
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 6:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(7, 8);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ }
+ if (kind != 0x7fffffff) {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 8 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return curPos;
+ }
+ }
+ }
+
+ private int jjStopStringLiteralDfa_1(int pos, long active0) {
+ switch (pos) {
+ default:
+ return -1;
+ }
+ }
+
+ private int jjStartNfa_1(int pos, long active0) {
+ return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1);
+ }
+
+ private int jjStartNfaWithStates_1(int pos, int kind, int state) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return pos + 1;
+ }
+ return jjMoveNfa_1(state, pos + 1);
+ }
+
+ private int jjMoveStringLiteralDfa0_1() {
+ switch (curChar) {
+ case 58:
+ return jjStopAtPos(0, 14);
+ case 59:
+ return jjStopAtPos(0, 15);
+ case 125:
+ return jjStopAtPos(0, 17);
+ default:
+ return jjMoveNfa_1(0, 0);
+ }
+ }
+
+ private int jjMoveNfa_1(int startState, int curPos) {
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 50;
+ 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 > 7)
+ kind = 7;
+ jjCheckNAddStates(9, 22);
+ } else if (curChar == 47)
+ jjAddStates(23, 24);
+ else if (curChar == 35)
+ jjstateSet[jjnewStateCnt++] = 7;
+ else if (curChar == 34)
+ jjCheckNAddTwoStates(4, 5);
+ else if (curChar == 45) {
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(1);
+ }
+ break;
+ case 1:
+ if ((0x3ff200000000000L & l) == 0L)
+ break;
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(1);
+ break;
+ case 3:
+ if (curChar == 34)
+ jjCheckNAddTwoStates(4, 5);
+ break;
+ case 4:
+ if ((0xfffffffbffffdbffL & l) != 0L)
+ jjCheckNAddTwoStates(4, 5);
+ break;
+ case 5:
+ if (curChar == 34 && kind > 22)
+ kind = 22;
+ break;
+ case 6:
+ if (curChar == 35)
+ jjstateSet[jjnewStateCnt++] = 7;
+ break;
+ case 7:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 8;
+ break;
+ case 8:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 9;
+ break;
+ case 9:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 23)
+ kind = 23;
+ jjstateSet[jjnewStateCnt++] = 10;
+ break;
+ case 10:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 11;
+ break;
+ case 11:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 12;
+ break;
+ case 12:
+ if ((0x3ff000000000000L & l) != 0L && kind > 23)
+ kind = 23;
+ break;
+ case 13:
+ if (curChar == 47)
+ jjAddStates(23, 24);
+ break;
+ case 14:
+ if (curChar == 47)
+ jjCheckNAddStates(25, 27);
+ break;
+ case 15:
+ if ((0xffffffffffffdbffL & l) != 0L)
+ jjCheckNAddStates(25, 27);
+ break;
+ case 16:
+ if ((0x2400L & l) != 0L && kind > 5)
+ kind = 5;
+ break;
+ case 17:
+ if (curChar == 10 && kind > 5)
+ kind = 5;
+ break;
+ case 18:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 17;
+ break;
+ case 19:
+ if (curChar == 42)
+ jjCheckNAddTwoStates(20, 21);
+ break;
+ case 20:
+ if ((0xfffffbffffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(20, 21);
+ break;
+ case 21:
+ if (curChar == 42)
+ jjAddStates(28, 29);
+ break;
+ case 22:
+ if ((0xffff7fffffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(23, 21);
+ break;
+ case 23:
+ if ((0xfffffbffffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(23, 21);
+ break;
+ case 24:
+ if (curChar == 47 && kind > 6)
+ kind = 6;
+ break;
+ case 25:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddStates(9, 22);
+ break;
+ case 26:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(26, 27);
+ break;
+ case 27:
+ if (curChar == 46)
+ jjCheckNAdd(28);
+ break;
+ case 28:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAdd(28);
+ break;
+ case 29:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(30, 32);
+ break;
+ case 30:
+ if (curChar == 46)
+ jjCheckNAdd(31);
+ break;
+ case 31:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(31, 33);
+ break;
+ case 34:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(33, 35);
+ break;
+ case 35:
+ if (curChar == 46)
+ jjCheckNAdd(36);
+ break;
+ case 36:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(36, 38);
+ break;
+ case 39:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(36, 41);
+ break;
+ case 40:
+ if (curChar == 46)
+ jjCheckNAdd(41);
+ break;
+ case 41:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(42, 46);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else if (curChar < 128) {
+ long l = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 0:
+ if ((0x7fffffe87fffffeL & l) != 0L) {
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(1);
+ } else if (curChar == 123) {
+ if (kind > 18)
+ kind = 18;
+ }
+ break;
+ case 1:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 9)
+ kind = 9;
+ jjCheckNAdd(1);
+ break;
+ case 2:
+ if (curChar == 123 && kind > 18)
+ kind = 18;
+ break;
+ case 4:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjAddStates(47, 48);
+ break;
+ case 7:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 8;
+ break;
+ case 8:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 9;
+ break;
+ case 9:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 23)
+ kind = 23;
+ jjstateSet[jjnewStateCnt++] = 10;
+ break;
+ case 10:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 11;
+ break;
+ case 11:
+ if ((0x7e0000007eL & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 12;
+ break;
+ case 12:
+ if ((0x7e0000007eL & l) != 0L && kind > 23)
+ kind = 23;
+ break;
+ case 15:
+ jjAddStates(25, 27);
+ break;
+ case 20:
+ jjCheckNAddTwoStates(20, 21);
+ break;
+ case 22:
+ case 23:
+ jjCheckNAddTwoStates(23, 21);
+ break;
+ case 32:
+ if (curChar == 109 && kind > 25)
+ kind = 25;
+ break;
+ case 33:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 32;
+ break;
+ case 37:
+ if (curChar == 120 && kind > 26)
+ kind = 26;
+ break;
+ case 38:
+ if (curChar == 101)
+ jjstateSet[jjnewStateCnt++] = 37;
+ break;
+ case 42:
+ if (curChar == 109 && kind > 27)
+ kind = 27;
+ break;
+ case 43:
+ if (curChar == 109)
+ jjCheckNAdd(42);
+ break;
+ case 44:
+ if (curChar == 99)
+ jjCheckNAdd(42);
+ break;
+ case 45:
+ if (curChar == 110 && kind > 27)
+ kind = 27;
+ break;
+ case 46:
+ if (curChar == 105)
+ jjstateSet[jjnewStateCnt++] = 45;
+ break;
+ case 47:
+ if (curChar == 112)
+ jjAddStates(49, 50);
+ break;
+ case 48:
+ if (curChar == 116 && kind > 27)
+ kind = 27;
+ break;
+ case 49:
+ if (curChar == 99 && kind > 27)
+ kind = 27;
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 4:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(47, 48);
+ break;
+ case 15:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjAddStates(25, 27);
+ break;
+ case 20:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddTwoStates(20, 21);
+ break;
+ case 22:
+ case 23:
+ if ((jjbitVec0[i2] & l2) != 0L)
+ jjCheckNAddTwoStates(23, 21);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ }
+ if (kind != 0x7fffffff) {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 50 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return curPos;
+ }
+ }
+ }
+
+ private int jjStopStringLiteralDfa_2(int pos, long active0) {
+ switch (pos) {
+ default:
+ return -1;
+ }
+ }
+
+ private int jjStartNfa_2(int pos, long active0) {
+ return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1);
+ }
+
+ private int jjStartNfaWithStates_2(int pos, int kind, int state) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return pos + 1;
+ }
+ return jjMoveNfa_2(state, pos + 1);
+ }
+
+ private int jjMoveStringLiteralDfa0_2() {
+ switch (curChar) {
+ case 59:
+ return jjStartNfaWithStates_2(0, 15, 3);
+ default:
+ return jjMoveNfa_2(4, 0);
+ }
+ }
+
+ private int jjMoveNfa_2(int startState, int curPos) {
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 5;
+ 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 4:
+ if (kind > 19)
+ kind = 19;
+ jjCheckNAdd(3);
+ if ((0x3ff000000000000L & l) != 0L) {
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(0, 1);
+ }
+ break;
+ case 0:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAddTwoStates(0, 1);
+ break;
+ case 1:
+ if (curChar == 46)
+ jjCheckNAdd(2);
+ break;
+ case 2:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 7)
+ kind = 7;
+ jjCheckNAdd(2);
+ break;
+ case 3:
+ if (kind > 19)
+ kind = 19;
+ jjCheckNAdd(3);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else if (curChar < 128) {
+ long l = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 4:
+ if ((0xdfffffffffffffffL & l) != 0L) {
+ if (kind > 19)
+ kind = 19;
+ jjCheckNAdd(3);
+ } else if (curChar == 125) {
+ if (kind > 20)
+ kind = 20;
+ }
+ break;
+ case 3:
+ if ((0xdfffffffffffffffL & l) == 0L)
+ break;
+ kind = 19;
+ jjCheckNAdd(3);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else {
+ int i2 = (curChar & 0xff) >> 6;
+ long l2 = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 4:
+ case 3:
+ if ((jjbitVec0[i2] & l2) == 0L)
+ break;
+ if (kind > 19)
+ kind = 19;
+ jjCheckNAdd(3);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ }
+ if (kind != 0x7fffffff) {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return curPos;
+ }
+ }
+ }
+
+ static final int[] jjnextStates = {
+ 6, 11, 7, 8, 10, 14, 16, 6, 7, 26, 27, 29, 30, 33, 34, 35,
+ 38, 39, 40, 43, 44, 46, 47, 14, 19, 15, 16, 18, 22, 24, 29, 30,
+ 33, 34, 35, 38, 39, 40, 43, 44, 46, 47, 41, 43, 44, 46, 47, 4,
+ 5, 48, 49,
+ };
+ public static final String[] jjstrLiteralImages = {
+ "", null, null, null, null, null, null, null, null, null, null, null, null,
+ "\72", "\72", "\73", "\173", "\175", null, null, null, null, null, null, null, null,
+ null, null, "\54", "\52", "\43", "\56", "\133", "\135", "\75",};
+ public static final String[] lexStateNames = {
+ "DEFAULT",
+ "IN_RULE",
+ "JAVA_CODE_RULE",
+ "IN_PSEUDOCLASS",
+ };
+ public static final int[] jjnewLexState = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, -1, -1, 1, 0, 2, -1, 1, 0, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ };
+ static final long[] jjtoToken = {
+ 0x7fefff281L,
+ };
+ static final long[] jjtoSkip = {
+ 0x7eL,
+ };
+ protected SimpleCharStream input_stream;
+ private final int[] jjrounds = new int[50];
+ private final int[] jjstateSet = new int[100];
+ protected char curChar;
+
+ public CSSParserTokenManager(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 CSSParserTokenManager(SimpleCharStream stream, int lexState) {
+ this(stream);
+ SwitchTo(lexState);
+ }
+
+ public void ReInit(SimpleCharStream stream) {
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+ }
+
+ private void ReInitRounds() {
+ int i;
+ jjround = 0x80000001;
+ for (i = 50; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+ }
+
+ public void ReInit(SimpleCharStream stream, int lexState) {
+ ReInit(stream);
+ SwitchTo(lexState);
+ }
+
+ public void SwitchTo(int lexState) {
+ if (lexState >= 4 || 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;
+ }
+
+ switch (curLexState) {
+ case 0:
+ try {
+ input_stream.backup(0);
+ while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) {
+ continue EOFLoop;
+ }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ break;
+ case 1:
+ try {
+ input_stream.backup(0);
+ while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
+ curChar = input_stream.BeginToken();
+ }
+ catch (java.io.IOException e1) {
+ continue EOFLoop;
+ }
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_1();
+ break;
+ case 2:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_2();
+ break;
+ case 3:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_3();
+ break;
+ }
+ if (jjmatchedKind != 0x7fffffff) {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
+ matchedToken = jjFillToken();
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ return matchedToken;
+ } else {
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ 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);
+ }
+ }
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,40 @@
+/* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */
+
+package jaxx.compiler.css.parser;
+
+public interface CSSParserTreeConstants {
+ public int JJTSTYLESHEET = 0;
+ public int JJTRULE = 1;
+ public int JJTSELECTORS = 2;
+ public int JJTSELECTOR = 3;
+ public int JJTJAVACLASS = 4;
+ public int JJTID = 5;
+ public int JJTCLASS = 6;
+ public int JJTPSEUDOCLASS = 7;
+ public int JJTANIMATIONPROPERTIES = 8;
+ public int JJTANIMATIONPROPERTY = 9;
+ public int JJTDECLARATION = 10;
+ public int JJTPROPERTY = 11;
+ public int JJTEXPRESSION = 12;
+ public int JJTJAVACODE = 13;
+ public int JJTIDENTIFIER = 14;
+
+
+ public String[] jjtNodeName = {
+ "Stylesheet",
+ "Rule",
+ "Selectors",
+ "Selector",
+ "JavaClass",
+ "Id",
+ "Class",
+ "PseudoClass",
+ "AnimationProperties",
+ "AnimationProperty",
+ "Declaration",
+ "Property",
+ "Expression",
+ "JavaCode",
+ "Identifier",
+ };
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,123 @@
+/* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */
+
+package jaxx.compiler.css.parser;
+
+class JJTCSSParserState {
+ private java.util.Stack<Node> nodes;
+ private java.util.Stack<Integer> marks;
+
+ private int sp; // number of nodes on stack
+ private int mk; // current mark
+ private boolean node_created;
+
+ JJTCSSParserState() {
+ nodes = new java.util.Stack<Node>();
+ marks = new java.util.Stack<Integer>();
+ 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 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 = marks.pop();
+ }
+ return nodes.pop();
+ }
+
+ /* Returns the node currently on the top of the stack. */
+ Node peekNode() {
+ return 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 = marks.pop();
+ }
+
+
+ void openNodeScope(Node n) {
+ marks.push(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 = marks.pop();
+ 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 = marks.pop();
+ while (a-- > 0) {
+ Node c = popNode();
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, a);
+ }
+ n.jjtClose();
+ pushNode(n);
+ node_created = true;
+ } else {
+ mk = marks.pop();
+ node_created = false;
+ }
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,51 @@
+/* Generated By:JJTree: Do not edit this line. Node.java */
+
+package jaxx.compiler.css.parser;
+
+/* 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.
+ *
+ * @param n node
+ */
+ public void jjtSetParent(Node n);
+
+ public Node jjtGetParent();
+
+ /**
+ * This method tells the node to add its argument to the node's
+ * list of children.
+ *
+ * @param n node
+ * @param i pos
+ */
+ public void jjtAddChild(Node n, int i);
+
+ /**
+ * @param i pos
+ * @return 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();
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,20 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
+package jaxx.compiler.css.parser;
+
+public class ParseException extends jaxx.compiler.java.parser.ParseException {
+ private static final long serialVersionUID = 229575674880359031L;
+
+ public ParseException() {
+ super();
+ }
+
+
+ public ParseException(String message) {
+ super(message);
+ }
+
+
+ public ParseException(String message, int line, int column) {
+ super(message, line, column);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,398 @@
+/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */
+package jaxx.compiler.css.parser;
+
+/**
+ * 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;
+ }
+ 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);
+ }
+
+ /**
+ * @return ???
+ * @see #getEndColumn
+ * @deprecated
+ */
+
+ public int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @return ???
+ * @see #getEndLine
+ * @deprecated
+ */
+
+ 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.
+ *
+ * @param newLine ?
+ * @param newCol ?
+ */
+ 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;
+ int nextColDiff, 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];
+ }
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,122 @@
+/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
+
+package jaxx.compiler.css.parser;
+
+public class SimpleNode implements Node {
+ protected Node parent;
+ protected Node[] children;
+ protected int id;
+ protected CSSParser parser;
+ public Token firstToken;
+ public Token lastToken;
+
+
+ public SimpleNode(int i) {
+ id = i;
+ }
+
+ public SimpleNode(CSSParser p, int i) {
+ this(i);
+ parser = p;
+ }
+
+
+ public int getId() {
+ return id;
+ }
+
+ public void jjtOpen() {
+ }
+
+ public void jjtClose() {
+ }
+
+ public void jjtSetParent(Node n) {
+ parent = n;
+ }
+
+ public Node jjtGetParent() {
+ return parent;
+ }
+
+ public SimpleNode getParent() {
+ return (SimpleNode) parent;
+ }
+
+ public void jjtAddChild(Node n, int i) {
+ if (children == null) {
+ children = new Node[i + 1];
+ } else if (i >= children.length) {
+ Node c[] = new Node[i + 1];
+ System.arraycopy(children, 0, c, 0, children.length);
+ children = c;
+ }
+ children[i] = n;
+ }
+
+ public Node jjtGetChild(int i) {
+ return children[i];
+ }
+
+ public SimpleNode getChild(int i) {
+ return (SimpleNode) children[i];
+ }
+
+ public int jjtGetNumChildren() {
+ return (children == null) ? 0 : children.length;
+ }
+
+ /* You can override these two methods in subclasses of SimpleNode to
+customize the way the node appears when the tree is dumped. If
+your output uses more than one line you should override
+toString(String), otherwise overriding toString() is probably all
+you need to do. */
+
+ @Override
+ public String toString() {
+ return getClass().getName() + "[" + getText() + "]";
+ }
+
+ public String toString(String prefix) {
+ return prefix + toString();
+ }
+
+ /* Override this method if you want to customize how the node dumps
+ out its children. */
+
+ public void dump(String prefix) {
+ System.out.println(toString(prefix));
+ if (children != null) {
+ for (Node aChildren : children) {
+ SimpleNode n = (SimpleNode) aChildren;
+ if (n != null) {
+ n.dump(prefix + " ");
+ }
+ }
+ }
+ }
+
+ private void appendSpecialTokens(StringBuffer s, Token st) {
+ if (st != null) {
+ appendSpecialTokens(s, st.specialToken);
+ s.append(st.image);
+ }
+ }
+
+
+ /** @return the text of the tokens comprising this node. */
+ public String getText() {
+ StringBuffer text = new StringBuffer();
+ Token t = firstToken;
+ while (t != null) {
+ appendSpecialTokens(text, t.specialToken);
+ text.append(t.image);
+ if (t == lastToken)
+ break;
+ t = t.next;
+ }
+
+ return text.toString();
+ }
+}
+
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,76 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+package jaxx.compiler.css.parser;
+
+/** Describes the input token stream. */
+
+public class Token {
+
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /** The string image of the token. */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /** Returns the image. */
+ public String toString() {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ * <p/>
+ * case MyParserConstants.ID : return new IDToken();
+ * <p/>
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ *
+ * @param ofKind kind of token
+ * @return the new token
+ */
+ public static Token newToken(int ofKind) {
+ switch (ofKind) {
+ default:
+ return new Token();
+ }
+ }
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,126 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+package jaxx.compiler.css.parser;
+
+public class TokenMgrError extends Error {
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /** Lexical error occured. */
+ static final int LEXICAL_ERROR = 0;
+
+ /** An attempt wass made to create a second instance of a static token manager. */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /** Tried to change to an invalid lexical state. */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /** Detected (and bailed out of) an infinite loop in the token manager. */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+ private static final long serialVersionUID = -4308847190164230336L;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ *
+ * @param str text to espace
+ * @return the espaced text
+ */
+ protected static String addEscapes(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").append(s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * @param EOFSeen : indicates if EOF caused the lexicl error
+ * @param lexState : lexical state in which this error occured
+ * @param errorLine : line number when the error occured
+ * @param errorColumn : column number when the error occured
+ * @param errorAfter : prefix that was seen before this error occured
+ * @param curChar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ * @return a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return ("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ * <p/>
+ * "Internal Error : Please file a bug report .... "
+ * <p/>
+ * from this method for such cases in the release version of your parser.
+ */
+ @Override
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -3,7 +3,7 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompiledObject.ChildRef;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.io.JavaFile;
+import jaxx.compiler.java.JavaFile;
import jaxx.runtime.SwingUtil;
/**
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,28 +0,0 @@
-package jaxx.compiler.decorators;
-
-import jaxx.compiler.CompiledObject;
-import jaxx.compiler.CompilerException;
-import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.io.JavaFile;
-
-/**
- *
- * Contract of compiled object decorator at generation time.
- *
- * Note : The implementation of this class must be stateless.
- *
- * @author tony
- * @since 1.2
- */
-public interface CompiledObjectDecorator {
-
- String getName();
-
- String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings);
-
- boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall);
-
- void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName);
-
- String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException;
-}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,12 +1,12 @@
package jaxx.compiler.decorators;
import jaxx.compiler.CompiledObject;
+import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.io.JavaField;
-import jaxx.compiler.io.JavaFile;
-import jaxx.compiler.io.JavaMethod;
-import jaxx.compiler.ScriptInitializer;
+import jaxx.compiler.java.JavaFile;
+import jaxx.compiler.java.JavaFileGenerator;
+import jaxx.compiler.script.ScriptInitializer;
import java.lang.reflect.Modifier;
import java.util.Map.Entry;
@@ -31,16 +31,16 @@
String id = object.getId();
int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED;
if (object == root) {
- javaFile.addField(new JavaField(access, className, id, false, "this"));
+ javaFile.addSimpleField(JavaFileGenerator.newField(access, className, id, false, "this"));
// javaFile.addField(new JavaField(access, fullClassName, id, false, "this"));
} else {
//TC -20081017 can have generic on compiled Object
- javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id, object.isOverride()), object.isJavaBean());
+ javaFile.addField(JavaFileGenerator.newField(access, JAXXCompiler.getCanonicalName(object), id, object.isOverride()), object.isJavaBean());
}
}
if (!compiler.inlineCreation(object) && object != root) {
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object), object.isOverride()));
+ javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object), object.isOverride()));
}
}
@@ -49,68 +49,68 @@
if (object instanceof ScriptInitializer) {
return object.getInitializationCode(compiler);
}
+ String eol = JAXXCompiler.getLineSeparator();
StringBuffer result = new StringBuffer();
- String eol = JAXXCompiler.getLineSeparator();
+ if (compiler.getRootObject() == object || compiler.inlineCreation(object)) {
+ result.append("// inline creation of " + object.getId());
+ }
if (object.isOverride() && object.getOverrideType() == object.getObjectClass()) {
//TC-20090309 on utilise le super code quand l'objet est de meme type
result.append("super.").append(object.getCreationMethodName()).append("();");
} else {
String init = object.getId() + " = ";
-// result.append(object.getId());
-// result.append(" = ");
if (object.isJavaBean() && object.getJavaBeanInitCode() != null) {
init += object.getJavaBeanInitCode();
-// result.append(object.getJavaBeanInitCode()).append(";");
} else {
+ //TC - 20081017 compiledObject can have generics
+ String canonicalName = JAXXCompiler.getCanonicalName(object);
+ init += "new " + canonicalName + "(";
String constructorParams = object.getConstructorParams();
- String canonicalName = JAXXCompiler.getCanonicalName(object);
if (constructorParams != null) {
- //TC - 20081017 compiledObject can have generics
- init += "new " + canonicalName + "(" + constructorParams + ")";
-// result.append(" new ").append(canonicalName).append("(").append(constructorParams).append(");");
- } else {
- //TC - 20081017 compiledObject can have generics
- init += "new " + canonicalName + "()";
-// result.append("new ").append(canonicalName).append("();");
+ init += constructorParams;
}
+ init += ")";
}
result.append(eol);
result.append("$objectMap.put(").append(compiler.getJavaCode(object.getId())).append(", ").append(init).append(");");
-// result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");");
}
result.append(eol);
String initCode = object.getInitializationCode(compiler);
if (initCode != null && initCode.length() > 0) {
result.append(initCode);
}
-
+ //TC-20091025 generate client properties at creation time (not at setup time)
+ // in some case can save to create a setup method (when there is only client properties
+ // to store)
+ addClientProperties(object);
return result.toString();
}
@Override
public String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings) {
StringBuffer code = new StringBuffer();
- //TC-20090327 generate client properties
- if (object.hasClientProperties()) {
- // generate putClientProperty invocations
- for (Entry<String, String> entry : object.getClientProperties().entrySet()) {
- object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");");
- }
-
- }
String eol = JAXXCompiler.getLineSeparator();
- //TC - 20081017 only generate the method if not empty ?
+ //TC-20091025 generate client properties at creation time (not at setup time)
+ // in some case can save to create a setup method (when there is only client properties
+ // to store)
+// addClientProperties(object);
+ //TC-20091025 only generate the code if not empty
if (object.getId().startsWith("$")) {
- code.append(object.getAdditionCode()).append(eol);
+ String additionCode = object.getAdditionCode();
+ if (!additionCode.isEmpty()) {
+ code.append("// inline complete setup of " + object.getId()).append(eol);
+ code.append(additionCode);
+ }
} else {
String additionCode = object.getAdditionCode();
if (additionCode.length() > 0) {
code.append(object.getAdditionMethodName()).append("();").append(eol);
additionCode = "if (!allComponentsCreated) {" + eol + " return;" + eol + "}" + eol + additionCode;
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode, false));
+ javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode, false));
}
}
- return code.toString();
+ String result = code.toString();
+ return result;
}
@Override
@@ -119,7 +119,12 @@
if (object == root) {
String rootCode = root.getInitializationCode(compiler);
if (rootCode != null && rootCode.length() > 0) {
+ code.append("// inline creation of " + object.getId()).append(eol);
code.append(rootCode);
+ //TC-20091025 generate client properties at creation time (not at setup time)
+ // in some case can save to create a setup method (when there is only client properties
+ // to store)
+ addClientProperties(object);
code.append(eol);
}
} else {
@@ -127,10 +132,8 @@
if (compiler.inlineCreation(object)) {
if (lastWasMethodCall) {
lastWasMethodCall = false;
- code.append(eol);
}
code.append(getCreationCode(compiler, object));
- code.append(eol);
} else {
code.append(object.getCreationMethodName()).append("();");
code.append(eol);
@@ -140,4 +143,14 @@
}
return lastWasMethodCall;
}
+
+ protected void addClientProperties(CompiledObject object) {
+ //TC-20090327 generate client properties
+ if (object.hasClientProperties()) {
+ // generate putClientProperty invocations
+ for (Entry<String, String> entry : object.getClientProperties().entrySet()) {
+ object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");");
+ }
+ }
+ }
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -3,9 +3,9 @@
import jaxx.compiler.CompiledObject;
import jaxx.compiler.CompilerConfiguration;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.io.JavaArgument;
-import jaxx.compiler.io.JavaFile;
-import jaxx.compiler.io.JavaMethod;
+import jaxx.compiler.java.JavaArgument;
+import jaxx.compiler.java.JavaFile;
+import jaxx.compiler.java.JavaFileGenerator;
import java.lang.reflect.Modifier;
import java.util.Iterator;
@@ -54,14 +54,14 @@
String helpBrokerFQN = getBrokerFQN(compiler);
javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">");
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "registerHelpId",
- "broker.installUI(component, helpId);",true,
+ javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PUBLIC, "void", "registerHelpId",
+ "broker.installUI(component, helpId);", true,
new JavaArgument(helpBrokerFQN, "broker"),
new JavaArgument("Component", "component"),
new JavaArgument("String", "helpId")));
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "showHelp",
- "getBroker().showHelp(this, helpId);",true,
+ javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PUBLIC, "void", "showHelp",
+ "getBroker().showHelp(this, helpId);", true,
new JavaArgument("String", "helpId")));
StringBuilder buffer = new StringBuilder();
@@ -93,6 +93,7 @@
buffer.append(eol);
// add the calls
+ compiler.appendLateInitializer("// help broker setup" + eol);
compiler.appendLateInitializer(extraCode.toString());
compiler.appendLateInitializer(buffer.toString());
}
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaArgument.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,56 @@
+package jaxx.compiler.java;
+
+/**
+ * Represents an argument to a <code>JavaMethod</code>.
+ *
+ * @see JavaMethod
+ */
+public class JavaArgument extends JavaElement {
+
+ private String type;
+ private boolean isFinal;
+
+ /**
+ * Creates a new <code>JavaArgument</code> with the specified name and type. For example, the method <code>main()</code>
+ * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>.
+ *
+ * @param type the argument's type, as it would appear in Java source code
+ * @param name the argument's name
+ */
+ public JavaArgument(String type, String name) {
+ this(type, name, false);
+ }
+
+ /**
+ * Creates a new <code>JavaArgument</code> with the specified name, type, and finality. For example, the method <code>main()</code>
+ * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. The
+ * <code>isFinal</code> parameter allows the presence of the <code>final</code> keyword on the argument to be controlled.
+ *
+ * @param type the argument's type, as it would appear in Java source code
+ * @param name the argument's name
+ * @param isFinal <code>true</code> if the argument should be marked final
+ */
+ public JavaArgument(String type, String name, boolean isFinal) {
+ super(0, name);
+ this.type = type;
+ this.isFinal = isFinal;
+ }
+
+ /**
+ * Returns the argument's type as it would be represented in Java source code.
+ *
+ * @return the argument's type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Returns <code>true</code> if the <code>final</code> keyword should appear before the argument.
+ *
+ * @return <code>true</code> if the argument is final
+ */
+ public boolean isFinal() {
+ return isFinal;
+ }
+}
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaElement.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,77 @@
+package jaxx.compiler.java;
+
+import java.lang.reflect.Modifier;
+
+/**
+ * Base Java element
+ * @author chemit
+ * @since 2.0.0
+ */
+public abstract class JavaElement {
+
+// private String lineSeparator;
+ private String name;
+ private int modifiers;
+
+ public JavaElement(int modifiers, String name) {
+ this.modifiers = modifiers;
+ this.name = name;
+ }
+
+ public final int getModifiers() {
+ return modifiers;
+ }
+
+ public final void setModifiers(int modifiers) {
+ this.modifiers = modifiers;
+ }
+
+ public final String getName() {
+ return name;
+ }
+
+ public final void setName(String className) {
+ this.name = className;
+ }
+
+ public final String getModifiersText() {
+ if (modifiers == 0) {
+ return "";
+ } else {
+ return Modifier.toString(modifiers) + ' ';
+ }
+ }
+
+// public final String getLineSeparator() {
+// if (lineSeparator == null) {
+// lineSeparator = JAXXCompiler.getLineSeparator();
+// }
+// return lineSeparator;
+// }
+//
+// public static String addIndentation(String source, int indentation, String lineSeparator) {
+// return indent(source, indentation, false, lineSeparator);
+// }
+//
+// public static String setIndentation(String source, int indentation, String lineSeparator) {
+// return indent(source, indentation, true, lineSeparator);
+// }
+//
+// public static String indent(String source, int indentation, boolean trim, String lineSeparator) {
+// if (trim) {
+// source = source.trim();
+// }
+// char[] spaces = new char[indentation];
+// Arrays.fill(spaces, ' ');
+// StringBuffer result = new StringBuffer();
+// String[] lines = source.split(System.getProperty("line.separator") + "|\n");
+// for (int i = 0; i < lines.length; i++) {
+// if (i > 0) {
+// result.append(lineSeparator);
+// }
+// result.append(spaces);
+// result.append(trim ? lines[i].trim() : lines[i]);
+// }
+// return result.toString();
+// }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaField.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,154 @@
+package jaxx.compiler.java;
+
+import java.lang.reflect.Modifier;
+import java.util.Comparator;
+
+/**
+ * Represents a field in a Java source file being generated for output. <code>JavaFields</code> are created
+ * and added to a {@link JavaFile}, which can then output Java source code.
+ */
+public class JavaField extends JavaElement implements Comparable<JavaField> {
+
+ /**
+ * Field comparator
+ */
+ static final JavaFieldComparator COMPARATOR = new JavaFieldComparator();
+ /**
+ * type of field (fqn)
+ */
+ private String type;
+ /**
+ * initializer of field (can be null)
+ */
+ private String initializer;
+ /**
+ * flag to known where a field overrides a super-field
+ */
+ private boolean override;
+
+ /**
+ * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the
+ * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be
+ * represented as it would appear in Java source code.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the field's declaration
+ * @param type the type of the field as it would appear in Java source code
+ * @param name the field's name
+ * @param override
+ */
+ public JavaField(int modifiers, String type, String name, boolean override) {
+ this(modifiers, type, name, override, null);
+ }
+
+ /**
+ * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the
+ * constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be
+ * represented as it would appear in Java source code. The <code>initializer</code> is the initial
+ * value of the field as it would appear in Java source code, or <code>null</code> to leave it at the
+ * default value.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the field's declaration
+ * @param type the type of the field as it would appear in Java source code
+ * @param name the field's name
+ * @param override
+ * @param initializer the initial value of the field, as it would appear in Java source code
+ */
+ public JavaField(int modifiers, String type, String name, boolean override, String initializer) {
+ super(modifiers, name);
+ this.type = type;
+ this.initializer = initializer;
+ this.override = override;
+ }
+
+ /**
+ * Returns the field's type, as it would be represented in Java source code.
+ *
+ * @return the field's type
+ */
+ public String getType() {
+ return type;
+ }
+
+ public boolean isOverride() {
+ return override;
+ }
+
+ public void setOverride(boolean override) {
+ this.override = override;
+ }
+
+ public String getInitializer() {
+ return initializer;
+ }
+
+ @Override
+ public int compareTo(JavaField o) {
+ return COMPARATOR.compare(this, o);
+ }
+
+ static class JavaFieldComparator implements Comparator<JavaField> {
+
+ @Override
+ public int compare(JavaField o1, JavaField o2) {
+ int result;
+ if ((result = compareStatic(o1, o2)) != 0) {
+ return result;
+ }
+ // data sources must be on the last after all other fields
+ if ((result = compareDataSource(o1, o2)) != 0) {
+ return result;
+ }
+ // same static
+ if ((result = compareVisibility(o1, o2)) != 0) {
+ return result;
+ }
+ // same visibility, test name
+ return o1.getName().compareTo(o2.getName());
+ }
+
+ public int compareStatic(JavaField o1, JavaField o2) {
+ // first comparator modifiers : static always before none static
+ if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) {
+ return -1;
+ }
+ if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) {
+ return 1;
+ }
+ return 0;
+ }
+
+ public int compareDataSource(JavaField o1, JavaField o2) {
+ // first comparator modifiers : static always before none static
+ if (o1.getName().startsWith("$DataSource") && !o2.getName().startsWith("$DataSource")) {
+ return 1;
+ }
+ if (!o1.getName().startsWith("$DataSource") && o2.getName().startsWith("$DataSource")) {
+ return -1;
+ }
+ return 0;
+ }
+
+ public int compareVisibility(JavaField o1, JavaField o2) {
+ // first comparator modifiers : static always before none static
+ if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) {
+ return 1;
+ }
+ if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) {
+ return -1;
+ }
+ if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) {
+ return -1;
+ }
+ if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) {
+ return 1;
+ }
+ if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) {
+ return -1;
+ }
+ if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) {
+ return 1;
+ }
+ return 0;
+ }
+ }
+}
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFile.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,181 @@
+package jaxx.compiler.java;
+
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A Java source file being generated for output. Once the class is completely initialized, use the
+ * {@link #toString} method to generate source code for it.
+ */
+public class JavaFile extends JavaElement {
+
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(JavaFile.class);
+ protected static final String GETTER_PATTERN = "return %1$s;";
+ protected static final String BOOLEAN_GETTER_PATTERN = "return %1$s !=null && %1$s;";
+ protected static final String SETTER_PATTERN = "%1$s oldValue = this.%2$s;\nthis.%2$s = newValue;\nfirePropertyChange(\"%2$s\", oldValue, newValue);";
+ private List<String> imports = new ArrayList<String>();
+ private List<JavaField> fields = new ArrayList<JavaField>();
+ private List<JavaMethod> methods = new ArrayList<JavaMethod>();
+ private List<JavaFile> innerClasses = new ArrayList<JavaFile>();
+ private String superClass;
+ private List<String> interfaces;
+ private StringBuffer rawBodyCode = new StringBuffer();
+ private boolean superclassIsJAXXObject;
+ private boolean abstractClass;
+ private String genericType;
+ private String superGenericType;
+
+ public JavaFile() {
+ super(0, "");
+ }
+
+ public JavaFile(int modifiers, String className, String superClass) {
+ this(modifiers, className, superClass, null);
+ }
+
+ public JavaFile(int modifiers, String className, String superClass, List<String> interfaces) {
+ super(modifiers, className);
+ this.superClass = superClass;
+ this.interfaces = interfaces;
+ }
+
+ public void addImport(String importString) {
+ imports.add(importString);
+ }
+
+ public void addImport(Class<?> importString) {
+ imports.add(importString.getName());
+ }
+
+ public String[] getImports() {
+ return imports.toArray(new String[imports.size()]);
+ }
+
+ public String getSuperClass() {
+ return superClass;
+ }
+
+ public void setSuperClass(String superClass) {
+ this.superClass = superClass;
+ }
+
+ public List<String> getInterfaces() {
+ if (interfaces == null) {
+ interfaces = new ArrayList<String>();
+ }
+ return interfaces;
+ }
+
+ public void setInterfaces(List<String> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public void setGenericType(String genericType) {
+ this.genericType = genericType;
+ }
+
+ public void addMethod(JavaMethod method) {
+ methods.add(method);
+ }
+
+ public List<JavaMethod> getMethods() {
+ return methods;
+ }
+
+ public void addField(JavaField field) {
+ addField(field, false);
+ }
+
+ public void addField(JavaField field, boolean javaBean) {
+ addSimpleField(field);
+ String id = field.getName();
+ String capitalizedName = org.apache.commons.lang.StringUtils.capitalize(id);
+ // add getter file
+ String content = String.format(GETTER_PATTERN, id);
+ addMethod(new JavaMethod(
+ Modifier.isProtected(field.getModifiers()) ? Modifier.PUBLIC : Modifier.PROTECTED,
+ field.getType(), "get" + capitalizedName, null, null, content, field.isOverride()));
+
+ if (javaBean) {
+ // add full javabean support
+ if (Boolean.class.getName().equals(field.getType())) {
+ content = String.format(BOOLEAN_GETTER_PATTERN, id);
+ addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(), "is" + capitalizedName, null, null, content, field.isOverride()));
+ }
+ content = String.format(SETTER_PATTERN, field.getType(), id);
+ JavaArgument arg = new JavaArgument(field.getType(), "newValue");
+ addMethod(new JavaMethod(Modifier.PUBLIC, "void", "set" + capitalizedName, new JavaArgument[]{arg}, null, content, field.isOverride()));
+ }
+ }
+
+ public void addSimpleField(JavaField field) {
+ fields.add(field);
+ }
+
+ public List<JavaField> getFields() {
+ return fields;
+ }
+
+ public void addBodyCode(String bodyCode) {
+ rawBodyCode.append(bodyCode);
+ }
+
+ public boolean isAbstractClass() {
+ return abstractClass;
+ }
+
+ public String getGenericType() {
+ return genericType;
+ }
+
+ public List<JavaFile> getInnerClasses() {
+ return innerClasses;
+ }
+
+ public StringBuffer getRawBodyCode() {
+ return rawBodyCode;
+ }
+
+ public String getSuperGenericType() {
+ return superGenericType;
+ }
+
+ public void addInterface(String canonicalName) {
+ if (interfaces == null || !interfaces.contains(canonicalName)) {
+ getInterfaces().add(canonicalName);
+ }
+ }
+
+ public void addInterfaces(String[] canonicalNames) {
+ if (canonicalNames == null) {
+ return;
+ }
+ for (String canonicalName : canonicalNames) {
+ if (interfaces == null || !interfaces.contains(canonicalName)) {
+ getInterfaces().add(canonicalName);
+ }
+ }
+ }
+
+ public boolean isSuperclassIsJAXXObject() {
+ return superclassIsJAXXObject;
+ }
+
+ public void setSuperclassIsJAXXObject(boolean superclassIsJAXXObject) {
+ this.superclassIsJAXXObject = superclassIsJAXXObject;
+ }
+
+ public void setAbstractClass(boolean abstractClass) {
+ this.abstractClass = abstractClass;
+ }
+
+ public void setSuperGenericType(String superGenericType) {
+ this.superGenericType = superGenericType;
+ }
+}
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,265 @@
+package jaxx.compiler.java;
+
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map.Entry;
+import jaxx.compiler.java.JavaMethod.MethodOrder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Java file generator.
+ *
+ * @author chemit
+ * @since 2.0.0
+ */
+public class JavaFileGenerator {
+
+ /**
+ * Logger
+ */
+ static private final Log log = LogFactory.getLog(JavaFileGenerator.class);
+
+ public static JavaField newField(int modifiers, String returnType, String name, boolean override) {
+ return newField(modifiers, returnType, name, override, null);
+ }
+
+ public static JavaField newField(int modifiers, String returnType, String name, boolean override, String initializer) {
+ return new JavaField(modifiers, returnType, name, override, initializer);
+ }
+
+ public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, String[] exceptions, JavaArgument... arguments) {
+ return new JavaMethod(modifiers, returnType, name, arguments, exceptions, initializer, override);
+ }
+
+ public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, JavaArgument... arguments) {
+ return newMethod(modifiers, returnType, name, initializer, override, new String[0], arguments);
+ }
+ /**
+ * End of line
+ */
+ protected final String eol;
+ /**
+ * verbose flag when generates
+ */
+ protected final boolean verbose;
+ /**
+ * current prefix indent size
+ */
+ protected int indentationLevel = 0;
+
+ public JavaFileGenerator(String eol, boolean verbose) {
+ this.eol = eol;
+ this.verbose = verbose && log.isDebugEnabled();
+ }
+
+ public String generateImport(String anImport) {
+ return "import " + anImport + ';' + eol;
+ }
+
+ public void generateFile(JavaFile f, PrintWriter result) {
+ if (verbose) {
+ log.info(f.getName());
+ }
+ indentationLevel = 0;
+ if (f.getName().indexOf(".") != -1) {
+ result.append("package ").append(f.getName().substring(0, f.getName().lastIndexOf("."))).append(";");
+ result.append(eol).append(eol);
+ }
+ String[] imports = f.getImports();
+
+ if (imports.length > 0) {
+ for (String anImport : imports) {
+ result.append(generateImport(anImport));
+ }
+ result.append(eol);
+ }
+ result.append(generateClass(f));
+ }
+
+ public String generateClass(JavaFile f) {
+
+ if (verbose) {
+ log.info(f.getName());
+ }
+ StringBuffer result = new StringBuffer();
+ String genericType = f.getGenericType();
+
+ result.append(f.getModifiersText());
+ if (f.isAbstractClass()) {
+ result.append("abstract ");
+ }
+ result.append("class ");
+ result.append(f.getName().substring(f.getName().lastIndexOf(".") + 1));
+ if (genericType != null) {
+ result.append('<').append(genericType).append('>');
+ }
+ result.append(" extends ");
+ result.append(f.getSuperClass());
+ if (f.getSuperGenericType() != null) {
+ result.append('<').append(f.getSuperGenericType()).append('>');
+ }
+ List<String> interfaces = f.getInterfaces();
+
+ if (interfaces != null && !interfaces.isEmpty()) {
+ result.append(" implements ").append(interfaces.get(0));
+ for (int i = 1; i < interfaces.size(); i++) {
+ result.append(", ").append(interfaces.get(i));
+ }
+ }
+ result.append(" {").append(eol);
+
+ // generate fields
+
+ List<JavaField> fields = f.getFields();
+
+ if (!fields.isEmpty()) {
+ java.util.Collections.sort(fields); // sort fields
+
+ for (JavaField field : fields) {
+ if (log.isDebugEnabled()) {
+ log.debug("generate field " + field);
+ }
+ String txt = generateField(field);
+ result.append(addIndentation(txt, 4, eol)).append(eol);
+ }
+ result.append(eol);
+ }
+
+ // generate raw body
+
+ StringBuffer rawBodyCode = f.getRawBodyCode();
+
+ if (rawBodyCode.length() > 0) {
+ result.append(addIndentation("/* begin raw body code */\n", 4, eol));
+ String s = rawBodyCode.toString();
+ if (!s.startsWith(eol)) {
+ result.append(eol);
+ }
+ result.append(addIndentation(s, 4, eol)).append(eol);
+ result.append(addIndentation("/* end raw body code */", 4, eol));
+ result.append(eol);
+ }
+
+ // generate inner classes
+
+ List<JavaFile> innerClasses = f.getInnerClasses();
+ for (JavaFile innerClass : innerClasses) {
+ indentationLevel += 4;
+ try {
+ String txt = generateClass(innerClass);
+ result.append(addIndentation(txt, 4, eol));
+ result.append(eol).append(eol);
+ } finally {
+ indentationLevel -= 4;
+ }
+ }
+
+ // generate methods
+
+ EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(f.getMethods());
+ for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) {
+ List<JavaMethod> list = entry.getValue();
+ if (!list.isEmpty()) {
+ result.append(addIndentation(entry.getKey().getHeader(), 4, eol));
+ result.append(eol).append(eol);
+ for (JavaMethod method : list) {
+ String txt = generateMethod(method);
+ result.append(addIndentation(txt, 4, eol));
+ result.append(eol).append(eol);
+ }
+ }
+ list.clear();
+ }
+ map.clear();
+ result.append("}");
+ return result.toString();
+
+ }
+
+ public String generateField(JavaField f) {
+ if (verbose) {
+ log.info(f.getName());
+ }
+ StringBuffer result = new StringBuffer();
+ result.append(f.getModifiersText());
+ result.append(f.getType()).append(' ').append(f.getName());
+ if (f.getInitializer() != null) {
+ result.append(" = ").append(f.getInitializer());
+ }
+ result.append(';').append(eol);
+ return result.toString();
+ }
+
+ public String generateMethod(JavaMethod m) {
+ if (verbose) {
+ log.info(m.getName());
+ }
+
+ StringBuffer result = new StringBuffer();
+ if (m.isOverride()) {
+ result.append("@Override").append(eol);
+ }
+ result.append(m.getModifiersText());
+ if (m.getReturnType() != null) {
+ result.append(m.getReturnType());
+ result.append(' ');
+ }
+ result.append(m.getName());
+ result.append('(');
+ JavaArgument[] arguments = m.getArguments();
+
+ if (arguments != null && arguments.length > 0) {
+ result.append(generateArgument(arguments[0]));
+ for (int i = 1; i < arguments.length; i++) {
+ result.append(", ").append(generateArgument(arguments[i]));
+ }
+ }
+ result.append(") {");
+ result.append(eol);
+ String body = m.getBody();
+
+ if (body != null) {
+ String formattedBodyCode = addIndentation(body.trim(), 4, eol);
+ if (formattedBodyCode.length() > 0) {
+ result.append(formattedBodyCode).append(eol);
+ }
+ }
+ result.append("}");
+ return result.toString();
+
+ }
+
+ public String generateArgument(JavaArgument argument) {
+ String result = argument.getType() + ' ' + argument.getName();
+ return argument.isFinal() ? "final " + result : result;
+ }
+
+ public String addIndentation(String source, int indentation, String lineSeparator) {
+ return indent(source, indentationLevel + indentation, false, lineSeparator);
+ }
+
+ public String setIndentation(String source, int indentation, String lineSeparator) {
+ return indent(source, indentationLevel + indentation, true, lineSeparator);
+ }
+
+ public static String indent(String source, int indentation, boolean trim, String lineSeparator) {
+ if (trim) {
+ source = source.trim();
+ }
+ char[] spaces = new char[indentation];
+ Arrays.fill(spaces, ' ');
+ StringBuffer result = new StringBuffer();
+ String[] lines = source.split(lineSeparator + "|\n");
+ for (int i = 0; i < lines.length; i++) {
+ if (i > 0) {
+ result.append(lineSeparator);
+ }
+ result.append(spaces);
+ result.append(trim ? lines[i].trim() : lines[i]);
+ }
+ return result.toString();
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethod.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,375 @@
+package jaxx.compiler.java;
+
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Represents a method in a Java source file being generated for output. <code>JavaMethods</code> are created
+ * and added to a {@link JavaFile}, which can then output Java source code. In addition to normal methods, a
+ * <code>JavaMethod</code> can represent a constructor -- constructors should be named after their containing
+ * classes and have a return type of <code>null</code>.
+ */
+public class JavaMethod extends JavaElement implements Comparable<JavaMethod> {
+
+ /**
+ * Method comparator
+ */
+ static final JavaMethodComparator COMPARATOR = new JavaMethodComparator();
+ /**
+ * return type of the method (null for constructors)
+ */
+ private String returnType;
+ /**
+ * arguments of the method (can be empty)
+ */
+ private JavaArgument[] arguments;
+ /**
+ * exceptions thrown by the method( can be empty)
+ */
+ private String[] exceptions;
+ /**
+ * body of the mehotd (can be empty)
+ */
+ private String body;
+ /**
+ * flag to known if the method overrids a super-method
+ */
+ private boolean override;
+
+ /**
+ * Constructs a new <code>JavaMethod</code> containing the specified body code. The <code>modifiers</code> parameter
+ * is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and
+ * <code>exceptions</code> of the method should be represented as they would appear in Java source code (<code>null</code>
+ * for a constructor). The method body is initially empty.
+ *
+ * @param modifiers the modifier keywords that should appear as part of the method's declaration
+ * @param returnType the return type of the method as it would appear in Java source code
+ * @param name the method's name
+ * @param arguments the method's arguments
+ * @param exceptions a list of exceptions the methods can throw, as they would be represented in Java source code
+ * @param bodyCode Java source code which should appear in the method body
+ * @param override flag with {@code true} value when the method overrides (or implements) a super class method
+ */
+ public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions, String bodyCode, boolean override) {
+ super(modifiers, name);
+ this.returnType = returnType;
+ this.override = override;
+ this.arguments = arguments;
+ this.exceptions = exceptions;
+ this.body = bodyCode == null ? "" : bodyCode;
+ }
+
+ /**
+ * Returns the method's return type, as it would be represented in Java source code.
+ *
+ * @return the method's return type
+ */
+ public String getReturnType() {
+ return returnType;
+ }
+
+ /**
+ * Returns a list of the method's arguments.
+ *
+ * @return the method's arguments
+ */
+ public JavaArgument[] getArguments() {
+ return arguments;
+ }
+
+ /**
+ * Returns a list of exceptions the method can throw.
+ *
+ * @return the method's exceptions
+ */
+ public String[] getExceptions() {
+ return exceptions;
+ }
+
+ public boolean isOverride() {
+ return override;
+ }
+
+ public void setOverride(boolean override) {
+ this.override = override;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ @Override
+ public int compareTo(JavaMethod o) {
+ return COMPARATOR.compare(this, o);
+ }
+
+ public enum MethodOrder {
+
+ statics(Modifier.STATIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Statics methods --------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ },
+ constructors(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Constructors -----------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return method.returnType == null;
+ }
+ },
+ JAXXObject(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- JAXXObject implementation ----------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ private List<String> methods = Arrays.asList("applyDataBinding", "firePropertyChange", "getObjectById", "get$objectMap", "processDataBinding", "removeDataBinding");
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return methods.contains(method.getName());
+ }
+ },
+ JAXXContext(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- JAXXContext implementation ---------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ private List<String> methods = Arrays.asList("getContextValue", "getDelegateContext", "getParentContainer", "removeContextValue", "setContextValue");
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return methods.contains(method.getName());
+ }
+ },
+ JAXXValidation(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- JAXXValidation implementation ------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ private List<String> methods = Arrays.asList("getValidator", "getValidatorIds");
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return methods.contains(method.getName());
+ }
+ },
+ events(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Event methods ----------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return (method.getName().startsWith("do") && method.getName().indexOf("__") > -1);
+ }
+ },
+ publicGetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- public acessor methods -------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return (method.getName().startsWith("get") || method.getName().startsWith("is"));
+ }
+ },
+ publicSetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- public mutator methods -------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return (method.getName().startsWith("set"));
+ }
+ },
+ otherPublic(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- public mutator methods -------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(int mod) {
+ return super.accept(mod) && !Modifier.isStatic(mod);
+ }
+ },
+ protectedGetters(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- protected acessors methods ---------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return (method.getName().startsWith("get") || method.getName().startsWith("is"));
+ }
+ },
+ createMethod(Modifier.PROTECTED | Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- ui creation methods ----------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(JavaMethod method) {
+ return method.getName().startsWith("create") || method.getName().startsWith("add") ||
+ method.getName().equals("$completeSetup") ||
+ method.getName().equals("$initialize");
+ }
+ },
+ protecteds(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Other protected methods ------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ },
+ packageLocal(0, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Package methods --------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+
+ @Override
+ public boolean accept(int mod) {
+ return !Modifier.isStatic(mod) && !Modifier.isPublic(mod) && !Modifier.isProtected(mod);
+ }
+ },
+ privates(Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" +
+ "/*-- Private methods --------------------------------------------------------------*/\n" +
+ "/*---------------------------------------------------------------------------------*/") {
+ };
+ private final String header;
+ private int modifier;
+
+ MethodOrder(int modifier, String header) {
+ this.header = header;
+ this.modifier = modifier;
+ }
+
+ public String getHeader() {
+ return header;
+ }
+
+ public boolean accept(JavaMethod method) {
+ return true;
+ }
+
+ public boolean accept(int mod) {
+ return (mod & modifier) != 0;
+ }
+
+ public boolean accept(int mod, JavaMethod method) {
+ return accept(mod) && accept(method);
+ }
+
+ public static MethodOrder valueOf(JavaMethod method, int scope) {
+ for (MethodOrder o : values()) {
+ if (o.accept(scope, method)) {
+ return o;
+ }
+ }
+ throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + method);
+ }
+ }
+
+ public static EnumMap<MethodOrder, List<JavaMethod>> getSortedMethods(List<JavaMethod> methods) {
+
+ EnumMap<MethodOrder, List<JavaMethod>> result = new EnumMap<MethodOrder, List<JavaMethod>>(MethodOrder.class);
+ for (MethodOrder methodOrder : MethodOrder.values()) {
+ result.put(methodOrder, new ArrayList<JavaMethod>());
+ }
+
+ EnumSet<MethodOrder> allConstants = EnumSet.allOf(MethodOrder.class);
+ List<JavaMethod> allMethods = new ArrayList<JavaMethod>(methods);
+ int[] scopes = new int[]{Modifier.STATIC, Modifier.PUBLIC, Modifier.PROTECTED, Modifier.PRIVATE};
+ for (int scope : scopes) {
+ EnumSet<MethodOrder> constants = getMethodOrderScope(allConstants, scope);
+
+ Iterator<JavaMethod> itMethods = allMethods.iterator();
+ while (itMethods.hasNext()) {
+ JavaMethod method = itMethods.next();
+ for (MethodOrder constant : constants) {
+ if (constant.accept(method.getModifiers(), method)) {
+ result.get(constant).add(method);
+ itMethods.remove();
+ break;
+ }
+ }
+ }
+ constants.clear();
+ }
+
+ if (!allMethods.isEmpty()) {
+ throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + allMethods);
+ }
+
+ for (MethodOrder methodOrder : MethodOrder.values()) {
+ // sort methods
+ java.util.Collections.sort(result.get(methodOrder));
+ }
+ return result;
+ }
+
+ public static EnumSet<MethodOrder> getMethodOrderScope(EnumSet<MethodOrder> allConstants, int scope) {
+ EnumSet<MethodOrder> constants = EnumSet.noneOf(MethodOrder.class);
+ for (MethodOrder order : allConstants) {
+ if (order.accept(scope)) {
+ constants.add(order);
+ }
+ }
+ return constants;
+ }
+
+ static class JavaMethodComparator implements Comparator<JavaMethod> {
+
+ @Override
+ public int compare(JavaMethod o1, JavaMethod o2) {
+
+ /*int result;
+ if ((result = compareStatic(o1, o2)) != 0) {
+ return result;
+ }
+ if ((result = compareConstructor(o1, o2)) != 0) {
+ return result;
+ }
+ if ((result = compareVisibility(o1, o2)) != 0) {
+ return result;
+ }*/
+ return o1.getName().compareTo(o2.getName());
+ }
+
+ public int compareStatic(JavaMethod o1, JavaMethod o2) {
+ if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) {
+ return -1;
+ }
+ if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) {
+ return 1;
+ }
+ return 0;
+ }
+
+ public int compareConstructor(JavaMethod o1, JavaMethod o2) {
+ if (o1.getReturnType() == null && o2.getReturnType() != null) {
+ return -1;
+ }
+ if (o1.getReturnType() != null && o2.getReturnType() == null) {
+ return 1;
+ }
+ return 0;
+ }
+
+ public int compareVisibility(JavaMethod o1, JavaMethod o2) {
+ if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) {
+ return -1;
+ }
+ if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) {
+ return 1;
+ }
+ if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) {
+ return -1;
+ }
+ if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) {
+ return 1;
+ }
+ if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) {
+ return -1;
+ }
+ if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) {
+ return 1;
+ }
+ return 0;
+ }
+ }
+}
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,123 @@
+/* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */
+
+package jaxx.compiler.java.parser;
+
+class JJTJavaParserState {
+ private java.util.Stack<Node> nodes;
+ private java.util.Stack<Integer> marks;
+
+ private int sp; // number of nodes on stack
+ private int mk; // current mark
+ private boolean node_created;
+
+ JJTJavaParserState() {
+ nodes = new java.util.Stack<Node>();
+ marks = new java.util.Stack<Integer>();
+ 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 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 = marks.pop();
+ }
+ return nodes.pop();
+ }
+
+ /* Returns the node currently on the top of the stack. */
+ Node peekNode() {
+ return 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 = marks.pop();
+ }
+
+
+ void openNodeScope(Node n) {
+ marks.push(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 = marks.pop();
+ 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 = marks.pop();
+ while (a-- > 0) {
+ Node c = popNode();
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, a);
+ }
+ n.jjtClose();
+ pushNode(n);
+ node_created = true;
+ } else {
+ mk = marks.pop();
+ node_created = false;
+ }
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jj
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jj (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jj 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,5125 @@
+/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. ./Java1.5.jj */
+/*@egen*/
+/*
+ * Copyright \u00a9 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has
+ * intellectual property rights relating to technology embodied in the product
+ * that is described in this document. In particular, and without limitation,
+ * these intellectual property rights may include one or more of the U.S.
+ * patents listed at http://www.sun.com/patents and one or more additional
+ * patents or pending patent applications in the U.S. and in other countries.
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements. Use is subject to license terms.
+ * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This
+ * product is covered and controlled by U.S. Export Control laws and may be
+ * subject to the export or import laws in other countries. Nuclear, missile,
+ * chemical biological weapons or nuclear maritime end uses or end users,
+ * whether direct or indirect, are strictly prohibited. Export or reexport
+ * to countries subject to U.S. embargo or to entities identified on U.S.
+ * export exclusion lists, including, but not limited to, the denied persons
+ * and specially designated nationals lists is strictly prohibited.
+ */
+
+// Slightly modified version of javacc's reference 1.5 grammar, tweaked for
+// usage with JAXX. There are two main areas of changes: several new
+// nonterminals were added to make identifying certain constructs easier,
+// and the Line nonterminal was added to support JAXX's script tags.
+// Several of the new changes are inefficient and require excess lookahead,
+// but at this point I'd rather have inefficiency than risk breaking it during
+// attempted optimizations.
+
+options {
+ JAVA_UNICODE_ESCAPE = true;
+ ERROR_REPORTING = false;
+ STATIC = false;
+ JDK_VERSION = "1.4";
+}
+
+PARSER_BEGIN(JavaParser)
+package jaxx.parser;
+
+import java.io.*;
+
+/**
+ * Grammar to parse Java version 1.5
+ * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5
+ */
+public class JavaParser/*@bgen(jjtree)*/implements JavaParserTreeConstants/*@egen*/
+{/*@bgen(jjtree)*/
+ protected JJTJavaParserState jjtree = new JJTJavaParserState();
+
+/*@egen*/
+ /**
+ * Class to hold modifiers.
+ */
+ static public final class ModifierSet
+ {
+ /* Definitions of the bits in the modifiers field. */
+ public static final int PUBLIC = 0x0001;
+ public static final int PROTECTED = 0x0002;
+ public static final int PRIVATE = 0x0004;
+ public static final int ABSTRACT = 0x0008;
+ public static final int STATIC = 0x0010;
+ public static final int FINAL = 0x0020;
+ public static final int SYNCHRONIZED = 0x0040;
+ public static final int NATIVE = 0x0080;
+ public static final int TRANSIENT = 0x0100;
+ public static final int VOLATILE = 0x0200;
+ public static final int STRICTFP = 0x1000;
+
+ /** A set of accessors that indicate whether the specified modifier
+ is in the set. */
+
+ public boolean isPublic(int modifiers)
+ {
+ return (modifiers & PUBLIC) != 0;
+ }
+
+ public boolean isProtected(int modifiers)
+ {
+ return (modifiers & PROTECTED) != 0;
+ }
+
+ public boolean isPrivate(int modifiers)
+ {
+ return (modifiers & PRIVATE) != 0;
+ }
+
+ public boolean isStatic(int modifiers)
+ {
+ return (modifiers & STATIC) != 0;
+ }
+
+ public boolean isAbstract(int modifiers)
+ {
+ return (modifiers & ABSTRACT) != 0;
+ }
+
+ public boolean isFinal(int modifiers)
+ {
+ return (modifiers & FINAL) != 0;
+ }
+
+ public boolean isNative(int modifiers)
+ {
+ return (modifiers & NATIVE) != 0;
+ }
+
+ public boolean isStrictfp(int modifiers)
+ {
+ return (modifiers & STRICTFP) != 0;
+ }
+
+ public boolean isSynchronized(int modifiers)
+ {
+ return (modifiers & SYNCHRONIZED) != 0;
+ }
+
+ public boolean isTransient(int modifiers)
+ {
+ return (modifiers & TRANSIENT) != 0;
+ }
+
+ public boolean isVolatile(int modifiers)
+ {
+ return (modifiers & VOLATILE) != 0;
+ }
+
+ /**
+ * Removes the given modifier.
+ */
+ static int removeModifier(int modifiers, int mod)
+ {
+ return modifiers & ~mod;
+ }
+ }
+
+ public JavaParser(String fileName)
+ {
+ this(System.in);
+ try { ReInit(new FileInputStream(new File(fileName))); }
+ catch(Exception e) { e.printStackTrace(); }
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode) n).firstToken = getToken(1);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode) n).lastToken = getToken(0);
+ }
+
+ public SimpleNode popNode()
+ {
+ if ( jjtree.nodeArity() > 0) // number of child nodes
+ return (SimpleNode)jjtree.popNode();
+ else
+ return null;
+ }
+ public static void main(String args[]) {
+ JavaParser parser;
+ if (args.length == 0) {
+ System.out.println("Java Parser Version 1.1: Reading from standard input . . .");
+ parser = new JavaParser(System.in);
+ } else if (args.length == 1) {
+ System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . .");
+ try {
+ parser = new JavaParser(new java.io.FileInputStream(args[0]));
+ } catch (java.io.FileNotFoundException e) {
+ System.out.println("Java Parser Version 1.1: File " + args[0] + " not found.");
+ return;
+ }
+ } else {
+ System.out.println("Java Parser Version 1.1: Usage is one of:");
+ System.out.println(" java JavaParser < inputfile");
+ System.out.println("OR");
+ System.out.println(" java JavaParser inputfile");
+ return;
+ }
+ try {
+ parser.CompilationUnit();
+ System.out.println("Java Parser Version 1.1: Java program parsed successfully.");
+ } catch (ParseException e) {
+ System.out.println(e.getMessage());
+ System.out.println("Java Parser Version 1.1: Encountered errors during parse.");
+ }
+ }
+
+}
+
+PARSER_END(JavaParser)
+
+/* COMMENTS */
+
+MORE :
+{
+ <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
+|
+ "/*" : IN_MULTI_LINE_COMMENT
+}
+
+SPECIAL_TOKEN:
+{
+ <WHITE_SPACE: ([" ", "\n", "\r", "\t", "\f"])+>
+}
+
+SPECIAL_TOKEN :
+{
+ <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?>
+}
+
+<IN_FORMAL_COMMENT>
+SPECIAL_TOKEN :
+{
+ <FORMAL_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_MULTI_LINE_COMMENT>
+SPECIAL_TOKEN :
+{
+ <MULTI_LINE_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
+MORE :
+{
+ < ~[] >
+}
+
+/* RESERVED WORDS AND LITERALS */
+
+TOKEN :
+{
+ < ABSTRACT: "abstract" >
+| < ASSERT: "assert" >
+| < BOOLEAN: "boolean" >
+| < BREAK: "break" >
+| < BYTE: "byte" >
+| < CASE: "case" >
+| < CATCH: "catch" >
+| < CHAR: "char" >
+| < CLASS: "class" >
+| < CONST: "const" >
+| < CONTINUE: "continue" >
+| < _DEFAULT: "default" >
+| < DO: "do" >
+| < DOUBLE: "double" >
+| < ELSE: "else" >
+| < ENUM: "enum" >
+| < EXTENDS: "extends" >
+| < FALSE: "false" >
+| < FINAL: "final" >
+| < FINALLY: "finally" >
+| < FLOAT: "float" >
+| < FOR: "for" >
+| < GOTO: "goto" >
+| < IF: "if" >
+| < IMPLEMENTS: "implements" >
+| < IMPORT: "import" >
+| < INSTANCEOF: "instanceof" >
+| < INT: "int" >
+| < INTERFACE: "interface" >
+| < LONG: "long" >
+| < NATIVE: "native" >
+| < NEW: "new" >
+| < NULL: "null" >
+| < PACKAGE: "package">
+| < PRIVATE: "private" >
+| < PROTECTED: "protected" >
+| < PUBLIC: "public" >
+| < RETURN: "return" >
+| < SHORT: "short" >
+| < STATIC: "static" >
+| < STRICTFP: "strictfp" >
+| < SUPER: "super" >
+| < SWITCH: "switch" >
+| < SYNCHRONIZED: "synchronized" >
+| < THIS: "this" >
+| < THROW: "throw" >
+| < THROWS: "throws" >
+| < TRANSIENT: "transient" >
+| < TRUE: "true" >
+| < TRY: "try" >
+| < VOID: "void" >
+| < VOLATILE: "volatile" >
+| < WHILE: "while" >
+}
+
+/* LITERALS */
+
+TOKEN :
+{
+ < INTEGER_LITERAL:
+ <DECIMAL_LITERAL> (["l","L"])?
+ | <HEX_LITERAL> (["l","L"])?
+ | <OCTAL_LITERAL> (["l","L"])?
+ >
+|
+ < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+ < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+ < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+ < FLOATING_POINT_LITERAL:
+ <DECIMAL_FLOATING_POINT_LITERAL>
+ | <HEXADECIMAL_FLOATING_POINT_LITERAL>
+ >
+|
+ < #DECIMAL_FLOATING_POINT_LITERAL:
+ (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
+ | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
+ | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])?
+ | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"]
+ >
+|
+ < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+|
+ < #HEXADECIMAL_FLOATING_POINT_LITERAL:
+ "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
+ | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
+ >
+|
+ < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ >
+|
+ < CHARACTER_LITERAL:
+ "'"
+ ( (~["'","\\","\n","\r"])
+ | ("\\"
+ ( ["n","t","b","r","f","\\","'","\""]
+ | ["0"-"7"] ( ["0"-"7"] )?
+ | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+ )
+ )
+ )
+ "'"
+ >
+|
+ < STRING_LITERAL:
+ "\""
+ ( (~["\"","\\","\n","\r"])
+ | ("\\"
+ ( ["n","t","b","r","f","\\","'","\""]
+ | ["0"-"7"] ( ["0"-"7"] )?
+ | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+ )
+ )
+ )*
+ "\""
+ >
+}
+
+/* IDENTIFIERS */
+
+TOKEN :
+{
+ < IDENTIFIER: <LETTER> (<PART_LETTER>)* >
+|
+ < #LETTER:
+ [ // all chars for which Character.isIdentifierStart is true
+ "$",
+ "A"-"Z",
+ "_",
+ "a"-"z",
+ "\u00a2"-"\u00a5",
+ "\u00aa",
+ "\u00b5",
+ "\u00ba",
+ "\u00c0"-"\u00d6",
+ "\u00d8"-"\u00f6",
+ "\u00f8"-"\u021f",
+ "\u0222"-"\u0233",
+ "\u0250"-"\u02ad",
+ "\u02b0"-"\u02b8",
+ "\u02bb"-"\u02c1",
+ "\u02d0"-"\u02d1",
+ "\u02e0"-"\u02e4",
+ "\u02ee",
+ "\u037a",
+ "\u0386",
+ "\u0388"-"\u038a",
+ "\u038c",
+ "\u038e"-"\u03a1",
+ "\u03a3"-"\u03ce",
+ "\u03d0"-"\u03d7",
+ "\u03da"-"\u03f3",
+ "\u0400"-"\u0481",
+ "\u048c"-"\u04c4",
+ "\u04c7"-"\u04c8",
+ "\u04cb"-"\u04cc",
+ "\u04d0"-"\u04f5",
+ "\u04f8"-"\u04f9",
+ "\u0531"-"\u0556",
+ "\u0559",
+ "\u0561"-"\u0587",
+ "\u05d0"-"\u05ea",
+ "\u05f0"-"\u05f2",
+ "\u0621"-"\u063a",
+ "\u0640"-"\u064a",
+ "\u0671"-"\u06d3",
+ "\u06d5",
+ "\u06e5"-"\u06e6",
+ "\u06fa"-"\u06fc",
+ "\u0710",
+ "\u0712"-"\u072c",
+ "\u0780"-"\u07a5",
+ "\u0905"-"\u0939",
+ "\u093d",
+ "\u0950",
+ "\u0958"-"\u0961",
+ "\u0985"-"\u098c",
+ "\u098f"-"\u0990",
+ "\u0993"-"\u09a8",
+ "\u09aa"-"\u09b0",
+ "\u09b2",
+ "\u09b6"-"\u09b9",
+ "\u09dc"-"\u09dd",
+ "\u09df"-"\u09e1",
+ "\u09f0"-"\u09f3",
+ "\u0a05"-"\u0a0a",
+ "\u0a0f"-"\u0a10",
+ "\u0a13"-"\u0a28",
+ "\u0a2a"-"\u0a30",
+ "\u0a32"-"\u0a33",
+ "\u0a35"-"\u0a36",
+ "\u0a38"-"\u0a39",
+ "\u0a59"-"\u0a5c",
+ "\u0a5e",
+ "\u0a72"-"\u0a74",
+ "\u0a85"-"\u0a8b",
+ "\u0a8d",
+ "\u0a8f"-"\u0a91",
+ "\u0a93"-"\u0aa8",
+ "\u0aaa"-"\u0ab0",
+ "\u0ab2"-"\u0ab3",
+ "\u0ab5"-"\u0ab9",
+ "\u0abd",
+ "\u0ad0",
+ "\u0ae0",
+ "\u0b05"-"\u0b0c",
+ "\u0b0f"-"\u0b10",
+ "\u0b13"-"\u0b28",
+ "\u0b2a"-"\u0b30",
+ "\u0b32"-"\u0b33",
+ "\u0b36"-"\u0b39",
+ "\u0b3d",
+ "\u0b5c"-"\u0b5d",
+ "\u0b5f"-"\u0b61",
+ "\u0b85"-"\u0b8a",
+ "\u0b8e"-"\u0b90",
+ "\u0b92"-"\u0b95",
+ "\u0b99"-"\u0b9a",
+ "\u0b9c",
+ "\u0b9e"-"\u0b9f",
+ "\u0ba3"-"\u0ba4",
+ "\u0ba8"-"\u0baa",
+ "\u0bae"-"\u0bb5",
+ "\u0bb7"-"\u0bb9",
+ "\u0c05"-"\u0c0c",
+ "\u0c0e"-"\u0c10",
+ "\u0c12"-"\u0c28",
+ "\u0c2a"-"\u0c33",
+ "\u0c35"-"\u0c39",
+ "\u0c60"-"\u0c61",
+ "\u0c85"-"\u0c8c",
+ "\u0c8e"-"\u0c90",
+ "\u0c92"-"\u0ca8",
+ "\u0caa"-"\u0cb3",
+ "\u0cb5"-"\u0cb9",
+ "\u0cde",
+ "\u0ce0"-"\u0ce1",
+ "\u0d05"-"\u0d0c",
+ "\u0d0e"-"\u0d10",
+ "\u0d12"-"\u0d28",
+ "\u0d2a"-"\u0d39",
+ "\u0d60"-"\u0d61",
+ "\u0d85"-"\u0d96",
+ "\u0d9a"-"\u0db1",
+ "\u0db3"-"\u0dbb",
+ "\u0dbd",
+ "\u0dc0"-"\u0dc6",
+ "\u0e01"-"\u0e30",
+ "\u0e32"-"\u0e33",
+ "\u0e3f"-"\u0e46",
+ "\u0e81"-"\u0e82",
+ "\u0e84",
+ "\u0e87"-"\u0e88",
+ "\u0e8a",
+ "\u0e8d",
+ "\u0e94"-"\u0e97",
+ "\u0e99"-"\u0e9f",
+ "\u0ea1"-"\u0ea3",
+ "\u0ea5",
+ "\u0ea7",
+ "\u0eaa"-"\u0eab",
+ "\u0ead"-"\u0eb0",
+ "\u0eb2"-"\u0eb3",
+ "\u0ebd",
+ "\u0ec0"-"\u0ec4",
+ "\u0ec6",
+ "\u0edc"-"\u0edd",
+ "\u0f00",
+ "\u0f40"-"\u0f47",
+ "\u0f49"-"\u0f6a",
+ "\u0f88"-"\u0f8b",
+ "\u1000"-"\u1021",
+ "\u1023"-"\u1027",
+ "\u1029"-"\u102a",
+ "\u1050"-"\u1055",
+ "\u10a0"-"\u10c5",
+ "\u10d0"-"\u10f6",
+ "\u1100"-"\u1159",
+ "\u115f"-"\u11a2",
+ "\u11a8"-"\u11f9",
+ "\u1200"-"\u1206",
+ "\u1208"-"\u1246",
+ "\u1248",
+ "\u124a"-"\u124d",
+ "\u1250"-"\u1256",
+ "\u1258",
+ "\u125a"-"\u125d",
+ "\u1260"-"\u1286",
+ "\u1288",
+ "\u128a"-"\u128d",
+ "\u1290"-"\u12ae",
+ "\u12b0",
+ "\u12b2"-"\u12b5",
+ "\u12b8"-"\u12be",
+ "\u12c0",
+ "\u12c2"-"\u12c5",
+ "\u12c8"-"\u12ce",
+ "\u12d0"-"\u12d6",
+ "\u12d8"-"\u12ee",
+ "\u12f0"-"\u130e",
+ "\u1310",
+ "\u1312"-"\u1315",
+ "\u1318"-"\u131e",
+ "\u1320"-"\u1346",
+ "\u1348"-"\u135a",
+ "\u13a0"-"\u13f4",
+ "\u1401"-"\u166c",
+ "\u166f"-"\u1676",
+ "\u1681"-"\u169a",
+ "\u16a0"-"\u16ea",
+ "\u1780"-"\u17b3",
+ "\u17db",
+ "\u1820"-"\u1877",
+ "\u1880"-"\u18a8",
+ "\u1e00"-"\u1e9b",
+ "\u1ea0"-"\u1ef9",
+ "\u1f00"-"\u1f15",
+ "\u1f18"-"\u1f1d",
+ "\u1f20"-"\u1f45",
+ "\u1f48"-"\u1f4d",
+ "\u1f50"-"\u1f57",
+ "\u1f59",
+ "\u1f5b",
+ "\u1f5d",
+ "\u1f5f"-"\u1f7d",
+ "\u1f80"-"\u1fb4",
+ "\u1fb6"-"\u1fbc",
+ "\u1fbe",
+ "\u1fc2"-"\u1fc4",
+ "\u1fc6"-"\u1fcc",
+ "\u1fd0"-"\u1fd3",
+ "\u1fd6"-"\u1fdb",
+ "\u1fe0"-"\u1fec",
+ "\u1ff2"-"\u1ff4",
+ "\u1ff6"-"\u1ffc",
+ "\u203f"-"\u2040",
+ "\u207f",
+ "\u20a0"-"\u20af",
+ "\u2102",
+ "\u2107",
+ "\u210a"-"\u2113",
+ "\u2115",
+ "\u2119"-"\u211d",
+ "\u2124",
+ "\u2126",
+ "\u2128",
+ "\u212a"-"\u212d",
+ "\u212f"-"\u2131",
+ "\u2133"-"\u2139",
+ "\u2160"-"\u2183",
+ "\u3005"-"\u3007",
+ "\u3021"-"\u3029",
+ "\u3031"-"\u3035",
+ "\u3038"-"\u303a",
+ "\u3041"-"\u3094",
+ "\u309d"-"\u309e",
+ "\u30a1"-"\u30fe",
+ "\u3105"-"\u312c",
+ "\u3131"-"\u318e",
+ "\u31a0"-"\u31b7",
+ "\u3400"-"\u4db5",
+ "\u4e00"-"\u9fa5",
+ "\ua000"-"\ua48c",
+ "\uac00"-"\ud7a3",
+ "\uf900"-"\ufa2d",
+ "\ufb00"-"\ufb06",
+ "\ufb13"-"\ufb17",
+ "\ufb1d",
+ "\ufb1f"-"\ufb28",
+ "\ufb2a"-"\ufb36",
+ "\ufb38"-"\ufb3c",
+ "\ufb3e",
+ "\ufb40"-"\ufb41",
+ "\ufb43"-"\ufb44",
+ "\ufb46"-"\ufbb1",
+ "\ufbd3"-"\ufd3d",
+ "\ufd50"-"\ufd8f",
+ "\ufd92"-"\ufdc7",
+ "\ufdf0"-"\ufdfb",
+ "\ufe33"-"\ufe34",
+ "\ufe4d"-"\ufe4f",
+ "\ufe69",
+ "\ufe70"-"\ufe72",
+ "\ufe74",
+ "\ufe76"-"\ufefc",
+ "\uff04",
+ "\uff21"-"\uff3a",
+ "\uff3f",
+ "\uff41"-"\uff5a",
+ "\uff65"-"\uffbe",
+ "\uffc2"-"\uffc7",
+ "\uffca"-"\uffcf",
+ "\uffd2"-"\uffd7",
+ "\uffda"-"\uffdc",
+ "\uffe0"-"\uffe1",
+ "\uffe5"-"\uffe6"
+ ]
+ >
+|
+ < #PART_LETTER:
+ [ // all chars for which Character.isIdentifierPart is true
+ "\u0000"-"\u0008",
+ "\u000e"-"\u001b",
+ "$",
+ "0"-"9",
+ "A"-"Z",
+ "_",
+ "a"-"z",
+ "\u007f"-"\u009f",
+ "\u00a2"-"\u00a5",
+ "\u00aa",
+ "\u00b5",
+ "\u00ba",
+ "\u00c0"-"\u00d6",
+ "\u00d8"-"\u00f6",
+ "\u00f8"-"\u021f",
+ "\u0222"-"\u0233",
+ "\u0250"-"\u02ad",
+ "\u02b0"-"\u02b8",
+ "\u02bb"-"\u02c1",
+ "\u02d0"-"\u02d1",
+ "\u02e0"-"\u02e4",
+ "\u02ee",
+ "\u0300"-"\u034e",
+ "\u0360"-"\u0362",
+ "\u037a",
+ "\u0386",
+ "\u0388"-"\u038a",
+ "\u038c",
+ "\u038e"-"\u03a1",
+ "\u03a3"-"\u03ce",
+ "\u03d0"-"\u03d7",
+ "\u03da"-"\u03f3",
+ "\u0400"-"\u0481",
+ "\u0483"-"\u0486",
+ "\u048c"-"\u04c4",
+ "\u04c7"-"\u04c8",
+ "\u04cb"-"\u04cc",
+ "\u04d0"-"\u04f5",
+ "\u04f8"-"\u04f9",
+ "\u0531"-"\u0556",
+ "\u0559",
+ "\u0561"-"\u0587",
+ "\u0591"-"\u05a1",
+ "\u05a3"-"\u05b9",
+ "\u05bb"-"\u05bd",
+ "\u05bf",
+ "\u05c1"-"\u05c2",
+ "\u05c4",
+ "\u05d0"-"\u05ea",
+ "\u05f0"-"\u05f2",
+ "\u0621"-"\u063a",
+ "\u0640"-"\u0655",
+ "\u0660"-"\u0669",
+ "\u0670"-"\u06d3",
+ "\u06d5"-"\u06dc",
+ "\u06df"-"\u06e8",
+ "\u06ea"-"\u06ed",
+ "\u06f0"-"\u06fc",
+ "\u070f"-"\u072c",
+ "\u0730"-"\u074a",
+ "\u0780"-"\u07b0",
+ "\u0901"-"\u0903",
+ "\u0905"-"\u0939",
+ "\u093c"-"\u094d",
+ "\u0950"-"\u0954",
+ "\u0958"-"\u0963",
+ "\u0966"-"\u096f",
+ "\u0981"-"\u0983",
+ "\u0985"-"\u098c",
+ "\u098f"-"\u0990",
+ "\u0993"-"\u09a8",
+ "\u09aa"-"\u09b0",
+ "\u09b2",
+ "\u09b6"-"\u09b9",
+ "\u09bc",
+ "\u09be"-"\u09c4",
+ "\u09c7"-"\u09c8",
+ "\u09cb"-"\u09cd",
+ "\u09d7",
+ "\u09dc"-"\u09dd",
+ "\u09df"-"\u09e3",
+ "\u09e6"-"\u09f3",
+ "\u0a02",
+ "\u0a05"-"\u0a0a",
+ "\u0a0f"-"\u0a10",
+ "\u0a13"-"\u0a28",
+ "\u0a2a"-"\u0a30",
+ "\u0a32"-"\u0a33",
+ "\u0a35"-"\u0a36",
+ "\u0a38"-"\u0a39",
+ "\u0a3c",
+ "\u0a3e"-"\u0a42",
+ "\u0a47"-"\u0a48",
+ "\u0a4b"-"\u0a4d",
+ "\u0a59"-"\u0a5c",
+ "\u0a5e",
+ "\u0a66"-"\u0a74",
+ "\u0a81"-"\u0a83",
+ "\u0a85"-"\u0a8b",
+ "\u0a8d",
+ "\u0a8f"-"\u0a91",
+ "\u0a93"-"\u0aa8",
+ "\u0aaa"-"\u0ab0",
+ "\u0ab2"-"\u0ab3",
+ "\u0ab5"-"\u0ab9",
+ "\u0abc"-"\u0ac5",
+ "\u0ac7"-"\u0ac9",
+ "\u0acb"-"\u0acd",
+ "\u0ad0",
+ "\u0ae0",
+ "\u0ae6"-"\u0aef",
+ "\u0b01"-"\u0b03",
+ "\u0b05"-"\u0b0c",
+ "\u0b0f"-"\u0b10",
+ "\u0b13"-"\u0b28",
+ "\u0b2a"-"\u0b30",
+ "\u0b32"-"\u0b33",
+ "\u0b36"-"\u0b39",
+ "\u0b3c"-"\u0b43",
+ "\u0b47"-"\u0b48",
+ "\u0b4b"-"\u0b4d",
+ "\u0b56"-"\u0b57",
+ "\u0b5c"-"\u0b5d",
+ "\u0b5f"-"\u0b61",
+ "\u0b66"-"\u0b6f",
+ "\u0b82"-"\u0b83",
+ "\u0b85"-"\u0b8a",
+ "\u0b8e"-"\u0b90",
+ "\u0b92"-"\u0b95",
+ "\u0b99"-"\u0b9a",
+ "\u0b9c",
+ "\u0b9e"-"\u0b9f",
+ "\u0ba3"-"\u0ba4",
+ "\u0ba8"-"\u0baa",
+ "\u0bae"-"\u0bb5",
+ "\u0bb7"-"\u0bb9",
+ "\u0bbe"-"\u0bc2",
+ "\u0bc6"-"\u0bc8",
+ "\u0bca"-"\u0bcd",
+ "\u0bd7",
+ "\u0be7"-"\u0bef",
+ "\u0c01"-"\u0c03",
+ "\u0c05"-"\u0c0c",
+ "\u0c0e"-"\u0c10",
+ "\u0c12"-"\u0c28",
+ "\u0c2a"-"\u0c33",
+ "\u0c35"-"\u0c39",
+ "\u0c3e"-"\u0c44",
+ "\u0c46"-"\u0c48",
+ "\u0c4a"-"\u0c4d",
+ "\u0c55"-"\u0c56",
+ "\u0c60"-"\u0c61",
+ "\u0c66"-"\u0c6f",
+ "\u0c82"-"\u0c83",
+ "\u0c85"-"\u0c8c",
+ "\u0c8e"-"\u0c90",
+ "\u0c92"-"\u0ca8",
+ "\u0caa"-"\u0cb3",
+ "\u0cb5"-"\u0cb9",
+ "\u0cbe"-"\u0cc4",
+ "\u0cc6"-"\u0cc8",
+ "\u0cca"-"\u0ccd",
+ "\u0cd5"-"\u0cd6",
+ "\u0cde",
+ "\u0ce0"-"\u0ce1",
+ "\u0ce6"-"\u0cef",
+ "\u0d02"-"\u0d03",
+ "\u0d05"-"\u0d0c",
+ "\u0d0e"-"\u0d10",
+ "\u0d12"-"\u0d28",
+ "\u0d2a"-"\u0d39",
+ "\u0d3e"-"\u0d43",
+ "\u0d46"-"\u0d48",
+ "\u0d4a"-"\u0d4d",
+ "\u0d57",
+ "\u0d60"-"\u0d61",
+ "\u0d66"-"\u0d6f",
+ "\u0d82"-"\u0d83",
+ "\u0d85"-"\u0d96",
+ "\u0d9a"-"\u0db1",
+ "\u0db3"-"\u0dbb",
+ "\u0dbd",
+ "\u0dc0"-"\u0dc6",
+ "\u0dca",
+ "\u0dcf"-"\u0dd4",
+ "\u0dd6",
+ "\u0dd8"-"\u0ddf",
+ "\u0df2"-"\u0df3",
+ "\u0e01"-"\u0e3a",
+ "\u0e3f"-"\u0e4e",
+ "\u0e50"-"\u0e59",
+ "\u0e81"-"\u0e82",
+ "\u0e84",
+ "\u0e87"-"\u0e88",
+ "\u0e8a",
+ "\u0e8d",
+ "\u0e94"-"\u0e97",
+ "\u0e99"-"\u0e9f",
+ "\u0ea1"-"\u0ea3",
+ "\u0ea5",
+ "\u0ea7",
+ "\u0eaa"-"\u0eab",
+ "\u0ead"-"\u0eb9",
+ "\u0ebb"-"\u0ebd",
+ "\u0ec0"-"\u0ec4",
+ "\u0ec6",
+ "\u0ec8"-"\u0ecd",
+ "\u0ed0"-"\u0ed9",
+ "\u0edc"-"\u0edd",
+ "\u0f00",
+ "\u0f18"-"\u0f19",
+ "\u0f20"-"\u0f29",
+ "\u0f35",
+ "\u0f37",
+ "\u0f39",
+ "\u0f3e"-"\u0f47",
+ "\u0f49"-"\u0f6a",
+ "\u0f71"-"\u0f84",
+ "\u0f86"-"\u0f8b",
+ "\u0f90"-"\u0f97",
+ "\u0f99"-"\u0fbc",
+ "\u0fc6",
+ "\u1000"-"\u1021",
+ "\u1023"-"\u1027",
+ "\u1029"-"\u102a",
+ "\u102c"-"\u1032",
+ "\u1036"-"\u1039",
+ "\u1040"-"\u1049",
+ "\u1050"-"\u1059",
+ "\u10a0"-"\u10c5",
+ "\u10d0"-"\u10f6",
+ "\u1100"-"\u1159",
+ "\u115f"-"\u11a2",
+ "\u11a8"-"\u11f9",
+ "\u1200"-"\u1206",
+ "\u1208"-"\u1246",
+ "\u1248",
+ "\u124a"-"\u124d",
+ "\u1250"-"\u1256",
+ "\u1258",
+ "\u125a"-"\u125d",
+ "\u1260"-"\u1286",
+ "\u1288",
+ "\u128a"-"\u128d",
+ "\u1290"-"\u12ae",
+ "\u12b0",
+ "\u12b2"-"\u12b5",
+ "\u12b8"-"\u12be",
+ "\u12c0",
+ "\u12c2"-"\u12c5",
+ "\u12c8"-"\u12ce",
+ "\u12d0"-"\u12d6",
+ "\u12d8"-"\u12ee",
+ "\u12f0"-"\u130e",
+ "\u1310",
+ "\u1312"-"\u1315",
+ "\u1318"-"\u131e",
+ "\u1320"-"\u1346",
+ "\u1348"-"\u135a",
+ "\u1369"-"\u1371",
+ "\u13a0"-"\u13f4",
+ "\u1401"-"\u166c",
+ "\u166f"-"\u1676",
+ "\u1681"-"\u169a",
+ "\u16a0"-"\u16ea",
+ "\u1780"-"\u17d3",
+ "\u17db",
+ "\u17e0"-"\u17e9",
+ "\u180b"-"\u180e",
+ "\u1810"-"\u1819",
+ "\u1820"-"\u1877",
+ "\u1880"-"\u18a9",
+ "\u1e00"-"\u1e9b",
+ "\u1ea0"-"\u1ef9",
+ "\u1f00"-"\u1f15",
+ "\u1f18"-"\u1f1d",
+ "\u1f20"-"\u1f45",
+ "\u1f48"-"\u1f4d",
+ "\u1f50"-"\u1f57",
+ "\u1f59",
+ "\u1f5b",
+ "\u1f5d",
+ "\u1f5f"-"\u1f7d",
+ "\u1f80"-"\u1fb4",
+ "\u1fb6"-"\u1fbc",
+ "\u1fbe",
+ "\u1fc2"-"\u1fc4",
+ "\u1fc6"-"\u1fcc",
+ "\u1fd0"-"\u1fd3",
+ "\u1fd6"-"\u1fdb",
+ "\u1fe0"-"\u1fec",
+ "\u1ff2"-"\u1ff4",
+ "\u1ff6"-"\u1ffc",
+ "\u200c"-"\u200f",
+ "\u202a"-"\u202e",
+ "\u203f"-"\u2040",
+ "\u206a"-"\u206f",
+ "\u207f",
+ "\u20a0"-"\u20af",
+ "\u20d0"-"\u20dc",
+ "\u20e1",
+ "\u2102",
+ "\u2107",
+ "\u210a"-"\u2113",
+ "\u2115",
+ "\u2119"-"\u211d",
+ "\u2124",
+ "\u2126",
+ "\u2128",
+ "\u212a"-"\u212d",
+ "\u212f"-"\u2131",
+ "\u2133"-"\u2139",
+ "\u2160"-"\u2183",
+ "\u3005"-"\u3007",
+ "\u3021"-"\u302f",
+ "\u3031"-"\u3035",
+ "\u3038"-"\u303a",
+ "\u3041"-"\u3094",
+ "\u3099"-"\u309a",
+ "\u309d"-"\u309e",
+ "\u30a1"-"\u30fe",
+ "\u3105"-"\u312c",
+ "\u3131"-"\u318e",
+ "\u31a0"-"\u31b7",
+ "\u3400"-"\u4db5",
+ "\u4e00"-"\u9fa5",
+ "\ua000"-"\ua48c",
+ "\uac00"-"\ud7a3",
+ "\uf900"-"\ufa2d",
+ "\ufb00"-"\ufb06",
+ "\ufb13"-"\ufb17",
+ "\ufb1d"-"\ufb28",
+ "\ufb2a"-"\ufb36",
+ "\ufb38"-"\ufb3c",
+ "\ufb3e",
+ "\ufb40"-"\ufb41",
+ "\ufb43"-"\ufb44",
+ "\ufb46"-"\ufbb1",
+ "\ufbd3"-"\ufd3d",
+ "\ufd50"-"\ufd8f",
+ "\ufd92"-"\ufdc7",
+ "\ufdf0"-"\ufdfb",
+ "\ufe20"-"\ufe23",
+ "\ufe33"-"\ufe34",
+ "\ufe4d"-"\ufe4f",
+ "\ufe69",
+ "\ufe70"-"\ufe72",
+ "\ufe74",
+ "\ufe76"-"\ufefc",
+ "\ufeff",
+ "\uff04",
+ "\uff10"-"\uff19",
+ "\uff21"-"\uff3a",
+ "\uff3f",
+ "\uff41"-"\uff5a",
+ "\uff65"-"\uffbe",
+ "\uffc2"-"\uffc7",
+ "\uffca"-"\uffcf",
+ "\uffd2"-"\uffd7",
+ "\uffda"-"\uffdc",
+ "\uffe0"-"\uffe1",
+ "\uffe5"-"\uffe6",
+ "\ufff9"-"\ufffb"
+ ]
+ >
+}
+
+/* SEPARATORS */
+
+TOKEN :
+{
+ < LPAREN: "(" >
+| < RPAREN: ")" >
+| < LBRACE: "{" >
+| < RBRACE: "}" >
+| < LBRACKET: "[" >
+| < RBRACKET: "]" >
+| < SEMICOLON: ";" >
+| < COMMA: "," >
+| < DOT: "." >
+| < AT: "@" >
+}
+
+/* OPERATORS */
+
+TOKEN :
+{
+ < ASSIGN: "=" >
+| < LT: "<" >
+| < BANG: "!" >
+| < TILDE: "~" >
+| < HOOK: "?" >
+| < COLON: ":" >
+| < EQ: "==" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "!=" >
+| < SC_OR: "||" >
+| < SC_AND: "&&" >
+| < INCR: "++" >
+| < DECR: "--" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < STAR: "*" >
+| < SLASH: "/" >
+| < BIT_AND: "&" >
+| < BIT_OR: "|" >
+| < XOR: "^" >
+| < REM: "%" >
+| < LSHIFT: "<<" >
+| < PLUSASSIGN: "+=" >
+| < MINUSASSIGN: "-=" >
+| < STARASSIGN: "*=" >
+| < SLASHASSIGN: "/=" >
+| < ANDASSIGN: "&=" >
+| < ORASSIGN: "|=" >
+| < XORASSIGN: "^=" >
+| < REMASSIGN: "%=" >
+| < LSHIFTASSIGN: "<<=" >
+| < RSIGNEDSHIFTASSIGN: ">>=" >
+| < RUNSIGNEDSHIFTASSIGN: ">>>=" >
+| < ELLIPSIS: "..." >
+}
+
+/* >'s need special attention due to generics syntax. */
+TOKEN :
+{
+ < RUNSIGNEDSHIFT: ">>>" >
+ {
+ matchedToken.kind = GT;
+ ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT;
+ input_stream.backup(2);
+ matchedToken.image = ">";
+ }
+| < RSIGNEDSHIFT: ">>" >
+ {
+ matchedToken.kind = GT;
+ ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT;
+ input_stream.backup(1);
+ matchedToken.image = ">";
+ }
+| < GT: ">" >
+}
+
+boolean Line() :
+{/*@bgen(jjtree) Line */
+ SimpleNode jjtn000 = new SimpleNode(JJTLINE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ int modifiers;
+}
+{/*@bgen(jjtree) Line */
+ try {
+/*@egen*/
+ <EOF>/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/ {
+ return true;
+ }
+|
+ LOOKAHEAD(BlockStatement())
+ BlockStatement()/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/ {
+ return false;
+ }
+|
+ LOOKAHEAD(Modifiers() [ TypeParameters() ] [ ResultType() ] <IDENTIFIER> FormalParameters() [ "throws" NameList() ] "{")
+ ClassOrInterfaceBodyDeclaration(false)/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/ {
+ return false;
+ }
+|
+ LOOKAHEAD(ClassOrInterfaceBodyDeclaration(false))
+ ClassOrInterfaceBodyDeclaration(false)/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/ {
+ return false;
+ }
+|
+ LOOKAHEAD(Expression())
+ Expression()/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/ {
+ return false;
+ }
+|
+ ImportDeclaration()/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/ {
+ return false;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/*****************************************
+ * THE JAVA LANGUAGE GRAMMAR STARTS HERE *
+ *****************************************/
+
+/*
+ * Program structuring syntax follows.
+ */
+
+void CompilationUnit():
+{/*@bgen(jjtree) CompilationUnit */
+ SimpleNode jjtn000 = new SimpleNode(JJTCOMPILATIONUNIT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) CompilationUnit */
+ try {
+/*@egen*/
+ [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ]
+ ( ImportDeclaration() )*
+ ( TypeDeclaration() )*
+ ( < "\u001a" > )?
+ ( <STUFF_TO_IGNORE: ~[]> )?
+ <EOF>/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PackageDeclaration():
+{/*@bgen(jjtree) PackageDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTPACKAGEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PackageDeclaration */
+ try {
+/*@egen*/
+ Modifiers() "package" Name() ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ImportDeclaration():
+{/*@bgen(jjtree) ImportDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTIMPORTDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ImportDeclaration */
+ try {
+/*@egen*/
+ "import" [ "static" ] Name() [ "." "*" ] ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/*
+ * Modifiers. We match all modifiers in a single rule to reduce the chances of
+ * syntax errors for simple modifier mistakes. It will also enable us to give
+ * better error messages.
+ */
+
+int Modifiers():
+{/*@bgen(jjtree) Modifiers */
+ SimpleNode jjtn000 = new SimpleNode(JJTMODIFIERS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ int modifiers = 0;
+}
+{/*@bgen(jjtree) Modifiers */
+ try {
+/*@egen*/
+ (
+ LOOKAHEAD(2)
+ (
+ "public" { modifiers |= ModifierSet.PUBLIC; }
+ |
+ "static" { modifiers |= ModifierSet.STATIC; }
+ |
+ "protected" { modifiers |= ModifierSet.PROTECTED; }
+ |
+ "private" { modifiers |= ModifierSet.PRIVATE; }
+ |
+ "final" { modifiers |= ModifierSet.FINAL; }
+ |
+ "abstract" { modifiers |= ModifierSet.ABSTRACT; }
+ |
+ "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; }
+ |
+ "native" { modifiers |= ModifierSet.NATIVE; }
+ |
+ "transient" { modifiers |= ModifierSet.TRANSIENT; }
+ |
+ "volatile" { modifiers |= ModifierSet.VOLATILE; }
+ |
+ "strictfp" { modifiers |= ModifierSet.STRICTFP; }
+ |
+ Annotation()
+ )
+ )*/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/
+
+ {
+ return modifiers;
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/*
+ * Declaration syntax follows.
+ */
+void TypeDeclaration():
+{/*@bgen(jjtree) TypeDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ int modifiers;
+}
+{/*@bgen(jjtree) TypeDeclaration */
+ try {
+/*@egen*/
+ ";"
+|
+ modifiers = Modifiers()
+ (
+ ClassOrInterfaceDeclaration(modifiers)
+ |
+ EnumDeclaration(modifiers)
+ |
+ AnnotationTypeDeclaration(modifiers)
+ )/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void ClassOrInterfaceDeclaration(int modifiers):
+{/*@bgen(jjtree) ClassOrInterfaceDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ boolean isInterface = false;
+}
+{/*@bgen(jjtree) ClassOrInterfaceDeclaration */
+ try {
+/*@egen*/
+ ( "class" | "interface" { isInterface = true; } )
+ <IDENTIFIER>
+ [ TypeParameters() ]
+ [ ExtendsList(isInterface) ]
+ [ ImplementsList(isInterface) ]
+ ClassOrInterfaceBody(isInterface)/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ExtendsList(boolean isInterface):
+{/*@bgen(jjtree) ExtendsList */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXTENDSLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ boolean extendsMoreThanOne = false;
+}
+{/*@bgen(jjtree) ExtendsList */
+ try {
+/*@egen*/
+ "extends" ClassOrInterfaceType()
+ ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )*/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/
+ {
+ if (extendsMoreThanOne && !isInterface)
+ throw new ParseException("A class cannot extend more than one other class");
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ImplementsList(boolean isInterface):
+{/*@bgen(jjtree) ImplementsList */
+ SimpleNode jjtn000 = new SimpleNode(JJTIMPLEMENTSLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ImplementsList */
+ try {
+/*@egen*/
+ "implements" ClassOrInterfaceType()
+ ( "," ClassOrInterfaceType() )*/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/
+ {
+ if (isInterface)
+ throw new ParseException("An interface cannot implement other interfaces");
+ }/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void EnumDeclaration(int modifiers):
+{/*@bgen(jjtree) EnumDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTENUMDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) EnumDeclaration */
+ try {
+/*@egen*/
+ "enum" <IDENTIFIER>
+ [ ImplementsList(false) ]
+ EnumBody()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void EnumBody():
+{/*@bgen(jjtree) EnumBody */
+ SimpleNode jjtn000 = new SimpleNode(JJTENUMBODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) EnumBody */
+ try {
+/*@egen*/
+ "{"
+ [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ]
+ [ "," ]
+ [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ]
+ "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void EnumConstant():
+{/*@bgen(jjtree) EnumConstant */
+ SimpleNode jjtn000 = new SimpleNode(JJTENUMCONSTANT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) EnumConstant */
+ try {
+/*@egen*/
+ Modifiers() <IDENTIFIER> [ Arguments() ] [ ClassOrInterfaceBody(false) ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void TypeParameters():
+{/*@bgen(jjtree) TypeParameters */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETERS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) TypeParameters */
+ try {
+/*@egen*/
+ "<" TypeParameter() ( "," TypeParameter() )* ">"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void TypeParameter():
+{/*@bgen(jjtree) TypeParameter */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) TypeParameter */
+ try {
+/*@egen*/
+ <IDENTIFIER> [ TypeBound() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void TypeBound():
+{/*@bgen(jjtree) TypeBound */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEBOUND);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) TypeBound */
+ try {
+/*@egen*/
+ "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ClassOrInterfaceBody(boolean isInterface):
+{/*@bgen(jjtree) ClassOrInterfaceBody */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ClassOrInterfaceBody */
+ try {
+/*@egen*/
+ "{" ( ClassOrInterfaceBodyDeclaration(isInterface) )* "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ClassOrInterfaceBodyDeclaration(boolean isInterface):
+{/*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODYDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ boolean isNestedInterface = false;
+ int modifiers;
+}
+{/*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */
+ try {
+/*@egen*/
+ LOOKAHEAD(2)
+ Initializer()/*@bgen(jjtree)*/
+ {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ }
+/*@egen*/
+ {
+ if (isInterface)
+ throw new ParseException("An interface cannot have initializers");
+ }
+|
+ modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do
+ // more checks, pass the modifiers down to the member
+ (
+ ClassOrInterfaceDeclaration(modifiers)
+ |
+ EnumDeclaration(modifiers)
+ |
+ LOOKAHEAD( [ TypeParameters() ] <IDENTIFIER> "(" )
+ ConstructorDeclaration()
+ |
+ LOOKAHEAD( Type() <IDENTIFIER> ( "[" "]" )* ( "," | "=" | ";" ) )
+ FieldDeclaration(modifiers)
+ |
+ MethodDeclaration(modifiers)
+ )
+|
+ ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void FieldDeclaration(int modifiers):
+{/*@bgen(jjtree) FieldDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTFIELDDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) FieldDeclaration */
+ try {
+/*@egen*/
+ // Modifiers are already matched in the caller
+ Type() VariableDeclarator() ( "," VariableDeclarator() )* ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void VariableDeclarator():
+{/*@bgen(jjtree) VariableDeclarator */
+ SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) VariableDeclarator */
+ try {
+/*@egen*/
+ VariableDeclaratorId() [ "=" VariableInitializer() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void VariableDeclaratorId():
+{/*@bgen(jjtree) VariableDeclaratorId */
+ SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATORID);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) VariableDeclaratorId */
+ try {
+/*@egen*/
+ <IDENTIFIER> ( "[" "]" )*/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void VariableInitializer():
+{/*@bgen(jjtree) VariableInitializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) VariableInitializer */
+ try {
+/*@egen*/
+ ArrayInitializer()
+|
+ Expression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ArrayInitializer():
+{/*@bgen(jjtree) ArrayInitializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTARRAYINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ArrayInitializer */
+ try {
+/*@egen*/
+ "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MethodDeclaration(int modifiers):
+{/*@bgen(jjtree) MethodDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MethodDeclaration */
+ try {
+/*@egen*/
+ // Modifiers already matched in the caller!
+ [ TypeParameters() ]
+ ResultType()
+ MethodDeclarator() [ "throws" NameList() ]
+ ( Block() | ";" )/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MethodDeclarator():
+{/*@bgen(jjtree) MethodDeclarator */
+ SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MethodDeclarator */
+ try {
+/*@egen*/
+ <IDENTIFIER> FormalParameters() ( "[" "]" )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void FormalParameters():
+{/*@bgen(jjtree) FormalParameters */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETERS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) FormalParameters */
+ try {
+/*@egen*/
+ "(" [ FormalParameter() ( "," FormalParameter() )* ] ")"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void FormalParameter():
+{/*@bgen(jjtree) FormalParameter */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) FormalParameter */
+ try {
+/*@egen*/
+ Modifiers() Type() [ "..." ] VariableDeclaratorId()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ConstructorDeclaration():
+{/*@bgen(jjtree) ConstructorDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONSTRUCTORDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ConstructorDeclaration */
+ try {
+/*@egen*/
+ [ TypeParameters() ]
+ // Modifiers matched in the caller
+ <IDENTIFIER> FormalParameters() [ "throws" NameList() ]
+ "{"
+ [ LOOKAHEAD(ExplicitConstructorInvocation())
+ ExplicitConstructorInvocation()
+ ]
+ ( BlockStatement() )*
+ "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ExplicitConstructorInvocation():
+{/*@bgen(jjtree) ExplicitConstructorInvocation */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXPLICITCONSTRUCTORINVOCATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ExplicitConstructorInvocation */
+ try {
+/*@egen*/
+ ( <IDENTIFIER> "." )* [ LOOKAHEAD(2) "this" "." ]
+ [ TypeArguments() ] ("this"|"super") Arguments() ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void Initializer():
+{/*@bgen(jjtree) Initializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Initializer */
+ try {
+/*@egen*/
+ [ "static" ] Block()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+/*
+ * Type, name and expression syntax follows.
+ */
+
+void Type():
+{/*@bgen(jjtree) Type */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Type */
+ try {
+/*@egen*/
+ LOOKAHEAD(2) ReferenceType()
+ |
+ PrimitiveType()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ReferenceType():
+{/*@bgen(jjtree) ReferenceType */
+ SimpleNode jjtn000 = new SimpleNode(JJTREFERENCETYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ReferenceType */
+ try {
+/*@egen*/
+ PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+
+ |
+ ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ClassOrInterfaceType():
+{/*@bgen(jjtree) ClassOrInterfaceType */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACETYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ClassOrInterfaceType */
+ try {
+/*@egen*/
+ <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ]
+ ( LOOKAHEAD(2) "." <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void TypeArguments():
+{/*@bgen(jjtree) TypeArguments */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENTS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) TypeArguments */
+ try {
+/*@egen*/
+ "<" TypeArgument() ( "," TypeArgument() )* ">"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void TypeArgument():
+{/*@bgen(jjtree) TypeArgument */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) TypeArgument */
+ try {
+/*@egen*/
+ ReferenceType()
+ |
+ "?" [ WildcardBounds() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void WildcardBounds():
+{/*@bgen(jjtree) WildcardBounds */
+ SimpleNode jjtn000 = new SimpleNode(JJTWILDCARDBOUNDS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) WildcardBounds */
+ try {
+/*@egen*/
+ "extends" ReferenceType()
+ |
+ "super" ReferenceType()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+void PrimitiveType():
+{/*@bgen(jjtree) PrimitiveType */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMITIVETYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PrimitiveType */
+ try {
+/*@egen*/
+ "boolean"
+|
+ "char"
+|
+ "byte"
+|
+ "short"
+|
+ "int"
+|
+ "long"
+|
+ "float"
+|
+ "double"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ResultType():
+{/*@bgen(jjtree) ResultType */
+ SimpleNode jjtn000 = new SimpleNode(JJTRESULTTYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ResultType */
+ try {
+/*@egen*/
+ "void"
+|
+ Type()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void Name():
+/*
+ * A lookahead of 2 is required below since "Name" can be followed
+ * by a ".*" when used in the context of an "ImportDeclaration".
+ */
+{/*@bgen(jjtree) Name */
+ SimpleNode jjtn000 = new SimpleNode(JJTNAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Name */
+ try {
+/*@egen*/
+ <IDENTIFIER>
+ ( LOOKAHEAD(2) "." <IDENTIFIER>
+ )*/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void NameList():
+{/*@bgen(jjtree) NameList */
+ SimpleNode jjtn000 = new SimpleNode(JJTNAMELIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) NameList */
+ try {
+/*@egen*/
+ Name() ( "," Name() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+/*
+ * Expression syntax follows.
+ */
+
+void Expression():
+/*
+ * This expansion has been written this way instead of:
+ * Assignment() | ConditionalExpression()
+ * for performance reasons.
+ * However, it is a weakening of the grammar for it allows the LHS of
+ * assignments to be any conditional expression whereas it can only be
+ * a primary expression. Consider adding a semantic predicate to work
+ * around this.
+ */
+{/*@bgen(jjtree) Expression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Expression */
+ try {
+/*@egen*/
+ ConditionalExpression()
+ [
+ LOOKAHEAD(2)
+ AssignmentOperator() Expression()
+ ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AssignmentOperator():
+{/*@bgen(jjtree) AssignmentOperator */
+ SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTOPERATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AssignmentOperator */
+ try {
+/*@egen*/
+ "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|="/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AssignmentExpression():
+{/*@bgen(jjtree) AssignmentExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AssignmentExpression */
+ try {
+/*@egen*/
+ PrimaryExpression() AssignmentOperator() Expression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ConditionalExpression():
+{/*@bgen(jjtree) ConditionalExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ConditionalExpression */
+ try {
+/*@egen*/
+ ConditionalOrExpression() [ "?" Expression() ":" Expression() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ConditionalOrExpression():
+{/*@bgen(jjtree) ConditionalOrExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALOREXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ConditionalOrExpression */
+ try {
+/*@egen*/
+ ConditionalAndExpression() ( "||" ConditionalAndExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ConditionalAndExpression():
+{/*@bgen(jjtree) ConditionalAndExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALANDEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ConditionalAndExpression */
+ try {
+/*@egen*/
+ InclusiveOrExpression() ( "&&" InclusiveOrExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void InclusiveOrExpression():
+{/*@bgen(jjtree) InclusiveOrExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTINCLUSIVEOREXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) InclusiveOrExpression */
+ try {
+/*@egen*/
+ ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ExclusiveOrExpression():
+{/*@bgen(jjtree) ExclusiveOrExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXCLUSIVEOREXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ExclusiveOrExpression */
+ try {
+/*@egen*/
+ AndExpression() ( "^" AndExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AndExpression():
+{/*@bgen(jjtree) AndExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTANDEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AndExpression */
+ try {
+/*@egen*/
+ EqualityExpression() ( "&" EqualityExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void EqualityExpression():
+{/*@bgen(jjtree) EqualityExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEQUALITYEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) EqualityExpression */
+ try {
+/*@egen*/
+ InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void InstanceOfExpression():
+{/*@bgen(jjtree) InstanceOfExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTINSTANCEOFEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) InstanceOfExpression */
+ try {
+/*@egen*/
+ RelationalExpression() [ "instanceof" Type() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void RelationalExpression():
+{/*@bgen(jjtree) RelationalExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTRELATIONALEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) RelationalExpression */
+ try {
+/*@egen*/
+ ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ShiftExpression():
+{/*@bgen(jjtree) ShiftExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTSHIFTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ShiftExpression */
+ try {
+/*@egen*/
+ AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AdditiveExpression():
+{/*@bgen(jjtree) AdditiveExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTADDITIVEEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AdditiveExpression */
+ try {
+/*@egen*/
+ MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MultiplicativeExpression():
+{/*@bgen(jjtree) MultiplicativeExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTMULTIPLICATIVEEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MultiplicativeExpression */
+ try {
+/*@egen*/
+ UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void UnaryExpression():
+{/*@bgen(jjtree) UnaryExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) UnaryExpression */
+ try {
+/*@egen*/
+ ( "+" | "-" ) UnaryExpression()
+|
+ PreIncrementExpression()
+|
+ PreDecrementExpression()
+|
+ UnaryExpressionNotPlusMinus()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PreIncrementExpression():
+{/*@bgen(jjtree) PreIncrementExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPREINCREMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PreIncrementExpression */
+ try {
+/*@egen*/
+ "++" PrimaryExpression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PreDecrementExpression():
+{/*@bgen(jjtree) PreDecrementExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPREDECREMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PreDecrementExpression */
+ try {
+/*@egen*/
+ "--" PrimaryExpression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void UnaryExpressionNotPlusMinus():
+{/*@bgen(jjtree) UnaryExpressionNotPlusMinus */
+ SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSIONNOTPLUSMINUS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) UnaryExpressionNotPlusMinus */
+ try {
+/*@egen*/
+ ( "~" | "!" ) UnaryExpression()
+|
+ LOOKAHEAD( CastLookahead() )
+ CastExpression()
+|
+ PostfixExpression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+// This production is to determine lookahead only. The LOOKAHEAD specifications
+// below are not used, but they are there just to indicate that we know about
+// this.
+void CastLookahead():
+{/*@bgen(jjtree) CastLookahead */
+ SimpleNode jjtn000 = new SimpleNode(JJTCASTLOOKAHEAD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) CastLookahead */
+ try {
+/*@egen*/
+ LOOKAHEAD(2)
+ "(" PrimitiveType()
+|
+ LOOKAHEAD("(" Type() "[")
+ "(" Type() "[" "]"
+|
+ "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() )/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PostfixExpression():
+{/*@bgen(jjtree) PostfixExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PostfixExpression */
+ try {
+/*@egen*/
+ PrimaryExpression() [ PostfixOperator() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PostfixOperator():
+{/*@bgen(jjtree) PostfixOperator */
+ SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXOPERATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PostfixOperator */
+ try {
+/*@egen*/
+ "++" | "--"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void CastExpression():
+{/*@bgen(jjtree) CastExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCASTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) CastExpression */
+ try {
+/*@egen*/
+ LOOKAHEAD("(" PrimitiveType())
+ "(" Type() ")" UnaryExpression()
+|
+ "(" Type() ")" UnaryExpressionNotPlusMinus()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PrimaryExpression():
+{/*@bgen(jjtree) PrimaryExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PrimaryExpression */
+ try {
+/*@egen*/
+ PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MemberSelector():
+{/*@bgen(jjtree) MemberSelector */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERSELECTOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MemberSelector */
+ try {
+/*@egen*/
+ "." TypeArguments() <IDENTIFIER>/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PrimaryPrefix():
+{/*@bgen(jjtree) PrimaryPrefix */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYPREFIX);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PrimaryPrefix */
+ try {
+/*@egen*/
+ Literal()
+|
+ LOOKAHEAD( ( <IDENTIFIER> "." )* "this" )
+ ( <IDENTIFIER> "." )*
+ "this"
+|
+ "super" "." <IDENTIFIER>
+|
+ "(" Expression() ")"
+|
+ AllocationExpression()
+|
+ LOOKAHEAD( ResultType() "." "class" )
+ ResultType() "." "class"
+|
+ Name()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void PrimarySuffix():
+{/*@bgen(jjtree) PrimarySuffix */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYSUFFIX);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) PrimarySuffix */
+ try {
+/*@egen*/
+ LOOKAHEAD("." "super" ".")
+ "." "super"
+|
+ LOOKAHEAD("." "this")
+ "." "this"
+|
+ LOOKAHEAD(2)
+ "." AllocationExpression()
+|
+ LOOKAHEAD(3)
+ MemberSelector()
+|
+ "[" Expression() "]"
+|
+ "." <IDENTIFIER>
+|
+ Arguments()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void Literal():
+{/*@bgen(jjtree) Literal */
+ SimpleNode jjtn000 = new SimpleNode(JJTLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Literal */
+ try {
+/*@egen*/
+ <INTEGER_LITERAL>
+|
+ <FLOATING_POINT_LITERAL>
+|
+ <CHARACTER_LITERAL>
+|
+ <STRING_LITERAL>
+|
+ BooleanLiteral()
+|
+ NullLiteral()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void BooleanLiteral():
+{/*@bgen(jjtree) BooleanLiteral */
+ SimpleNode jjtn000 = new SimpleNode(JJTBOOLEANLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) BooleanLiteral */
+ try {
+/*@egen*/
+ "true"
+|
+ "false"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void NullLiteral():
+{/*@bgen(jjtree) NullLiteral */
+ SimpleNode jjtn000 = new SimpleNode(JJTNULLLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) NullLiteral */
+ try {
+/*@egen*/
+ "null"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void Arguments():
+{/*@bgen(jjtree) Arguments */
+ SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Arguments */
+ try {
+/*@egen*/
+ "(" [ ArgumentList() ] ")"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ArgumentList():
+{/*@bgen(jjtree) ArgumentList */
+ SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ArgumentList */
+ try {
+/*@egen*/
+ Expression() ( "," Expression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AllocationExpression():
+{/*@bgen(jjtree) AllocationExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTALLOCATIONEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AllocationExpression */
+ try {
+/*@egen*/
+ LOOKAHEAD(2)
+ "new" PrimitiveType() ArrayDimsAndInits()
+|
+ "new" ClassOrInterfaceType() [ TypeArguments() ]
+ (
+ ArrayDimsAndInits()
+ |
+ Arguments() [ ClassOrInterfaceBody(false) ]
+ )/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/*
+ * The third LOOKAHEAD specification below is to parse to PrimarySuffix
+ * if there is an expression between the "[...]".
+ */
+void ArrayDimsAndInits():
+{/*@bgen(jjtree) ArrayDimsAndInits */
+ SimpleNode jjtn000 = new SimpleNode(JJTARRAYDIMSANDINITS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ArrayDimsAndInits */
+ try {
+/*@egen*/
+ LOOKAHEAD(2)
+ ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )*
+|
+ ( "[" "]" )+ ArrayInitializer()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+/*
+ * Statement syntax follows.
+ */
+
+void Statement():
+{/*@bgen(jjtree) Statement */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Statement */
+ try {
+/*@egen*/
+ LOOKAHEAD(2)
+ LabeledStatement()
+|
+ AssertStatement()
+|
+ Block()
+|
+ EmptyStatement()
+|
+ StatementExpression() ";"
+|
+ SwitchStatement()
+|
+ IfStatement()
+|
+ WhileStatement()
+|
+ DoStatement()
+|
+ ForStatement()
+|
+ BreakStatement()
+|
+ ContinueStatement()
+|
+ ReturnStatement()
+|
+ ThrowStatement()
+|
+ SynchronizedStatement()
+|
+ TryStatement()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AssertStatement():
+{/*@bgen(jjtree) AssertStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTASSERTSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AssertStatement */
+ try {
+/*@egen*/
+ "assert" Expression() [ ":" Expression() ] ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void LabeledStatement():
+{/*@bgen(jjtree) LabeledStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTLABELEDSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) LabeledStatement */
+ try {
+/*@egen*/
+ <IDENTIFIER> ":" Statement()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void Block():
+{/*@bgen(jjtree) Block */
+ SimpleNode jjtn000 = new SimpleNode(JJTBLOCK);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Block */
+ try {
+/*@egen*/
+ "{" ( BlockStatement() )* "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void BlockStatement():
+{/*@bgen(jjtree) BlockStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTBLOCKSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) BlockStatement */
+ try {
+/*@egen*/
+ LOOKAHEAD( Modifiers() Type() <IDENTIFIER> )
+ LocalVariableDeclaration() ";"
+|
+ Statement()
+|
+ ClassOrInterfaceDeclaration(0)/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void LocalVariableDeclaration():
+{/*@bgen(jjtree) LocalVariableDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTLOCALVARIABLEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) LocalVariableDeclaration */
+ try {
+/*@egen*/
+ Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void EmptyStatement():
+{/*@bgen(jjtree) EmptyStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTEMPTYSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) EmptyStatement */
+ try {
+/*@egen*/
+ ";"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void StatementExpression():
+{/*@bgen(jjtree) StatementExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) StatementExpression */
+ try {
+/*@egen*/
+ PreIncrementExpression()
+|
+ PreDecrementExpression()
+|
+ LOOKAHEAD(PrimaryExpression() AssignmentOperator())
+ AssignmentExpression()
+|
+ PostfixExpression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void SwitchStatement():
+{/*@bgen(jjtree) SwitchStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTSWITCHSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) SwitchStatement */
+ try {
+/*@egen*/
+ "switch" "(" Expression() ")" "{"
+ ( SwitchLabel() ( BlockStatement() )* )*
+ "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void SwitchLabel():
+{/*@bgen(jjtree) SwitchLabel */
+ SimpleNode jjtn000 = new SimpleNode(JJTSWITCHLABEL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) SwitchLabel */
+ try {
+/*@egen*/
+ "case" Expression() ":"
+|
+ "default" ":"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void IfStatement():
+/*
+ * The disambiguating algorithm of JavaCC automatically binds dangling
+ * else's to the innermost if statement. The LOOKAHEAD specification
+ * is to tell JavaCC that we know what we are doing.
+ */
+{/*@bgen(jjtree) IfStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTIFSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) IfStatement */
+ try {
+/*@egen*/
+ "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void WhileStatement():
+{/*@bgen(jjtree) WhileStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTWHILESTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) WhileStatement */
+ try {
+/*@egen*/
+ "while" "(" Expression() ")" Statement()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void DoStatement():
+{/*@bgen(jjtree) DoStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTDOSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) DoStatement */
+ try {
+/*@egen*/
+ "do" Statement() "while" "(" Expression() ")" ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ForStatement():
+{/*@bgen(jjtree) ForStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ForStatement */
+ try {
+/*@egen*/
+ "for" "("
+
+ (
+ LOOKAHEAD(Modifiers() Type() <IDENTIFIER> ":")
+ Modifiers() Type() <IDENTIFIER> ":" Expression()
+ |
+ [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ]
+ )
+
+ ")" Statement()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ForInit():
+{/*@bgen(jjtree) ForInit */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORINIT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ForInit */
+ try {
+/*@egen*/
+ LOOKAHEAD( Modifiers() Type() <IDENTIFIER> )
+ LocalVariableDeclaration()
+|
+ StatementExpressionList()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void StatementExpressionList():
+{/*@bgen(jjtree) StatementExpressionList */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSIONLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) StatementExpressionList */
+ try {
+/*@egen*/
+ StatementExpression() ( "," StatementExpression() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ForUpdate():
+{/*@bgen(jjtree) ForUpdate */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORUPDATE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ForUpdate */
+ try {
+/*@egen*/
+ StatementExpressionList()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void BreakStatement():
+{/*@bgen(jjtree) BreakStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTBREAKSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) BreakStatement */
+ try {
+/*@egen*/
+ "break" [ <IDENTIFIER> ] ";"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ContinueStatement():
+{/*@bgen(jjtree) ContinueStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONTINUESTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ContinueStatement */
+ try {
+/*@egen*/
+ "continue" [ <IDENTIFIER> ] ";"/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ReturnStatement():
+{/*@bgen(jjtree) ReturnStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTRETURNSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ReturnStatement */
+ try {
+/*@egen*/
+ "return" [ Expression() ] ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void ThrowStatement():
+{/*@bgen(jjtree) ThrowStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTTHROWSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) ThrowStatement */
+ try {
+/*@egen*/
+ "throw" Expression() ";"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void SynchronizedStatement():
+{/*@bgen(jjtree) SynchronizedStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTSYNCHRONIZEDSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) SynchronizedStatement */
+ try {
+/*@egen*/
+ "synchronized" "(" Expression() ")" Block()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void TryStatement():
+/*
+ * Semantic check required here to make sure that at least one
+ * finally/catch is present.
+ */
+{/*@bgen(jjtree) TryStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTTRYSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) TryStatement */
+ try {
+/*@egen*/
+ "try" Block()
+ ( "catch" "(" FormalParameter() ")" Block() )*
+ [ "finally" Block() ]/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/* We use productions to match >>>, >> and > so that we can keep the
+ * type declaration syntax with generics clean
+ */
+
+void RUNSIGNEDSHIFT():
+{/*@bgen(jjtree) RUNSIGNEDSHIFT */
+ SimpleNode jjtn000 = new SimpleNode(JJTRUNSIGNEDSHIFT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) RUNSIGNEDSHIFT */
+ try {
+/*@egen*/
+ ( LOOKAHEAD({ getToken(1).kind == GT &&
+ ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} )
+ ">" ">" ">"
+ )/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void RSIGNEDSHIFT():
+{/*@bgen(jjtree) RSIGNEDSHIFT */
+ SimpleNode jjtn000 = new SimpleNode(JJTRSIGNEDSHIFT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) RSIGNEDSHIFT */
+ try {
+/*@egen*/
+ ( LOOKAHEAD({ getToken(1).kind == GT &&
+ ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} )
+ ">" ">"
+ )/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+/* Annotation syntax follows. */
+
+void Annotation():
+{/*@bgen(jjtree) Annotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) Annotation */
+ try {
+/*@egen*/
+ LOOKAHEAD( "@" Name() "(" ( <IDENTIFIER> "=" | ")" ))
+ NormalAnnotation()
+ |
+ LOOKAHEAD( "@" Name() "(" )
+ SingleMemberAnnotation()
+ |
+ MarkerAnnotation()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void NormalAnnotation():
+{/*@bgen(jjtree) NormalAnnotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTNORMALANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) NormalAnnotation */
+ try {
+/*@egen*/
+ "@" Name() "(" [ MemberValuePairs() ] ")"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MarkerAnnotation():
+{/*@bgen(jjtree) MarkerAnnotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTMARKERANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MarkerAnnotation */
+ try {
+/*@egen*/
+ "@" Name()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void SingleMemberAnnotation():
+{/*@bgen(jjtree) SingleMemberAnnotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTSINGLEMEMBERANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) SingleMemberAnnotation */
+ try {
+/*@egen*/
+ "@" Name() "(" MemberValue() ")"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MemberValuePairs():
+{/*@bgen(jjtree) MemberValuePairs */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIRS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MemberValuePairs */
+ try {
+/*@egen*/
+ MemberValuePair() ( "," MemberValuePair() )*/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MemberValuePair():
+{/*@bgen(jjtree) MemberValuePair */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MemberValuePair */
+ try {
+/*@egen*/
+ <IDENTIFIER> "=" MemberValue()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MemberValue():
+{/*@bgen(jjtree) MemberValue */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MemberValue */
+ try {
+/*@egen*/
+ Annotation()
+ |
+ MemberValueArrayInitializer()
+ |
+ ConditionalExpression()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void MemberValueArrayInitializer():
+{/*@bgen(jjtree) MemberValueArrayInitializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEARRAYINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) MemberValueArrayInitializer */
+ try {
+/*@egen*/
+ "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+
+/* Annotation Types. */
+
+void AnnotationTypeDeclaration(int modifiers):
+{/*@bgen(jjtree) AnnotationTypeDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AnnotationTypeDeclaration */
+ try {
+/*@egen*/
+ "@" "interface" <IDENTIFIER> AnnotationTypeBody()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AnnotationTypeBody():
+{/*@bgen(jjtree) AnnotationTypeBody */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEBODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) AnnotationTypeBody */
+ try {
+/*@egen*/
+ "{" ( AnnotationTypeMemberDeclaration() )* "}"/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void AnnotationTypeMemberDeclaration():
+{/*@bgen(jjtree) AnnotationTypeMemberDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEMEMBERDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/
+ int modifiers;
+}
+{/*@bgen(jjtree) AnnotationTypeMemberDeclaration */
+ try {
+/*@egen*/
+ modifiers = Modifiers()
+ (
+ LOOKAHEAD(Type() <IDENTIFIER> "(")
+ Type() <IDENTIFIER> "(" ")" [ DefaultValue() ] ";"
+ |
+ ClassOrInterfaceDeclaration(modifiers)
+ |
+ EnumDeclaration(modifiers)
+ |
+ AnnotationTypeDeclaration(modifiers)
+ |
+ FieldDeclaration(modifiers)
+ )
+ |
+ ( ";" )/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
+
+void DefaultValue():
+{/*@bgen(jjtree) DefaultValue */
+ SimpleNode jjtn000 = new SimpleNode(JJTDEFAULTVALUE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) DefaultValue */
+ try {
+/*@egen*/
+ "default" MemberValue()/*@bgen(jjtree)*/
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ throw (RuntimeException)jjte000;
+ }
+ if (jjte000 instanceof ParseException) {
+ throw (ParseException)jjte000;
+ }
+ throw (Error)jjte000;
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+/*@egen*/
+}
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jjt
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jjt (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jjt 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,2150 @@
+
+/*
+ * Copyright © 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has
+ * intellectual property rights relating to technology embodied in the product
+ * that is described in this document. In particular, and without limitation,
+ * these intellectual property rights may include one or more of the U.S.
+ * patents listed at http://www.sun.com/patents and one or more additional
+ * patents or pending patent applications in the U.S. and in other countries.
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements. Use is subject to license terms.
+ * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This
+ * product is covered and controlled by U.S. Export Control laws and may be
+ * subject to the export or import laws in other countries. Nuclear, missile,
+ * chemical biological weapons or nuclear maritime end uses or end users,
+ * whether direct or indirect, are strictly prohibited. Export or reexport
+ * to countries subject to U.S. embargo or to entities identified on U.S.
+ * export exclusion lists, including, but not limited to, the denied persons
+ * and specially designated nationals lists is strictly prohibited.
+ */
+
+// Slightly modified version of javacc's reference 1.5 grammar, tweaked for
+// usage with JAXX. There are two main areas of changes: several new
+// nonterminals were added to make identifying certain constructs easier,
+// and the Line nonterminal was added to support JAXX's script tags.
+// Several of the new changes are inefficient and require excess lookahead,
+// but at this point I'd rather have inefficiency than risk breaking it during
+// attempted optimizations.
+
+options {
+ JAVA_UNICODE_ESCAPE = true;
+ ERROR_REPORTING = false;
+ STATIC = false;
+ JDK_VERSION = "1.4";
+ NODE_SCOPE_HOOK=true;
+}
+
+PARSER_BEGIN(JavaParser)
+package jaxx.parser;
+
+import java.io.*;
+
+/**
+ * Grammar to parse Java version 1.5
+ * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5
+ */
+public class JavaParser
+{
+ /**
+ * Class to hold modifiers.
+ */
+ static public final class ModifierSet
+ {
+ /* Definitions of the bits in the modifiers field. */
+ public static final int PUBLIC = 0x0001;
+ public static final int PROTECTED = 0x0002;
+ public static final int PRIVATE = 0x0004;
+ public static final int ABSTRACT = 0x0008;
+ public static final int STATIC = 0x0010;
+ public static final int FINAL = 0x0020;
+ public static final int SYNCHRONIZED = 0x0040;
+ public static final int NATIVE = 0x0080;
+ public static final int TRANSIENT = 0x0100;
+ public static final int VOLATILE = 0x0200;
+ public static final int STRICTFP = 0x1000;
+
+ /** A set of accessors that indicate whether the specified modifier
+ is in the set. */
+
+ public boolean isPublic(int modifiers)
+ {
+ return (modifiers & PUBLIC) != 0;
+ }
+
+ public boolean isProtected(int modifiers)
+ {
+ return (modifiers & PROTECTED) != 0;
+ }
+
+ public boolean isPrivate(int modifiers)
+ {
+ return (modifiers & PRIVATE) != 0;
+ }
+
+ public boolean isStatic(int modifiers)
+ {
+ return (modifiers & STATIC) != 0;
+ }
+
+ public boolean isAbstract(int modifiers)
+ {
+ return (modifiers & ABSTRACT) != 0;
+ }
+
+ public boolean isFinal(int modifiers)
+ {
+ return (modifiers & FINAL) != 0;
+ }
+
+ public boolean isNative(int modifiers)
+ {
+ return (modifiers & NATIVE) != 0;
+ }
+
+ public boolean isStrictfp(int modifiers)
+ {
+ return (modifiers & STRICTFP) != 0;
+ }
+
+ public boolean isSynchronized(int modifiers)
+ {
+ return (modifiers & SYNCHRONIZED) != 0;
+ }
+
+ public boolean isTransient(int modifiers)
+ {
+ return (modifiers & TRANSIENT) != 0;
+ }
+
+ public boolean isVolatile(int modifiers)
+ {
+ return (modifiers & VOLATILE) != 0;
+ }
+
+ /**
+ * Removes the given modifier.
+ */
+ static int removeModifier(int modifiers, int mod)
+ {
+ return modifiers & ~mod;
+ }
+ }
+
+ public JavaParser(String fileName)
+ {
+ this(System.in);
+ try { ReInit(new FileInputStream(new File(fileName))); }
+ catch(Exception e) { e.printStackTrace(); }
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode) n).firstToken = getToken(1);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode) n).lastToken = getToken(0);
+ }
+
+ public SimpleNode popNode()
+ {
+ if ( jjtree.nodeArity() > 0) // number of child nodes
+ return (SimpleNode)jjtree.popNode();
+ else
+ return null;
+ }
+ public static void main(String args[]) {
+ JavaParser parser;
+ if (args.length == 0) {
+ System.out.println("Java Parser Version 1.1: Reading from standard input . . .");
+ parser = new JavaParser(System.in);
+ } else if (args.length == 1) {
+ System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . .");
+ try {
+ parser = new JavaParser(new java.io.FileInputStream(args[0]));
+ } catch (java.io.FileNotFoundException e) {
+ System.out.println("Java Parser Version 1.1: File " + args[0] + " not found.");
+ return;
+ }
+ } else {
+ System.out.println("Java Parser Version 1.1: Usage is one of:");
+ System.out.println(" java JavaParser < inputfile");
+ System.out.println("OR");
+ System.out.println(" java JavaParser inputfile");
+ return;
+ }
+ try {
+ parser.CompilationUnit();
+ System.out.println("Java Parser Version 1.1: Java program parsed successfully.");
+ } catch (ParseException e) {
+ System.out.println(e.getMessage());
+ System.out.println("Java Parser Version 1.1: Encountered errors during parse.");
+ }
+ }
+
+}
+
+PARSER_END(JavaParser)
+
+/* COMMENTS */
+
+MORE :
+{
+ <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
+|
+ "/*" : IN_MULTI_LINE_COMMENT
+}
+
+SPECIAL_TOKEN:
+{
+ <WHITE_SPACE: ([" ", "\n", "\r", "\t", "\f"])+>
+}
+
+SPECIAL_TOKEN :
+{
+ <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?>
+}
+
+<IN_FORMAL_COMMENT>
+SPECIAL_TOKEN :
+{
+ <FORMAL_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_MULTI_LINE_COMMENT>
+SPECIAL_TOKEN :
+{
+ <MULTI_LINE_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
+MORE :
+{
+ < ~[] >
+}
+
+/* RESERVED WORDS AND LITERALS */
+
+TOKEN :
+{
+ < ABSTRACT: "abstract" >
+| < ASSERT: "assert" >
+| < BOOLEAN: "boolean" >
+| < BREAK: "break" >
+| < BYTE: "byte" >
+| < CASE: "case" >
+| < CATCH: "catch" >
+| < CHAR: "char" >
+| < CLASS: "class" >
+| < CONST: "const" >
+| < CONTINUE: "continue" >
+| < _DEFAULT: "default" >
+| < DO: "do" >
+| < DOUBLE: "double" >
+| < ELSE: "else" >
+| < ENUM: "enum" >
+| < EXTENDS: "extends" >
+| < FALSE: "false" >
+| < FINAL: "final" >
+| < FINALLY: "finally" >
+| < FLOAT: "float" >
+| < FOR: "for" >
+| < GOTO: "goto" >
+| < IF: "if" >
+| < IMPLEMENTS: "implements" >
+| < IMPORT: "import" >
+| < INSTANCEOF: "instanceof" >
+| < INT: "int" >
+| < INTERFACE: "interface" >
+| < LONG: "long" >
+| < NATIVE: "native" >
+| < NEW: "new" >
+| < NULL: "null" >
+| < PACKAGE: "package">
+| < PRIVATE: "private" >
+| < PROTECTED: "protected" >
+| < PUBLIC: "public" >
+| < RETURN: "return" >
+| < SHORT: "short" >
+| < STATIC: "static" >
+| < STRICTFP: "strictfp" >
+| < SUPER: "super" >
+| < SWITCH: "switch" >
+| < SYNCHRONIZED: "synchronized" >
+| < THIS: "this" >
+| < THROW: "throw" >
+| < THROWS: "throws" >
+| < TRANSIENT: "transient" >
+| < TRUE: "true" >
+| < TRY: "try" >
+| < VOID: "void" >
+| < VOLATILE: "volatile" >
+| < WHILE: "while" >
+}
+
+/* LITERALS */
+
+TOKEN :
+{
+ < INTEGER_LITERAL:
+ <DECIMAL_LITERAL> (["l","L"])?
+ | <HEX_LITERAL> (["l","L"])?
+ | <OCTAL_LITERAL> (["l","L"])?
+ >
+|
+ < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+|
+ < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+ < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+|
+ < FLOATING_POINT_LITERAL:
+ <DECIMAL_FLOATING_POINT_LITERAL>
+ | <HEXADECIMAL_FLOATING_POINT_LITERAL>
+ >
+|
+ < #DECIMAL_FLOATING_POINT_LITERAL:
+ (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
+ | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])?
+ | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])?
+ | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"]
+ >
+|
+ < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+|
+ < #HEXADECIMAL_FLOATING_POINT_LITERAL:
+ "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
+ | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?
+ >
+|
+ < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ >
+|
+ < CHARACTER_LITERAL:
+ "'"
+ ( (~["'","\\","\n","\r"])
+ | ("\\"
+ ( ["n","t","b","r","f","\\","'","\""]
+ | ["0"-"7"] ( ["0"-"7"] )?
+ | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+ )
+ )
+ )
+ "'"
+ >
+|
+ < STRING_LITERAL:
+ "\""
+ ( (~["\"","\\","\n","\r"])
+ | ("\\"
+ ( ["n","t","b","r","f","\\","'","\""]
+ | ["0"-"7"] ( ["0"-"7"] )?
+ | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+ )
+ )
+ )*
+ "\""
+ >
+}
+
+/* IDENTIFIERS */
+
+TOKEN :
+{
+ < IDENTIFIER: <LETTER> (<PART_LETTER>)* >
+|
+ < #LETTER:
+ [ // all chars for which Character.isIdentifierStart is true
+ "$",
+ "A"-"Z",
+ "_",
+ "a"-"z",
+ "\u00a2"-"\u00a5",
+ "\u00aa",
+ "\u00b5",
+ "\u00ba",
+ "\u00c0"-"\u00d6",
+ "\u00d8"-"\u00f6",
+ "\u00f8"-"\u021f",
+ "\u0222"-"\u0233",
+ "\u0250"-"\u02ad",
+ "\u02b0"-"\u02b8",
+ "\u02bb"-"\u02c1",
+ "\u02d0"-"\u02d1",
+ "\u02e0"-"\u02e4",
+ "\u02ee",
+ "\u037a",
+ "\u0386",
+ "\u0388"-"\u038a",
+ "\u038c",
+ "\u038e"-"\u03a1",
+ "\u03a3"-"\u03ce",
+ "\u03d0"-"\u03d7",
+ "\u03da"-"\u03f3",
+ "\u0400"-"\u0481",
+ "\u048c"-"\u04c4",
+ "\u04c7"-"\u04c8",
+ "\u04cb"-"\u04cc",
+ "\u04d0"-"\u04f5",
+ "\u04f8"-"\u04f9",
+ "\u0531"-"\u0556",
+ "\u0559",
+ "\u0561"-"\u0587",
+ "\u05d0"-"\u05ea",
+ "\u05f0"-"\u05f2",
+ "\u0621"-"\u063a",
+ "\u0640"-"\u064a",
+ "\u0671"-"\u06d3",
+ "\u06d5",
+ "\u06e5"-"\u06e6",
+ "\u06fa"-"\u06fc",
+ "\u0710",
+ "\u0712"-"\u072c",
+ "\u0780"-"\u07a5",
+ "\u0905"-"\u0939",
+ "\u093d",
+ "\u0950",
+ "\u0958"-"\u0961",
+ "\u0985"-"\u098c",
+ "\u098f"-"\u0990",
+ "\u0993"-"\u09a8",
+ "\u09aa"-"\u09b0",
+ "\u09b2",
+ "\u09b6"-"\u09b9",
+ "\u09dc"-"\u09dd",
+ "\u09df"-"\u09e1",
+ "\u09f0"-"\u09f3",
+ "\u0a05"-"\u0a0a",
+ "\u0a0f"-"\u0a10",
+ "\u0a13"-"\u0a28",
+ "\u0a2a"-"\u0a30",
+ "\u0a32"-"\u0a33",
+ "\u0a35"-"\u0a36",
+ "\u0a38"-"\u0a39",
+ "\u0a59"-"\u0a5c",
+ "\u0a5e",
+ "\u0a72"-"\u0a74",
+ "\u0a85"-"\u0a8b",
+ "\u0a8d",
+ "\u0a8f"-"\u0a91",
+ "\u0a93"-"\u0aa8",
+ "\u0aaa"-"\u0ab0",
+ "\u0ab2"-"\u0ab3",
+ "\u0ab5"-"\u0ab9",
+ "\u0abd",
+ "\u0ad0",
+ "\u0ae0",
+ "\u0b05"-"\u0b0c",
+ "\u0b0f"-"\u0b10",
+ "\u0b13"-"\u0b28",
+ "\u0b2a"-"\u0b30",
+ "\u0b32"-"\u0b33",
+ "\u0b36"-"\u0b39",
+ "\u0b3d",
+ "\u0b5c"-"\u0b5d",
+ "\u0b5f"-"\u0b61",
+ "\u0b85"-"\u0b8a",
+ "\u0b8e"-"\u0b90",
+ "\u0b92"-"\u0b95",
+ "\u0b99"-"\u0b9a",
+ "\u0b9c",
+ "\u0b9e"-"\u0b9f",
+ "\u0ba3"-"\u0ba4",
+ "\u0ba8"-"\u0baa",
+ "\u0bae"-"\u0bb5",
+ "\u0bb7"-"\u0bb9",
+ "\u0c05"-"\u0c0c",
+ "\u0c0e"-"\u0c10",
+ "\u0c12"-"\u0c28",
+ "\u0c2a"-"\u0c33",
+ "\u0c35"-"\u0c39",
+ "\u0c60"-"\u0c61",
+ "\u0c85"-"\u0c8c",
+ "\u0c8e"-"\u0c90",
+ "\u0c92"-"\u0ca8",
+ "\u0caa"-"\u0cb3",
+ "\u0cb5"-"\u0cb9",
+ "\u0cde",
+ "\u0ce0"-"\u0ce1",
+ "\u0d05"-"\u0d0c",
+ "\u0d0e"-"\u0d10",
+ "\u0d12"-"\u0d28",
+ "\u0d2a"-"\u0d39",
+ "\u0d60"-"\u0d61",
+ "\u0d85"-"\u0d96",
+ "\u0d9a"-"\u0db1",
+ "\u0db3"-"\u0dbb",
+ "\u0dbd",
+ "\u0dc0"-"\u0dc6",
+ "\u0e01"-"\u0e30",
+ "\u0e32"-"\u0e33",
+ "\u0e3f"-"\u0e46",
+ "\u0e81"-"\u0e82",
+ "\u0e84",
+ "\u0e87"-"\u0e88",
+ "\u0e8a",
+ "\u0e8d",
+ "\u0e94"-"\u0e97",
+ "\u0e99"-"\u0e9f",
+ "\u0ea1"-"\u0ea3",
+ "\u0ea5",
+ "\u0ea7",
+ "\u0eaa"-"\u0eab",
+ "\u0ead"-"\u0eb0",
+ "\u0eb2"-"\u0eb3",
+ "\u0ebd",
+ "\u0ec0"-"\u0ec4",
+ "\u0ec6",
+ "\u0edc"-"\u0edd",
+ "\u0f00",
+ "\u0f40"-"\u0f47",
+ "\u0f49"-"\u0f6a",
+ "\u0f88"-"\u0f8b",
+ "\u1000"-"\u1021",
+ "\u1023"-"\u1027",
+ "\u1029"-"\u102a",
+ "\u1050"-"\u1055",
+ "\u10a0"-"\u10c5",
+ "\u10d0"-"\u10f6",
+ "\u1100"-"\u1159",
+ "\u115f"-"\u11a2",
+ "\u11a8"-"\u11f9",
+ "\u1200"-"\u1206",
+ "\u1208"-"\u1246",
+ "\u1248",
+ "\u124a"-"\u124d",
+ "\u1250"-"\u1256",
+ "\u1258",
+ "\u125a"-"\u125d",
+ "\u1260"-"\u1286",
+ "\u1288",
+ "\u128a"-"\u128d",
+ "\u1290"-"\u12ae",
+ "\u12b0",
+ "\u12b2"-"\u12b5",
+ "\u12b8"-"\u12be",
+ "\u12c0",
+ "\u12c2"-"\u12c5",
+ "\u12c8"-"\u12ce",
+ "\u12d0"-"\u12d6",
+ "\u12d8"-"\u12ee",
+ "\u12f0"-"\u130e",
+ "\u1310",
+ "\u1312"-"\u1315",
+ "\u1318"-"\u131e",
+ "\u1320"-"\u1346",
+ "\u1348"-"\u135a",
+ "\u13a0"-"\u13f4",
+ "\u1401"-"\u166c",
+ "\u166f"-"\u1676",
+ "\u1681"-"\u169a",
+ "\u16a0"-"\u16ea",
+ "\u1780"-"\u17b3",
+ "\u17db",
+ "\u1820"-"\u1877",
+ "\u1880"-"\u18a8",
+ "\u1e00"-"\u1e9b",
+ "\u1ea0"-"\u1ef9",
+ "\u1f00"-"\u1f15",
+ "\u1f18"-"\u1f1d",
+ "\u1f20"-"\u1f45",
+ "\u1f48"-"\u1f4d",
+ "\u1f50"-"\u1f57",
+ "\u1f59",
+ "\u1f5b",
+ "\u1f5d",
+ "\u1f5f"-"\u1f7d",
+ "\u1f80"-"\u1fb4",
+ "\u1fb6"-"\u1fbc",
+ "\u1fbe",
+ "\u1fc2"-"\u1fc4",
+ "\u1fc6"-"\u1fcc",
+ "\u1fd0"-"\u1fd3",
+ "\u1fd6"-"\u1fdb",
+ "\u1fe0"-"\u1fec",
+ "\u1ff2"-"\u1ff4",
+ "\u1ff6"-"\u1ffc",
+ "\u203f"-"\u2040",
+ "\u207f",
+ "\u20a0"-"\u20af",
+ "\u2102",
+ "\u2107",
+ "\u210a"-"\u2113",
+ "\u2115",
+ "\u2119"-"\u211d",
+ "\u2124",
+ "\u2126",
+ "\u2128",
+ "\u212a"-"\u212d",
+ "\u212f"-"\u2131",
+ "\u2133"-"\u2139",
+ "\u2160"-"\u2183",
+ "\u3005"-"\u3007",
+ "\u3021"-"\u3029",
+ "\u3031"-"\u3035",
+ "\u3038"-"\u303a",
+ "\u3041"-"\u3094",
+ "\u309d"-"\u309e",
+ "\u30a1"-"\u30fe",
+ "\u3105"-"\u312c",
+ "\u3131"-"\u318e",
+ "\u31a0"-"\u31b7",
+ "\u3400"-"\u4db5",
+ "\u4e00"-"\u9fa5",
+ "\ua000"-"\ua48c",
+ "\uac00"-"\ud7a3",
+ "\uf900"-"\ufa2d",
+ "\ufb00"-"\ufb06",
+ "\ufb13"-"\ufb17",
+ "\ufb1d",
+ "\ufb1f"-"\ufb28",
+ "\ufb2a"-"\ufb36",
+ "\ufb38"-"\ufb3c",
+ "\ufb3e",
+ "\ufb40"-"\ufb41",
+ "\ufb43"-"\ufb44",
+ "\ufb46"-"\ufbb1",
+ "\ufbd3"-"\ufd3d",
+ "\ufd50"-"\ufd8f",
+ "\ufd92"-"\ufdc7",
+ "\ufdf0"-"\ufdfb",
+ "\ufe33"-"\ufe34",
+ "\ufe4d"-"\ufe4f",
+ "\ufe69",
+ "\ufe70"-"\ufe72",
+ "\ufe74",
+ "\ufe76"-"\ufefc",
+ "\uff04",
+ "\uff21"-"\uff3a",
+ "\uff3f",
+ "\uff41"-"\uff5a",
+ "\uff65"-"\uffbe",
+ "\uffc2"-"\uffc7",
+ "\uffca"-"\uffcf",
+ "\uffd2"-"\uffd7",
+ "\uffda"-"\uffdc",
+ "\uffe0"-"\uffe1",
+ "\uffe5"-"\uffe6"
+ ]
+ >
+|
+ < #PART_LETTER:
+ [ // all chars for which Character.isIdentifierPart is true
+ "\u0000"-"\u0008",
+ "\u000e"-"\u001b",
+ "$",
+ "0"-"9",
+ "A"-"Z",
+ "_",
+ "a"-"z",
+ "\u007f"-"\u009f",
+ "\u00a2"-"\u00a5",
+ "\u00aa",
+ "\u00b5",
+ "\u00ba",
+ "\u00c0"-"\u00d6",
+ "\u00d8"-"\u00f6",
+ "\u00f8"-"\u021f",
+ "\u0222"-"\u0233",
+ "\u0250"-"\u02ad",
+ "\u02b0"-"\u02b8",
+ "\u02bb"-"\u02c1",
+ "\u02d0"-"\u02d1",
+ "\u02e0"-"\u02e4",
+ "\u02ee",
+ "\u0300"-"\u034e",
+ "\u0360"-"\u0362",
+ "\u037a",
+ "\u0386",
+ "\u0388"-"\u038a",
+ "\u038c",
+ "\u038e"-"\u03a1",
+ "\u03a3"-"\u03ce",
+ "\u03d0"-"\u03d7",
+ "\u03da"-"\u03f3",
+ "\u0400"-"\u0481",
+ "\u0483"-"\u0486",
+ "\u048c"-"\u04c4",
+ "\u04c7"-"\u04c8",
+ "\u04cb"-"\u04cc",
+ "\u04d0"-"\u04f5",
+ "\u04f8"-"\u04f9",
+ "\u0531"-"\u0556",
+ "\u0559",
+ "\u0561"-"\u0587",
+ "\u0591"-"\u05a1",
+ "\u05a3"-"\u05b9",
+ "\u05bb"-"\u05bd",
+ "\u05bf",
+ "\u05c1"-"\u05c2",
+ "\u05c4",
+ "\u05d0"-"\u05ea",
+ "\u05f0"-"\u05f2",
+ "\u0621"-"\u063a",
+ "\u0640"-"\u0655",
+ "\u0660"-"\u0669",
+ "\u0670"-"\u06d3",
+ "\u06d5"-"\u06dc",
+ "\u06df"-"\u06e8",
+ "\u06ea"-"\u06ed",
+ "\u06f0"-"\u06fc",
+ "\u070f"-"\u072c",
+ "\u0730"-"\u074a",
+ "\u0780"-"\u07b0",
+ "\u0901"-"\u0903",
+ "\u0905"-"\u0939",
+ "\u093c"-"\u094d",
+ "\u0950"-"\u0954",
+ "\u0958"-"\u0963",
+ "\u0966"-"\u096f",
+ "\u0981"-"\u0983",
+ "\u0985"-"\u098c",
+ "\u098f"-"\u0990",
+ "\u0993"-"\u09a8",
+ "\u09aa"-"\u09b0",
+ "\u09b2",
+ "\u09b6"-"\u09b9",
+ "\u09bc",
+ "\u09be"-"\u09c4",
+ "\u09c7"-"\u09c8",
+ "\u09cb"-"\u09cd",
+ "\u09d7",
+ "\u09dc"-"\u09dd",
+ "\u09df"-"\u09e3",
+ "\u09e6"-"\u09f3",
+ "\u0a02",
+ "\u0a05"-"\u0a0a",
+ "\u0a0f"-"\u0a10",
+ "\u0a13"-"\u0a28",
+ "\u0a2a"-"\u0a30",
+ "\u0a32"-"\u0a33",
+ "\u0a35"-"\u0a36",
+ "\u0a38"-"\u0a39",
+ "\u0a3c",
+ "\u0a3e"-"\u0a42",
+ "\u0a47"-"\u0a48",
+ "\u0a4b"-"\u0a4d",
+ "\u0a59"-"\u0a5c",
+ "\u0a5e",
+ "\u0a66"-"\u0a74",
+ "\u0a81"-"\u0a83",
+ "\u0a85"-"\u0a8b",
+ "\u0a8d",
+ "\u0a8f"-"\u0a91",
+ "\u0a93"-"\u0aa8",
+ "\u0aaa"-"\u0ab0",
+ "\u0ab2"-"\u0ab3",
+ "\u0ab5"-"\u0ab9",
+ "\u0abc"-"\u0ac5",
+ "\u0ac7"-"\u0ac9",
+ "\u0acb"-"\u0acd",
+ "\u0ad0",
+ "\u0ae0",
+ "\u0ae6"-"\u0aef",
+ "\u0b01"-"\u0b03",
+ "\u0b05"-"\u0b0c",
+ "\u0b0f"-"\u0b10",
+ "\u0b13"-"\u0b28",
+ "\u0b2a"-"\u0b30",
+ "\u0b32"-"\u0b33",
+ "\u0b36"-"\u0b39",
+ "\u0b3c"-"\u0b43",
+ "\u0b47"-"\u0b48",
+ "\u0b4b"-"\u0b4d",
+ "\u0b56"-"\u0b57",
+ "\u0b5c"-"\u0b5d",
+ "\u0b5f"-"\u0b61",
+ "\u0b66"-"\u0b6f",
+ "\u0b82"-"\u0b83",
+ "\u0b85"-"\u0b8a",
+ "\u0b8e"-"\u0b90",
+ "\u0b92"-"\u0b95",
+ "\u0b99"-"\u0b9a",
+ "\u0b9c",
+ "\u0b9e"-"\u0b9f",
+ "\u0ba3"-"\u0ba4",
+ "\u0ba8"-"\u0baa",
+ "\u0bae"-"\u0bb5",
+ "\u0bb7"-"\u0bb9",
+ "\u0bbe"-"\u0bc2",
+ "\u0bc6"-"\u0bc8",
+ "\u0bca"-"\u0bcd",
+ "\u0bd7",
+ "\u0be7"-"\u0bef",
+ "\u0c01"-"\u0c03",
+ "\u0c05"-"\u0c0c",
+ "\u0c0e"-"\u0c10",
+ "\u0c12"-"\u0c28",
+ "\u0c2a"-"\u0c33",
+ "\u0c35"-"\u0c39",
+ "\u0c3e"-"\u0c44",
+ "\u0c46"-"\u0c48",
+ "\u0c4a"-"\u0c4d",
+ "\u0c55"-"\u0c56",
+ "\u0c60"-"\u0c61",
+ "\u0c66"-"\u0c6f",
+ "\u0c82"-"\u0c83",
+ "\u0c85"-"\u0c8c",
+ "\u0c8e"-"\u0c90",
+ "\u0c92"-"\u0ca8",
+ "\u0caa"-"\u0cb3",
+ "\u0cb5"-"\u0cb9",
+ "\u0cbe"-"\u0cc4",
+ "\u0cc6"-"\u0cc8",
+ "\u0cca"-"\u0ccd",
+ "\u0cd5"-"\u0cd6",
+ "\u0cde",
+ "\u0ce0"-"\u0ce1",
+ "\u0ce6"-"\u0cef",
+ "\u0d02"-"\u0d03",
+ "\u0d05"-"\u0d0c",
+ "\u0d0e"-"\u0d10",
+ "\u0d12"-"\u0d28",
+ "\u0d2a"-"\u0d39",
+ "\u0d3e"-"\u0d43",
+ "\u0d46"-"\u0d48",
+ "\u0d4a"-"\u0d4d",
+ "\u0d57",
+ "\u0d60"-"\u0d61",
+ "\u0d66"-"\u0d6f",
+ "\u0d82"-"\u0d83",
+ "\u0d85"-"\u0d96",
+ "\u0d9a"-"\u0db1",
+ "\u0db3"-"\u0dbb",
+ "\u0dbd",
+ "\u0dc0"-"\u0dc6",
+ "\u0dca",
+ "\u0dcf"-"\u0dd4",
+ "\u0dd6",
+ "\u0dd8"-"\u0ddf",
+ "\u0df2"-"\u0df3",
+ "\u0e01"-"\u0e3a",
+ "\u0e3f"-"\u0e4e",
+ "\u0e50"-"\u0e59",
+ "\u0e81"-"\u0e82",
+ "\u0e84",
+ "\u0e87"-"\u0e88",
+ "\u0e8a",
+ "\u0e8d",
+ "\u0e94"-"\u0e97",
+ "\u0e99"-"\u0e9f",
+ "\u0ea1"-"\u0ea3",
+ "\u0ea5",
+ "\u0ea7",
+ "\u0eaa"-"\u0eab",
+ "\u0ead"-"\u0eb9",
+ "\u0ebb"-"\u0ebd",
+ "\u0ec0"-"\u0ec4",
+ "\u0ec6",
+ "\u0ec8"-"\u0ecd",
+ "\u0ed0"-"\u0ed9",
+ "\u0edc"-"\u0edd",
+ "\u0f00",
+ "\u0f18"-"\u0f19",
+ "\u0f20"-"\u0f29",
+ "\u0f35",
+ "\u0f37",
+ "\u0f39",
+ "\u0f3e"-"\u0f47",
+ "\u0f49"-"\u0f6a",
+ "\u0f71"-"\u0f84",
+ "\u0f86"-"\u0f8b",
+ "\u0f90"-"\u0f97",
+ "\u0f99"-"\u0fbc",
+ "\u0fc6",
+ "\u1000"-"\u1021",
+ "\u1023"-"\u1027",
+ "\u1029"-"\u102a",
+ "\u102c"-"\u1032",
+ "\u1036"-"\u1039",
+ "\u1040"-"\u1049",
+ "\u1050"-"\u1059",
+ "\u10a0"-"\u10c5",
+ "\u10d0"-"\u10f6",
+ "\u1100"-"\u1159",
+ "\u115f"-"\u11a2",
+ "\u11a8"-"\u11f9",
+ "\u1200"-"\u1206",
+ "\u1208"-"\u1246",
+ "\u1248",
+ "\u124a"-"\u124d",
+ "\u1250"-"\u1256",
+ "\u1258",
+ "\u125a"-"\u125d",
+ "\u1260"-"\u1286",
+ "\u1288",
+ "\u128a"-"\u128d",
+ "\u1290"-"\u12ae",
+ "\u12b0",
+ "\u12b2"-"\u12b5",
+ "\u12b8"-"\u12be",
+ "\u12c0",
+ "\u12c2"-"\u12c5",
+ "\u12c8"-"\u12ce",
+ "\u12d0"-"\u12d6",
+ "\u12d8"-"\u12ee",
+ "\u12f0"-"\u130e",
+ "\u1310",
+ "\u1312"-"\u1315",
+ "\u1318"-"\u131e",
+ "\u1320"-"\u1346",
+ "\u1348"-"\u135a",
+ "\u1369"-"\u1371",
+ "\u13a0"-"\u13f4",
+ "\u1401"-"\u166c",
+ "\u166f"-"\u1676",
+ "\u1681"-"\u169a",
+ "\u16a0"-"\u16ea",
+ "\u1780"-"\u17d3",
+ "\u17db",
+ "\u17e0"-"\u17e9",
+ "\u180b"-"\u180e",
+ "\u1810"-"\u1819",
+ "\u1820"-"\u1877",
+ "\u1880"-"\u18a9",
+ "\u1e00"-"\u1e9b",
+ "\u1ea0"-"\u1ef9",
+ "\u1f00"-"\u1f15",
+ "\u1f18"-"\u1f1d",
+ "\u1f20"-"\u1f45",
+ "\u1f48"-"\u1f4d",
+ "\u1f50"-"\u1f57",
+ "\u1f59",
+ "\u1f5b",
+ "\u1f5d",
+ "\u1f5f"-"\u1f7d",
+ "\u1f80"-"\u1fb4",
+ "\u1fb6"-"\u1fbc",
+ "\u1fbe",
+ "\u1fc2"-"\u1fc4",
+ "\u1fc6"-"\u1fcc",
+ "\u1fd0"-"\u1fd3",
+ "\u1fd6"-"\u1fdb",
+ "\u1fe0"-"\u1fec",
+ "\u1ff2"-"\u1ff4",
+ "\u1ff6"-"\u1ffc",
+ "\u200c"-"\u200f",
+ "\u202a"-"\u202e",
+ "\u203f"-"\u2040",
+ "\u206a"-"\u206f",
+ "\u207f",
+ "\u20a0"-"\u20af",
+ "\u20d0"-"\u20dc",
+ "\u20e1",
+ "\u2102",
+ "\u2107",
+ "\u210a"-"\u2113",
+ "\u2115",
+ "\u2119"-"\u211d",
+ "\u2124",
+ "\u2126",
+ "\u2128",
+ "\u212a"-"\u212d",
+ "\u212f"-"\u2131",
+ "\u2133"-"\u2139",
+ "\u2160"-"\u2183",
+ "\u3005"-"\u3007",
+ "\u3021"-"\u302f",
+ "\u3031"-"\u3035",
+ "\u3038"-"\u303a",
+ "\u3041"-"\u3094",
+ "\u3099"-"\u309a",
+ "\u309d"-"\u309e",
+ "\u30a1"-"\u30fe",
+ "\u3105"-"\u312c",
+ "\u3131"-"\u318e",
+ "\u31a0"-"\u31b7",
+ "\u3400"-"\u4db5",
+ "\u4e00"-"\u9fa5",
+ "\ua000"-"\ua48c",
+ "\uac00"-"\ud7a3",
+ "\uf900"-"\ufa2d",
+ "\ufb00"-"\ufb06",
+ "\ufb13"-"\ufb17",
+ "\ufb1d"-"\ufb28",
+ "\ufb2a"-"\ufb36",
+ "\ufb38"-"\ufb3c",
+ "\ufb3e",
+ "\ufb40"-"\ufb41",
+ "\ufb43"-"\ufb44",
+ "\ufb46"-"\ufbb1",
+ "\ufbd3"-"\ufd3d",
+ "\ufd50"-"\ufd8f",
+ "\ufd92"-"\ufdc7",
+ "\ufdf0"-"\ufdfb",
+ "\ufe20"-"\ufe23",
+ "\ufe33"-"\ufe34",
+ "\ufe4d"-"\ufe4f",
+ "\ufe69",
+ "\ufe70"-"\ufe72",
+ "\ufe74",
+ "\ufe76"-"\ufefc",
+ "\ufeff",
+ "\uff04",
+ "\uff10"-"\uff19",
+ "\uff21"-"\uff3a",
+ "\uff3f",
+ "\uff41"-"\uff5a",
+ "\uff65"-"\uffbe",
+ "\uffc2"-"\uffc7",
+ "\uffca"-"\uffcf",
+ "\uffd2"-"\uffd7",
+ "\uffda"-"\uffdc",
+ "\uffe0"-"\uffe1",
+ "\uffe5"-"\uffe6",
+ "\ufff9"-"\ufffb"
+ ]
+ >
+}
+
+/* SEPARATORS */
+
+TOKEN :
+{
+ < LPAREN: "(" >
+| < RPAREN: ")" >
+| < LBRACE: "{" >
+| < RBRACE: "}" >
+| < LBRACKET: "[" >
+| < RBRACKET: "]" >
+| < SEMICOLON: ";" >
+| < COMMA: "," >
+| < DOT: "." >
+| < AT: "@" >
+}
+
+/* OPERATORS */
+
+TOKEN :
+{
+ < ASSIGN: "=" >
+| < LT: "<" >
+| < BANG: "!" >
+| < TILDE: "~" >
+| < HOOK: "?" >
+| < COLON: ":" >
+| < EQ: "==" >
+| < LE: "<=" >
+| < GE: ">=" >
+| < NE: "!=" >
+| < SC_OR: "||" >
+| < SC_AND: "&&" >
+| < INCR: "++" >
+| < DECR: "--" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < STAR: "*" >
+| < SLASH: "/" >
+| < BIT_AND: "&" >
+| < BIT_OR: "|" >
+| < XOR: "^" >
+| < REM: "%" >
+| < LSHIFT: "<<" >
+| < PLUSASSIGN: "+=" >
+| < MINUSASSIGN: "-=" >
+| < STARASSIGN: "*=" >
+| < SLASHASSIGN: "/=" >
+| < ANDASSIGN: "&=" >
+| < ORASSIGN: "|=" >
+| < XORASSIGN: "^=" >
+| < REMASSIGN: "%=" >
+| < LSHIFTASSIGN: "<<=" >
+| < RSIGNEDSHIFTASSIGN: ">>=" >
+| < RUNSIGNEDSHIFTASSIGN: ">>>=" >
+| < ELLIPSIS: "..." >
+}
+
+/* >'s need special attention due to generics syntax. */
+TOKEN :
+{
+ < RUNSIGNEDSHIFT: ">>>" >
+ {
+ matchedToken.kind = GT;
+ ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT;
+ input_stream.backup(2);
+ matchedToken.image = ">";
+ }
+| < RSIGNEDSHIFT: ">>" >
+ {
+ matchedToken.kind = GT;
+ ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT;
+ input_stream.backup(1);
+ matchedToken.image = ">";
+ }
+| < GT: ">" >
+}
+
+boolean Line() :
+{
+ int modifiers;
+}
+{
+ <EOF> {
+ return true;
+ }
+|
+ LOOKAHEAD(BlockStatement())
+ BlockStatement() {
+ return false;
+ }
+|
+ LOOKAHEAD(Modifiers() [ TypeParameters() ] [ ResultType() ] <IDENTIFIER> FormalParameters() [ "throws" NameList() ] "{")
+ ClassOrInterfaceBodyDeclaration(false) {
+ return false;
+ }
+|
+ LOOKAHEAD(ClassOrInterfaceBodyDeclaration(false))
+ ClassOrInterfaceBodyDeclaration(false) {
+ return false;
+ }
+|
+ LOOKAHEAD(Expression())
+ Expression() {
+ return false;
+ }
+|
+ ImportDeclaration() {
+ return false;
+ }
+}
+
+/*****************************************
+ * THE JAVA LANGUAGE GRAMMAR STARTS HERE *
+ *****************************************/
+
+/*
+ * Program structuring syntax follows.
+ */
+
+void CompilationUnit():
+{}
+{
+ [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ]
+ ( ImportDeclaration() )*
+ ( TypeDeclaration() )*
+ ( < "\u001a" > )?
+ ( <STUFF_TO_IGNORE: ~[]> )?
+ <EOF>
+}
+
+void PackageDeclaration():
+{}
+{
+ Modifiers() "package" Name() ";"
+}
+
+void ImportDeclaration():
+{}
+{
+ "import" [ "static" ] Name() [ "." "*" ] ";"
+}
+
+/*
+ * Modifiers. We match all modifiers in a single rule to reduce the chances of
+ * syntax errors for simple modifier mistakes. It will also enable us to give
+ * better error messages.
+ */
+
+int Modifiers():
+{
+ int modifiers = 0;
+}
+{
+ (
+ LOOKAHEAD(2)
+ (
+ "public" { modifiers |= ModifierSet.PUBLIC; }
+ |
+ "static" { modifiers |= ModifierSet.STATIC; }
+ |
+ "protected" { modifiers |= ModifierSet.PROTECTED; }
+ |
+ "private" { modifiers |= ModifierSet.PRIVATE; }
+ |
+ "final" { modifiers |= ModifierSet.FINAL; }
+ |
+ "abstract" { modifiers |= ModifierSet.ABSTRACT; }
+ |
+ "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; }
+ |
+ "native" { modifiers |= ModifierSet.NATIVE; }
+ |
+ "transient" { modifiers |= ModifierSet.TRANSIENT; }
+ |
+ "volatile" { modifiers |= ModifierSet.VOLATILE; }
+ |
+ "strictfp" { modifiers |= ModifierSet.STRICTFP; }
+ |
+ Annotation()
+ )
+ )*
+
+ {
+ return modifiers;
+ }
+}
+
+/*
+ * Declaration syntax follows.
+ */
+void TypeDeclaration():
+{
+ int modifiers;
+}
+{
+ ";"
+|
+ modifiers = Modifiers()
+ (
+ ClassOrInterfaceDeclaration(modifiers)
+ |
+ EnumDeclaration(modifiers)
+ |
+ AnnotationTypeDeclaration(modifiers)
+ )
+}
+
+
+void ClassOrInterfaceDeclaration(int modifiers):
+{
+ boolean isInterface = false;
+}
+{
+ ( "class" | "interface" { isInterface = true; } )
+ <IDENTIFIER>
+ [ TypeParameters() ]
+ [ ExtendsList(isInterface) ]
+ [ ImplementsList(isInterface) ]
+ ClassOrInterfaceBody(isInterface)
+}
+
+void ExtendsList(boolean isInterface):
+{
+ boolean extendsMoreThanOne = false;
+}
+{
+ "extends" ClassOrInterfaceType()
+ ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )*
+ {
+ if (extendsMoreThanOne && !isInterface)
+ throw new ParseException("A class cannot extend more than one other class");
+ }
+}
+
+void ImplementsList(boolean isInterface):
+{}
+{
+ "implements" ClassOrInterfaceType()
+ ( "," ClassOrInterfaceType() )*
+ {
+ if (isInterface)
+ throw new ParseException("An interface cannot implement other interfaces");
+ }
+}
+
+void EnumDeclaration(int modifiers):
+{}
+{
+ "enum" <IDENTIFIER>
+ [ ImplementsList(false) ]
+ EnumBody()
+}
+
+void EnumBody():
+{}
+{
+ "{"
+ [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ]
+ [ "," ]
+ [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ]
+ "}"
+}
+
+void EnumConstant():
+{}
+{
+ Modifiers() <IDENTIFIER> [ Arguments() ] [ ClassOrInterfaceBody(false) ]
+}
+
+void TypeParameters():
+{}
+{
+ "<" TypeParameter() ( "," TypeParameter() )* ">"
+}
+
+void TypeParameter():
+{}
+{
+ <IDENTIFIER> [ TypeBound() ]
+}
+
+void TypeBound():
+{}
+{
+ "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )*
+}
+
+void ClassOrInterfaceBody(boolean isInterface):
+{}
+{
+ "{" ( ClassOrInterfaceBodyDeclaration(isInterface) )* "}"
+}
+
+void ClassOrInterfaceBodyDeclaration(boolean isInterface):
+{
+ boolean isNestedInterface = false;
+ int modifiers;
+}
+{
+ LOOKAHEAD(2)
+ Initializer()
+ {
+ if (isInterface)
+ throw new ParseException("An interface cannot have initializers");
+ }
+|
+ modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do
+ // more checks, pass the modifiers down to the member
+ (
+ ClassOrInterfaceDeclaration(modifiers)
+ |
+ EnumDeclaration(modifiers)
+ |
+ LOOKAHEAD( [ TypeParameters() ] <IDENTIFIER> "(" )
+ ConstructorDeclaration()
+ |
+ LOOKAHEAD( Type() <IDENTIFIER> ( "[" "]" )* ( "," | "=" | ";" ) )
+ FieldDeclaration(modifiers)
+ |
+ MethodDeclaration(modifiers)
+ )
+|
+ ";"
+}
+
+void FieldDeclaration(int modifiers):
+{}
+{
+ // Modifiers are already matched in the caller
+ Type() VariableDeclarator() ( "," VariableDeclarator() )* ";"
+}
+
+void VariableDeclarator():
+{}
+{
+ VariableDeclaratorId() [ "=" VariableInitializer() ]
+}
+
+void VariableDeclaratorId():
+{}
+{
+ <IDENTIFIER> ( "[" "]" )*
+}
+
+void VariableInitializer():
+{}
+{
+ ArrayInitializer()
+|
+ Expression()
+}
+
+void ArrayInitializer():
+{}
+{
+ "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}"
+}
+
+void MethodDeclaration(int modifiers):
+{}
+{
+ // Modifiers already matched in the caller!
+ [ TypeParameters() ]
+ ResultType()
+ MethodDeclarator() [ "throws" NameList() ]
+ ( Block() | ";" )
+}
+
+void MethodDeclarator():
+{}
+{
+ <IDENTIFIER> FormalParameters() ( "[" "]" )*
+}
+
+void FormalParameters():
+{}
+{
+ "(" [ FormalParameter() ( "," FormalParameter() )* ] ")"
+}
+
+void FormalParameter():
+{}
+{
+ Modifiers() Type() [ "..." ] VariableDeclaratorId()
+}
+
+void ConstructorDeclaration():
+{}
+{
+ [ TypeParameters() ]
+ // Modifiers matched in the caller
+ <IDENTIFIER> FormalParameters() [ "throws" NameList() ]
+ "{"
+ [ LOOKAHEAD(ExplicitConstructorInvocation())
+ ExplicitConstructorInvocation()
+ ]
+ ( BlockStatement() )*
+ "}"
+}
+
+void ExplicitConstructorInvocation():
+{}
+{
+ ( <IDENTIFIER> "." )* [ LOOKAHEAD(2) "this" "." ]
+ [ TypeArguments() ] ("this"|"super") Arguments() ";"
+}
+
+void Initializer():
+{}
+{
+ [ "static" ] Block()
+}
+
+
+/*
+ * Type, name and expression syntax follows.
+ */
+
+void Type():
+{}
+{
+ LOOKAHEAD(2) ReferenceType()
+ |
+ PrimitiveType()
+}
+
+void ReferenceType():
+{}
+{
+ PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+
+ |
+ ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )*
+}
+
+void ClassOrInterfaceType():
+{}
+{
+ <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ]
+ ( LOOKAHEAD(2) "." <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] )*
+}
+
+void TypeArguments():
+{}
+{
+ "<" TypeArgument() ( "," TypeArgument() )* ">"
+}
+
+void TypeArgument():
+{}
+{
+ ReferenceType()
+ |
+ "?" [ WildcardBounds() ]
+}
+
+void WildcardBounds():
+{}
+{
+ "extends" ReferenceType()
+ |
+ "super" ReferenceType()
+}
+
+
+void PrimitiveType():
+{}
+{
+ "boolean"
+|
+ "char"
+|
+ "byte"
+|
+ "short"
+|
+ "int"
+|
+ "long"
+|
+ "float"
+|
+ "double"
+}
+
+void ResultType():
+{}
+{
+ "void"
+|
+ Type()
+}
+
+void Name():
+/*
+ * A lookahead of 2 is required below since "Name" can be followed
+ * by a ".*" when used in the context of an "ImportDeclaration".
+ */
+{}
+{
+ <IDENTIFIER>
+ ( LOOKAHEAD(2) "." <IDENTIFIER>
+ )*
+}
+
+void NameList():
+{}
+{
+ Name() ( "," Name() )*
+}
+
+
+/*
+ * Expression syntax follows.
+ */
+
+void Expression():
+/*
+ * This expansion has been written this way instead of:
+ * Assignment() | ConditionalExpression()
+ * for performance reasons.
+ * However, it is a weakening of the grammar for it allows the LHS of
+ * assignments to be any conditional expression whereas it can only be
+ * a primary expression. Consider adding a semantic predicate to work
+ * around this.
+ */
+{}
+{
+ ConditionalExpression()
+ [
+ LOOKAHEAD(2)
+ AssignmentOperator() Expression()
+ ]
+}
+
+void AssignmentOperator():
+{}
+{
+ "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|="
+}
+
+void AssignmentExpression():
+{}
+{
+ PrimaryExpression() AssignmentOperator() Expression()
+}
+
+void ConditionalExpression():
+{}
+{
+ ConditionalOrExpression() [ "?" Expression() ":" Expression() ]
+}
+
+void ConditionalOrExpression():
+{}
+{
+ ConditionalAndExpression() ( "||" ConditionalAndExpression() )*
+}
+
+void ConditionalAndExpression():
+{}
+{
+ InclusiveOrExpression() ( "&&" InclusiveOrExpression() )*
+}
+
+void InclusiveOrExpression():
+{}
+{
+ ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )*
+}
+
+void ExclusiveOrExpression():
+{}
+{
+ AndExpression() ( "^" AndExpression() )*
+}
+
+void AndExpression():
+{}
+{
+ EqualityExpression() ( "&" EqualityExpression() )*
+}
+
+void EqualityExpression():
+{}
+{
+ InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )*
+}
+
+void InstanceOfExpression():
+{}
+{
+ RelationalExpression() [ "instanceof" Type() ]
+}
+
+void RelationalExpression():
+{}
+{
+ ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )*
+}
+
+void ShiftExpression():
+{}
+{
+ AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )*
+}
+
+void AdditiveExpression():
+{}
+{
+ MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )*
+}
+
+void MultiplicativeExpression():
+{}
+{
+ UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )*
+}
+
+void UnaryExpression():
+{}
+{
+ ( "+" | "-" ) UnaryExpression()
+|
+ PreIncrementExpression()
+|
+ PreDecrementExpression()
+|
+ UnaryExpressionNotPlusMinus()
+}
+
+void PreIncrementExpression():
+{}
+{
+ "++" PrimaryExpression()
+}
+
+void PreDecrementExpression():
+{}
+{
+ "--" PrimaryExpression()
+}
+
+void UnaryExpressionNotPlusMinus():
+{}
+{
+ ( "~" | "!" ) UnaryExpression()
+|
+ LOOKAHEAD( CastLookahead() )
+ CastExpression()
+|
+ PostfixExpression()
+}
+
+// This production is to determine lookahead only. The LOOKAHEAD specifications
+// below are not used, but they are there just to indicate that we know about
+// this.
+void CastLookahead():
+{}
+{
+ LOOKAHEAD(2)
+ "(" PrimitiveType()
+|
+ LOOKAHEAD("(" Type() "[")
+ "(" Type() "[" "]"
+|
+ "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() )
+}
+
+void PostfixExpression():
+{}
+{
+ PrimaryExpression() [ PostfixOperator() ]
+}
+
+void PostfixOperator():
+{}
+{
+ "++" | "--"
+}
+
+void CastExpression():
+{}
+{
+ LOOKAHEAD("(" PrimitiveType())
+ "(" Type() ")" UnaryExpression()
+|
+ "(" Type() ")" UnaryExpressionNotPlusMinus()
+}
+
+void PrimaryExpression():
+{}
+{
+ PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )*
+}
+
+void MemberSelector():
+{}
+{
+ "." TypeArguments() <IDENTIFIER>
+}
+
+void PrimaryPrefix():
+{}
+{
+ Literal()
+|
+ LOOKAHEAD( ( <IDENTIFIER> "." )* "this" )
+ ( <IDENTIFIER> "." )*
+ "this"
+|
+ "super" "." <IDENTIFIER>
+|
+ "(" Expression() ")"
+|
+ AllocationExpression()
+|
+ LOOKAHEAD( ResultType() "." "class" )
+ ResultType() "." "class"
+|
+ Name()
+}
+
+void PrimarySuffix():
+{}
+{
+ LOOKAHEAD("." "super" ".")
+ "." "super"
+|
+ LOOKAHEAD("." "this")
+ "." "this"
+|
+ LOOKAHEAD(2)
+ "." AllocationExpression()
+|
+ LOOKAHEAD(3)
+ MemberSelector()
+|
+ "[" Expression() "]"
+|
+ "." <IDENTIFIER>
+|
+ Arguments()
+}
+
+void Literal():
+{}
+{
+ <INTEGER_LITERAL>
+|
+ <FLOATING_POINT_LITERAL>
+|
+ <CHARACTER_LITERAL>
+|
+ <STRING_LITERAL>
+|
+ BooleanLiteral()
+|
+ NullLiteral()
+}
+
+void BooleanLiteral():
+{}
+{
+ "true"
+|
+ "false"
+}
+
+void NullLiteral():
+{}
+{
+ "null"
+}
+
+void Arguments():
+{}
+{
+ "(" [ ArgumentList() ] ")"
+}
+
+void ArgumentList():
+{}
+{
+ Expression() ( "," Expression() )*
+}
+
+void AllocationExpression():
+{}
+{
+ LOOKAHEAD(2)
+ "new" PrimitiveType() ArrayDimsAndInits()
+|
+ "new" ClassOrInterfaceType() [ TypeArguments() ]
+ (
+ ArrayDimsAndInits()
+ |
+ Arguments() [ ClassOrInterfaceBody(false) ]
+ )
+}
+
+/*
+ * The third LOOKAHEAD specification below is to parse to PrimarySuffix
+ * if there is an expression between the "[...]".
+ */
+void ArrayDimsAndInits():
+{}
+{
+ LOOKAHEAD(2)
+ ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )*
+|
+ ( "[" "]" )+ ArrayInitializer()
+}
+
+
+/*
+ * Statement syntax follows.
+ */
+
+void Statement():
+{}
+{
+ LOOKAHEAD(2)
+ LabeledStatement()
+|
+ AssertStatement()
+|
+ Block()
+|
+ EmptyStatement()
+|
+ StatementExpression() ";"
+|
+ SwitchStatement()
+|
+ IfStatement()
+|
+ WhileStatement()
+|
+ DoStatement()
+|
+ ForStatement()
+|
+ BreakStatement()
+|
+ ContinueStatement()
+|
+ ReturnStatement()
+|
+ ThrowStatement()
+|
+ SynchronizedStatement()
+|
+ TryStatement()
+}
+
+void AssertStatement():
+{}
+{
+ "assert" Expression() [ ":" Expression() ] ";"
+}
+
+void LabeledStatement():
+{}
+{
+ <IDENTIFIER> ":" Statement()
+}
+
+void Block():
+{}
+{
+ "{" ( BlockStatement() )* "}"
+}
+
+void BlockStatement():
+{}
+{
+ LOOKAHEAD( Modifiers() Type() <IDENTIFIER> )
+ LocalVariableDeclaration() ";"
+|
+ Statement()
+|
+ ClassOrInterfaceDeclaration(0)
+}
+
+void LocalVariableDeclaration():
+{}
+{
+ Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )*
+}
+
+void EmptyStatement():
+{}
+{
+ ";"
+}
+
+void StatementExpression():
+{}
+{
+ PreIncrementExpression()
+|
+ PreDecrementExpression()
+|
+ LOOKAHEAD(PrimaryExpression() AssignmentOperator())
+ AssignmentExpression()
+|
+ PostfixExpression()
+}
+
+void SwitchStatement():
+{}
+{
+ "switch" "(" Expression() ")" "{"
+ ( SwitchLabel() ( BlockStatement() )* )*
+ "}"
+}
+
+void SwitchLabel():
+{}
+{
+ "case" Expression() ":"
+|
+ "default" ":"
+}
+
+void IfStatement():
+/*
+ * The disambiguating algorithm of JavaCC automatically binds dangling
+ * else's to the innermost if statement. The LOOKAHEAD specification
+ * is to tell JavaCC that we know what we are doing.
+ */
+{}
+{
+ "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]
+}
+
+void WhileStatement():
+{}
+{
+ "while" "(" Expression() ")" Statement()
+}
+
+void DoStatement():
+{}
+{
+ "do" Statement() "while" "(" Expression() ")" ";"
+}
+
+void ForStatement():
+{}
+{
+ "for" "("
+
+ (
+ LOOKAHEAD(Modifiers() Type() <IDENTIFIER> ":")
+ Modifiers() Type() <IDENTIFIER> ":" Expression()
+ |
+ [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ]
+ )
+
+ ")" Statement()
+}
+
+void ForInit():
+{}
+{
+ LOOKAHEAD( Modifiers() Type() <IDENTIFIER> )
+ LocalVariableDeclaration()
+|
+ StatementExpressionList()
+}
+
+void StatementExpressionList():
+{}
+{
+ StatementExpression() ( "," StatementExpression() )*
+}
+
+void ForUpdate():
+{}
+{
+ StatementExpressionList()
+}
+
+void BreakStatement():
+{}
+{
+ "break" [ <IDENTIFIER> ] ";"
+}
+
+void ContinueStatement():
+{}
+{
+ "continue" [ <IDENTIFIER> ] ";"
+}
+
+void ReturnStatement():
+{}
+{
+ "return" [ Expression() ] ";"
+}
+
+void ThrowStatement():
+{}
+{
+ "throw" Expression() ";"
+}
+
+void SynchronizedStatement():
+{}
+{
+ "synchronized" "(" Expression() ")" Block()
+}
+
+void TryStatement():
+/*
+ * Semantic check required here to make sure that at least one
+ * finally/catch is present.
+ */
+{}
+{
+ "try" Block()
+ ( "catch" "(" FormalParameter() ")" Block() )*
+ [ "finally" Block() ]
+}
+
+/* We use productions to match >>>, >> and > so that we can keep the
+ * type declaration syntax with generics clean
+ */
+
+void RUNSIGNEDSHIFT():
+{}
+{
+ ( LOOKAHEAD({ getToken(1).kind == GT &&
+ ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} )
+ ">" ">" ">"
+ )
+}
+
+void RSIGNEDSHIFT():
+{}
+{
+ ( LOOKAHEAD({ getToken(1).kind == GT &&
+ ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} )
+ ">" ">"
+ )
+}
+
+/* Annotation syntax follows. */
+
+void Annotation():
+{}
+{
+ LOOKAHEAD( "@" Name() "(" ( <IDENTIFIER> "=" | ")" ))
+ NormalAnnotation()
+ |
+ LOOKAHEAD( "@" Name() "(" )
+ SingleMemberAnnotation()
+ |
+ MarkerAnnotation()
+}
+
+void NormalAnnotation():
+{}
+{
+ "@" Name() "(" [ MemberValuePairs() ] ")"
+}
+
+void MarkerAnnotation():
+{}
+{
+ "@" Name()
+}
+
+void SingleMemberAnnotation():
+{}
+{
+ "@" Name() "(" MemberValue() ")"
+}
+
+void MemberValuePairs():
+{}
+{
+ MemberValuePair() ( "," MemberValuePair() )*
+}
+
+void MemberValuePair():
+{}
+{
+ <IDENTIFIER> "=" MemberValue()
+}
+
+void MemberValue():
+{}
+{
+ Annotation()
+ |
+ MemberValueArrayInitializer()
+ |
+ ConditionalExpression()
+}
+
+void MemberValueArrayInitializer():
+{}
+{
+ "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}"
+}
+
+
+/* Annotation Types. */
+
+void AnnotationTypeDeclaration(int modifiers):
+{}
+{
+ "@" "interface" <IDENTIFIER> AnnotationTypeBody()
+}
+
+void AnnotationTypeBody():
+{}
+{
+ "{" ( AnnotationTypeMemberDeclaration() )* "}"
+}
+
+void AnnotationTypeMemberDeclaration():
+{
+ int modifiers;
+}
+{
+ modifiers = Modifiers()
+ (
+ LOOKAHEAD(Type() <IDENTIFIER> "(")
+ Type() <IDENTIFIER> "(" ")" [ DefaultValue() ] ";"
+ |
+ ClassOrInterfaceDeclaration(modifiers)
+ |
+ EnumDeclaration(modifiers)
+ |
+ AnnotationTypeDeclaration(modifiers)
+ |
+ FieldDeclaration(modifiers)
+ )
+ |
+ ( ";" )
+}
+
+void DefaultValue():
+{}
+{
+ "default" MemberValue()
+}
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,530 @@
+/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */
+package jaxx.compiler.java.parser;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (with java-like unicode escape processing).
+ */
+
+public class JavaCharStream {
+ public static final boolean staticFlag = false;
+
+ static int hexval(char c) throws java.io.IOException {
+ switch (c) {
+ case '0':
+ return 0;
+ case '1':
+ return 1;
+ case '2':
+ return 2;
+ case '3':
+ return 3;
+ case '4':
+ return 4;
+ case '5':
+ return 5;
+ case '6':
+ return 6;
+ case '7':
+ return 7;
+ case '8':
+ return 8;
+ case '9':
+ return 9;
+
+ case 'a':
+ case 'A':
+ return 10;
+ case 'b':
+ case 'B':
+ return 11;
+ case 'c':
+ case 'C':
+ return 12;
+ case 'd':
+ case 'D':
+ return 13;
+ case 'e':
+ case 'E':
+ return 14;
+ case 'f':
+ case 'F':
+ return 15;
+ }
+
+ throw new java.io.IOException(); // Should never come here
+ }
+
+ public int bufpos = -1;
+ int bufsize;
+ int available;
+ int tokenBegin;
+ 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[] nextCharBuf;
+ protected char[] buffer;
+ protected int maxNextCharInd = 0;
+ protected int nextCharInd = -1;
+ 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;
+
+ 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;
+
+ bufpos -= tokenBegin;
+ }
+ }
+ catch (Throwable t) {
+ throw new Error(t.getMessage());
+ }
+
+ available = (bufsize += 2048);
+ tokenBegin = 0;
+ }
+
+ protected void FillBuff() throws java.io.IOException {
+ int i;
+ if (maxNextCharInd == 4096)
+ maxNextCharInd = nextCharInd = 0;
+
+ try {
+ if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
+ 4096 - maxNextCharInd)) == -1) {
+ inputStream.close();
+ throw new java.io.IOException();
+ } else {
+ maxNextCharInd += i;
+ }
+ }
+ catch (java.io.IOException e) {
+ if (bufpos != 0) {
+ --bufpos;
+ backup(0);
+ } else {
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+ throw e;
+ }
+ }
+
+ protected char ReadByte() throws java.io.IOException {
+ if (++nextCharInd >= maxNextCharInd)
+ FillBuff();
+
+ return nextCharBuf[nextCharInd];
+ }
+
+ public char BeginToken() throws java.io.IOException {
+ if (inBuf > 0) {
+ --inBuf;
+
+ if (++bufpos == bufsize) {
+ bufpos = 0;
+ }
+
+ tokenBegin = bufpos;
+ return buffer[bufpos];
+ }
+
+ tokenBegin = 0;
+ bufpos = -1;
+
+ return readChar();
+ }
+
+ protected void AdjustBuffSize() {
+ if (available == bufsize) {
+ if (tokenBegin > 2048) {
+ bufpos = 0;
+ available = tokenBegin;
+ } else
+ ExpandBuff(false);
+ } else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ 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];
+ }
+
+ char c;
+
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ if ((buffer[bufpos] = c = ReadByte()) == '\\') {
+ UpdateLineColumn(c);
+
+ int backSlashCnt = 1;
+
+ for (; ;) // Read all the backslashes
+ {
+ if (++bufpos == available)
+ AdjustBuffSize();
+
+ try {
+ if ((buffer[bufpos] = c = ReadByte()) != '\\') {
+ UpdateLineColumn(c);
+ // found a non-backslash char.
+ if ((c == 'u') && ((backSlashCnt & 1) == 1)) {
+ if (--bufpos < 0)
+ bufpos = bufsize - 1;
+
+ break;
+ }
+
+ backup(backSlashCnt);
+ return '\\';
+ }
+ }
+ catch (java.io.IOException e) {
+ if (backSlashCnt > 1)
+ backup(backSlashCnt);
+
+ return '\\';
+ }
+
+ UpdateLineColumn(c);
+ backSlashCnt++;
+ }
+
+ // Here, we have seen an odd number of backslash's followed by a 'u'
+ try {
+ while ((c = ReadByte()) == 'u')
+ ++column;
+
+ buffer[bufpos] = c = (char) (hexval(c) << 12 |
+ hexval(ReadByte()) << 8 |
+ hexval(ReadByte()) << 4 |
+ hexval(ReadByte()));
+
+ column += 4;
+ }
+ catch (java.io.IOException e) {
+ throw new Error("Invalid escape character at line " + line +
+ " column " + column + ".");
+ }
+
+ if (backSlashCnt == 1)
+ return c;
+ else {
+ backup(backSlashCnt - 1);
+ return '\\';
+ }
+ } else {
+ UpdateLineColumn(c);
+ return (c);
+ }
+ }
+
+ /**
+ * @return column index
+ * @see #getEndColumn
+ * @deprecated
+ */
+
+ public int getColumn() {
+ return bufcolumn[bufpos];
+ }
+
+ /**
+ * @return line type ???
+ * @see #getEndLine
+ * @deprecated
+ */
+
+ 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 JavaCharStream(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];
+ nextCharBuf = new char[4096];
+ }
+
+ public JavaCharStream(java.io.Reader dstream,
+ int startline, int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public JavaCharStream(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];
+ nextCharBuf = new char[4096];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ nextCharInd = 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 JavaCharStream(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 JavaCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn, int buffersize) {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ }
+
+ public JavaCharStream(java.io.InputStream dstream, String encoding, int startline,
+ int startcolumn) throws java.io.UnsupportedEncodingException {
+ this(dstream, encoding, startline, startcolumn, 4096);
+ }
+
+ public JavaCharStream(java.io.InputStream dstream, int startline,
+ int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
+ }
+
+ public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException {
+ this(dstream, encoding, 1, 1, 4096);
+ }
+
+ public JavaCharStream(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, 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 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 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() {
+ nextCharBuf = null;
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /**
+ * Method to adjust line and column numbers for the start of a token.
+ *
+ * @param newLine line number ?
+ * @param newCol column number ?
+ */
+ 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;
+ int nextColDiff, 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];
+ }
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,10048 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */
+package jaxx.compiler.java.parser;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+/**
+ * Grammar to parse Java version 1.5
+ *
+ * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5
+ */
+public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, JavaParserConstants {/*@bgen(jjtree)*/
+ protected JJTJavaParserState jjtree = new JJTJavaParserState();
+
+ /** Class to hold modifiers. */
+ static public final class ModifierSet {
+ /* Definitions of the bits in the modifiers field. */
+ public static final int PUBLIC = 0x0001;
+ public static final int PROTECTED = 0x0002;
+ public static final int PRIVATE = 0x0004;
+ public static final int ABSTRACT = 0x0008;
+ public static final int STATIC = 0x0010;
+ public static final int FINAL = 0x0020;
+ public static final int SYNCHRONIZED = 0x0040;
+ public static final int NATIVE = 0x0080;
+ public static final int TRANSIENT = 0x0100;
+ public static final int VOLATILE = 0x0200;
+ public static final int STRICTFP = 0x1000;
+
+ /**
+ * A set of accessors that indicate whether the specified modifier
+ * is in the set.
+ */
+
+ public boolean isPublic(int modifiers) {
+ return (modifiers & PUBLIC) != 0;
+ }
+
+ public boolean isProtected(int modifiers) {
+ return (modifiers & PROTECTED) != 0;
+ }
+
+ public boolean isPrivate(int modifiers) {
+ return (modifiers & PRIVATE) != 0;
+ }
+
+ public boolean isStatic(int modifiers) {
+ return (modifiers & STATIC) != 0;
+ }
+
+ public boolean isAbstract(int modifiers) {
+ return (modifiers & ABSTRACT) != 0;
+ }
+
+ public boolean isFinal(int modifiers) {
+ return (modifiers & FINAL) != 0;
+ }
+
+ public boolean isNative(int modifiers) {
+ return (modifiers & NATIVE) != 0;
+ }
+
+ public boolean isStrictfp(int modifiers) {
+ return (modifiers & STRICTFP) != 0;
+ }
+
+ public boolean isSynchronized(int modifiers) {
+ return (modifiers & SYNCHRONIZED) != 0;
+ }
+
+ public boolean isTransient(int modifiers) {
+ return (modifiers & TRANSIENT) != 0;
+ }
+
+ public boolean isVolatile(int modifiers) {
+ return (modifiers & VOLATILE) != 0;
+ }
+
+ /** Removes the given modifier. */
+ static int removeModifier(int modifiers, int mod) {
+ return modifiers & ~mod;
+ }
+ }
+
+ public JavaParser(String fileName) {
+ this(System.in);
+ try {
+ ReInit(new FileInputStream(new File(fileName)));
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ void jjtreeOpenNodeScope(Node n) {
+ ((SimpleNode) n).firstToken = getToken(1);
+ }
+
+ void jjtreeCloseNodeScope(Node n) {
+ ((SimpleNode) n).lastToken = getToken(0);
+ }
+
+ public SimpleNode popNode() {
+ if (jjtree.nodeArity() > 0) // number of child nodes
+ return (SimpleNode) jjtree.popNode();
+ else
+ return null;
+ }
+
+ public static void main(String args[]) {
+ JavaParser parser;
+ if (args.length == 0) {
+ System.out.println("Java Parser Version 1.1: Reading from standard input . . .");
+ parser = new JavaParser(System.in);
+ } else if (args.length == 1) {
+ System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . .");
+ try {
+ parser = new JavaParser(new java.io.FileInputStream(args[0]));
+ } catch (java.io.FileNotFoundException e) {
+ System.out.println("Java Parser Version 1.1: File " + args[0] + " not found.");
+ return;
+ }
+ } else {
+ System.out.println("Java Parser Version 1.1: Usage is one of:");
+ System.out.println(" java JavaParser < inputfile");
+ System.out.println("OR");
+ System.out.println(" java JavaParser inputfile");
+ return;
+ }
+ try {
+ parser.CompilationUnit();
+ System.out.println("Java Parser Version 1.1: Java program parsed successfully.");
+ } catch (ParseException e) {
+ System.out.println(e.getMessage());
+ System.out.println("Java Parser Version 1.1: Encountered errors during parse.");
+ }
+ }
+
+ final public boolean Line() throws ParseException {
+ /*@bgen(jjtree) Line */
+ SimpleNode jjtn000 = new SimpleNode(JJTLINE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ int modifiers;
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 0:
+ jj_consume_token(0);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return true;
+ }
+ break;
+ default:
+ if (jj_2_1(2147483647)) {
+ BlockStatement();
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return false;
+ }
+ } else if (jj_2_2(2147483647)) {
+ ClassOrInterfaceBodyDeclaration(false);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return false;
+ }
+ } else if (jj_2_3(2147483647)) {
+ ClassOrInterfaceBodyDeclaration(false);
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return false;
+ }
+ } else if (jj_2_4(2147483647)) {
+ Expression();
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return false;
+ }
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IMPORT:
+ ImportDeclaration();
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return false;
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ /**
+ * **************************************
+ * THE JAVA LANGUAGE GRAMMAR STARTS HERE *
+ * ***************************************
+ */
+
+/*
+ * Program structuring syntax follows.
+ */
+ final public void CompilationUnit() throws ParseException {
+ /*@bgen(jjtree) CompilationUnit */
+ SimpleNode jjtn000 = new SimpleNode(JJTCOMPILATIONUNIT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_5(2147483647)) {
+ PackageDeclaration();
+ } else {
+ ;
+ }
+ label_1:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IMPORT:
+ ;
+ break;
+ default:
+ break label_1;
+ }
+ ImportDeclaration();
+ }
+ label_2:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case CLASS:
+ case ENUM:
+ case FINAL:
+ case INTERFACE:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOLATILE:
+ case SEMICOLON:
+ case AT:
+ ;
+ break;
+ default:
+ break label_2;
+ }
+ TypeDeclaration();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case 123:
+ jj_consume_token(123);
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STUFF_TO_IGNORE:
+ jj_consume_token(STUFF_TO_IGNORE);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(0);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PackageDeclaration() throws ParseException {
+ /*@bgen(jjtree) PackageDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTPACKAGEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Modifiers();
+ jj_consume_token(PACKAGE);
+ Name();
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ImportDeclaration() throws ParseException {
+ /*@bgen(jjtree) ImportDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTIMPORTDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IMPORT);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STATIC:
+ jj_consume_token(STATIC);
+ break;
+ default:
+ ;
+ }
+ Name();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case DOT:
+ jj_consume_token(DOT);
+ jj_consume_token(STAR);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /*
+ * Modifiers. We match all modifiers in a single rule to reduce the chances of
+ * syntax errors for simple modifier mistakes. It will also enable us to give
+ * better error messages.
+ */
+ final public int Modifiers() throws ParseException {
+ /*@bgen(jjtree) Modifiers */
+ SimpleNode jjtn000 = new SimpleNode(JJTMODIFIERS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ int modifiers = 0;
+ try {
+ label_3:
+ while (true) {
+ if (jj_2_6(2)) {
+ ;
+ } else {
+ break label_3;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PUBLIC:
+ jj_consume_token(PUBLIC);
+ modifiers |= ModifierSet.PUBLIC;
+ break;
+ case STATIC:
+ jj_consume_token(STATIC);
+ modifiers |= ModifierSet.STATIC;
+ break;
+ case PROTECTED:
+ jj_consume_token(PROTECTED);
+ modifiers |= ModifierSet.PROTECTED;
+ break;
+ case PRIVATE:
+ jj_consume_token(PRIVATE);
+ modifiers |= ModifierSet.PRIVATE;
+ break;
+ case FINAL:
+ jj_consume_token(FINAL);
+ modifiers |= ModifierSet.FINAL;
+ break;
+ case ABSTRACT:
+ jj_consume_token(ABSTRACT);
+ modifiers |= ModifierSet.ABSTRACT;
+ break;
+ case SYNCHRONIZED:
+ jj_consume_token(SYNCHRONIZED);
+ modifiers |= ModifierSet.SYNCHRONIZED;
+ break;
+ case NATIVE:
+ jj_consume_token(NATIVE);
+ modifiers |= ModifierSet.NATIVE;
+ break;
+ case TRANSIENT:
+ jj_consume_token(TRANSIENT);
+ modifiers |= ModifierSet.TRANSIENT;
+ break;
+ case VOLATILE:
+ jj_consume_token(VOLATILE);
+ modifiers |= ModifierSet.VOLATILE;
+ break;
+ case STRICTFP:
+ jj_consume_token(STRICTFP);
+ modifiers |= ModifierSet.STRICTFP;
+ break;
+ case AT:
+ Annotation();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ {
+ if (true) return modifiers;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ /*
+ * Declaration syntax follows.
+ */
+ final public void TypeDeclaration() throws ParseException {
+ /*@bgen(jjtree) TypeDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ int modifiers;
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ case ABSTRACT:
+ case CLASS:
+ case ENUM:
+ case FINAL:
+ case INTERFACE:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOLATILE:
+ case AT:
+ modifiers = Modifiers();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case CLASS:
+ case INTERFACE:
+ ClassOrInterfaceDeclaration(modifiers);
+ break;
+ case ENUM:
+ EnumDeclaration(modifiers);
+ break;
+ case AT:
+ AnnotationTypeDeclaration(modifiers);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ClassOrInterfaceDeclaration(int modifiers) throws ParseException {
+ /*@bgen(jjtree) ClassOrInterfaceDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ boolean isInterface = false;
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case CLASS:
+ jj_consume_token(CLASS);
+ break;
+ case INTERFACE:
+ jj_consume_token(INTERFACE);
+ isInterface = true;
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(IDENTIFIER);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LT:
+ TypeParameters();
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case EXTENDS:
+ ExtendsList(isInterface);
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IMPLEMENTS:
+ ImplementsList(isInterface);
+ break;
+ default:
+ ;
+ }
+ ClassOrInterfaceBody(isInterface);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ExtendsList(boolean isInterface) throws ParseException {
+ /*@bgen(jjtree) ExtendsList */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXTENDSLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ boolean extendsMoreThanOne = false;
+ try {
+ jj_consume_token(EXTENDS);
+ ClassOrInterfaceType();
+ label_4:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_4;
+ }
+ jj_consume_token(COMMA);
+ ClassOrInterfaceType();
+ extendsMoreThanOne = true;
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ if (extendsMoreThanOne && !isInterface) {
+ if (true)
+ throw new ParseException("A class cannot extend more than one other class");
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ImplementsList(boolean isInterface) throws ParseException {
+ /*@bgen(jjtree) ImplementsList */
+ SimpleNode jjtn000 = new SimpleNode(JJTIMPLEMENTSLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IMPLEMENTS);
+ ClassOrInterfaceType();
+ label_5:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_5;
+ }
+ jj_consume_token(COMMA);
+ ClassOrInterfaceType();
+ }
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ if (isInterface) {
+ if (true)
+ throw new ParseException("An interface cannot implement other interfaces");
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void EnumDeclaration(int modifiers) throws ParseException {
+ /*@bgen(jjtree) EnumDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTENUMDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(ENUM);
+ jj_consume_token(IDENTIFIER);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IMPLEMENTS:
+ ImplementsList(false);
+ break;
+ default:
+ ;
+ }
+ EnumBody();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void EnumBody() throws ParseException {
+ /*@bgen(jjtree) EnumBody */
+ SimpleNode jjtn000 = new SimpleNode(JJTENUMBODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LBRACE);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case FINAL:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOLATILE:
+ case IDENTIFIER:
+ case AT:
+ EnumConstant();
+ label_6:
+ while (true) {
+ if (jj_2_7(2)) {
+ ;
+ } else {
+ break label_6;
+ }
+ jj_consume_token(COMMA);
+ EnumConstant();
+ }
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ label_7:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case DOUBLE:
+ case ENUM:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOID:
+ case VOLATILE:
+ case IDENTIFIER:
+ case LBRACE:
+ case SEMICOLON:
+ case AT:
+ case LT:
+ ;
+ break;
+ default:
+ break label_7;
+ }
+ ClassOrInterfaceBodyDeclaration(false);
+ }
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void EnumConstant() throws ParseException {
+ /*@bgen(jjtree) EnumConstant */
+ SimpleNode jjtn000 = new SimpleNode(JJTENUMCONSTANT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Modifiers();
+ jj_consume_token(IDENTIFIER);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ Arguments();
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACE:
+ ClassOrInterfaceBody(false);
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void TypeParameters() throws ParseException {
+ /*@bgen(jjtree) TypeParameters */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETERS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LT);
+ TypeParameter();
+ label_8:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_8;
+ }
+ jj_consume_token(COMMA);
+ TypeParameter();
+ }
+ jj_consume_token(GT);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void TypeParameter() throws ParseException {
+ /*@bgen(jjtree) TypeParameter */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case EXTENDS:
+ TypeBound();
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void TypeBound() throws ParseException {
+ /*@bgen(jjtree) TypeBound */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEBOUND);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(EXTENDS);
+ ClassOrInterfaceType();
+ label_9:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BIT_AND:
+ ;
+ break;
+ default:
+ break label_9;
+ }
+ jj_consume_token(BIT_AND);
+ ClassOrInterfaceType();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ClassOrInterfaceBody(boolean isInterface) throws ParseException {
+ /*@bgen(jjtree) ClassOrInterfaceBody */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LBRACE);
+ label_10:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case DOUBLE:
+ case ENUM:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOID:
+ case VOLATILE:
+ case IDENTIFIER:
+ case LBRACE:
+ case SEMICOLON:
+ case AT:
+ case LT:
+ ;
+ break;
+ default:
+ break label_10;
+ }
+ ClassOrInterfaceBodyDeclaration(isInterface);
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ClassOrInterfaceBodyDeclaration(boolean isInterface) throws ParseException {
+ /*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODYDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ boolean isNestedInterface = false;
+ int modifiers;
+ try {
+ if (jj_2_10(2)) {
+ Initializer();
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtc000 = false;
+ jjtreeCloseNodeScope(jjtn000);
+ if (isInterface) {
+ if (true)
+ throw new ParseException("An interface cannot have initializers");
+ }
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case DOUBLE:
+ case ENUM:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOID:
+ case VOLATILE:
+ case IDENTIFIER:
+ case AT:
+ case LT:
+ modifiers = Modifiers();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case CLASS:
+ case INTERFACE:
+ ClassOrInterfaceDeclaration(modifiers);
+ break;
+ case ENUM:
+ EnumDeclaration(modifiers);
+ break;
+ default:
+ if (jj_2_8(2147483647)) {
+ ConstructorDeclaration();
+ } else if (jj_2_9(2147483647)) {
+ FieldDeclaration(modifiers);
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case SHORT:
+ case VOID:
+ case IDENTIFIER:
+ case LT:
+ MethodDeclaration(modifiers);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ break;
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void FieldDeclaration(int modifiers) throws ParseException {
+ /*@bgen(jjtree) FieldDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTFIELDDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Type();
+ VariableDeclarator();
+ label_11:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_11;
+ }
+ jj_consume_token(COMMA);
+ VariableDeclarator();
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void VariableDeclarator() throws ParseException {
+ /*@bgen(jjtree) VariableDeclarator */
+ SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ VariableDeclaratorId();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ASSIGN:
+ jj_consume_token(ASSIGN);
+ VariableInitializer();
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void VariableDeclaratorId() throws ParseException {
+ /*@bgen(jjtree) VariableDeclaratorId */
+ SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATORID);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ label_12:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACKET:
+ ;
+ break;
+ default:
+ break label_12;
+ }
+ jj_consume_token(LBRACKET);
+ jj_consume_token(RBRACKET);
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void VariableInitializer() throws ParseException {
+ /*@bgen(jjtree) VariableInitializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACE:
+ ArrayInitializer();
+ break;
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case BANG:
+ case TILDE:
+ case INCR:
+ case DECR:
+ case PLUS:
+ case MINUS:
+ Expression();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ArrayInitializer() throws ParseException {
+ /*@bgen(jjtree) ArrayInitializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTARRAYINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LBRACE);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case LBRACE:
+ case BANG:
+ case TILDE:
+ case INCR:
+ case DECR:
+ case PLUS:
+ case MINUS:
+ VariableInitializer();
+ label_13:
+ while (true) {
+ if (jj_2_11(2)) {
+ ;
+ } else {
+ break label_13;
+ }
+ jj_consume_token(COMMA);
+ VariableInitializer();
+ }
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MethodDeclaration(int modifiers) throws ParseException {
+ /*@bgen(jjtree) MethodDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LT:
+ TypeParameters();
+ break;
+ default:
+ ;
+ }
+ ResultType();
+ MethodDeclarator();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case THROWS:
+ jj_consume_token(THROWS);
+ NameList();
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACE:
+ Block();
+ break;
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MethodDeclarator() throws ParseException {
+ /*@bgen(jjtree) MethodDeclarator */
+ SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ FormalParameters();
+ label_14:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACKET:
+ ;
+ break;
+ default:
+ break label_14;
+ }
+ jj_consume_token(LBRACKET);
+ jj_consume_token(RBRACKET);
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void FormalParameters() throws ParseException {
+ /*@bgen(jjtree) FormalParameters */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETERS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LPAREN);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOLATILE:
+ case IDENTIFIER:
+ case AT:
+ FormalParameter();
+ label_15:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_15;
+ }
+ jj_consume_token(COMMA);
+ FormalParameter();
+ }
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void FormalParameter() throws ParseException {
+ /*@bgen(jjtree) FormalParameter */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Modifiers();
+ Type();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ELLIPSIS:
+ jj_consume_token(ELLIPSIS);
+ break;
+ default:
+ ;
+ }
+ VariableDeclaratorId();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ConstructorDeclaration() throws ParseException {
+ /*@bgen(jjtree) ConstructorDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONSTRUCTORDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LT:
+ TypeParameters();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(IDENTIFIER);
+ FormalParameters();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case THROWS:
+ jj_consume_token(THROWS);
+ NameList();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(LBRACE);
+ if (jj_2_12(2147483647)) {
+ ExplicitConstructorInvocation();
+ } else {
+ ;
+ }
+ label_16:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case ASSERT:
+ case BOOLEAN:
+ case BREAK:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case CONTINUE:
+ case DO:
+ case DOUBLE:
+ case FALSE:
+ case FINAL:
+ case FLOAT:
+ case FOR:
+ case IF:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case NEW:
+ case NULL:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case RETURN:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SUPER:
+ case SWITCH:
+ case SYNCHRONIZED:
+ case THIS:
+ case THROW:
+ case TRANSIENT:
+ case TRUE:
+ case TRY:
+ case VOID:
+ case VOLATILE:
+ case WHILE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case LBRACE:
+ case SEMICOLON:
+ case AT:
+ case INCR:
+ case DECR:
+ ;
+ break;
+ default:
+ break label_16;
+ }
+ BlockStatement();
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ExplicitConstructorInvocation() throws ParseException {
+ /*@bgen(jjtree) ExplicitConstructorInvocation */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXPLICITCONSTRUCTORINVOCATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ label_17:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ ;
+ break;
+ default:
+ break label_17;
+ }
+ jj_consume_token(IDENTIFIER);
+ jj_consume_token(DOT);
+ }
+ if (jj_2_13(2)) {
+ jj_consume_token(THIS);
+ jj_consume_token(DOT);
+ } else {
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LT:
+ TypeArguments();
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case THIS:
+ jj_consume_token(THIS);
+ break;
+ case SUPER:
+ jj_consume_token(SUPER);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ Arguments();
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Initializer() throws ParseException {
+ /*@bgen(jjtree) Initializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STATIC:
+ jj_consume_token(STATIC);
+ break;
+ default:
+ ;
+ }
+ Block();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /*
+ * Type, name and expression syntax follows.
+ */
+ final public void Type() throws ParseException {
+ /*@bgen(jjtree) Type */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_14(2)) {
+ ReferenceType();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case SHORT:
+ PrimitiveType();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ReferenceType() throws ParseException {
+ /*@bgen(jjtree) ReferenceType */
+ SimpleNode jjtn000 = new SimpleNode(JJTREFERENCETYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case SHORT:
+ PrimitiveType();
+ label_18:
+ while (true) {
+ jj_consume_token(LBRACKET);
+ jj_consume_token(RBRACKET);
+ if (jj_2_15(2)) {
+ ;
+ } else {
+ break label_18;
+ }
+ }
+ break;
+ case IDENTIFIER:
+ ClassOrInterfaceType();
+ label_19:
+ while (true) {
+ if (jj_2_16(2)) {
+ ;
+ } else {
+ break label_19;
+ }
+ jj_consume_token(LBRACKET);
+ jj_consume_token(RBRACKET);
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ClassOrInterfaceType() throws ParseException {
+ /*@bgen(jjtree) ClassOrInterfaceType */
+ SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACETYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ if (jj_2_17(2)) {
+ TypeArguments();
+ } else {
+ ;
+ }
+ label_20:
+ while (true) {
+ if (jj_2_18(2)) {
+ ;
+ } else {
+ break label_20;
+ }
+ jj_consume_token(DOT);
+ jj_consume_token(IDENTIFIER);
+ if (jj_2_19(2)) {
+ TypeArguments();
+ } else {
+ ;
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void TypeArguments() throws ParseException {
+ /*@bgen(jjtree) TypeArguments */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENTS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LT);
+ TypeArgument();
+ label_21:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_21;
+ }
+ jj_consume_token(COMMA);
+ TypeArgument();
+ }
+ jj_consume_token(GT);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void TypeArgument() throws ParseException {
+ /*@bgen(jjtree) TypeArgument */
+ SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case SHORT:
+ case IDENTIFIER:
+ ReferenceType();
+ break;
+ case HOOK:
+ jj_consume_token(HOOK);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case EXTENDS:
+ case SUPER:
+ WildcardBounds();
+ break;
+ default:
+ ;
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void WildcardBounds() throws ParseException {
+ /*@bgen(jjtree) WildcardBounds */
+ SimpleNode jjtn000 = new SimpleNode(JJTWILDCARDBOUNDS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case EXTENDS:
+ jj_consume_token(EXTENDS);
+ ReferenceType();
+ break;
+ case SUPER:
+ jj_consume_token(SUPER);
+ ReferenceType();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PrimitiveType() throws ParseException {
+ /*@bgen(jjtree) PrimitiveType */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMITIVETYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ jj_consume_token(BOOLEAN);
+ break;
+ case CHAR:
+ jj_consume_token(CHAR);
+ break;
+ case BYTE:
+ jj_consume_token(BYTE);
+ break;
+ case SHORT:
+ jj_consume_token(SHORT);
+ break;
+ case INT:
+ jj_consume_token(INT);
+ break;
+ case LONG:
+ jj_consume_token(LONG);
+ break;
+ case FLOAT:
+ jj_consume_token(FLOAT);
+ break;
+ case DOUBLE:
+ jj_consume_token(DOUBLE);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ResultType() throws ParseException {
+ /*@bgen(jjtree) ResultType */
+ SimpleNode jjtn000 = new SimpleNode(JJTRESULTTYPE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case VOID:
+ jj_consume_token(VOID);
+ break;
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case SHORT:
+ case IDENTIFIER:
+ Type();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Name() throws ParseException {
+ /*@bgen(jjtree) Name */
+ SimpleNode jjtn000 = new SimpleNode(JJTNAME);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ label_22:
+ while (true) {
+ if (jj_2_20(2)) {
+ ;
+ } else {
+ break label_22;
+ }
+ jj_consume_token(DOT);
+ jj_consume_token(IDENTIFIER);
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void NameList() throws ParseException {
+ /*@bgen(jjtree) NameList */
+ SimpleNode jjtn000 = new SimpleNode(JJTNAMELIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Name();
+ label_23:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_23;
+ }
+ jj_consume_token(COMMA);
+ Name();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /*
+ * Expression syntax follows.
+ */
+ final public void Expression() throws ParseException {
+ /*@bgen(jjtree) Expression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ ConditionalExpression();
+ if (jj_2_21(2)) {
+ AssignmentOperator();
+ Expression();
+ } else {
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AssignmentOperator() throws ParseException {
+ /*@bgen(jjtree) AssignmentOperator */
+ SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTOPERATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ASSIGN:
+ jj_consume_token(ASSIGN);
+ break;
+ case STARASSIGN:
+ jj_consume_token(STARASSIGN);
+ break;
+ case SLASHASSIGN:
+ jj_consume_token(SLASHASSIGN);
+ break;
+ case REMASSIGN:
+ jj_consume_token(REMASSIGN);
+ break;
+ case PLUSASSIGN:
+ jj_consume_token(PLUSASSIGN);
+ break;
+ case MINUSASSIGN:
+ jj_consume_token(MINUSASSIGN);
+ break;
+ case LSHIFTASSIGN:
+ jj_consume_token(LSHIFTASSIGN);
+ break;
+ case RSIGNEDSHIFTASSIGN:
+ jj_consume_token(RSIGNEDSHIFTASSIGN);
+ break;
+ case RUNSIGNEDSHIFTASSIGN:
+ jj_consume_token(RUNSIGNEDSHIFTASSIGN);
+ break;
+ case ANDASSIGN:
+ jj_consume_token(ANDASSIGN);
+ break;
+ case XORASSIGN:
+ jj_consume_token(XORASSIGN);
+ break;
+ case ORASSIGN:
+ jj_consume_token(ORASSIGN);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AssignmentExpression() throws ParseException {
+ /*@bgen(jjtree) AssignmentExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ PrimaryExpression();
+ AssignmentOperator();
+ Expression();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ConditionalExpression() throws ParseException {
+ /*@bgen(jjtree) ConditionalExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ ConditionalOrExpression();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case HOOK:
+ jj_consume_token(HOOK);
+ Expression();
+ jj_consume_token(COLON);
+ Expression();
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ConditionalOrExpression() throws ParseException {
+ /*@bgen(jjtree) ConditionalOrExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALOREXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ ConditionalAndExpression();
+ label_24:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SC_OR:
+ ;
+ break;
+ default:
+ break label_24;
+ }
+ jj_consume_token(SC_OR);
+ ConditionalAndExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ConditionalAndExpression() throws ParseException {
+ /*@bgen(jjtree) ConditionalAndExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALANDEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ InclusiveOrExpression();
+ label_25:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SC_AND:
+ ;
+ break;
+ default:
+ break label_25;
+ }
+ jj_consume_token(SC_AND);
+ InclusiveOrExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void InclusiveOrExpression() throws ParseException {
+ /*@bgen(jjtree) InclusiveOrExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTINCLUSIVEOREXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ ExclusiveOrExpression();
+ label_26:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BIT_OR:
+ ;
+ break;
+ default:
+ break label_26;
+ }
+ jj_consume_token(BIT_OR);
+ ExclusiveOrExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ExclusiveOrExpression() throws ParseException {
+ /*@bgen(jjtree) ExclusiveOrExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEXCLUSIVEOREXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ AndExpression();
+ label_27:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case XOR:
+ ;
+ break;
+ default:
+ break label_27;
+ }
+ jj_consume_token(XOR);
+ AndExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AndExpression() throws ParseException {
+ /*@bgen(jjtree) AndExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTANDEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ EqualityExpression();
+ label_28:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BIT_AND:
+ ;
+ break;
+ default:
+ break label_28;
+ }
+ jj_consume_token(BIT_AND);
+ EqualityExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void EqualityExpression() throws ParseException {
+ /*@bgen(jjtree) EqualityExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTEQUALITYEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ InstanceOfExpression();
+ label_29:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case EQ:
+ case NE:
+ ;
+ break;
+ default:
+ break label_29;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case EQ:
+ jj_consume_token(EQ);
+ break;
+ case NE:
+ jj_consume_token(NE);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ InstanceOfExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void InstanceOfExpression() throws ParseException {
+ /*@bgen(jjtree) InstanceOfExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTINSTANCEOFEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ RelationalExpression();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case INSTANCEOF:
+ jj_consume_token(INSTANCEOF);
+ Type();
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void RelationalExpression() throws ParseException {
+ /*@bgen(jjtree) RelationalExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTRELATIONALEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ ShiftExpression();
+ label_30:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LT:
+ case LE:
+ case GE:
+ case GT:
+ ;
+ break;
+ default:
+ break label_30;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LT:
+ jj_consume_token(LT);
+ break;
+ case GT:
+ jj_consume_token(GT);
+ break;
+ case LE:
+ jj_consume_token(LE);
+ break;
+ case GE:
+ jj_consume_token(GE);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ ShiftExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ShiftExpression() throws ParseException {
+ /*@bgen(jjtree) ShiftExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTSHIFTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ AdditiveExpression();
+ label_31:
+ while (true) {
+ if (jj_2_22(1)) {
+ ;
+ } else {
+ break label_31;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LSHIFT:
+ jj_consume_token(LSHIFT);
+ break;
+ default:
+ if (jj_2_23(1)) {
+ RSIGNEDSHIFT();
+ } else if (jj_2_24(1)) {
+ RUNSIGNEDSHIFT();
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ AdditiveExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AdditiveExpression() throws ParseException {
+ /*@bgen(jjtree) AdditiveExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTADDITIVEEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ MultiplicativeExpression();
+ label_32:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PLUS:
+ case MINUS:
+ ;
+ break;
+ default:
+ break label_32;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ break;
+ case MINUS:
+ jj_consume_token(MINUS);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ MultiplicativeExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MultiplicativeExpression() throws ParseException {
+ /*@bgen(jjtree) MultiplicativeExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTMULTIPLICATIVEEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ UnaryExpression();
+ label_33:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STAR:
+ case SLASH:
+ case REM:
+ ;
+ break;
+ default:
+ break label_33;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case STAR:
+ jj_consume_token(STAR);
+ break;
+ case SLASH:
+ jj_consume_token(SLASH);
+ break;
+ case REM:
+ jj_consume_token(REM);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ UnaryExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void UnaryExpression() throws ParseException {
+ /*@bgen(jjtree) UnaryExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PLUS:
+ case MINUS:
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case PLUS:
+ jj_consume_token(PLUS);
+ break;
+ case MINUS:
+ jj_consume_token(MINUS);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ UnaryExpression();
+ break;
+ case INCR:
+ PreIncrementExpression();
+ break;
+ case DECR:
+ PreDecrementExpression();
+ break;
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case BANG:
+ case TILDE:
+ UnaryExpressionNotPlusMinus();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PreIncrementExpression() throws ParseException {
+ /*@bgen(jjtree) PreIncrementExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPREINCREMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(INCR);
+ PrimaryExpression();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PreDecrementExpression() throws ParseException {
+ /*@bgen(jjtree) PreDecrementExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPREDECREMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(DECR);
+ PrimaryExpression();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void UnaryExpressionNotPlusMinus() throws ParseException {
+ /*@bgen(jjtree) UnaryExpressionNotPlusMinus */
+ SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSIONNOTPLUSMINUS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BANG:
+ case TILDE:
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case TILDE:
+ jj_consume_token(TILDE);
+ break;
+ case BANG:
+ jj_consume_token(BANG);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ UnaryExpression();
+ break;
+ default:
+ if (jj_2_25(2147483647)) {
+ CastExpression();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ PostfixExpression();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+// This production is to determine lookahead only. The LOOKAHEAD specifications
+// below are not used, but they are there just to indicate that we know about
+
+ // this.
+ final public void CastLookahead() throws ParseException {
+ /*@bgen(jjtree) CastLookahead */
+ SimpleNode jjtn000 = new SimpleNode(JJTCASTLOOKAHEAD);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_26(2)) {
+ jj_consume_token(LPAREN);
+ PrimitiveType();
+ } else if (jj_2_27(2147483647)) {
+ jj_consume_token(LPAREN);
+ Type();
+ jj_consume_token(LBRACKET);
+ jj_consume_token(RBRACKET);
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ jj_consume_token(LPAREN);
+ Type();
+ jj_consume_token(RPAREN);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case TILDE:
+ jj_consume_token(TILDE);
+ break;
+ case BANG:
+ jj_consume_token(BANG);
+ break;
+ case LPAREN:
+ jj_consume_token(LPAREN);
+ break;
+ case IDENTIFIER:
+ jj_consume_token(IDENTIFIER);
+ break;
+ case THIS:
+ jj_consume_token(THIS);
+ break;
+ case SUPER:
+ jj_consume_token(SUPER);
+ break;
+ case NEW:
+ jj_consume_token(NEW);
+ break;
+ case FALSE:
+ case NULL:
+ case TRUE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ Literal();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PostfixExpression() throws ParseException {
+ /*@bgen(jjtree) PostfixExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ PrimaryExpression();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case INCR:
+ case DECR:
+ PostfixOperator();
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PostfixOperator() throws ParseException {
+ /*@bgen(jjtree) PostfixOperator */
+ SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXOPERATOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case INCR:
+ jj_consume_token(INCR);
+ break;
+ case DECR:
+ jj_consume_token(DECR);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void CastExpression() throws ParseException {
+ /*@bgen(jjtree) CastExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTCASTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_28(2147483647)) {
+ jj_consume_token(LPAREN);
+ Type();
+ jj_consume_token(RPAREN);
+ UnaryExpression();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LPAREN:
+ jj_consume_token(LPAREN);
+ Type();
+ jj_consume_token(RPAREN);
+ UnaryExpressionNotPlusMinus();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PrimaryExpression() throws ParseException {
+ /*@bgen(jjtree) PrimaryExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ PrimaryPrefix();
+ label_34:
+ while (true) {
+ if (jj_2_29(2)) {
+ ;
+ } else {
+ break label_34;
+ }
+ PrimarySuffix();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MemberSelector() throws ParseException {
+ /*@bgen(jjtree) MemberSelector */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERSELECTOR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(DOT);
+ TypeArguments();
+ jj_consume_token(IDENTIFIER);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PrimaryPrefix() throws ParseException {
+ /*@bgen(jjtree) PrimaryPrefix */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYPREFIX);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case FALSE:
+ case NULL:
+ case TRUE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ Literal();
+ break;
+ default:
+ if (jj_2_30(2147483647)) {
+ label_35:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ ;
+ break;
+ default:
+ break label_35;
+ }
+ jj_consume_token(IDENTIFIER);
+ jj_consume_token(DOT);
+ }
+ jj_consume_token(THIS);
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case SUPER:
+ jj_consume_token(SUPER);
+ jj_consume_token(DOT);
+ jj_consume_token(IDENTIFIER);
+ break;
+ case LPAREN:
+ jj_consume_token(LPAREN);
+ Expression();
+ jj_consume_token(RPAREN);
+ break;
+ case NEW:
+ AllocationExpression();
+ break;
+ default:
+ if (jj_2_31(2147483647)) {
+ ResultType();
+ jj_consume_token(DOT);
+ jj_consume_token(CLASS);
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ Name();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void PrimarySuffix() throws ParseException {
+ /*@bgen(jjtree) PrimarySuffix */
+ SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYSUFFIX);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_32(2147483647)) {
+ jj_consume_token(DOT);
+ jj_consume_token(SUPER);
+ } else if (jj_2_33(2147483647)) {
+ jj_consume_token(DOT);
+ jj_consume_token(THIS);
+ } else if (jj_2_34(2)) {
+ jj_consume_token(DOT);
+ AllocationExpression();
+ } else if (jj_2_35(3)) {
+ MemberSelector();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACKET:
+ jj_consume_token(LBRACKET);
+ Expression();
+ jj_consume_token(RBRACKET);
+ break;
+ case DOT:
+ jj_consume_token(DOT);
+ jj_consume_token(IDENTIFIER);
+ break;
+ case LPAREN:
+ Arguments();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Literal() throws ParseException {
+ /*@bgen(jjtree) Literal */
+ SimpleNode jjtn000 = new SimpleNode(JJTLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case INTEGER_LITERAL:
+ jj_consume_token(INTEGER_LITERAL);
+ break;
+ case FLOATING_POINT_LITERAL:
+ jj_consume_token(FLOATING_POINT_LITERAL);
+ break;
+ case CHARACTER_LITERAL:
+ jj_consume_token(CHARACTER_LITERAL);
+ break;
+ case STRING_LITERAL:
+ jj_consume_token(STRING_LITERAL);
+ break;
+ case FALSE:
+ case TRUE:
+ BooleanLiteral();
+ break;
+ case NULL:
+ NullLiteral();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void BooleanLiteral() throws ParseException {
+ /*@bgen(jjtree) BooleanLiteral */
+ SimpleNode jjtn000 = new SimpleNode(JJTBOOLEANLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case TRUE:
+ jj_consume_token(TRUE);
+ break;
+ case FALSE:
+ jj_consume_token(FALSE);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void NullLiteral() throws ParseException {
+ /*@bgen(jjtree) NullLiteral */
+ SimpleNode jjtn000 = new SimpleNode(JJTNULLLITERAL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(NULL);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Arguments() throws ParseException {
+ /*@bgen(jjtree) Arguments */
+ SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LPAREN);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case BANG:
+ case TILDE:
+ case INCR:
+ case DECR:
+ case PLUS:
+ case MINUS:
+ ArgumentList();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ArgumentList() throws ParseException {
+ /*@bgen(jjtree) ArgumentList */
+ SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Expression();
+ label_36:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_36;
+ }
+ jj_consume_token(COMMA);
+ Expression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AllocationExpression() throws ParseException {
+ /*@bgen(jjtree) AllocationExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTALLOCATIONEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_36(2)) {
+ jj_consume_token(NEW);
+ PrimitiveType();
+ ArrayDimsAndInits();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case NEW:
+ jj_consume_token(NEW);
+ ClassOrInterfaceType();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LT:
+ TypeArguments();
+ break;
+ default:
+ ;
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACKET:
+ ArrayDimsAndInits();
+ break;
+ case LPAREN:
+ Arguments();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACE:
+ ClassOrInterfaceBody(false);
+ break;
+ default:
+ ;
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /*
+ * The third LOOKAHEAD specification below is to parse to PrimarySuffix
+ * if there is an expression between the "[...]".
+ */
+ final public void ArrayDimsAndInits() throws ParseException {
+ /*@bgen(jjtree) ArrayDimsAndInits */
+ SimpleNode jjtn000 = new SimpleNode(JJTARRAYDIMSANDINITS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_39(2)) {
+ label_37:
+ while (true) {
+ jj_consume_token(LBRACKET);
+ Expression();
+ jj_consume_token(RBRACKET);
+ if (jj_2_37(2)) {
+ ;
+ } else {
+ break label_37;
+ }
+ }
+ label_38:
+ while (true) {
+ if (jj_2_38(2)) {
+ ;
+ } else {
+ break label_38;
+ }
+ jj_consume_token(LBRACKET);
+ jj_consume_token(RBRACKET);
+ }
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACKET:
+ label_39:
+ while (true) {
+ jj_consume_token(LBRACKET);
+ jj_consume_token(RBRACKET);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case LBRACKET:
+ ;
+ break;
+ default:
+ break label_39;
+ }
+ }
+ ArrayInitializer();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /*
+ * Statement syntax follows.
+ */
+ final public void Statement() throws ParseException {
+ /*@bgen(jjtree) Statement */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_40(2)) {
+ LabeledStatement();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ASSERT:
+ AssertStatement();
+ break;
+ case LBRACE:
+ Block();
+ break;
+ case SEMICOLON:
+ EmptyStatement();
+ break;
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case INCR:
+ case DECR:
+ StatementExpression();
+ jj_consume_token(SEMICOLON);
+ break;
+ case SWITCH:
+ SwitchStatement();
+ break;
+ case IF:
+ IfStatement();
+ break;
+ case WHILE:
+ WhileStatement();
+ break;
+ case DO:
+ DoStatement();
+ break;
+ case FOR:
+ ForStatement();
+ break;
+ case BREAK:
+ BreakStatement();
+ break;
+ case CONTINUE:
+ ContinueStatement();
+ break;
+ case RETURN:
+ ReturnStatement();
+ break;
+ case THROW:
+ ThrowStatement();
+ break;
+ case SYNCHRONIZED:
+ SynchronizedStatement();
+ break;
+ case TRY:
+ TryStatement();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AssertStatement() throws ParseException {
+ /*@bgen(jjtree) AssertStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTASSERTSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(ASSERT);
+ Expression();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COLON:
+ jj_consume_token(COLON);
+ Expression();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void LabeledStatement() throws ParseException {
+ /*@bgen(jjtree) LabeledStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTLABELEDSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ jj_consume_token(COLON);
+ Statement();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void Block() throws ParseException {
+ /*@bgen(jjtree) Block */
+ SimpleNode jjtn000 = new SimpleNode(JJTBLOCK);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LBRACE);
+ label_40:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case ASSERT:
+ case BOOLEAN:
+ case BREAK:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case CONTINUE:
+ case DO:
+ case DOUBLE:
+ case FALSE:
+ case FINAL:
+ case FLOAT:
+ case FOR:
+ case IF:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case NEW:
+ case NULL:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case RETURN:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SUPER:
+ case SWITCH:
+ case SYNCHRONIZED:
+ case THIS:
+ case THROW:
+ case TRANSIENT:
+ case TRUE:
+ case TRY:
+ case VOID:
+ case VOLATILE:
+ case WHILE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case LBRACE:
+ case SEMICOLON:
+ case AT:
+ case INCR:
+ case DECR:
+ ;
+ break;
+ default:
+ break label_40;
+ }
+ BlockStatement();
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void BlockStatement() throws ParseException {
+ /*@bgen(jjtree) BlockStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTBLOCKSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_41(2147483647)) {
+ LocalVariableDeclaration();
+ jj_consume_token(SEMICOLON);
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ASSERT:
+ case BOOLEAN:
+ case BREAK:
+ case BYTE:
+ case CHAR:
+ case CONTINUE:
+ case DO:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case FOR:
+ case IF:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case RETURN:
+ case SHORT:
+ case SUPER:
+ case SWITCH:
+ case SYNCHRONIZED:
+ case THIS:
+ case THROW:
+ case TRUE:
+ case TRY:
+ case VOID:
+ case WHILE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case LBRACE:
+ case SEMICOLON:
+ case INCR:
+ case DECR:
+ Statement();
+ break;
+ case CLASS:
+ case INTERFACE:
+ ClassOrInterfaceDeclaration(0);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void LocalVariableDeclaration() throws ParseException {
+ /*@bgen(jjtree) LocalVariableDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTLOCALVARIABLEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ Modifiers();
+ Type();
+ VariableDeclarator();
+ label_41:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_41;
+ }
+ jj_consume_token(COMMA);
+ VariableDeclarator();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void EmptyStatement() throws ParseException {
+ /*@bgen(jjtree) EmptyStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTEMPTYSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(SEMICOLON);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void StatementExpression() throws ParseException {
+ /*@bgen(jjtree) StatementExpression */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case INCR:
+ PreIncrementExpression();
+ break;
+ case DECR:
+ PreDecrementExpression();
+ break;
+ default:
+ if (jj_2_42(2147483647)) {
+ AssignmentExpression();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ PostfixExpression();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void SwitchStatement() throws ParseException {
+ /*@bgen(jjtree) SwitchStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTSWITCHSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(SWITCH);
+ jj_consume_token(LPAREN);
+ Expression();
+ jj_consume_token(RPAREN);
+ jj_consume_token(LBRACE);
+ label_42:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case CASE:
+ case _DEFAULT:
+ ;
+ break;
+ default:
+ break label_42;
+ }
+ SwitchLabel();
+ label_43:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case ASSERT:
+ case BOOLEAN:
+ case BREAK:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case CONTINUE:
+ case DO:
+ case DOUBLE:
+ case FALSE:
+ case FINAL:
+ case FLOAT:
+ case FOR:
+ case IF:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case NEW:
+ case NULL:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case RETURN:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SUPER:
+ case SWITCH:
+ case SYNCHRONIZED:
+ case THIS:
+ case THROW:
+ case TRANSIENT:
+ case TRUE:
+ case TRY:
+ case VOID:
+ case VOLATILE:
+ case WHILE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case LBRACE:
+ case SEMICOLON:
+ case AT:
+ case INCR:
+ case DECR:
+ ;
+ break;
+ default:
+ break label_43;
+ }
+ BlockStatement();
+ }
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void SwitchLabel() throws ParseException {
+ /*@bgen(jjtree) SwitchLabel */
+ SimpleNode jjtn000 = new SimpleNode(JJTSWITCHLABEL);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case CASE:
+ jj_consume_token(CASE);
+ Expression();
+ jj_consume_token(COLON);
+ break;
+ case _DEFAULT:
+ jj_consume_token(_DEFAULT);
+ jj_consume_token(COLON);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void IfStatement() throws ParseException {
+ /*@bgen(jjtree) IfStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTIFSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IF);
+ jj_consume_token(LPAREN);
+ Expression();
+ jj_consume_token(RPAREN);
+ Statement();
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ELSE:
+ jj_consume_token(ELSE);
+ Statement();
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void WhileStatement() throws ParseException {
+ /*@bgen(jjtree) WhileStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTWHILESTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(WHILE);
+ jj_consume_token(LPAREN);
+ Expression();
+ jj_consume_token(RPAREN);
+ Statement();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void DoStatement() throws ParseException {
+ /*@bgen(jjtree) DoStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTDOSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(DO);
+ Statement();
+ jj_consume_token(WHILE);
+ jj_consume_token(LPAREN);
+ Expression();
+ jj_consume_token(RPAREN);
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ForStatement() throws ParseException {
+ /*@bgen(jjtree) ForStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(FOR);
+ jj_consume_token(LPAREN);
+ if (jj_2_43(2147483647)) {
+ Modifiers();
+ Type();
+ jj_consume_token(IDENTIFIER);
+ jj_consume_token(COLON);
+ Expression();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NATIVE:
+ case NEW:
+ case NULL:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SUPER:
+ case SYNCHRONIZED:
+ case THIS:
+ case TRANSIENT:
+ case TRUE:
+ case VOID:
+ case VOLATILE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case SEMICOLON:
+ case AT:
+ case INCR:
+ case DECR:
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NATIVE:
+ case NEW:
+ case NULL:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SUPER:
+ case SYNCHRONIZED:
+ case THIS:
+ case TRANSIENT:
+ case TRUE:
+ case VOID:
+ case VOLATILE:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case AT:
+ case INCR:
+ case DECR:
+ ForInit();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case BANG:
+ case TILDE:
+ case INCR:
+ case DECR:
+ case PLUS:
+ case MINUS:
+ Expression();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case INCR:
+ case DECR:
+ ForUpdate();
+ break;
+ default:
+ ;
+ }
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ jj_consume_token(RPAREN);
+ Statement();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ForInit() throws ParseException {
+ /*@bgen(jjtree) ForInit */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORINIT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_44(2147483647)) {
+ LocalVariableDeclaration();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case INCR:
+ case DECR:
+ StatementExpressionList();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void StatementExpressionList() throws ParseException {
+ /*@bgen(jjtree) StatementExpressionList */
+ SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSIONLIST);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ StatementExpression();
+ label_44:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_44;
+ }
+ jj_consume_token(COMMA);
+ StatementExpression();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ForUpdate() throws ParseException {
+ /*@bgen(jjtree) ForUpdate */
+ SimpleNode jjtn000 = new SimpleNode(JJTFORUPDATE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ StatementExpressionList();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void BreakStatement() throws ParseException {
+ /*@bgen(jjtree) BreakStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTBREAKSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(BREAK);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ jj_consume_token(IDENTIFIER);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ContinueStatement() throws ParseException {
+ /*@bgen(jjtree) ContinueStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTCONTINUESTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(CONTINUE);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ jj_consume_token(IDENTIFIER);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ReturnStatement() throws ParseException {
+ /*@bgen(jjtree) ReturnStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTRETURNSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(RETURN);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case BANG:
+ case TILDE:
+ case INCR:
+ case DECR:
+ case PLUS:
+ case MINUS:
+ Expression();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void ThrowStatement() throws ParseException {
+ /*@bgen(jjtree) ThrowStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTTHROWSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(THROW);
+ Expression();
+ jj_consume_token(SEMICOLON);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void SynchronizedStatement() throws ParseException {
+ /*@bgen(jjtree) SynchronizedStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTSYNCHRONIZEDSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(SYNCHRONIZED);
+ jj_consume_token(LPAREN);
+ Expression();
+ jj_consume_token(RPAREN);
+ Block();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void TryStatement() throws ParseException {
+ /*@bgen(jjtree) TryStatement */
+ SimpleNode jjtn000 = new SimpleNode(JJTTRYSTATEMENT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(TRY);
+ Block();
+ label_45:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case CATCH:
+ ;
+ break;
+ default:
+ break label_45;
+ }
+ jj_consume_token(CATCH);
+ jj_consume_token(LPAREN);
+ FormalParameter();
+ jj_consume_token(RPAREN);
+ Block();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case FINALLY:
+ jj_consume_token(FINALLY);
+ Block();
+ break;
+ default:
+ ;
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /* We use productions to match >>>, >> and > so that we can keep the
+ * type declaration syntax with generics clean
+ */
+ final public void RUNSIGNEDSHIFT() throws ParseException {
+ /*@bgen(jjtree) RUNSIGNEDSHIFT */
+ SimpleNode jjtn000 = new SimpleNode(JJTRUNSIGNEDSHIFT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (getToken(1).kind == GT &&
+ ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT) {
+
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(GT);
+ jj_consume_token(GT);
+ jj_consume_token(GT);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void RSIGNEDSHIFT() throws ParseException {
+ /*@bgen(jjtree) RSIGNEDSHIFT */
+ SimpleNode jjtn000 = new SimpleNode(JJTRSIGNEDSHIFT);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (getToken(1).kind == GT &&
+ ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT) {
+
+ } else {
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ jj_consume_token(GT);
+ jj_consume_token(GT);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /* Annotation syntax follows. */
+ final public void Annotation() throws ParseException {
+ /*@bgen(jjtree) Annotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ if (jj_2_45(2147483647)) {
+ NormalAnnotation();
+ } else if (jj_2_46(2147483647)) {
+ SingleMemberAnnotation();
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case AT:
+ MarkerAnnotation();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void NormalAnnotation() throws ParseException {
+ /*@bgen(jjtree) NormalAnnotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTNORMALANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(AT);
+ Name();
+ jj_consume_token(LPAREN);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case IDENTIFIER:
+ MemberValuePairs();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(RPAREN);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MarkerAnnotation() throws ParseException {
+ /*@bgen(jjtree) MarkerAnnotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTMARKERANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(AT);
+ Name();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void SingleMemberAnnotation() throws ParseException {
+ /*@bgen(jjtree) SingleMemberAnnotation */
+ SimpleNode jjtn000 = new SimpleNode(JJTSINGLEMEMBERANNOTATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(AT);
+ Name();
+ jj_consume_token(LPAREN);
+ MemberValue();
+ jj_consume_token(RPAREN);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MemberValuePairs() throws ParseException {
+ /*@bgen(jjtree) MemberValuePairs */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIRS);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ MemberValuePair();
+ label_46:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ break label_46;
+ }
+ jj_consume_token(COMMA);
+ MemberValuePair();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MemberValuePair() throws ParseException {
+ /*@bgen(jjtree) MemberValuePair */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIR);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(IDENTIFIER);
+ jj_consume_token(ASSIGN);
+ MemberValue();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MemberValue() throws ParseException {
+ /*@bgen(jjtree) MemberValue */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case AT:
+ Annotation();
+ break;
+ case LBRACE:
+ MemberValueArrayInitializer();
+ break;
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FALSE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case NEW:
+ case NULL:
+ case SHORT:
+ case SUPER:
+ case THIS:
+ case TRUE:
+ case VOID:
+ case INTEGER_LITERAL:
+ case FLOATING_POINT_LITERAL:
+ case CHARACTER_LITERAL:
+ case STRING_LITERAL:
+ case IDENTIFIER:
+ case LPAREN:
+ case BANG:
+ case TILDE:
+ case INCR:
+ case DECR:
+ case PLUS:
+ case MINUS:
+ ConditionalExpression();
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void MemberValueArrayInitializer() throws ParseException {
+ /*@bgen(jjtree) MemberValueArrayInitializer */
+ SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEARRAYINITIALIZER);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LBRACE);
+ MemberValue();
+ label_47:
+ while (true) {
+ if (jj_2_47(2)) {
+ ;
+ } else {
+ break label_47;
+ }
+ jj_consume_token(COMMA);
+ MemberValue();
+ }
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case COMMA:
+ jj_consume_token(COMMA);
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ /* Annotation Types. */
+ final public void AnnotationTypeDeclaration(int modifiers) throws ParseException {
+ /*@bgen(jjtree) AnnotationTypeDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(AT);
+ jj_consume_token(INTERFACE);
+ jj_consume_token(IDENTIFIER);
+ AnnotationTypeBody();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AnnotationTypeBody() throws ParseException {
+ /*@bgen(jjtree) AnnotationTypeBody */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEBODY);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(LBRACE);
+ label_48:
+ while (true) {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case DOUBLE:
+ case ENUM:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOLATILE:
+ case IDENTIFIER:
+ case SEMICOLON:
+ case AT:
+ ;
+ break;
+ default:
+ break label_48;
+ }
+ AnnotationTypeMemberDeclaration();
+ }
+ jj_consume_token(RBRACE);
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void AnnotationTypeMemberDeclaration() throws ParseException {
+ /*@bgen(jjtree) AnnotationTypeMemberDeclaration */
+ SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEMEMBERDECLARATION);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ int modifiers;
+ try {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case ABSTRACT:
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case CLASS:
+ case DOUBLE:
+ case ENUM:
+ case FINAL:
+ case FLOAT:
+ case INT:
+ case INTERFACE:
+ case LONG:
+ case NATIVE:
+ case PRIVATE:
+ case PROTECTED:
+ case PUBLIC:
+ case SHORT:
+ case STATIC:
+ case STRICTFP:
+ case SYNCHRONIZED:
+ case TRANSIENT:
+ case VOLATILE:
+ case IDENTIFIER:
+ case AT:
+ modifiers = Modifiers();
+ if (jj_2_48(2147483647)) {
+ Type();
+ jj_consume_token(IDENTIFIER);
+ jj_consume_token(LPAREN);
+ jj_consume_token(RPAREN);
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case _DEFAULT:
+ DefaultValue();
+ break;
+ default:
+ ;
+ }
+ jj_consume_token(SEMICOLON);
+ } else {
+ switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
+ case CLASS:
+ case INTERFACE:
+ ClassOrInterfaceDeclaration(modifiers);
+ break;
+ case ENUM:
+ EnumDeclaration(modifiers);
+ break;
+ case AT:
+ AnnotationTypeDeclaration(modifiers);
+ break;
+ case BOOLEAN:
+ case BYTE:
+ case CHAR:
+ case DOUBLE:
+ case FLOAT:
+ case INT:
+ case LONG:
+ case SHORT:
+ case IDENTIFIER:
+ FieldDeclaration(modifiers);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ break;
+ case SEMICOLON:
+ jj_consume_token(SEMICOLON);
+ break;
+ default:
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final public void DefaultValue() throws ParseException {
+ /*@bgen(jjtree) DefaultValue */
+ SimpleNode jjtn000 = new SimpleNode(JJTDEFAULTVALUE);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ jjtreeOpenNodeScope(jjtn000);
+ try {
+ jj_consume_token(_DEFAULT);
+ MemberValue();
+ } catch (Throwable jjte000) {
+ if (jjtc000) {
+ jjtree.clearNodeScope(jjtn000);
+ jjtc000 = false;
+ } else {
+ jjtree.popNode();
+ }
+ if (jjte000 instanceof RuntimeException) {
+ {
+ if (true) throw (RuntimeException) jjte000;
+ }
+ }
+ if (jjte000 instanceof ParseException) {
+ {
+ if (true) throw (ParseException) jjte000;
+ }
+ }
+ {
+ if (true) throw (Error) jjte000;
+ }
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, true);
+ jjtreeCloseNodeScope(jjtn000);
+ }
+ }
+ }
+
+ final private boolean jj_2_1(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_1();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_2(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_2();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_3(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_3();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_4(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_4();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_5(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_5();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_6(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_6();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_7(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_7();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_8(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_8();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_9(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_9();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_10(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_10();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_11(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_11();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_12(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_12();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_13(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_13();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_14(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_14();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_15(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_15();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_16(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_16();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_17(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_17();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_18(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_18();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_19(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_19();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_20(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_20();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_21(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_21();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_22(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_22();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_23(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_23();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_24(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_24();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_25(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_25();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_26(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_26();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_27(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_27();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_28(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_28();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_29(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_29();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_30(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_30();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_31(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_31();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_32(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_32();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_33(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_33();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_34(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_34();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_35(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_35();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_36(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_36();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_37(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_37();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_38(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_38();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_39(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_39();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_40(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_40();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_41(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_41();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_42(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_42();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_43(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_43();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_44(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_44();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_45(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_45();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_46(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_46();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_47(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_47();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_2_48(int xla) {
+ jj_la = xla;
+ jj_lastpos = jj_scanpos = token;
+ try {
+ return !jj_3_48();
+ }
+ catch (LookaheadSuccess ls) {
+ return true;
+ }
+ }
+
+ final private boolean jj_3R_56() {
+ if (jj_3R_101()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_21()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_135() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_91()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_99() {
+ if (jj_3R_91()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_135()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3_20() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_91() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_20()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_122() {
+ if (jj_3R_72()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_86() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(58)) {
+ jj_scanpos = xsp;
+ if (jj_3R_122()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3_19() {
+ if (jj_3R_78()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_83() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(10)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(15)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(12)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(46)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(35)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(37)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(28)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(21)) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_194() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_112()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_290() {
+ if (jj_scan_token(SUPER)) return true;
+ if (jj_3R_77()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_16() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_289() {
+ if (jj_scan_token(EXTENDS)) return true;
+ if (jj_3R_77()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_277() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_289()) {
+ jj_scanpos = xsp;
+ if (jj_3R_290()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_256() {
+ if (jj_3R_277()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_151() {
+ if (jj_scan_token(HOOK)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_256()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3_17() {
+ if (jj_3R_78()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_112() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_150()) {
+ jj_scanpos = xsp;
+ if (jj_3R_151()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_150() {
+ if (jj_3R_77()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_15() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_78() {
+ if (jj_scan_token(LT)) return true;
+ if (jj_3R_112()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_194()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(GT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_18() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_19()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_149() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_17()) jj_scanpos = xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_18()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_111() {
+ if (jj_3R_149()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_16()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_110() {
+ if (jj_3R_83()) return true;
+ Token xsp;
+ if (jj_3_15()) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_15()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_77() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_110()) {
+ jj_scanpos = xsp;
+ if (jj_3R_111()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3_13() {
+ if (jj_scan_token(THIS)) return true;
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_221() {
+ if (jj_scan_token(THROWS)) return true;
+ if (jj_3R_99()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_103() {
+ if (jj_3R_83()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_72() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_14()) {
+ jj_scanpos = xsp;
+ if (jj_3R_103()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3_14() {
+ if (jj_3R_77()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_74() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(47)) jj_scanpos = xsp;
+ if (jj_3R_104()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_12() {
+ if (jj_3R_76()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_108() {
+ if (jj_3R_78()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_107() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_252() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_76() {
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_107()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ xsp = jj_scanpos;
+ if (jj_3_13()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_108()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(52)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(49)) return true;
+ }
+ if (jj_3R_109()) return true;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_134() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_133()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_223() {
+ if (jj_3R_49()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_222() {
+ if (jj_3R_76()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_220() {
+ if (jj_3R_97()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_186() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_220()) jj_scanpos = xsp;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_3R_53()) return true;
+ xsp = jj_scanpos;
+ if (jj_3R_221()) jj_scanpos = xsp;
+ if (jj_scan_token(LBRACE)) return true;
+ xsp = jj_scanpos;
+ if (jj_3R_222()) jj_scanpos = xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_223()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(RBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_11() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_75()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_227() {
+ if (jj_scan_token(THROWS)) return true;
+ if (jj_3R_99()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_98() {
+ if (jj_3R_133()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_134()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_133() {
+ if (jj_3R_50()) return true;
+ if (jj_3R_72()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(119)) jj_scanpos = xsp;
+ if (jj_3R_184()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_53() {
+ if (jj_scan_token(LPAREN)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_98()) jj_scanpos = xsp;
+ if (jj_scan_token(RPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_48() {
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_226() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_3R_53()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_252()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_228() {
+ if (jj_3R_104()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_225() {
+ if (jj_3R_97()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_292() {
+ if (jj_3R_75()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_11()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_188() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_225()) jj_scanpos = xsp;
+ if (jj_3R_86()) return true;
+ if (jj_3R_226()) return true;
+ xsp = jj_scanpos;
+ if (jj_3R_227()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_228()) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(81)) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_198() {
+ if (jj_scan_token(ASSIGN)) return true;
+ if (jj_3R_75()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_224() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_47() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_93()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_217() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_147() {
+ if (jj_scan_token(LBRACE)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_292()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(82)) jj_scanpos = xsp;
+ if (jj_scan_token(RBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_73() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_106() {
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_105() {
+ if (jj_3R_147()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_75() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_105()) {
+ jj_scanpos = xsp;
+ if (jj_3R_106()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_184() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_217()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_160() {
+ if (jj_scan_token(LBRACE)) return true;
+ if (jj_3R_93()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_47()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ xsp = jj_scanpos;
+ if (jj_scan_token(82)) jj_scanpos = xsp;
+ if (jj_scan_token(RBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_276() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_275()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_161() {
+ if (jj_3R_184()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_198()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_127() {
+ if (jj_3R_101()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_9() {
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_73()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ xsp = jj_scanpos;
+ if (jj_scan_token(82)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(85)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(81)) return true;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_126() {
+ if (jj_3R_160()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_71() {
+ if (jj_3R_97()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_93() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_125()) {
+ jj_scanpos = xsp;
+ if (jj_3R_126()) {
+ jj_scanpos = xsp;
+ if (jj_3R_127()) return true;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_125() {
+ if (jj_3R_102()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_8() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_71()) jj_scanpos = xsp;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_187() {
+ if (jj_3R_72()) return true;
+ if (jj_3R_161()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_224()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_275() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(ASSIGN)) return true;
+ if (jj_3R_93()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_140() {
+ if (jj_3R_188()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_139() {
+ if (jj_3R_187()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_249() {
+ if (jj_scan_token(BIT_AND)) return true;
+ if (jj_3R_149()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_138() {
+ if (jj_3R_186()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_255() {
+ if (jj_3R_275()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_276()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_231() {
+ if (jj_3R_255()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_137() {
+ if (jj_3R_185()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_92() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(ASSIGN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_136() {
+ if (jj_3R_130()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_192() {
+ if (jj_scan_token(AT)) return true;
+ if (jj_3R_91()) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_93()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_286() {
+ if (jj_3R_182()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_100() {
+ if (jj_3R_50()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_136()) {
+ jj_scanpos = xsp;
+ if (jj_3R_137()) {
+ jj_scanpos = xsp;
+ if (jj_3R_138()) {
+ jj_scanpos = xsp;
+ if (jj_3R_139()) {
+ jj_scanpos = xsp;
+ if (jj_3R_140()) return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_193() {
+ if (jj_scan_token(AT)) return true;
+ if (jj_3R_91()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_46() {
+ if (jj_scan_token(AT)) return true;
+ if (jj_3R_91()) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_10() {
+ if (jj_3R_74()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_55() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_10()) {
+ jj_scanpos = xsp;
+ if (jj_3R_100()) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(81)) return true;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_191() {
+ if (jj_scan_token(AT)) return true;
+ if (jj_3R_91()) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_231()) jj_scanpos = xsp;
+ if (jj_scan_token(RPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_45() {
+ if (jj_scan_token(AT)) return true;
+ if (jj_3R_91()) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_92()) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(76)) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_215() {
+ if (jj_3R_55()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_132() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_131()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_183() {
+ if (jj_3R_216()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_285() {
+ if (jj_3R_109()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_145() {
+ if (jj_3R_193()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_182() {
+ if (jj_scan_token(LBRACE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_215()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(RBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_144() {
+ if (jj_3R_192()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_113() {
+ return false;
+ }
+
+ final private boolean jj_3R_102() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_143()) {
+ jj_scanpos = xsp;
+ if (jj_3R_144()) {
+ jj_scanpos = xsp;
+ if (jj_3R_145()) return true;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_143() {
+ if (jj_3R_191()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_216() {
+ if (jj_scan_token(EXTENDS)) return true;
+ if (jj_3R_149()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_249()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_131() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_183()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_114() {
+ return false;
+ }
+
+ final private boolean jj_3_7() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_70()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_80() {
+ Token xsp;
+ xsp = jj_scanpos;
+ lookingAhead = true;
+ jj_semLA = getToken(1).kind == GT &&
+ ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT;
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_113()) return true;
+ if (jj_scan_token(GT)) return true;
+ if (jj_scan_token(GT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_97() {
+ if (jj_scan_token(LT)) return true;
+ if (jj_3R_131()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_132()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(GT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_272() {
+ if (jj_3R_55()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_70() {
+ if (jj_3R_50()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_285()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_286()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_81() {
+ Token xsp;
+ xsp = jj_scanpos;
+ lookingAhead = true;
+ jj_semLA = getToken(1).kind == GT &&
+ ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT;
+ lookingAhead = false;
+ if (!jj_semLA || jj_3R_114()) return true;
+ if (jj_scan_token(GT)) return true;
+ if (jj_scan_token(GT)) return true;
+ if (jj_scan_token(GT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_251() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_272()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_250() {
+ if (jj_3R_70()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_7()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_246() {
+ if (jj_scan_token(FINALLY)) return true;
+ if (jj_3R_104()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_219() {
+ if (jj_scan_token(LBRACE)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_250()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(82)) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_251()) jj_scanpos = xsp;
+ if (jj_scan_token(RBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_245() {
+ if (jj_scan_token(CATCH)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_133()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_3R_104()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_212() {
+ if (jj_scan_token(TRY)) return true;
+ if (jj_3R_104()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_245()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ xsp = jj_scanpos;
+ if (jj_3R_246()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_218() {
+ if (jj_3R_214()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_185() {
+ if (jj_scan_token(ENUM)) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_218()) jj_scanpos = xsp;
+ if (jj_3R_219()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_211() {
+ if (jj_scan_token(SYNCHRONIZED)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_3R_104()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_244() {
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_248() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_149()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_214() {
+ if (jj_scan_token(IMPLEMENTS)) return true;
+ if (jj_3R_149()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_248()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_210() {
+ if (jj_scan_token(THROW)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_271() {
+ if (jj_3R_284()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_299() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_201()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_209() {
+ if (jj_scan_token(RETURN)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_244()) jj_scanpos = xsp;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_247() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_149()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_213() {
+ if (jj_scan_token(EXTENDS)) return true;
+ if (jj_3R_149()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_247()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_208() {
+ if (jj_scan_token(CONTINUE)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(72)) jj_scanpos = xsp;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_178() {
+ if (jj_scan_token(INTERFACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_207() {
+ if (jj_scan_token(BREAK)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(72)) jj_scanpos = xsp;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_181() {
+ if (jj_3R_214()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_180() {
+ if (jj_3R_213()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_179() {
+ if (jj_3R_97()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_284() {
+ if (jj_3R_296()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_270() {
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_130() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(16)) {
+ jj_scanpos = xsp;
+ if (jj_3R_178()) return true;
+ }
+ if (jj_scan_token(IDENTIFIER)) return true;
+ xsp = jj_scanpos;
+ if (jj_3R_179()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_180()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_181()) jj_scanpos = xsp;
+ if (jj_3R_182()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_44() {
+ if (jj_3R_50()) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_296() {
+ if (jj_3R_201()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_299()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_241() {
+ if (jj_scan_token(ELSE)) return true;
+ if (jj_3R_129()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_295() {
+ if (jj_3R_296()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_43() {
+ if (jj_3R_50()) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(COLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_294() {
+ if (jj_3R_128()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_283() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_294()) {
+ jj_scanpos = xsp;
+ if (jj_3R_295()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_269() {
+ if (jj_3R_283()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_243() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_269()) jj_scanpos = xsp;
+ if (jj_scan_token(SEMICOLON)) return true;
+ xsp = jj_scanpos;
+ if (jj_3R_270()) jj_scanpos = xsp;
+ if (jj_scan_token(SEMICOLON)) return true;
+ xsp = jj_scanpos;
+ if (jj_3R_271()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_242() {
+ if (jj_3R_50()) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_54() {
+ if (jj_scan_token(THROWS)) return true;
+ if (jj_3R_99()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_206() {
+ if (jj_scan_token(FOR)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_242()) {
+ jj_scanpos = xsp;
+ if (jj_3R_243()) return true;
+ }
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_3R_129()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_69() {
+ if (jj_3R_102()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_205() {
+ if (jj_scan_token(DO)) return true;
+ if (jj_3R_129()) return true;
+ if (jj_scan_token(WHILE)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_68() {
+ if (jj_scan_token(STRICTFP)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_67() {
+ if (jj_scan_token(VOLATILE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_66() {
+ if (jj_scan_token(TRANSIENT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_204() {
+ if (jj_scan_token(WHILE)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_3R_129()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_65() {
+ if (jj_scan_token(NATIVE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_64() {
+ if (jj_scan_token(SYNCHRONIZED)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_63() {
+ if (jj_scan_token(ABSTRACT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_268() {
+ if (jj_3R_49()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_203() {
+ if (jj_scan_token(IF)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_3R_129()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_241()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_62() {
+ if (jj_scan_token(FINAL)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_61() {
+ if (jj_scan_token(PRIVATE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_162() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_161()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_60() {
+ if (jj_scan_token(PROTECTED)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_59() {
+ if (jj_scan_token(STATIC)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_58() {
+ if (jj_scan_token(PUBLIC)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_282() {
+ if (jj_scan_token(_DEFAULT)) return true;
+ if (jj_scan_token(COLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_6() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_58()) {
+ jj_scanpos = xsp;
+ if (jj_3R_59()) {
+ jj_scanpos = xsp;
+ if (jj_3R_60()) {
+ jj_scanpos = xsp;
+ if (jj_3R_61()) {
+ jj_scanpos = xsp;
+ if (jj_3R_62()) {
+ jj_scanpos = xsp;
+ if (jj_3R_63()) {
+ jj_scanpos = xsp;
+ if (jj_3R_64()) {
+ jj_scanpos = xsp;
+ if (jj_3R_65()) {
+ jj_scanpos = xsp;
+ if (jj_3R_66()) {
+ jj_scanpos = xsp;
+ if (jj_3R_67()) {
+ jj_scanpos = xsp;
+ if (jj_3R_68()) {
+ jj_scanpos = xsp;
+ if (jj_3R_69()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_281() {
+ if (jj_scan_token(CASE)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(COLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_267() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_281()) {
+ jj_scanpos = xsp;
+ if (jj_3R_282()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_50() {
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_6()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_240() {
+ if (jj_3R_267()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_268()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3_42() {
+ if (jj_3R_90()) return true;
+ if (jj_3R_79()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_202() {
+ if (jj_scan_token(SWITCH)) return true;
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_scan_token(LBRACE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_240()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(RBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_239() {
+ if (jj_3R_266()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_57() {
+ if (jj_3R_102()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_52() {
+ if (jj_3R_86()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_238() {
+ if (jj_3R_265()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_5() {
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_57()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(PACKAGE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_237() {
+ if (jj_3R_264()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_201() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_236()) {
+ jj_scanpos = xsp;
+ if (jj_3R_237()) {
+ jj_scanpos = xsp;
+ if (jj_3R_238()) {
+ jj_scanpos = xsp;
+ if (jj_3R_239()) return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_236() {
+ if (jj_3R_263()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_200() {
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_41() {
+ if (jj_3R_50()) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_128() {
+ if (jj_3R_50()) return true;
+ if (jj_3R_72()) return true;
+ if (jj_3R_161()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_162()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_51() {
+ if (jj_3R_97()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_235() {
+ if (jj_scan_token(COLON)) return true;
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_96() {
+ if (jj_3R_130()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_95() {
+ if (jj_3R_129()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_4() {
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_94() {
+ if (jj_3R_128()) return true;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_49() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_94()) {
+ jj_scanpos = xsp;
+ if (jj_3R_95()) {
+ jj_scanpos = xsp;
+ if (jj_3R_96()) return true;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_146() {
+ if (jj_3R_49()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_3() {
+ if (jj_3R_55()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_104() {
+ if (jj_scan_token(LBRACE)) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_146()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(RBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_2() {
+ if (jj_3R_50()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_51()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_52()) jj_scanpos = xsp;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_3R_53()) return true;
+ xsp = jj_scanpos;
+ if (jj_3R_54()) jj_scanpos = xsp;
+ if (jj_scan_token(LBRACE)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_89() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_3R_129()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_3R_49()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_199() {
+ if (jj_scan_token(ASSERT)) return true;
+ if (jj_3R_56()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_235()) jj_scanpos = xsp;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_177() {
+ if (jj_3R_212()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_176() {
+ if (jj_3R_211()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_38() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_175() {
+ if (jj_3R_210()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_174() {
+ if (jj_3R_209()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_173() {
+ if (jj_3R_208()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_172() {
+ if (jj_3R_207()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_171() {
+ if (jj_3R_206()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_170() {
+ if (jj_3R_205()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_169() {
+ if (jj_3R_204()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_168() {
+ if (jj_3R_203()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_167() {
+ if (jj_3R_202()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_166() {
+ if (jj_3R_201()) return true;
+ if (jj_scan_token(SEMICOLON)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_165() {
+ if (jj_3R_200()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_164() {
+ if (jj_3R_104()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_163() {
+ if (jj_3R_199()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_260() {
+ if (jj_3R_78()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_40() {
+ if (jj_3R_89()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_129() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_40()) {
+ jj_scanpos = xsp;
+ if (jj_3R_163()) {
+ jj_scanpos = xsp;
+ if (jj_3R_164()) {
+ jj_scanpos = xsp;
+ if (jj_3R_165()) {
+ jj_scanpos = xsp;
+ if (jj_3R_166()) {
+ jj_scanpos = xsp;
+ if (jj_3R_167()) {
+ jj_scanpos = xsp;
+ if (jj_3R_168()) {
+ jj_scanpos = xsp;
+ if (jj_3R_169()) {
+ jj_scanpos = xsp;
+ if (jj_3R_170()) {
+ jj_scanpos = xsp;
+ if (jj_3R_171()) {
+ jj_scanpos = xsp;
+ if (jj_3R_172()) {
+ jj_scanpos = xsp;
+ if (jj_3R_173()) {
+ jj_scanpos = xsp;
+ if (jj_3R_174()) {
+ jj_scanpos = xsp;
+ if (jj_3R_175()) {
+ jj_scanpos = xsp;
+ if (jj_3R_176()) {
+ jj_scanpos = xsp;
+ if (jj_3R_177())
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_279() {
+ if (jj_3R_182()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_291() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_278() {
+ Token xsp;
+ if (jj_3R_291()) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_291()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_3R_147()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_37() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_39() {
+ Token xsp;
+ if (jj_3_37()) return true;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_37()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_38()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_259() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_39()) {
+ jj_scanpos = xsp;
+ if (jj_3R_278()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_262() {
+ if (jj_3R_109()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_279()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_232() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_261() {
+ if (jj_3R_259()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_123() {
+ if (jj_scan_token(NEW)) return true;
+ if (jj_3R_149()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_260()) jj_scanpos = xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_261()) {
+ jj_scanpos = xsp;
+ if (jj_3R_262()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_87() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_36()) {
+ jj_scanpos = xsp;
+ if (jj_3R_123()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3_36() {
+ if (jj_scan_token(NEW)) return true;
+ if (jj_3R_83()) return true;
+ if (jj_3R_259()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_148() {
+ if (jj_3R_195()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_195() {
+ if (jj_3R_56()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_232()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_109() {
+ if (jj_scan_token(LPAREN)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_148()) jj_scanpos = xsp;
+ if (jj_scan_token(RPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_258() {
+ if (jj_scan_token(NULL)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_257() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(56)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(25)) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_234() {
+ if (jj_3R_258()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_233() {
+ if (jj_3R_257()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_196() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(61)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(65)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(70)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(71)) {
+ jj_scanpos = xsp;
+ if (jj_3R_233()) {
+ jj_scanpos = xsp;
+ if (jj_3R_234()) return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_152() {
+ if (jj_3R_196()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_121() {
+ if (jj_3R_109()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_120() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_33() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(THIS)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_119() {
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_32() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(SUPER)) return true;
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_35() {
+ if (jj_3R_88()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_34() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_3R_87()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_118() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(THIS)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_31() {
+ if (jj_3R_86()) return true;
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(CLASS)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_117() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(SUPER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_84() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_117()) {
+ jj_scanpos = xsp;
+ if (jj_3R_118()) {
+ jj_scanpos = xsp;
+ if (jj_3_34()) {
+ jj_scanpos = xsp;
+ if (jj_3_35()) {
+ jj_scanpos = xsp;
+ if (jj_3R_119()) {
+ jj_scanpos = xsp;
+ if (jj_3R_120()) {
+ jj_scanpos = xsp;
+ if (jj_3R_121()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_85() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_159() {
+ if (jj_3R_91()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_30() {
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_85()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(THIS)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_158() {
+ if (jj_3R_86()) return true;
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(CLASS)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_157() {
+ if (jj_3R_87()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_156() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ return false;
+ }
+
+ final private boolean jj_3_29() {
+ if (jj_3R_84()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_155() {
+ if (jj_scan_token(SUPER)) return true;
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_197() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ if (jj_scan_token(DOT)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_154() {
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_197()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ if (jj_scan_token(THIS)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_124() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_153()) {
+ jj_scanpos = xsp;
+ if (jj_3R_154()) {
+ jj_scanpos = xsp;
+ if (jj_3R_155()) {
+ jj_scanpos = xsp;
+ if (jj_3R_156()) {
+ jj_scanpos = xsp;
+ if (jj_3R_157()) {
+ jj_scanpos = xsp;
+ if (jj_3R_158()) {
+ jj_scanpos = xsp;
+ if (jj_3R_159()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_153() {
+ if (jj_3R_196()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_88() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_3R_78()) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_280() {
+ if (jj_3R_293()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_28() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_83()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_90() {
+ if (jj_3R_124()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_29()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_319() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_3R_313()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_318() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ if (jj_3R_307()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_317() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_318()) {
+ jj_scanpos = xsp;
+ if (jj_3R_319()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_293() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(97)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(98)) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3_27() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(LBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_266() {
+ if (jj_3R_90()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_280()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_116() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(RPAREN)) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(88)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(87)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(75)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(72)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(52)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(49)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(39)) {
+ jj_scanpos = xsp;
+ if (jj_3R_152()) return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_115() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_72()) return true;
+ if (jj_scan_token(LBRACKET)) return true;
+ if (jj_scan_token(RBRACKET)) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_82() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3_26()) {
+ jj_scanpos = xsp;
+ if (jj_3R_115()) {
+ jj_scanpos = xsp;
+ if (jj_3R_116()) return true;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3_26() {
+ if (jj_scan_token(LPAREN)) return true;
+ if (jj_3R_83()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_25() {
+ if (jj_3R_82()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_24() {
+ if (jj_3R_81()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_316() {
+ if (jj_3R_266()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_315() {
+ if (jj_3R_317()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_314() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(88)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(87)) return true;
+ }
+ if (jj_3R_307()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_313() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_314()) {
+ jj_scanpos = xsp;
+ if (jj_3R_315()) {
+ jj_scanpos = xsp;
+ if (jj_3R_316()) return true;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_264() {
+ if (jj_scan_token(DECR)) return true;
+ if (jj_3R_90()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_306() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(99)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(100)) return true;
+ }
+ if (jj_3R_305()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_308() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(101)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(102)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(106)) return true;
+ }
+ }
+ if (jj_3R_307()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_23() {
+ if (jj_3R_80()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_263() {
+ if (jj_scan_token(INCR)) return true;
+ if (jj_3R_90()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_312() {
+ if (jj_3R_313()) return true;
+ return false;
+ }
+
+ final private boolean jj_3_22() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(107)) {
+ jj_scanpos = xsp;
+ if (jj_3_23()) {
+ jj_scanpos = xsp;
+ if (jj_3_24()) return true;
+ }
+ }
+ if (jj_3R_304()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_311() {
+ if (jj_3R_264()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_310() {
+ if (jj_3R_263()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_309() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(99)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(100)) return true;
+ }
+ if (jj_3R_307()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_307() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_309()) {
+ jj_scanpos = xsp;
+ if (jj_3R_310()) {
+ jj_scanpos = xsp;
+ if (jj_3R_311()) {
+ jj_scanpos = xsp;
+ if (jj_3R_312()) return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_303() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(86)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(122)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(92)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(93)) return true;
+ }
+ }
+ }
+ if (jj_3R_302()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_301() {
+ if (jj_scan_token(INSTANCEOF)) return true;
+ if (jj_3R_72()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_305() {
+ if (jj_3R_307()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_308()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_298() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(91)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(94)) return true;
+ }
+ if (jj_3R_297()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_304() {
+ if (jj_3R_305()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_306()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_302() {
+ if (jj_3R_304()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3_22()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_288() {
+ if (jj_scan_token(BIT_AND)) return true;
+ if (jj_3R_287()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_300() {
+ if (jj_3R_302()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_303()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_254() {
+ if (jj_scan_token(BIT_OR)) return true;
+ if (jj_3R_253()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_297() {
+ if (jj_3R_300()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_301()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_274() {
+ if (jj_scan_token(XOR)) return true;
+ if (jj_3R_273()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_230() {
+ if (jj_scan_token(SC_AND)) return true;
+ if (jj_3R_229()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_287() {
+ if (jj_3R_297()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_298()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_190() {
+ if (jj_scan_token(SC_OR)) return true;
+ if (jj_3R_189()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_273() {
+ if (jj_3R_287()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_288()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_142() {
+ if (jj_scan_token(HOOK)) return true;
+ if (jj_3R_56()) return true;
+ if (jj_scan_token(COLON)) return true;
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_253() {
+ if (jj_3R_273()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_274()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_229() {
+ if (jj_3R_253()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_254()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_189() {
+ if (jj_3R_229()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_230()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_141() {
+ if (jj_3R_189()) return true;
+ Token xsp;
+ while (true) {
+ xsp = jj_scanpos;
+ if (jj_3R_190()) {
+ jj_scanpos = xsp;
+ break;
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_101() {
+ if (jj_3R_141()) return true;
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_142()) jj_scanpos = xsp;
+ return false;
+ }
+
+ final private boolean jj_3R_265() {
+ if (jj_3R_90()) return true;
+ if (jj_3R_79()) return true;
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_79() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(85)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(110)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(111)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(115)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(108)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(109)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(116)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(117)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(118)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(112)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(114)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(113))
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ final private boolean jj_3_21() {
+ if (jj_3R_79()) return true;
+ if (jj_3R_56()) return true;
+ return false;
+ }
+
+ public JavaParserTokenManager token_source;
+ JavaCharStream jj_input_stream;
+ public Token token, jj_nt;
+ private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
+
+ public JavaParser(java.io.InputStream stream) {
+ this(stream, null);
+ }
+
+ public JavaParser(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream = new JavaCharStream(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source = new JavaParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ }
+
+ public void ReInit(java.io.InputStream stream) {
+ ReInit(stream, null);
+ }
+
+ public void ReInit(java.io.InputStream stream, String encoding) {
+ try {
+ jj_input_stream.ReInit(stream, encoding, 1, 1);
+ } catch (java.io.UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ }
+
+ public JavaParser(java.io.Reader stream) {
+ jj_input_stream = new JavaCharStream(stream, 1, 1);
+ token_source = new JavaParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ }
+
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ }
+
+ public JavaParser(JavaParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ }
+
+ public void ReInit(JavaParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jjtree.reset();
+ }
+
+ final private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ return token;
+ }
+ token = oldToken;
+ throw generateParseException();
+ }
+
+ static private final class LookaheadSuccess extends java.lang.Error {
+ }
+
+ final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_scanpos.kind != kind) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+ return false;
+ }
+
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ return token;
+ }
+
+ final public Token getToken(int index) {
+ Token t = lookingAhead ? jj_scanpos : token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ final private int jj_ntk() {
+ if ((jj_nt = token.next) == null)
+ return (jj_ntk = (token.next = token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ public ParseException generateParseException() {
+ Token errortok = token.next;
+ int line = errortok.beginLine, column = errortok.beginColumn;
+ String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image;
+ return new ParseException("Unable to parse Java code near token: " + mess, line, column);
+ }
+
+ final public void enable_tracing() {
+ }
+
+ final public void disable_tracing() {
+ }
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,260 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */
+package jaxx.compiler.java.parser;
+
+public interface JavaParserConstants {
+
+ int EOF = 0;
+ int WHITE_SPACE = 3;
+ int SINGLE_LINE_COMMENT = 4;
+ int FORMAL_COMMENT = 5;
+ int MULTI_LINE_COMMENT = 6;
+ int ABSTRACT = 8;
+ int ASSERT = 9;
+ int BOOLEAN = 10;
+ int BREAK = 11;
+ int BYTE = 12;
+ int CASE = 13;
+ int CATCH = 14;
+ int CHAR = 15;
+ int CLASS = 16;
+ int CONST = 17;
+ int CONTINUE = 18;
+ int _DEFAULT = 19;
+ int DO = 20;
+ int DOUBLE = 21;
+ int ELSE = 22;
+ int ENUM = 23;
+ int EXTENDS = 24;
+ int FALSE = 25;
+ int FINAL = 26;
+ int FINALLY = 27;
+ int FLOAT = 28;
+ int FOR = 29;
+ int GOTO = 30;
+ int IF = 31;
+ int IMPLEMENTS = 32;
+ int IMPORT = 33;
+ int INSTANCEOF = 34;
+ int INT = 35;
+ int INTERFACE = 36;
+ int LONG = 37;
+ int NATIVE = 38;
+ int NEW = 39;
+ int NULL = 40;
+ int PACKAGE = 41;
+ int PRIVATE = 42;
+ int PROTECTED = 43;
+ int PUBLIC = 44;
+ int RETURN = 45;
+ int SHORT = 46;
+ int STATIC = 47;
+ int STRICTFP = 48;
+ int SUPER = 49;
+ int SWITCH = 50;
+ int SYNCHRONIZED = 51;
+ int THIS = 52;
+ int THROW = 53;
+ int THROWS = 54;
+ int TRANSIENT = 55;
+ int TRUE = 56;
+ int TRY = 57;
+ int VOID = 58;
+ int VOLATILE = 59;
+ int WHILE = 60;
+ int INTEGER_LITERAL = 61;
+ int DECIMAL_LITERAL = 62;
+ int HEX_LITERAL = 63;
+ int OCTAL_LITERAL = 64;
+ int FLOATING_POINT_LITERAL = 65;
+ int DECIMAL_FLOATING_POINT_LITERAL = 66;
+ int DECIMAL_EXPONENT = 67;
+ int HEXADECIMAL_FLOATING_POINT_LITERAL = 68;
+ int HEXADECIMAL_EXPONENT = 69;
+ int CHARACTER_LITERAL = 70;
+ int STRING_LITERAL = 71;
+ int IDENTIFIER = 72;
+ int LETTER = 73;
+ int PART_LETTER = 74;
+ int LPAREN = 75;
+ int RPAREN = 76;
+ int LBRACE = 77;
+ int RBRACE = 78;
+ int LBRACKET = 79;
+ int RBRACKET = 80;
+ int SEMICOLON = 81;
+ int COMMA = 82;
+ int DOT = 83;
+ int AT = 84;
+ int ASSIGN = 85;
+ int LT = 86;
+ int BANG = 87;
+ int TILDE = 88;
+ int HOOK = 89;
+ int COLON = 90;
+ int EQ = 91;
+ int LE = 92;
+ int GE = 93;
+ int NE = 94;
+ int SC_OR = 95;
+ int SC_AND = 96;
+ int INCR = 97;
+ int DECR = 98;
+ int PLUS = 99;
+ int MINUS = 100;
+ int STAR = 101;
+ int SLASH = 102;
+ int BIT_AND = 103;
+ int BIT_OR = 104;
+ int XOR = 105;
+ int REM = 106;
+ int LSHIFT = 107;
+ int PLUSASSIGN = 108;
+ int MINUSASSIGN = 109;
+ int STARASSIGN = 110;
+ int SLASHASSIGN = 111;
+ int ANDASSIGN = 112;
+ int ORASSIGN = 113;
+ int XORASSIGN = 114;
+ int REMASSIGN = 115;
+ int LSHIFTASSIGN = 116;
+ int RSIGNEDSHIFTASSIGN = 117;
+ int RUNSIGNEDSHIFTASSIGN = 118;
+ int ELLIPSIS = 119;
+ int RUNSIGNEDSHIFT = 120;
+ int RSIGNEDSHIFT = 121;
+ int GT = 122;
+ int STUFF_TO_IGNORE = 124;
+
+ int DEFAULT = 0;
+ int IN_FORMAL_COMMENT = 1;
+ int IN_MULTI_LINE_COMMENT = 2;
+
+ String[] tokenImage = {
+ "<EOF>",
+ "<token of kind 1>",
+ "\"/*\"",
+ "<WHITE_SPACE>",
+ "<SINGLE_LINE_COMMENT>",
+ "\"*/\"",
+ "\"*/\"",
+ "<token of kind 7>",
+ "\"abstract\"",
+ "\"assert\"",
+ "\"boolean\"",
+ "\"break\"",
+ "\"byte\"",
+ "\"case\"",
+ "\"catch\"",
+ "\"char\"",
+ "\"class\"",
+ "\"const\"",
+ "\"continue\"",
+ "\"default\"",
+ "\"do\"",
+ "\"double\"",
+ "\"else\"",
+ "\"enum\"",
+ "\"extends\"",
+ "\"false\"",
+ "\"final\"",
+ "\"finally\"",
+ "\"float\"",
+ "\"for\"",
+ "\"goto\"",
+ "\"if\"",
+ "\"implements\"",
+ "\"import\"",
+ "\"instanceof\"",
+ "\"int\"",
+ "\"interface\"",
+ "\"long\"",
+ "\"native\"",
+ "\"new\"",
+ "\"null\"",
+ "\"package\"",
+ "\"private\"",
+ "\"protected\"",
+ "\"public\"",
+ "\"return\"",
+ "\"short\"",
+ "\"static\"",
+ "\"strictfp\"",
+ "\"super\"",
+ "\"switch\"",
+ "\"synchronized\"",
+ "\"this\"",
+ "\"throw\"",
+ "\"throws\"",
+ "\"transient\"",
+ "\"true\"",
+ "\"try\"",
+ "\"void\"",
+ "\"volatile\"",
+ "\"while\"",
+ "<INTEGER_LITERAL>",
+ "<DECIMAL_LITERAL>",
+ "<HEX_LITERAL>",
+ "<OCTAL_LITERAL>",
+ "<FLOATING_POINT_LITERAL>",
+ "<DECIMAL_FLOATING_POINT_LITERAL>",
+ "<DECIMAL_EXPONENT>",
+ "<HEXADECIMAL_FLOATING_POINT_LITERAL>",
+ "<HEXADECIMAL_EXPONENT>",
+ "<CHARACTER_LITERAL>",
+ "<STRING_LITERAL>",
+ "<IDENTIFIER>",
+ "<LETTER>",
+ "<PART_LETTER>",
+ "\"(\"",
+ "\")\"",
+ "\"{\"",
+ "\"}\"",
+ "\"[\"",
+ "\"]\"",
+ "\";\"",
+ "\",\"",
+ "\".\"",
+ "\"@\"",
+ "\"=\"",
+ "\"<\"",
+ "\"!\"",
+ "\"~\"",
+ "\"?\"",
+ "\":\"",
+ "\"==\"",
+ "\"<=\"",
+ "\">=\"",
+ "\"!=\"",
+ "\"||\"",
+ "\"&&\"",
+ "\"++\"",
+ "\"--\"",
+ "\"+\"",
+ "\"-\"",
+ "\"*\"",
+ "\"/\"",
+ "\"&\"",
+ "\"|\"",
+ "\"^\"",
+ "\"%\"",
+ "\"<<\"",
+ "\"+=\"",
+ "\"-=\"",
+ "\"*=\"",
+ "\"/=\"",
+ "\"&=\"",
+ "\"|=\"",
+ "\"^=\"",
+ "\"%=\"",
+ "\"<<=\"",
+ "\">>=\"",
+ "\">>>=\"",
+ "\"...\"",
+ "\">>>\"",
+ "\">>\"",
+ "\">\"",
+ "\"\\u001a\"",
+ "<STUFF_TO_IGNORE>",
+ };
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,2072 @@
+/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserTokenManager.java */
+package jaxx.compiler.java.parser;
+
+public class JavaParserTokenManager implements JavaParserConstants {
+ public java.io.PrintStream debugStream = System.out;
+
+ public void setDebugStream(java.io.PrintStream ds) {
+ debugStream = ds;
+ }
+
+ private int jjStopStringLiteralDfa_0(int pos, long active0, long active1) {
+ switch (pos) {
+ case 0:
+ if ((active0 & 0x4L) != 0L || (active1 & 0x804000000000L) != 0L)
+ return 48;
+ if ((active1 & 0x80000000080000L) != 0L)
+ return 5;
+ if ((active0 & 0x1fffffffffffff00L) != 0L) {
+ jjmatchedKind = 72;
+ return 29;
+ }
+ return -1;
+ case 1:
+ if ((active0 & 0x4L) != 0L)
+ return 46;
+ if ((active0 & 0x1fffffff7fcfff00L) != 0L) {
+ if (jjmatchedPos != 1) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 1;
+ }
+ return 29;
+ }
+ if ((active0 & 0x80300000L) != 0L)
+ return 29;
+ return -1;
+ case 2:
+ if ((active0 & 0x1dffff675fefff00L) != 0L) {
+ if (jjmatchedPos != 2) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 2;
+ }
+ return 29;
+ }
+ if ((active0 & 0x200009820000000L) != 0L)
+ return 29;
+ return -1;
+ case 3:
+ if ((active0 & 0x18effe571f2f4f00L) != 0L) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 3;
+ return 29;
+ }
+ if ((active0 & 0x510012040c0b000L) != 0L)
+ return 29;
+ return -1;
+ case 4:
+ if ((active0 & 0x88dbe57012c0700L) != 0L) {
+ if (jjmatchedPos != 4) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 4;
+ }
+ return 29;
+ }
+ if ((active0 & 0x106240001e034800L) != 0L)
+ return 29;
+ return -1;
+ case 5:
+ if ((active0 & 0x8890e15090c0500L) != 0L) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 5;
+ return 29;
+ }
+ if ((active0 & 0x44b04200200200L) != 0L)
+ return 29;
+ return -1;
+ case 6:
+ if ((active0 & 0x889081500040100L) != 0L) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 6;
+ return 29;
+ }
+ if ((active0 & 0x60009080400L) != 0L)
+ return 29;
+ return -1;
+ case 7:
+ if ((active0 & 0x801000000040100L) != 0L)
+ return 29;
+ if ((active0 & 0x88081500000000L) != 0L) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 7;
+ return 29;
+ }
+ return -1;
+ case 8:
+ if ((active0 & 0x8000500000000L) != 0L) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 8;
+ return 29;
+ }
+ if ((active0 & 0x80081000000000L) != 0L)
+ return 29;
+ return -1;
+ case 9:
+ if ((active0 & 0x8000000000000L) != 0L) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 9;
+ return 29;
+ }
+ if ((active0 & 0x500000000L) != 0L)
+ return 29;
+ return -1;
+ case 10:
+ if ((active0 & 0x8000000000000L) != 0L) {
+ jjmatchedKind = 72;
+ jjmatchedPos = 10;
+ return 29;
+ }
+ return -1;
+ default:
+ return -1;
+ }
+ }
+
+ private int jjStartNfa_0(int pos, long active0, long active1) {
+ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1);
+ }
+
+ private int jjStopAtPos(int pos, int kind) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ return pos + 1;
+ }
+
+ private int jjStartNfaWithStates_0(int pos, int kind, int state) {
+ jjmatchedKind = kind;
+ jjmatchedPos = pos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return pos + 1;
+ }
+ return jjMoveNfa_0(state, pos + 1);
+ }
+
+ private int jjMoveStringLiteralDfa0_0() {
+ switch (curChar) {
+ case 26:
+ return jjStopAtPos(0, 123);
+ case 33:
+ jjmatchedKind = 87;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x40000000L);
+ case 37:
+ jjmatchedKind = 106;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000000000L);
+ case 38:
+ jjmatchedKind = 103;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x1000100000000L);
+ case 40:
+ return jjStopAtPos(0, 75);
+ case 41:
+ return jjStopAtPos(0, 76);
+ case 42:
+ jjmatchedKind = 101;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000000L);
+ case 43:
+ jjmatchedKind = 99;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x100200000000L);
+ case 44:
+ return jjStopAtPos(0, 82);
+ case 45:
+ jjmatchedKind = 100;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x200400000000L);
+ case 46:
+ jjmatchedKind = 83;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x80000000000000L);
+ case 47:
+ jjmatchedKind = 102;
+ return jjMoveStringLiteralDfa1_0(0x4L, 0x800000000000L);
+ case 58:
+ return jjStopAtPos(0, 90);
+ case 59:
+ return jjStopAtPos(0, 81);
+ case 60:
+ jjmatchedKind = 86;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x10080010000000L);
+ case 61:
+ jjmatchedKind = 85;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000L);
+ case 62:
+ jjmatchedKind = 122;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x360000020000000L);
+ case 63:
+ return jjStopAtPos(0, 89);
+ case 64:
+ return jjStopAtPos(0, 84);
+ case 91:
+ return jjStopAtPos(0, 79);
+ case 93:
+ return jjStopAtPos(0, 80);
+ case 94:
+ jjmatchedKind = 105;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x4000000000000L);
+ case 97:
+ return jjMoveStringLiteralDfa1_0(0x300L, 0x0L);
+ case 98:
+ return jjMoveStringLiteralDfa1_0(0x1c00L, 0x0L);
+ case 99:
+ return jjMoveStringLiteralDfa1_0(0x7e000L, 0x0L);
+ case 100:
+ return jjMoveStringLiteralDfa1_0(0x380000L, 0x0L);
+ case 101:
+ return jjMoveStringLiteralDfa1_0(0x1c00000L, 0x0L);
+ case 102:
+ return jjMoveStringLiteralDfa1_0(0x3e000000L, 0x0L);
+ case 103:
+ return jjMoveStringLiteralDfa1_0(0x40000000L, 0x0L);
+ case 105:
+ return jjMoveStringLiteralDfa1_0(0x1f80000000L, 0x0L);
+ case 108:
+ return jjMoveStringLiteralDfa1_0(0x2000000000L, 0x0L);
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x1c000000000L, 0x0L);
+ case 112:
+ return jjMoveStringLiteralDfa1_0(0x1e0000000000L, 0x0L);
+ case 114:
+ return jjMoveStringLiteralDfa1_0(0x200000000000L, 0x0L);
+ case 115:
+ return jjMoveStringLiteralDfa1_0(0xfc00000000000L, 0x0L);
+ case 116:
+ return jjMoveStringLiteralDfa1_0(0x3f0000000000000L, 0x0L);
+ case 118:
+ return jjMoveStringLiteralDfa1_0(0xc00000000000000L, 0x0L);
+ case 119:
+ return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L);
+ case 123:
+ return jjStopAtPos(0, 77);
+ case 124:
+ jjmatchedKind = 104;
+ return jjMoveStringLiteralDfa1_0(0x0L, 0x2000080000000L);
+ case 125:
+ return jjStopAtPos(0, 78);
+ case 126:
+ return jjStopAtPos(0, 88);
+ default:
+ return jjMoveNfa_0(1, 0);
+ }
+ }
+
+ private int jjMoveStringLiteralDfa1_0(long active0, long active1) {
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(0, active0, active1);
+ return 1;
+ }
+ switch (curChar) {
+ case 38:
+ if ((active1 & 0x100000000L) != 0L)
+ return jjStopAtPos(1, 96);
+ break;
+ case 42:
+ if ((active0 & 0x4L) != 0L)
+ return jjStartNfaWithStates_0(1, 2, 46);
+ break;
+ case 43:
+ if ((active1 & 0x200000000L) != 0L)
+ return jjStopAtPos(1, 97);
+ break;
+ case 45:
+ if ((active1 & 0x400000000L) != 0L)
+ return jjStopAtPos(1, 98);
+ break;
+ case 46:
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000000L);
+ case 60:
+ if ((active1 & 0x80000000000L) != 0L) {
+ jjmatchedKind = 107;
+ jjmatchedPos = 1;
+ }
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000000L);
+ case 61:
+ if ((active1 & 0x8000000L) != 0L)
+ return jjStopAtPos(1, 91);
+ else if ((active1 & 0x10000000L) != 0L)
+ return jjStopAtPos(1, 92);
+ else if ((active1 & 0x20000000L) != 0L)
+ return jjStopAtPos(1, 93);
+ else if ((active1 & 0x40000000L) != 0L)
+ return jjStopAtPos(1, 94);
+ else if ((active1 & 0x100000000000L) != 0L)
+ return jjStopAtPos(1, 108);
+ else if ((active1 & 0x200000000000L) != 0L)
+ return jjStopAtPos(1, 109);
+ else if ((active1 & 0x400000000000L) != 0L)
+ return jjStopAtPos(1, 110);
+ else if ((active1 & 0x800000000000L) != 0L)
+ return jjStopAtPos(1, 111);
+ else if ((active1 & 0x1000000000000L) != 0L)
+ return jjStopAtPos(1, 112);
+ else if ((active1 & 0x2000000000000L) != 0L)
+ return jjStopAtPos(1, 113);
+ else if ((active1 & 0x4000000000000L) != 0L)
+ return jjStopAtPos(1, 114);
+ else if ((active1 & 0x8000000000000L) != 0L)
+ return jjStopAtPos(1, 115);
+ break;
+ case 62:
+ if ((active1 & 0x200000000000000L) != 0L) {
+ jjmatchedKind = 121;
+ jjmatchedPos = 1;
+ }
+ return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x160000000000000L);
+ case 97:
+ return jjMoveStringLiteralDfa2_0(active0, 0x24002006000L, active1, 0L);
+ case 98:
+ return jjMoveStringLiteralDfa2_0(active0, 0x100L, active1, 0L);
+ case 101:
+ return jjMoveStringLiteralDfa2_0(active0, 0x208000080000L, active1, 0L);
+ case 102:
+ if ((active0 & 0x80000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 31, 29);
+ break;
+ case 104:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1070400000008000L, active1, 0L);
+ case 105:
+ return jjMoveStringLiteralDfa2_0(active0, 0xc000000L, active1, 0L);
+ case 108:
+ return jjMoveStringLiteralDfa2_0(active0, 0x10410000L, active1, 0L);
+ case 109:
+ return jjMoveStringLiteralDfa2_0(active0, 0x300000000L, active1, 0L);
+ case 110:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1c00800000L, active1, 0L);
+ case 111:
+ if ((active0 & 0x100000L) != 0L) {
+ jjmatchedKind = 20;
+ jjmatchedPos = 1;
+ }
+ return jjMoveStringLiteralDfa2_0(active0, 0xc00002060260400L, active1, 0L);
+ case 114:
+ return jjMoveStringLiteralDfa2_0(active0, 0x3800c0000000800L, active1, 0L);
+ case 115:
+ return jjMoveStringLiteralDfa2_0(active0, 0x200L, active1, 0L);
+ case 116:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1800000000000L, active1, 0L);
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x2110000000000L, active1, 0L);
+ case 119:
+ return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0L);
+ case 120:
+ return jjMoveStringLiteralDfa2_0(active0, 0x1000000L, active1, 0L);
+ case 121:
+ return jjMoveStringLiteralDfa2_0(active0, 0x8000000001000L, active1, 0L);
+ case 124:
+ if ((active1 & 0x80000000L) != 0L)
+ return jjStopAtPos(1, 95);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(0, active0, active1);
+ }
+
+ private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) {
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(0, old0, old1);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(1, active0, active1);
+ return 2;
+ }
+ switch (curChar) {
+ case 46:
+ if ((active1 & 0x80000000000000L) != 0L)
+ return jjStopAtPos(2, 119);
+ break;
+ case 61:
+ if ((active1 & 0x10000000000000L) != 0L)
+ return jjStopAtPos(2, 116);
+ else if ((active1 & 0x20000000000000L) != 0L)
+ return jjStopAtPos(2, 117);
+ break;
+ case 62:
+ if ((active1 & 0x100000000000000L) != 0L) {
+ jjmatchedKind = 120;
+ jjmatchedPos = 2;
+ }
+ return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x40000000000000L);
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x80800000018000L, active1, 0L);
+ case 98:
+ return jjMoveStringLiteralDfa3_0(active0, 0x100000000000L, active1, 0L);
+ case 99:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0L);
+ case 101:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800L, active1, 0L);
+ case 102:
+ return jjMoveStringLiteralDfa3_0(active0, 0x80000L, active1, 0L);
+ case 105:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1414040000000000L, active1, 0L);
+ case 108:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800010002000000L, active1, 0L);
+ case 110:
+ return jjMoveStringLiteralDfa3_0(active0, 0x800200c060000L, active1, 0L);
+ case 111:
+ return jjMoveStringLiteralDfa3_0(active0, 0x480010000400L, active1, 0L);
+ case 112:
+ return jjMoveStringLiteralDfa3_0(active0, 0x2000300000000L, active1, 0L);
+ case 114:
+ if ((active0 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 29, 29);
+ return jjMoveStringLiteralDfa3_0(active0, 0x61000000000000L, active1, 0L);
+ case 115:
+ return jjMoveStringLiteralDfa3_0(active0, 0x400402300L, active1, 0L);
+ case 116:
+ if ((active0 & 0x800000000L) != 0L) {
+ jjmatchedKind = 35;
+ jjmatchedPos = 2;
+ }
+ return jjMoveStringLiteralDfa3_0(active0, 0x205041005000L, active1, 0L);
+ case 117:
+ return jjMoveStringLiteralDfa3_0(active0, 0x100000000a00000L, active1, 0L);
+ case 119:
+ if ((active0 & 0x8000000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 39, 29);
+ break;
+ case 121:
+ if ((active0 & 0x200000000000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 57, 29);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(1, active0, active1);
+ }
+
+ private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) {
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(1, old0, old1);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(2, active0, active1);
+ return 3;
+ }
+ switch (curChar) {
+ case 61:
+ if ((active1 & 0x40000000000000L) != 0L)
+ return jjStopAtPos(3, 118);
+ break;
+ case 97:
+ return jjMoveStringLiteralDfa4_0(active0, 0x80000001c080800L, active1, 0L);
+ case 98:
+ return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L);
+ case 99:
+ return jjMoveStringLiteralDfa4_0(active0, 0x8000000004000L, active1, 0L);
+ case 100:
+ if ((active0 & 0x400000000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 58, 29);
+ break;
+ case 101:
+ if ((active0 & 0x1000L) != 0L)
+ return jjStartNfaWithStates_0(3, 12, 29);
+ else if ((active0 & 0x2000L) != 0L)
+ return jjStartNfaWithStates_0(3, 13, 29);
+ else if ((active0 & 0x400000L) != 0L)
+ return jjStartNfaWithStates_0(3, 22, 29);
+ else if ((active0 & 0x100000000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 56, 29);
+ return jjMoveStringLiteralDfa4_0(active0, 0x2001001000200L, active1, 0L);
+ case 103:
+ if ((active0 & 0x2000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 37, 29);
+ break;
+ case 105:
+ return jjMoveStringLiteralDfa4_0(active0, 0x1004000000000L, active1, 0L);
+ case 107:
+ return jjMoveStringLiteralDfa4_0(active0, 0x20000000000L, active1, 0L);
+ case 108:
+ if ((active0 & 0x10000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 40, 29);
+ return jjMoveStringLiteralDfa4_0(active0, 0x1000100100000400L, active1, 0L);
+ case 109:
+ if ((active0 & 0x800000L) != 0L)
+ return jjStartNfaWithStates_0(3, 23, 29);
+ break;
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active0, 0x80000000000000L, active1, 0L);
+ case 111:
+ if ((active0 & 0x40000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 30, 29);
+ return jjMoveStringLiteralDfa4_0(active0, 0x60000200000000L, active1, 0L);
+ case 114:
+ if ((active0 & 0x8000L) != 0L)
+ return jjStartNfaWithStates_0(3, 15, 29);
+ return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L);
+ case 115:
+ if ((active0 & 0x10000000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 52, 29);
+ return jjMoveStringLiteralDfa4_0(active0, 0x2030000L, active1, 0L);
+ case 116:
+ return jjMoveStringLiteralDfa4_0(active0, 0x4880400040100L, active1, 0L);
+ case 117:
+ return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L, active1, 0L);
+ case 118:
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L, active1, 0L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(2, active0, active1);
+ }
+
+ private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) {
+ if (((active0 &= old0) | (active1 &= old1)) == 0L)
+ return jjStartNfa_0(2, old0, old1);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(3, active0, 0L);
+ return 4;
+ }
+ switch (curChar) {
+ case 97:
+ return jjMoveStringLiteralDfa5_0(active0, 0x60400000000L);
+ case 99:
+ return jjMoveStringLiteralDfa5_0(active0, 0x5000000000000L);
+ case 101:
+ if ((active0 & 0x2000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 25, 29);
+ else if ((active0 & 0x1000000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 60, 29);
+ return jjMoveStringLiteralDfa5_0(active0, 0x80100000400L);
+ case 104:
+ if ((active0 & 0x4000L) != 0L)
+ return jjStartNfaWithStates_0(4, 14, 29);
+ return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000L);
+ case 105:
+ return jjMoveStringLiteralDfa5_0(active0, 0x900000040000L);
+ case 107:
+ if ((active0 & 0x800L) != 0L)
+ return jjStartNfaWithStates_0(4, 11, 29);
+ break;
+ case 108:
+ if ((active0 & 0x4000000L) != 0L) {
+ jjmatchedKind = 26;
+ jjmatchedPos = 4;
+ }
+ return jjMoveStringLiteralDfa5_0(active0, 0x8200000L);
+ case 110:
+ return jjMoveStringLiteralDfa5_0(active0, 0x1000000L);
+ case 114:
+ if ((active0 & 0x2000000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 49, 29);
+ return jjMoveStringLiteralDfa5_0(active0, 0x201200000300L);
+ case 115:
+ if ((active0 & 0x10000L) != 0L)
+ return jjStartNfaWithStates_0(4, 16, 29);
+ return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L);
+ case 116:
+ if ((active0 & 0x20000L) != 0L)
+ return jjStartNfaWithStates_0(4, 17, 29);
+ else if ((active0 & 0x10000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 28, 29);
+ else if ((active0 & 0x400000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 46, 29);
+ return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa5_0(active0, 0x80000L);
+ case 118:
+ return jjMoveStringLiteralDfa5_0(active0, 0x4000000000L);
+ case 119:
+ if ((active0 & 0x20000000000000L) != 0L) {
+ jjmatchedKind = 53;
+ jjmatchedPos = 4;
+ }
+ return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(3, active0, 0L);
+ }
+
+ private int jjMoveStringLiteralDfa5_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(3, old0, 0L);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(4, active0, 0L);
+ return 5;
+ }
+ switch (curChar) {
+ case 97:
+ return jjMoveStringLiteralDfa6_0(active0, 0x500L);
+ case 99:
+ if ((active0 & 0x100000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 44, 29);
+ else if ((active0 & 0x800000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 47, 29);
+ return jjMoveStringLiteralDfa6_0(active0, 0x80000000000L);
+ case 100:
+ return jjMoveStringLiteralDfa6_0(active0, 0x1000000L);
+ case 101:
+ if ((active0 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(5, 21, 29);
+ else if ((active0 & 0x4000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 38, 29);
+ break;
+ case 102:
+ return jjMoveStringLiteralDfa6_0(active0, 0x1000000000L);
+ case 103:
+ return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L);
+ case 104:
+ if ((active0 & 0x4000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 50, 29);
+ break;
+ case 105:
+ return jjMoveStringLiteralDfa6_0(active0, 0x880000000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa6_0(active0, 0x8080000L);
+ case 109:
+ return jjMoveStringLiteralDfa6_0(active0, 0x100000000L);
+ case 110:
+ if ((active0 & 0x200000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 45, 29);
+ return jjMoveStringLiteralDfa6_0(active0, 0x400040000L);
+ case 114:
+ return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L);
+ case 115:
+ if ((active0 & 0x40000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 54, 29);
+ break;
+ case 116:
+ if ((active0 & 0x200L) != 0L)
+ return jjStartNfaWithStates_0(5, 9, 29);
+ else if ((active0 & 0x200000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 33, 29);
+ return jjMoveStringLiteralDfa6_0(active0, 0x1040000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(4, active0, 0L);
+ }
+
+ private int jjMoveStringLiteralDfa6_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(4, old0, 0L);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(5, active0, 0L);
+ return 6;
+ }
+ switch (curChar) {
+ case 97:
+ return jjMoveStringLiteralDfa7_0(active0, 0x1000000000L);
+ case 99:
+ return jjMoveStringLiteralDfa7_0(active0, 0x400000100L);
+ case 101:
+ if ((active0 & 0x20000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 41, 29);
+ else if ((active0 & 0x40000000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 42, 29);
+ return jjMoveStringLiteralDfa7_0(active0, 0x80000100000000L);
+ case 102:
+ return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000L);
+ case 108:
+ return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L);
+ case 110:
+ if ((active0 & 0x400L) != 0L)
+ return jjStartNfaWithStates_0(6, 10, 29);
+ break;
+ case 111:
+ return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L);
+ case 115:
+ if ((active0 & 0x1000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 24, 29);
+ break;
+ case 116:
+ if ((active0 & 0x80000L) != 0L)
+ return jjStartNfaWithStates_0(6, 19, 29);
+ return jjMoveStringLiteralDfa7_0(active0, 0x80000000000L);
+ case 117:
+ return jjMoveStringLiteralDfa7_0(active0, 0x40000L);
+ case 121:
+ if ((active0 & 0x8000000L) != 0L)
+ return jjStartNfaWithStates_0(6, 27, 29);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(5, active0, 0L);
+ }
+
+ private int jjMoveStringLiteralDfa7_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(5, old0, 0L);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(6, active0, 0L);
+ return 7;
+ }
+ switch (curChar) {
+ case 99:
+ return jjMoveStringLiteralDfa8_0(active0, 0x1000000000L);
+ case 101:
+ if ((active0 & 0x40000L) != 0L)
+ return jjStartNfaWithStates_0(7, 18, 29);
+ else if ((active0 & 0x800000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 59, 29);
+ return jjMoveStringLiteralDfa8_0(active0, 0x80400000000L);
+ case 110:
+ return jjMoveStringLiteralDfa8_0(active0, 0x88000100000000L);
+ case 112:
+ if ((active0 & 0x1000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 48, 29);
+ break;
+ case 116:
+ if ((active0 & 0x100L) != 0L)
+ return jjStartNfaWithStates_0(7, 8, 29);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(6, active0, 0L);
+ }
+
+ private int jjMoveStringLiteralDfa8_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(6, old0, 0L);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(7, active0, 0L);
+ return 8;
+ }
+ switch (curChar) {
+ case 100:
+ if ((active0 & 0x80000000000L) != 0L)
+ return jjStartNfaWithStates_0(8, 43, 29);
+ break;
+ case 101:
+ if ((active0 & 0x1000000000L) != 0L)
+ return jjStartNfaWithStates_0(8, 36, 29);
+ break;
+ case 105:
+ return jjMoveStringLiteralDfa9_0(active0, 0x8000000000000L);
+ case 111:
+ return jjMoveStringLiteralDfa9_0(active0, 0x400000000L);
+ case 116:
+ if ((active0 & 0x80000000000000L) != 0L)
+ return jjStartNfaWithStates_0(8, 55, 29);
+ return jjMoveStringLiteralDfa9_0(active0, 0x100000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(7, active0, 0L);
+ }
+
+ private int jjMoveStringLiteralDfa9_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(7, old0, 0L);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(8, active0, 0L);
+ return 9;
+ }
+ switch (curChar) {
+ case 102:
+ if ((active0 & 0x400000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 34, 29);
+ break;
+ case 115:
+ if ((active0 & 0x100000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 32, 29);
+ break;
+ case 122:
+ return jjMoveStringLiteralDfa10_0(active0, 0x8000000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(8, active0, 0L);
+ }
+
+ private int jjMoveStringLiteralDfa10_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(8, old0, 0L);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(9, active0, 0L);
+ return 10;
+ }
+ switch (curChar) {
+ case 101:
+ return jjMoveStringLiteralDfa11_0(active0, 0x8000000000000L);
+ default:
+ break;
+ }
+ return jjStartNfa_0(9, active0, 0L);
+ }
+
+ private int jjMoveStringLiteralDfa11_0(long old0, long active0) {
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(9, old0, 0L);
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ jjStopStringLiteralDfa_0(10, active0, 0L);
+ return 11;
+ }
+ switch (curChar) {
+ case 100:
+ if ((active0 & 0x8000000000000L) != 0L)
+ return jjStartNfaWithStates_0(11, 51, 29);
+ break;
+ default:
+ break;
+ }
+ return jjStartNfa_0(10, active0, 0L);
+ }
+
+ private void jjCheckNAdd(int state) {
+ if (jjrounds[state] != jjround) {
+ jjstateSet[jjnewStateCnt++] = state;
+ jjrounds[state] = jjround;
+ }
+ }
+
+ private void jjAddStates(int start, int end) {
+ do {
+ jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+ } while (start++ != end);
+ }
+
+ private void jjCheckNAddTwoStates(int state1, int state2) {
+ jjCheckNAdd(state1);
+ jjCheckNAdd(state2);
+ }
+
+ private void jjCheckNAddStates(int start, int end) {
+ do {
+ jjCheckNAdd(jjnextStates[start]);
+ } while (start++ != end);
+ }
+
+ private 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 = {
+ 0xfff0000000200002L, 0xffffffffffffdfffL, 0xfffff00f7fffffffL, 0x12000000007fffffL
+ };
+ static final long[] jjbitVec4 = {
+ 0x0L, 0x0L, 0x420043c00000000L, 0xff7fffffff7fffffL
+ };
+ static final long[] jjbitVec5 = {
+ 0xffffcffffffffL, 0xffffffffffff0000L, 0xf9ff3fffffffffffL, 0x401f00030003L
+ };
+ static final long[] jjbitVec6 = {
+ 0x0L, 0x400000000000000L, 0xfffffffbffffd740L, 0xffffffcff7fffL
+ };
+ static final long[] jjbitVec7 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff003L, 0x33fffffffff199fL
+ };
+ static final long[] jjbitVec8 = {
+ 0xfffe000000000000L, 0xfffffffe027fffffL, 0xffL, 0x707ffffff0000L
+ };
+ static final long[] jjbitVec9 = {
+ 0x7fffffe00000000L, 0xfffe0000000007ffL, 0xffffffffffffffffL, 0x1c000060002fffffL
+ };
+ static final long[] jjbitVec10 = {
+ 0x1ffffffd0000L, 0x0L, 0x3fffffffffL, 0x0L
+ };
+ static final long[] jjbitVec11 = {
+ 0x23ffffffffffffe0L, 0x3ff010000L, 0x3c5fdfffff99fe0L, 0xf0003b0000000L
+ };
+ static final long[] jjbitVec12 = {
+ 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100010000L
+ };
+ static final long[] jjbitVec13 = {
+ 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L
+ };
+ static final long[] jjbitVec14 = {
+ 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L
+ };
+ static final long[] jjbitVec15 = {
+ 0x3fffdfffffddfe0L, 0x300000000L, 0x2ffbfffffc7fffe0L, 0x7fL
+ };
+ static final long[] jjbitVec16 = {
+ 0x800dfffffffffffeL, 0x7fL, 0x200decaefef02596L, 0x3000005fL
+ };
+ static final long[] jjbitVec17 = {
+ 0x1L, 0x7fffffffeffL, 0xf00L, 0x0L
+ };
+ static final long[] jjbitVec18 = {
+ 0x6fbffffffffL, 0x3f0000L, 0xffffffff00000000L, 0x7fffffffff003fL
+ };
+ static final long[] jjbitVec19 = {
+ 0xffffffffffffffffL, 0xffffffff83ffffffL, 0xffffff07ffffffffL, 0x3ffffffffffffffL
+ };
+ static final long[] jjbitVec20 = {
+ 0xffffffffffffff7fL, 0xffffffff3d7f3d7fL, 0x7f3d7fffffff3d7fL, 0xffff7fffff7f7f3dL
+ };
+ static final long[] jjbitVec21 = {
+ 0xffffffff7f3d7fffL, 0x7ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL
+ };
+ static final long[] jjbitVec22 = {
+ 0xffffffffffffffffL, 0x7f9fffffffffffL, 0xffffffff07fffffeL, 0x7ffffffffffL
+ };
+ static final long[] jjbitVec23 = {
+ 0x0L, 0x0L, 0xfffffffffffffL, 0x8000000L
+ };
+ static final long[] jjbitVec24 = {
+ 0xffffffff00000000L, 0xffffffffffffffL, 0x1ffffffffffL, 0x0L
+ };
+ static final long[] jjbitVec25 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL
+ };
+ static final long[] jjbitVec26 = {
+ 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL
+ };
+ static final long[] jjbitVec27 = {
+ 0x8000000000000000L, 0x8000000000000001L, 0xffff00000000L, 0x0L
+ };
+ static final long[] jjbitVec28 = {
+ 0x3fbbd503e2ffc84L, 0xffffffff00000000L, 0xfL, 0x0L
+ };
+ static final long[] jjbitVec29 = {
+ 0x73e03fe000000e0L, 0xfffffffffffffffeL, 0xfffffffe601fffffL, 0x7fffffffffffffffL
+ };
+ static final long[] jjbitVec30 = {
+ 0xfffe1fffffffffe0L, 0xffffffffffffffffL, 0xffffff00007fffL, 0x0L
+ };
+ static final long[] jjbitVec31 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffL, 0x0L
+ };
+ static final long[] jjbitVec32 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L
+ };
+ static final long[] jjbitVec33 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0x1fffL, 0x0L
+ };
+ static final long[] jjbitVec34 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L
+ };
+ static final long[] jjbitVec35 = {
+ 0x3fffffffffffL, 0x0L, 0x0L, 0x0L
+ };
+ static final long[] jjbitVec36 = {
+ 0x5f7ffdffa0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L
+ };
+ static final long[] jjbitVec37 = {
+ 0x3fffffffffffffffL, 0xffffffffffff0000L, 0xfffffffffffcffffL, 0xfff0000000000ffL
+ };
+ static final long[] jjbitVec38 = {
+ 0x18000000000000L, 0xffd702000000e000L, 0xffffffffffffffffL, 0x1fffffffffffffffL
+ };
+ static final long[] jjbitVec39 = {
+ 0x87fffffe00000010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0x631cfcfcfcL
+ };
+ static final long[] jjbitVec40 = {
+ 0x0L, 0x0L, 0x420043cffffffffL, 0xff7fffffff7fffffL
+ };
+ static final long[] jjbitVec41 = {
+ 0xffffffffffffffffL, 0x400000700007fffL, 0xfffffffbffffd740L, 0xffffffcff7fffL
+ };
+ static final long[] jjbitVec42 = {
+ 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff07bL, 0x33fffffffff199fL
+ };
+ static final long[] jjbitVec43 = {
+ 0xfffe000000000000L, 0xfffffffe027fffffL, 0xbbfffffbfffe00ffL, 0x707ffffff0016L
+ };
+ static final long[] jjbitVec44 = {
+ 0x7fffffe00000000L, 0xffff03ff003fffffL, 0xffffffffffffffffL, 0x1fff3dff9fefffffL
+ };
+ static final long[] jjbitVec45 = {
+ 0xffff1fffffff8000L, 0x7ffL, 0x1ffffffffffffL, 0x0L
+ };
+ static final long[] jjbitVec46 = {
+ 0xf3ffffffffffffeeL, 0xffcfff1f3fffL, 0xd3c5fdfffff99feeL, 0xfffcfb080399fL
+ };
+ static final long[] jjbitVec47 = {
+ 0xd36dfdfffff987e4L, 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100013bbfL
+ };
+ static final long[] jjbitVec48 = {
+ 0xf3cdfdfffff99feeL, 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L
+ };
+ static final long[] jjbitVec49 = {
+ 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL
+ };
+ static final long[] jjbitVec50 = {
+ 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x2ffbfffffc7fffecL, 0xc0000ff5f847fL
+ };
+ static final long[] jjbitVec51 = {
+ 0x87fffffffffffffeL, 0x3ff7fffL, 0x3bffecaefef02596L, 0x33ff3f5fL
+ };
+ static final long[] jjbitVec52 = {
+ 0xc2a003ff03000001L, 0xfffe07fffffffeffL, 0x1ffffffffeff0fdfL, 0x40L
+ };
+ static final long[] jjbitVec53 = {
+ 0x3c7f6fbffffffffL, 0x3ff03ffL, 0xffffffff00000000L, 0x7fffffffff003fL
+ };
+ static final long[] jjbitVec54 = {
+ 0xffffffff7f3d7fffL, 0x3fe0007ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL
+ };
+ static final long[] jjbitVec55 = {
+ 0x0L, 0x0L, 0xffffffffffffffffL, 0x3ff080fffffL
+ };
+ static final long[] jjbitVec56 = {
+ 0xffffffff03ff7800L, 0xffffffffffffffL, 0x3ffffffffffL, 0x0L
+ };
+ static final long[] jjbitVec57 = {
+ 0x80007c000000f000L, 0x8000fc0000000001L, 0xffff00000000L, 0x21fff0000L
+ };
+ static final long[] jjbitVec58 = {
+ 0x73efffe000000e0L, 0xfffffffffffffffeL, 0xfffffffe661fffffL, 0x7fffffffffffffffL
+ };
+ static final long[] jjbitVec59 = {
+ 0x5f7ffdffe0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L
+ };
+ static final long[] jjbitVec60 = {
+ 0x18000f00000000L, 0xffd702000000e000L, 0xffffffffffffffffL, 0x9fffffffffffffffL
+ };
+ static final long[] jjbitVec61 = {
+ 0x87fffffe03ff0010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0xe0000631cfcfcfcL
+ };
+
+ private int jjMoveNfa_0(int startState, int curPos) {
+ int[] nextStates;
+ int startsAt = 0;
+ jjnewStateCnt = 71;
+ 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 1:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 6);
+ else if ((0x100003600L & l) != 0L) {
+ if (kind > 3)
+ kind = 3;
+ jjCheckNAdd(0);
+ } else if (curChar == 47)
+ jjAddStates(7, 8);
+ else if (curChar == 36) {
+ if (kind > 72)
+ kind = 72;
+ jjCheckNAdd(29);
+ } else if (curChar == 34)
+ jjCheckNAddStates(9, 11);
+ else if (curChar == 39)
+ jjAddStates(12, 13);
+ else if (curChar == 46)
+ jjCheckNAdd(5);
+ if ((0x3fe000000000000L & l) != 0L) {
+ if (kind > 61)
+ kind = 61;
+ jjCheckNAddTwoStates(2, 3);
+ } else if (curChar == 48) {
+ if (kind > 61)
+ kind = 61;
+ jjCheckNAddStates(14, 18);
+ }
+ break;
+ case 48:
+ if (curChar == 47) {
+ if (kind > 4)
+ kind = 4;
+ jjCheckNAddStates(19, 21);
+ } else if (curChar == 42)
+ jjstateSet[jjnewStateCnt++] = 46;
+ break;
+ case 0:
+ if ((0x100003600L & l) == 0L)
+ break;
+ if (kind > 3)
+ kind = 3;
+ jjCheckNAdd(0);
+ break;
+ case 2:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 61)
+ kind = 61;
+ jjCheckNAddTwoStates(2, 3);
+ break;
+ case 4:
+ if (curChar == 46)
+ jjCheckNAdd(5);
+ break;
+ case 5:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddStates(22, 24);
+ break;
+ case 7:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(8);
+ break;
+ case 8:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddTwoStates(8, 9);
+ break;
+ case 10:
+ if (curChar == 39)
+ jjAddStates(12, 13);
+ break;
+ case 11:
+ if ((0xffffff7fffffdbffL & l) != 0L)
+ jjCheckNAdd(12);
+ break;
+ case 12:
+ if (curChar == 39 && kind > 70)
+ kind = 70;
+ break;
+ case 14:
+ if ((0x8400000000L & l) != 0L)
+ jjCheckNAdd(12);
+ break;
+ case 15:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(16, 12);
+ break;
+ case 16:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAdd(12);
+ break;
+ case 17:
+ if ((0xf000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 18;
+ break;
+ case 18:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAdd(16);
+ break;
+ case 19:
+ if (curChar == 34)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 20:
+ if ((0xfffffffbffffdbffL & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 22:
+ if ((0x8400000000L & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 23:
+ if (curChar == 34 && kind > 71)
+ kind = 71;
+ break;
+ case 24:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddStates(25, 28);
+ break;
+ case 25:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 26:
+ if ((0xf000000000000L & l) != 0L)
+ jjstateSet[jjnewStateCnt++] = 27;
+ break;
+ case 27:
+ if ((0xff000000000000L & l) != 0L)
+ jjCheckNAdd(25);
+ break;
+ case 28:
+ if (curChar != 36)
+ break;
+ if (kind > 72)
+ kind = 72;
+ jjCheckNAdd(29);
+ break;
+ case 29:
+ if ((0x3ff00100fffc1ffL & l) == 0L)
+ break;
+ if (kind > 72)
+ kind = 72;
+ jjCheckNAdd(29);
+ break;
+ case 30:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(0, 6);
+ break;
+ case 31:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(29, 31);
+ break;
+ case 33:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(34);
+ break;
+ case 34:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(34, 9);
+ break;
+ case 35:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(35, 36);
+ break;
+ case 37:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(38);
+ break;
+ case 38:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddTwoStates(38, 9);
+ break;
+ case 39:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(39, 40);
+ break;
+ case 40:
+ if (curChar != 46)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddStates(32, 34);
+ break;
+ case 41:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddStates(32, 34);
+ break;
+ case 43:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(44);
+ break;
+ case 44:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddTwoStates(44, 9);
+ break;
+ case 45:
+ if (curChar == 47)
+ jjAddStates(7, 8);
+ break;
+ case 46:
+ if (curChar == 42)
+ jjstateSet[jjnewStateCnt++] = 47;
+ break;
+ case 47:
+ if ((0xffff7fffffffffffL & l) != 0L && kind > 1)
+ kind = 1;
+ break;
+ case 49:
+ if (curChar != 47)
+ break;
+ if (kind > 4)
+ kind = 4;
+ jjCheckNAddStates(19, 21);
+ break;
+ case 50:
+ if ((0xffffffffffffdbffL & l) == 0L)
+ break;
+ if (kind > 4)
+ kind = 4;
+ jjCheckNAddStates(19, 21);
+ break;
+ case 51:
+ if ((0x2400L & l) != 0L && kind > 4)
+ kind = 4;
+ break;
+ case 52:
+ if (curChar == 10 && kind > 4)
+ kind = 4;
+ break;
+ case 53:
+ if (curChar == 13)
+ jjstateSet[jjnewStateCnt++] = 52;
+ break;
+ case 54:
+ if (curChar != 48)
+ break;
+ if (kind > 61)
+ kind = 61;
+ jjCheckNAddStates(14, 18);
+ break;
+ case 56:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 61)
+ kind = 61;
+ jjCheckNAddTwoStates(56, 3);
+ break;
+ case 57:
+ if ((0xff000000000000L & l) == 0L)
+ break;
+ if (kind > 61)
+ kind = 61;
+ jjCheckNAddTwoStates(57, 3);
+ break;
+ case 59:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjAddStates(35, 36);
+ break;
+ case 60:
+ if (curChar == 46)
+ jjCheckNAdd(61);
+ break;
+ case 61:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(61, 62);
+ break;
+ case 63:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(64);
+ break;
+ case 64:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddTwoStates(64, 9);
+ break;
+ case 66:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddStates(37, 39);
+ break;
+ case 67:
+ if (curChar == 46)
+ jjCheckNAdd(68);
+ break;
+ case 69:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(70);
+ break;
+ case 70:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 65)
+ kind = 65;
+ jjCheckNAddTwoStates(70, 9);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ } else if (curChar < 128) {
+ long l = 1L << (curChar & 077);
+ MatchLoop:
+ do {
+ switch (jjstateSet[--i]) {
+ case 1:
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 72)
+ kind = 72;
+ jjCheckNAdd(29);
+ break;
+ case 3:
+ if ((0x100000001000L & l) != 0L && kind > 61)
+ kind = 61;
+ break;
+ case 6:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(40, 41);
+ break;
+ case 9:
+ if ((0x5000000050L & l) != 0L && kind > 65)
+ kind = 65;
+ break;
+ case 11:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAdd(12);
+ break;
+ case 13:
+ if (curChar == 92)
+ jjAddStates(42, 44);
+ break;
+ case 14:
+ if ((0x14404410000000L & l) != 0L)
+ jjCheckNAdd(12);
+ break;
+ case 20:
+ if ((0xffffffffefffffffL & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 21:
+ if (curChar == 92)
+ jjAddStates(45, 47);
+ break;
+ case 22:
+ if ((0x14404410000000L & l) != 0L)
+ jjCheckNAddStates(9, 11);
+ break;
+ case 29:
+ if ((0x87fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 72)
+ kind = 72;
+ jjCheckNAdd(29);
+ break;
+ case 32:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(48, 49);
+ break;
+ case 36:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(50, 51);
+ break;
+ case 42:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(52, 53);
+ break;
+ case 47:
+ if (kind > 1)
+ kind = 1;
+ break;
+ case 50:
+ if (kind > 4)
+ kind = 4;
+ jjAddStates(19, 21);
+ break;
+ case 55:
+ if ((0x100000001000000L & l) != 0L)
+ jjCheckNAdd(56);
+ break;
+ case 56:
+ if ((0x7e0000007eL & l) == 0L)
+ break;
+ if (kind > 61)
+ kind = 61;
+ jjCheckNAddTwoStates(56, 3);
+ break;
+ case 58:
+ if ((0x100000001000000L & l) != 0L)
+ jjCheckNAddTwoStates(59, 60);
+ break;
+ case 59:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddTwoStates(59, 60);
+ break;
+ case 61:
+ if ((0x7e0000007eL & l) != 0L)
+ jjAddStates(54, 55);
+ break;
+ case 62:
+ if ((0x1000000010000L & l) != 0L)
+ jjAddStates(56, 57);
+ break;
+ case 65:
+ if ((0x100000001000000L & l) != 0L)
+ jjCheckNAdd(66);
+ break;
+ case 66:
+ if ((0x7e0000007eL & l) != 0L)
+ jjCheckNAddStates(37, 39);
+ break;
+ case 68:
+ if ((0x1000000010000L & l) != 0L)
+ jjAddStates(58, 59);
+ 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 1:
+ if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 72)
+ kind = 72;
+ jjCheckNAdd(29);
+ break;
+ case 11:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjstateSet[jjnewStateCnt++] = 12;
+ break;
+ case 20:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2))
+ jjAddStates(9, 11);
+ break;
+ case 29:
+ if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 72)
+ kind = 72;
+ jjCheckNAdd(29);
+ break;
+ case 47:
+ if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 1)
+ kind = 1;
+ break;
+ case 50:
+ if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
+ break;
+ if (kind > 4)
+ kind = 4;
+ jjAddStates(19, 21);
+ break;
+ default:
+ break;
+ }
+ } while (i != startsAt);
+ }
+ if (kind != 0x7fffffff) {
+ jjmatchedKind = kind;
+ jjmatchedPos = curPos;
+ kind = 0x7fffffff;
+ }
+ ++curPos;
+ if ((i = jjnewStateCnt) == (startsAt = 71 - (jjnewStateCnt = startsAt)))
+ return curPos;
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return curPos;
+ }
+ }
+ }
+
+ private int jjMoveStringLiteralDfa0_2() {
+ switch (curChar) {
+ case 42:
+ return jjMoveStringLiteralDfa1_2(0x40L);
+ default:
+ return 1;
+ }
+ }
+
+ private int jjMoveStringLiteralDfa1_2(long active0) {
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return 1;
+ }
+ switch (curChar) {
+ case 47:
+ if ((active0 & 0x40L) != 0L)
+ return jjStopAtPos(1, 6);
+ break;
+ default:
+ return 2;
+ }
+ return 2;
+ }
+
+ private int jjMoveStringLiteralDfa0_1() {
+ switch (curChar) {
+ case 42:
+ return jjMoveStringLiteralDfa1_1(0x20L);
+ default:
+ return 1;
+ }
+ }
+
+ private int jjMoveStringLiteralDfa1_1(long active0) {
+ try {
+ curChar = input_stream.readChar();
+ }
+ catch (java.io.IOException e) {
+ return 1;
+ }
+ switch (curChar) {
+ case 47:
+ if ((active0 & 0x20L) != 0L)
+ return jjStopAtPos(1, 5);
+ break;
+ default:
+ return 2;
+ }
+ return 2;
+ }
+
+ static final int[] jjnextStates = {
+ 31, 32, 9, 35, 36, 39, 40, 48, 49, 20, 21, 23, 11, 13, 55, 57,
+ 3, 58, 65, 50, 51, 53, 5, 6, 9, 20, 21, 25, 23, 31, 32, 9,
+ 41, 42, 9, 59, 60, 66, 67, 68, 7, 8, 14, 15, 17, 22, 24, 26,
+ 33, 34, 37, 38, 43, 44, 61, 62, 63, 64, 69, 70,
+ };
+
+ private static 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 boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) {
+ switch (hiByte) {
+ case 0:
+ return ((jjbitVec4[i2] & l2) != 0L);
+ case 2:
+ return ((jjbitVec5[i2] & l2) != 0L);
+ case 3:
+ return ((jjbitVec6[i2] & l2) != 0L);
+ case 4:
+ return ((jjbitVec7[i2] & l2) != 0L);
+ case 5:
+ return ((jjbitVec8[i2] & l2) != 0L);
+ case 6:
+ return ((jjbitVec9[i2] & l2) != 0L);
+ case 7:
+ 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 18:
+ return ((jjbitVec20[i2] & l2) != 0L);
+ case 19:
+ return ((jjbitVec21[i2] & l2) != 0L);
+ case 20:
+ return ((jjbitVec0[i2] & l2) != 0L);
+ case 22:
+ return ((jjbitVec22[i2] & l2) != 0L);
+ case 23:
+ return ((jjbitVec23[i2] & l2) != 0L);
+ case 24:
+ return ((jjbitVec24[i2] & l2) != 0L);
+ case 30:
+ return ((jjbitVec25[i2] & l2) != 0L);
+ case 31:
+ return ((jjbitVec26[i2] & l2) != 0L);
+ case 32:
+ return ((jjbitVec27[i2] & l2) != 0L);
+ case 33:
+ return ((jjbitVec28[i2] & l2) != 0L);
+ case 48:
+ return ((jjbitVec29[i2] & l2) != 0L);
+ case 49:
+ return ((jjbitVec30[i2] & l2) != 0L);
+ case 77:
+ return ((jjbitVec31[i2] & l2) != 0L);
+ case 159:
+ return ((jjbitVec32[i2] & l2) != 0L);
+ case 164:
+ return ((jjbitVec33[i2] & l2) != 0L);
+ case 215:
+ return ((jjbitVec34[i2] & l2) != 0L);
+ case 250:
+ return ((jjbitVec35[i2] & l2) != 0L);
+ case 251:
+ return ((jjbitVec36[i2] & l2) != 0L);
+ case 253:
+ return ((jjbitVec37[i2] & l2) != 0L);
+ case 254:
+ return ((jjbitVec38[i2] & l2) != 0L);
+ case 255:
+ return ((jjbitVec39[i2] & l2) != 0L);
+ default:
+ if ((jjbitVec3[i1] & l1) != 0L)
+ return true;
+ return false;
+ }
+ }
+
+ private static boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) {
+ switch (hiByte) {
+ case 0:
+ return ((jjbitVec40[i2] & l2) != 0L);
+ case 2:
+ return ((jjbitVec5[i2] & l2) != 0L);
+ case 3:
+ return ((jjbitVec41[i2] & l2) != 0L);
+ case 4:
+ return ((jjbitVec42[i2] & l2) != 0L);
+ case 5:
+ return ((jjbitVec43[i2] & l2) != 0L);
+ case 6:
+ return ((jjbitVec44[i2] & l2) != 0L);
+ case 7:
+ return ((jjbitVec45[i2] & l2) != 0L);
+ case 9:
+ return ((jjbitVec46[i2] & l2) != 0L);
+ case 10:
+ return ((jjbitVec47[i2] & l2) != 0L);
+ case 11:
+ return ((jjbitVec48[i2] & l2) != 0L);
+ case 12:
+ return ((jjbitVec49[i2] & l2) != 0L);
+ case 13:
+ return ((jjbitVec50[i2] & l2) != 0L);
+ case 14:
+ return ((jjbitVec51[i2] & l2) != 0L);
+ case 15:
+ return ((jjbitVec52[i2] & l2) != 0L);
+ case 16:
+ return ((jjbitVec53[i2] & l2) != 0L);
+ case 17:
+ return ((jjbitVec19[i2] & l2) != 0L);
+ case 18:
+ return ((jjbitVec20[i2] & l2) != 0L);
+ case 19:
+ return ((jjbitVec54[i2] & l2) != 0L);
+ case 20:
+ return ((jjbitVec0[i2] & l2) != 0L);
+ case 22:
+ return ((jjbitVec22[i2] & l2) != 0L);
+ case 23:
+ return ((jjbitVec55[i2] & l2) != 0L);
+ case 24:
+ return ((jjbitVec56[i2] & l2) != 0L);
+ case 30:
+ return ((jjbitVec25[i2] & l2) != 0L);
+ case 31:
+ return ((jjbitVec26[i2] & l2) != 0L);
+ case 32:
+ return ((jjbitVec57[i2] & l2) != 0L);
+ case 33:
+ return ((jjbitVec28[i2] & l2) != 0L);
+ case 48:
+ return ((jjbitVec58[i2] & l2) != 0L);
+ case 49:
+ return ((jjbitVec30[i2] & l2) != 0L);
+ case 77:
+ return ((jjbitVec31[i2] & l2) != 0L);
+ case 159:
+ return ((jjbitVec32[i2] & l2) != 0L);
+ case 164:
+ return ((jjbitVec33[i2] & l2) != 0L);
+ case 215:
+ return ((jjbitVec34[i2] & l2) != 0L);
+ case 250:
+ return ((jjbitVec35[i2] & l2) != 0L);
+ case 251:
+ return ((jjbitVec59[i2] & l2) != 0L);
+ case 253:
+ return ((jjbitVec37[i2] & l2) != 0L);
+ case 254:
+ return ((jjbitVec60[i2] & l2) != 0L);
+ case 255:
+ return ((jjbitVec61[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,
+ "\141\142\163\164\162\141\143\164", "\141\163\163\145\162\164", "\142\157\157\154\145\141\156",
+ "\142\162\145\141\153", "\142\171\164\145", "\143\141\163\145", "\143\141\164\143\150",
+ "\143\150\141\162", "\143\154\141\163\163", "\143\157\156\163\164",
+ "\143\157\156\164\151\156\165\145", "\144\145\146\141\165\154\164", "\144\157", "\144\157\165\142\154\145",
+ "\145\154\163\145", "\145\156\165\155", "\145\170\164\145\156\144\163", "\146\141\154\163\145",
+ "\146\151\156\141\154", "\146\151\156\141\154\154\171", "\146\154\157\141\164", "\146\157\162",
+ "\147\157\164\157", "\151\146", "\151\155\160\154\145\155\145\156\164\163",
+ "\151\155\160\157\162\164", "\151\156\163\164\141\156\143\145\157\146", "\151\156\164",
+ "\151\156\164\145\162\146\141\143\145", "\154\157\156\147", "\156\141\164\151\166\145", "\156\145\167",
+ "\156\165\154\154", "\160\141\143\153\141\147\145", "\160\162\151\166\141\164\145",
+ "\160\162\157\164\145\143\164\145\144", "\160\165\142\154\151\143", "\162\145\164\165\162\156",
+ "\163\150\157\162\164", "\163\164\141\164\151\143", "\163\164\162\151\143\164\146\160",
+ "\163\165\160\145\162", "\163\167\151\164\143\150",
+ "\163\171\156\143\150\162\157\156\151\172\145\144", "\164\150\151\163", "\164\150\162\157\167", "\164\150\162\157\167\163",
+ "\164\162\141\156\163\151\145\156\164", "\164\162\165\145", "\164\162\171", "\166\157\151\144",
+ "\166\157\154\141\164\151\154\145", "\167\150\151\154\145", null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, "\50", "\51", "\173", "\175", "\133", "\135", "\73",
+ "\54", "\56", "\100", "\75", "\74", "\41", "\176", "\77", "\72", "\75\75", "\74\75",
+ "\76\75", "\41\75", "\174\174", "\46\46", "\53\53", "\55\55", "\53", "\55", "\52",
+ "\57", "\46", "\174", "\136", "\45", "\74\74", "\53\75", "\55\75", "\52\75",
+ "\57\75", "\46\75", "\174\75", "\136\75", "\45\75", "\74\74\75", "\76\76\75",
+ "\76\76\76\75", "\56\56\56", "\76\76\76", "\76\76", "\76", "\32", null,};
+ public static final String[] lexStateNames = {
+ "DEFAULT",
+ "IN_FORMAL_COMMENT",
+ "IN_MULTI_LINE_COMMENT",
+ };
+ public static final int[] jjnewLexState = {
+ -1, 1, 2, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ };
+ static final long[] jjtoToken = {
+ 0x3fffffffffffff01L, 0x1ffffffffffff9c2L,
+ };
+ static final long[] jjtoSkip = {
+ 0x78L, 0x0L,
+ };
+ static final long[] jjtoSpecial = {
+ 0x78L, 0x0L,
+ };
+ static final long[] jjtoMore = {
+ 0x86L, 0x0L,
+ };
+ protected JavaCharStream input_stream;
+ private final int[] jjrounds = new int[71];
+ private final int[] jjstateSet = new int[142];
+ StringBuffer image;
+ int jjimageLen;
+ int lengthOfMatch;
+ protected char curChar;
+
+ public JavaParserTokenManager(JavaCharStream stream) {
+ if (JavaCharStream.staticFlag)
+ throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ input_stream = stream;
+ }
+
+ public JavaParserTokenManager(JavaCharStream stream, int lexState) {
+ this(stream);
+ SwitchTo(lexState);
+ }
+
+ public void ReInit(JavaCharStream stream) {
+ jjmatchedPos = jjnewStateCnt = 0;
+ curLexState = defaultLexState;
+ input_stream = stream;
+ ReInitRounds();
+ }
+
+ private void ReInitRounds() {
+ int i;
+ jjround = 0x80000001;
+ for (i = 71; i-- > 0;)
+ jjrounds[i] = 0x80000000;
+ }
+
+ public void ReInit(JavaCharStream stream, int lexState) {
+ ReInit(stream);
+ SwitchTo(lexState);
+ }
+
+ public void SwitchTo(int lexState) {
+ if (lexState >= 3 || 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();
+ matchedToken.specialToken = specialToken;
+ return matchedToken;
+ }
+ image = null;
+ jjimageLen = 0;
+
+ for (; ;) {
+ switch (curLexState) {
+ case 0:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_0();
+ if (jjmatchedPos == 0 && jjmatchedKind > 124) {
+ jjmatchedKind = 124;
+ }
+ break;
+ case 1:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_1();
+ if (jjmatchedPos == 0 && jjmatchedKind > 7) {
+ jjmatchedKind = 7;
+ }
+ break;
+ case 2:
+ jjmatchedKind = 0x7fffffff;
+ jjmatchedPos = 0;
+ curPos = jjMoveStringLiteralDfa0_2();
+ if (jjmatchedPos == 0 && jjmatchedKind > 7) {
+ jjmatchedKind = 7;
+ }
+ break;
+ }
+ if (jjmatchedKind != 0x7fffffff) {
+ if (jjmatchedPos + 1 < curPos)
+ input_stream.backup(curPos - jjmatchedPos - 1);
+ if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
+ matchedToken = jjFillToken();
+ matchedToken.specialToken = specialToken;
+ TokenLexicalActions(matchedToken);
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ return matchedToken;
+ } else
+ if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
+ if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
+ matchedToken = jjFillToken();
+ if (specialToken == null)
+ specialToken = matchedToken;
+ else {
+ matchedToken.specialToken = specialToken;
+ specialToken = (specialToken.next = matchedToken);
+ }
+ SkipLexicalActions(matchedToken);
+ } else
+ SkipLexicalActions(null);
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ continue EOFLoop;
+ }
+ MoreLexicalActions();
+ if (jjnewLexState[jjmatchedKind] != -1)
+ curLexState = jjnewLexState[jjmatchedKind];
+ curPos = 0;
+ jjmatchedKind = 0x7fffffff;
+ try {
+ curChar = input_stream.readChar();
+ continue;
+ }
+ catch (java.io.IOException e1) {
+ }
+ }
+ 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);
+ }
+ }
+ }
+
+ void SkipLexicalActions(Token matchedToken) {
+ switch (jjmatchedKind) {
+ default:
+ break;
+ }
+ }
+
+ void MoreLexicalActions() {
+ jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
+ switch (jjmatchedKind) {
+ case 1:
+ if (image == null)
+ image = new StringBuffer();
+ image.append(input_stream.GetSuffix(jjimageLen));
+ jjimageLen = 0;
+ input_stream.backup(1);
+ break;
+ default:
+ break;
+ }
+ }
+
+ void TokenLexicalActions(Token matchedToken) {
+ switch (jjmatchedKind) {
+ case 120:
+ if (image == null)
+ image = new StringBuffer();
+ image.append(jjstrLiteralImages[120]);
+ matchedToken.kind = GT;
+ ((Token.GTToken) matchedToken).realKind = RUNSIGNEDSHIFT;
+ input_stream.backup(2);
+ matchedToken.image = ">";
+ break;
+ case 121:
+ if (image == null)
+ image = new StringBuffer();
+ image.append(jjstrLiteralImages[121]);
+ matchedToken.kind = GT;
+ ((Token.GTToken) matchedToken).realKind = RSIGNEDSHIFT;
+ input_stream.backup(1);
+ matchedToken.image = ">";
+ break;
+ default:
+ break;
+ }
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,230 @@
+/* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */
+
+package jaxx.compiler.java.parser;
+
+public interface JavaParserTreeConstants {
+ public int JJTLINE = 0;
+ public int JJTCOMPILATIONUNIT = 1;
+ public int JJTPACKAGEDECLARATION = 2;
+ public int JJTIMPORTDECLARATION = 3;
+ public int JJTMODIFIERS = 4;
+ public int JJTTYPEDECLARATION = 5;
+ public int JJTCLASSORINTERFACEDECLARATION = 6;
+ public int JJTEXTENDSLIST = 7;
+ public int JJTIMPLEMENTSLIST = 8;
+ public int JJTENUMDECLARATION = 9;
+ public int JJTENUMBODY = 10;
+ public int JJTENUMCONSTANT = 11;
+ public int JJTTYPEPARAMETERS = 12;
+ public int JJTTYPEPARAMETER = 13;
+ public int JJTTYPEBOUND = 14;
+ public int JJTCLASSORINTERFACEBODY = 15;
+ public int JJTCLASSORINTERFACEBODYDECLARATION = 16;
+ public int JJTFIELDDECLARATION = 17;
+ public int JJTVARIABLEDECLARATOR = 18;
+ public int JJTVARIABLEDECLARATORID = 19;
+ public int JJTVARIABLEINITIALIZER = 20;
+ public int JJTARRAYINITIALIZER = 21;
+ public int JJTMETHODDECLARATION = 22;
+ public int JJTMETHODDECLARATOR = 23;
+ public int JJTFORMALPARAMETERS = 24;
+ public int JJTFORMALPARAMETER = 25;
+ public int JJTCONSTRUCTORDECLARATION = 26;
+ public int JJTEXPLICITCONSTRUCTORINVOCATION = 27;
+ public int JJTINITIALIZER = 28;
+ public int JJTTYPE = 29;
+ public int JJTREFERENCETYPE = 30;
+ public int JJTCLASSORINTERFACETYPE = 31;
+ public int JJTTYPEARGUMENTS = 32;
+ public int JJTTYPEARGUMENT = 33;
+ public int JJTWILDCARDBOUNDS = 34;
+ public int JJTPRIMITIVETYPE = 35;
+ public int JJTRESULTTYPE = 36;
+ public int JJTNAME = 37;
+ public int JJTNAMELIST = 38;
+ public int JJTEXPRESSION = 39;
+ public int JJTASSIGNMENTOPERATOR = 40;
+ public int JJTASSIGNMENTEXPRESSION = 41;
+ public int JJTCONDITIONALEXPRESSION = 42;
+ public int JJTCONDITIONALOREXPRESSION = 43;
+ public int JJTCONDITIONALANDEXPRESSION = 44;
+ public int JJTINCLUSIVEOREXPRESSION = 45;
+ public int JJTEXCLUSIVEOREXPRESSION = 46;
+ public int JJTANDEXPRESSION = 47;
+ public int JJTEQUALITYEXPRESSION = 48;
+ public int JJTINSTANCEOFEXPRESSION = 49;
+ public int JJTRELATIONALEXPRESSION = 50;
+ public int JJTSHIFTEXPRESSION = 51;
+ public int JJTADDITIVEEXPRESSION = 52;
+ public int JJTMULTIPLICATIVEEXPRESSION = 53;
+ public int JJTUNARYEXPRESSION = 54;
+ public int JJTPREINCREMENTEXPRESSION = 55;
+ public int JJTPREDECREMENTEXPRESSION = 56;
+ public int JJTUNARYEXPRESSIONNOTPLUSMINUS = 57;
+ public int JJTCASTLOOKAHEAD = 58;
+ public int JJTPOSTFIXEXPRESSION = 59;
+ public int JJTPOSTFIXOPERATOR = 60;
+ public int JJTCASTEXPRESSION = 61;
+ public int JJTPRIMARYEXPRESSION = 62;
+ public int JJTMEMBERSELECTOR = 63;
+ public int JJTPRIMARYPREFIX = 64;
+ public int JJTPRIMARYSUFFIX = 65;
+ public int JJTLITERAL = 66;
+ public int JJTBOOLEANLITERAL = 67;
+ public int JJTNULLLITERAL = 68;
+ public int JJTARGUMENTS = 69;
+ public int JJTARGUMENTLIST = 70;
+ public int JJTALLOCATIONEXPRESSION = 71;
+ public int JJTARRAYDIMSANDINITS = 72;
+ public int JJTSTATEMENT = 73;
+ public int JJTASSERTSTATEMENT = 74;
+ public int JJTLABELEDSTATEMENT = 75;
+ public int JJTBLOCK = 76;
+ public int JJTBLOCKSTATEMENT = 77;
+ public int JJTLOCALVARIABLEDECLARATION = 78;
+ public int JJTEMPTYSTATEMENT = 79;
+ public int JJTSTATEMENTEXPRESSION = 80;
+ public int JJTSWITCHSTATEMENT = 81;
+ public int JJTSWITCHLABEL = 82;
+ public int JJTIFSTATEMENT = 83;
+ public int JJTWHILESTATEMENT = 84;
+ public int JJTDOSTATEMENT = 85;
+ public int JJTFORSTATEMENT = 86;
+ public int JJTFORINIT = 87;
+ public int JJTSTATEMENTEXPRESSIONLIST = 88;
+ public int JJTFORUPDATE = 89;
+ public int JJTBREAKSTATEMENT = 90;
+ public int JJTCONTINUESTATEMENT = 91;
+ public int JJTRETURNSTATEMENT = 92;
+ public int JJTTHROWSTATEMENT = 93;
+ public int JJTSYNCHRONIZEDSTATEMENT = 94;
+ public int JJTTRYSTATEMENT = 95;
+ public int JJTRUNSIGNEDSHIFT = 96;
+ public int JJTRSIGNEDSHIFT = 97;
+ public int JJTANNOTATION = 98;
+ public int JJTNORMALANNOTATION = 99;
+ public int JJTMARKERANNOTATION = 100;
+ public int JJTSINGLEMEMBERANNOTATION = 101;
+ public int JJTMEMBERVALUEPAIRS = 102;
+ public int JJTMEMBERVALUEPAIR = 103;
+ public int JJTMEMBERVALUE = 104;
+ public int JJTMEMBERVALUEARRAYINITIALIZER = 105;
+ public int JJTANNOTATIONTYPEDECLARATION = 106;
+ public int JJTANNOTATIONTYPEBODY = 107;
+ public int JJTANNOTATIONTYPEMEMBERDECLARATION = 108;
+ public int JJTDEFAULTVALUE = 109;
+
+
+ public String[] jjtNodeName = {
+ "Line",
+ "CompilationUnit",
+ "PackageDeclaration",
+ "ImportDeclaration",
+ "Modifiers",
+ "TypeDeclaration",
+ "ClassOrInterfaceDeclaration",
+ "ExtendsList",
+ "ImplementsList",
+ "EnumDeclaration",
+ "EnumBody",
+ "EnumConstant",
+ "TypeParameters",
+ "TypeParameter",
+ "TypeBound",
+ "ClassOrInterfaceBody",
+ "ClassOrInterfaceBodyDeclaration",
+ "FieldDeclaration",
+ "VariableDeclarator",
+ "VariableDeclaratorId",
+ "VariableInitializer",
+ "ArrayInitializer",
+ "MethodDeclaration",
+ "MethodDeclarator",
+ "FormalParameters",
+ "FormalParameter",
+ "ConstructorDeclaration",
+ "ExplicitConstructorInvocation",
+ "Initializer",
+ "Type",
+ "ReferenceType",
+ "ClassOrInterfaceType",
+ "TypeArguments",
+ "TypeArgument",
+ "WildcardBounds",
+ "PrimitiveType",
+ "ResultType",
+ "Name",
+ "NameList",
+ "Expression",
+ "AssignmentOperator",
+ "AssignmentExpression",
+ "ConditionalExpression",
+ "ConditionalOrExpression",
+ "ConditionalAndExpression",
+ "InclusiveOrExpression",
+ "ExclusiveOrExpression",
+ "AndExpression",
+ "EqualityExpression",
+ "InstanceOfExpression",
+ "RelationalExpression",
+ "ShiftExpression",
+ "AdditiveExpression",
+ "MultiplicativeExpression",
+ "UnaryExpression",
+ "PreIncrementExpression",
+ "PreDecrementExpression",
+ "UnaryExpressionNotPlusMinus",
+ "CastLookahead",
+ "PostfixExpression",
+ "PostfixOperator",
+ "CastExpression",
+ "PrimaryExpression",
+ "MemberSelector",
+ "PrimaryPrefix",
+ "PrimarySuffix",
+ "Literal",
+ "BooleanLiteral",
+ "NullLiteral",
+ "Arguments",
+ "ArgumentList",
+ "AllocationExpression",
+ "ArrayDimsAndInits",
+ "Statement",
+ "AssertStatement",
+ "LabeledStatement",
+ "Block",
+ "BlockStatement",
+ "LocalVariableDeclaration",
+ "EmptyStatement",
+ "StatementExpression",
+ "SwitchStatement",
+ "SwitchLabel",
+ "IfStatement",
+ "WhileStatement",
+ "DoStatement",
+ "ForStatement",
+ "ForInit",
+ "StatementExpressionList",
+ "ForUpdate",
+ "BreakStatement",
+ "ContinueStatement",
+ "ReturnStatement",
+ "ThrowStatement",
+ "SynchronizedStatement",
+ "TryStatement",
+ "RUNSIGNEDSHIFT",
+ "RSIGNEDSHIFT",
+ "Annotation",
+ "NormalAnnotation",
+ "MarkerAnnotation",
+ "SingleMemberAnnotation",
+ "MemberValuePairs",
+ "MemberValuePair",
+ "MemberValue",
+ "MemberValueArrayInitializer",
+ "AnnotationTypeDeclaration",
+ "AnnotationTypeBody",
+ "AnnotationTypeMemberDeclaration",
+ "DefaultValue",
+ };
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,51 @@
+/* Generated By:JJTree: Do not edit this line. Node.java */
+
+package jaxx.compiler.java.parser;
+
+/* 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.
+ *
+ * @param n node
+ */
+ public void jjtSetParent(Node n);
+
+ public Node jjtGetParent();
+
+ /**
+ * This method tells the node to add its argument to the node's
+ * list of children.
+ *
+ * @param n node
+ * @param i index ?
+ */
+ public void jjtAddChild(Node n, int i);
+
+ /**
+ * @param i index of child
+ * @return 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();
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,214 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
+package jaxx.compiler.java.parser;
+
+/**
+ * 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.
+ * <p/>
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends jaxx.compiler.CompilerException {
+ int line;
+ int column;
+ private static final long serialVersionUID = 6179854408401024700L;
+
+ /**
+ * 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: <result of getMessage>
+ *
+ * @param currentTokenVal ?
+ * @param expectedTokenSequencesVal ?
+ * @param tokenImageVal ?
+ */
+ 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;
+ }
+
+ public ParseException(String message, int line, int column) {
+ super(message);
+ specialConstructor = false;
+ this.line = line;
+ this.column = column;
+ }
+
+
+ /**
+ * 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[] expectedTokenSequence : expectedTokenSequences) {
+ if (maxSize < expectedTokenSequence.length) {
+ maxSize = expectedTokenSequence.length;
+ }
+ for (int anExpectedTokenSequence : expectedTokenSequence) {
+ expected.append(tokenImage[anExpectedTokenSequence]).append(" ");
+ }
+ if (expectedTokenSequence[expectedTokenSequence.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;
+ }
+
+
+ public int getLine() {
+ return line;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ /** 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.
+ *
+ * @param str text to treate
+ * @return the escaped version of text
+ */
+ 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").append(s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ }
+ }
+ return retval.toString();
+ }
+
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,135 @@
+/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
+
+package jaxx.compiler.java.parser;
+
+import jaxx.compiler.reflect.ClassDescriptor;
+
+public class SimpleNode implements Node {
+ protected Node parent;
+ protected Node[] children;
+ protected int id;
+ protected JavaParser parser;
+ public Token firstToken;
+ public Token lastToken;
+ private ClassDescriptor javaType;
+
+
+ public SimpleNode(int i) {
+ id = i;
+ }
+
+ public SimpleNode(JavaParser p, int i) {
+ this(i);
+ parser = p;
+ }
+
+
+ public int getId() {
+ return id;
+ }
+
+ public void jjtOpen() {
+ }
+
+ public void jjtClose() {
+ }
+
+ public void jjtSetParent(Node n) {
+ parent = n;
+ }
+
+ public Node jjtGetParent() {
+ return parent;
+ }
+
+ public SimpleNode getParent() {
+ return (SimpleNode) parent;
+ }
+
+
+ public ClassDescriptor getJavaType() {
+ return javaType;
+ }
+
+
+ public void setJavaType(ClassDescriptor javaType) {
+ this.javaType = javaType;
+ }
+
+ public void jjtAddChild(Node n, int i) {
+ if (children == null) {
+ children = new Node[i + 1];
+ } else if (i >= children.length) {
+ Node c[] = new Node[i + 1];
+ System.arraycopy(children, 0, c, 0, children.length);
+ children = c;
+ }
+ children[i] = n;
+ }
+
+ public Node jjtGetChild(int i) {
+ return children[i];
+ }
+
+ public SimpleNode getChild(int i) {
+ return (SimpleNode) children[i];
+ }
+
+ public int jjtGetNumChildren() {
+ return (children == null) ? 0 : children.length;
+ }
+
+ /* You can override these two methods in subclasses of SimpleNode to
+customize the way the node appears when the tree is dumped. If
+your output uses more than one line you should override
+toString(String), otherwise overriding toString() is probably all
+you need to do. */
+
+ @Override
+ public String toString() {
+ return getClass().getName() + "[" + getText() + "]";
+ }
+
+ public String toString(String prefix) {
+ return prefix + toString();
+ }
+
+ /* Override this method if you want to customize how the node dumps
+ out its children. */
+
+ public void dump(String prefix) {
+ System.out.println(toString(prefix));
+ if (children != null) {
+ for (Node aChildren : children) {
+ SimpleNode n = (SimpleNode) aChildren;
+ if (n != null) {
+ n.dump(prefix + " ");
+ }
+ }
+ }
+ }
+
+ private void appendSpecialTokens(StringBuffer s, Token st) {
+ if (st != null) {
+ appendSpecialTokens(s, st.specialToken);
+ s.append(st.image);
+ }
+ }
+
+
+ /** @return the text of the tokens comprising this node. */
+ public String getText() {
+ StringBuffer text = new StringBuffer();
+ Token t = firstToken;
+ while (t != null) {
+ appendSpecialTokens(text, t.specialToken);
+ text.append(t.image);
+ if (t == lastToken)
+ break;
+ t = t.next;
+ }
+
+ return text.toString();
+ }
+}
+
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,79 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+package jaxx.compiler.java.parser;
+
+/** Describes the input token stream. */
+
+public class Token {
+ /**
+ * An integer that describes the kind of this token. This numbering
+ * system is determined by JavaCCParser, and a table of these numbers is
+ * stored in the file ...Constants.java.
+ */
+ public int kind;
+
+ /**
+ * beginLine and beginColumn describe the position of the first character
+ * of this token; endLine and endColumn describe the position of the
+ * last character of this token.
+ */
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /** The string image of the token. */
+ public String image;
+
+ /**
+ * A reference to the next regular (non-special) token from the input
+ * stream. If this is the last token from the input stream, or if the
+ * token manager has not read tokens beyond this one, this field is
+ * set to null. This is true only if this token is also a regular
+ * token. Otherwise, see below for a description of the contents of
+ * this field.
+ */
+ public Token next;
+
+ /**
+ * This field is used to access special tokens that occur prior to this
+ * token, but after the immediately preceding regular (non-special) token.
+ * If there are no such special tokens, this field is set to null.
+ * When there are more than one such special token, this field refers
+ * to the last of these special tokens, which in turn refers to the next
+ * previous special token through its specialToken field, and so on
+ * until the first special token (whose specialToken field is null).
+ * The next fields of special tokens refer to other special tokens that
+ * immediately follow it (without an intervening regular token). If there
+ * is no such token, this field is null.
+ */
+ public Token specialToken;
+
+ /** Returns the image. */
+ public String toString() {
+ return image;
+ }
+
+ /**
+ * Returns a new Token object, by default. However, if you want, you
+ * can create and return subclass objects based on the value of ofKind.
+ * Simply add the cases to the switch for all those special cases.
+ * For example, if you have a subclass of Token called IDToken that
+ * you want to create if ofKind is ID, simlpy add something like :
+ * <p/>
+ * case MyParserConstants.ID : return new IDToken();
+ * <p/>
+ * to the following switch statement. Then you can cast matchedToken
+ * variable to the appropriate type and use it in your lexical actions.
+ */
+ public static final Token newToken(int ofKind) {
+ switch (ofKind) {
+ default:
+ return new Token();
+ case JavaParserConstants.RUNSIGNEDSHIFT:
+ case JavaParserConstants.RSIGNEDSHIFT:
+ case JavaParserConstants.GT:
+ return new GTToken();
+ }
+ }
+
+ public static class GTToken extends Token {
+ int realKind = JavaParserConstants.GT;
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,126 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+package jaxx.compiler.java.parser;
+
+public class TokenMgrError extends Error {
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /** Lexical error occured. */
+ static final int LEXICAL_ERROR = 0;
+
+ /** An attempt wass made to create a second instance of a static token manager. */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /** Tried to change to an invalid lexical state. */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /** Detected (and bailed out of) an infinite loop in the token manager. */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+ private static final long serialVersionUID = -9131500865453532454L;
+
+ /**
+ * Replaces unprintable characters by their espaced (or unicode escaped)
+ * equivalents in the given string
+ *
+ * @param str text to treate
+ * @return the treated text
+ */
+ protected static String addEscapes(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").append(s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * @param EOFSeen : indicates if EOF caused the lexicl error
+ * @param lexState : lexical state in which this error occured
+ * @param errorLine : line number when the error occured
+ * @param errorColumn : column number when the error occured
+ * @param errorAfter : prefix that was seen before this error occured
+ * @param curChar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ * @return a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ */
+ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return ("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ * <p/>
+ * "Internal Error : Please file a bug report .... "
+ * <p/>
+ * from this method for such cases in the release version of your parser.
+ */
+ @Override
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError() {
+ }
+
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -3,10 +3,10 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.JAXXEngine;
-import jaxx.compiler.parser.java.JavaParser;
-import jaxx.compiler.parser.java.JavaParserTreeConstants;
-import jaxx.compiler.parser.java.ParseException;
-import jaxx.compiler.parser.java.SimpleNode;
+import jaxx.compiler.java.parser.JavaParser;
+import jaxx.compiler.java.parser.JavaParserTreeConstants;
+import jaxx.compiler.java.parser.ParseException;
+import jaxx.compiler.java.parser.SimpleNode;
import jaxx.compiler.tags.TagManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java (from rev 1582, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.compiler.script;
+
+import jaxx.compiler.CompiledObject;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.reflect.ClassDescriptorLoader;
+
+/**
+ * A dummy CompiledObject which serves to initialize scripted field. This is handled by
+ * a CompiledObject rather than (say) simply inlining the initialization code in order to
+ * ensure that the field is initialized in document order.
+ */
+public class ScriptInitializer extends CompiledObject {
+
+ public ScriptInitializer(String initializer, JAXXCompiler compiler) {
+ super(compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class)),
+ ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class), compiler, false);
+ appendInitializationCode(initializer);
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java (from rev 1582, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,320 @@
+package jaxx.compiler.script;
+
+import jaxx.compiler.*;
+import jaxx.compiler.java.parser.JavaParser;
+import jaxx.compiler.java.parser.JavaParserTreeConstants;
+import jaxx.compiler.java.parser.SimpleNode;
+import jaxx.compiler.reflect.FieldDescriptor;
+import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.compiler.tags.TagManager;
+
+import java.io.StringReader;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class ScriptManager {
+
+ private JAXXCompiler compiler;
+
+ public ScriptManager(JAXXCompiler compiler) {
+ this.compiler = compiler;
+ }
+
+ /**
+ * Strips unnecessary curly braces from around the script, generating a warning if they are found.
+ *
+ * @param script script to trim
+ * @return the trimed script
+ */
+ public String trimScript(String script) {
+ script = script.trim();
+ if (script.startsWith("{") && script.endsWith("}")) {
+ compiler.reportWarning("curly braces are unnecessary for script '" + script + "'");
+ script = script.substring(1, script.length() - 1);
+ }
+ return script;
+ }
+
+ public void checkParse(String script) throws CompilerException {
+ script = trimScript(script);
+ JavaParser p = new JavaParser(new StringReader(script));
+ while (!p.Line()) {
+ // ???
+ }
+ }
+
+ public String preprocessScript(String script) throws CompilerException {
+ script = trimScript(script);
+ StringBuffer result = new StringBuffer();
+ JavaParser p = new JavaParser(new StringReader(script));
+ //JavaParser p = new JavaParser(new StringReader(script + ";"));
+ while (!p.Line()) {
+ SimpleNode node = p.popNode();
+ if (node != null) {
+ preprocessScriptNode(node, false);
+ result.append(node.getText());
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Scans through a compound symbol (foo.bar.baz) to identify and compile the JAXX class it refers to, if any.
+ *
+ * @param symbol symbol to scan
+ */
+ private void scanCompoundSymbol(String symbol) {
+ String[] tokens = symbol.split("\\.");
+ StringBuffer currentSymbol = new StringBuffer();
+ for (String token : tokens) {
+ if (currentSymbol.length() > 0) {
+ currentSymbol.append('.');
+ }
+ currentSymbol.append(token.trim());
+
+ String contextClass = TagManager.resolveClassName(currentSymbol.toString(), compiler);
+ if (contextClass != null) {
+ compiler.addDependencyClass(contextClass);
+ }
+ }
+ }
+
+ private void preprocessScriptNode(SimpleNode node, boolean staticContext) throws CompilerException {
+ // identify static methods and initializers -- we can't fire events statically
+ if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION) {
+ if (node.getParent().getChild(0).getText().indexOf("static") != -1) {
+ staticContext = true;
+ }
+ } else if (node.getId() == JavaParserTreeConstants.JJTINITIALIZER) {
+ if (node.getText().trim().startsWith("static")) {
+ staticContext = true;
+ }
+ }
+
+ int count = node.jjtGetNumChildren();
+ for (int i = 0; i < count; i++) {
+ preprocessScriptNode(node.getChild(i), staticContext);
+ }
+
+ int id = node.getId();
+ if (id == JavaParserTreeConstants.JJTNAME || id == JavaParserTreeConstants.JJTCLASSORINTERFACETYPE) {
+ scanCompoundSymbol(node.getText());
+ }
+ if (!staticContext) {
+ String lhs = null;
+ if (id == JavaParserTreeConstants.JJTASSIGNMENTEXPRESSION || (id == JavaParserTreeConstants.JJTPOSTFIXEXPRESSION && node.jjtGetNumChildren() == 2)) {
+ lhs = ((SimpleNode) node.jjtGetChild(0)).getText().trim();
+ } else if (id == JavaParserTreeConstants.JJTPREINCREMENTEXPRESSION || id == JavaParserTreeConstants.JJTPREDECREMENTEXPRESSION) {
+ lhs = ((SimpleNode) node.jjtGetChild(0)).getText().trim();
+ }
+ if (lhs != null) {
+ FieldDescriptor[] fields = compiler.getScriptFields();
+ for (FieldDescriptor field : fields) {
+ if (field.getName().equals(lhs)) {
+ //lhs.substring(lhs.lastIndexOf(".") + 1);
+ node.firstToken.image = "jaxx.runtime.Util.assignment(" + node.firstToken.image;
+ String outputClassName = compiler.getOutputClassName();
+ node.lastToken.image = node.lastToken.image + ", \"" + lhs + "\", " + outputClassName + ".this)";
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Examines a Line to determine its real type. As all tokens returned by the parser are Lines, and
+ * they are just a tiny wrapper around the real node, this method strips off the wrapper layers to identify
+ * the real type of a node.
+ *
+ * @param line line to scan
+ * @return the line type
+ */
+ private int getLineType(SimpleNode line) {
+ if (line.jjtGetNumChildren() == 1) {
+ SimpleNode node = line.getChild(0);
+ if (node.getId() == JavaParserTreeConstants.JJTBLOCKSTATEMENT) {
+ if (node.jjtGetNumChildren() == 1) {
+ return node.getChild(0).getId();
+ }
+ } else if (node.getId() == JavaParserTreeConstants.JJTCLASSORINTERFACEBODYDECLARATION) {
+ int id = node.getChild(0).getId();
+ if (id == JavaParserTreeConstants.JJTMODIFIERS) {
+ return node.getChild(1).getId();
+ }
+ if (id == JavaParserTreeConstants.JJTINITIALIZER) {
+ return id;
+ }
+ }
+ return node.getId();
+ }
+ return JavaParserTreeConstants.JJTLINE; // generic value implying that it's okay to put into the initializer block
+ }
+
+ private SimpleNode findExplicitConstructorInvocation(SimpleNode parent) {
+ if (parent.getId() == JavaParserTreeConstants.JJTEXPLICITCONSTRUCTORINVOCATION) {
+ return parent;
+ }
+
+ int count = parent.jjtGetNumChildren();
+ for (int i = 0; i < count; i++) {
+ SimpleNode result = findExplicitConstructorInvocation(parent.getChild(i));
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ private void processConstructor(String modifiers, SimpleNode node) {
+ assert node.getId() == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION : "expected node to be ConstructorDeclaration, found " + JavaParserTreeConstants.jjtNodeName[node.getId()] + " instead";
+ assert node.getChild(0).getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS : "expected node 0 to be FormalParameters, found " + JavaParserTreeConstants.jjtNodeName[node.getChild(1).getId()] + " instead";
+ String code = "";
+ if (node.getChild(0).jjtGetNumChildren() == 0) {
+ compiler.reportError("The default no-argument constructor may not be redefined");
+ } else {
+ SimpleNode explicitConstructorInvocation = findExplicitConstructorInvocation(node);
+ if (explicitConstructorInvocation == null || explicitConstructorInvocation.getText().trim().startsWith("super(")) {
+ code = "$initialize();" + JAXXCompiler.getLineSeparator();
+ if (explicitConstructorInvocation == null) {
+ node.getChild(1).firstToken.image = node.getChild(1).firstToken.image;
+ } else {
+ explicitConstructorInvocation.lastToken.image += code;
+ }
+ }
+ }
+
+ compiler.appendBodyCode(modifiers + " " + node.getText().substring(0, node.getText().length() - 1) + code + "}");
+ //compiler.bodyCode.append(";\n");
+ }
+
+ private void scanScriptNode(SimpleNode node) throws CompilerException {
+ int nodeType = getLineType(node);
+ if (nodeType == JavaParserTreeConstants.JJTIMPORTDECLARATION) { // have to handle imports early so the preprocessing takes them into account
+ String text = node.getChild(0).getText().trim();
+ if (text.startsWith("import")) {
+ text = text.substring("import".length()).trim();
+ }
+ if (text.endsWith(";")) {
+ text = text.substring(0, text.length() - 1);
+ }
+ compiler.addImport(text);
+ }
+
+ preprocessScriptNode(node, false);
+
+ if (nodeType == JavaParserTreeConstants.JJTIMPORTDECLARATION) {
+ // do nothing, already handled above
+ } else if (nodeType == JavaParserTreeConstants.JJTMETHODDECLARATION) {
+ String returnType = null;
+ String name = null;
+ List<String> parameterTypes = new ArrayList<String>();
+ //List<String> parameterNames = new ArrayList<String>();
+ SimpleNode methodDeclaration = node.getChild(0).getChild(1);
+ assert methodDeclaration.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION;
+ for (int i = 0; i < methodDeclaration.jjtGetNumChildren(); i++) {
+ SimpleNode child = methodDeclaration.getChild(i);
+ int type = child.getId();
+ if (type == JavaParserTreeConstants.JJTRESULTTYPE) {
+ String rawReturnType = child.getText().trim();
+ returnType = TagManager.resolveClassName(rawReturnType, compiler);
+ // FIXME: this check fails for inner classes defined in this file
+ //if (returnType == null)
+ // throw new CompilerException("could not find class '" + rawReturnType + "'");
+ } else if (type == JavaParserTreeConstants.JJTMETHODDECLARATOR) {
+ name = child.firstToken.image.trim();
+ SimpleNode formalParameters = child.getChild(0);
+ assert formalParameters.getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS;
+ for (int j = 0; j < formalParameters.jjtGetNumChildren(); j++) {
+ SimpleNode parameter = formalParameters.getChild(j);
+ String rawParameterType = parameter.getChild(1).getText().trim().replaceAll("\\.\\.\\.", "[]");
+ String parameterType = TagManager.resolveClassName(rawParameterType, compiler);
+ // FIXME: this check fails for inner classes defined in this file
+ //if (parameterType == null)
+ // throw new CompilerException("could not find class '" + rawParameterType + "'");
+ parameterTypes.add(parameterType);
+ //parameterNames.add(parameter.getChild(2).getText().trim());
+ }
+ }
+ }
+ compiler.appendBodyCode(node.getText());
+ //compiler.bodyCode.append(";\n");
+ compiler.addScriptMethod(new MethodDescriptor(name, Modifier.PUBLIC, returnType, parameterTypes.toArray(new String[parameterTypes.size()]), compiler.getClassLoader()));
+ } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION ||
+ nodeType == JavaParserTreeConstants.JJTINITIALIZER) {
+ String str = node.getText().trim();
+ if (str.endsWith(";")) {
+ str += ";";
+ }
+ compiler.appendBodyCode(str);
+ //compiler.bodyCode.append(";\n");
+ } else if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) {
+ processConstructor(node.getChild(0).getChild(0).getText(), node.getChild(0).getChild(1));
+ } else if (nodeType == JavaParserTreeConstants.JJTLOCALVARIABLEDECLARATION || nodeType == JavaParserTreeConstants.JJTFIELDDECLARATION) {
+ // the "local" variable declarations in this expression aren't actually local -- they are flagged local
+ // just because there isn't an enclosing class scope visible to the parser. "Real" local variable
+ // declarations won't show up here, because they will be buried inside of methods.
+ String text = node.getText().trim();
+ if (!text.endsWith(";")) {
+ text += ";";
+ }
+ String declaration = text;
+ int equals = text.indexOf("=");
+ if (equals != -1) {
+ declaration = declaration.substring(0, equals);
+ }
+ declaration = declaration.trim();
+ String[] declarationTokens = declaration.split("\\s");
+ boolean isFinal = Arrays.asList(declarationTokens).contains("final");
+ boolean isStatic = Arrays.asList(declarationTokens).contains("static");
+ String name = declarationTokens[declarationTokens.length - 1];
+ if (name.endsWith(";")) {
+ name = name.substring(0, name.length() - 1).trim();
+ }
+ String className = declarationTokens[declarationTokens.length - 2];
+ String type = TagManager.resolveClassName(className, compiler);
+ compiler.addScriptField(new FieldDescriptor(name, Modifier.PUBLIC, type, compiler.getClassLoader())); // TODO: determine the actual modifiers
+ if (equals != -1 && !isFinal && !isStatic) { // declare the field in the class body, but wait to actually initialize it
+ //compiler.bodyCode.append(text.substring(0, equals).trim());
+ compiler.appendBodyCode(text.substring(0, equals).trim() + ";");
+ String initializer = text.substring(equals + 1).trim();
+ if (type.endsWith("[]")) {
+ initializer = "new " + type + " " + initializer;
+ }
+ final String finalInitializer = name + " = " + initializer;
+ compiler.registerInitializer(new Runnable() {
+
+ @Override
+ public void run() {
+ compiler.registerCompiledObject(new ScriptInitializer(finalInitializer, compiler));
+ }
+ });
+ } else {
+ compiler.appendBodyCode(text);
+ }
+ compiler.appendBodyCode("\n");
+ //compiler.bodyCode.append(";\n");
+ } else {
+ String text = node.getText().trim();
+ if (text.length() > 0) {
+ if (!text.endsWith(";")) {
+ text += ";";
+ }
+ compiler.appendInitializerCode(text);
+ //compiler.initializer.append(";\n");
+ }
+ }
+ }
+
+ public void registerScript(String script) throws CompilerException {
+ JavaParser p = new JavaParser(new StringReader(script));
+ //JavaParser p = new JavaParser(new StringReader(script + ";"));
+ while (!p.Line()) {
+ SimpleNode node = p.popNode();
+ if (node != null) {
+ scanScriptNode(node);
+ }
+ }
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -23,6 +23,7 @@
import java.beans.IntrospectionException;
import java.io.IOException;
import java.lang.reflect.Field;
+import jaxx.runtime.Util;
import org.w3c.dom.Attr;
import org.w3c.dom.NamedNodeMap;
@@ -141,43 +142,43 @@
return id + ".setLocation(" + id + ".getX(), " + valueCode + ");";
}
if (name.equals("width")) { // need to optimize case when both width and height are being assigned
- return "jaxx.runtime.Util.setComponentWidth(" + id + "," + valueCode + ");\n";
+ return Util.class.getName() + ".setComponentWidth(" + id + "," + valueCode + ");";
}
if (name.equals("height")) {
- return "jaxx.runtime.Util.setComponentHeight(" + id + "," + valueCode + ");\n";
+ return Util.class.getName() + ".setComponentHeight(" + id + "," + valueCode + ");";
}
if (name.equals("font-face")) {
- return "if (" + id + ".getFont() != null) " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));";
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));\n}";
}
if (name.equals("font-size")) {
- return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));";
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));\n}";
}
if (name.equals("font-weight")) {
if (valueCode.equals("\"bold\"")) {
- return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));";
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n}";
}
if (valueCode.equals("\"normal\"")) {
- return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));";
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n}";
}
if (!valueCode.startsWith("\"")) {
- return "if (" + id + ".getFont() != null) { if ((" + valueCode + ").equals(\"bold\")) " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD)); else " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD)); }";
+ return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"bold\")) {\n " +
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n } else {\n " +
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n }\n}";
}
compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode);
return "";
}
if (name.equals("font-style")) {
if (valueCode.equals("\"italic\"")) {
- return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));";
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n}";
}
if (valueCode.equals("\"normal\"")) {
- return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));";
+ return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n}";
}
if (!valueCode.startsWith("\"")) {
- return "if (" + id + ".getFont() != null) { if ((" + valueCode + ").equals(\"italic\")) " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC)); else " +
- id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC)); }";
+ return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"italic\")) {\n " +
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n } else {\n " +
+ id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n }\n}";
}
compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode);
return "";
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -8,14 +8,14 @@
import jaxx.compiler.UnsupportedAttributeException;
import jaxx.compiler.CompiledObject;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.io.JavaArgument;
-import jaxx.compiler.io.JavaMethod;
-import jaxx.compiler.StylesheetHelper;
import jaxx.compiler.beans.JAXXBeanInfo;
import jaxx.compiler.beans.JAXXEventSetDescriptor;
import jaxx.compiler.beans.JAXXIntrospector;
import jaxx.compiler.beans.JAXXPropertyDescriptor;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
+import jaxx.compiler.css.StylesheetHelper;
+import jaxx.compiler.CompiledObjectDecorator;
+import jaxx.compiler.java.JavaArgument;
+import jaxx.compiler.java.JavaMethod;
import jaxx.compiler.reflect.ClassDescriptor;
import jaxx.compiler.reflect.ClassDescriptorLoader;
import jaxx.compiler.reflect.FieldDescriptor;
@@ -44,6 +44,7 @@
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
+import jaxx.runtime.Util;
/**
* Default handler for class tags. Class tags are tags which represent instances of Java classes,
@@ -290,7 +291,7 @@
result.append(code).append('.').append(eventInfo.addMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n");
if (eventInfo.modelName != null) {
result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName),
- "jaxx.runtime.Util.getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
+ Util.class.getName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")",
compiler));
}
return result.toString();
@@ -346,7 +347,7 @@
result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n");
if (eventInfo.modelName != null) {
result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName),
- "jaxx.runtime.Util.getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
+ Util.class.getName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")",
compiler));
}
return result.toString();
@@ -775,7 +776,7 @@
// check for data binding & remove if found
JAXXObjectDescriptor jaxxObjectDescriptor = object.getObjectClass().getJAXXObjectDescriptor();
ComponentDescriptor root = jaxxObjectDescriptor.getComponentDescriptors()[0];
- object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");" + JAXXCompiler.getLineSeparator());
+ object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");");
}
object.addProperty(propertyName, stringValue);
ClassDescriptor type = getPropertyType(object, propertyName, compiler);
@@ -799,7 +800,8 @@
// have to set layout early, before children are added
object.appendInitializationCode(getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler));
}
- object.registerDataBinding(binding, propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler), compiler);
+// object.registerDataBinding(binding, propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler), compiler);
+ compiler.registerDataBinding(binding, object.getId() + "." + propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler));
} else { // no bindings, convert from string
if (inline) {
compiler.addInlineStyle(object, propertyName, false);
@@ -1056,7 +1058,7 @@
* Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass}
* for each child tag.
*
- * @param tag the tag whose children to compile
+ * @param tag the tag whose children to run
* @param compiler the current <code>JAXXCompiler</code>
* @throws CompilerException if a compilation error occurs
* @throws IOException if an I/O error occurs
@@ -1077,7 +1079,7 @@
* Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass}
* for each child tag.
*
- * @param tag the tag whose children to compile
+ * @param tag the tag whose children to run
* @param compiler the current <code>JAXXCompiler</code>
* @throws CompilerException if a compilation error occurs
* @throws IOException if an I/O error occurs
@@ -1103,7 +1105,7 @@
* Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass
* JAXXCompiler.compileFirstPass}.
*
- * @param tag the child tag to compile
+ * @param tag the child tag to run
* @param compiler the current <code>JAXXCompiler</code>
* @throws CompilerException if a compilation error occurs
* @throws IOException if an I/O error occurs
@@ -1116,7 +1118,7 @@
* Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass
* JAXXCompiler.compileSecondPass}.
*
- * @param tag the child tag to compile
+ * @param tag the child tag to run
* @param compiler the current <code>JAXXCompiler</code>
* @throws CompilerException if a compilation error occurs
* @throws IOException if an I/O error occurs
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -7,12 +7,12 @@
import jaxx.compiler.CompilerException;
import jaxx.compiler.UnsupportedAttributeException;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.parser.css.CSSParser;
-import jaxx.compiler.parser.css.CSSParserConstants;
-import jaxx.compiler.parser.css.CSSParserTreeConstants;
+import jaxx.compiler.css.parser.CSSParser;
+import jaxx.compiler.css.parser.CSSParserConstants;
+import jaxx.compiler.css.parser.CSSParserTreeConstants;
+import jaxx.compiler.css.parser.SimpleNode;
import jaxx.runtime.css.Rule;
import jaxx.runtime.css.Selector;
-import jaxx.compiler.parser.css.SimpleNode;
import jaxx.runtime.css.Stylesheet;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -90,7 +90,7 @@
/**
* Maps a class tag to a specific <code>TagHandler</code>. When a tag representing the bean class is
* encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified
- * <code>TagHandler</code> will be invoked to compile it.
+ * <code>TagHandler</code> will be invoked to run it.
*
* @param <T>
* @param beanClass the class to associate with a <code>TagHandler</code>
@@ -359,7 +359,7 @@
* class could be found.
*
* @param name name to resolve
- * @param compiler compile to use
+ * @param compiler run to use
* @return the resolved fqn class name
*/
public static String resolveClassName(String name, JAXXCompiler compiler) {
@@ -397,7 +397,7 @@
// name uses a dollar sign instead of a dot (javax.swing.JPopupMenu$Separator). And there could be more than
// one inner class -- it's possible to have com.mycompany.Outer$Inner$Innerer$Innerest.
//
- // The basic strategy is to start by treating the part before the last dot as a package name, as that is by far
+ // The basic strategy is to run by treating the part before the last dot as a package name, as that is by far
// the most likely case. If we don't find the class there, change the last dot to a dollar sign and try again.
// Suppose we have the tag <com.mycompany.Outer.Inner.Innerer.Innerest/>, matching the class above. Resolution
// proceeds like this:
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -39,7 +39,9 @@
public static final String ERROR_TABLE_MODEL_ATTRIBUTE = "errorTableModel";
public static final String ERROR_LIST_ATTRIBUTE = "errorList";
public static final String ERROR_TABLE_ATTRIBUTE = "errorTable";
+ //TODO-TC20091024 should change this default value to errorListModel
public static final String ERROR_LIST_MODEL_DEFAULT = "errors";
+ //TODO-TC20091024 should change this default value to errorTableModel
public static final String ERROR_TABLE_MODEL_DEFAULT = "errors2";
public static final String ERROR_LIST_DEFAULT = "errorList";
public static final String ERROR_TABLE_DEFAULT = "errorTable";
@@ -66,8 +68,8 @@
@Override
protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
- if (compiler.getConfiguration().isVerbose()) {
- log.info(tag);
+ if (log.isDebugEnabled()) {
+ log.debug(tag);
}
if (!tag.getLocalName().equals(FieldValidatorHandler.TAG)) {
compiler.reportError("tag '" + tag.getParentNode().getLocalName() + "' may only contain " + FieldValidatorHandler.TAG + " as children, but found : " + tag.getLocalName());
@@ -133,8 +135,8 @@
@Override
public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) {
- if (compiler.getConfiguration().isVerbose()) {
- log.info(propertyName + " : " + stringValue + " for " + object);
+ if (log.isDebugEnabled()) {
+ log.debug(propertyName + " : " + stringValue + " for " + object);
}
// delegate to the compiled object with is statefull (but not the tag handler)
object.addProperty(propertyName, stringValue);
@@ -169,8 +171,8 @@
super(id, getDescriptor(objectClass, compiler), compiler);
fields = new TreeMap<String, String>();
excludeFields = new TreeMap<String, String>();
- if (compiler.getConfiguration().isVerbose()) {
- log.info("validator objectClass " + super.getObjectClass());
+ if (log.isDebugEnabled()) {
+ log.debug("validator objectClass " + super.getObjectClass());
}
}
@@ -394,7 +396,6 @@
appendAdditionCode(code);
return false;
-
}
protected boolean addErrorTableModel(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) {
@@ -597,8 +598,8 @@
protected void registerAutoFieldBean(Element tag, JAXXCompiler compiler, JAXXBeanInfo beanInfo) {
for (JAXXPropertyDescriptor beanProperty : beanInfo.getJAXXPropertyDescriptors()) {
String descriptionName = beanProperty.getName();
- if (compiler.getConfiguration().isVerbose()) {
- log.info("try to bind on bean " + beanInfo.getJAXXBeanDescriptor().getName() + " property " + descriptionName);
+ if (log.isDebugEnabled()) {
+ log.debug("try to bind on bean " + beanInfo.getJAXXBeanDescriptor().getName() + " property " + descriptionName);
}
if (beanProperty.getWriteMethodDescriptor() == null) {
// read-only property
@@ -633,8 +634,8 @@
if (fields.containsKey(id)) {
compiler.reportError("duplicate field '" + id + "' for validator " + this);
} else {
- if (compiler.getConfiguration().isVerbose()) {
- log.info("add field <" + id + ":" + component + ">");
+ if (log.isDebugEnabled()) {
+ log.debug("add field <" + id + ":" + component + ">");
}
fields.put(id, component);
}
@@ -644,8 +645,8 @@
if (excludeFields.containsKey(id)) {
compiler.reportError("duplicate field '" + id + "' for validator " + this);
} else {
- if (compiler.getConfiguration().isVerbose()) {
- log.info("add excludeField <" + id + ":" + component + ">");
+ if (log.isDebugEnabled()) {
+ log.debug("add excludeField <" + id + ":" + component + ">");
}
excludeFields.put(id, component);
}
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -27,7 +27,7 @@
@Override
public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
if (compiler.getConfiguration().isVerbose()) {
- log.info(tag);
+ log.debug(tag);
}
//todo check there is no child
}
@@ -35,7 +35,7 @@
@Override
public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException {
if (compiler.getConfiguration().isVerbose()) {
- log.info(tag);
+ log.debug(tag);
}
if (!ClassDescriptorLoader.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) {
Modified: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,6 +1,7 @@
package jaxx.compiler.tools.jaxxcapture.handlers;
import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.java.JavaFileGenerator;
import jaxx.compiler.tools.jaxxcapture.CapturedObject;
import jaxx.compiler.tools.jaxxcapture.ContextNode;
import jaxx.compiler.tools.jaxxcapture.JAXXCapture;
@@ -16,7 +17,6 @@
import java.lang.reflect.Field;
import java.util.Map;
import java.util.Stack;
-import jaxx.compiler.io.JavaElement;
public class ObjectHandler {
private static int count;
@@ -292,7 +292,7 @@
}
result.append(" <script>");
result.append(lineSeparator);
- result.append(JavaElement.indent(script, 4, false, lineSeparator));
+ result.append(JavaFileGenerator.indent(script, 4, false, lineSeparator));
result.append(lineSeparator);
result.append(" </script>");
result.append(lineSeparator);
@@ -314,7 +314,7 @@
String lineSeparator = JAXXCompiler.getLineSeparator();
for (CapturedObject aChildren : children) {
if (!aChildren.isInlineable()) {
- result.append(JavaElement.indent(aChildren.getXML(capture), 2, false, lineSeparator));
+ result.append(JavaFileGenerator.indent(aChildren.getXML(capture), 2, false, lineSeparator));
result.append(lineSeparator);
}
}
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.CompiledObjectDecorator (from rev 1589, branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.CompiledObjectDecorator (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.CompiledObjectDecorator 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,3 @@
+jaxx.compiler.decorators.DefaultCompiledObjectDecorator
+jaxx.compiler.decorators.BoxedCompiledObjectDecorator
+jaxx.compiler.decorators.HelpRootCompiledObjectDecorator
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.CompiledObjectDecorator
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.JAXXCompilerFinalizer (from rev 1582, branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.JAXXCompilerFinalizer (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.JAXXCompilerFinalizer 2009-10-25 19:49:15 UTC (rev 1595)
@@ -0,0 +1,3 @@
+jaxx.compiler.finalizers.DefaultFinalizer
+jaxx.compiler.finalizers.SwingFinalizer
+jaxx.compiler.finalizers.ValidatorFinalizer
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,3 +0,0 @@
-jaxx.compiler.decorators.DefaultCompiledObjectDecorator
-jaxx.compiler.decorators.BoxedCompiledObjectDecorator
-jaxx.compiler.decorators.HelpRootCompiledObjectDecorator
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,3 +0,0 @@
-jaxx.compiler.generators.JAXXObjectGenerator
-jaxx.compiler.generators.SwingGenerator
-jaxx.compiler.generators.ValidatorGenerator
Modified: branches/jaxx-2.X/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,7 +1,7 @@
package jaxx.compiler;
-import jaxx.compiler.io.JavaMethod;
-import jaxx.compiler.io.JavaMethod.MethodOrder;
+import jaxx.compiler.java.JavaMethod;
+import jaxx.compiler.java.JavaMethod.MethodOrder;
import org.junit.Assert;
import org.junit.Test;
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -18,11 +18,12 @@
*##%*/
package org.nuiton.jaxx.plugin;
+import java.util.List;
import jaxx.compiler.CompilerConfiguration;
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.JAXXEngine;
import jaxx.compiler.beans.BeanInfoUtil;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
+import jaxx.compiler.CompiledObjectDecorator;
import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator;
import jaxx.compiler.tags.TagManager;
import jaxx.runtime.JAXXContext;
@@ -37,6 +38,7 @@
import java.io.IOException;
import java.util.Map;
import java.net.URL;
+import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
@@ -398,14 +400,12 @@
TagManager.reset(verbose);
engine = JAXXEngine.newLaunchor(src, files, this);
-// JAXXEngine engine;
-// engine = JAXXEngine.newLaunchor(src, files, this);
- boolean success = engine.compile();
- getLog().info("Generated " + engine.getCompilerCount() + " file(s). ");
-
+ boolean success = engine.run();
+ report(engine);
if (!success) {
throw new MojoExecutionException("Aborting due to errors reported by jaxxc");
}
+ getLog().info("Generated " + engine.getCompilerCount() + " file(s). ");
if (generateHelp) {
// generate help
@@ -520,7 +520,7 @@
public JAXXEngine getEngine() {
return engine;
}
-
+
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
@@ -529,7 +529,7 @@
protected void fixCompileSourceRoots() {
if (project == null) {
// no project defined, can not fix anything
- // this case could appears if we wanted to do some tests of the plugin
+ // this case could appear if we wanted to do some tests of the plugin
return;
}
@@ -544,7 +544,7 @@
getLog().info(toString());
getLog().info("includes : " + Arrays.toString(includes));
for (String file : files) {
- getLog().info("will generate " + file);
+ getLog().info("will parse " + file);
}
ClassLoader threadLoader = Thread.currentThread().getContextClassLoader();
@@ -561,6 +561,10 @@
} catch (Exception e) {
getLog().warn("??? : " + e.getMessage(), e);
}
+ } else if (threadLoader instanceof URLClassLoader) {
+ for (URL u : ((URLClassLoader) threadLoader).getURLs()) {
+ getLog().info("url in class loader " + u);
+ }
}
}
@@ -600,4 +604,25 @@
}
return txt;
}
+
+ protected void report(JAXXEngine engine) {
+ List<String> warnings = engine.getWarnings();
+ if (!warnings.isEmpty()) {
+ StringBuilder buffer = new StringBuilder("JAXX detects " + (warnings.size() == 1 ? "1 warning" : warnings.size() + " warnings"));
+ buffer.append(" :");
+ for (String s : warnings) {
+ buffer.append("\n").append(s);
+ }
+ getLog().warn(buffer.toString());
+ }
+ List<String> errors = engine.getErrors();
+ if (!errors.isEmpty()) {
+ StringBuilder buffer = new StringBuilder("JAXX detects " + (errors.size() == 1 ? "1 error" : errors.size() + " errors"));
+ buffer.append(" :");
+ for (String s : errors) {
+ buffer.append("\n").append(s);
+ }
+ getLog().error(buffer.toString());
+ }
+ }
}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,14 +1,10 @@
package org.nuiton.jaxx.plugin;
-import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JAXXEngine;
import jaxx.runtime.context.DefaultJAXXContext;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.SystemStreamLog;
import java.io.File;
-import java.lang.reflect.Field;
-import java.util.Map;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -123,12 +119,7 @@
//do nothing
}
});
- Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers");
- Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount");
- fieldCompilers.setAccessible(true);
- fieldErrorCount.setAccessible(true);
-
// execute mjo on each jaxx file to produce the error
for (String file : mojo.files) {
log.info("test bad file " + file);
@@ -140,12 +131,7 @@
} catch (MojoExecutionException e) {
// ok jaxx compiler failed
assertTrue(true);
-
- JAXXEngine launchor = mojo.getEngine();
- Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor);
- assertEquals(1, compilers.size());
- Integer nberrors = (Integer) fieldErrorCount.get(launchor);
- assertTrue(nberrors != null && nberrors > 0);
+ assertError(mojo.getEngine(), file, 1);
}
}
}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,11 +1,8 @@
package org.nuiton.jaxx.plugin;
-import jaxx.compiler.JAXXEngine;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.SystemStreamLog;
-import java.lang.reflect.Field;
-import java.util.Map;
import org.junit.Test;
@@ -29,6 +26,7 @@
String[] files = mojo.files;
assertNumberJaxxFiles(19);
mojo.setLog(new SystemStreamLog() {
+
@Override
public boolean isErrorEnabled() {
return false;
@@ -49,12 +47,7 @@
//do nothing
}
});
- Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers");
- Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount");
- fieldCompilers.setAccessible(true);
- fieldErrorCount.setAccessible(true);
-
// execute mjo on each jaxx file to produce the error
for (String file : files) {
log.info("test bad file " + file);
@@ -66,13 +59,8 @@
} catch (MojoExecutionException e) {
// ok jaxx compiler failed
assertTrue(true);
- JAXXEngine launchor = mojo.getEngine();
- Map<String, Compiler> compilers = (Map<String, Compiler>) fieldCompilers.get(launchor);
- assertEquals(1, compilers.size());
- Integer nberrors = (Integer) fieldErrorCount.get(launchor);
- assertEquals(1, nberrors.intValue());
+ assertError(mojo.getEngine(), file, 1);
}
}
}
-
-}
\ No newline at end of file
+}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -1,11 +1,7 @@
package org.nuiton.jaxx.plugin;
-import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JAXXEngine;
import org.apache.maven.plugin.MojoExecutionException;
-import java.lang.reflect.Field;
-import java.util.Map;
import org.apache.maven.plugin.logging.SystemStreamLog;
import org.junit.Test;
@@ -66,13 +62,7 @@
//do nothing
}
});
- Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers");
- Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount");
- fieldCompilers.setAccessible(true);
- fieldErrorCount.setAccessible(true);
-
-
// execute mjo on each jaxx file to produce the error
for (String file : mojo.files) {
log.info("test bad file " + file);
@@ -84,12 +74,7 @@
} catch (MojoExecutionException e) {
// ok jaxx compiler failed
assertTrue(true);
-
- JAXXEngine launchor = mojo.getEngine();
- Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor);
- assertEquals(1, compilers.size());
- Integer nberrors = (Integer) fieldErrorCount.get(launchor);
- assertTrue(nberrors != null && nberrors > 0);
+ assertError(mojo.getEngine(), file, 1);
}
}
}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java 2009-10-25 19:48:54 UTC (rev 1594)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java 2009-10-25 19:49:15 UTC (rev 1595)
@@ -5,6 +5,11 @@
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.JAXXEngine;
import org.nuiton.plugin.AbstractMojoTest;
import static org.junit.Assert.*;
@@ -19,6 +24,8 @@
*/
public abstract class JaxxBaseTest extends AbstractMojoTest<GenerateMojo> {
+ private Field fieldCompilers;
+
@Override
protected String getGoalName(String methodName) {
return "generate";
@@ -59,4 +66,18 @@
assertEquals(expectedNbFiles, getMojo().files.length);
}
}
+
+ @SuppressWarnings("unchecked")
+ protected void assertError(JAXXEngine engine, String file, int nbCompiler) throws Exception {
+ if (fieldCompilers == null) {
+ fieldCompilers = JAXXEngine.class.getDeclaredField("compilers");
+ fieldCompilers.setAccessible(true);
+ }
+
+ Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(engine);
+ assertEquals(nbCompiler, compilers.size());
+ List<String> errors = engine.getErrors();
+ //Integer nberrors = (Integer) fieldErrorCount.get(launchor);
+ assertTrue("should have found at least one error for " + file, errors != null && !errors.isEmpty());
+ }
}
1
0
r1594 - in branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler: . finalizers
by tchemit@users.nuiton.org 25 Oct '09
by tchemit@users.nuiton.org 25 Oct '09
25 Oct '09
Author: tchemit
Date: 2009-10-25 20:48:54 +0100 (Sun, 25 Oct 2009)
New Revision: 1594
Added:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java
Removed:
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/Generator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/GeneratorManager.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/JAXXObjectGenerator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingGenerator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorGenerator.java
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/io/
branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/parser/
Log:
- Evolution #100: am?\195?\169lioration du design du compilateur
- Evolution #99: Am?\195?\169liorer le code g?\195?\169n?\195?\169r?\195?\169
- amelioration des test dans le plugin
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java (from rev 1582, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -0,0 +1,530 @@
+package jaxx.compiler.finalizers;
+
+import jaxx.compiler.JAXXCompilerFinalizer;
+import jaxx.compiler.CompilerException;
+import jaxx.compiler.CompiledObject;
+import jaxx.compiler.CompiledObjectDecorator;
+import jaxx.compiler.DataBinding;
+import jaxx.compiler.EventHandler;
+import jaxx.compiler.JAXXCompiler;
+import jaxx.compiler.java.JavaMethod;
+import jaxx.compiler.java.JavaArgument;
+import jaxx.compiler.java.JavaField;
+import jaxx.compiler.java.JavaFile;
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.reflect.FieldDescriptor;
+import jaxx.compiler.reflect.MethodDescriptor;
+import jaxx.runtime.Base64Coder;
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.JAXXObjectDescriptor;
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.Util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.IOException;
+import static java.lang.reflect.Modifier.*;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import static jaxx.compiler.java.JavaFileGenerator.*;
+
+/**
+ * This class is a refactoring of the {@link jaxx.compiler.JAXXCompiler}.
+ * <p/>
+ * We delegate now the generation of a {@link jaxx.runtime.JAXXObject} to this class, the
+ * {@link jaxx.compiler.JAXXCompiler} now only deals with the compilation of files.
+ *
+ * @author chemit
+ */
+public class DefaultFinalizer implements JAXXCompilerFinalizer {
+
+ /** log */
+ protected static final Log log = LogFactory.getLog(DefaultFinalizer.class);
+ protected static final JavaField SERIAL_VERSION_UID_FIELD = newField(PRIVATE | STATIC | FINAL,
+ "long", "serialVersionUID", false, "1L");
+ protected static final JavaField ACTIVE_BINDINGS_FIELD = newField(PROTECTED,
+ "java.util.List<Object>", "$activeBindings", false, "new ArrayList<Object>()");
+ protected static final JavaField BINDING_SOURCES_FIELD = newField(PROTECTED,
+ "java.util.Map<String,Object>", "$bindingSources", false, "new HashMap<String,Object>()");
+ protected static final JavaField OBJECT_MAP_FIELD = newField(PROTECTED,
+ "Map<String,Object>", "$objectMap", true, "new HashMap<String,Object>()");
+ protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = newField(PRIVATE,
+ "boolean", "allComponentsCreated", false);
+ protected static final JavaField CONTEXT_INITIALIZED = newField(PRIVATE,
+ "boolean", "contextInitialized", false, "true");
+ protected static final JavaField PREVIOUS_VALUES_FIELD = newField(PROTECTED,
+ "java.util.Map<?,?>", "$previousValues", false, "new java.util.HashMap<Object,Object>()");
+ protected static final JavaField DELEGATE_CONTEXT_FIELD = newField(PROTECTED,
+ JAXXContext.class.getName(), "delegateContext", true);
+ protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = newField(0,
+ "java.beans.PropertyChangeSupport", "$propertyChangeSupport", false);
+ protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue",
+ "return delegateContext.getContextValue(clazz, null);", true,
+ new JavaArgument("Class<T>", "clazz"));
+ protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue",
+ "return delegateContext.getContextValue(clazz, name);", true,
+ new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name"));
+ protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue",
+ "delegateContext.setContextValue(o, name);", true,
+ new JavaArgument("T", "o"), new JavaArgument("String", "name"));
+ protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue",
+ "delegateContext.setContextValue(o, null);", true,
+ new JavaArgument("T", "o"));
+ protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue",
+ "delegateContext.removeContextValue(clazz, name);", true,
+ new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name"));
+ protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue",
+ "delegateContext.removeContextValue(clazz, null);", true,
+ new JavaArgument("Class<T>", "clazz"));
+ protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer",
+ "return delegateContext.getParentContainer(source, clazz);", true,
+ new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz"));
+ protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer",
+ "return delegateContext.getParentContainer(clazz);", true,
+ new JavaArgument("Class<O>", "clazz"));
+ protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = newMethod(PUBLIC, "java.lang.Object", "getObjectById",
+ "return $objectMap.get(id);", true,
+ new JavaArgument("String", "id"));
+ protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor",
+ "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);", false);
+ protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = newMethod(PUBLIC, "void", "processDataBinding",
+ "processDataBinding(dest, false);", true,
+ new JavaArgument("String", "dest"));
+ protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = newMethod(PUBLIC, "void", "firePropertyChange",
+ "super.firePropertyChange(propertyName, oldValue, newValue);", true,
+ new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue"));
+ protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = newMethod(PUBLIC, "void", "firePropertyChange",
+ "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", true,
+ new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue"));
+ protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport",
+ "if ($propertyChangeSupport == null)\n" +
+ " $propertyChangeSupport = new PropertyChangeSupport(this);\n" +
+ "return $propertyChangeSupport;", false);
+ protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener",
+ "$getPropertyChangeSupport().addPropertyChangeListener(listener);", true,
+ new JavaArgument("java.beans.PropertyChangeListener", "listener"));
+ protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener",
+ "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", true,
+ new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener"));
+ protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener",
+ "$getPropertyChangeSupport().removePropertyChangeListener(listener);", true,
+ new JavaArgument("java.beans.PropertyChangeListener", "listener"));
+ protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener",
+ "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", true,
+ new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener"));
+
+ @Override
+ public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) {
+
+ String fullClassName = packageName != null ? packageName + "." + className : className;
+ if (root == null) {
+ throw new CompilerException("root tag must be a class tag");
+ }
+ //Map<String, CompiledObject> objects = compiler.getObjects();
+ ClassDescriptor superclass = root.getObjectClass();
+ boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(superclass);
+ javaFile.setModifiers(PUBLIC);
+ javaFile.setName(fullClassName);
+ javaFile.setSuperClass(JAXXCompiler.getCanonicalName(superclass));
+ javaFile.setSuperclassIsJAXXObject(superclassIsJAXXObject);
+
+ javaFile.addInterfaces(compiler.getExtraInterfaces());
+ javaFile.setAbstractClass(compiler.isAbstractClass());
+ javaFile.setGenericType(compiler.getGenericType());
+ javaFile.setSuperGenericType(compiler.getSuperGenericType());
+
+ // finalize all objects via their decorator
+ for (CompiledObject object : compiler.getObjects().values()) {
+ CompiledObjectDecorator decorator = object.getDecorator();
+ decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName);
+ }
+ String eol = JAXXCompiler.getLineSeparator();
+
+ // DataBinding
+ for (DataBinding dataBinding : compiler.getDataBindings()) {
+ if (dataBinding.compile(true)) {
+ compiler.getInitDataBindings().append("applyDataBinding(").append(compiler.getJavaCode(dataBinding.getId())).append(");").append(eol);
+ }
+ }
+
+ if (superclassIsJAXXObject) {
+// boolean hasBind = compiler.getApplyDataBinding().length() > 0;
+ boolean hasBind = compiler.hasApplyDataBinding();
+ if (hasBind) {
+ compiler.appendApplyDataBinding(" else {");
+ compiler.appendApplyDataBinding(eol);
+ compiler.appendApplyDataBinding(" ");
+ }
+ compiler.appendApplyDataBinding("super.applyDataBinding($binding);");
+ compiler.appendApplyDataBinding(eol);
+
+ if (hasBind) {
+ compiler.appendApplyDataBinding(" return;");
+ compiler.appendApplyDataBinding(eol);
+ compiler.appendApplyDataBinding("}");
+ }
+
+ hasBind = compiler.hasRemoveDataBinding();
+// hasBind = compiler.getRemoveDataBinding().length() > 0;
+ if (hasBind) {
+ compiler.appendRemoveDataBinding(" else {");
+ compiler.appendRemoveDataBinding(eol);
+ compiler.appendRemoveDataBinding(" ");
+ }
+ compiler.appendRemoveDataBinding("super.removeDataBinding($binding);");
+ compiler.appendRemoveDataBinding(eol);
+
+ if (hasBind) {
+ compiler.appendRemoveDataBinding("}");
+ }
+ } else {
+ javaFile.addInterface(JAXXCompiler.getCanonicalName(JAXXObject.class));
+ }
+ }
+
+ @Override
+ public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException {
+
+ String fullClassName = javaFile.getName();
+
+ String jaxxContextImplementorClass = compiler.getConfiguration().getJaxxContextClass().getName();
+ boolean superclassIsJAXXObject = javaFile.isSuperclassIsJAXXObject();
+ if (!superclassIsJAXXObject) {
+ // add logger
+ if (compiler.getConfiguration().isAddLogger()) {
+ javaFile.addImport(Log.class);
+ javaFile.addImport(LogFactory.class);
+ javaFile.addSimpleField(newField(PUBLIC | STATIC | FINAL, "Log", "log", false, "LogFactory.getLog(" + fullClassName + ".class)"));
+ }
+
+ // JAXXObject
+ javaFile.addField(OBJECT_MAP_FIELD);
+ javaFile.addMethod(GET_OBJECT_BY_ID_METHOD);
+ javaFile.addField(BINDING_SOURCES_FIELD);
+ javaFile.addField(ACTIVE_BINDINGS_FIELD);
+
+ // JAXXContext
+ javaFile.addField(newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", true, "new " + jaxxContextImplementorClass + "(this);"));
+ javaFile.addMethod(SET_CONTEXT_VALUE_METHOD);
+ javaFile.addMethod(SET_CONTEXT_VALUE_NAMED_METHOD);
+ javaFile.addMethod(GET_CONTEXT_VALUE_METHOD);
+ javaFile.addMethod(GET_CONTEXT_VALUE_NAMED_METHOD);
+ javaFile.addMethod(REMOVE_CONTEXT_VALUE_METHOD);
+ javaFile.addMethod(REMOVE_CONTEXT_VALUE_NAMED_METHOD);
+ javaFile.addMethod(GET_PARENT_CONTAINER_METHOD);
+ javaFile.addMethod(GET_PARENT_CONTAINER_MORE_METHOD);
+
+ // PropertyChangeSupport
+ addPropertyChangeSupport(root, javaFile);
+
+ // DataBinding
+ javaFile.addMethod(PROCESS_DATA_BINDING_METHOD);
+ }
+ javaFile.addSimpleField(SERIAL_VERSION_UID_FIELD);
+ javaFile.addSimpleField(ALL_COMPONENTS_CREATED_FIELD);
+ boolean overrideContextInitialized = false;
+ FieldDescriptor[] scriptFields = compiler.getScriptFields();
+ for (FieldDescriptor f : scriptFields) {
+ if ("contextInitialized".equals(f.getName())) {
+ overrideContextInitialized = true;
+ break;
+ }
+ }
+ if (!overrideContextInitialized) {
+ javaFile.addSimpleField(CONTEXT_INITIALIZED);
+ }
+ javaFile.addSimpleField(createJAXXObjectDescriptorField(compiler, javaFile));
+
+ if (compiler.getStylesheet() != null) {
+ boolean needField = true;
+ if (superclassIsJAXXObject) {
+ // check alreay exists on parent
+ ClassDescriptor superclass = root.getObjectClass();
+ if (log.isDebugEnabled()) {
+ log.debug("superclass : " + superclass);
+ }
+ JAXXCompiler parentCompiler = compiler.getEngine().getJAXXCompiler(superclass.getName());
+ if (parentCompiler != null) {
+ needField = parentCompiler.getStylesheet() == null;
+ } else {
+ try {
+
+ superclass.getDeclaredFieldDescriptor(PREVIOUS_VALUES_FIELD.getName());
+ needField = false;
+ } catch (NoSuchFieldException ex) {
+ // field not found
+ }
+ }
+ if (needField && log.isDebugEnabled()) {
+ log.debug("no " + PREVIOUS_VALUES_FIELD.getName() + " field in super class");
+ }
+ }
+ if (needField) {
+ javaFile.addSimpleField(PREVIOUS_VALUES_FIELD);
+ }
+ }
+ //TC 20090228 - only generate constructors if not done in scripts
+ boolean constructorDetected = false;
+ MethodDescriptor[] methods = compiler.getScriptMethods();
+ for (MethodDescriptor m : methods) {
+ try {
+ m.getReturnType();
+ if (className.equals(m.getName())) {
+ constructorDetected = true;
+ break;
+ }
+ } catch (Exception e) {
+ log.warn("could not find return type " + m);
+ }
+ }
+ if (!constructorDetected) {
+ javaFile.addMethod(createConstructor(compiler, className, superclassIsJAXXObject));
+ javaFile.addMethod(createConstructorWithInitialContext(compiler, className, superclassIsJAXXObject));
+ }
+
+ javaFile.addMethod(createInitializer(compiler));
+ javaFile.addMethod(GET_JAXX_OBJECT_DESCRIPTOR_METHOD);
+
+ javaFile.addBodyCode(compiler.getBodyCode().toString());
+
+ javaFile.addMethod(createCompleteSetupMethod(compiler, javaFile, compiler.getInitDataBindings()));
+
+ javaFile.addMethod(newMethod(PUBLIC, "void", "applyDataBinding",
+ compiler.getApplyDataBinding().toString() + JAXXCompiler.getLineSeparator() + "processDataBinding($binding);",
+ true,
+ new JavaArgument("String", "$binding")));
+
+ javaFile.addMethod(newMethod(PUBLIC, "void", "removeDataBinding",
+ compiler.getRemoveDataBinding().toString(), true, new JavaArgument("String", "$binding")));
+
+ javaFile.addMethod(createProcessDataBindingMethod(compiler, superclassIsJAXXObject));
+
+ addEventHandlers(compiler, javaFile);
+
+ }
+
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Create fields ----------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+ protected JavaField createJAXXObjectDescriptorField(JAXXCompiler compiler, JavaFile javaFile) {
+ try {
+ JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor();
+ String data = Base64Coder.serialize(descriptor, true);
+ /*ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(new GZIPOutputStream(buffer));
+ out.writeObject(descriptor);
+ out.close();
+ // the use of the weird deprecated constructor is deliberate -- we need to store the data as a String
+ // in the compiled class file, since byte array initialization is horribly inefficient compared to
+ // String initialization. So we store the bytes in the String, and we quite explicitly want a 1:1
+ // mapping between bytes and chars, with the high byte of the char set to zero. We can then safely
+ // reconstitute the original byte[] at a later date. This is unquestionably an abuse of the String
+ // type, but if we could efficiently store a byte[] we wouldn't have to do this.
+ String data = new String(buffer.toByteArray(), 0);*/
+
+ int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit
+ if (data.length() < sizeLimit) {
+ return newField(PRIVATE | STATIC, "java.lang.String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data));
+ } else {
+ StringBuffer initializer = new StringBuffer();
+ for (int i = 0; i < data.length(); i += sizeLimit) {
+ String name = "$jaxxObjectDescriptor" + i;
+ javaFile.addField(new JavaField(PRIVATE | STATIC, "java.lang.String", name, false,
+ compiler.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length())))));
+ if (initializer.length() > 0) {
+ initializer.append(" + ");
+ }
+ initializer.append("String.valueOf(").append(name).append(")");
+ }
+ return newField(PRIVATE | STATIC | FINAL, "java.lang.String", "$jaxxObjectDescriptor", false, initializer.toString());
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+ /*---------------------------------------------------------------------------------*/
+ /*-- Create methods ---------------------------------------------------------------*/
+ /*---------------------------------------------------------------------------------*/
+ protected void addPropertyChangeSupport(CompiledObject root, JavaFile javaFile) {
+ ClassDescriptor currentClass = root.getObjectClass();
+ MethodDescriptor firePropertyChange = null;
+ while (firePropertyChange == null && currentClass != null) {
+ try {
+ firePropertyChange = currentClass.getDeclaredMethodDescriptor("firePropertyChange", ClassDescriptorLoader.getClassDescriptor(String.class),
+ ClassDescriptorLoader.getClassDescriptor(Object.class),
+ ClassDescriptorLoader.getClassDescriptor(Object.class));
+
+ } catch (NoSuchMethodException e) {
+ currentClass = currentClass.getSuperclass();
+ }
+ }
+
+ int modifiers = firePropertyChange != null ? firePropertyChange.getModifiers() : 0;
+ if (isPublic(modifiers)) {
+ // we have all the support we need
+ }
+ if (isProtected(modifiers)) {
+ // there is property change support but the firePropertyChange method is protected
+ javaFile.addMethod(FIRE_PROPERTY_CHANGE_METHOD);
+ } else {
+ // either no support at all or firePropertyChange isn't accessible
+ javaFile.addField(PROPERTY_CHANGE_SUPPORT_FIELD);
+ javaFile.addMethod(GET_PROPERTY_CHANGE_SUPPORT_METHOD);
+ javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_METHOD);
+ javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
+ javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD);
+ javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
+ javaFile.addMethod(FIRE_PROPERTY_CHANGE_NAMED_METHOD);
+ }
+ }
+
+ protected void addEventHandlers(JAXXCompiler compiler, JavaFile javaFile) {
+ for (Map.Entry<String, Map<ClassDescriptor, List<EventHandler>>> e1 : compiler.getEventHandlers().entrySet()) {
+ // outer loop is iterating over different objects (well, technically, different Java expressions)
+ for (Map.Entry<ClassDescriptor, List<EventHandler>> e2 : e1.getValue().entrySet()) {
+ // iterate over different types of listeners for this particular object (MouseListener, ComponentListener, etc.)
+ for (EventHandler handler : e2.getValue()) {
+ // iterate over individual event handlers of a single type
+ String methodName = compiler.getEventHandlerMethodName(handler);
+ MethodDescriptor listenerMethod = handler.getListenerMethod();
+ if (listenerMethod.getParameterTypes().length != 1) {
+ throw new CompilerException("Expected event handler " + listenerMethod.getName() + " of class " + handler.getListenerClass() + " to have exactly one argument");
+ }
+ javaFile.addMethod(newMethod(PUBLIC, "void", methodName, handler.getJavaCode(), false,
+ new JavaArgument(JAXXCompiler.getCanonicalName(listenerMethod.getParameterTypes()[0]), "event")));
+ }
+ }
+ }
+ }
+
+ protected JavaMethod createConstructor(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException {
+ StringBuffer code = new StringBuffer();
+ String constructorParams = compiler.getRootObject().getConstructorParams();
+ String eol = JAXXCompiler.getLineSeparator();
+ if (constructorParams != null) {
+ code.append(" super(").append(constructorParams).append(");").append(eol);
+ } else {
+ if (superclassIsJAXXObject) {
+ code.append(" super();").append(eol);
+ }
+ }
+ code.append("$initialize();");
+ code.append(eol);
+ return newMethod(PUBLIC, null, className, code.toString(), false);
+ }
+
+ protected JavaMethod createConstructorWithInitialContext(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException {
+ StringBuffer code = new StringBuffer();
+ String constructorParams = compiler.getRootObject().getConstructorParams();
+ String eol = JAXXCompiler.getLineSeparator();
+ if (constructorParams != null) {
+ code.append(" super(").append(constructorParams).append(");").append(eol);
+ } else {
+ if (superclassIsJAXXObject) {
+ code.append(" super(parentContext);").append(eol);
+ }
+ }
+ if (!superclassIsJAXXObject) {
+ code.append(Util.class.getName() + ".initContext(this, parentContext);");
+ code.append(eol);
+ }
+ code.append("$initialize();");
+ code.append(eol);
+ return newMethod(PUBLIC, null, className, code.toString(), false, new JavaArgument(JAXXContext.class.getName(), "parentContext"));
+ }
+
+ public JavaMethod createInitializer(JAXXCompiler compiler) throws CompilerException {
+ String eol = JAXXCompiler.getLineSeparator();
+ StringBuffer code = new StringBuffer();
+ CompiledObject root = compiler.getRootObject();
+ code.append("if (allComponentsCreated || !contextInitialized) {");
+ code.append(eol);
+ code.append(" return;");
+ code.append(eol);
+ code.append("}");
+ code.append(eol);
+ //TODO-TC20091025 we should remove this if no used anywhere
+ code.append("$objectMap.put(").append(compiler.getJavaCode(root.getId())).append(", this);");
+ code.append(eol);
+
+ Iterator<CompiledObject> i = compiler.getObjectCreationOrder();
+ boolean lastWasMethodCall = false;
+ //TODO-TC20091025 should do init of root first ?
+// root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall);
+ while (i.hasNext()) {
+ CompiledObject object = i.next();
+ if (object == root) {
+ continue;
+ }
+ CompiledObjectDecorator decorator = object.getDecorator();
+ lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall);
+ }
+ root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall);
+// code.append(eol);
+ if (compiler.getInitializer().length() > 0) {
+ code.append(compiler.getInitializer());
+// code.append(eol);
+ }
+ code.append("$completeSetup();");
+ code.append(eol);
+ return newMethod(PRIVATE, "void", "$initialize", code.toString(), false);
+ }
+
+ protected JavaMethod createCompleteSetupMethod(JAXXCompiler compiler, JavaFile javaFile, StringBuffer initDataBindings) {
+ StringBuffer code = new StringBuffer();
+ code.append("allComponentsCreated = true;");
+ String eol = JAXXCompiler.getLineSeparator();
+ code.append(eol);
+ for (CompiledObject object : compiler.getObjects().values()) {
+ CompiledObjectDecorator decorator = object.getDecorator();
+ code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings));
+ }
+ code.append("// init data bindings").append(eol);
+ code.append(initDataBindings);
+
+ if (compiler.getLateInitializer().length() > 0) {
+ code.append("// late initializer").append(eol);
+ code.append(compiler.getLateInitializer()).append(eol);
+ }
+ //TC-20090313 add an extra method after complete setup
+ MethodDescriptor method = compiler.getScriptMethod("$afterCompleteSetup");
+ if (method != null) {
+ code.append("$afterCompleteSetup();").append(eol);
+ }
+ return newMethod(PRIVATE, "void", "$completeSetup", code.toString(), false);
+ }
+
+ protected JavaMethod createProcessDataBindingMethod(JAXXCompiler compiler, boolean superclassIsJAXXObject) {
+ StringBuffer code = new StringBuffer();
+ String eol = JAXXCompiler.getLineSeparator();
+ //boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(compiler.getRootObject().getObjectClass());
+ // the force parameter forces the update to happen even if it is already in activeBindings. This
+ // is used on superclass invocations b/c by the time the call gets to the superclass, it is already
+ // marked active and would otherwise be skipped
+ if (compiler.getProcessDataBinding().length() > 0) {
+ code.append(" if (!$force && $activeBindings.contains($dest)) { ");
+ code.append(eol);
+ code.append(" return;").append(eol);
+ code.append("}").append(eol);
+ code.append("$activeBindings.add($dest);").append(eol);
+ code.append("try {").append(eol);
+ code.append(compiler.getProcessDataBinding().toString());
+ if (superclassIsJAXXObject) {
+ code.append(" else {").append(eol);
+ code.append(" super.processDataBinding($dest, true);").append(eol);
+ code.append(" }").append(eol);
+ }
+ code.append("} finally {").append(eol);
+ code.append(" $activeBindings.remove($dest);").append(eol);
+ code.append("}").append(eol);
+ } else if (superclassIsJAXXObject) {
+ code.append("super.processDataBinding($dest, true);").append(eol);
+ }
+ return newMethod(PUBLIC, "void", "processDataBinding", code.toString(), superclassIsJAXXObject,
+ new JavaArgument("String", "$dest"), new JavaArgument("boolean", "$force"));
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/Generator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java 2009-10-21 13:16:51 UTC (rev 1582)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/Generator.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -1,17 +0,0 @@
-package jaxx.compiler.generators;
-
-import jaxx.compiler.CompiledObject;
-import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JavaFile;
-
-/**
- * TODO javadoc!
- *
- * @author chemit
- */
-public interface Generator {
-
- void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className);
-
- void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException;
-}
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/GeneratorManager.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/GeneratorManager.java 2009-10-21 13:16:51 UTC (rev 1582)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/GeneratorManager.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -1,42 +0,0 @@
-package jaxx.compiler.generators;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ServiceLoader;
-
-/**
- *
- * @author chemit
- * @since 2.0.0
- */
-public class GeneratorManager {
-
- protected static List<Generator> generators;
-
- public static List<Generator> getGenerators() {
- if (generators == null) {
- loadGenerators();
- }
- return generators;
- }
-
- public static void addGenerator(Generator g) {
- getGenerators().add(g);
- }
-
- public static void clear() {
- if (generators != null) {
- generators.clear();
- generators = null;
- }
- }
-
- protected static void loadGenerators() {
- if (generators == null) {
- generators = new ArrayList<Generator>();
- for (Generator generator : ServiceLoader.load(Generator.class)) {
- generators.add(generator);
- }
- }
- }
-}
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/JAXXObjectGenerator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java 2009-10-21 13:16:51 UTC (rev 1582)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/JAXXObjectGenerator.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -1,604 +0,0 @@
-package jaxx.compiler.generators;
-
-import jaxx.compiler.*;
-import jaxx.runtime.Base64Coder;
-import jaxx.compiler.CompilerException;
-import jaxx.compiler.decorators.CompiledObjectDecorator;
-import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
-import jaxx.compiler.reflect.FieldDescriptor;
-import jaxx.compiler.reflect.MethodDescriptor;
-import jaxx.compiler.types.TypeManager;
-import jaxx.runtime.JAXXObject;
-import jaxx.runtime.JAXXObjectDescriptor;
-import jaxx.runtime.JAXXContext;
-import jaxx.runtime.Util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.IOException;
-import java.lang.reflect.Modifier;
-import static java.lang.reflect.Modifier.FINAL;
-import static java.lang.reflect.Modifier.PROTECTED;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class is a refactoring of the {@link jaxx.compiler.JAXXCompiler}.
- * <p/>
- * We delegate now the generation of a {@link jaxx.runtime.JAXXObject} to this class, the
- * {@link jaxx.compiler.JAXXCompiler} now only deals with the compilation of files.
- *
- * @author chemit
- */
-public class JAXXObjectGenerator implements Generator {
-
- /** log */
- protected static final Log log = LogFactory.getLog(JAXXObjectGenerator.class);
- protected static final JavaField ACTIVE_BINDINGS_FIELD = JavaField.newField(PROTECTED,
- "java.util.List<Object>", "$activeBindings", "new ArrayList<Object>()");
- protected static final JavaField BINDING_SOURCES_FIELD = JavaField.newField(PROTECTED,
- "java.util.Map<String,Object>", "$bindingSources", "new HashMap<String,Object>()");
- protected static final JavaField OBJECT_MAP_FIELD = JavaField.newField(PROTECTED,
- "Map<String,Object>", "$objectMap", "new HashMap<String,Object>()");
- protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = JavaField.newField(java.lang.reflect.Modifier.PRIVATE,
- "boolean", "allComponentsCreated");
- protected static final JavaField CONTEXT_INITIALIZED = JavaField.newField(java.lang.reflect.Modifier.PRIVATE,
- "boolean", "contextInitialized", "true");
- protected static final JavaField PREVIOUS_VALUES_FIELD = JavaField.newField(0,
- "java.util.Map", "$previousValues", "new java.util.HashMap()");
- protected static final JavaField DELEGATE_CONTEXT_FIELD = JavaField.newField(PROTECTED,
- JAXXContext.class.getName(), "delegateContext");
- protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = JavaField.newField(0,
- "java.beans.PropertyChangeSupport", "$propertyChangeSupport");
- protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue",
- "return delegateContext.getContextValue(clazz, null);",
- new JavaArgument("Class<T>", "clazz"));
- protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue",
- "return delegateContext.getContextValue(clazz, name);",
- new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name"));
- protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue",
- "delegateContext.setContextValue(o, name);",
- new JavaArgument("T", "o"), new JavaArgument("String", "name"));
- protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue",
- "delegateContext.setContextValue(o, null);",
- new JavaArgument("T", "o"));
- protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue",
- "delegateContext.removeContextValue(clazz, name);",
- new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name"));
- protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue",
- "delegateContext.removeContextValue(clazz, null);",
- new JavaArgument("Class<T>", "clazz"));
- protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer",
- "return delegateContext.getParentContainer(source, clazz);",
- new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz"));
- protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer",
- "return delegateContext.getParentContainer(clazz);",
- new JavaArgument("Class<O>", "clazz"));
- protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "java.lang.Object", "getObjectById",
- "return $objectMap.get(id);",
- new JavaArgument("String", "id"));
- protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC | java.lang.reflect.Modifier.STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor",
- "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);");
- protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "processDataBinding",
- "processDataBinding(dest, false);",
- new JavaArgument("String", "dest"));
- protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange",
- "super.firePropertyChange(propertyName, oldValue, newValue);",
- new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue"));
- protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange",
- "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);",
- new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue"));
- protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport",
- "if ($propertyChangeSupport == null)\n" +
- " $propertyChangeSupport = new PropertyChangeSupport(this);\n" +
- "return $propertyChangeSupport;");
- protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener",
- "$getPropertyChangeSupport().addPropertyChangeListener(listener);",
- new JavaArgument("java.beans.PropertyChangeListener", "listener"));
- protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener",
- "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);",
- new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener"));
- protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener",
- "$getPropertyChangeSupport().removePropertyChangeListener(listener);",
- new JavaArgument("java.beans.PropertyChangeListener", "listener"));
- protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener",
- "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);",
- new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener"));
-
- @Override
- public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) {
-
- String fullClassName = packageName != null ? packageName + "." + className : className;
- if (root == null) {
- throw new CompilerException("root tag must be a class tag");
- }
- //Map<String, CompiledObject> objects = compiler.getObjects();
- ClassDescriptor superclass = root.getObjectClass();
- boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(superclass);
- javaFile.setModifiers(Modifier.PUBLIC);
- javaFile.setClassName(fullClassName);
- javaFile.setSuperClass(JAXXCompiler.getCanonicalName(superclass));
- javaFile.setSuperclassIsJAXXObject(superclassIsJAXXObject);
-
- javaFile.addInterfaces(compiler.getExtraInterfaces());
- javaFile.setAbstractClass(compiler.isAbstractClass());
- javaFile.setGenericType(compiler.getGenericType());
- javaFile.setSuperGenericType(compiler.getSuperGenericType());
-
- for (CompiledObject object : compiler.getObjects().values()) {
- CompiledObjectDecorator decorator = object.getDecorator();
- decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName);
-
- /*if (!object.isOverride() && !(object instanceof ScriptInitializer)) {
- String id = object.getId();
- int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED;
- if (object == root) {
- javaFile.addField(new JavaField(access, fullClassName, id, "this"));
- } else {
- //TC -20081017 can have generic on compiled Object
- javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean());
- }
- }
-
- if (!compiler.inlineCreation(object) && object != root) {
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object)));
- }*/
- }
-
- // DataBinding
- for (DataBinding dataBinding : compiler.getDataBindings()) {
- if (dataBinding.compile(true)) {
- compiler.getInitDataBindings().append("applyDataBinding(").append(TypeManager.getJavaCode(dataBinding.getId())).append(");").append(JAXXCompiler.getLineSeparator());
- }
- }
-
- if (superclassIsJAXXObject) {
- boolean hasBind = compiler.getApplyDataBinding().length() > 0;
- if (hasBind) {
- compiler.appendApplyDataBinding(" else {");
- compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator());
- compiler.appendApplyDataBinding(" ");
- }
- compiler.appendApplyDataBinding("super.applyDataBinding($binding);");
- compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator());
-
- if (hasBind) {
- compiler.appendApplyDataBinding(" return;");
- compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator());
- compiler.appendApplyDataBinding("}");
- }
-
-
- hasBind = compiler.getRemoveDataBinding().length() > 0;
- if (hasBind) {
- compiler.appendRemoveDataBinding(" else {");
- compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator());
- compiler.appendRemoveDataBinding(" ");
- }
- compiler.appendRemoveDataBinding("super.removeDataBinding($binding);");
- compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator());
-
- if (hasBind) {
- compiler.appendRemoveDataBinding("}");
- }
- } else {
- javaFile.addInterface(JAXXCompiler.getCanonicalName(JAXXObject.class));
- }
- }
-
- @Override
- public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException {
-
- String fullClassName = javaFile.getClassName();
-
- String jaxxContextImplementorClass = compiler.getConfiguration().getJaxxContextClass().getName();
- boolean superclassIsJAXXObject = javaFile.isSuperclassIsJAXXObject();
- if (!superclassIsJAXXObject) {
- // add logger
- if (compiler.getConfiguration().isAddLogger()) {
- javaFile.addImport(Log.class);
- javaFile.addImport(LogFactory.class);
- javaFile.addField(JavaField.newField(Modifier.PUBLIC + Modifier.STATIC + FINAL, "Log", "log", "LogFactory.getLog(" + fullClassName + ".class)"));
- }
-
- // JAXXObject
- javaFile.addField(OBJECT_MAP_FIELD);
- javaFile.addMethod(GET_OBJECT_BY_ID_METHOD);
- javaFile.addField(BINDING_SOURCES_FIELD);
- javaFile.addField(ACTIVE_BINDINGS_FIELD);
-
- // JAXXContext
- javaFile.addField(JavaField.newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", "new " + jaxxContextImplementorClass + "(this);"));
- javaFile.addMethod(SET_CONTEXT_VALUE_METHOD);
- javaFile.addMethod(SET_CONTEXT_VALUE_NAMED_METHOD);
- javaFile.addMethod(GET_CONTEXT_VALUE_METHOD);
- javaFile.addMethod(GET_CONTEXT_VALUE_NAMED_METHOD);
- javaFile.addMethod(REMOVE_CONTEXT_VALUE_METHOD);
- javaFile.addMethod(REMOVE_CONTEXT_VALUE_NAMED_METHOD);
- javaFile.addMethod(GET_PARENT_CONTAINER_METHOD);
- javaFile.addMethod(GET_PARENT_CONTAINER_MORE_METHOD);
-
- // PropertyChangeSupport
- addPropertyChangeSupport(root, javaFile);
-
- // DataBinding
- javaFile.addMethod(PROCESS_DATA_BINDING_METHOD);
- }
-
- javaFile.addField(ALL_COMPONENTS_CREATED_FIELD);
- boolean overrideContextInitialized = false;
- FieldDescriptor[] scriptFields = compiler.getScriptFields();
- for (FieldDescriptor f : scriptFields) {
- if ("contextInitialized".equals(f.getName())) {
- overrideContextInitialized = true;
- break;
- }
- }
- if (!overrideContextInitialized) {
- javaFile.addField(CONTEXT_INITIALIZED);
- }
- javaFile.addField(createJAXXObjectDescriptorField(compiler, javaFile));
-
- if (compiler.getStylesheet() != null) {
- javaFile.addField(PREVIOUS_VALUES_FIELD);
- }
- /*for (CompiledObject object : compiler.getObjects().values()) {
- List<CompiledObject.ChildRef> refList = object.getChilds();
- if (refList==null || refList.isEmpty()) {
- continue;
- }
- for (ChildRef childRef : refList) {
- childRef.addToAdditionCode(buffer);
- }
- }*/
- //TC 20090228 - only generate constructors if not done in scripts
- boolean constructorDetected = false;
- MethodDescriptor[] methods = compiler.getScriptMethods();
- for (MethodDescriptor m : methods) {
- try {
- m.getReturnType();
- if (className.equals(m.getName())) {
- constructorDetected = true;
- break;
- }
- } catch (Exception e) {
- log.warn("could not find return type " + m);
- }
- }
- if (!constructorDetected) {
- javaFile.addMethod(createConstructor(compiler, className, superclassIsJAXXObject));
- javaFile.addMethod(createConstructorWithInitialContext(compiler, className, superclassIsJAXXObject));
- }
-
- javaFile.addMethod(createInitializer(compiler));
- javaFile.addMethod(GET_JAXX_OBJECT_DESCRIPTOR_METHOD);
-
- javaFile.addBodyCode(compiler.getBodyCode().toString());
-
- javaFile.addMethod(createCompleteSetupMethod(compiler, javaFile, compiler.getInitDataBindings()));
-
-
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "applyDataBinding",
- compiler.getApplyDataBinding().toString() + JAXXCompiler.getLineSeparator() + "processDataBinding($binding);",
- new JavaArgument("String", "$binding")));
-
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "removeDataBinding",
- compiler.getRemoveDataBinding().toString(), new JavaArgument("String", "$binding")));
-
- javaFile.addMethod(createProcessDataBindingMethod(compiler, superclassIsJAXXObject));
-
- addEventHandlers(compiler, javaFile);
-
- }
-
-
- /*---------------------------------------------------------------------------------*/
- /*-- Create fields ----------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
- protected JavaField createJAXXObjectDescriptorField(JAXXCompiler compiler, JavaFile javaFile) {
- try {
- JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor();
- String data = Base64Coder.serialize(descriptor, true);
- /*ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(new GZIPOutputStream(buffer));
- out.writeObject(descriptor);
- out.close();
- // the use of the weird deprecated constructor is deliberate -- we need to store the data as a String
- // in the compiled class file, since byte array initialization is horribly inefficient compared to
- // String initialization. So we store the bytes in the String, and we quite explicitly want a 1:1
- // mapping between bytes and chars, with the high byte of the char set to zero. We can then safely
- // reconstitute the original byte[] at a later date. This is unquestionably an abuse of the String
- // type, but if we could efficiently store a byte[] we wouldn't have to do this.
- String data = new String(buffer.toByteArray(), 0);*/
-
- int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit
- if (data.length() < sizeLimit) {
- return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", TypeManager.getJavaCode(data));
- } else {
- StringBuffer initializer = new StringBuffer();
- for (int i = 0; i < data.length(); i += sizeLimit) {
- String name = "$jaxxObjectDescriptor" + i;
- javaFile.addField(new JavaField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", name,
- TypeManager.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length())))));
- if (initializer.length() > 0) {
- initializer.append(" + ");
- }
- initializer.append("String.valueOf(").append(name).append(")");
- }
- return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", initializer.toString());
- }
- } catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- Create methods ---------------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
- protected void addPropertyChangeSupport(CompiledObject root, JavaFile javaFile) {
- ClassDescriptor currentClass = root.getObjectClass();
- MethodDescriptor firePropertyChange = null;
- while (firePropertyChange == null && currentClass != null) {
- try {
- firePropertyChange = currentClass.getDeclaredMethodDescriptor("firePropertyChange", ClassDescriptorLoader.getClassDescriptor(String.class),
- ClassDescriptorLoader.getClassDescriptor(Object.class),
- ClassDescriptorLoader.getClassDescriptor(Object.class));
-
- } catch (NoSuchMethodException e) {
- currentClass = currentClass.getSuperclass();
- }
- }
-
- int modifiers = firePropertyChange != null ? firePropertyChange.getModifiers() : 0;
- if (Modifier.isPublic(modifiers)) {
- // we have all the support we need
- }
- if (Modifier.isProtected(modifiers)) {
- // there is property change support but the firePropertyChange method is protected
- javaFile.addMethod(FIRE_PROPERTY_CHANGE_METHOD);
- } else {
- // either no support at all or firePropertyChange isn't accessible
- javaFile.addField(PROPERTY_CHANGE_SUPPORT_FIELD);
- javaFile.addMethod(GET_PROPERTY_CHANGE_SUPPORT_METHOD);
- javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_METHOD);
- javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
- javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD);
- javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD);
- javaFile.addMethod(FIRE_PROPERTY_CHANGE_NAMED_METHOD);
- }
- }
-
- protected void addEventHandlers(JAXXCompiler compiler, JavaFile javaFile) {
- for (Map.Entry<String, Map<ClassDescriptor, List<EventHandler>>> e1 : compiler.getEventHandlers().entrySet()) {
- // outer loop is iterating over different objects (well, technically, different Java expressions)
- for (Map.Entry<ClassDescriptor, List<EventHandler>> e2 : e1.getValue().entrySet()) {
- // iterate over different types of listeners for this particular object (MouseListener, ComponentListener, etc.)
- for (EventHandler handler : e2.getValue()) {
- // iterate over individual event handlers of a single type
- String methodName = compiler.getEventHandlerMethodName(handler);
- MethodDescriptor listenerMethod = handler.getListenerMethod();
- if (listenerMethod.getParameterTypes().length != 1) {
- throw new CompilerException("Expected event handler " + listenerMethod.getName() + " of class " + handler.getListenerClass() + " to have exactly one argument");
- }
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", methodName, handler.getJavaCode(),
- new JavaArgument(JAXXCompiler.getCanonicalName(listenerMethod.getParameterTypes()[0]), "event")));
- }
- }
- }
- }
-
- protected JavaMethod createConstructor(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException {
- StringBuffer code = new StringBuffer();
- String constructorParams = compiler.getRootObject().getConstructorParams();
- if (constructorParams != null) {
- code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator());
- } else {
- if (superclassIsJAXXObject) {
- code.append(" super();").append(JAXXCompiler.getLineSeparator());
- }
- }
- code.append("$initialize();");
- code.append(JAXXCompiler.getLineSeparator());
- return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString());
- }
-
- protected JavaMethod createConstructorWithInitialContext(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException {
- StringBuffer code = new StringBuffer();
- String constructorParams = compiler.getRootObject().getConstructorParams();
- if (constructorParams != null) {
- code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator());
- } else {
- if (superclassIsJAXXObject) {
- code.append(" super(parentContext);").append(JAXXCompiler.getLineSeparator());
- }
- }
- if (!superclassIsJAXXObject) {
- code.append(Util.class.getName() + ".initContext(this, parentContext);");
- code.append(JAXXCompiler.getLineSeparator());
-
-// code.append("if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {");
-// code.append(JAXXCompiler.getLineSeparator());
-// code.append(" ((jaxx.runtime.context.JAXXInitialContext)parentContext).to(this);");
-// code.append(JAXXCompiler.getLineSeparator());
-// code.append("} else {");
-// code.append(JAXXCompiler.getLineSeparator());
-// code.append(" setContextValue(parentContext);");
-// code.append(JAXXCompiler.getLineSeparator());
-// code.append("}");
-// code.append(JAXXCompiler.getLineSeparator());
- }
- code.append("$initialize();");
- code.append(JAXXCompiler.getLineSeparator());
- return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString(), new JavaArgument(JAXXContext.class.getName(), "parentContext"));
- }
-
- public JavaMethod createInitializer(JAXXCompiler compiler) throws CompilerException {
- StringBuffer code = new StringBuffer();
- CompiledObject root = compiler.getRootObject();
- code.append("if (allComponentsCreated || !contextInitialized) {");
- code.append(JAXXCompiler.getLineSeparator());
- code.append(" return;");
- code.append(JAXXCompiler.getLineSeparator());
- code.append("}");
- code.append(JAXXCompiler.getLineSeparator());
- code.append("$objectMap.put(").append(TypeManager.getJavaCode(root.getId())).append(", this);");
- code.append(JAXXCompiler.getLineSeparator());
-
- Iterator<CompiledObject> i = compiler.getObjectCreationOrder();
- boolean lastWasMethodCall = false;
- while (i.hasNext()) {
- CompiledObject object = i.next();
- if (object == root) {
- continue;
- }
- CompiledObjectDecorator decorator = object.getDecorator();
- lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall);
- /*if (object != root && !object.isOverride()) {
- if (compiler.inlineCreation(object)) {
- if (lastWasMethodCall) {
- lastWasMethodCall = false;
- code.append(JAXXCompiler.getLineSeparator());
- }
- code.append(getCreationCode(compiler, object));
- code.append(JAXXCompiler.getLineSeparator());
- } else {
- code.append(object.getCreationMethodName()).append("();");
- code.append(JAXXCompiler.getLineSeparator());
- lastWasMethodCall = true;
- }
- }*/
- }
- root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall);
- /*String rootCode = root.getInitializationCode(compiler);
- if (rootCode != null && rootCode.length() > 0) {
- code.append(rootCode);
- code.append(JAXXCompiler.getLineSeparator());
- }*/
- code.append(JAXXCompiler.getLineSeparator());
- if (compiler.getInitializer().length() > 0) {
- code.append(compiler.getInitializer());
- code.append(JAXXCompiler.getLineSeparator());
- }
- code.append("$completeSetup();");
- code.append(JAXXCompiler.getLineSeparator());
- return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$initialize", code.toString());
- }
-
- protected JavaMethod createCompleteSetupMethod(JAXXCompiler compiler, JavaFile javaFile, StringBuffer initDataBindings) {
- StringBuffer code = new StringBuffer();
- code.append("allComponentsCreated = true;");
- code.append(JAXXCompiler.getLineSeparator());
- for (CompiledObject object : compiler.getObjects().values()) {
- CompiledObjectDecorator decorator = object.getDecorator();
- code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings));
-
- /*//TC - 20081017 only generate the method if not empty ?
- if (object.getId().startsWith("$")) {
- code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator());
- } else {
- String additionCode = object.getAdditionCode();
- if (additionCode.length() > 0) {
- code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator());
- additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode;
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode));
- }
- }*/
- //code.append(getLineSeparator());
- }
-
- code.append(initDataBindings);
-
- if (compiler.getLateInitializer().length() > 0) {
- code.append(compiler.getLateInitializer());
- code.append(JAXXCompiler.getLineSeparator());
- }
- //TC-20090313 add an extra method after complete setup
- MethodDescriptor method = compiler.getScriptMethod("$afterCompleteSetup");
- if (method != null) {
- code.append("$afterCompleteSetup();").append(JAXXCompiler.getLineSeparator());
- }
- return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$completeSetup", code.toString());
- }
-
- protected JavaMethod createProcessDataBindingMethod(JAXXCompiler compiler, boolean superclassIsJAXXObject) {
- StringBuffer code = new StringBuffer();
- //boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(compiler.getRootObject().getObjectClass());
- // the force parameter forces the update to happen even if it is already in activeBindings. This
- // is used on superclass invocations b/c by the time the call gets to the superclass, it is already
- // marked active and would otherwise be skipped
- if (compiler.getProcessDataBinding().length() > 0) {
- code.append(" if (!$force && $activeBindings.contains($dest)) { ");
- code.append(JAXXCompiler.getLineSeparator());
- code.append(" return;");
- code.append(JAXXCompiler.getLineSeparator());
- code.append("}");
- code.append(JAXXCompiler.getLineSeparator());
- code.append("$activeBindings.add($dest);");
- code.append(JAXXCompiler.getLineSeparator());
- code.append("try {");
- code.append(JAXXCompiler.getLineSeparator());
- if (compiler.getProcessDataBinding().length() > 0) {
- code.append(compiler.getProcessDataBinding().toString());
- //code.append(JAXXCompiler.getLineSeparator());
- }
- if (superclassIsJAXXObject) {
- code.append(" else {");
- code.append(JAXXCompiler.getLineSeparator());
- code.append(" super.processDataBinding($dest, true);");
- code.append(JAXXCompiler.getLineSeparator());
- code.append(" }");
- code.append(JAXXCompiler.getLineSeparator());
- }
- code.append("} finally {");
- code.append(JAXXCompiler.getLineSeparator());
- code.append(" $activeBindings.remove($dest);");
- code.append(JAXXCompiler.getLineSeparator());
- code.append("}");
- code.append(JAXXCompiler.getLineSeparator());
- } else if (superclassIsJAXXObject) {
- code.append("super.processDataBinding($dest, true);");
- code.append(JAXXCompiler.getLineSeparator());
- }
- return JavaMethod.newMethod(Modifier.PUBLIC, "void", "processDataBinding", code.toString(),
- new JavaArgument("String", "$dest"), new JavaArgument("boolean", "$force"));
- }
-
- /*---------------------------------------------------------------------------------*/
- /*-- Create methods code ----------------------------------------------------------*/
- /*---------------------------------------------------------------------------------*/
-
- /* protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException {
- if (object instanceof ScriptInitializer) {
- return object.getInitializationCode(compiler);
- }
- CompiledObjectDecorator decorator = object.getDecorator();
- String result = decorator.getCreationCode(compiler, object);
- return result;*/
- /*StringBuffer result = new StringBuffer();
- result.append(object.getId());
- result.append(" = ");
- if (object.isJavaBean() && object.getJavaBeanInitCode() != null) {
- result.append(object.getJavaBeanInitCode()).append(";");
- } else {
- String constructorParams = object.getConstructorParams();
- if (constructorParams != null) {
- //TC - 20081017 compiledObject can have generics
- result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");");
- //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");");
- } else {
- //TC - 20081017 compiledObject can have generics
- result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();");
- }
- }
- result.append(JAXXCompiler.getLineSeparator());
- String initCode = object.getInitializationCode(compiler);
- if (initCode != null && initCode.length() > 0) {
- result.append(initCode);
- }
- result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");");
-
- return result.toString();*/
-// }
-}
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java (from rev 1582, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -0,0 +1,33 @@
+package jaxx.compiler.finalizers;
+
+import jaxx.compiler.java.JavaArgument;
+import jaxx.compiler.java.JavaFile;
+import jaxx.compiler.java.JavaFileGenerator;
+import jaxx.compiler.*;
+import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.runtime.swing.Application;
+
+import java.lang.reflect.Modifier;
+
+/** @author chemit */
+public class SwingFinalizer implements JAXXCompilerFinalizer {
+
+ @Override
+ public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) {
+ }
+
+ @Override
+ public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException {
+
+ if (ClassDescriptorLoader.getClassDescriptor(Application.class.getName()).isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) {
+ // TODO: check for existing main method first
+ javaFile.addMethod(JavaFileGenerator.newMethod(
+ Modifier.PUBLIC | Modifier.STATIC,
+ "void",
+ "main",
+ "SwingUtilities.invokeLater(new Runnable() { public void run() { new " + className + "().setVisible(true); } });",
+ false,
+ new JavaArgument("String[]", "arg")));
+ }
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingGenerator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java 2009-10-21 13:16:51 UTC (rev 1582)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingGenerator.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -1,27 +0,0 @@
-package jaxx.compiler.generators;
-
-import jaxx.compiler.*;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
-import jaxx.runtime.swing.Application;
-
-import java.lang.reflect.Modifier;
-
-/** @author chemit */
-public class SwingGenerator implements Generator {
-
- @Override
- public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) {
- }
-
- @Override
- public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException {
-
- //TODO : move this to jaxx-compiler-swing generator
- if (ClassDescriptorLoader.getClassDescriptor(Application.class.getName()).isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) {
- // TODO: check for existing main method first
- javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC | Modifier.STATIC, "void", "main",
- "SwingUtilities.invokeLater(new Runnable() { public void run() { new " + className + "().setVisible(true); } });",
- new JavaArgument("String[]", "arg")));
- }
- }
-}
Copied: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java (from rev 1582, branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java)
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java (rev 0)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -0,0 +1,97 @@
+package jaxx.compiler.finalizers;
+
+import jaxx.compiler.java.JavaArgument;
+import jaxx.compiler.java.JavaField;
+import jaxx.compiler.java.JavaFile;
+import jaxx.compiler.java.JavaFileGenerator;
+import jaxx.compiler.*;
+import jaxx.compiler.CompiledObject.ChildRef;
+import jaxx.compiler.reflect.ClassDescriptor;
+import jaxx.compiler.reflect.ClassDescriptorLoader;
+import jaxx.compiler.tags.validator.BeanValidatorHandler;
+import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator;
+
+import java.util.List;
+import jaxx.runtime.SwingUtil;
+
+/** @author chemit */
+public class ValidatorFinalizer implements JAXXCompilerFinalizer {
+
+ protected static final JavaField VALIDATOR_IDS_FIELD = JavaFileGenerator.newField(java.lang.reflect.Modifier.PROTECTED,
+ "java.util.List<String>", "validatorIds", true, "new ArrayList<String>()");
+
+ @Override
+ public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) {
+
+ if (!BeanValidatorHandler.hasValidator(compiler)) {
+ return;
+ }
+
+ for (CompiledObject object : compiler.getObjects().values()) {
+ List<ChildRef> childs = object.getChilds();
+ if (childs == null || childs.isEmpty()) {
+ continue;
+ }
+ for (ChildRef child : childs) {
+ String javaCode = child.getChildJavaCode();
+ // some validators are defined on this object
+ boolean found = BeanValidatorHandler.isComponentUsedByValidator(compiler, child.getChild().getId());
+ if (found) {
+ // box the child component in a JxLayer
+ child.setChildJavaCode(SwingUtil.class.getName() + ".boxComponentWithJxLayer(" + javaCode + ")");
+ }
+ }
+ }
+ String eol = JAXXCompiler.getLineSeparator();
+ // register validator
+ compiler.appendLateInitializer("// validator setup" + eol);
+ for (CompiledBeanValidator validator : BeanValidatorHandler.getValidators(compiler)) {
+ String id = compiler.getJavaCode(validator.getId());
+ compiler.appendLateInitializer("validatorIds.add(" + id + ");");
+ compiler.appendLateInitializer(eol);
+ compiler.appendLateInitializer("getValidator(" + id + ").installUIs();");
+ compiler.appendLateInitializer(eol);
+ compiler.appendLateInitializer("getValidator(" + id + ").reloadBean();");
+ //compiler.appendLateInitializer("getValidator(" + id + ").validate();");
+ compiler.appendLateInitializer(eol);
+ }
+ compiler.appendLateInitializer("validatorIds = java.util.Collections.unmodifiableList(validatorIds);");
+ compiler.appendLateInitializer(eol);
+ }
+
+ @Override
+ public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException {
+ if (!BeanValidatorHandler.hasValidator(compiler)) {
+ return;
+ }
+ Class<?> validatorClass = compiler.getConfiguration().getValidatorClass();
+ String validatorFQN = validatorClass.getName();
+ javaFile.addImport(validatorFQN);
+
+ //TODO use the specific JAXXValidator interface (swing, gwt,...)
+ Class<?> validatorInterface = jaxx.runtime.JAXXValidator.class;
+
+ if (javaFile.isSuperclassIsJAXXObject()) {
+ ClassDescriptor superClass = ClassDescriptorLoader.getClassDescriptor(javaFile.getSuperClass());
+ boolean parentIsValidator = ClassDescriptorLoader.getClassDescriptor(validatorInterface).isAssignableFrom(superClass);
+
+ if (parentIsValidator) {
+ // nothing to generate (use the parent directly)
+ return;
+ }
+ }
+
+ // add JAXXValidator interface
+ javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface));
+
+ // implements JAXXValidator
+ javaFile.addField(VALIDATOR_IDS_FIELD);
+ javaFile.addMethod(JavaFileGenerator.newMethod(
+ java.lang.reflect.Modifier.PUBLIC,
+ validatorFQN + "<?>",
+ "getValidator",
+ "return (" + validatorFQN + "<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);",
+ true,
+ new JavaArgument("String", "validatorId")));
+ }
+}
Property changes on: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Deleted: branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorGenerator.java
===================================================================
--- branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java 2009-10-21 13:16:51 UTC (rev 1582)
+++ branches/jaxx-2.X/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorGenerator.java 2009-10-25 19:48:54 UTC (rev 1594)
@@ -1,88 +0,0 @@
-package jaxx.compiler.generators;
-
-import jaxx.compiler.*;
-import jaxx.compiler.CompiledObject.ChildRef;
-import jaxx.compiler.reflect.ClassDescriptor;
-import jaxx.compiler.reflect.ClassDescriptorLoader;
-import jaxx.compiler.tags.validator.BeanValidatorHandler;
-import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator;
-import jaxx.compiler.types.TypeManager;
-
-import java.util.List;
-import jaxx.runtime.SwingUtil;
-
-/** @author chemit */
-public class ValidatorGenerator implements Generator {
-
- protected static final JavaField VALIDATOR_IDS_FIELD = JavaField.newField(java.lang.reflect.Modifier.PROTECTED,
- "java.util.List<String>", "validatorIds", "new ArrayList<String>()");
-
- @Override
- public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) {
-
- if (!BeanValidatorHandler.hasValidator(compiler)) {
- return;
- }
-
- for (CompiledObject object : compiler.getObjects().values()) {
- List<ChildRef> childs = object.getChilds();
- if (childs == null || childs.isEmpty()) {
- continue;
- }
- for (ChildRef child : childs) {
- String javaCode = child.getChildJavaCode();
- // some validators are defined on this object
- boolean found = BeanValidatorHandler.isComponentUsedByValidator(compiler, child.getChild().getId());
- if (found) {
- // box the child component in a JxLayer
- child.setChildJavaCode(SwingUtil.class.getName() + ".boxComponentWithJxLayer(" + javaCode + ")");
- }
- }
- }
- // register validator
- for (CompiledBeanValidator validator : BeanValidatorHandler.getValidators(compiler)) {
- String id = TypeManager.getJavaCode(validator.getId());
- compiler.appendLateInitializer("validatorIds.add(" + id + ");");
- compiler.appendLateInitializer(JAXXCompiler.getLineSeparator());
- compiler.appendLateInitializer("getValidator(" + id + ").installUIs();");
- compiler.appendLateInitializer(JAXXCompiler.getLineSeparator());
- compiler.appendLateInitializer("getValidator(" + id + ").reloadBean();");
- //compiler.appendLateInitializer("getValidator(" + id + ").validate();");
- compiler.appendLateInitializer(JAXXCompiler.getLineSeparator());
- }
- compiler.appendLateInitializer("validatorIds = java.util.Collections.unmodifiableList(validatorIds);");
- compiler.appendLateInitializer(JAXXCompiler.getLineSeparator());
- }
-
- @Override
- public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException {
- if (!BeanValidatorHandler.hasValidator(compiler)) {
- return;
- }
- Class<?> validatorClass = compiler.getConfiguration().getValidatorClass();
- String validatorFQN = validatorClass.getName();
- javaFile.addImport(validatorFQN);
-
- //TODO use the specific JAXXValidator interface (swing, gwt,...)
- Class<?> validatorInterface = jaxx.runtime.JAXXValidator.class;
-
- if (javaFile.isSuperclassIsJAXXObject()) {
- ClassDescriptor superClass = ClassDescriptorLoader.getClassDescriptor(javaFile.getSuperClass());
- boolean parentIsValidator = ClassDescriptorLoader.getClassDescriptor(validatorInterface).isAssignableFrom(superClass);
-
- if (parentIsValidator) {
- // nothing to generate (use the parent directly)
- return;
- }
- }
-
- // add JAXXValidator interface
- javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface));
-
- // implements JAXXValidator
- javaFile.addField(VALIDATOR_IDS_FIELD);
- javaFile.addMethod(JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, validatorFQN + "<?>", "getValidator",
- "return (" + validatorFQN + ") (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);",
- new JavaArgument("String", "validatorId")));
- }
-}
1
0
r1593 - in branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin: Bug1722Test Bug1750Test Bug1751Test CompilerTest CompilerValidatorTest Evolution74Test
by tchemit@users.nuiton.org 24 Oct '09
by tchemit@users.nuiton.org 24 Oct '09
24 Oct '09
Author: tchemit
Date: 2009-10-24 15:56:24 +0200 (Sat, 24 Oct 2009)
New Revision: 1593
Modified:
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml
branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml
Log:
remover verbose flag on tests
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml 2009-10-24 11:36:16 UTC (rev 1592)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml 2009-10-24 13:56:24 UTC (rev 1593)
@@ -16,7 +16,7 @@
<outJava>${basedir}/target/it-generated-sources/java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
- <verbose>true</verbose>
+ <!--<verbose>true</verbose>-->
<includes>
<value>**/Bug1722Test/*.jaxx</value>
</includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml 2009-10-24 11:36:16 UTC (rev 1592)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml 2009-10-24 13:56:24 UTC (rev 1593)
@@ -16,7 +16,7 @@
<outJava>${basedir}/target/it-generated-sources/java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
- <verbose>true</verbose>
+ <!--<verbose>true</verbose>-->
<resetAfterCompile>false</resetAfterCompile>
<includes>
<value>**/Bug1750Test/*.jaxx</value>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml 2009-10-24 11:36:16 UTC (rev 1592)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml 2009-10-24 13:56:24 UTC (rev 1593)
@@ -17,7 +17,7 @@
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<i18nable>true</i18nable>
<force>true</force>
- <verbose>true</verbose>
+ <!--<verbose>true</verbose>-->
<resetAfterCompile>false</resetAfterCompile>
<includes>
<value>**/Bug1751Test/*.jaxx</value>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml 2009-10-24 11:36:16 UTC (rev 1592)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml 2009-10-24 13:56:24 UTC (rev 1593)
@@ -17,7 +17,7 @@
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<i18nable>false</i18nable>
<force>true</force>
- <verbose>true</verbose>
+ <!--<verbose>true</verbose>-->
<resetAfterCompile>true</resetAfterCompile>
<includes>
<value>**/CompilerTest/icon/*.jaxx</value>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml 2009-10-24 11:36:16 UTC (rev 1592)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml 2009-10-24 13:56:24 UTC (rev 1593)
@@ -17,7 +17,7 @@
<outJava>${basedir}/target/it-generated-sources/java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
- <verbose>true</verbose>
+ <!--<verbose>true</verbose>-->
<includes>
<value>**/CompilerValidatorTest/validator/errors/*.jaxx</value>
</includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml 2009-10-24 11:36:16 UTC (rev 1592)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml 2009-10-24 13:56:24 UTC (rev 1593)
@@ -16,7 +16,7 @@
<outJava>${basedir}/target/it-generated-sources/java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
- <verbose>true</verbose>
+ <!--<verbose>true</verbose>-->
<includes>
<value>**/CompilerValidatorTest/validator/ok/*.jaxx</value>
</includes>
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml 2009-10-24 11:36:16 UTC (rev 1592)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml 2009-10-24 13:56:24 UTC (rev 1593)
@@ -16,7 +16,7 @@
<outJava>${basedir}/target/it-generated-sources/java</outJava>
<!--outResource>${basedir}/target/it-generated-sources/resources</outResource-->
<force>true</force>
- <verbose>true</verbose>
+ <!--<verbose>true</verbose>-->
<includes>
<value>**/Evolution74Test/error/*.jaxx</value>
</includes>
1
0
r1592 - branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime
by tchemit@users.nuiton.org 24 Oct '09
by tchemit@users.nuiton.org 24 Oct '09
24 Oct '09
Author: tchemit
Date: 2009-10-24 13:36:16 +0200 (Sat, 24 Oct 2009)
New Revision: 1592
Modified:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
Log:
clean code
Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-24 11:34:52 UTC (rev 1591)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-24 11:36:16 UTC (rev 1592)
@@ -99,7 +99,6 @@
return newListContextEntryDef(null);
}
- //@SuppressWarnings({"unchecked"})
public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) {
Class<List<O>> castList = Util.<O>castList();
JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name,castList);
1
0
r1591 - in branches/jaxx-2.X: . jaxx-runtime/src/main/java/jaxx/runtime maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin maven-jaxx-plugin/src/main/resources maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin
by tchemit@users.nuiton.org 24 Oct '09
by tchemit@users.nuiton.org 24 Oct '09
24 Oct '09
Author: tchemit
Date: 2009-10-24 13:34:52 +0200 (Sat, 24 Oct 2009)
New Revision: 1591
Modified:
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java
branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java
branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java
branches/jaxx-2.X/pom.xml
Log:
- Evolution #100: am?\195?\169lioration du design du compilateur
- Evolution #99: Am?\195?\169liorer le code g?\195?\169n?\195?\169r?\195?\169
- Evolution #98: les objets JAXX sont serializable
Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java 2009-10-24 11:34:52 UTC (rev 1591)
@@ -4,13 +4,14 @@
*/
package jaxx.runtime;
+import java.io.Serializable;
import java.util.Map;
/**
* The <code>JAXXObject</code> interface is implemented by all classes
* produced by the JAXX compiler.
*/
-public interface JAXXObject extends JAXXContext {
+public interface JAXXObject extends JAXXContext, Serializable {
/**
* Retrieves an object defined in an XML tag by its ID.
Modified: branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java
===================================================================
--- branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/jaxx-runtime/src/main/java/jaxx/runtime/Util.java 2009-10-24 11:34:52 UTC (rev 1591)
@@ -30,7 +30,9 @@
public static final String DEFAULT_ICON_PATH = "/icons/";
public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path";
- /** to use log facility, just put in your code: log.info(\"...\"); */
+ /**
+ * Logger
+ */
static private final Log log = LogFactory.getLog(Util.class);
// Maps root objects to lists of event listeners
private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java 2009-10-24 11:34:52 UTC (rev 1591)
@@ -20,7 +20,7 @@
import jaxx.compiler.CompilerConfiguration;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JAXXCompilerLaunchor;
+import jaxx.compiler.JAXXEngine;
import jaxx.compiler.beans.BeanInfoUtil;
import jaxx.compiler.decorators.CompiledObjectDecorator;
import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator;
@@ -297,6 +297,10 @@
*
*/
protected ClassLoader cl;
+ /**
+ * JAXX engine
+ */
+ private JAXXEngine engine;
@SuppressWarnings("unchecked")
@Override
@@ -393,10 +397,11 @@
// force compiler init from here, not in a static block
TagManager.reset(verbose);
- JAXXCompilerLaunchor launchor;
- launchor = JAXXCompilerLaunchor.newLaunchor(src, files, this);
- boolean success = launchor.compile();
- getLog().info("Generated " + launchor.getCompilerCount() + " file(s). ");
+ engine = JAXXEngine.newLaunchor(src, files, this);
+// JAXXEngine engine;
+// engine = JAXXEngine.newLaunchor(src, files, this);
+ boolean success = engine.compile();
+ getLog().info("Generated " + engine.getCompilerCount() + " file(s). ");
if (!success) {
throw new MojoExecutionException("Aborting due to errors reported by jaxxc");
@@ -512,6 +517,10 @@
return validatorClass;
}
+ public JAXXEngine getEngine() {
+ return engine;
+ }
+
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/main/resources/log4j.properties 2009-10-24 11:34:52 UTC (rev 1591)
@@ -6,4 +6,4 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
log4j.logger.org.nuiton.i18n=ERROR
-#log4j.logger.jaxx=DEBUG
+log4j.logger.jaxx=INFO
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java 2009-10-24 11:34:52 UTC (rev 1591)
@@ -2,7 +2,6 @@
import jaxx.runtime.Base64Coder;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JAXXCompilerLaunchor;
import jaxx.runtime.JAXXObjectDescriptor;
import jaxx.runtime.Util;
@@ -17,7 +16,7 @@
getMojo().execute();
assertNumberJaxxFiles(1);
- JAXXCompiler compiler = JAXXCompilerLaunchor.get().getJAXXCompiler("org.nuiton.jaxx.plugin.Bug1750Test.ComboBox");
+ JAXXCompiler compiler = getMojo().getEngine().getJAXXCompiler("org.nuiton.jaxx.plugin.Bug1750Test.ComboBox");
assertNotNull(compiler);
JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor();
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java 2009-10-24 11:34:52 UTC (rev 1591)
@@ -1,7 +1,7 @@
package org.nuiton.jaxx.plugin;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JAXXCompilerLaunchor;
+import jaxx.compiler.JAXXEngine;
import jaxx.runtime.context.DefaultJAXXContext;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.SystemStreamLog;
@@ -123,8 +123,8 @@
//do nothing
}
});
- Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers");
- Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount");
+ Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers");
+ Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount");
fieldCompilers.setAccessible(true);
fieldErrorCount.setAccessible(true);
@@ -141,11 +141,9 @@
// ok jaxx compiler failed
assertTrue(true);
- JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get();
+ JAXXEngine launchor = mojo.getEngine();
Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor);
assertEquals(1, compilers.size());
- //JAXXCompiler compiler;
- //compiler = compilers.values().iterator().next();
Integer nberrors = (Integer) fieldErrorCount.get(launchor);
assertTrue(nberrors != null && nberrors > 0);
}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java 2009-10-24 11:34:52 UTC (rev 1591)
@@ -1,6 +1,6 @@
package org.nuiton.jaxx.plugin;
-import jaxx.compiler.JAXXCompilerLaunchor;
+import jaxx.compiler.JAXXEngine;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.SystemStreamLog;
@@ -49,8 +49,8 @@
//do nothing
}
});
- Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers");
- Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount");
+ Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers");
+ Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount");
fieldCompilers.setAccessible(true);
fieldErrorCount.setAccessible(true);
@@ -66,10 +66,9 @@
} catch (MojoExecutionException e) {
// ok jaxx compiler failed
assertTrue(true);
- JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get();
+ JAXXEngine launchor = mojo.getEngine();
Map<String, Compiler> compilers = (Map<String, Compiler>) fieldCompilers.get(launchor);
assertEquals(1, compilers.size());
- //Compiler compiler = compilers.values().iterator().next();
Integer nberrors = (Integer) fieldErrorCount.get(launchor);
assertEquals(1, nberrors.intValue());
}
Modified: branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java
===================================================================
--- branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java 2009-10-24 11:34:52 UTC (rev 1591)
@@ -1,7 +1,7 @@
package org.nuiton.jaxx.plugin;
import jaxx.compiler.JAXXCompiler;
-import jaxx.compiler.JAXXCompilerLaunchor;
+import jaxx.compiler.JAXXEngine;
import org.apache.maven.plugin.MojoExecutionException;
import java.lang.reflect.Field;
@@ -66,8 +66,8 @@
//do nothing
}
});
- Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers");
- Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount");
+ Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers");
+ Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount");
fieldCompilers.setAccessible(true);
fieldErrorCount.setAccessible(true);
@@ -85,11 +85,9 @@
// ok jaxx compiler failed
assertTrue(true);
- JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get();
+ JAXXEngine launchor = mojo.getEngine();
Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor);
assertEquals(1, compilers.size());
- //JAXXCompiler compiler;
- //compiler = compilers.values().iterator().next();
Integer nberrors = (Integer) fieldErrorCount.get(launchor);
assertTrue(nberrors != null && nberrors > 0);
}
Modified: branches/jaxx-2.X/pom.xml
===================================================================
--- branches/jaxx-2.X/pom.xml 2009-10-24 11:32:31 UTC (rev 1590)
+++ branches/jaxx-2.X/pom.xml 2009-10-24 11:34:52 UTC (rev 1591)
@@ -342,7 +342,7 @@
<name>JAXX Project</name>
<description>JAXX Project</description>
<inceptionYear>2008</inceptionYear>
- <url>http://maven-site.nuiton.org/jaxx</url>
+ <url>http://maven-site.nuiton.org/jaxx-2.0</url>
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
1
0