Host workspace repositories on Central Gitea
This commit is contained in:
@@ -0,0 +1,535 @@
|
||||
|
||||
import * as antlr from "antlr4ng";
|
||||
import { Token } from "antlr4ng";
|
||||
|
||||
import { QuixosLockVisitor } from "./QuixosLockVisitor.js";
|
||||
|
||||
// for running tests with parameters, TODO: discuss strategy for typed parameters in CI
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
type int = number;
|
||||
|
||||
|
||||
export class QuixosLockParser extends antlr.Parser {
|
||||
public static readonly QUIXOS_LOCK = 1;
|
||||
public static readonly VERSION = 2;
|
||||
public static readonly QUIXOS = 3;
|
||||
public static readonly SOURCE = 4;
|
||||
public static readonly INTERFACE = 5;
|
||||
public static readonly PACKAGE = 6;
|
||||
public static readonly REPOSITORY = 7;
|
||||
public static readonly COMMIT = 8;
|
||||
public static readonly LBRACE = 9;
|
||||
public static readonly RBRACE = 10;
|
||||
public static readonly SEMI = 11;
|
||||
public static readonly INTEGER = 12;
|
||||
public static readonly IDENTIFIER = 13;
|
||||
public static readonly STRING_LITERAL = 14;
|
||||
public static readonly LINE_COMMENT = 15;
|
||||
public static readonly BLOCK_COMMENT = 16;
|
||||
public static readonly WS = 17;
|
||||
public static readonly RULE_document = 0;
|
||||
public static readonly RULE_quixosEntry = 1;
|
||||
public static readonly RULE_resourceEntry = 2;
|
||||
public static readonly RULE_resourceKind = 3;
|
||||
public static readonly RULE_sourceBlock = 4;
|
||||
public static readonly RULE_identifier = 5;
|
||||
public static readonly RULE_stringLiteral = 6;
|
||||
|
||||
public static readonly literalNames = [
|
||||
null, "'quixos-lock'", "'version'", "'quixos'", "'source'", "'interface'",
|
||||
"'package'", "'repository'", "'commit'", "'{'", "'}'", "';'"
|
||||
];
|
||||
|
||||
public static readonly symbolicNames = [
|
||||
null, "QUIXOS_LOCK", "VERSION", "QUIXOS", "SOURCE", "INTERFACE",
|
||||
"PACKAGE", "REPOSITORY", "COMMIT", "LBRACE", "RBRACE", "SEMI", "INTEGER",
|
||||
"IDENTIFIER", "STRING_LITERAL", "LINE_COMMENT", "BLOCK_COMMENT",
|
||||
"WS"
|
||||
];
|
||||
public static readonly ruleNames = [
|
||||
"document", "quixosEntry", "resourceEntry", "resourceKind", "sourceBlock",
|
||||
"identifier", "stringLiteral",
|
||||
];
|
||||
|
||||
public get grammarFileName(): string { return "QuixosLock.g4"; }
|
||||
public get literalNames(): (string | null)[] { return QuixosLockParser.literalNames; }
|
||||
public get symbolicNames(): (string | null)[] { return QuixosLockParser.symbolicNames; }
|
||||
public get ruleNames(): string[] { return QuixosLockParser.ruleNames; }
|
||||
public get serializedATN(): number[] { return QuixosLockParser._serializedATN; }
|
||||
|
||||
protected createFailedPredicateException(predicate?: string, message?: string): antlr.FailedPredicateException {
|
||||
return new antlr.FailedPredicateException(this, predicate, message);
|
||||
}
|
||||
|
||||
public constructor(input: antlr.TokenStream) {
|
||||
super(input);
|
||||
this.interpreter = new antlr.ParserATNSimulator(this, QuixosLockParser._ATN, QuixosLockParser.decisionsToDFA, new antlr.PredictionContextCache());
|
||||
}
|
||||
public document(): DocumentContext {
|
||||
let localContext = new DocumentContext(this.context, this.state);
|
||||
this.enterRule(localContext, 0, QuixosLockParser.RULE_document);
|
||||
let _la: number;
|
||||
try {
|
||||
this.enterOuterAlt(localContext, 1);
|
||||
{
|
||||
this.state = 14;
|
||||
this.match(QuixosLockParser.QUIXOS_LOCK);
|
||||
this.state = 15;
|
||||
this.match(QuixosLockParser.VERSION);
|
||||
this.state = 16;
|
||||
this.match(QuixosLockParser.INTEGER);
|
||||
this.state = 17;
|
||||
this.match(QuixosLockParser.LBRACE);
|
||||
this.state = 18;
|
||||
this.quixosEntry();
|
||||
this.state = 22;
|
||||
this.errorHandler.sync(this);
|
||||
_la = this.tokenStream.LA(1);
|
||||
while (_la === 5 || _la === 6) {
|
||||
{
|
||||
{
|
||||
this.state = 19;
|
||||
this.resourceEntry();
|
||||
}
|
||||
}
|
||||
this.state = 24;
|
||||
this.errorHandler.sync(this);
|
||||
_la = this.tokenStream.LA(1);
|
||||
}
|
||||
this.state = 25;
|
||||
this.match(QuixosLockParser.RBRACE);
|
||||
this.state = 26;
|
||||
this.match(QuixosLockParser.EOF);
|
||||
}
|
||||
}
|
||||
catch (re) {
|
||||
if (re instanceof antlr.RecognitionException) {
|
||||
this.errorHandler.reportError(this, re);
|
||||
this.errorHandler.recover(this, re);
|
||||
} else {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.exitRule();
|
||||
}
|
||||
return localContext;
|
||||
}
|
||||
public quixosEntry(): QuixosEntryContext {
|
||||
let localContext = new QuixosEntryContext(this.context, this.state);
|
||||
this.enterRule(localContext, 2, QuixosLockParser.RULE_quixosEntry);
|
||||
try {
|
||||
this.enterOuterAlt(localContext, 1);
|
||||
{
|
||||
this.state = 28;
|
||||
this.match(QuixosLockParser.QUIXOS);
|
||||
this.state = 29;
|
||||
this.match(QuixosLockParser.SOURCE);
|
||||
this.state = 30;
|
||||
this.sourceBlock();
|
||||
}
|
||||
}
|
||||
catch (re) {
|
||||
if (re instanceof antlr.RecognitionException) {
|
||||
this.errorHandler.reportError(this, re);
|
||||
this.errorHandler.recover(this, re);
|
||||
} else {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.exitRule();
|
||||
}
|
||||
return localContext;
|
||||
}
|
||||
public resourceEntry(): ResourceEntryContext {
|
||||
let localContext = new ResourceEntryContext(this.context, this.state);
|
||||
this.enterRule(localContext, 4, QuixosLockParser.RULE_resourceEntry);
|
||||
try {
|
||||
this.enterOuterAlt(localContext, 1);
|
||||
{
|
||||
this.state = 32;
|
||||
this.resourceKind();
|
||||
this.state = 33;
|
||||
this.identifier();
|
||||
this.state = 34;
|
||||
this.match(QuixosLockParser.SOURCE);
|
||||
this.state = 35;
|
||||
this.sourceBlock();
|
||||
}
|
||||
}
|
||||
catch (re) {
|
||||
if (re instanceof antlr.RecognitionException) {
|
||||
this.errorHandler.reportError(this, re);
|
||||
this.errorHandler.recover(this, re);
|
||||
} else {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.exitRule();
|
||||
}
|
||||
return localContext;
|
||||
}
|
||||
public resourceKind(): ResourceKindContext {
|
||||
let localContext = new ResourceKindContext(this.context, this.state);
|
||||
this.enterRule(localContext, 6, QuixosLockParser.RULE_resourceKind);
|
||||
let _la: number;
|
||||
try {
|
||||
this.enterOuterAlt(localContext, 1);
|
||||
{
|
||||
this.state = 37;
|
||||
_la = this.tokenStream.LA(1);
|
||||
if(!(_la === 5 || _la === 6)) {
|
||||
this.errorHandler.recoverInline(this);
|
||||
}
|
||||
else {
|
||||
this.errorHandler.reportMatch(this);
|
||||
this.consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (re) {
|
||||
if (re instanceof antlr.RecognitionException) {
|
||||
this.errorHandler.reportError(this, re);
|
||||
this.errorHandler.recover(this, re);
|
||||
} else {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.exitRule();
|
||||
}
|
||||
return localContext;
|
||||
}
|
||||
public sourceBlock(): SourceBlockContext {
|
||||
let localContext = new SourceBlockContext(this.context, this.state);
|
||||
this.enterRule(localContext, 8, QuixosLockParser.RULE_sourceBlock);
|
||||
try {
|
||||
this.enterOuterAlt(localContext, 1);
|
||||
{
|
||||
this.state = 39;
|
||||
this.match(QuixosLockParser.LBRACE);
|
||||
this.state = 40;
|
||||
this.match(QuixosLockParser.REPOSITORY);
|
||||
this.state = 41;
|
||||
this.stringLiteral();
|
||||
this.state = 42;
|
||||
this.match(QuixosLockParser.SEMI);
|
||||
this.state = 43;
|
||||
this.match(QuixosLockParser.COMMIT);
|
||||
this.state = 44;
|
||||
this.stringLiteral();
|
||||
this.state = 45;
|
||||
this.match(QuixosLockParser.SEMI);
|
||||
this.state = 46;
|
||||
this.match(QuixosLockParser.RBRACE);
|
||||
}
|
||||
}
|
||||
catch (re) {
|
||||
if (re instanceof antlr.RecognitionException) {
|
||||
this.errorHandler.reportError(this, re);
|
||||
this.errorHandler.recover(this, re);
|
||||
} else {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.exitRule();
|
||||
}
|
||||
return localContext;
|
||||
}
|
||||
public identifier(): IdentifierContext {
|
||||
let localContext = new IdentifierContext(this.context, this.state);
|
||||
this.enterRule(localContext, 10, QuixosLockParser.RULE_identifier);
|
||||
try {
|
||||
this.enterOuterAlt(localContext, 1);
|
||||
{
|
||||
this.state = 48;
|
||||
this.match(QuixosLockParser.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
catch (re) {
|
||||
if (re instanceof antlr.RecognitionException) {
|
||||
this.errorHandler.reportError(this, re);
|
||||
this.errorHandler.recover(this, re);
|
||||
} else {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.exitRule();
|
||||
}
|
||||
return localContext;
|
||||
}
|
||||
public stringLiteral(): StringLiteralContext {
|
||||
let localContext = new StringLiteralContext(this.context, this.state);
|
||||
this.enterRule(localContext, 12, QuixosLockParser.RULE_stringLiteral);
|
||||
try {
|
||||
this.enterOuterAlt(localContext, 1);
|
||||
{
|
||||
this.state = 50;
|
||||
this.match(QuixosLockParser.STRING_LITERAL);
|
||||
}
|
||||
}
|
||||
catch (re) {
|
||||
if (re instanceof antlr.RecognitionException) {
|
||||
this.errorHandler.reportError(this, re);
|
||||
this.errorHandler.recover(this, re);
|
||||
} else {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.exitRule();
|
||||
}
|
||||
return localContext;
|
||||
}
|
||||
|
||||
public static readonly _serializedATN: number[] = [
|
||||
4,1,17,53,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
|
||||
6,1,0,1,0,1,0,1,0,1,0,1,0,5,0,21,8,0,10,0,12,0,24,9,0,1,0,1,0,1,
|
||||
0,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,4,1,4,1,
|
||||
4,1,4,1,4,1,4,1,4,1,5,1,5,1,6,1,6,1,6,0,0,7,0,2,4,6,8,10,12,0,1,
|
||||
1,0,5,6,46,0,14,1,0,0,0,2,28,1,0,0,0,4,32,1,0,0,0,6,37,1,0,0,0,8,
|
||||
39,1,0,0,0,10,48,1,0,0,0,12,50,1,0,0,0,14,15,5,1,0,0,15,16,5,2,0,
|
||||
0,16,17,5,12,0,0,17,18,5,9,0,0,18,22,3,2,1,0,19,21,3,4,2,0,20,19,
|
||||
1,0,0,0,21,24,1,0,0,0,22,20,1,0,0,0,22,23,1,0,0,0,23,25,1,0,0,0,
|
||||
24,22,1,0,0,0,25,26,5,10,0,0,26,27,5,0,0,1,27,1,1,0,0,0,28,29,5,
|
||||
3,0,0,29,30,5,4,0,0,30,31,3,8,4,0,31,3,1,0,0,0,32,33,3,6,3,0,33,
|
||||
34,3,10,5,0,34,35,5,4,0,0,35,36,3,8,4,0,36,5,1,0,0,0,37,38,7,0,0,
|
||||
0,38,7,1,0,0,0,39,40,5,9,0,0,40,41,5,7,0,0,41,42,3,12,6,0,42,43,
|
||||
5,11,0,0,43,44,5,8,0,0,44,45,3,12,6,0,45,46,5,11,0,0,46,47,5,10,
|
||||
0,0,47,9,1,0,0,0,48,49,5,13,0,0,49,11,1,0,0,0,50,51,5,14,0,0,51,
|
||||
13,1,0,0,0,1,22
|
||||
];
|
||||
|
||||
private static __ATN: antlr.ATN;
|
||||
public static get _ATN(): antlr.ATN {
|
||||
if (!QuixosLockParser.__ATN) {
|
||||
QuixosLockParser.__ATN = new antlr.ATNDeserializer().deserialize(QuixosLockParser._serializedATN);
|
||||
}
|
||||
|
||||
return QuixosLockParser.__ATN;
|
||||
}
|
||||
|
||||
|
||||
private static readonly vocabulary = new antlr.Vocabulary(QuixosLockParser.literalNames, QuixosLockParser.symbolicNames, []);
|
||||
|
||||
public override get vocabulary(): antlr.Vocabulary {
|
||||
return QuixosLockParser.vocabulary;
|
||||
}
|
||||
|
||||
private static readonly decisionsToDFA = QuixosLockParser._ATN.decisionToState.map( (ds: antlr.DecisionState, index: number) => new antlr.DFA(ds, index) );
|
||||
}
|
||||
|
||||
export class DocumentContext extends antlr.ParserRuleContext {
|
||||
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
public QUIXOS_LOCK(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.QUIXOS_LOCK, 0)!;
|
||||
}
|
||||
public VERSION(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.VERSION, 0)!;
|
||||
}
|
||||
public INTEGER(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.INTEGER, 0)!;
|
||||
}
|
||||
public LBRACE(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.LBRACE, 0)!;
|
||||
}
|
||||
public quixosEntry(): QuixosEntryContext {
|
||||
return this.getRuleContext(0, QuixosEntryContext)!;
|
||||
}
|
||||
public RBRACE(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.RBRACE, 0)!;
|
||||
}
|
||||
public EOF(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.EOF, 0)!;
|
||||
}
|
||||
public resourceEntry(): ResourceEntryContext[];
|
||||
public resourceEntry(i: number): ResourceEntryContext | null;
|
||||
public resourceEntry(i?: number): ResourceEntryContext[] | ResourceEntryContext | null {
|
||||
if (i === undefined) {
|
||||
return this.getRuleContexts(ResourceEntryContext);
|
||||
}
|
||||
|
||||
return this.getRuleContext(i, ResourceEntryContext);
|
||||
}
|
||||
public override get ruleIndex(): number {
|
||||
return QuixosLockParser.RULE_document;
|
||||
}
|
||||
public override accept<Result>(visitor: QuixosLockVisitor<Result>): Result | null {
|
||||
if (visitor.visitDocument) {
|
||||
return visitor.visitDocument(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class QuixosEntryContext extends antlr.ParserRuleContext {
|
||||
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
public QUIXOS(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.QUIXOS, 0)!;
|
||||
}
|
||||
public SOURCE(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.SOURCE, 0)!;
|
||||
}
|
||||
public sourceBlock(): SourceBlockContext {
|
||||
return this.getRuleContext(0, SourceBlockContext)!;
|
||||
}
|
||||
public override get ruleIndex(): number {
|
||||
return QuixosLockParser.RULE_quixosEntry;
|
||||
}
|
||||
public override accept<Result>(visitor: QuixosLockVisitor<Result>): Result | null {
|
||||
if (visitor.visitQuixosEntry) {
|
||||
return visitor.visitQuixosEntry(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class ResourceEntryContext extends antlr.ParserRuleContext {
|
||||
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
public resourceKind(): ResourceKindContext {
|
||||
return this.getRuleContext(0, ResourceKindContext)!;
|
||||
}
|
||||
public identifier(): IdentifierContext {
|
||||
return this.getRuleContext(0, IdentifierContext)!;
|
||||
}
|
||||
public SOURCE(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.SOURCE, 0)!;
|
||||
}
|
||||
public sourceBlock(): SourceBlockContext {
|
||||
return this.getRuleContext(0, SourceBlockContext)!;
|
||||
}
|
||||
public override get ruleIndex(): number {
|
||||
return QuixosLockParser.RULE_resourceEntry;
|
||||
}
|
||||
public override accept<Result>(visitor: QuixosLockVisitor<Result>): Result | null {
|
||||
if (visitor.visitResourceEntry) {
|
||||
return visitor.visitResourceEntry(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class ResourceKindContext extends antlr.ParserRuleContext {
|
||||
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
public INTERFACE(): antlr.TerminalNode | null {
|
||||
return this.getToken(QuixosLockParser.INTERFACE, 0);
|
||||
}
|
||||
public PACKAGE(): antlr.TerminalNode | null {
|
||||
return this.getToken(QuixosLockParser.PACKAGE, 0);
|
||||
}
|
||||
public override get ruleIndex(): number {
|
||||
return QuixosLockParser.RULE_resourceKind;
|
||||
}
|
||||
public override accept<Result>(visitor: QuixosLockVisitor<Result>): Result | null {
|
||||
if (visitor.visitResourceKind) {
|
||||
return visitor.visitResourceKind(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class SourceBlockContext extends antlr.ParserRuleContext {
|
||||
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
public LBRACE(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.LBRACE, 0)!;
|
||||
}
|
||||
public REPOSITORY(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.REPOSITORY, 0)!;
|
||||
}
|
||||
public stringLiteral(): StringLiteralContext[];
|
||||
public stringLiteral(i: number): StringLiteralContext | null;
|
||||
public stringLiteral(i?: number): StringLiteralContext[] | StringLiteralContext | null {
|
||||
if (i === undefined) {
|
||||
return this.getRuleContexts(StringLiteralContext);
|
||||
}
|
||||
|
||||
return this.getRuleContext(i, StringLiteralContext);
|
||||
}
|
||||
public SEMI(): antlr.TerminalNode[];
|
||||
public SEMI(i: number): antlr.TerminalNode | null;
|
||||
public SEMI(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] {
|
||||
if (i === undefined) {
|
||||
return this.getTokens(QuixosLockParser.SEMI);
|
||||
} else {
|
||||
return this.getToken(QuixosLockParser.SEMI, i);
|
||||
}
|
||||
}
|
||||
public COMMIT(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.COMMIT, 0)!;
|
||||
}
|
||||
public RBRACE(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.RBRACE, 0)!;
|
||||
}
|
||||
public override get ruleIndex(): number {
|
||||
return QuixosLockParser.RULE_sourceBlock;
|
||||
}
|
||||
public override accept<Result>(visitor: QuixosLockVisitor<Result>): Result | null {
|
||||
if (visitor.visitSourceBlock) {
|
||||
return visitor.visitSourceBlock(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class IdentifierContext extends antlr.ParserRuleContext {
|
||||
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
public IDENTIFIER(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.IDENTIFIER, 0)!;
|
||||
}
|
||||
public override get ruleIndex(): number {
|
||||
return QuixosLockParser.RULE_identifier;
|
||||
}
|
||||
public override accept<Result>(visitor: QuixosLockVisitor<Result>): Result | null {
|
||||
if (visitor.visitIdentifier) {
|
||||
return visitor.visitIdentifier(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class StringLiteralContext extends antlr.ParserRuleContext {
|
||||
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
|
||||
super(parent, invokingState);
|
||||
}
|
||||
public STRING_LITERAL(): antlr.TerminalNode {
|
||||
return this.getToken(QuixosLockParser.STRING_LITERAL, 0)!;
|
||||
}
|
||||
public override get ruleIndex(): number {
|
||||
return QuixosLockParser.RULE_stringLiteral;
|
||||
}
|
||||
public override accept<Result>(visitor: QuixosLockVisitor<Result>): Result | null {
|
||||
if (visitor.visitStringLiteral) {
|
||||
return visitor.visitStringLiteral(this);
|
||||
} else {
|
||||
return visitor.visitChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user