All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.antlr.v4.tool.templates.codegen.Cpp.Cpp.stg Maven / Gradle / Ivy

There is a newer version: 2.12.15
Show newest version
/*
 * [The "BSD license"]
 *  Copyright (c) 2015 Dan McLaughlin, Mike Lischke
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *  3. The name of the author may not be used to endorse or promote products
 *     derived from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

import "Files.stg" // All file specific stuff.

cppTypeInitMap ::= [
    "int":"0",
    "long":"0",
    "float":"0.0f",
    "double":"0.0",
    "bool":"false",
    "short":"0",
    "char":"0",
    default: "nullptr" // anything other than a primitive type is an object
]

LexerHeader(lexer, atn, actionFuncs, sempredFuncs, superClass = {antlr4::Lexer}) ::= <<


class   : public  {
public:

  enum {
     = }; separator=", ", wrap, anchor>
  };



  enum {
     = }; separator=", ", wrap, anchor>
  };



  enum {
     = }; separator=", ", wrap, anchor>
  };


  (antlr4::CharStream *input);
  ~();

  
  virtual std::string getGrammarFileName() const override;
  virtual const std::vector\& getRuleNames() const override;

  virtual const std::vector\& getChannelNames() const override;
  virtual const std::vector\& getModeNames() const override;
  virtual const std::vector\& getTokenNames() const override; // deprecated, use vocabulary instead
  virtual antlr4::dfa::Vocabulary& getVocabulary() const override;

  virtual const std::vector\ getSerializedATN() const override;
  virtual const antlr4::atn::ATN& getATN() const override;

  
  virtual void action(antlr4::RuleContext *context, size_t ruleIndex, size_t actionIndex) override;
  
  
  virtual bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override;
  

private:
  static std::vector\ _decisionToDFA;
  static antlr4::atn::PredictionContextCache _sharedContextCache;
  static std::vector\ _ruleNames;
  static std::vector\ _tokenNames;
  static std::vector\ _channelNames;
  static std::vector\ _modeNames;

  static std::vector\ _literalNames;
  static std::vector\ _symbolicNames;
  static antlr4::dfa::Vocabulary _vocabulary;
  

  

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

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

  struct Initializer {
    Initializer();
  };
  static Initializer _init;
};
>>

Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass = {Lexer}) ::= <<
::(CharStream *input) : (input) {
  _interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
}

::~() {
  delete _interpreter;
}

std::string ::getGrammarFileName() const {
  return "";
}

const std::vector\& ::getRuleNames() const {
  return _ruleNames;
}

const std::vector\& ::getChannelNames() const {
  return _channelNames;
}

const std::vector\& ::getModeNames() const {
  return _modeNames;
}

const std::vector\& ::getTokenNames() const {
  return _tokenNames;
}

dfa::Vocabulary& ::getVocabulary() const {
  return _vocabulary;
}

const std::vector\ ::getSerializedATN() const {
  return _serializedATN;
}

const atn::ATN& ::getATN() const {
  return _atn;
}




void ::action(RuleContext *context, size_t ruleIndex, size_t actionIndex) {
  switch (ruleIndex) {
    : Action(dynamic_cast\< *>(context), actionIndex); break;}; separator="\n">

  default:
    break;
  }
}



bool ::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) {
  switch (ruleIndex) {
    : return Sempred(dynamic_cast\< *>(context), predicateIndex);}; separator="\n">

  default:
    break;
  }
  return true;
}






// Static vars and initialization.
std::vector\ ::_decisionToDFA;
atn::PredictionContextCache ::_sharedContextCache;

// We own the ATN which in turn owns the ATN states.
atn::ATN ::_atn;
std::vector\ ::_serializedATN;

std::vector\ ::_ruleNames = {
  "}; separator = ", ", wrap, anchor>
};

std::vector\ ::_channelNames = {
  "DEFAULT_TOKEN_CHANNEL", "HIDDEN", "}; separator = ", ", wrap, anchor>
};

std::vector\ ::_modeNames = {
  "}; separator = ", ", wrap, anchor>
};

std::vector\ ::_literalNames = {
  }; null = "\"\"", separator = ", ", wrap, anchor>
};

std::vector\ ::_symbolicNames = {
  }; null = "\"\"", separator = ", ", wrap, anchor>
};

dfa::Vocabulary ::_vocabulary(_literalNames, _symbolicNames);

std::vector\ ::_tokenNames;

::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);
    }
	}

  
}

::Initializer ::_init;
>>

RuleActionFunctionHeader(r, actions) ::= <<
void Action( *context, size_t actionIndex);
>>

RuleActionFunction(r, actions) ::= <<
void ::Action( *context, size_t actionIndex) {
  switch (actionIndex) {
    :  break;}; separator="\n">

  default:
    break;
  }
}

>>

RuleSempredFunctionHeader(r, actions) ::= <<
bool Sempred( *_localctx, size_t predicateIndex);
>>

RuleSempredFunction(r, actions) ::= <<

bool ::Sempred( *_localctx, size_t predicateIndex) {
  switch (predicateIndex) {
    : return }; separator=";\n">;

  default:
    break;
  }
  return true;
}

>>

//--------------------------------------------------------------------------------------------------

ParserHeader(parser, funcs, atn, sempredFuncs, superClass = {antlr4::Parser}) ::= <<


class   : public  {
public:

  enum {
     = }; separator=", ", wrap, anchor>
  };



  enum {
     = }; separator=", ", wrap, anchor>
  };


  (antlr4::TokenStream *input);
  ~();

  virtual std::string getGrammarFileName() const override;
  virtual const antlr4::atn::ATN& getATN() const override { return _atn; };
  virtual const std::vector\& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead.
  virtual const std::vector\& getRuleNames() const override;
  virtual antlr4::dfa::Vocabulary& getVocabulary() const override;

  

  Context;};  separator = "\n"> 

  

  
  virtual bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override;
  
  

private:
  static std::vector\ _decisionToDFA;
  static antlr4::atn::PredictionContextCache _sharedContextCache;
  static std::vector\ _ruleNames;
  static std::vector\ _tokenNames;

  static std::vector\ _literalNames;
  static std::vector\ _symbolicNames;
  static antlr4::dfa::Vocabulary _vocabulary;
  

  

  struct Initializer {
    Initializer();
  };
  static Initializer _init;
};
>>

Parser(parser, funcs, atn, sempredFuncs, superClass = {Parser}) ::= <<
using namespace antlr4;

::(TokenStream *input) : (input) {
  _interpreter = new atn::ParserATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
}

::~() {
  delete _interpreter;
}

std::string ::getGrammarFileName() const {
  return "";
}

const std::vector\& ::getRuleNames() const {
  return _ruleNames;
}

dfa::Vocabulary& ::getVocabulary() const {
  return _vocabulary;
}






bool ::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) {
  switch (ruleIndex) {
  : return Sempred(dynamic_cast\< *>(context), predicateIndex);}; separator="\n">

  default:
    break;
  }
  return true;
}



// Static vars and initialization.
std::vector\ ::_decisionToDFA;
atn::PredictionContextCache ::_sharedContextCache;

// We own the ATN which in turn owns the ATN states.
atn::ATN ::_atn;
std::vector\ ::_serializedATN;

std::vector\ ::_ruleNames = {
  "}; separator = ", ", wrap, anchor>
};

std::vector\ ::_literalNames = {
  }; null = "\"\"", separator = ", ", wrap, anchor>
};

std::vector\ ::_symbolicNames = {
  }; null = "\"\"", separator = ", ", wrap, anchor>
};

dfa::Vocabulary ::_vocabulary(_literalNames, _symbolicNames);

std::vector\ ::_tokenNames;

::Initializer::Initializer() {
	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);
    }
	}

  
}

::Initializer ::_init;
>>

SerializedATNHeader(model) ::= <<
static antlr4::atn::ATN _atn;
static std::vector\ _serializedATN;
>>

// Constructs the serialized ATN and writes init code for static member vars.
SerializedATN(model) ::= <<

[] = {
     }>
\};}; separator="\n">

,
  serializedATNSegment + sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0]));
}>



_serializedATN = {
  }>
};


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);
}
>>

RuleFunctionHeader(currentRule, args, code, locals, ruleCtx, altLabelCtxs, namedActions, finallyAction, postamble, exceptions) ::= <<

}; separator="\n">
* ();

>>

RuleFunction(currentRule, args, code, locals, ruleCtx, altLabelCtxs, namedActions, finallyAction, postamble, exceptions) ::= <<

}; separator = "\n">
::* ::() {
   *_localctx = _tracker.createInstance\<\>(_ctx, getState()}>);
  enterRule(_localctx, , ::Rule);
  
  

  auto onExit = finally([=] {
  
    exitRule();
  });
  try {

    size_t alt;
    
    
   
    
  }
  
  
  
  catch (RecognitionException &e) {
    _errHandler->reportError(this, e);
    _localctx->exception = std::current_exception();
    _errHandler->recover(this, _localctx->exception);
  }
  

  return _localctx;
}
>>

LeftRecursiveRuleFunctionHeader(currentRule, args, code, locals, ruleCtx, altLabelCtxs, namedActions, finallyAction, postamble) ::= <<

}; separator="\n">
* ();
* (int precedence}>);
>>

LeftRecursiveRuleFunction(currentRule, args, code, locals, ruleCtx, altLabelCtxs, namedActions, finallyAction, postamble) ::= <<

}; separator="\n">

::* ::() {
   return (0}>);
}

::* ::(int precedence}>) {
  ParserRuleContext *parentContext = _ctx;
  size_t parentState = getState();
  :: *_localctx = _tracker.createInstance\<\>(_ctx, parentState}>);
  :: *previousContext = _localctx;
  size_t startState = ;
  enterRecursionRule(_localctx, , ::Rule, precedence);

    
    

  auto onExit = finally([=] {
  
    unrollRecursionContexts(parentContext);
  });
  try {
    size_t alt;
    

    
  }
  catch (RecognitionException &e) {
    _errHandler->reportError(this, e);
    _localctx->exception = std::current_exception();
    _errHandler->recover(this, _localctx->exception);
  }
  return _localctx;
}
>>

StructDeclHeader(struct, ctorAttrs, attrs, getters, dispatchMethods, interfaces, extensionMembers) ::= <<
class   : public antlr4::ParserRuleContext,  {
public:
  ;}; separator="\n">
  (antlr4::ParserRuleContext *parent, size_t invokingState);
  (antlr4::ParserRuleContext *parent, size_t invokingState}>);
 
  () : antlr4::ParserRuleContext() { }
  void copyFrom( *context);
  using antlr4::ParserRuleContext::copyFrom;


  virtual size_t getRuleIndex() const override;
  }; separator = "\n">

  
 
};

>>

StructDecl(struct, ctorAttrs, attrs, getters, dispatchMethods, interfaces, extensionMembers) ::= <<
//-----------------  ------------------------------------------------------------------


::::(ParserRuleContext *parent, size_t invokingState)
  : ParserRuleContext(parent, invokingState) {
}


::::(ParserRuleContext *parent, size_t invokingState}>)
  : ParserRuleContext(parent, invokingState) {
   = ;}; separator="\n">
}

}; separator = "\n">

size_t ::::getRuleIndex() const {
  return ::Rule;
}


void ::::copyFrom( *ctx) {
  ParserRuleContext::copyFrom(ctx);
   = ctx->;}; separator = "\n">
}




>>

AltLabelStructDeclHeader(struct, attrs, getters, dispatchMethods) ::= <<
class   : public Context {
public:
  (Context *ctx);

  }; separator = "\n">
  }; separator = "\n">
  
};

>>

AltLabelStructDecl(struct, attrs, getters, dispatchMethods) ::= <<
//-----------------  ------------------------------------------------------------------

}; separator = "\n">
}; separator = "\n">
::::(Context *ctx) { copyFrom(ctx); }


>>


CodeBlockForOuterMostAltHeader(currentOuterMostAltCodeBlock, locals, preamble, ops) ::= ""
CodeBlockForOuterMostAlt(currentOuterMostAltCodeBlock, locals, preamble, ops) ::= <<

_localctx = dynamic_cast\< *>(_tracker.createInstance\<::Context>(_localctx));

enterOuterAlt(_localctx, );

>>

CodeBlockForAltHeader(currentAltCodeBlock, locals, preamble, ops) ::= ""
CodeBlockForAlt(currentAltCodeBlock, locals, preamble, ops) ::= <<



>>

LL1AltBlockHeader(choice, preamble, alts, error) ::= ""
LL1AltBlock(choice, preamble, alts, error) ::= <<
setState();
_errHandler->sync(this);
LL1AltBlock(choice, preamble, alts, error)  = _input->LT(1);

switch (_input->LA(1)) {
   {
  
  break;
\}
}; separator = "\n">
default:
  
}
>>

LL1OptionalBlockHeader(choice, alts, error) ::= ""
LL1OptionalBlock(choice, alts, error) ::= <<
setState();
_errHandler->sync(this);
switch (_input->LA(1)) {
   {
  
  break;
\}
}; separator="\n">
default:
  break;
}
>>

LL1OptionalBlockSingleAltHeader(choice, expr, alts, preamble, error, followExpr) ::= ""
LL1OptionalBlockSingleAlt(choice, expr, alts, preamble, error, followExpr) ::= <<
setState();
_errHandler->sync(this);


if () {
  
}
>>

LL1StarBlockSingleAltHeader(choice, loopExpr, alts, preamble, iteration) ::= ""
LL1StarBlockSingleAlt(choice, loopExpr, alts, preamble, iteration) ::= <<
setState();
_errHandler->sync(this);

while () {
  
  setState();
  _errHandler->sync(this);
  
}
>>

LL1PlusBlockSingleAltHeader(choice, loopExpr, alts, preamble, iteration) ::= ""
LL1PlusBlockSingleAlt(choice, loopExpr, alts, preamble, iteration) ::= <<
setState(); 
_errHandler->sync(this);

do {
  
  setState(); 
  _errHandler->sync(this);
  
} while ();
>>

// LL(*) stuff

AltBlockHeader(choice, preamble, alts, error) ::= ""
AltBlock(choice, preamble, alts, error) ::= <<
setState();
_errHandler->sync(this);
 = _input->LT(1);

switch (getInterpreter\()->adaptivePredict(_input, , _ctx)) {
: {
  
  break;
\}
}; separator="\n">
}
>>

OptionalBlockHeader(choice, alts, error) ::= ""
OptionalBlock(choice, alts, error) ::= <<
setState();
_errHandler->sync(this);

switch (getInterpreter\()->adaptivePredict(_input, , _ctx)) {
 + 1: {
  
  break;
\}
}; separator = "\n">
}
>>

StarBlockHeader(choice, alts, sync, iteration) ::= ""
StarBlock(choice, alts, sync, iteration) ::= <<
setState();
_errHandler->sync(this);
alt = getInterpreter\()->adaptivePredict(_input, , _ctx);
while (alt !=  && alt != atn::ATN::INVALID_ALT_NUMBER) {
  if (alt == 1 + 1) {
    
     
  }
  setState();
  _errHandler->sync(this);
  alt = getInterpreter\()->adaptivePredict(_input, , _ctx);
}
>>

PlusBlockHeader(choice, alts, error) ::= ""
PlusBlock(choice, alts, error) ::= <<
setState(); 
_errHandler->sync(this);
alt = 1 + 1;
do {
  switch (alt) {
     + 1: {
      
      break;
    \}
}; separator="\n">
  default:
    
  }
  setState(); 
  _errHandler->sync(this);
  alt = getInterpreter\()->adaptivePredict(_input, , _ctx);
} while (alt !=  && alt != atn::ATN::INVALID_ALT_NUMBER);
>>

Sync(s) ::= "Sync(s) sync();"

ThrowNoViableAltHeader(t) ::= ""
ThrowNoViableAlt(t) ::= "throw NoViableAltException(this);"

TestSetInlineHeader(s) ::= ""
TestSetInline(s) ::= <<
}; separator=" || ">
>>

// Java language spec 15.19 - shift operators mask operands rather than overflow to 0... need range test
testShiftInRange(shiftAmount) ::= <<
(( & ~ 0x3fULL) == 0)
>>

// produces smaller bytecode only when bits.ttypes contains more than two items
bitsetBitfieldComparison(s, bits) ::= <<
(})> &&
  ((1ULL \<\< ) & ()}; separator = "\n  | ">)) != 0)
>>

isZero ::= [
  "0": true,
  default: false
]

offsetShift(shiftAmount, offset, prefix = false) ::= <%
(:: - )::
%>

// produces more efficient bytecode when bits.ttypes contains at most two items
bitsetInlineComparison(s, bits) ::= <%
 == ::}; separator = "\n\n|| ">
%>

cases(ttypes) ::= <<
:::}; separator="\n">
>>

InvokeRuleHeader(r, argExprsChunks) ::= "InvokeRuleHeader"
InvokeRule(r, argExprsChunks) ::= <<
setState();
 = }>(,);
>>

MatchTokenHeader(m) ::= ""
MatchToken(m) ::= <<
setState();
 = }>match(::);
>>

MatchSetHeader(m, expr, capture) ::= ""
MatchSet(m, expr, capture) ::= ""

MatchNotSetHeader(m, expr, capture) ::= ""
MatchNotSet(m, expr, capture) ::= ""

CommonSetStuff(m, expr, capture, invert) ::= <<
setState();
 = }>_input->LT(1);

if ( == 0 ||  == Token::EOF || !()) {
   = }>_errHandler->recoverInline(this);
}
else {
  _errHandler->reportMatch(this);
  consume();
}
>>

WildcardHeader(w) ::= ""
Wildcard(w) ::= <<
setState();
 = }>matchWildcard();
>>

// ACTION STUFF

ActionHeader(a, foo, chunks) ::= ""
Action(a, foo, chunks) ::= ""

ArgAction(a, chunks) ::= "ArgAction(a, chunks) "

SemPredHeader(p, chunks, failChunks) ::= ""
SemPred(p, chunks, failChunks) ::= <<
setState();

if (!()) throw FailedPredicateException(this, , , );
>>

ExceptionClauseHeader(e, catchArg, catchAction) ::= ""
ExceptionClause(e, catchArg, catchAction) ::= <<
catch () {
  
}
>>

// Lexer actions are not associated with model objects.

LexerSkipCommand()  ::= "skip();"
LexerMoreCommand()  ::= "more();"
LexerPopModeCommand() ::= "popMode();"

LexerTypeCommand(arg, grammar)      ::= "type = ::;"
LexerChannelCommand(arg, grammar)   ::= "channel = ;"
LexerModeCommand(arg, grammar)      ::= "mode = Mode::;"
LexerPushModeCommand(arg, grammar)  ::= "pushMode(Mode::);"

ActionTextHeader(t) ::= ""
ActionText(t) ::= ""

ActionTemplateHeader(t) ::= ""
ActionTemplate(t) ::= ""

ArgRefHeader(t) ::= ""
ArgRef(a) ::= "_localctx->"

LocalRefHeader(t) ::= ""
LocalRef(a) ::= "_localctx->"

RetValueRefHeader(t) ::= ""
RetValueRef(a) ::= "_localctx->"

QRetValueRefHeader(t) ::= ""
QRetValueRef(a) ::= "->->"
/** How to translate $tokenLabel */

