forked from phoedos/pmd
[velocity] Rename package and language id from vm to velocity
Also change prefix from Vm to Vtl
This commit is contained in:
parent
d21e5c95d0
commit
1aa6112aae
@ -502,7 +502,7 @@ entries:
|
|||||||
url: /pmd_languages_visualforce.html
|
url: /pmd_languages_visualforce.html
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
- title: Velocity Template Language (VTL)
|
- title: Velocity Template Language (VTL)
|
||||||
url: /pmd_languages_vm.html
|
url: /pmd_languages_velocity.html
|
||||||
output: web, pdf
|
output: web, pdf
|
||||||
- title: XML and XML dialects
|
- title: XML and XML dialects
|
||||||
url: /pmd_languages_xml.html
|
url: /pmd_languages_xml.html
|
||||||
|
@ -104,7 +104,7 @@ class JDocNamespaceDeclaration < Liquid::Tag
|
|||||||
'javascript', 'jsp', 'julia',
|
'javascript', 'jsp', 'julia',
|
||||||
'kotlin', 'lang-test', 'lua', 'matlab', 'objectivec', 'perl', 'php', 'plsql', 'python', 'ruby', 'scala', 'swift',
|
'kotlin', 'lang-test', 'lua', 'matlab', 'objectivec', 'perl', 'php', 'plsql', 'python', 'ruby', 'scala', 'swift',
|
||||||
'test', 'test-schema', 'tsql', 'ui',
|
'test', 'test-schema', 'tsql', 'ui',
|
||||||
'modelica', 'visualforce', 'vm', 'xml'].flat_map {|m| [m, "pmd-" + m]}
|
'modelica', 'visualforce', 'velocity', 'xml'].flat_map {|m| [m, "pmd-" + m]}
|
||||||
|
|
||||||
def self.make_base_namespaces
|
def self.make_base_namespaces
|
||||||
res = {}
|
res = {}
|
||||||
|
18
docs/pages/pmd/languages/velocity.md
Normal file
18
docs/pages/pmd/languages/velocity.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
title: Velocity Template Language (VTL) support
|
||||||
|
permalink: pmd_languages_velocity.html
|
||||||
|
last_updated: February 2024 (7.0.0)
|
||||||
|
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
|
||||||
|
summary: "VTL-specific features and guidance"
|
||||||
|
---
|
||||||
|
|
||||||
|
> [Velocity](https://velocity.apache.org/engine/devel/vtl-reference.html) is a Java-based template engine.
|
||||||
|
> It permits web page designers to reference methods defined in Java code.
|
||||||
|
|
||||||
|
{% include language_info.html name='Velocity Template Language (VTL)' id='velocity' implementation='velocity::lang.velocity.VmLanguageModule' supports_pmd=true supports_cpd=true since='5.1.0' %}
|
||||||
|
|
||||||
|
{% capture id_change_note %}
|
||||||
|
The language id of the Velocity module was in PMD 6 just "vm". In PMD 7, this has been changed to "velocity". Also the
|
||||||
|
package name of the classes has been changed from vm to "velocity".
|
||||||
|
{% endcapture %}
|
||||||
|
{% include note.html content=id_change_note %}
|
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
title: Velocity Template Language (VTL) support
|
|
||||||
permalink: pmd_languages_vm.html
|
|
||||||
last_updated: September 2023 (7.0.0)
|
|
||||||
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
|
|
||||||
summary: "VTL-specific features and guidance"
|
|
||||||
---
|
|
||||||
|
|
||||||
> [Velocity](https://velocity.apache.org/engine/devel/vtl-reference.html) is a Java-based template engine.
|
|
||||||
> It permits web page designers to reference methods defined in Java code.
|
|
||||||
|
|
||||||
{% include language_info.html name='Velocity Template Language (VTL)' id='vm' implementation='vm::lang.vm.VmLanguageModule' supports_pmd=true supports_cpd=true since='5.1.0' %}
|
|
@ -75,6 +75,7 @@ You might encounter additionally the following types of problems:
|
|||||||
* Some CLI options have been removed, because they have been deprecated. See [CLI Changes](#cli-changes) for details.
|
* Some CLI options have been removed, because they have been deprecated. See [CLI Changes](#cli-changes) for details.
|
||||||
* If you call CPD programmatically, the API has changed, see [New Programmatic API for CPD](pmd_release_notes_pmd7.html#new-programmatic-api-for-cpd).
|
* If you call CPD programmatically, the API has changed, see [New Programmatic API for CPD](pmd_release_notes_pmd7.html#new-programmatic-api-for-cpd).
|
||||||
* If you use Visualforce, then you need to change "vf" to "visualforce", e.g. `category/vf/security.xml` ➡️ `category/visualforce/security.xml`
|
* If you use Visualforce, then you need to change "vf" to "visualforce", e.g. `category/vf/security.xml` ➡️ `category/visualforce/security.xml`
|
||||||
|
* If you use Velocity, then you need to change "vm" to "velocity", e.g. `category/vm/...` ➡️ `category/velocity/...`
|
||||||
|
|
||||||
The following topics describe well known migration challenges in more detail.
|
The following topics describe well known migration challenges in more detail.
|
||||||
|
|
||||||
|
@ -136,6 +136,15 @@ is now considered stable.
|
|||||||
|
|
||||||
Experimental Kotlin support has been promoted as stable API now.
|
Experimental Kotlin support has been promoted as stable API now.
|
||||||
|
|
||||||
|
##### Changed: Velocity Template Language (VTL)
|
||||||
|
|
||||||
|
The module was named just "vm" which was not a good name. It module and language id and
|
||||||
|
package names have been renamed to "velocity".
|
||||||
|
|
||||||
|
If you import rules, you also need to ajdust the paths, e.g.
|
||||||
|
|
||||||
|
* `category/vm/...` ➡️ `category/velocity/...`
|
||||||
|
|
||||||
#### Rule Changes
|
#### Rule Changes
|
||||||
|
|
||||||
**New Rules**
|
**New Rules**
|
||||||
@ -153,6 +162,9 @@ Experimental Kotlin support has been promoted as stable API now.
|
|||||||
**Renamed Rulesets**
|
**Renamed Rulesets**
|
||||||
|
|
||||||
* `category/vf/security.xml` ➡️ `category/visualforce/security.xml`
|
* `category/vf/security.xml` ➡️ `category/visualforce/security.xml`
|
||||||
|
* `category/vm/bestpractices.xml` ➡️ `category/velocity/bestpractices.xml`
|
||||||
|
* `category/vm/design.xml` ➡️ `category/velocity/design.xml`
|
||||||
|
* `category/vm/errorprone.xml` ➡️ `category/velocity/errorprone.xml`
|
||||||
|
|
||||||
**Removed Rules**
|
**Removed Rules**
|
||||||
|
|
||||||
@ -371,6 +383,16 @@ in the migration guide for details.
|
|||||||
* The package `net.sourceforge.pmd.lang.vf` has been renamed to {%jdoc_package visualforce::lang.visualforce %}.
|
* The package `net.sourceforge.pmd.lang.vf` has been renamed to {%jdoc_package visualforce::lang.visualforce %}.
|
||||||
* The language id of visualforce has been changed to `visualforce` (it was previously just "vf")
|
* The language id of visualforce has been changed to `visualforce` (it was previously just "vf")
|
||||||
* The ruleset changed: `category/vf/security.xml` ➡️ `category/visualforce/security.xml`
|
* The ruleset changed: `category/vf/security.xml` ➡️ `category/visualforce/security.xml`
|
||||||
|
* pmd-velocity (renamed from pmd-vm)
|
||||||
|
* The package `net.sourceforge.pmd.lang.vm` has been renamed to {%jdoc_package velocity::lang.velocity %}.
|
||||||
|
* The language id of the Velocity module has been changed to `velocity` (it was previously just "vm")
|
||||||
|
* The rulesets changed: `category/vm/...` ➡️ `category/velocity/...`
|
||||||
|
* Many classes used the prefix `Vm`, e.g. `VmLanguageModule`. This has been changed to be `Vtl`:
|
||||||
|
* {%jdoc velocity::lang.velocity.VtlLanguageModule %}
|
||||||
|
* {%jdoc velocity::lang.velocity.ast.VtlNode %}
|
||||||
|
* {%jdoc velocity::lang.velocity.ast.VtlParser %}
|
||||||
|
* {%jdoc velocity::lang.velocity.cpd.VtlCpdLexer %}
|
||||||
|
* {%jdoc velocity::lang.velocity.rule.AbstractVtlRule %}
|
||||||
|
|
||||||
**Internalized classes and interfaces and methods**
|
**Internalized classes and interfaces and methods**
|
||||||
|
|
||||||
@ -716,10 +738,10 @@ The annotation `@DeprecatedUntil700` has been removed.
|
|||||||
* {%jdoc !!visualforce::lang.vf.DataType %} - method `fromBasicType(BasicType)` has been removed.
|
* {%jdoc !!visualforce::lang.vf.DataType %} - method `fromBasicType(BasicType)` has been removed.
|
||||||
Use {%jdoc visualforce::lang.vf.DataType#fromTypeName(java.lang.String) %} instead.
|
Use {%jdoc visualforce::lang.vf.DataType#fromTypeName(java.lang.String) %} instead.
|
||||||
* pmd-vm
|
* pmd-vm
|
||||||
* {%jdoc !!vm::lang.vm.ast.VmNode %} - method `jjtAccept()` has been removed.
|
* {%jdoc !!velocity::lang.vm.ast.VmNode %} - method `jjtAccept()` has been removed.
|
||||||
Use {%jdoc core::lang.ast.Node#acceptVisitor(core::lang.ast.AstVisitor,P) %} instead.
|
Use {%jdoc core::lang.ast.Node#acceptVisitor(core::lang.ast.AstVisitor,P) %} instead.
|
||||||
* `net.sourceforge.pmd.lang.vm.ast.VmParserVisitor`
|
* `net.sourceforge.pmd.lang.vm.ast.VmParserVisitor`
|
||||||
Use {%jdoc vm::lang.vm.ast.VmVisitor %} or {%jdoc vm::lang.vm.ast.VmVisitorBase %} instead.
|
Use {%jdoc velocity::lang.vm.ast.VmVisitor %} or {%jdoc velocity::lang.vm.ast.VmVisitorBase %} instead.
|
||||||
* `net.sourceforge.pmd.lang.vm.ast.VmParserVisitorAdapter`
|
* `net.sourceforge.pmd.lang.vm.ast.VmParserVisitorAdapter`
|
||||||
|
|
||||||
**Removed classes, interfaces and methods (not previously deprecated)**
|
**Removed classes, interfaces and methods (not previously deprecated)**
|
||||||
|
@ -1705,7 +1705,7 @@ These deprecations have already been rolled out in a previous version for the
|
|||||||
following languages:
|
following languages:
|
||||||
* Java: {% jdoc_package java::lang.java.ast %}
|
* Java: {% jdoc_package java::lang.java.ast %}
|
||||||
* Java Server Pages: {% jdoc_package jsp::lang.jsp.ast %}
|
* Java Server Pages: {% jdoc_package jsp::lang.jsp.ast %}
|
||||||
* Velocity Template Language: {% jdoc_package vm::lang.vm.ast %}
|
* Velocity Template Language: {% jdoc_package velocity::lang.vm.ast %}
|
||||||
|
|
||||||
Outside of these packages, these changes also concern the following TokenManager
|
Outside of these packages, these changes also concern the following TokenManager
|
||||||
implementations, and their corresponding Parser if it exists (in the same package):
|
implementations, and their corresponding Parser if it exists (in the same package):
|
||||||
@ -1720,7 +1720,7 @@ implementations, and their corresponding Parser if it exists (in the same packag
|
|||||||
* {% jdoc plsql::lang.plsql.PLSQLTokenManager %}
|
* {% jdoc plsql::lang.plsql.PLSQLTokenManager %}
|
||||||
* {% jdoc python::lang.python.PythonTokenManager %}
|
* {% jdoc python::lang.python.PythonTokenManager %}
|
||||||
* {% jdoc visualforce::lang.vf.VfTokenManager %}
|
* {% jdoc visualforce::lang.vf.VfTokenManager %}
|
||||||
* {% jdoc vm::lang.vm.VmTokenManager %}
|
* {% jdoc velocity::lang.vm.VmTokenManager %}
|
||||||
|
|
||||||
|
|
||||||
In the **Java AST** the following attributes are deprecated and will issue a warning when used in XPath rules:
|
In the **Java AST** the following attributes are deprecated and will issue a warning when used in XPath rules:
|
||||||
@ -1855,19 +1855,19 @@ The following usages are now deprecated **in the VM AST** (with other languages
|
|||||||
Those constructors will be made package private with 7.0.0.
|
Those constructors will be made package private with 7.0.0.
|
||||||
* **Subclassing of abstract node classes, or usage of their type**. The base classes are internal API
|
* **Subclassing of abstract node classes, or usage of their type**. The base classes are internal API
|
||||||
and will be hidden in version 7.0.0. You should not couple your code to them.
|
and will be hidden in version 7.0.0. You should not couple your code to them.
|
||||||
* In the meantime you should use interfaces like {% jdoc vm::lang.vm.ast.VmNode %} or
|
* In the meantime you should use interfaces like {% jdoc velocity::lang.vm.ast.VmNode %} or
|
||||||
{% jdoc core::lang.ast.Node %}, or the other published interfaces in this package,
|
{% jdoc core::lang.ast.Node %}, or the other published interfaces in this package,
|
||||||
to refer to nodes generically.
|
to refer to nodes generically.
|
||||||
* Concrete node classes will **be made final** with 7.0.0.
|
* Concrete node classes will **be made final** with 7.0.0.
|
||||||
* Setters found in any node class or interface. **Rules should consider the AST immutable**.
|
* Setters found in any node class or interface. **Rules should consider the AST immutable**.
|
||||||
We will make those setters package private with 7.0.0.
|
We will make those setters package private with 7.0.0.
|
||||||
* The package {% jdoc_package vm::lang.vm.directive %} as well as the classes
|
* The package {% jdoc_package velocity::lang.vm.directive %} as well as the classes
|
||||||
{% jdoc vm::lang.vm.util.DirectiveMapper %} and {% jdoc vm::lang.vm.util.LogUtil %} are deprecated
|
{% jdoc velocity::lang.vm.util.DirectiveMapper %} and {% jdoc velocity::lang.vm.util.LogUtil %} are deprecated
|
||||||
for removal. They were only used internally during parsing.
|
for removal. They were only used internally during parsing.
|
||||||
* The class {% jdoc vm::lang.vm.VmParser %} is deprecated and should not be used directly.
|
* The class {% jdoc velocity::lang.vm.VmParser %} is deprecated and should not be used directly.
|
||||||
Use {% jdoc !!core::lang.LanguageVersionHandler#getParser(ParserOptions) %} instead.
|
Use {% jdoc !!core::lang.LanguageVersionHandler#getParser(ParserOptions) %} instead.
|
||||||
|
|
||||||
Please look at {% jdoc_package vm::lang.vm.ast %} to find out the full list of deprecations.
|
Please look at {% jdoc_package velocity::lang.vm.ast %} to find out the full list of deprecations.
|
||||||
|
|
||||||
**PLSQL AST**
|
**PLSQL AST**
|
||||||
|
|
||||||
@ -2077,7 +2077,7 @@ of deprecations.
|
|||||||
* {% jdoc !q!jsp::lang.jsp.ast.DumpFacade %}
|
* {% jdoc !q!jsp::lang.jsp.ast.DumpFacade %}
|
||||||
* {% jdoc !q!plsql::lang.plsql.ast.DumpFacade %}
|
* {% jdoc !q!plsql::lang.plsql.ast.DumpFacade %}
|
||||||
* {% jdoc !q!visualforce::lang.vf.ast.DumpFacade %}
|
* {% jdoc !q!visualforce::lang.vf.ast.DumpFacade %}
|
||||||
* {% jdoc !q!vm::lang.vm.ast.AbstractVmNode#dump(String, boolean, Writer) %}
|
* {% jdoc !q!velocity::lang.vm.ast.AbstractVmNode#dump(String, boolean, Writer) %}
|
||||||
* {% jdoc !q!xml::lang.xml.ast.DumpFacade %}
|
* {% jdoc !q!xml::lang.xml.ast.DumpFacade %}
|
||||||
* The method {% jdoc !c!core::lang.LanguageVersionHandler#getDumpFacade(Writer, String, boolean) %} will be
|
* The method {% jdoc !c!core::lang.LanguageVersionHandler#getDumpFacade(Writer, String, boolean) %} will be
|
||||||
removed as well. It is deprecated, along with all its implementations in the subclasses of {% jdoc core::lang.LanguageVersionHandler %}.
|
removed as well. It is deprecated, along with all its implementations in the subclasses of {% jdoc core::lang.LanguageVersionHandler %}.
|
||||||
|
@ -18,7 +18,7 @@ class AllRulesIT extends AbstractBinaryDistributionTest {
|
|||||||
static Iterable<String> languagesToTest() {
|
static Iterable<String> languagesToTest() {
|
||||||
// note: scala and wsdl have no rules
|
// note: scala and wsdl have no rules
|
||||||
return Arrays.asList("java", "apex", "html", "javascript", "jsp", "modelica",
|
return Arrays.asList("java", "apex", "html", "javascript", "jsp", "modelica",
|
||||||
"plsql", "pom", "visualforce", "velocitytemplate", "xml", "xsl");
|
"plsql", "pom", "visualforce", "velocity", "xml", "xsl");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
@ -34,7 +34,7 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest {
|
|||||||
"julia",
|
"julia",
|
||||||
"kotlin", "lua", "matlab", "modelica", "objectivec", "perl",
|
"kotlin", "lua", "matlab", "modelica", "objectivec", "perl",
|
||||||
"php", "plsql", "pom", "python", "ruby", "scala", "swift",
|
"php", "plsql", "pom", "python", "ruby", "scala", "swift",
|
||||||
"tsql", "typescript", "visualforce", "vm", "wsdl", "xml", "xsl"
|
"tsql", "typescript", "velocity", "visualforce", "wsdl", "xml", "xsl"
|
||||||
);
|
);
|
||||||
|
|
||||||
private static final List<String> SUPPORTED_LANGUAGES_PMD = listOf(
|
private static final List<String> SUPPORTED_LANGUAGES_PMD = listOf(
|
||||||
@ -61,11 +61,12 @@ class BinaryDistributionIT extends AbstractBinaryDistributionTest {
|
|||||||
"swift-4.2", "swift-5.0", "swift-5.1", "swift-5.2",
|
"swift-4.2", "swift-5.0", "swift-5.1", "swift-5.2",
|
||||||
"swift-5.3", "swift-5.4", "swift-5.5", "swift-5.6",
|
"swift-5.3", "swift-5.4", "swift-5.5", "swift-5.6",
|
||||||
"swift-5.7", "swift-5.8", "swift-5.9",
|
"swift-5.7", "swift-5.8", "swift-5.9",
|
||||||
|
"velocity-2.0", "velocity-2.1", "velocity-2.2", "velocity-2.3",
|
||||||
"visualforce-52", "visualforce-53", "visualforce-54", "visualforce-55", "visualforce-56",
|
"visualforce-52", "visualforce-53", "visualforce-54", "visualforce-55", "visualforce-56",
|
||||||
"visualforce-57", "visualforce-58", "visualforce-59",
|
"visualforce-57", "visualforce-58", "visualforce-59",
|
||||||
"vm-2.0", "vm-2.1", "vm-2.2", "vm-2.3", "wsdl-1.1",
|
"wsdl-1.1", "wsdl-2.0",
|
||||||
"wsdl-2.0", "xml-1.0", "xml-1.1", "xsl-1.0", "xsl-2.0",
|
"xml-1.0", "xml-1.1",
|
||||||
"xsl-3.0"
|
"xsl-1.0", "xsl-2.0", "xsl-3.0"
|
||||||
);
|
);
|
||||||
|
|
||||||
private final String srcDir = new File(".", "src/test/resources/sample-source/java/").getAbsolutePath();
|
private final String srcDir = new File(".", "src/test/resources/sample-source/java/").getAbsolutePath();
|
||||||
|
18
pmd-dist/src/test/resources/rulesets/all-velocity.xml
Normal file
18
pmd-dist/src/test/resources/rulesets/all-velocity.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<ruleset name="All Velocity Template Language Rules"
|
||||||
|
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||||
|
<description>Every Velocity Template Language Rule in PMD</description>
|
||||||
|
|
||||||
|
<rule ref="category/velocity/bestpractices.xml" />
|
||||||
|
<rule ref="category/velocity/codestyle.xml" />
|
||||||
|
<rule ref="category/velocity/design.xml" />
|
||||||
|
<rule ref="category/velocity/documentation.xml" />
|
||||||
|
<rule ref="category/velocity/errorprone.xml" />
|
||||||
|
<rule ref="category/velocity/multithreading.xml" />
|
||||||
|
<rule ref="category/velocity/performance.xml" />
|
||||||
|
<rule ref="category/velocity/security.xml" />
|
||||||
|
|
||||||
|
</ruleset>
|
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<ruleset name="All Velocity Template Language Rules"
|
|
||||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
|
||||||
<description>Every Velocity Template Language Rule in PMD</description>
|
|
||||||
|
|
||||||
<rule ref="category/vm/bestpractices.xml" />
|
|
||||||
<rule ref="category/vm/codestyle.xml" />
|
|
||||||
<rule ref="category/vm/design.xml" />
|
|
||||||
<rule ref="category/vm/documentation.xml" />
|
|
||||||
<rule ref="category/vm/errorprone.xml" />
|
|
||||||
<rule ref="category/vm/multithreading.xml" />
|
|
||||||
<rule ref="category/vm/performance.xml" />
|
|
||||||
<rule ref="category/vm/security.xml" />
|
|
||||||
|
|
||||||
</ruleset>
|
|
@ -154,7 +154,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sourceforge.pmd</groupId>
|
<groupId>net.sourceforge.pmd</groupId>
|
||||||
<artifactId>pmd-vm</artifactId>
|
<artifactId>pmd-velocity</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -33,8 +33,8 @@ options
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PARSER_BEGIN(VmParserImpl)
|
PARSER_BEGIN(VtlParserImpl)
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -59,7 +59,7 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
|
|||||||
* @author <a href="hps@intermeta.de">Henning P. Schmiedehausen</a>
|
* @author <a href="hps@intermeta.de">Henning P. Schmiedehausen</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class VmParserImpl
|
public class VtlParserImpl
|
||||||
{
|
{
|
||||||
private void throwParseException(String message) {
|
private void throwParseException(String message) {
|
||||||
throw new ParseException(message).withLocation(token);
|
throw new ParseException(message).withLocation(token);
|
||||||
@ -109,7 +109,7 @@ public class VmParserImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PARSER_END(VmParserImpl)
|
PARSER_END(VtlParserImpl)
|
||||||
|
|
||||||
TOKEN_MGR_DECLS:
|
TOKEN_MGR_DECLS:
|
||||||
{
|
{
|
||||||
@ -1101,7 +1101,7 @@ void DirectiveArg() #void : {}
|
|||||||
* Supports the Pluggable Directives
|
* Supports the Pluggable Directives
|
||||||
* #foo( arg+ )
|
* #foo( arg+ )
|
||||||
*/
|
*/
|
||||||
VmNode Directive() :
|
VtlNode Directive() :
|
||||||
{
|
{
|
||||||
JavaccToken t = null;
|
JavaccToken t = null;
|
||||||
int argPos = 0;
|
int argPos = 0;
|
||||||
@ -1117,7 +1117,7 @@ VmNode Directive() :
|
|||||||
((t = <WORD>) | (t = <BRACKETED_WORD>))
|
((t = <WORD>) | (t = <BRACKETED_WORD>))
|
||||||
{
|
{
|
||||||
String directiveName;
|
String directiveName;
|
||||||
if (t.kind == VmTokenKinds.BRACKETED_WORD)
|
if (t.kind == VtlTokenKinds.BRACKETED_WORD)
|
||||||
{
|
{
|
||||||
directiveName = t.getImage().substring(2, t.getImage().length() - 1);
|
directiveName = t.getImage().substring(2, t.getImage().length() - 1);
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>pmd-vm</artifactId>
|
<artifactId>pmd-velocity</artifactId>
|
||||||
<name>PMD Velocity</name>
|
<name>PMD Velocity Template Language (VTL)</name>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.sourceforge.pmd</groupId>
|
<groupId>net.sourceforge.pmd</groupId>
|
||||||
@ -44,8 +44,8 @@
|
|||||||
<target>
|
<target>
|
||||||
<ant antfile="${javacc.ant.wrapper}" target="alljavacc">
|
<ant antfile="${javacc.ant.wrapper}" target="alljavacc">
|
||||||
<property name="javacc.jar" value="${javacc.jar}" />
|
<property name="javacc.jar" value="${javacc.jar}" />
|
||||||
<property name="lang-name" value="Vm" />
|
<property name="lang-name" value="Vtl" />
|
||||||
<property name="lang-terse-name" value="vm" />
|
<property name="lang-terse-name" value="velocity" />
|
||||||
</ant>
|
</ant>
|
||||||
</target>
|
</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -75,7 +75,7 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<suppressionsLocation>pmd-vm-checkstyle-suppressions.xml</suppressionsLocation>
|
<suppressionsLocation>pmd-velocity-checkstyle-suppressions.xml</suppressionsLocation>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.sourceforge.pmd.lang.velocity;
|
||||||
|
|
||||||
|
import net.sourceforge.pmd.lang.AbstractPmdLanguageVersionHandler;
|
||||||
|
import net.sourceforge.pmd.lang.ast.Parser;
|
||||||
|
import net.sourceforge.pmd.lang.velocity.ast.VtlParser;
|
||||||
|
|
||||||
|
public class VtlHandler extends AbstractPmdLanguageVersionHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Parser getParser() {
|
||||||
|
return new VtlParser();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,37 +2,37 @@
|
|||||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm;
|
package net.sourceforge.pmd.lang.velocity;
|
||||||
|
|
||||||
import net.sourceforge.pmd.cpd.CpdLexer;
|
import net.sourceforge.pmd.cpd.CpdLexer;
|
||||||
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
|
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
|
||||||
import net.sourceforge.pmd.lang.LanguageRegistry;
|
import net.sourceforge.pmd.lang.LanguageRegistry;
|
||||||
import net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase;
|
import net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase;
|
||||||
import net.sourceforge.pmd.lang.vm.cpd.VmCpdLexer;
|
import net.sourceforge.pmd.lang.velocity.cpd.VtlCpdLexer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by christoferdutz on 20.09.14.
|
* Created by christoferdutz on 20.09.14.
|
||||||
*/
|
*/
|
||||||
public class VmLanguageModule extends SimpleLanguageModuleBase {
|
public class VtlLanguageModule extends SimpleLanguageModuleBase {
|
||||||
static final String ID = "vm";
|
static final String ID = "velocity";
|
||||||
static final String NAME = "Velocity Template Language (VTL)";
|
static final String NAME = "Velocity Template Language (VTL)";
|
||||||
|
|
||||||
public VmLanguageModule() {
|
public VtlLanguageModule() {
|
||||||
super(LanguageMetadata.withId(ID).name(NAME)
|
super(LanguageMetadata.withId(ID).name(NAME)
|
||||||
.extensions("vm")
|
.extensions("vm")
|
||||||
.addVersion("2.0")
|
.addVersion("2.0")
|
||||||
.addVersion("2.1")
|
.addVersion("2.1")
|
||||||
.addVersion("2.2")
|
.addVersion("2.2")
|
||||||
.addDefaultVersion("2.3"),
|
.addDefaultVersion("2.3"),
|
||||||
new VmHandler());
|
new VtlHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VmLanguageModule getInstance() {
|
public static VtlLanguageModule getInstance() {
|
||||||
return (VmLanguageModule) LanguageRegistry.PMD.getLanguageById(ID);
|
return (VtlLanguageModule) LanguageRegistry.PMD.getLanguageById(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CpdLexer createCpdLexer(LanguagePropertyBundle bundle) {
|
public CpdLexer createCpdLexer(LanguagePropertyBundle bundle) {
|
||||||
return new VmCpdLexer();
|
return new VtlCpdLexer();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -39,7 +39,7 @@ public final class ASTAddNode extends ASTMathNode {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,11 +2,11 @@
|
|||||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public final class ASTBlock extends AbstractVmNode {
|
public final class ASTBlock extends AbstractVtlNode {
|
||||||
|
|
||||||
ASTBlock(int id) {
|
ASTBlock(int id) {
|
||||||
super(id);
|
super(id);
|
||||||
@ -14,7 +14,7 @@ public final class ASTBlock extends AbstractVmNode {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -37,7 +37,7 @@ import java.util.Set;
|
|||||||
* @author <a href="mailto:kav@kav.dk">Kasper Nielsen</a>
|
* @author <a href="mailto:kav@kav.dk">Kasper Nielsen</a>
|
||||||
* @version $Id: ASTDirective.java 724825 2008-12-09 18:56:06Z nbubna $
|
* @version $Id: ASTDirective.java 724825 2008-12-09 18:56:06Z nbubna $
|
||||||
*/
|
*/
|
||||||
public final class ASTDirective extends AbstractVmNode {
|
public final class ASTDirective extends AbstractVtlNode {
|
||||||
|
|
||||||
private static final Set<String> DIRECTIVE_NAMES;
|
private static final Set<String> DIRECTIVE_NAMES;
|
||||||
private static final Set<String> BLOCK_DIRECTIVES;
|
private static final Set<String> BLOCK_DIRECTIVES;
|
||||||
@ -73,7 +73,7 @@ public final class ASTDirective extends AbstractVmNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -40,7 +40,7 @@ public final class ASTDivNode extends ASTMathNode {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -29,7 +29,7 @@ package net.sourceforge.pmd.lang.vm.ast;
|
|||||||
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
|
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
|
||||||
* @version $Id: ASTEscape.java 517553 2007-03-13 06:09:58Z wglass $
|
* @version $Id: ASTEscape.java 517553 2007-03-13 06:09:58Z wglass $
|
||||||
*/
|
*/
|
||||||
public final class ASTEscape extends AbstractVmNode {
|
public final class ASTEscape extends AbstractVtlNode {
|
||||||
|
|
||||||
/** Used by the parser. */
|
/** Used by the parser. */
|
||||||
private String val;
|
private String val;
|
||||||
@ -48,7 +48,7 @@ public final class ASTEscape extends AbstractVmNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -32,7 +32,7 @@ package net.sourceforge.pmd.lang.vm.ast;
|
|||||||
* @author Nathan Bubna
|
* @author Nathan Bubna
|
||||||
* @version $Id: ASTMathNode.java 517553 2007-03-13 06:09:58Z wglass $
|
* @version $Id: ASTMathNode.java 517553 2007-03-13 06:09:58Z wglass $
|
||||||
*/
|
*/
|
||||||
abstract class ASTMathNode extends AbstractVmNode {
|
abstract class ASTMathNode extends AbstractVtlNode {
|
||||||
|
|
||||||
ASTMathNode(int id) {
|
ASTMathNode(int id) {
|
||||||
super(id);
|
super(id);
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -35,14 +35,14 @@ package net.sourceforge.pmd.lang.vm.ast;
|
|||||||
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
|
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
|
||||||
* @version $Id: ASTMethod.java 720228 2008-11-24 16:58:33Z nbubna $
|
* @version $Id: ASTMethod.java 720228 2008-11-24 16:58:33Z nbubna $
|
||||||
*/
|
*/
|
||||||
public final class ASTMethod extends AbstractVmNode {
|
public final class ASTMethod extends AbstractVtlNode {
|
||||||
|
|
||||||
ASTMethod(int id) {
|
ASTMethod(int id) {
|
||||||
super(id);
|
super(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -39,7 +39,7 @@ public final class ASTModNode extends ASTMathNode {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -40,7 +40,7 @@ public final class ASTMulNode extends ASTMathNode {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
@ -32,7 +32,7 @@ package net.sourceforge.pmd.lang.vm.ast;
|
|||||||
* @author <a href="mailto:kjohnson@transparent.com">Kent Johnson</a>
|
* @author <a href="mailto:kjohnson@transparent.com">Kent Johnson</a>
|
||||||
* @version $Id: ASTReference.java 806597 2009-08-21 15:21:44Z nbubna $
|
* @version $Id: ASTReference.java 806597 2009-08-21 15:21:44Z nbubna $
|
||||||
*/
|
*/
|
||||||
public final class ASTReference extends AbstractVmNode {
|
public final class ASTReference extends AbstractVtlNode {
|
||||||
private String rootString;
|
private String rootString;
|
||||||
|
|
||||||
private String literal = null;
|
private String literal = null;
|
||||||
@ -42,7 +42,7 @@ public final class ASTReference extends AbstractVmNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package net.sourceforge.pmd.lang.vm.ast;
|
package net.sourceforge.pmd.lang.velocity.ast;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
@ -25,14 +25,14 @@ package net.sourceforge.pmd.lang.vm.ast;
|
|||||||
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
|
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
|
||||||
* @version $Id: ASTStringLiteral.java 705297 2008-10-16 17:59:24Z nbubna $
|
* @version $Id: ASTStringLiteral.java 705297 2008-10-16 17:59:24Z nbubna $
|
||||||
*/
|
*/
|
||||||
public final class ASTStringLiteral extends AbstractVmNode {
|
public final class ASTStringLiteral extends AbstractVtlNode {
|
||||||
|
|
||||||
ASTStringLiteral(int id) {
|
ASTStringLiteral(int id) {
|
||||||
super(id);
|
super(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <P, R> R acceptVmVisitor(VmVisitor<? super P, ? extends R> visitor, P data) {
|
protected <P, R> R acceptVtlVisitor(VtlVisitor<? super P, ? extends R> visitor, P data) {
|
||||||
return visitor.visit(this, data);
|
return visitor.visit(this, data);
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user