UNPKG

1.53 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 { Dependents } from "./Dependents";
6import { Parser } from "./Parser";
7/**
8 * Declares a dependency upon a grammar rule, along with a set of zero or more dependent rules.
9 *
10 * Version numbers within a grammar should be assigned on a monotonically increasing basis to allow for accurate
11 * tracking of dependent rules.
12 *
13 * @author Sam Harwell
14 */
15export declare function RuleDependency(dependency: DependencySpecification): (target: object, propertyKey: PropertyKey, propertyDescriptor: PropertyDescriptor) => void;
16export interface DependencySpecification {
17 readonly recognizer: {
18 new (...args: any[]): Parser;
19 };
20 readonly rule: number;
21 readonly version: number;
22 /**
23 * Specifies the set of grammar rules related to `rule` which the annotated element depends on. Even when absent
24 * from this set, the annotated element is implicitly dependent upon the explicitly specified `rule`, which
25 * corresponds to the `Dependents.SELF` element.
26 *
27 * By default, the annotated element is dependent upon the specified `rule` and its `Dependents.PARENTS`, i.e. the
28 * rule within one level of context information. The parents are included since the most frequent assumption about a
29 * rule is where it's used in the grammar.
30 */
31 readonly dependents?: Dependents[];
32}