]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/Chunk.h
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / tree / pattern / Chunk.h
1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2  * Use of this file is governed by the BSD 3-clause license that
3  * can be found in the LICENSE.txt file in the project root.
4  */
5
6 #pragma once
7
8 #include "antlr4-common.h"
9
10 namespace antlr4 {
11 namespace tree {
12 namespace pattern {
13
14   /// <summary>
15   /// A chunk is either a token tag, a rule tag, or a span of literal text within a
16   /// tree pattern.
17   /// <p/>
18   /// The method <seealso cref="ParseTreePatternMatcher#split(String)"/> returns a list of
19   /// chunks in preparation for creating a token stream by
20   /// <seealso cref="ParseTreePatternMatcher#tokenize(String)"/>. From there, we get a parse
21   /// tree from with <seealso cref="ParseTreePatternMatcher#compile(String, int)"/>. These
22   /// chunks are converted to <seealso cref="RuleTagToken"/>, <seealso cref="TokenTagToken"/>, or the
23   /// regular tokens of the text surrounding the tags.
24   /// </summary>
25   class ANTLR4CPP_PUBLIC Chunk {
26   public:
27     Chunk() = default;
28     Chunk(Chunk const&) = default;
29     virtual ~Chunk();
30
31     Chunk& operator=(Chunk const&) = default;
32
33     /// This method returns a text representation of the tag chunk. Labeled tags
34     /// are returned in the form {@code label:tag}, and unlabeled tags are
35     /// returned as just the tag name.
36     virtual std::string toString() {
37       std::string str;
38       return str;
39     }
40   };
41
42 } // namespace pattern
43 } // namespace tree
44 } // namespace antlr4