add antlr

This commit is contained in:
2020-09-29 23:16:42 +05:30
parent 34754a7130
commit 2b36e74ff5
181 changed files with 14689 additions and 7 deletions

139
lib/generated/bfLexer.cpp Normal file
View File

@@ -0,0 +1,139 @@
// Generated from /home/atreya/Documents/Projects/Miscellaneous/bfc/grammar/bf.g4 by ANTLR 4.8
#include "bfLexer.h"
using namespace antlr4;
bfLexer::bfLexer(CharStream *input) : Lexer(input) {
_interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
}
bfLexer::~bfLexer() {
delete _interpreter;
}
std::string bfLexer::getGrammarFileName() const {
return "bf.g4";
}
const std::vector<std::string>& bfLexer::getRuleNames() const {
return _ruleNames;
}
const std::vector<std::string>& bfLexer::getChannelNames() const {
return _channelNames;
}
const std::vector<std::string>& bfLexer::getModeNames() const {
return _modeNames;
}
const std::vector<std::string>& bfLexer::getTokenNames() const {
return _tokenNames;
}
dfa::Vocabulary& bfLexer::getVocabulary() const {
return _vocabulary;
}
const std::vector<uint16_t> bfLexer::getSerializedATN() const {
return _serializedATN;
}
const atn::ATN& bfLexer::getATN() const {
return _atn;
}
// Static vars and initialization.
std::vector<dfa::DFA> bfLexer::_decisionToDFA;
atn::PredictionContextCache bfLexer::_sharedContextCache;
// We own the ATN which in turn owns the ATN states.
atn::ATN bfLexer::_atn;
std::vector<uint16_t> bfLexer::_serializedATN;
std::vector<std::string> bfLexer::_ruleNames = {
u8"COMMENT", u8"INPUT", u8"OUTPUT", u8"DEC", u8"INC", u8"LEFT", u8"RIGHT"
};
std::vector<std::string> bfLexer::_channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
std::vector<std::string> bfLexer::_modeNames = {
u8"DEFAULT_MODE"
};
std::vector<std::string> bfLexer::_literalNames = {
"", u8"'\\\\.*?\\\\'", u8"'?'", u8"'.'", u8"'-'", u8"'+'", u8"'>'", u8"'<'"
};
std::vector<std::string> bfLexer::_symbolicNames = {
"", u8"COMMENT", u8"INPUT", u8"OUTPUT", u8"DEC", u8"INC", u8"LEFT", u8"RIGHT"
};
dfa::Vocabulary bfLexer::_vocabulary(_literalNames, _symbolicNames);
std::vector<std::string> bfLexer::_tokenNames;
bfLexer::Initializer::Initializer() {
// This code could be in a static initializer lambda, but VS doesn't allow access to private class members from there.
for (size_t i = 0; i < _symbolicNames.size(); ++i) {
std::string name = _vocabulary.getLiteralName(i);
if (name.empty()) {
name = _vocabulary.getSymbolicName(i);
}
if (name.empty()) {
_tokenNames.push_back("<INVALID>");
} else {
_tokenNames.push_back(name);
}
}
_serializedATN = {
0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964,
0x2, 0x9, 0x27, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4,
0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7, 0x9,
0x7, 0x4, 0x8, 0x9, 0x8, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3,
0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3,
0x3, 0x3, 0x4, 0x3, 0x4, 0x3, 0x5, 0x3, 0x5, 0x3, 0x6, 0x3, 0x6, 0x3,
0x7, 0x3, 0x7, 0x3, 0x8, 0x3, 0x8, 0x2, 0x2, 0x9, 0x3, 0x3, 0x5, 0x4,
0x7, 0x5, 0x9, 0x6, 0xb, 0x7, 0xd, 0x8, 0xf, 0x9, 0x3, 0x2, 0x2, 0x2,
0x26, 0x2, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x5, 0x3, 0x2, 0x2, 0x2, 0x2,
0x7, 0x3, 0x2, 0x2, 0x2, 0x2, 0x9, 0x3, 0x2, 0x2, 0x2, 0x2, 0xb, 0x3,
0x2, 0x2, 0x2, 0x2, 0xd, 0x3, 0x2, 0x2, 0x2, 0x2, 0xf, 0x3, 0x2, 0x2,
0x2, 0x3, 0x11, 0x3, 0x2, 0x2, 0x2, 0x5, 0x1b, 0x3, 0x2, 0x2, 0x2, 0x7,
0x1d, 0x3, 0x2, 0x2, 0x2, 0x9, 0x1f, 0x3, 0x2, 0x2, 0x2, 0xb, 0x21,
0x3, 0x2, 0x2, 0x2, 0xd, 0x23, 0x3, 0x2, 0x2, 0x2, 0xf, 0x25, 0x3, 0x2,
0x2, 0x2, 0x11, 0x12, 0x7, 0x5e, 0x2, 0x2, 0x12, 0x13, 0x7, 0x5e, 0x2,
0x2, 0x13, 0x14, 0x7, 0x30, 0x2, 0x2, 0x14, 0x15, 0x7, 0x2c, 0x2, 0x2,
0x15, 0x16, 0x7, 0x41, 0x2, 0x2, 0x16, 0x17, 0x7, 0x5e, 0x2, 0x2, 0x17,
0x18, 0x7, 0x5e, 0x2, 0x2, 0x18, 0x19, 0x3, 0x2, 0x2, 0x2, 0x19, 0x1a,
0x8, 0x2, 0x2, 0x2, 0x1a, 0x4, 0x3, 0x2, 0x2, 0x2, 0x1b, 0x1c, 0x7,
0x41, 0x2, 0x2, 0x1c, 0x6, 0x3, 0x2, 0x2, 0x2, 0x1d, 0x1e, 0x7, 0x30,
0x2, 0x2, 0x1e, 0x8, 0x3, 0x2, 0x2, 0x2, 0x1f, 0x20, 0x7, 0x2f, 0x2,
0x2, 0x20, 0xa, 0x3, 0x2, 0x2, 0x2, 0x21, 0x22, 0x7, 0x2d, 0x2, 0x2,
0x22, 0xc, 0x3, 0x2, 0x2, 0x2, 0x23, 0x24, 0x7, 0x40, 0x2, 0x2, 0x24,
0xe, 0x3, 0x2, 0x2, 0x2, 0x25, 0x26, 0x7, 0x3e, 0x2, 0x2, 0x26, 0x10,
0x3, 0x2, 0x2, 0x2, 0x3, 0x2, 0x3, 0x8, 0x2, 0x2,
};
atn::ATNDeserializer deserializer;
_atn = deserializer.deserialize(_serializedATN);
size_t count = _atn.getNumberOfDecisions();
_decisionToDFA.reserve(count);
for (size_t i = 0; i < count; i++) {
_decisionToDFA.emplace_back(_atn.getDecisionState(i), i);
}
}
bfLexer::Initializer bfLexer::_init;