forked from phoedos/pmd
[typescript] Exclude TypeScriptLexerBase from checkstyle, fix PMD issues
This commit is contained in:
parent
e4b9c30323
commit
c134386898
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
|
||||
<suppressions>
|
||||
<suppress files="[\\/]generated-sources[\\/]" checks="[a-zA-Z0-9]*"/>
|
||||
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]net[\\/]sourceforge[\\/]pmd[\\/]lang[\\/]typescript[\\/]ast[\\/]TypeScriptLexerBase.java" checks="[a-zA-Z0-9]*"/>
|
||||
</suppressions>
|
@ -78,6 +78,14 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<suppressionsLocation>pmd-javascript-checkstyle-suppressions.xml</suppressionsLocation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
|
@ -7,17 +7,16 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.typescript.ast;
|
||||
|
||||
import java.util.Stack;
|
||||
import org.antlr.v4.runtime.*;
|
||||
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.Lexer;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
* All lexer methods that used in grammar (IsStrictMode)
|
||||
* should start with Upper Case Char similar to Lexer rules.
|
||||
*/
|
||||
abstract class TypeScriptLexerBase extends Lexer {
|
||||
abstract class TypeScriptLexerBase extends Lexer
|
||||
{
|
||||
/**
|
||||
* Stores values of nested modes. By default mode is strict or
|
||||
* defined externally (useStrictDefault)
|
||||
@ -102,21 +101,26 @@ abstract class TypeScriptLexerBase extends Lexer {
|
||||
return next;
|
||||
}
|
||||
|
||||
protected void ProcessOpenBrace() {
|
||||
protected void ProcessOpenBrace()
|
||||
{
|
||||
bracesDepth++;
|
||||
useStrictCurrent = scopeStrictModes.size() > 0 && scopeStrictModes.peek() || useStrictDefault;
|
||||
scopeStrictModes.push(useStrictCurrent);
|
||||
}
|
||||
|
||||
protected void ProcessCloseBrace() {
|
||||
protected void ProcessCloseBrace()
|
||||
{
|
||||
bracesDepth--;
|
||||
useStrictCurrent = scopeStrictModes.size() > 0 ? scopeStrictModes.pop() : useStrictDefault;
|
||||
}
|
||||
|
||||
protected void ProcessStringLiteral() {
|
||||
if (lastToken == null || lastToken.getType() == TypeScriptLexer.OpenBrace) {
|
||||
protected void ProcessStringLiteral()
|
||||
{
|
||||
if (lastToken == null || lastToken.getType() == TypeScriptLexer.OpenBrace)
|
||||
{
|
||||
String text = getText();
|
||||
if ("\"use strict\"".equals(text) || "'use strict'".equals(text)) {
|
||||
if ("\"use strict\"".equals(text) || "'use strict'".equals(text))
|
||||
{
|
||||
if (scopeStrictModes.size() > 0) {
|
||||
scopeStrictModes.pop();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user