From 45409c781a9e35df68c43b1e2f028d30bf90c0a0 Mon Sep 17 00:00:00 2001 From: Patrick Schönberger Date: Wed, 28 Jul 2021 09:07:53 +0200 Subject: Initial commit --- gen/TocLexer.cpp | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 gen/TocLexer.cpp (limited to 'gen/TocLexer.cpp') diff --git a/gen/TocLexer.cpp b/gen/TocLexer.cpp new file mode 100644 index 0000000..5e7a299 --- /dev/null +++ b/gen/TocLexer.cpp @@ -0,0 +1,218 @@ + +// Generated from Toc.g4 by ANTLR 4.9.2 + + +#include "TocLexer.h" + + +using namespace antlr4; + + +TocLexer::TocLexer(CharStream *input) : Lexer(input) { + _interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache); +} + +TocLexer::~TocLexer() { + delete _interpreter; +} + +std::string TocLexer::getGrammarFileName() const { + return "Toc.g4"; +} + +const std::vector& TocLexer::getRuleNames() const { + return _ruleNames; +} + +const std::vector& TocLexer::getChannelNames() const { + return _channelNames; +} + +const std::vector& TocLexer::getModeNames() const { + return _modeNames; +} + +const std::vector& TocLexer::getTokenNames() const { + return _tokenNames; +} + +dfa::Vocabulary& TocLexer::getVocabulary() const { + return _vocabulary; +} + +const std::vector TocLexer::getSerializedATN() const { + return _serializedATN; +} + +const atn::ATN& TocLexer::getATN() const { + return _atn; +} + + + + +// Static vars and initialization. +std::vector TocLexer::_decisionToDFA; +atn::PredictionContextCache TocLexer::_sharedContextCache; + +// We own the ATN which in turn owns the ATN states. +atn::ATN TocLexer::_atn; +std::vector TocLexer::_serializedATN; + +std::vector TocLexer::_ruleNames = { + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", + "T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "BINARY_OPERATOR", + "INTLIT", "NAME", "WS", "NEWLINE" +}; + +std::vector TocLexer::_channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" +}; + +std::vector TocLexer::_modeNames = { + "DEFAULT_MODE" +}; + +std::vector TocLexer::_literalNames = { + "", "'var'", "':'", "'='", "'func'", "'('", "')'", "','", "'{'", "'}'", + "'struct'", "'if'", "'while'", "'return'", "'['", "']'", "'.'" +}; + +std::vector TocLexer::_symbolicNames = { + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "BINARY_OPERATOR", + "INTLIT", "NAME", "WS", "NEWLINE" +}; + +dfa::Vocabulary TocLexer::_vocabulary(_literalNames, _symbolicNames); + +std::vector TocLexer::_tokenNames; + +TocLexer::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(""); + } else { + _tokenNames.push_back(name); + } + } + + static const uint16_t serializedATNSegment0[] = { + 0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964, + 0x2, 0x17, 0x82, 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, 0x4, 0x9, 0x9, 0x9, 0x4, 0xa, + 0x9, 0xa, 0x4, 0xb, 0x9, 0xb, 0x4, 0xc, 0x9, 0xc, 0x4, 0xd, 0x9, + 0xd, 0x4, 0xe, 0x9, 0xe, 0x4, 0xf, 0x9, 0xf, 0x4, 0x10, 0x9, 0x10, + 0x4, 0x11, 0x9, 0x11, 0x4, 0x12, 0x9, 0x12, 0x4, 0x13, 0x9, 0x13, + 0x4, 0x14, 0x9, 0x14, 0x4, 0x15, 0x9, 0x15, 0x4, 0x16, 0x9, 0x16, + 0x3, 0x2, 0x3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2, 0x74, 0x75, + 0x3, 0x2, 0x2, 0x2, 0x75, 0x28, 0x3, 0x2, 0x2, 0x2, 0x76, 0x78, 0x9, + 0x7, 0x2, 0x2, 0x77, 0x76, 0x3, 0x2, 0x2, 0x2, 0x78, 0x79, 0x3, 0x2, + 0x2, 0x2, 0x79, 0x77, 0x3, 0x2, 0x2, 0x2, 0x79, 0x7a, 0x3, 0x2, 0x2, + 0x2, 0x7a, 0x7b, 0x3, 0x2, 0x2, 0x2, 0x7b, 0x7c, 0x8, 0x15, 0x2, + 0x2, 0x7c, 0x2a, 0x3, 0x2, 0x2, 0x2, 0x7d, 0x7f, 0x9, 0x8, 0x2, 0x2, + 0x7e, 0x7d, 0x3, 0x2, 0x2, 0x2, 0x7f, 0x80, 0x3, 0x2, 0x2, 0x2, 0x80, + 0x7e, 0x3, 0x2, 0x2, 0x2, 0x80, 0x81, 0x3, 0x2, 0x2, 0x2, 0x81, 0x2c, + 0x3, 0x2, 0x2, 0x2, 0xa, 0x2, 0x67, 0x6a, 0x6f, 0x72, 0x74, 0x79, + 0x80, 0x3, 0x8, 0x2, 0x2, + }; + + _serializedATN.insert(_serializedATN.end(), serializedATNSegment0, + serializedATNSegment0 + sizeof(serializedATNSegment0) / sizeof(serializedATNSegment0[0])); + + + 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); + } +} + +TocLexer::Initializer TocLexer::_init; -- cgit v1.2.3