TokenRefHeader(t) ::= ""
TokenRef(t) ::= "->"

LabelRefHeader(t) ::= ""
LabelRef(t) ::= "->"

ListLabelRefHeader(t) ::= ""
ListLabelRef(t) ::= "->"

SetAttrHeader(t) ::= ""
SetAttr(s,rhsChunks) ::= "-> = ;"

InputSymbolType() ::= " *"

TokenPropertyRef_textHeader(t) ::= ""
TokenPropertyRef_text(t) ::= <<(-> != nullptr ? ->->getText() : "")>>

TokenPropertyRef_typeHeader(t) ::= ""
TokenPropertyRef_type(t) ::= "(-> != nullptr ? ->->getType() : 0)"

TokenPropertyRef_lineHeader(t) ::= ""
TokenPropertyRef_line(t) ::= "(-> != nullptr ? ->->getLine() : 0)"

TokenPropertyRef_posHeader(t) ::= ""
TokenPropertyRef_pos(t) ::= "(-> != nullptr ? ->->getCharPositionInLine() : 0)"

TokenPropertyRef_channelHeader(t) ::= ""
TokenPropertyRef_channel(t) ::= "(-> != nullptr ? ->->getChannel() : 0)"

TokenPropertyRef_indexHeader(t) ::= ""
TokenPropertyRef_index(t) ::= "(-> != nullptr ? ->->getTokenIndex() : 0)"

