Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/tdl-generated-code-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "tdl-generated-code-checks"

on:
pull_request:
push:
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"
workflow_dispatch:

concurrency:
group: "${{github.workflow}}-${{github.ref}}"
# Cancel in-progress jobs for efficiency
cancel-in-progress: true

jobs:
antlr-code-committed:
name: "antlr-code-committed"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
with:
submodules: "recursive"

- name: "Set up Java"
uses: "actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00"
with:
distribution: "temurin"
java-version: "11"

- name: "Install task"
shell: "bash"
run: "npm install -g @go-task/cli"

- name: "Generate parsers"
shell: "bash"
run: "task build:tdl-generate-parsers"

- name: "Check if the generated parsers are the latest"
shell: "bash"
run:
|
git status --porcelain \
src/spider/tdl/parser/antlr_generated \
| grep . > /dev/null \
&& exit 1 \
|| exit 0
5 changes: 5 additions & 0 deletions src/spider/tdl/parser/TaskDefLang.g4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
grammar TaskDefLang;

start: EOF ;

SPACE: [ \t\r\n] -> skip ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

// Generated from tdl/parser/TaskDefLang.g4 by ANTLR 4.13.2


#include "TaskDefLangBaseVisitor.h"


using namespace spider::tdl::parser::antlr_generated;

27 changes: 27 additions & 0 deletions src/spider/tdl/parser/antlr_generated/TaskDefLangBaseVisitor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

// Generated from tdl/parser/TaskDefLang.g4 by ANTLR 4.13.2

#pragma once


#include "antlr4-runtime.h"
#include "TaskDefLangVisitor.h"


namespace spider::tdl::parser::antlr_generated {

/**
* This class provides an empty implementation of TaskDefLangVisitor, which can be
* extended to create a visitor which only needs to handle a subset of the available methods.
*/
class TaskDefLangBaseVisitor : public TaskDefLangVisitor {
public:

virtual std::any visitStart(TaskDefLangParser::StartContext *ctx) override {
return visitChildren(ctx);
}


};

} // namespace spider::tdl::parser::antlr_generated
141 changes: 141 additions & 0 deletions src/spider/tdl/parser/antlr_generated/TaskDefLangLexer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@

// Generated from tdl/parser/TaskDefLang.g4 by ANTLR 4.13.2


#include "TaskDefLangLexer.h"


using namespace antlr4;

using namespace spider::tdl::parser::antlr_generated;


using namespace antlr4;

namespace {

struct TaskDefLangLexerStaticData final {
TaskDefLangLexerStaticData(std::vector<std::string> ruleNames,
std::vector<std::string> channelNames,
std::vector<std::string> modeNames,
std::vector<std::string> literalNames,
std::vector<std::string> symbolicNames)
: ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)),
modeNames(std::move(modeNames)), literalNames(std::move(literalNames)),
symbolicNames(std::move(symbolicNames)),
vocabulary(this->literalNames, this->symbolicNames) {}

TaskDefLangLexerStaticData(const TaskDefLangLexerStaticData&) = delete;
TaskDefLangLexerStaticData(TaskDefLangLexerStaticData&&) = delete;
TaskDefLangLexerStaticData& operator=(const TaskDefLangLexerStaticData&) = delete;
TaskDefLangLexerStaticData& operator=(TaskDefLangLexerStaticData&&) = delete;

std::vector<antlr4::dfa::DFA> decisionToDFA;
antlr4::atn::PredictionContextCache sharedContextCache;
const std::vector<std::string> ruleNames;
const std::vector<std::string> channelNames;
const std::vector<std::string> modeNames;
const std::vector<std::string> literalNames;
const std::vector<std::string> symbolicNames;
const antlr4::dfa::Vocabulary vocabulary;
antlr4::atn::SerializedATNView serializedATN;
std::unique_ptr<antlr4::atn::ATN> atn;
};

::antlr4::internal::OnceFlag taskdeflanglexerLexerOnceFlag;
#if ANTLR4_USE_THREAD_LOCAL_CACHE
static thread_local
#endif
std::unique_ptr<TaskDefLangLexerStaticData> taskdeflanglexerLexerStaticData = nullptr;

