275 Commits

Author SHA1 Message Date
Clément Fournier
86d7c3e009 Merge branch 'grammar-dimensions' into java-grammar 2020-01-16 03:45:23 +01:00
Clément Fournier
94ebcdec82 Don't forget annotation methods 2020-01-16 03:25:16 +01:00
Clément Fournier
a465d4b585 Merge branch 'java-grammar' into grammar-catch-formal 2020-01-16 02:43:32 +01:00
Clément Fournier
d3908cb2bb Merge branch 'java-grammar' into grammar-dimensions 2020-01-16 02:42:45 +01:00
Clément Fournier
88aa7746f0 Merge branch '7.0.x' into java-grammar 2020-01-10 21:34:48 +01:00
Clément Fournier
99700d7526 Extract changes from #2166 to 7.0.x
* Make Java nodes text-available
* Introduce shared JavaccToken in pmd-core
* Use factory to produce char streams

Tests are still on java-grammar,
since they use the DSL & newer
AST structure.

This is to prepare for other changes
that concern all javacc languages and
should not be done on java-grammar
2020-01-10 21:15:15 +01:00
Clément Fournier
1fefbd2c4a Make FieldDeclaration not a TypeNode 2020-01-07 23:13:05 +01:00
Clément Fournier
1eab9448e7 Use ArrayDimensions for VariableDeclaratorId
* Remove `Dimensionable`, remove its methods from the former implementations (except from ASTArrayDimsAndInits, which is itself deprecated)

* The varargs ellipsis is now represented as an ArrayTypeDim.
  * This affects FormalParameter and LambdaParameter

Closes #997. All forms of type annotations are now supported.
2020-01-07 23:12:53 +01:00
Clément Fournier
17305f3781 Cleanup 2020-01-07 22:35:37 +01:00
Clément Fournier
ee1e9bf286 Fix final catch param 2020-01-07 21:19:49 +01:00
Clément Fournier
bba0367b10 Cleanup FormalParameter 2020-01-07 21:18:41 +01:00
Clément Fournier
db1344d5aa Separate catch formal from method formal 2020-01-07 21:16:39 +01:00
Clément Fournier
4ce104a41b Move CharStream into impl.javacc package 2020-01-06 16:41:25 +01:00
Clément Fournier
c1191253a6 Add tests for text access 2020-01-06 16:41:24 +01:00
Clément Fournier
f6d25ccf33 Cleanup token manager errors 2020-01-06 16:40:58 +01:00
Clément Fournier
4c07f606df Rename token to JavaccToken in pmd-java 2020-01-06 16:40:58 +01:00
Clément Fournier
821c4c41d1 Rename JavaTokenFactory 2020-01-06 16:40:58 +01:00
Clément Fournier
0ce6234ba7 Simplify GTToken 2020-01-06 16:40:58 +01:00
Clément Fournier
1327d99307 Use token document instead 2020-01-06 16:40:57 +01:00
Clément Fournier
a70e70ad15 Refactor JavaCharStream to buffer whole file in memory, provide access to underlying text for all java nodes 2020-01-06 16:40:57 +01:00
Clément Fournier
5cc235dc94 Merge branch 'java-grammar' into grammar-new-statements 2019-12-15 01:45:08 +01:00
Clément Fournier
218fdc7264 Merge branch 'java-grammar' into grammar-prefix-postfix 2019-12-15 01:27:36 +01:00
Clément Fournier
b03e233647 Turn Statement into an interface
Remove BlockStatement
Introduce LocalClassDeclStatement
Introduce EmptyDeclaration (in preparation for PR about declarations)
Replace StatementExpression with ExpressionStatement

Make YieldStatement, ExplicitConstructorInvocation implement ASTStatement

Extract ForeachStatement from ForStatement

Rename
(ASTWhileStmt,
 ASTDoStmt,
 ASTForStmt,
 ASTIfStmt,
 ASTAssertStmt)#getGuardExpressionNode() -> getCondition()

Rename ASTCatchStatement -> ASTCatchClause
Rename ASTFinallyStatement -> ASTFinallyClause
Rename ASTTryStatement#getCatchStatements() -> getCatchClauses()

Make ASTYieldStatement not a TypeNode

Remove ASTTryStatement#hasFinally()

