text: 
  #include "repository/ISwiftMtParser.h"
  #include "SwiftMtMessage.pb.h"
  #include <vector>
  #include <string>
  #include "BaseErrorListener.h"
  #include "SwiftMtParser_MT320Lexer.h"
  
  
  // Generated from C:/programming/message-converter-c/message/generation/swift-mt-generation/repository/SR2018/grammars/SwiftMtParser_MT320.g4 by ANTLR 4.7.2
  
  #pragma once
  
  
  #include "antlr4-runtime.h"
  
  
  namespace message::definition::swift::mt::parsers::sr2018 {
  
  
  class  SwiftMtParser_MT320Parser : public antlr4::Parser {
  public:
    enum {
      TAG_BH = 1, TAG_AH = 2, TAG_UH = 3, TAG_MT = 4, TAG_TR = 5, MT_END = 6, 
      LBRACE = 7, RBRACE = 8, COLON = 9, START_OF_FIELD = 10, ANY = 11
    };
  
    enum {
      RuleMessage = 0, RuleBh = 1, RuleBh_content = 2, RuleAh = 3, RuleAh_content = 4, 
      RuleUh = 5, RuleTr = 6, RuleSys_block = 7, RuleSys_element = 8, RuleSys_element_key = 9, 
      RuleSys_element_content = 10, RuleMt = 11
    };
  
    SwiftMtParser_MT320Parser(antlr4::TokenStream *input);
    ~SwiftMtParser_MT320Parser();
  
    virtual std::string getGrammarFileName() const override;
    virtual const antlr4::atn::ATN& getATN() const override { return _atn; };
    virtual const std::vector<std::string>& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead.
    virtual const std::vector<std::string>& getRuleNames() const override;
    virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
  
  
    public:
        typedef SwiftMtParser_MT320Lexer tLexer;
        typedef SwiftMtParser_MT320Parser tParser;
  
    private:
        std::vector<std::string> _errors;
  
    public:
        [[nodiscard]] const std::vector<std::string>& errors() const { return _errors; }
  
    private:
        class DefaultErrorListener : public antlr4::BaseErrorListener {
        private:
            std::vector<std::string>& _errors;
  
        public:
            explicit DefaultErrorListener(std::vector<std::string>& errors) : _errors(errors) { }
  
            void syntaxError(Recognizer *recognizer, antlr4::Token * offendingSymbol, size_t line, size_t charPositionInLine,
                                   const std::string &msg, std::exception_ptr e) override {
                _errors.push_back(msg);
            }
        };
  
        DefaultErrorListener _error_listener { _errors };
  
    public:
        class Helper : public ISwiftMtParser {
        public:
            bool parse_message(const std::string& message, std::vector<std::string>& errors, SwiftMtMessage& out_message) override {
                antlr4::ANTLRInputStream stream{message};
                tLexer lexer{&stream};
                antlr4::CommonTokenStream token_stream{&lexer};
  
                tParser parser{&token_stream};
                return parser.process(errors, out_message);
            }
        };
  
    private:
        SwiftMtMessage _message_builder{};
  
        bool process(std::vector<std::string>& errors, SwiftMtMessage& out_message) {
            _errors.clear();
            removeErrorListeners();
            addErrorListener(&_error_listener);
  
            _message_builder = SwiftMtMessage{};
  
            message();
            if(!_errors.empty()) {
                errors.insert(errors.end(), _errors.begin(), _errors.end());
                return false;
            }
  
            out_message = _message_builder;
            return true;
        }
    public:
  
        [[nodiscard]] SwiftMtMessage parsed_message() const {
            return _message_builder;
        }
  
  
    class MessageContext;
    class BhContext;
    class Bh_contentContext;
    class AhContext;
    class Ah_contentContext;
    class UhContext;
    class TrContext;
    class Sys_blockContext;
    class Sys_elementContext;
    class Sys_element_keyContext;
    class Sys_element_contentContext;
    class MtContext; 
  
    class  MessageContext : public antlr4::ParserRuleContext {
    public:
      MessageContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      BhContext *bh();
      AhContext *ah();
      MtContext *mt();
      antlr4::tree::TerminalNode *EOF();
      UhContext *uh();
      TrContext *tr();
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    MessageContext* message();
  
    class  BhContext : public antlr4::ParserRuleContext {
    public:
      BhContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      antlr4::tree::TerminalNode *TAG_BH();
      Bh_contentContext *bh_content();
      antlr4::tree::TerminalNode *RBRACE();
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    BhContext* bh();
  
    class  Bh_contentContext : public antlr4::ParserRuleContext {
    public:
      Bh_contentContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      std::vector<antlr4::tree::TerminalNode *> RBRACE();
      antlr4::tree::TerminalNode* RBRACE(size_t i);
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    Bh_contentContext* bh_content();
  
    class  AhContext : public antlr4::ParserRuleContext {
    public:
      AhContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      antlr4::tree::TerminalNode *TAG_AH();
      Ah_contentContext *ah_content();
      antlr4::tree::TerminalNode *RBRACE();
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    AhContext* ah();
  
    class  Ah_contentContext : public antlr4::ParserRuleContext {
    public:
      Ah_contentContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      std::vector<antlr4::tree::TerminalNode *> RBRACE();
      antlr4::tree::TerminalNode* RBRACE(size_t i);
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    Ah_contentContext* ah_content();
  
    class  UhContext : public antlr4::ParserRuleContext {
    public:
      UhContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      antlr4::tree::TerminalNode *TAG_UH();
      Sys_blockContext *sys_block();
      antlr4::tree::TerminalNode *RBRACE();
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    UhContext* uh();
  
    class  TrContext : public antlr4::ParserRuleContext {
    public:
      TrContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      antlr4::tree::TerminalNode *TAG_TR();
      Sys_blockContext *sys_block();
      antlr4::tree::TerminalNode *RBRACE();
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    TrContext* tr();
  
    class  Sys_blockContext : public antlr4::ParserRuleContext {
    public:
      Sys_blockContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      std::vector<Sys_elementContext *> sys_element();
      Sys_elementContext* sys_element(size_t i);
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    Sys_blockContext* sys_block();
  
    class  Sys_elementContext : public antlr4::ParserRuleContext {
    public:
      Sys_elementContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      antlr4::tree::TerminalNode *LBRACE();
      Sys_element_keyContext *sys_element_key();
      antlr4::tree::TerminalNode *COLON();
      Sys_element_contentContext *sys_element_content();
      antlr4::tree::TerminalNode *RBRACE();
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    Sys_elementContext* sys_element();
  
    class  Sys_element_keyContext : public antlr4::ParserRuleContext {
    public:
      Sys_element_keyContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      std::vector<antlr4::tree::TerminalNode *> COLON();
      antlr4::tree::TerminalNode* COLON(size_t i);
      std::vector<antlr4::tree::TerminalNode *> RBRACE();
      antlr4::tree::TerminalNode* RBRACE(size_t i);
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    Sys_element_keyContext* sys_element_key();
  
    class  Sys_element_contentContext : public antlr4::ParserRuleContext {
    public:
      Sys_element_contentContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      std::vector<antlr4::tree::TerminalNode *> RBRACE();
      antlr4::tree::TerminalNode* RBRACE(size_t i);
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    Sys_element_contentContext* sys_element_content();
  
    class  MtContext : public antlr4::ParserRuleContext {
    public:
      message::definition::swift::mt::MessageText elem;
      MtContext(antlr4::ParserRuleContext *parent, size_t invokingState);
      virtual size_t getRuleIndex() const override;
      antlr4::tree::TerminalNode *TAG_MT();
      antlr4::tree::TerminalNode *MT_END();
  
      virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override;
      virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override;
     
    };
  
    MtContext* mt();
  
  
  private:
    static std::vector<antlr4::dfa::DFA> _decisionToDFA;
    static antlr4::atn::PredictionContextCache _sharedContextCache;
    static std::vector<std::string> _ruleNames;
    static std::vector<std::string> _tokenNames;
  
    static std::vector<std::string> _literalNames;
    static std::vector<std::string> _symbolicNames;
    static antlr4::dfa::Vocabulary _vocabulary;
    static antlr4::atn::ATN _atn;
    static std::vector<uint16_t> _serializedATN;
  
  
    struct Initializer {
      Initializer();
    };
    static Initializer _init;
  };
  
  }  // namespace message::definition::swift::mt::parsers::sr2018
  