void taskdeflanglexerLexerInitialize() {
#if ANTLR4_USE_THREAD_LOCAL_CACHE
if (taskdeflanglexerLexerStaticData != nullptr) {
return;
}
#else
assert(taskdeflanglexerLexerStaticData == nullptr);
#endif
auto staticData = std::make_unique<TaskDefLangLexerStaticData>(
std::vector<std::string>{
"SPACE"
},
std::vector<std::string>{
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
},
std::vector<std::string>{
"DEFAULT_MODE"
},
std::vector<std::string>{
},
std::vector<std::string>{
"", "SPACE"
}
);
static const int32_t serializedATNSegment[] = {
4,0,1,7,6,-1,2,0,7,0,1,0,1,0,1,0,1,0,0,0,1,1,1,1,0,1,3,0,9,10,13,13,32,
32,6,0,1,1,0,0,0,1,3,1,0,0,0,3,4,7,0,0,0,4,5,1,0,0,0,5,6,6,0,0,0,6,2,
1,0,0,0,1,0,1,6,0,0
};
staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0]));

antlr4::atn::ATNDeserializer deserializer;
staticData->atn = deserializer.deserialize(staticData->serializedATN);

const size_t count = staticData->atn->getNumberOfDecisions();
staticData->decisionToDFA.reserve(count);
for (size_t i = 0; i < count; i++) {
staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i);
}
taskdeflanglexerLexerStaticData = std::move(staticData);
}

}

TaskDefLangLexer::TaskDefLangLexer(CharStream *input) : Lexer(input) {
TaskDefLangLexer::initialize();
_interpreter = new atn::LexerATNSimulator(this, *taskdeflanglexerLexerStaticData->atn, taskdeflanglexerLexerStaticData->decisionToDFA, taskdeflanglexerLexerStaticData->sharedContextCache);
}

TaskDefLangLexer::~TaskDefLangLexer() {
delete _interpreter;
}

std::string TaskDefLangLexer::getGrammarFileName() const {
return "TaskDefLang.g4";
}

const std::vector<std::string>& TaskDefLangLexer::getRuleNames() const {
return taskdeflanglexerLexerStaticData->ruleNames;
}

const std::vector<std::string>& TaskDefLangLexer::getChannelNames() const {
return taskdeflanglexerLexerStaticData->channelNames;
}

const std::vector<std::string>& TaskDefLangLexer::getModeNames() const {
return taskdeflanglexerLexerStaticData->modeNames;
}

const dfa::Vocabulary& TaskDefLangLexer::getVocabulary() const {
return taskdeflanglexerLexerStaticData->vocabulary;
}

antlr4::atn::SerializedATNView TaskDefLangLexer::getSerializedATN() const {
return taskdeflanglexerLexerStaticData->serializedATN;
}

const atn::ATN& TaskDefLangLexer::getATN() const {
return *taskdeflanglexerLexerStaticData->atn;
}




void TaskDefLangLexer::initialize() {
#if ANTLR4_USE_THREAD_LOCAL_CACHE
taskdeflanglexerLexerInitialize();
#else
::antlr4::internal::call_once(taskdeflanglexerLexerOnceFlag, taskdeflanglexerLexerInitialize);
#endif
}
51 changes: 51 additions & 0 deletions src/spider/tdl/parser/antlr_generated/TaskDefLangLexer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

// Generated from tdl/parser/TaskDefLang.g4 by ANTLR 4.13.2

#pragma once


#include "antlr4-runtime.h"


namespace spider::tdl::parser::antlr_generated {


class TaskDefLangLexer : public antlr4::Lexer {
public:
enum {
SPACE = 1
};

explicit TaskDefLangLexer(antlr4::CharStream *input);

~TaskDefLangLexer() override;


std::string getGrammarFileName() const override;

const std::vector<std::string>& getRuleNames() const override;

const std::vector<std::string>& getChannelNames() const override;

const std::vector<std::string>& getModeNames() const override;

const antlr4::dfa::Vocabulary& getVocabulary() const override;

antlr4::atn::SerializedATNView getSerializedATN() const override;

const antlr4::atn::ATN& getATN() const override;

// By default the static state used to implement the lexer is lazily initialized during the first
// call to the constructor. You can call this function if you wish to initialize the static state
// ahead of time.
static void initialize();

private:

// Individual action functions triggered by action() above.

// Individual semantic predicate functions triggered by sempred() above.

};

} // namespace spider::tdl::parser::antlr_generated
Loading