TokenPropertyRef_intHeader(t) ::= ""
TokenPropertyRef_int(t) ::= "(-> != nullptr ? std::stoi(->->getText()) : 0)"

RulePropertyRef_startHeader(r)  ::= ""
RulePropertyRef_start(r) ::= "(-> != nullptr ? (->->start) : nullptr)"

RulePropertyRef_stopHeader(r)  ::= ""
RulePropertyRef_stop(r)  ::= "(-> != nullptr ? (->->stop) : nullptr)"

RulePropertyRef_textHeader(r)  ::= ""
RulePropertyRef_text(r)  ::= "(-> != nullptr ? _input->getText(->->start, ->->stop) : nullptr)"

RulePropertyRef_ctxHeader(r)   ::= ""
RulePropertyRef_ctx(r)   ::= "->"

ThisRulePropertyRef_start(r) ::= "ThisRulePropertyRef_start(r) _localctx->start"
ThisRulePropertyRef_stop(r)  ::= "ThisRulePropertyRef_stop(r) _localctx->stop"

ThisRulePropertyRef_textHeader(r)  ::= ""
ThisRulePropertyRef_text(r)  ::= "_input->getText(_localctx->start, _input->LT(-1))"

ThisRulePropertyRef_ctxHeader(r)   ::= ""
ThisRulePropertyRef_ctx(r)   ::= "_localctx"

