193 lines
8.3 KiB
C++
193 lines
8.3 KiB
C++
|
|
// Generated from /home/atreya/Documents/Projects/Miscellaneous/bfc/grammar/bfe.g4 by ANTLR 4.8
|
|
|
|
|
|
#include "bfeLexer.h"
|
|
|
|
|
|
using namespace antlr4;
|
|
|
|
|
|
bfeLexer::bfeLexer(CharStream *input) : Lexer(input) {
|
|
_interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
|
|
}
|
|
|
|
bfeLexer::~bfeLexer() {
|
|
delete _interpreter;
|
|
}
|
|
|
|
std::string bfeLexer::getGrammarFileName() const {
|
|
return "bfe.g4";
|
|
}
|
|
|
|
const std::vector<std::string>& bfeLexer::getRuleNames() const {
|
|
return _ruleNames;
|
|
}
|
|
|
|
const std::vector<std::string>& bfeLexer::getChannelNames() const {
|
|
return _channelNames;
|
|
}
|
|
|
|
const std::vector<std::string>& bfeLexer::getModeNames() const {
|
|
return _modeNames;
|
|
}
|
|
|
|
const std::vector<std::string>& bfeLexer::getTokenNames() const {
|
|
return _tokenNames;
|
|
}
|
|
|
|
dfa::Vocabulary& bfeLexer::getVocabulary() const {
|
|
return _vocabulary;
|
|
}
|
|
|
|
const std::vector<uint16_t> bfeLexer::getSerializedATN() const {
|
|
return _serializedATN;
|
|
}
|
|
|
|
const atn::ATN& bfeLexer::getATN() const {
|
|
return _atn;
|
|
}
|
|
|
|
|
|
|
|
|
|
// Static vars and initialization.
|
|
std::vector<dfa::DFA> bfeLexer::_decisionToDFA;
|
|
atn::PredictionContextCache bfeLexer::_sharedContextCache;
|
|
|
|
// We own the ATN which in turn owns the ATN states.
|
|
atn::ATN bfeLexer::_atn;
|
|
std::vector<uint16_t> bfeLexer::_serializedATN;
|
|
|
|
std::vector<std::string> bfeLexer::_ruleNames = {
|
|
u8"NEWLINE", u8"COMMENT", u8"ML_COMMENT", u8"DEF", u8"LOOPSTART", u8"LOOPEND",
|
|
u8"GRPSTART", u8"GRPEND", u8"NUMBER", u8"INPUT", u8"OUTPUT", u8"DEC",
|
|
u8"INC", u8"LEFT", u8"RIGHT", u8"EVERYTHING_ELSE", u8"WS"
|
|
};
|
|
|
|
std::vector<std::string> bfeLexer::_channelNames = {
|
|
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
|
};
|
|
|
|
std::vector<std::string> bfeLexer::_modeNames = {
|
|
u8"DEFAULT_MODE"
|
|
};
|
|
|
|
std::vector<std::string> bfeLexer::_literalNames = {
|
|
"", u8"'\n'", "", "", u8"'#'", u8"'['", u8"']'", u8"'('", u8"')'", "",
|
|
u8"','", u8"'.'", u8"'-'", u8"'+'", u8"'<'", u8"'>'"
|
|
};
|
|
|
|
std::vector<std::string> bfeLexer::_symbolicNames = {
|
|
"", u8"NEWLINE", u8"COMMENT", u8"ML_COMMENT", u8"DEF", u8"LOOPSTART",
|
|
u8"LOOPEND", u8"GRPSTART", u8"GRPEND", u8"NUMBER", u8"INPUT", u8"OUTPUT",
|
|
u8"DEC", u8"INC", u8"LEFT", u8"RIGHT", u8"EVERYTHING_ELSE", u8"WS"
|
|
};
|
|
|
|
dfa::Vocabulary bfeLexer::_vocabulary(_literalNames, _symbolicNames);
|
|
|
|
std::vector<std::string> bfeLexer::_tokenNames;
|
|
|
|
bfeLexer::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, 0x13, 0x6b, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4,
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, 0x3,
|
|
0x2, 0x2, 0x2, 0x52, 0x54, 0x9, 0x3, 0x2, 0x2, 0x53, 0x52, 0x3, 0x2,
|
|
0x2, 0x2, 0x54, 0x55, 0x3, 0x2, 0x2, 0x2, 0x55, 0x53, 0x3, 0x2, 0x2,
|
|
0x2, 0x55, 0x56, 0x3, 0x2, 0x2, 0x2, 0x56, 0x14, 0x3, 0x2, 0x2, 0x2,
|
|
0x57, 0x58, 0x7, 0x2e, 0x2, 0x2, 0x58, 0x16, 0x3, 0x2, 0x2, 0x2, 0x59,
|
|
0x5a, 0x7, 0x30, 0x2, 0x2, 0x5a, 0x18, 0x3, 0x2, 0x2, 0x2, 0x5b, 0x5c,
|
|
0x7, 0x2f, 0x2, 0x2, 0x5c, 0x1a, 0x3, 0x2, 0x2, 0x2, 0x5d, 0x5e, 0x7,
|
|
0x2d, 0x2, 0x2, 0x5e, 0x1c, 0x3, 0x2, 0x2, 0x2, 0x5f, 0x60, 0x7, 0x3e,
|
|
0x2, 0x2, 0x60, 0x1e, 0x3, 0x2, 0x2, 0x2, 0x61, 0x62, 0x7, 0x40, 0x2,
|
|
0x2, 0x62, 0x20, 0x3, 0x2, 0x2, 0x2, 0x63, 0x64, 0xb, 0x2, 0x2, 0x2,
|
|
0x64, 0x65, 0x3, 0x2, 0x2, 0x2, 0x65, 0x66, 0x8, 0x11, 0x3, 0x2, 0x66,
|
|
0x22, 0x3, 0x2, 0x2, 0x2, 0x67, 0x68, 0x9, 0x4, 0x2, 0x2, 0x68, 0x69,
|
|
0x3, 0x2, 0x2, 0x2, 0x69, 0x6a, 0x8, 0x12, 0x2, 0x2, 0x6a, 0x24, 0x3,
|
|
0x2, 0x2, 0x2, 0x8, 0x2, 0x2f, 0x33, 0x36, 0x40, 0x55, 0x4, 0x8, 0x2,
|
|
0x2, 0x2, 0x3, 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);
|
|
}
|
|
}
|
|
|
|
bfeLexer::Initializer bfeLexer::_init;
|