Add (ASTThrowStatement,  ASTYieldStatement, ASTReturnStatement)#getExpression()
Add ASTTryStatement#getBody()
2019-12-15 01:21:49 +01:00
Clément Fournier
44106075f4 Merge branch 'grammar-isolate-version-checks' into java-grammar 2019-12-11 20:41:11 +01:00
Clément Fournier
ff174620f4 Merge branch '7.0.x' into java-grammar 2019-12-11 20:22:55 +01:00
Clément Fournier
76439a47f2 Use a single node for unary exprs 2019-12-09 15:12:09 +01:00
Clément Fournier
c7da6e94b2 Merge branch 'java-grammar' into grammar-prefix-postfix 2019-11-19 16:22:12 +01:00
Clément Fournier
585e123c09 Cleanup 2019-11-19 03:58:32 +01:00
Clément Fournier
1c6e57b5db Fix tests 2019-11-19 03:43:46 +01:00
Clément Fournier
b9882c4268 Remove abstract java parser 2019-11-19 03:43:46 +01:00
Clément Fournier
ac2b77b472 Pull version checks out of the parser 2019-11-19 03:43:46 +01:00
Clément Fournier
b154c5e3ee Remove irrelevant changes 2019-10-08 01:47:38 +02:00
Clément Fournier
6a6f20d899 Make getEnclosingClass always resolved 2019-10-08 01:47:38 +02:00
Clément Fournier
f5cc4f919a Reduce visibility 2019-10-08 01:47:38 +02:00
Clément Fournier
8140ae9cbc Extract suppressor interface 2019-10-07 00:01:31 +02:00
Clément Fournier
3c31b2df30 Merge branch 'java-grammar' into grammar-method-alignment 2019-10-05 14:56:19 +02:00
Clément Fournier
a62ecf0f4c Merge branch 'java-grammar' into grammar-method-alignment 2019-10-05 14:50:27 +02:00
Clément Fournier
d56f61b9aa Merge branch 'java-grammar' into grammar-type-expr 2019-09-30 15:49:18 +02:00
Clément Fournier
1258db21ea Use better names for assignment operators
Also, %= had been forgotten
2019-09-30 15:47:29 +02:00
Clément Fournier
341a833ee7 Remove InstanceOfExpression, use regular InfixExpression 2019-09-30 12:08:15 +02:00
Clément Fournier
e3e0911ca4 Use throwslist instead of namelist 2019-09-27 06:24:26 +02:00
Clément Fournier
9efe40f729 Merge branch 'java-grammar-merged' into grammar-method-alignment 2019-09-26 06:05:39 +02:00
Clément Fournier
b769629a10 Split UnaryExpr into Prefix and Postfix
Among the different possible categorisations
of unary expressions, this is probably the
most logical and easiest to document.

Here's a comparison of different possible
categorisations. Note: `_++` is the postfix
increment operator, while `++_` is the prefix
one - idem for decrement. The last one is the
one implemented by this commit.

\## 6.0.x

```
  Unary = { -, + }
  UnaryNotPlusMinus { !, ~ }
  PreIncrement = { ++_ }
  PreDecrement { --_ }
  Postfix { _++, _++ }
```

* Very assymmetric, splits operators based on parsing
concerns

\## Before #1890:

```
  Unary = { -, + , !, ~ }
  PreIncrement = { ++_ }
  PreDecrement { --_ }
  Postfix { _++, _++ }
```

* Minor simplification

\## #1890:

```
  Unary = Prefix \ { ++_, --_ })
  Increment ( { ++ , -- } x (postfix, prefix) )
```
* Names are weird (IncrementExpr may be decrement, Unary != Increment
  even though semantically, Increment \subset Unary)
* No possibility to introduce a supertype (what would it be?)
* But easy to match all increment/decrement expressions

\## JLS (also, Eclipse):

```
  Prefix = { !, ~, -, +, ++_, --_ }
  Postfix = { _++, _-- }
```

* Both can have super interface UnaryExpr
  * This allows matching all increment/decrement expressions easily too
* Easiest to document, JLS like, AST like
* Fits well with `InfixExpr`
2019-09-26 05:57:30 +02:00
Clément Fournier
d4b0440c7f Treat instanceof expression as an infix expression 2019-09-26 05:53:53 +02:00
Clément Fournier
fbebe72bc0 Merge branch 'grammar-array-dims' into java-grammar 2019-09-26 05:44:11 +02:00
Clément Fournier
8b7ecd7576 Merge branch 'grammar-receiver' into java-grammar 2019-09-26 05:44:03 +02:00
Clément Fournier
8d47824b41 Merge branch 'java-grammar' into grammar-left-recursive-ops 2019-09-25 22:59:37 +02:00
Clément Fournier
6a04f6af25 Merge branch 'java-grammar' into grammar-array-dims 2019-09-25 22:55:50 +02:00
Clément Fournier
f702295e24 Merge branch 'java-grammar' into grammar-receiver 2019-09-25 22:55:11 +02:00
Clément Fournier
0f13725b3d Use kotlin tests for text blocks 2019-09-14 16:25:44 +02:00