ThisRulePropertyRef_parserHeader(r)	 ::= ""
ThisRulePropertyRef_parser(r)	 ::= "this"

NonLocalAttrRef(s) ::= "NonLocalAttrRef(s) ((Context)getInvokingContext())."
SetNonLocalAttr(s, rhsChunks) ::=
  "SetNonLocalAttr(s, rhsChunks) ((Context)getInvokingContext()). = ;"

AddToLabelListHeader(a) ::= ""
AddToLabelList(a) ::= <<
->.push_back();
>>

TokenLabelType() ::= " *"

TokenDeclHeader(t) ::= "antlr4:: = nullptr;"
TokenDecl(t) ::= ""

TokenTypeDeclHeader(t) ::= ""
TokenTypeDecl(t) ::= "size_t  = 0;"

TokenListDeclHeader(t) ::= "std::vector\ ;"
TokenListDecl(t) ::= ""

RuleContextDeclHeader(r) ::= ":: * = nullptr;"
RuleContextDecl(r) ::= ""

RuleContextListDeclHeader(rdecl) ::= "std::vector\< *> ;"
RuleContextListDecl(rdecl) ::= ""

ContextTokenGetterDeclHeader(t) ::= "antlr4::tree::TerminalNode *();"
ContextTokenGetterDecl(t) ::= <<
tree::TerminalNode* ::::() {
  return getToken(::, 0);
}

