]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/RuleContextWithAltNum.h
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / RuleContextWithAltNum.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 "ParserRuleContext.h"
9
10 namespace antlr4 {
11
12   /// A handy class for use with
13   ///
14   ///  options {contextSuperClass=org.antlr.v4.runtime.RuleContextWithAltNum;}
15   ///
16   ///  that provides a backing field / impl for the outer alternative number
17   ///  matched for an internal parse tree node.
18   ///
19   ///  I'm only putting into Java runtime as I'm certain I'm the only one that
20   ///  will really every use this.
21   class ANTLR4CPP_PUBLIC RuleContextWithAltNum : public ParserRuleContext {
22   public:
23     size_t altNum = 0;
24
25     RuleContextWithAltNum();
26     RuleContextWithAltNum(ParserRuleContext *parent, int invokingStateNumber);
27
28     virtual size_t getAltNumber() const override;
29     virtual void setAltNumber(size_t altNum) override;
30   };
31
32 } // namespace antlr4