Skip to content

Commit

Permalink
Removed @OverRide annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-lischke committed Oct 7, 2024
1 parent 3e8df3e commit 53aa60b
Show file tree
Hide file tree
Showing 26 changed files with 62 additions and 143 deletions.
8 changes: 4 additions & 4 deletions src/tree-walkers/LeftRecursiveRuleWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ export class LeftRecursiveRuleWalker extends TreeParser {
this.special = LeftRecursiveRuleWalker.DFA11_special;
this.transition = LeftRecursiveRuleWalker.DFA11_transition;
}
@Override

public getDescription(): string {
return "()* loopback of 124:35: ( element )*";
}
Expand All @@ -595,7 +595,7 @@ export class LeftRecursiveRuleWalker extends TreeParser {
this.special = LeftRecursiveRuleWalker.DFA14_special;
this.transition = LeftRecursiveRuleWalker.DFA14_transition;
}
@Override

public getDescription(): string {
return "()+ loopback of 130:4: ( element )+";
}
Expand Down Expand Up @@ -650,9 +650,9 @@ export class LeftRecursiveRuleWalker extends TreeParser {
return [];
}

@Override

public getTokenNames(): string[] { return LeftRecursiveRuleWalker.tokenNames; }
@Override

public getGrammarFileName(): string { return "org/antlr/v4/parse/LeftRecursiveRuleWalker.g"; } // how many alts for this rule total?

public setAltAssoc(altTree: AltAST, alt: number): void { }
Expand Down
48 changes: 24 additions & 24 deletions tool/src/org/antlr/v4/codegen/BlankOutputModelFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,81 +26,81 @@ import { GrammarAST } from "../tool/ast/GrammarAST.js";


export abstract class BlankOutputModelFactory implements OutputModelFactory {
@Override

public parserFile(fileName: string): ParserFile { return null; }

@Override

public parser(file: ParserFile): Parser { return null; }

@Override

public rule(r: Rule): RuleFunction { return null; }

@Override

public rulePostamble(function: RuleFunction, r: Rule): Array<SrcOp> { return null; }

@Override

public lexerFile(fileName: string): LexerFile { return null; }

@Override

public lexer(file: LexerFile): Lexer { return null; }

// ALTERNATIVES / ELEMENTS

@Override

public alternative(alt: Alternative, outerMost: boolean): CodeBlockForAlt { return null; }

@Override

public finishAlternative(blk: CodeBlockForAlt, ops: Array<SrcOp>): CodeBlockForAlt { return blk; }

@Override

public epsilon(alt: Alternative, outerMost: boolean): CodeBlockForAlt { return null; }

@Override

public ruleRef(ID: GrammarAST, label: GrammarAST, args: GrammarAST): Array<SrcOp> { return null; }

@Override

public tokenRef(ID: GrammarAST, label: GrammarAST, args: GrammarAST): Array<SrcOp> { return null; }

@Override

public stringRef(ID: GrammarAST, label: GrammarAST): Array<SrcOp> { return this.tokenRef(ID, label, null); }

@Override

public set(setAST: GrammarAST, label: GrammarAST, invert: boolean): Array<SrcOp> { return null; }

@Override

public wildcard(ast: GrammarAST, labelAST: GrammarAST): Array<SrcOp> { return null; }

// ACTIONS

@Override

public action(ast: ActionAST): Array<SrcOp> { return null; }

@Override

public sempred(ast: ActionAST): Array<SrcOp> { return null; }

// BLOCKS

@Override

public getChoiceBlock(blkAST: BlockAST, alts: Array<CodeBlockForAlt>, label: GrammarAST): Choice { return null; }

@Override

public getEBNFBlock(ebnfRoot: GrammarAST, alts: Array<CodeBlockForAlt>): Choice { return null; }

@Override

public getLL1ChoiceBlock(blkAST: BlockAST, alts: Array<CodeBlockForAlt>): Choice { return null; }

@Override

public getComplexChoiceBlock(blkAST: BlockAST, alts: Array<CodeBlockForAlt>): Choice { return null; }

@Override

public getLL1EBNFBlock(ebnfRoot: GrammarAST, alts: Array<CodeBlockForAlt>): Choice { return null; }

@Override

public getComplexEBNFBlock(ebnfRoot: GrammarAST, alts: Array<CodeBlockForAlt>): Choice { return null; }

@Override

public getLL1Test(look: IntervalSet, blkAST: GrammarAST): Array<SrcOp> { return null; }

@Override

public needsImplicitLabel(ID: GrammarAST, op: LabeledOp): boolean { return false; }
}
24 changes: 12 additions & 12 deletions tool/src/org/antlr/v4/codegen/DefaultOutputModelFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ export abstract class DefaultOutputModelFactory extends BlankOutputModelFactory
}