>>

ContextTokenListGetterDeclHeader(t) ::= "std::vector\ ();"
ContextTokenListGetterDecl(t) ::= <<
std::vector\ ::::() {
  return getTokens(::);
}

>>

ContextTokenListIndexedGetterDeclHeader(t) ::= "antlr4::tree::TerminalNode* (size_t i);"
ContextTokenListIndexedGetterDecl(t)  ::= <<
tree::TerminalNode* ::::(size_t i) {
  return getToken(::, i);
}

>>

ContextRuleGetterDeclHeader(r) ::= " *();"
ContextRuleGetterDecl(r) ::= <<

::* ::::() {
  return getRuleContext\<::\>(0);
}

>>

ContextRuleListGetterDeclHeader(r) ::= "std::vector\< *> ();"
ContextRuleListGetterDecl(r) ::= <<
std::vector\<:: *> ::::() {
  return getRuleContexts\<::\>();
}

>>

ContextRuleListIndexedGetterDeclHeader(r) ::= "* (size_t i);"
ContextRuleListIndexedGetterDecl(r) ::= <<
::* ::::(size_t i) {
  return getRuleContext\<::\>(i);
}

>>

LexerRuleContext() ::= "antlr4::RuleContext"

// The rule context name is the rule followed by a suffix; e.g. r becomes rContext.
RuleContextNameSuffix() ::= "Context"

ImplicitTokenLabel(tokenName) ::= <<
Token
>>

ImplicitRuleLabel(ruleName) ::= "Context"
ImplicitSetLabel(id) ::= "_tset"
ListLabelName(label) ::= "