You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ma...@apache.org on 2006/07/25 00:24:18 UTC
svn commit: r425235 [2/11] - in
/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins: ./
maven-adf-archetype/
maven-adf-archetype/src/main/resources/archetype-resources/
maven-adf-archetype/src/main/resources/archetype-resources/src/main/ja...
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/pom.xml?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/pom.xml (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/pom.xml Mon Jul 24 17:24:16 2006
@@ -1,42 +1,42 @@
-<project>
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <artifactId>maven-plugin-parent</artifactId>
- <version>incubator-alpha-1-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <artifactId>maven-javacc-plugin</artifactId>
- <packaging>maven-plugin</packaging>
- <version>incubator-alpha-5-SNAPSHOT</version>
- <name>Maven Javacc Plugin</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>plexus</groupId>
- <artifactId>plexus-compiler-api</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.0.1</version>
- </dependency>
- <dependency>
- <groupId>javacc</groupId>
- <artifactId>javacc</artifactId>
- <version>3.2</version>
- </dependency>
- </dependencies>
-</project>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-plugin-parent</artifactId>
+ <version>incubator-alpha-1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-javacc-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>incubator-alpha-5-SNAPSHOT</version>
+ <name>Maven Javacc Plugin</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>plexus</groupId>
+ <artifactId>plexus-compiler-api</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javacc</groupId>
+ <artifactId>javacc</artifactId>
+ <version>3.2</version>
+ </dependency>
+ </dependencies>
+</project>
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/main/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/main/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojo.java?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/main/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojo.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/main/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojo.java Mon Jul 24 17:24:16 2006
@@ -1,347 +1,347 @@
-package org.apache.myfaces.trinidadinternal.view.faces.maven.plugin.javacc;
-
-/*
- * Copyright 2001-2005 The Codehaus.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.File;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
-import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
-import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
-import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
-import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
-import org.codehaus.plexus.util.FileUtils;
-
-
-/**
- * @goal generate
- * @phase generate-sources
- * @description Goal which parse a JJ file and transform it to Java Source Files.
- * @author jruiz@exist.com
- * @author jesse <je...@gmail.com>
- * @version $Id$
- */
-public class JavaCCMojo
- extends AbstractMojo
-{
- /**
- * @parameter expression=1
- * @required
- */
- private int lookAhead;
-
- /**
- * @parameter expression=2
- * @required
- */
- private int choiceAmbiguityCheck;
-
- /**
- * @parameter expression=1
- * @required
- */
- private int otherAmbiguityCheck;
-
- /**
- * @parameter expression="true"
- * @required
- */
- private boolean isStatic;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean debugParser;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean debugLookAhead;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean debugTokenManager;
-
- /**
- * @parameter expression="true"
- * @required
- */
- private boolean optimizeTokenManager;
-
- /**
- * @parameter expression="true"
- * @required
- */
- private boolean errorReporting;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean javaUnicodeEscape;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean unicodeInput;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean ignoreCase;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean commonTokenAction;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean userTokenManager;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean userCharStream;
-
- /**
- * @parameter expression="true"
- * @required
- */
- private boolean buildParser;
-
- /**
- * @parameter expression="true"
- * @required
- */
- private boolean buildTokenManager;
-
- /**
- * @parameter expression="true"
- * @required
- */
- private boolean sanityCheck;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean forceLaCheck;
-
- /**
- * @parameter expression="false"
- * @required
- */
- private boolean cacheTokens;
-
- /**
- * @parameter expression="true"
- * @required
- */
- private boolean keepLineColumn;
-
- /**
- * Directory where the JJ file(s) are located.
- * @parameter expression="src/main/javacc"
- */
- private File sourceDirectory;
-
- /**
- * Path under source directory where the JJ file(s) are located.
- * @parameter expression=""
- */
- private String sourcePath;
-
- /**
- * Directory where the output Java Files will be located.
- * @parameter expression="${project.build.directory}/maven-javacc-plugin/src/main/java"
- */
- private File outputDirectory;
-
- /**
- * Path under output directory where the output Java Files will be located.
- * @parameter expression=""
- */
- private String outputPath;
-
- /**
- * the directory to store the processed .jj files
- *
- * @parameter expression="${project.build.directory}/maven-javacc-plugin/src/main/conf"
- */
- private File timestampDirectory;
-
- /**
- * The granularity in milliseconds of the last modification
- * date for testing whether a source needs recompilation
- *
- * @parameter expression="${lastModGranularityMs}" default-value="0"
- */
- private int staleMillis;
-
- /**
- * @parameter expression="${project}"
- * @required
- */
- private MavenProject project;
-
- /**
- * @parameter expression=false
- * @required
- */
- private boolean doNotGenerateTokenFile;
-
- public void execute()
- throws MojoExecutionException
- {
- File outDir = new File(outputDirectory, outputPath);
-
- if (!outDir.exists())
- {
- outDir.mkdirs();
- }
-
- if (!timestampDirectory.exists())
- {
- timestampDirectory.mkdirs();
- }
-
- Set staleGrammars = computeStaleGrammars();
-
- if (staleGrammars.isEmpty())
- {
- getLog().info("Nothing to process - all grammars are up to date");
- if (project != null)
- {
- project.addCompileSourceRoot(outDir.getPath());
- }
- return;
- }
-
- for (Iterator i = staleGrammars.iterator(); i.hasNext(); )
- {
- File javaccFile = (File) i.next();
- try
- {
- org.javacc.parser.Main.mainProgram(generateJavaCCArgumentList(javaccFile.getAbsolutePath()));
-
- FileUtils.copyFileToDirectory(javaccFile, timestampDirectory);
- if (doNotGenerateTokenFile == true) {
- File tokenFile = new File(outDir, "Token.java");
- FileUtils.forceDelete(tokenFile);
- }
- }
- catch (Exception e)
- {
- throw new MojoExecutionException("JavaCC execution failed", e);
- }
- }
-
- if (project != null)
- {
- project.addCompileSourceRoot(outputDirectory.getPath());
- }
- }
-
-
- private String[] generateJavaCCArgumentList(String javaccInput)
- {
-
- File outDir = new File(outputDirectory, outputPath);
-
- ArrayList argsList = new ArrayList();
-
- argsList.add("-LOOKAHEAD=" + lookAhead);
- argsList.add("-CHOICE_AMBIGUITY_CHECK=" + choiceAmbiguityCheck);
- argsList.add("-OTHER_AMBIGUITY_CHECK=" + otherAmbiguityCheck);
- argsList.add("-STATIC=" + isStatic);
- argsList.add("-DEBUG_PARSER=" + debugParser);
- argsList.add("-DEBUG_LOOKAHEAD=" + debugLookAhead);
- argsList.add("-DEBUG_TOKEN_MANAGER=" + debugTokenManager);
- argsList.add("-OPTIMIZE_TOKEN_MANAGER=" + optimizeTokenManager);
- argsList.add("-ERROR_REPORTING=" + errorReporting);
- argsList.add("-JAVA_UNICODE_ESCAPE=" + javaUnicodeEscape);
- argsList.add("-UNICODE_INPUT=" + unicodeInput);
- argsList.add("-IGNORE_CASE=" + ignoreCase);
- argsList.add("-COMMON_TOKEN_ACTION=" + commonTokenAction);
- argsList.add("-USER_TOKEN_MANAGER=" + userTokenManager);
- argsList.add("-USER_CHAR_STREAM=" + userCharStream);
- argsList.add("-BUILD_PARSER=" + buildParser);
- argsList.add("-BUILD_TOKEN_MANAGER=" + buildTokenManager);
- argsList.add("-SANITY_CHECK=" + sanityCheck);
- argsList.add("-FORCE_LA_CHECK=" + forceLaCheck);
- argsList.add("-CACHE_TOKENS=" + cacheTokens);
- argsList.add("-KEEP_LINE_COLUMN=" + keepLineColumn);
- argsList.add("-OUTPUT_DIRECTORY:" + outDir.getPath());
- argsList.add(javaccInput);
-
- getLog().debug("argslist: " + argsList.toString());
-
- return (String[]) argsList.toArray(new String[argsList.size()]);
- }
-
- private Set computeStaleGrammars()
- throws MojoExecutionException
- {
- SuffixMapping mapping = new SuffixMapping(".jj", ".jj");
- SuffixMapping mappingCAP = new SuffixMapping(".JJ", ".JJ");
-
- SourceInclusionScanner scanner = new StaleSourceScanner(staleMillis);
-
- scanner.addSourceMapping(mapping);
- scanner.addSourceMapping(mappingCAP);
-
- Set staleSources = new HashSet();
-
- File sourceDir = new File(sourceDirectory, sourcePath);
-
- try
- {
- staleSources.addAll(scanner.getIncludedSources(sourceDir,
- timestampDirectory));
- }
- catch (InclusionScanException e)
- {
- throw new MojoExecutionException("Error scanning source root: \'" +
- sourceDir +
- "\' for stale grammars to reprocess.",
- e);
- }
-
- return staleSources;
- }
-
-
-}
-
+package org.apache.myfaces.trinidadinternal.view.faces.maven.plugin.javacc;
+
+/*
+ * Copyright 2001-2005 The Codehaus.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
+import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
+import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+import org.codehaus.plexus.util.FileUtils;
+
+
+/**
+ * @goal generate
+ * @phase generate-sources
+ * @description Goal which parse a JJ file and transform it to Java Source Files.
+ * @author jruiz@exist.com
+ * @author jesse <je...@gmail.com>
+ * @version $Id$
+ */
+public class JavaCCMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter expression=1
+ * @required
+ */
+ private int lookAhead;
+
+ /**
+ * @parameter expression=2
+ * @required
+ */
+ private int choiceAmbiguityCheck;
+
+ /**
+ * @parameter expression=1
+ * @required
+ */
+ private int otherAmbiguityCheck;
+
+ /**
+ * @parameter expression="true"
+ * @required
+ */
+ private boolean isStatic;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean debugParser;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean debugLookAhead;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean debugTokenManager;
+
+ /**
+ * @parameter expression="true"
+ * @required
+ */
+ private boolean optimizeTokenManager;
+
+ /**
+ * @parameter expression="true"
+ * @required
+ */
+ private boolean errorReporting;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean javaUnicodeEscape;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean unicodeInput;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean ignoreCase;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean commonTokenAction;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean userTokenManager;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean userCharStream;
+
+ /**
+ * @parameter expression="true"
+ * @required
+ */
+ private boolean buildParser;
+
+ /**
+ * @parameter expression="true"
+ * @required
+ */
+ private boolean buildTokenManager;
+
+ /**
+ * @parameter expression="true"
+ * @required
+ */
+ private boolean sanityCheck;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean forceLaCheck;
+
+ /**
+ * @parameter expression="false"
+ * @required
+ */
+ private boolean cacheTokens;
+
+ /**
+ * @parameter expression="true"
+ * @required
+ */
+ private boolean keepLineColumn;
+
+ /**
+ * Directory where the JJ file(s) are located.
+ * @parameter expression="src/main/javacc"
+ */
+ private File sourceDirectory;
+
+ /**
+ * Path under source directory where the JJ file(s) are located.
+ * @parameter expression=""
+ */
+ private String sourcePath;
+
+ /**
+ * Directory where the output Java Files will be located.
+ * @parameter expression="${project.build.directory}/maven-javacc-plugin/src/main/java"
+ */
+ private File outputDirectory;
+
+ /**
+ * Path under output directory where the output Java Files will be located.
+ * @parameter expression=""
+ */
+ private String outputPath;
+
+ /**
+ * the directory to store the processed .jj files
+ *
+ * @parameter expression="${project.build.directory}/maven-javacc-plugin/src/main/conf"
+ */
+ private File timestampDirectory;
+
+ /**
+ * The granularity in milliseconds of the last modification
+ * date for testing whether a source needs recompilation
+ *
+ * @parameter expression="${lastModGranularityMs}" default-value="0"
+ */
+ private int staleMillis;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression=false
+ * @required
+ */
+ private boolean doNotGenerateTokenFile;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ File outDir = new File(outputDirectory, outputPath);
+
+ if (!outDir.exists())
+ {
+ outDir.mkdirs();
+ }
+
+ if (!timestampDirectory.exists())
+ {
+ timestampDirectory.mkdirs();
+ }
+
+ Set staleGrammars = computeStaleGrammars();
+
+ if (staleGrammars.isEmpty())
+ {
+ getLog().info("Nothing to process - all grammars are up to date");
+ if (project != null)
+ {
+ project.addCompileSourceRoot(outDir.getPath());
+ }
+ return;
+ }
+
+ for (Iterator i = staleGrammars.iterator(); i.hasNext(); )
+ {
+ File javaccFile = (File) i.next();
+ try
+ {
+ org.javacc.parser.Main.mainProgram(generateJavaCCArgumentList(javaccFile.getAbsolutePath()));
+
+ FileUtils.copyFileToDirectory(javaccFile, timestampDirectory);
+ if (doNotGenerateTokenFile == true) {
+ File tokenFile = new File(outDir, "Token.java");
+ FileUtils.forceDelete(tokenFile);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new MojoExecutionException("JavaCC execution failed", e);
+ }
+ }
+
+ if (project != null)
+ {
+ project.addCompileSourceRoot(outputDirectory.getPath());
+ }
+ }
+
+
+ private String[] generateJavaCCArgumentList(String javaccInput)
+ {
+
+ File outDir = new File(outputDirectory, outputPath);
+
+ ArrayList argsList = new ArrayList();
+
+ argsList.add("-LOOKAHEAD=" + lookAhead);
+ argsList.add("-CHOICE_AMBIGUITY_CHECK=" + choiceAmbiguityCheck);
+ argsList.add("-OTHER_AMBIGUITY_CHECK=" + otherAmbiguityCheck);
+ argsList.add("-STATIC=" + isStatic);
+ argsList.add("-DEBUG_PARSER=" + debugParser);
+ argsList.add("-DEBUG_LOOKAHEAD=" + debugLookAhead);
+ argsList.add("-DEBUG_TOKEN_MANAGER=" + debugTokenManager);
+ argsList.add("-OPTIMIZE_TOKEN_MANAGER=" + optimizeTokenManager);
+ argsList.add("-ERROR_REPORTING=" + errorReporting);
+ argsList.add("-JAVA_UNICODE_ESCAPE=" + javaUnicodeEscape);
+ argsList.add("-UNICODE_INPUT=" + unicodeInput);
+ argsList.add("-IGNORE_CASE=" + ignoreCase);
+ argsList.add("-COMMON_TOKEN_ACTION=" + commonTokenAction);
+ argsList.add("-USER_TOKEN_MANAGER=" + userTokenManager);
+ argsList.add("-USER_CHAR_STREAM=" + userCharStream);
+ argsList.add("-BUILD_PARSER=" + buildParser);
+ argsList.add("-BUILD_TOKEN_MANAGER=" + buildTokenManager);
+ argsList.add("-SANITY_CHECK=" + sanityCheck);
+ argsList.add("-FORCE_LA_CHECK=" + forceLaCheck);
+ argsList.add("-CACHE_TOKENS=" + cacheTokens);
+ argsList.add("-KEEP_LINE_COLUMN=" + keepLineColumn);
+ argsList.add("-OUTPUT_DIRECTORY:" + outDir.getPath());
+ argsList.add(javaccInput);
+
+ getLog().debug("argslist: " + argsList.toString());
+
+ return (String[]) argsList.toArray(new String[argsList.size()]);
+ }
+
+ private Set computeStaleGrammars()
+ throws MojoExecutionException
+ {
+ SuffixMapping mapping = new SuffixMapping(".jj", ".jj");
+ SuffixMapping mappingCAP = new SuffixMapping(".JJ", ".JJ");
+
+ SourceInclusionScanner scanner = new StaleSourceScanner(staleMillis);
+
+ scanner.addSourceMapping(mapping);
+ scanner.addSourceMapping(mappingCAP);
+
+ Set staleSources = new HashSet();
+
+ File sourceDir = new File(sourceDirectory, sourcePath);
+
+ try
+ {
+ staleSources.addAll(scanner.getIncludedSources(sourceDir,
+ timestampDirectory));
+ }
+ catch (InclusionScanException e)
+ {
+ throw new MojoExecutionException("Error scanning source root: \'" +
+ sourceDir +
+ "\' for stale grammars to reprocess.",
+ e);
+ }
+
+ return staleSources;
+ }
+
+
+}
+
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/main/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojoTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojoTest.java?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojoTest.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojoTest.java Mon Jul 24 17:24:16 2006
@@ -1,39 +1,39 @@
-package org.apache.myfaces.trinidadinternal.view.faces.maven.plugin.javacc;
-
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-import junit.framework.TestCase;
-
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.myfaces.trinidadinternal.view.faces.maven.plugin.javacc.JavaCCMojo;
-
-
-public class JavaCCMojoTest extends TestCase
-{
- public void testExecution() throws MojoExecutionException
- {
- JavaCCMojo mojo = new JavaCCMojo();
- //TODO: write a test here...
- }
-}
+package org.apache.myfaces.trinidadinternal.view.faces.maven.plugin.javacc;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import junit.framework.TestCase;
+
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.myfaces.trinidadinternal.view.faces.maven.plugin.javacc.JavaCCMojo;
+
+
+public class JavaCCMojoTest extends TestCase
+{
+ public void testExecution() throws MojoExecutionException
+ {
+ JavaCCMojo mojo = new JavaCCMojo();
+ //TODO: write a test here...
+ }
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/java/org/apache/myfaces/trinidadinternal/view/faces/maven/plugin/javacc/JavaCCMojoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/resources/SelectorParser.jj
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/resources/SelectorParser.jj?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/resources/SelectorParser.jj (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/resources/SelectorParser.jj Mon Jul 24 17:24:16 2006
@@ -1,573 +1,573 @@
-/**
- * <a href="http://activemq.org">ActiveMQ: The Open Source Message Fabric</a>
- *
- * Copyright 2004 Hiram Chirino
- * Copyright 2004 Protique Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- **/
-
-// ----------------------------------------------------------------------------
-// OPTIONS
-// ----------------------------------------------------------------------------
-options {
- STATIC = true;
- UNICODE_INPUT = false;
-
- //some performance optimizations
- OPTIMIZE_TOKEN_MANAGER = false;
- ERROR_REPORTING = true;
-}
-
-// ----------------------------------------------------------------------------
-// PARSER
-// ----------------------------------------------------------------------------
-
-PARSER_BEGIN(SelectorParser)
-
-package org.activemq.selector;
-
-import java.io.*;
-import java.util.*;
-
-import javax.jms.InvalidSelectorException;
-
-import org.activemq.filter.*;
-
-/**
- * JMS Selector Parser generated by JavaCC
- *
- * Do not edit this .java file directly - it is autogenerated from SelectorParser.jj
- */
-public class SelectorParser {
-
- public SelectorParser() {
- this(new StringReader(""));
- }
-
- public BooleanExpression parse(String sql) throws InvalidSelectorException {
- this.ReInit(new StringReader(sql));
-
- try {
- return this.JmsSelector();
- }
- catch (Throwable e) {
- throw (InvalidSelectorException)new InvalidSelectorException("test").initCause(e);
- }
-
- }
-
- private BooleanExpression asBooleanExpression(Expression value) throws ParseException {
- if (value instanceof BooleanExpression) {
- return (BooleanExpression) value;
- }
- if (value instanceof PropertyExpression) {
- return UnaryExpression.createBooleanCast( value );
- }
- throw new ParseException("Expression will not result in a boolean value: " + value);
- }
-
-
-}
-
-PARSER_END(SelectorParser)
-
-// ----------------------------------------------------------------------------
-// Tokens
-// ----------------------------------------------------------------------------
-
-/* White Space */
-SPECIAL_TOKEN :
-{
- " " | "\t" | "\n" | "\r" | "\f"
-}
-
-/* Comments */
-SKIP:
-{
- <LINE_COMMENT: "--" (~["\n","\r"])* ("\n"|"\r"|"\r\n") >
-}
-
-SKIP:
-{
- <BLOCK_COMMENT: "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
-}
-
-/* Reserved Words */
-TOKEN [IGNORE_CASE] :
-{
- < NOT : "NOT">
- | < AND : "AND">
- | < OR : "OR">
- | < BETWEEN : "BETWEEN">
- | < LIKE : "LIKE">
- | < ESCAPE : "ESCAPE">
- | < IN : "IN">
- | < IS : "IS">
- | < TRUE : "TRUE" >
- | < FALSE : "FALSE" >
- | < NULL : "NULL" >
- | < XPATH : "XPATH" >
- | < XQUERY : "XQUERY" >
-}
-
-/* Literals */
-TOKEN [IGNORE_CASE] :
-{
-
- < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* (["l","L"])? >
- | < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
- | < OCTAL_LITERAL: "0" (["0"-"7"])* >
- | < FLOATING_POINT_LITERAL:
- (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? // matches: 5.5 or 5. or 5.5E10 or 5.E10
- | "." (["0"-"9"])+ (<EXPONENT>)? // matches: .5 or .5E10
- | (["0"-"9"])+ <EXPONENT> // matches: 5E10
- >
- | < #EXPONENT: "E" (["+","-"])? (["0"-"9"])+ >
- | < STRING_LITERAL: "'" ( ("''") | ~["'"] )* "'" >
-}
-
-TOKEN [IGNORE_CASE] :
-{
- < ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* >
-}
-
-// ----------------------------------------------------------------------------
-// Grammer
-// ----------------------------------------------------------------------------
-BooleanExpression JmsSelector() :
-{
- Expression left=null;
-}
-{
- (
- left = orExpression()
- )
- {
- return asBooleanExpression(left);
- }
-
-}
-
-Expression orExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- (
- left = andExpression()
- (
- <OR> right = andExpression()
- {
- left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
- }
- )*
- )
- {
- return left;
- }
-
-}
-
-
-Expression andExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- (
- left = equalityExpression()
- (
- <AND> right = equalityExpression()
- {
- left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
- }
- )*
- )
- {
- return left;
- }
-}
-
-Expression equalityExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- (
- left = comparisonExpression()
- (
-
- "=" right = comparisonExpression()
- {
- left = ComparisonExpression.createEqual(left, right);
- }
- |
- "<>" right = comparisonExpression()
- {
- left = ComparisonExpression.createNotEqual(left, right);
- }
- |
- LOOKAHEAD(2)
- <IS> <NULL>
- {
- left = ComparisonExpression.createIsNull(left);
- }
- |
- <IS> <NOT> <NULL>
- {
- left = ComparisonExpression.createIsNotNull(left);
- }
- )*
- )
- {
- return left;
- }
-}
-
-Expression comparisonExpression() :
-{
- Expression left;
- Expression right;
- Expression low;
- Expression high;
- String t, u;
- boolean not;
- ArrayList list;
-}
-{
- (
- left = addExpression()
- (
-
- ">" right = addExpression()
- {
- left = ComparisonExpression.createGreaterThan(left, right);
- }
- |
- ">=" right = addExpression()
- {
- left = ComparisonExpression.createGreaterThanEqual(left, right);
- }
- |
- "<" right = addExpression()
- {
- left = ComparisonExpression.createLessThan(left, right);
- }
- |
- "<=" right = addExpression()
- {
- left = ComparisonExpression.createLessThanEqual(left, right);
- }
- |
- {
- u=null;
- }
- <LIKE> t = stringLitteral()
- [ <ESCAPE> u = stringLitteral() ]
- {
- left = ComparisonExpression.createLike(left, t, u);
- }
- |
- LOOKAHEAD(2)
- {
- u=null;
- }
- <NOT> <LIKE> t = stringLitteral() [ <ESCAPE> u = stringLitteral() ]
- {
- left = ComparisonExpression.createNotLike(left, t, u);
- }
- |
- <BETWEEN> low = addExpression() <AND> high = addExpression()
- {
- left = ComparisonExpression.createBetween(left, low, high);
- }
- |
- LOOKAHEAD(2)
- <NOT> <BETWEEN> low = addExpression() <AND> high = addExpression()
- {
- left = ComparisonExpression.createNotBetween(left, low, high);
- }
- |
- <IN>
- "("
- t = stringLitteral()
- {
- list = new ArrayList();
- list.add( t );
- }
- (
- ","
- t = stringLitteral()
- {
- list.add( t );
- }
-
- )*
- ")"
- {
- left = ComparisonExpression.createInFilter(left, list);
- }
- |
- LOOKAHEAD(2)
- <NOT> <IN>
- "("
- t = stringLitteral()
- {
- list = new ArrayList();
- list.add( t );
- }
- (
- ","
- t = stringLitteral()
- {
- list.add( t );
- }
-
- )*
- ")"
- {
- left = ComparisonExpression.createNotInFilter(left, list);
- }
-
- )*
- )
- {
- return left;
- }
-}
-
-Expression addExpression() :
-{
- Expression left;
- Expression right;
-}
-{
- left = multExpr()
- (
- LOOKAHEAD( ("+"|"-") multExpr())
- (
- "+" right = multExpr()
- {
- left = ArithmeticExpression.createPlus(left, right);
- }
- |
- "-" right = multExpr()
- {
- left = ArithmeticExpression.createMinus(left, right);
- }
- )
-
- )*
- {
- return left;
- }
-}
-
-Expression multExpr() :
-{
- Expression left;
- Expression right;
-}
-{
- left = unaryExpr()
- (
- "*" right = unaryExpr()
- {
- left = ArithmeticExpression.createMultiply(left, right);
- }
- |
- "/" right = unaryExpr()
- {
- left = ArithmeticExpression.createDivide(left, right);
- }
- |
- "%" right = unaryExpr()
- {
- left = ArithmeticExpression.createMod(left, right);
- }
-
- )*
- {
- return left;
- }
-}
-
-
-Expression unaryExpr() :
-{
- String s=null;
- Expression left=null;
-}
-{
- (
- LOOKAHEAD( "+" unaryExpr() )
- "+" left=unaryExpr()
- |
- "-" left=unaryExpr()
- {
- left = UnaryExpression.createNegate(left);
- }
- |
- <NOT> left=unaryExpr()
- {
- left = UnaryExpression.createNOT( asBooleanExpression(left) );
- }
- |
- <XPATH> s=stringLitteral()
- {
- left = UnaryExpression.createXPath( s );
- }
- |
- <XQUERY> s=stringLitteral()
- {
- left = UnaryExpression.createXQuery( s );
- }
- |
- left = primaryExpr()
- )
- {
- return left;
- }
-
-}
-
-Expression primaryExpr() :
-{
- Expression left=null;
-}
-{
- (
- left = literal()
- |
- left = variable()
- |
- "(" left = orExpression() ")"
- )
- {
- return left;
- }
-}
-
-
-
-ConstantExpression literal() :
-{
- Token t;
- String s;
- ConstantExpression left=null;
-}
-{
- (
- (
- s = stringLitteral()
- {
- left = new ConstantExpression(s);
- }
- )
- |
- (
- t = <DECIMAL_LITERAL>
- {
- left = ConstantExpression.createFromDecimal(t.image);
- }
- )
- |
- (
- t = <HEX_LITERAL>
- {
- left = ConstantExpression.createFromHex(t.image);
- }
- )
- |
- (
- t = <OCTAL_LITERAL>
- {
- left = ConstantExpression.createFromOctal(t.image);
- }
- )
- |
- (
- t = <FLOATING_POINT_LITERAL>
- {
- left = ConstantExpression.createFloat(t.image);
- }
- )
- |
- (
- <TRUE>
- {
- left = ConstantExpression.TRUE;
- }
- )
- |
- (
- <FALSE>
- {
- left = ConstantExpression.FALSE;
- }
- )
- |
- (
- <NULL>
- {
- left = ConstantExpression.NULL;
- }
- )
- )
- {
- return left;
- }
-}
-
-String stringLitteral() :
-{
- Token t;
- StringBuffer rc = new StringBuffer();
- boolean first=true;
-}
-{
- t = <STRING_LITERAL>
- {
- // Decode the sting value.
- String image = t.image;
- for( int i=1; i < image.length()-1; i++ ) {
- char c = image.charAt(i);
- if( c == '\'' )
- i++;
- rc.append(c);
- }
- return rc.toString();
- }
-}
-
-PropertyExpression variable() :
-{
- Token t;
- PropertyExpression left=null;
-}
-{
- (
- t = <ID>
- {
- left = new PropertyExpression(t.image);
- }
- )
- {
- return left;
- }
+/**
+ * <a href="http://activemq.org">ActiveMQ: The Open Source Message Fabric</a>
+ *
+ * Copyright 2004 Hiram Chirino
+ * Copyright 2004 Protique Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ **/
+
+// ----------------------------------------------------------------------------
+// OPTIONS
+// ----------------------------------------------------------------------------
+options {
+ STATIC = true;
+ UNICODE_INPUT = false;
+
+ //some performance optimizations
+ OPTIMIZE_TOKEN_MANAGER = false;
+ ERROR_REPORTING = true;
+}
+
+// ----------------------------------------------------------------------------
+// PARSER
+// ----------------------------------------------------------------------------
+
+PARSER_BEGIN(SelectorParser)
+
+package org.activemq.selector;
+
+import java.io.*;
+import java.util.*;
+
+import javax.jms.InvalidSelectorException;
+
+import org.activemq.filter.*;
+
+/**
+ * JMS Selector Parser generated by JavaCC
+ *
+ * Do not edit this .java file directly - it is autogenerated from SelectorParser.jj
+ */
+public class SelectorParser {
+
+ public SelectorParser() {
+ this(new StringReader(""));
+ }
+
+ public BooleanExpression parse(String sql) throws InvalidSelectorException {
+ this.ReInit(new StringReader(sql));
+
+ try {
+ return this.JmsSelector();
+ }
+ catch (Throwable e) {
+ throw (InvalidSelectorException)new InvalidSelectorException("test").initCause(e);
+ }
+
+ }
+
+ private BooleanExpression asBooleanExpression(Expression value) throws ParseException {
+ if (value instanceof BooleanExpression) {
+ return (BooleanExpression) value;
+ }
+ if (value instanceof PropertyExpression) {
+ return UnaryExpression.createBooleanCast( value );
+ }
+ throw new ParseException("Expression will not result in a boolean value: " + value);
+ }
+
+
+}
+
+PARSER_END(SelectorParser)
+
+// ----------------------------------------------------------------------------
+// Tokens
+// ----------------------------------------------------------------------------
+
+/* White Space */
+SPECIAL_TOKEN :
+{
+ " " | "\t" | "\n" | "\r" | "\f"
+}
+
+/* Comments */
+SKIP:
+{
+ <LINE_COMMENT: "--" (~["\n","\r"])* ("\n"|"\r"|"\r\n") >
+}
+
+SKIP:
+{
+ <BLOCK_COMMENT: "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
+}
+
+/* Reserved Words */
+TOKEN [IGNORE_CASE] :
+{
+ < NOT : "NOT">
+ | < AND : "AND">
+ | < OR : "OR">
+ | < BETWEEN : "BETWEEN">
+ | < LIKE : "LIKE">
+ | < ESCAPE : "ESCAPE">
+ | < IN : "IN">
+ | < IS : "IS">
+ | < TRUE : "TRUE" >
+ | < FALSE : "FALSE" >
+ | < NULL : "NULL" >
+ | < XPATH : "XPATH" >
+ | < XQUERY : "XQUERY" >
+}
+
+/* Literals */
+TOKEN [IGNORE_CASE] :
+{
+
+ < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* (["l","L"])? >
+ | < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+ | < OCTAL_LITERAL: "0" (["0"-"7"])* >
+ | < FLOATING_POINT_LITERAL:
+ (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? // matches: 5.5 or 5. or 5.5E10 or 5.E10
+ | "." (["0"-"9"])+ (<EXPONENT>)? // matches: .5 or .5E10
+ | (["0"-"9"])+ <EXPONENT> // matches: 5E10
+ >
+ | < #EXPONENT: "E" (["+","-"])? (["0"-"9"])+ >
+ | < STRING_LITERAL: "'" ( ("''") | ~["'"] )* "'" >
+}
+
+TOKEN [IGNORE_CASE] :
+{
+ < ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* >
+}
+
+// ----------------------------------------------------------------------------
+// Grammer
+// ----------------------------------------------------------------------------
+BooleanExpression JmsSelector() :
+{
+ Expression left=null;
+}
+{
+ (
+ left = orExpression()
+ )
+ {
+ return asBooleanExpression(left);
+ }
+
+}
+
+Expression orExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = andExpression()
+ (
+ <OR> right = andExpression()
+ {
+ left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
+ }
+ )*
+ )
+ {
+ return left;
+ }
+
+}
+
+
+Expression andExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = equalityExpression()
+ (
+ <AND> right = equalityExpression()
+ {
+ left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
+ }
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression equalityExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = comparisonExpression()
+ (
+
+ "=" right = comparisonExpression()
+ {
+ left = ComparisonExpression.createEqual(left, right);
+ }
+ |
+ "<>" right = comparisonExpression()
+ {
+ left = ComparisonExpression.createNotEqual(left, right);
+ }
+ |
+ LOOKAHEAD(2)
+ <IS> <NULL>
+ {
+ left = ComparisonExpression.createIsNull(left);
+ }
+ |
+ <IS> <NOT> <NULL>
+ {
+ left = ComparisonExpression.createIsNotNull(left);
+ }
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression comparisonExpression() :
+{
+ Expression left;
+ Expression right;
+ Expression low;
+ Expression high;
+ String t, u;
+ boolean not;
+ ArrayList list;
+}
+{
+ (
+ left = addExpression()
+ (
+
+ ">" right = addExpression()
+ {
+ left = ComparisonExpression.createGreaterThan(left, right);
+ }
+ |
+ ">=" right = addExpression()
+ {
+ left = ComparisonExpression.createGreaterThanEqual(left, right);
+ }
+ |
+ "<" right = addExpression()
+ {
+ left = ComparisonExpression.createLessThan(left, right);
+ }
+ |
+ "<=" right = addExpression()
+ {
+ left = ComparisonExpression.createLessThanEqual(left, right);
+ }
+ |
+ {
+ u=null;
+ }
+ <LIKE> t = stringLitteral()
+ [ <ESCAPE> u = stringLitteral() ]
+ {
+ left = ComparisonExpression.createLike(left, t, u);
+ }
+ |
+ LOOKAHEAD(2)
+ {
+ u=null;
+ }
+ <NOT> <LIKE> t = stringLitteral() [ <ESCAPE> u = stringLitteral() ]
+ {
+ left = ComparisonExpression.createNotLike(left, t, u);
+ }
+ |
+ <BETWEEN> low = addExpression() <AND> high = addExpression()
+ {
+ left = ComparisonExpression.createBetween(left, low, high);
+ }
+ |
+ LOOKAHEAD(2)
+ <NOT> <BETWEEN> low = addExpression() <AND> high = addExpression()
+ {
+ left = ComparisonExpression.createNotBetween(left, low, high);
+ }
+ |
+ <IN>
+ "("
+ t = stringLitteral()
+ {
+ list = new ArrayList();
+ list.add( t );
+ }
+ (
+ ","
+ t = stringLitteral()
+ {
+ list.add( t );
+ }
+
+ )*
+ ")"
+ {
+ left = ComparisonExpression.createInFilter(left, list);
+ }
+ |
+ LOOKAHEAD(2)
+ <NOT> <IN>
+ "("
+ t = stringLitteral()
+ {
+ list = new ArrayList();
+ list.add( t );
+ }
+ (
+ ","
+ t = stringLitteral()
+ {
+ list.add( t );
+ }
+
+ )*
+ ")"
+ {
+ left = ComparisonExpression.createNotInFilter(left, list);
+ }
+
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression addExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ left = multExpr()
+ (
+ LOOKAHEAD( ("+"|"-") multExpr())
+ (
+ "+" right = multExpr()
+ {
+ left = ArithmeticExpression.createPlus(left, right);
+ }
+ |
+ "-" right = multExpr()
+ {
+ left = ArithmeticExpression.createMinus(left, right);
+ }
+ )
+
+ )*
+ {
+ return left;
+ }
+}
+
+Expression multExpr() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ left = unaryExpr()
+ (
+ "*" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createMultiply(left, right);
+ }
+ |
+ "/" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createDivide(left, right);
+ }
+ |
+ "%" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createMod(left, right);
+ }
+
+ )*
+ {
+ return left;
+ }
+}
+
+
+Expression unaryExpr() :
+{
+ String s=null;
+ Expression left=null;
+}
+{
+ (
+ LOOKAHEAD( "+" unaryExpr() )
+ "+" left=unaryExpr()
+ |
+ "-" left=unaryExpr()
+ {
+ left = UnaryExpression.createNegate(left);
+ }
+ |
+ <NOT> left=unaryExpr()
+ {
+ left = UnaryExpression.createNOT( asBooleanExpression(left) );
+ }
+ |
+ <XPATH> s=stringLitteral()
+ {
+ left = UnaryExpression.createXPath( s );
+ }
+ |
+ <XQUERY> s=stringLitteral()
+ {
+ left = UnaryExpression.createXQuery( s );
+ }
+ |
+ left = primaryExpr()
+ )
+ {
+ return left;
+ }
+
+}
+
+Expression primaryExpr() :
+{
+ Expression left=null;
+}
+{
+ (
+ left = literal()
+ |
+ left = variable()
+ |
+ "(" left = orExpression() ")"
+ )
+ {
+ return left;
+ }
+}
+
+
+
+ConstantExpression literal() :
+{
+ Token t;
+ String s;
+ ConstantExpression left=null;
+}
+{
+ (
+ (
+ s = stringLitteral()
+ {
+ left = new ConstantExpression(s);
+ }
+ )
+ |
+ (
+ t = <DECIMAL_LITERAL>
+ {
+ left = ConstantExpression.createFromDecimal(t.image);
+ }
+ )
+ |
+ (
+ t = <HEX_LITERAL>
+ {
+ left = ConstantExpression.createFromHex(t.image);
+ }
+ )
+ |
+ (
+ t = <OCTAL_LITERAL>
+ {
+ left = ConstantExpression.createFromOctal(t.image);
+ }
+ )
+ |
+ (
+ t = <FLOATING_POINT_LITERAL>
+ {
+ left = ConstantExpression.createFloat(t.image);
+ }
+ )
+ |
+ (
+ <TRUE>
+ {
+ left = ConstantExpression.TRUE;
+ }
+ )
+ |
+ (
+ <FALSE>
+ {
+ left = ConstantExpression.FALSE;
+ }
+ )
+ |
+ (
+ <NULL>
+ {
+ left = ConstantExpression.NULL;
+ }
+ )
+ )
+ {
+ return left;
+ }
+}
+
+String stringLitteral() :
+{
+ Token t;
+ StringBuffer rc = new StringBuffer();
+ boolean first=true;
+}
+{
+ t = <STRING_LITERAL>
+ {
+ // Decode the sting value.
+ String image = t.image;
+ for( int i=1; i < image.length()-1; i++ ) {
+ char c = image.charAt(i);
+ if( c == '\'' )
+ i++;
+ rc.append(c);
+ }
+ return rc.toString();
+ }
+}
+
+PropertyExpression variable() :
+{
+ Token t;
+ PropertyExpression left=null;
+}
+{
+ (
+ t = <ID>
+ {
+ left = new PropertyExpression(t.image);
+ }
+ )
+ {
+ return left;
+ }
}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javacc-plugin/src/test/resources/SelectorParser.jj
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/pom.xml?rev=425235&r1=425234&r2=425235&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/pom.xml (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/pom.xml Mon Jul 24 17:24:16 2006
@@ -1,67 +1,67 @@
-<project>
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <artifactId>maven-plugin-parent</artifactId>
- <version>incubator-alpha-1-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <artifactId>maven-javascript-plugin</artifactId>
- <version>incubator-alpha-2-SNAPSHOT</version>
- <packaging>maven-plugin</packaging>
- <name>Maven Javascript Plugin</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.myfaces.trinidadbuild</groupId>
- <artifactId>maven-javacc-plugin</artifactId>
- <version>incubator-alpha-5-SNAPSHOT</version>
- <configuration>
- <sourceDirectory>src/main/java</sourceDirectory>
- <sourcePath>org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser</sourcePath>
- <outputPath>org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser</outputPath>
- <isStatic>false</isStatic>
- <doNotGenerateTokenFile>true</doNotGenerateTokenFile>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
-
-</project>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-plugin-parent</artifactId>
+ <version>incubator-alpha-1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-javascript-plugin</artifactId>
+ <version>incubator-alpha-2-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+ <name>Maven Javascript Plugin</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.myfaces.trinidadbuild</groupId>
+ <artifactId>maven-javacc-plugin</artifactId>
+ <version>incubator-alpha-5-SNAPSHOT</version>
+ <configuration>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <sourcePath>org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser</sourcePath>
+ <outputPath>org/apache/myfaces/trinidadbuild/plugin/javascript/obfuscator/javascript15parser</outputPath>
+ <isStatic>false</isStatic>
+ <doNotGenerateTokenFile>true</doNotGenerateTokenFile>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/plugins/maven-javascript-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native