forked from eclipse-jdt/eclipse.jdt.core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JEP-445] Grammar, parser, AST and code generation for unnamed classes
- Loading branch information
1 parent
c9c22d8
commit 96b986d
Showing
62 changed files
with
2,003 additions
and
1,347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+5.07 KB
org.eclipse.jdt.core.compiler.batch/scripts/GenerateParserScript.class
Binary file not shown.
44 changes: 44 additions & 0 deletions
44
...lipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnnamedClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat, Inc. and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.jdt.internal.compiler.ast; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.text.MessageFormat; | ||
|
||
import org.eclipse.jdt.internal.compiler.CompilationResult; | ||
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; | ||
|
||
/** | ||
* Represents an unnamed class as defined in JEP 445 | ||
*/ | ||
public class UnnamedClass extends TypeDeclaration { | ||
|
||
private static String NAME_TEMPLATE = "<unnamed_class${0}>"; //$NON-NLS-1$ | ||
|
||
public UnnamedClass(CompilationResult result) { | ||
super(result); | ||
this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccFinal; | ||
|
||
Path p = Paths.get(new String(result.fileName)); | ||
String basename = p.getFileName().toString(); | ||
String classSuffix; | ||
if (basename.endsWith(".java")) { //$NON-NLS-1$ | ||
classSuffix = basename.substring(0, basename.length() - 5); | ||
} else { | ||
classSuffix = basename; | ||
} | ||
|
||
String nameString = MessageFormat.format(NAME_TEMPLATE, classSuffix); | ||
this.name = nameString.toCharArray(); | ||
} | ||
|
||
} |
1,056 changes: 560 additions & 496 deletions
1,056
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+300 Bytes
(100%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
Binary file not shown.
Binary file modified
BIN
+22 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
Binary file not shown.
Binary file modified
BIN
+28 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
Binary file not shown.
Binary file modified
BIN
+2 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
Binary file not shown.
Binary file modified
BIN
-108 Bytes
(99%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
Binary file not shown.
Binary file modified
BIN
+296 Bytes
(100%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
Binary file not shown.
Binary file modified
BIN
+58 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
Binary file not shown.
Binary file modified
BIN
+16 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
Binary file not shown.
Binary file modified
BIN
+2 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser22.rsc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser23.rsc
Binary file not shown.
Binary file modified
BIN
+2 Bytes
(100%)
...eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser24.rsc
Binary file not shown.
Binary file modified
BIN
+28 Bytes
(100%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
Binary file not shown.
Binary file modified
BIN
-38 Bytes
(99%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
Binary file not shown.
Binary file modified
BIN
+28 Bytes
(100%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
Binary file not shown.
Binary file modified
BIN
+44 Bytes
(100%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
Binary file not shown.
Binary file modified
BIN
+2 Bytes
(100%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
Binary file not shown.
Binary file modified
BIN
-110 Bytes
(99%)
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.