Merge branch 'pr-1802'
This commit is contained in:
@ -22,12 +22,15 @@ This is a {{ site.pmd.release_type }} release.
|
||||
* [#1738](https://github.com/pmd/pmd/issues/1738): \[java] MethodReturnsInternalArray does not work in inner classes
|
||||
* java-codestyle
|
||||
* [#1804](https://github.com/pmd/pmd/issues/1804): \[java] NPE in UnnecessaryLocalBeforeReturnRule
|
||||
* python
|
||||
* [#1810](https://github.com/pmd/pmd/issues/1810): \[python] \[cpd] Parse error when using Python 2 backticks
|
||||
|
||||
### API Changes
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#1799](https://github.com/pmd/pmd/pull/1799): \[java] MethodReturnsInternalArray does not work in inner classes - Fixed #1738 - [Srinivasan Venkatachalam](https://github.com/Srini1993)
|
||||
* [#1802](https://github.com/pmd/pmd/pull/1802): \[python] \[cpd] Add support for Python 2 backticks - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#1803](https://github.com/pmd/pmd/pull/1803): \[dart] \[cpd] Dart escape sequences - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
@ -52,6 +52,7 @@ TOKEN : /* SEPARATORS */
|
||||
| < COMMA: "," >
|
||||
| < DOT: "." >
|
||||
| < COLON: ":" >
|
||||
| < BACKTICK: "`" >
|
||||
}
|
||||
|
||||
|
||||
@ -280,4 +281,4 @@ MORE : /* Strings */
|
||||
| <"\r"> { image.setCharAt(image.length()-1, '\n'); }
|
||||
| <~["\n","\r"]>
|
||||
| <"\\" ~["\n","\r"]>
|
||||
}
|
||||
}
|
||||
|
@ -53,4 +53,16 @@ public class PythonTokenizerTest extends AbstractTokenizerTest {
|
||||
TokenEntry.getEOF();
|
||||
assertEquals(3, tokens.size()); // 3 tokens: "import" + "logging" + EOF
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBackticks() throws IOException {
|
||||
SourceCode sourceCode = new SourceCode(new SourceCode.StringCodeLoader("test = 'hello'" + PMD.EOL
|
||||
+ "quoted = `test`" + PMD.EOL
|
||||
+ "print quoted" + PMD.EOL
|
||||
));
|
||||
Tokens tokens = new Tokens();
|
||||
tokenizer.tokenize(sourceCode, tokens); // should not result in parse error
|
||||
TokenEntry.getEOF();
|
||||
assertEquals(3, tokens.getTokens().get(tokens.getTokens().size() - 2).getBeginLine());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user