/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD 3-clause license that * can be found in the LICENSE.txt file in the project root. */ #pragma once #include "CommonToken.h" namespace antlr4 { namespace tree { namespace pattern { /// /// A object representing a token of a particular type; e.g., /// {@code }. These tokens are created for chunks where the /// tag corresponds to a lexer rule or token type. /// class ANTLR4CPP_PUBLIC TokenTagToken : public CommonToken { /// /// This is the backing field for . /// private: const std::string tokenName; /// /// This is the backing field for . /// const std::string label; /// /// Constructs a new instance of for an unlabeled tag /// with the specified token name and type. /// /// The token name. /// The token type. public: TokenTagToken(const std::string &tokenName, int type); //this(tokenName, type, nullptr); /// /// Constructs a new instance of with the specified /// token name, type, and label. /// /// The token name. /// The token type. /// The label associated with the token tag, or {@code null} if /// the token tag is unlabeled. TokenTagToken(const std::string &tokenName, int type, const std::string &label); /// /// Gets the token name. /// The token name. std::string getTokenName() const; /// /// Gets the label associated with the rule tag. /// /// The name of the label associated with the rule tag, or /// {@code null} if this is an unlabeled rule tag. std::string getLabel() const; /// /// {@inheritDoc} ///

/// The implementation for returns the token tag /// formatted with {@code <} and {@code >} delimiters. ///

virtual std::string getText() const override; /// /// {@inheritDoc} ///

/// The implementation for returns a string of the form /// {@code tokenName:type}. ///

virtual std::string toString() const override; }; } // namespace pattern } // namespace tree } // namespace antlr4