You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by cb...@apache.org on 2019/06/17 12:10:12 UTC
svn commit: r1861505 - in /velocity/engine/branches/parser_experiments: ./
velocity-custom-parser-example/
velocity-custom-parser-example/src/test/java/org/apache/velocity/runtime/parser/
velocity-engine-core/ velocity-engine-core/src/main/parser/
Author: cbrisson
Date: Mon Jun 17 12:10:12 2019
New Revision: 1861505
URL: http://svn.apache.org/viewvc?rev=1861505&view=rev
Log:
[engine][VELOCITY-917] Functional parser.package property
Modified:
velocity/engine/branches/parser_experiments/pom.xml
velocity/engine/branches/parser_experiments/velocity-custom-parser-example/pom.xml
velocity/engine/branches/parser_experiments/velocity-custom-parser-example/src/test/java/org/apache/velocity/runtime/parser/CustomParserTestCase.java
velocity/engine/branches/parser_experiments/velocity-engine-core/pom.xml
velocity/engine/branches/parser_experiments/velocity-engine-core/src/main/parser/Parser.jjt
Modified: velocity/engine/branches/parser_experiments/pom.xml
URL: http://svn.apache.org/viewvc/velocity/engine/branches/parser_experiments/pom.xml?rev=1861505&r1=1861504&r2=1861505&view=diff
==============================================================================
--- velocity/engine/branches/parser_experiments/pom.xml (original)
+++ velocity/engine/branches/parser_experiments/pom.xml Mon Jun 17 12:10:12 2019
@@ -96,6 +96,11 @@
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
+ <plugin>
+ <groupId>com.google.code.maven-replacer-plugin</groupId>
+ <artifactId>replacer</artifactId>
+ <version>1.5.3</version>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
Modified: velocity/engine/branches/parser_experiments/velocity-custom-parser-example/pom.xml
URL: http://svn.apache.org/viewvc/velocity/engine/branches/parser_experiments/velocity-custom-parser-example/pom.xml?rev=1861505&r1=1861504&r2=1861505&view=diff
==============================================================================
--- velocity/engine/branches/parser_experiments/velocity-custom-parser-example/pom.xml (original)
+++ velocity/engine/branches/parser_experiments/velocity-custom-parser-example/pom.xml Mon Jun 17 12:10:12 2019
@@ -53,6 +53,8 @@
<parser.debug>false</parser.debug>
<!-- parser basename -->
<parser.basename>Custom</parser.basename>
+ <!-- parser package -->
+ <parser.package>org.apache.velocity.runtime.parser.custom</parser.package>
<!-- character to substitute to '*' -->
<parser.char.asterisk>*</parser.char.asterisk>
<!-- character to substitute to '@' -->
@@ -191,21 +193,21 @@
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
- <directory>${project.build.directory}/generated-sources/javacc/org/apache/velocity/runtime/parser</directory>
+ <directory>${project.build.directory}/generated-sources/javacc/</directory>
<includes>
- <include>*.java</include>
+ <include>**/*.java</include>
</includes>
<excludes>
- <exclude>*${parser.basename}*.java</exclude>
+ <exclude>**/*${parser.basename}*.java</exclude>
</excludes>
</fileset>
<fileset>
- <directory>${project.build.directory}/generated-sources/jjtree/org/apache/velocity/runtime/parser/node</directory>
+ <directory>${project.build.directory}/generated-sources/jjtree/</directory>
<includes>
- <include>*.java</include>
+ <include>**/node/*.java</include>
</includes>
<excludes>
- <exclude>*${parser.basename}*.java</exclude>
+ <exclude>**/node/*${parser.basename}*.java</exclude>
</excludes>
</fileset>
</filesets>
Modified: velocity/engine/branches/parser_experiments/velocity-custom-parser-example/src/test/java/org/apache/velocity/runtime/parser/CustomParserTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/parser_experiments/velocity-custom-parser-example/src/test/java/org/apache/velocity/runtime/parser/CustomParserTestCase.java?rev=1861505&r1=1861504&r2=1861505&view=diff
==============================================================================
--- velocity/engine/branches/parser_experiments/velocity-custom-parser-example/src/test/java/org/apache/velocity/runtime/parser/CustomParserTestCase.java (original)
+++ velocity/engine/branches/parser_experiments/velocity-custom-parser-example/src/test/java/org/apache/velocity/runtime/parser/CustomParserTestCase.java Mon Jun 17 12:10:12 2019
@@ -27,7 +27,7 @@ public class CustomParserTestCase
engine = new VelocityEngine();
engine.setProperty("resource.loaders", "file");
engine.setProperty("resource.loader.file.path", TEMPLATES_DIR);
- engine.setProperty("parser.class", "org.apache.velocity.runtime.parser.CustomParser");
+ engine.setProperty("parser.class", "org.apache.velocity.runtime.parser.custom.CustomParser");
engine.init();
}
Modified: velocity/engine/branches/parser_experiments/velocity-engine-core/pom.xml
URL: http://svn.apache.org/viewvc/velocity/engine/branches/parser_experiments/velocity-engine-core/pom.xml?rev=1861505&r1=1861504&r2=1861505&view=diff
==============================================================================
--- velocity/engine/branches/parser_experiments/velocity-engine-core/pom.xml (original)
+++ velocity/engine/branches/parser_experiments/velocity-engine-core/pom.xml Mon Jun 17 12:10:12 2019
@@ -35,6 +35,7 @@
Instead, you should customize the velocity-custom-parser-example module to fit your own needs.
-->
<parser.debug>false</parser.debug>
+ <parser.package>org.apache.velocity.runtime.parser</parser.package>
<parser.basename>Standard</parser.basename>
<parser.char.asterisk>*</parser.char.asterisk>
<parser.char.at>@</parser.char.at>
@@ -67,13 +68,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
- <version>3.1.0</version>
- <configuration>
- <useDefaultDelimiters>false</useDefaultDelimiters>
- <delimiters>
- <delimiter>${*}</delimiter>
- </delimiters>
- </configuration>
<executions>
<!-- prepare parser grammar file -->
<execution>
@@ -83,6 +77,11 @@
<goal>copy-resources</goal>
</goals>
<configuration>
+ <useDefaultDelimiters>false</useDefaultDelimiters>
+
+ <delimiters>
+ <delimiter>${*}</delimiter>
+ </delimiters>
<resources>
<resource>
<directory>src/main/parser</directory>
@@ -178,6 +177,30 @@
</configuration>
</execution>
</executions>
+ </plugin>
+
+ <!-- post-processing of parser genereted source files -->
+ <plugin>
+ <groupId>com.google.code.maven-replacer-plugin</groupId>
+ <artifactId>replacer</artifactId>
+ <executions>
+ <execution>
+ <id>patch-parser-files</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ <configuration>
+ <file>${project.build.directory}/generated-sources/javacc/org/apache/velocity/runtime/parser/TokenMgrError.java</file>
+ <replacements>
+ <replacement>
+ <token>static final int</token>
+ <value>public static final int</value>
+ </replacement>
+ </replacements>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<!-- handle OSGi information -->
Modified: velocity/engine/branches/parser_experiments/velocity-engine-core/src/main/parser/Parser.jjt
URL: http://svn.apache.org/viewvc/velocity/engine/branches/parser_experiments/velocity-engine-core/src/main/parser/Parser.jjt?rev=1861505&r1=1861504&r2=1861505&view=diff
==============================================================================
--- velocity/engine/branches/parser_experiments/velocity-engine-core/src/main/parser/Parser.jjt (original)
+++ velocity/engine/branches/parser_experiments/velocity-engine-core/src/main/parser/Parser.jjt Mon Jun 17 12:10:12 2019
@@ -79,13 +79,14 @@ options
}
PARSER_BEGIN(${parser.basename}Parser)
-package org.apache.velocity.runtime.parser;
+package ${parser.package};
import java.io.*;
import java.util.*;
import org.apache.velocity.Template;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.parser.*;
import org.apache.velocity.runtime.parser.node.*;
import org.apache.velocity.runtime.directive.*;
import org.apache.velocity.runtime.directive.MacroParseException;
@@ -108,7 +109,7 @@ import org.slf4j.Logger;
* @author <a href="hps@intermeta.de">Henning P. Schmiedehausen</a>
* @version $Id$
*/
-public class ${parser.basename}Parser implements org.apache.velocity.runtime.parser.Parser
+public class ${parser.basename}Parser implements Parser
{
/**
* Parser debugging flag.