Commit Graph

5 Commits

Author SHA1 Message Date
Lulu13022002
6eeac161d5
rename test files: .yml -> .yaml 2024-04-12 17:28:51 +02:00
Lulu13022002
5a05ceabee
improve source parsing to be more accurate
The previous way had several flaw and was not really future proof. This
new system is based on an iterative string reader similar to how brigadier parse
arguments which simplify a lot of things tracking the cursor internally.

The comments and javadoc are now properly skipped to prevent commented line to be counted as an import.

The first scope detection to stop the parser once all imports have been processed
now detect the first '{' char uncommented. Previously it only worked for api
gen and was really restrictive since it detected the following pattern: <class type> <class name>
as a workaround.
The annotations are also skipped to prevent curly bracket that could be in
it to be counted too (this include the arguments as well).

Type name extended on multi line are also supported and checked at
runtime as defined in the JLS:
https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.8
For fully qualified name, each part separated by a dot are checked. Keyword
are also checked to prevent @interface to be considered as a regular annotation
when it's more a class definition. Whitespace and comments in between type name are
stripped to collect the right import in the end. Annotation between the package
name and the class name are not supported but is not needed for
import and annotation since they are forbidden by the compiler.

Multi line stuff is handled using a list of tasks to process in the right order
for the imports or annotations with two types of task: repeat and basic.

This new system is now used in the marker comment detection and in the old generated
code test.

There's also a lot of tests to make sure no regression happen in the future
that can be enabled by inluding the tag 'parser' (disabled in CI runner by default).
Additionnaly marker stub are not anymore allowed by default while parsing import,
annotation and metadata stuff but can be reenabled with the system property
'paper.generator.rewriter.searchMarkerInMetadata' for experimental/testing
purpose.

Short type name resolution (based on the collected imports) has been redone to
supports static star import and inner class type referenced either implicitly or via import.
2024-04-11 20:22:30 +02:00
Lulu13022002
bc44bf0a54
collect imports for unknown classes 2024-04-11 20:22:30 +02:00
Lulu13022002
0ec5ca062b
consolidate key format for mob goal keys 2024-04-11 20:22:29 +02:00
Lulu13022002
3fc81acf07
CraftBlockData mapping 2024-04-11 20:22:29 +02:00