@Override

public setController(controller: OutputModelController): void {
this.controller = controller;
}

@Override

public getController(): OutputModelController {
return this.controller;
}

@Override

public override rulePostamble(function: RuleFunction, r: Rule): Array<SrcOp> {
if (r.namedActions.containsKey("after") || r.namedActions.containsKey("finally")) {
// See OutputModelController.buildLeftRecursiveRuleFunction
Expand All @@ -106,30 +106,30 @@ export abstract class DefaultOutputModelFactory extends BlankOutputModelFactory
// Convenience methods


@Override

public getGrammar(): Grammar { return this.g; }

@Override

public getGenerator(): CodeGenerator { return this.gen; }

@Override

public getRoot(): OutputModelObject { return this.controller.getRoot(); }

@Override

public getCurrentRuleFunction(): RuleFunction { return this.controller.getCurrentRuleFunction(); }

@Override

public getCurrentOuterMostAlt(): Alternative { return this.controller.getCurrentOuterMostAlt(); }

@Override

public getCurrentBlock(): CodeBlock { return this.controller.getCurrentBlock(); }

@Override

public getCurrentOuterMostAlternativeBlock(): CodeBlockForOuterMostAlt { return this.controller.getCurrentOuterMostAlternativeBlock(); }

@Override

public getCodeBlockLevel(): number { return this.controller.codeBlockLevel; }

@Override

public getTreeLevel(): number { return this.controller.treeLevel; }
}
20 changes: 0 additions & 20 deletions tool/src/org/antlr/v4/codegen/ParserFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,14 @@ import { TerminalAST } from "../tool/ast/TerminalAST.js";
export class ParserFactory extends DefaultOutputModelFactory {
public constructor(gen: CodeGenerator) { super(gen); }

@Override
public override parserFile(fileName: string): ParserFile {
return new ParserFile(this, fileName);
}

@Override
public override parser(file: ParserFile): Parser {
return new Parser(this, file);
}

@Override
public override rule(r: Rule): RuleFunction {
if (r instanceof LeftRecursiveRule) {
return new LeftRecursiveRuleFunction(this, r);
Expand All @@ -75,12 +72,10 @@ export class ParserFactory extends DefaultOutputModelFactory {
}
}

@Override
public override epsilon(alt: Alternative, outerMost: boolean): CodeBlockForAlt {
return this.alternative(alt, outerMost);
}

@Override
public override alternative(alt: Alternative, outerMost: boolean): CodeBlockForAlt {
if (outerMost) {
return new CodeBlockForOuterMostAlt(this, alt);
Expand All @@ -89,20 +84,16 @@ export class ParserFactory extends DefaultOutputModelFactory {
return new CodeBlockForAlt(this);
}

@Override
public override finishAlternative(blk: CodeBlockForAlt, ops: SrcOp[]): CodeBlockForAlt {
blk.ops = ops;

return blk;
}

@Override
public override action(ast: ActionAST): SrcOp[] { return ParserFactory.list(new Action(this, ast)); }

@Override
public override sempred(ast: ActionAST): SrcOp[] { return ParserFactory.list(new SemPred(this, ast)); }

@Override
public override ruleRef(ID: GrammarAST, label: GrammarAST, args: GrammarAST): SrcOp[] {
const invokeOp = new InvokeRule(this, ID, label);
// If no manual label and action refs as token/rule not label, we need to define implicit label
Expand All @@ -115,7 +106,6 @@ export class ParserFactory extends DefaultOutputModelFactory {
return ParserFactory.list(invokeOp, listLabelOp);
}

@Override
public override tokenRef(ID: GrammarAST, labelAST: GrammarAST, args: GrammarAST): SrcOp[] {
const matchOp = new MatchToken(this, ID as TerminalAST);
if (labelAST !== null) {
Expand Down Expand Up @@ -158,7 +148,6 @@ export class ParserFactory extends DefaultOutputModelFactory {
return new TokenListDecl(this, this.gen.getTarget().getListLabel(label));
}

@Override
public override set(setAST: GrammarAST, labelAST: GrammarAST, invert: boolean): SrcOp[] {
let matchOp: MatchSet;
if (invert) {
Expand Down Expand Up @@ -192,7 +181,6 @@ export class ParserFactory extends DefaultOutputModelFactory {
return ParserFactory.list(matchOp, listLabelOp);
}

@Override
public override wildcard(ast: GrammarAST, labelAST: GrammarAST): SrcOp[] {
const wild = new Wildcard(this, ast);
// TODO: dup with tokenRef
Expand All @@ -215,7 +203,6 @@ export class ParserFactory extends DefaultOutputModelFactory {
return ParserFactory.list(wild, listLabelOp);
}

@Override
public override getChoiceBlock(blkAST: BlockAST, alts: CodeBlockForAlt[], labelAST: GrammarAST): Choice {
const decision = (blkAST.atnState as DecisionState).decision;
let c: Choice;
Expand All @@ -241,7 +228,6 @@ export class ParserFactory extends DefaultOutputModelFactory {
return c;
}

@Override
public override getEBNFBlock(ebnfRoot: GrammarAST, alts: CodeBlockForAlt[]): Choice {
if (!this.g.tool.force_atn) {
let decision: number;
Expand All @@ -265,17 +251,14 @@ export class ParserFactory extends DefaultOutputModelFactory {
return this.getComplexEBNFBlock(ebnfRoot, alts);
}

@Override
public override getLL1ChoiceBlock(blkAST: BlockAST, alts: CodeBlockForAlt[]): Choice {
return new LL1AltBlock(this, blkAST, alts);
}

@Override
public override getComplexChoiceBlock(blkAST: BlockAST, alts: CodeBlockForAlt[]): Choice {
return new AltBlock(this, blkAST, alts);
}

@Override
public override getLL1EBNFBlock(ebnfRoot: GrammarAST, alts: CodeBlockForAlt[]): Choice {
let ebnf = 0;
if (ebnfRoot !== null) {
Expand Down Expand Up @@ -327,7 +310,6 @@ export class ParserFactory extends DefaultOutputModelFactory {
return c;
}

@Override
public override getComplexEBNFBlock(ebnfRoot: GrammarAST, alts: CodeBlockForAlt[]): Choice {
let ebnf = 0;
if (ebnfRoot !== null) {
Expand Down Expand Up @@ -358,12 +340,10 @@ export class ParserFactory extends DefaultOutputModelFactory {
return c;
}

@Override
public override getLL1Test(look: IntervalSet, blkAST: GrammarAST): SrcOp[] {
return ParserFactory.list(new TestSetInline(this, blkAST, look, this.gen.getTarget().getInlineTestSetWordSize()));
}

@Override
public override needsImplicitLabel(ID: GrammarAST, op: LabeledOp): boolean {
const currentOuterMostAlt = this.getCurrentOuterMostAlt();
const actionRefsAsToken = currentOuterMostAlt.tokenRefsInActions.containsKey(ID.getText());
Expand Down
Loading

0 comments on commit 53aa60b

Please sign in to comment.