Skip to content

Commit

Permalink
chore: update signature
Browse files Browse the repository at this point in the history
  • Loading branch information
clementdessoude committed Dec 21, 2024
1 parent b5d7f91 commit 0f7d6da
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
38 changes: 28 additions & 10 deletions packages/java-parser/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ export abstract class JavaCstVisitor<IN, OUT> implements ICstVisitor<IN, OUT> {
param?: IN
): OUT;
isDims(ctx: IsDimsCtx, param?: IN): OUT;
isFollowingVariableDeclarator(
ctx: IsFollowingVariableDeclaratorCtx,
param?: IN
): OUT;
compilationUnit(ctx: CompilationUnitCtx, param?: IN): OUT;
ordinaryCompilationUnit(ctx: OrdinaryCompilationUnitCtx, param?: IN): OUT;
modularCompilationUnit(ctx: ModularCompilationUnitCtx, param?: IN): OUT;
Expand Down Expand Up @@ -300,7 +304,7 @@ export abstract class JavaCstVisitor<IN, OUT> implements ICstVisitor<IN, OUT> {
param?: IN
): OUT;
normalLambdaParameterList(ctx: NormalLambdaParameterListCtx, param?: IN): OUT;
normalLambdaParameter(ctx: LambdaParameterCtx, param?: IN): OUT;
normalLambdaParameter(ctx: NormalLambdaParameterCtx, param?: IN): OUT;
regularLambdaParameter(ctx: RegularLambdaParameterCtx, param?: IN): OUT;
lambdaParameterType(ctx: LambdaParameterTypeCtx, param?: IN): OUT;
conciseLambdaParameter(ctx: ConciseLambdaParameterCtx, param?: IN): OUT;
Expand Down Expand Up @@ -499,6 +503,10 @@ export abstract class JavaCstVisitorWithDefaults<IN, OUT>
param?: IN
): OUT;
isDims(ctx: IsDimsCtx, param?: IN): OUT;
isFollowingVariableDeclarator(
ctx: IsFollowingVariableDeclaratorCtx,
param?: IN
): OUT;
compilationUnit(ctx: CompilationUnitCtx, param?: IN): OUT;
ordinaryCompilationUnit(ctx: OrdinaryCompilationUnitCtx, param?: IN): OUT;
modularCompilationUnit(ctx: ModularCompilationUnitCtx, param?: IN): OUT;
Expand Down Expand Up @@ -628,7 +636,7 @@ export abstract class JavaCstVisitorWithDefaults<IN, OUT>
param?: IN
): OUT;
normalLambdaParameterList(ctx: NormalLambdaParameterListCtx, param?: IN): OUT;
normalLambdaParameter(ctx: LambdaParameterCtx, param?: IN): OUT;
normalLambdaParameter(ctx: NormalLambdaParameterCtx, param?: IN): OUT;
regularLambdaParameter(ctx: RegularLambdaParameterCtx, param?: IN): OUT;
lambdaParameterType(ctx: LambdaParameterTypeCtx, param?: IN): OUT;
conciseLambdaParameter(ctx: ConciseLambdaParameterCtx, param?: IN): OUT;
Expand Down Expand Up @@ -1555,7 +1563,7 @@ export interface SimpleTypeNameCstNode extends CstNode {
}

export type SimpleTypeNameCtx = {
TypeIdentifier: TypeIdentifierCstNode[];
typeIdentifier: TypeIdentifierCstNode[];
};

export interface ConstructorBodyCstNode extends CstNode {
Expand Down Expand Up @@ -1794,6 +1802,16 @@ export type IsDimsCtx = {
RBrace?: IToken[];
};

export interface IsFollowingVariableDeclaratorCstNode extends CstNode {
name: "isFollowingVariableDeclarator";
children: IsFollowingVariableDeclaratorCtx;
}

export type IsFollowingVariableDeclaratorCtx = {
Comma: IToken[];
variableDeclarator: VariableDeclaratorCstNode[];
};

export interface CompilationUnitCstNode extends CstNode {
name: "compilationUnit";
children: CompilationUnitCtx;
Expand Down Expand Up @@ -2238,7 +2256,7 @@ export interface ElementValueCstNode extends CstNode {
}

export type ElementValueCtx = {
expression?: ExpressionCstNode[];
conditionalExpression?: ConditionalExpressionCstNode[];
elementValueArrayInitializer?: ElementValueArrayInitializerCstNode[];
annotation?: AnnotationCstNode[];
};
Expand Down Expand Up @@ -2469,8 +2487,8 @@ export interface SwitchBlockCstNode extends CstNode {

export type SwitchBlockCtx = {
LCurly: IToken[];
switchBlockStatementGroup?: SwitchBlockStatementGroupCstNode[];
switchRule?: SwitchRuleCstNode[];
switchBlockStatementGroup?: SwitchBlockStatementGroupCstNode[];
RCurly: IToken[];
};

Expand All @@ -2492,8 +2510,8 @@ export interface SwitchLabelCstNode extends CstNode {

export type SwitchLabelCtx = {
Case?: IToken[];
Comma?: IToken[];
Null?: IToken[];
Comma?: IToken[];
Default?: IToken[];
casePattern?: CasePatternCstNode[];
guard?: GuardCstNode[];
Expand Down Expand Up @@ -2888,16 +2906,16 @@ export interface NormalLambdaParameterListCstNode extends CstNode {
}

export type NormalLambdaParameterListCtx = {
normalLambdaParameter: LambdaParameterCstNode[];
normalLambdaParameter: NormalLambdaParameterCstNode[];
Comma?: IToken[];
};

export interface LambdaParameterCstNode extends CstNode {
export interface NormalLambdaParameterCstNode extends CstNode {
name: "normalLambdaParameter";
children: LambdaParameterCtx;
children: NormalLambdaParameterCtx;
}

export type LambdaParameterCtx = {
export type NormalLambdaParameterCtx = {
regularLambdaParameter?: RegularLambdaParameterCstNode[];
variableArityParameter?: VariableArityParameterCstNode[];
};
Expand Down
7 changes: 6 additions & 1 deletion packages/java-parser/scripts/generate-signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import _ from "lodash";
import path from "path";
import fs from "fs";
import JavaParser from "../src/parser";
import { fileURLToPath } from "url";

import JavaParser from "../src/parser.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const parseRule = rule => {
const children = {};
Expand Down
6 changes: 5 additions & 1 deletion packages/prettier-plugin-java/src/printers/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
FormalParameterCtx,
FormalParameterListCtx,
InstanceInitializerCtx,
InterfaceTypeListCtx,
InterfaceTypeListCtx, IsFollowingVariableDeclaratorCtx,
IToken,
MethodBodyCtx,
MethodDeclarationCtx,
Expand Down Expand Up @@ -1071,4 +1071,8 @@ export class ClassesPrettierVisitor extends BaseCstPrettierPrinter {
isDims() {
return "isDims";
}

isFollowingVariableDeclarator() {
return "isFollowingVariableDeclarator";
}
}

0 comments on commit 0f7d6da

Please sign in to comment.