UNPKG

1.49 kBTypeScriptView Raw
1/*!
2 * Copyright 2016 The ANTLR Project. All rights reserved.
3 * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4 */
5import { ParserRuleContext } from "./ParserRuleContext";
6/**
7 * This class extends {@link ParserRuleContext} by allowing the value of
8 * {@link #getRuleIndex} to be explicitly set for the context.
9 *
10 * {@link ParserRuleContext} does not include field storage for the rule index
11 * since the context classes created by the code generator override the
12 * {@link #getRuleIndex} method to return the correct value for that context.
13 * Since the parser interpreter does not use the context classes generated for a
14 * parser, this class (with slightly more memory overhead per node) is used to
15 * provide equivalent functionality.
16 */
17export declare class InterpreterRuleContext extends ParserRuleContext {
18 /**
19 * This is the backing field for {@link #getRuleIndex}.
20 */
21 private _ruleIndex;
22 constructor(ruleIndex: number);
23 /**
24 * Constructs a new {@link InterpreterRuleContext} with the specified
25 * parent, invoking state, and rule index.
26 *
27 * @param ruleIndex The rule index for the current context.
28 * @param parent The parent context.
29 * @param invokingStateNumber The invoking state number.
30 */
31 constructor(ruleIndex: number, parent: ParserRuleContext | undefined, invokingStateNumber: number);
32 get ruleIndex(): number;
33}