Initial commit with Advoware proxy

This commit is contained in:
root
2025-10-19 14:57:07 +00:00
commit 273aa8b549
45771 changed files with 5534555 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ErrorNode } from "./ErrorNode";
import { ParseTree } from "./ParseTree";
import { ParseTreeVisitor } from "./ParseTreeVisitor";
import { RuleNode } from "./RuleNode";
import { TerminalNode } from "./TerminalNode";
export declare abstract class AbstractParseTreeVisitor<Result> implements ParseTreeVisitor<Result> {
/**
* {@inheritDoc}
*
* The default implementation calls {@link ParseTree#accept} on the
* specified tree.
*/
visit(tree: ParseTree): Result;
/**
* {@inheritDoc}
*
* The default implementation initializes the aggregate result to
* {@link #defaultResult defaultResult()}. Before visiting each child, it
* calls {@link #shouldVisitNextChild shouldVisitNextChild}; if the result
* is `false` no more children are visited and the current aggregate
* result is returned. After visiting a child, the aggregate result is
* updated by calling {@link #aggregateResult aggregateResult} with the
* previous aggregate result and the result of visiting the child.
*
* The default implementation is not safe for use in visitors that modify
* the tree structure. Visitors that modify the tree should override this
* method to behave properly in respect to the specific algorithm in use.
*/
visitChildren(node: RuleNode): Result;
/**
* {@inheritDoc}
*
* The default implementation returns the result of
* {@link #defaultResult defaultResult}.
*/
visitTerminal(node: TerminalNode): Result;
/**
* {@inheritDoc}
*
* The default implementation returns the result of
* {@link #defaultResult defaultResult}.
*/
visitErrorNode(node: ErrorNode): Result;
/**
* Gets the default value returned by visitor methods. This value is
* returned by the default implementations of
* {@link #visitTerminal visitTerminal}, {@link #visitErrorNode visitErrorNode}.
* The default implementation of {@link #visitChildren visitChildren}
* initializes its aggregate result to this value.
*
* @returns The default value returned by visitor methods.
*/
protected abstract defaultResult(): Result;
/**
* Aggregates the results of visiting multiple children of a node. After
* either all children are visited or {@link #shouldVisitNextChild} returns
* `false`, the aggregate value is returned as the result of
* {@link #visitChildren}.
*
* The default implementation returns `nextResult`, meaning
* {@link #visitChildren} will return the result of the last child visited
* (or return the initial value if the node has no children).
*
* @param aggregate The previous aggregate value. In the default
* implementation, the aggregate value is initialized to
* {@link #defaultResult}, which is passed as the `aggregate` argument
* to this method after the first child node is visited.
* @param nextResult The result of the immediately preceeding call to visit
* a child node.
*
* @returns The updated aggregate result.
*/
protected aggregateResult(aggregate: Result, nextResult: Result): Result;
/**
* This method is called after visiting each child in
* {@link #visitChildren}. This method is first called before the first
* child is visited; at that point `currentResult` will be the initial
* value (in the default implementation, the initial value is returned by a
* call to {@link #defaultResult}. This method is not called after the last
* child is visited.
*
* The default implementation always returns `true`, indicating that
* `visitChildren` should only return after all children are visited.
* One reason to override this method is to provide a "short circuit"
* evaluation option for situations where the result of visiting a single
* child has the potential to determine the result of the visit operation as
* a whole.
*
* @param node The {@link RuleNode} whose children are currently being
* visited.
* @param currentResult The current aggregate result of the children visited
* to the current point.
*
* @returns `true` to continue visiting children. Otherwise return
* `false` to stop visiting children and immediately return the
* current aggregate result from {@link #visitChildren}.
*/
protected shouldVisitNextChild(node: RuleNode, currentResult: Result): boolean;
}

View File

@@ -0,0 +1,144 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractParseTreeVisitor = void 0;
const Decorators_1 = require("../Decorators");
class AbstractParseTreeVisitor {
/**
* {@inheritDoc}
*
* The default implementation calls {@link ParseTree#accept} on the
* specified tree.
*/
visit(tree) {
return tree.accept(this);
}
/**
* {@inheritDoc}
*
* The default implementation initializes the aggregate result to
* {@link #defaultResult defaultResult()}. Before visiting each child, it
* calls {@link #shouldVisitNextChild shouldVisitNextChild}; if the result
* is `false` no more children are visited and the current aggregate
* result is returned. After visiting a child, the aggregate result is
* updated by calling {@link #aggregateResult aggregateResult} with the
* previous aggregate result and the result of visiting the child.
*
* The default implementation is not safe for use in visitors that modify
* the tree structure. Visitors that modify the tree should override this
* method to behave properly in respect to the specific algorithm in use.
*/
visitChildren(node) {
let result = this.defaultResult();
let n = node.childCount;
for (let i = 0; i < n; i++) {
if (!this.shouldVisitNextChild(node, result)) {
break;
}
let c = node.getChild(i);
let childResult = c.accept(this);
result = this.aggregateResult(result, childResult);
}
return result;
}
/**
* {@inheritDoc}
*
* The default implementation returns the result of
* {@link #defaultResult defaultResult}.
*/
visitTerminal(node) {
return this.defaultResult();
}
/**
* {@inheritDoc}
*
* The default implementation returns the result of
* {@link #defaultResult defaultResult}.
*/
visitErrorNode(node) {
return this.defaultResult();
}
/**
* Aggregates the results of visiting multiple children of a node. After
* either all children are visited or {@link #shouldVisitNextChild} returns
* `false`, the aggregate value is returned as the result of
* {@link #visitChildren}.
*
* The default implementation returns `nextResult`, meaning
* {@link #visitChildren} will return the result of the last child visited
* (or return the initial value if the node has no children).
*
* @param aggregate The previous aggregate value. In the default
* implementation, the aggregate value is initialized to
* {@link #defaultResult}, which is passed as the `aggregate` argument
* to this method after the first child node is visited.
* @param nextResult The result of the immediately preceeding call to visit
* a child node.
*
* @returns The updated aggregate result.
*/
aggregateResult(aggregate, nextResult) {
return nextResult;
}
/**
* This method is called after visiting each child in
* {@link #visitChildren}. This method is first called before the first
* child is visited; at that point `currentResult` will be the initial
* value (in the default implementation, the initial value is returned by a
* call to {@link #defaultResult}. This method is not called after the last
* child is visited.
*
* The default implementation always returns `true`, indicating that
* `visitChildren` should only return after all children are visited.
* One reason to override this method is to provide a "short circuit"
* evaluation option for situations where the result of visiting a single
* child has the potential to determine the result of the visit operation as
* a whole.
*
* @param node The {@link RuleNode} whose children are currently being
* visited.
* @param currentResult The current aggregate result of the children visited
* to the current point.
*
* @returns `true` to continue visiting children. Otherwise return
* `false` to stop visiting children and immediately return the
* current aggregate result from {@link #visitChildren}.
*/
shouldVisitNextChild(node, currentResult) {
return true;
}
}
__decorate([
Decorators_1.Override,
__param(0, Decorators_1.NotNull)
], AbstractParseTreeVisitor.prototype, "visit", null);
__decorate([
Decorators_1.Override,
__param(0, Decorators_1.NotNull)
], AbstractParseTreeVisitor.prototype, "visitChildren", null);
__decorate([
Decorators_1.Override,
__param(0, Decorators_1.NotNull)
], AbstractParseTreeVisitor.prototype, "visitTerminal", null);
__decorate([
Decorators_1.Override,
__param(0, Decorators_1.NotNull)
], AbstractParseTreeVisitor.prototype, "visitErrorNode", null);
__decorate([
__param(0, Decorators_1.NotNull)
], AbstractParseTreeVisitor.prototype, "shouldVisitNextChild", null);
exports.AbstractParseTreeVisitor = AbstractParseTreeVisitor;
//# sourceMappingURL=AbstractParseTreeVisitor.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTreeVisitor } from "./ParseTreeVisitor";
import { TerminalNode } from "./TerminalNode";
import { Token } from "../Token";
/** Represents a token that was consumed during resynchronization
* rather than during a valid match operation. For example,
* we will create this kind of a node during single token insertion
* and deletion as well as during "consume until error recovery set"
* upon no viable alternative exceptions.
*/
export declare class ErrorNode extends TerminalNode {
constructor(token: Token);
accept<T>(visitor: ParseTreeVisitor<T>): T;
}

View File

@@ -0,0 +1,35 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorNode = void 0;
// ConvertTo-TS run at 2016-10-04T11:26:47.4646355-07:00
const Decorators_1 = require("../Decorators");
const TerminalNode_1 = require("./TerminalNode");
/** Represents a token that was consumed during resynchronization
* rather than during a valid match operation. For example,
* we will create this kind of a node during single token insertion
* and deletion as well as during "consume until error recovery set"
* upon no viable alternative exceptions.
*/
class ErrorNode extends TerminalNode_1.TerminalNode {
constructor(token) {
super(token);
}
accept(visitor) {
return visitor.visitErrorNode(this);
}
}
__decorate([
Decorators_1.Override
], ErrorNode.prototype, "accept", null);
exports.ErrorNode = ErrorNode;
//# sourceMappingURL=ErrorNode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ErrorNode.js","sourceRoot":"","sources":["../../../src/tree/ErrorNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,wDAAwD;AAExD,8CAAyC;AAEzC,iDAA8C;AAG9C;;;;;GAKG;AACH,MAAa,SAAU,SAAQ,2BAAY;IAC1C,YAAY,KAAY;QACvB,KAAK,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;IAGM,MAAM,CAAI,OAA4B;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACD;AAHA;IADC,qBAAQ;uCAGR;AARF,8BASC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:47.4646355-07:00\r\n\r\nimport { Override } from \"../Decorators\";\r\nimport { ParseTreeVisitor } from \"./ParseTreeVisitor\";\r\nimport { TerminalNode } from \"./TerminalNode\";\r\nimport { Token } from \"../Token\";\r\n\r\n/** Represents a token that was consumed during resynchronization\r\n * rather than during a valid match operation. For example,\r\n * we will create this kind of a node during single token insertion\r\n * and deletion as well as during \"consume until error recovery set\"\r\n * upon no viable alternative exceptions.\r\n */\r\nexport class ErrorNode extends TerminalNode {\r\n\tconstructor(token: Token) {\r\n\t\tsuper(token);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic accept<T>(visitor: ParseTreeVisitor<T>): T {\r\n\t\treturn visitor.visitErrorNode(this);\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,36 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Parser } from "../Parser";
import { ParseTreeVisitor } from "./ParseTreeVisitor";
import { RuleContext } from "../RuleContext";
import { SyntaxTree } from "./SyntaxTree";
/** An interface to access the tree of {@link RuleContext} objects created
* during a parse that makes the data structure look like a simple parse tree.
* This node represents both internal nodes, rule invocations,
* and leaf nodes, token matches.
*
* The payload is either a {@link Token} or a {@link RuleContext} object.
*/
export interface ParseTree extends SyntaxTree {
readonly parent: ParseTree | undefined;
/**
* Set the parent for this node.
*
* @since 4.7
*/
setParent(parent: RuleContext): void;
getChild(i: number): ParseTree;
/** The {@link ParseTreeVisitor} needs a double dispatch method. */
accept<T>(visitor: ParseTreeVisitor<T>): T;
/** Return the combined text of all leaf nodes. Does not get any
* off-channel tokens (if any) so won't return whitespace and
* comments if they are sent to parser on hidden channel.
*/
readonly text: string;
/** Specialize toStringTree so that it can print out more information
* based upon the parser.
*/
toStringTree(parser?: Parser): string;
}

View File

@@ -0,0 +1,7 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=ParseTree.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParseTree.js","sourceRoot":"","sources":["../../../src/tree/ParseTree.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:47.5349010-07:00\r\n\r\nimport { Parser } from \"../Parser\";\r\nimport { ParseTreeVisitor } from \"./ParseTreeVisitor\";\r\nimport { RuleContext } from \"../RuleContext\";\r\nimport { SyntaxTree } from \"./SyntaxTree\";\r\n\r\n/** An interface to access the tree of {@link RuleContext} objects created\r\n * during a parse that makes the data structure look like a simple parse tree.\r\n * This node represents both internal nodes, rule invocations,\r\n * and leaf nodes, token matches.\r\n *\r\n * The payload is either a {@link Token} or a {@link RuleContext} object.\r\n */\r\nexport interface ParseTree extends SyntaxTree {\r\n\t// the following methods narrow the return type; they are not additional methods\r\n\t//@Override\r\n\treadonly parent: ParseTree | undefined;\r\n\r\n\t/**\r\n\t * Set the parent for this node.\r\n\t *\r\n\t * @since 4.7\r\n\t */\r\n\tsetParent(parent: RuleContext): void;\r\n\r\n\t//@Override\r\n\tgetChild(i: number): ParseTree;\r\n\r\n\t/** The {@link ParseTreeVisitor} needs a double dispatch method. */\r\n\taccept<T>(visitor: ParseTreeVisitor<T>): T;\r\n\r\n\t/** Return the combined text of all leaf nodes. Does not get any\r\n\t * off-channel tokens (if any) so won't return whitespace and\r\n\t * comments if they are sent to parser on hidden channel.\r\n\t */\r\n\treadonly text: string;\r\n\r\n\t/** Specialize toStringTree so that it can print out more information\r\n\t * \tbased upon the parser.\r\n\t */\r\n\ttoStringTree(parser?: Parser): string;\r\n}\r\n"]}

View File

@@ -0,0 +1,26 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ErrorNode } from "./ErrorNode";
import { ParserRuleContext } from "../ParserRuleContext";
import { TerminalNode } from "./TerminalNode";
/** This interface describes the minimal core of methods triggered
* by {@link ParseTreeWalker}. E.g.,
*
* ```
* ParseTreeWalker walker = new ParseTreeWalker();
* walker.walk(myParseTreeListener, myParseTree); <-- triggers events in your listener
* ```
*
* If you want to trigger events in multiple listeners during a single
* tree walk, you can use the ParseTreeDispatcher object available at
*
* https://github.com/antlr/antlr4/issues/841
*/
export interface ParseTreeListener {
visitTerminal?: (/*@NotNull*/ node: TerminalNode) => void;
visitErrorNode?: (/*@NotNull*/ node: ErrorNode) => void;
enterEveryRule?: (/*@NotNull*/ ctx: ParserRuleContext) => void;
exitEveryRule?: (/*@NotNull*/ ctx: ParserRuleContext) => void;
}

View File

@@ -0,0 +1,7 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=ParseTreeListener.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParseTreeListener.js","sourceRoot":"","sources":["../../../src/tree/ParseTreeListener.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:47.6109431-07:00\r\n\r\nimport { ErrorNode } from \"./ErrorNode\";\r\nimport { ParserRuleContext } from \"../ParserRuleContext\";\r\nimport { TerminalNode } from \"./TerminalNode\";\r\n\r\n/** This interface describes the minimal core of methods triggered\r\n * by {@link ParseTreeWalker}. E.g.,\r\n *\r\n * ```\r\n * ParseTreeWalker walker = new ParseTreeWalker();\r\n * walker.walk(myParseTreeListener, myParseTree); <-- triggers events in your listener\r\n * ```\r\n *\r\n * If you want to trigger events in multiple listeners during a single\r\n * tree walk, you can use the ParseTreeDispatcher object available at\r\n *\r\n * \t\thttps://github.com/antlr/antlr4/issues/841\r\n */\r\nexport interface ParseTreeListener {\r\n\tvisitTerminal?: (/*@NotNull*/ node: TerminalNode) => void;\r\n\tvisitErrorNode?: (/*@NotNull*/ node: ErrorNode) => void;\r\n\tenterEveryRule?: (/*@NotNull*/ ctx: ParserRuleContext) => void;\r\n\texitEveryRule?: (/*@NotNull*/ ctx: ParserRuleContext) => void;\r\n}\r\n"]}

View File

@@ -0,0 +1,28 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "./ParseTree";
/**
* Associate a property with a parse tree node. Useful with parse tree listeners
* that need to associate values with particular tree nodes, kind of like
* specifying a return value for the listener event method that visited a
* particular node. Example:
*
* ```
* ParseTreeProperty<Integer> values = new ParseTreeProperty<Integer>();
* values.put(tree, 36);
* int x = values.get(tree);
* values.removeFrom(tree);
* ```
*
* You would make one decl (values here) in the listener and use lots of times
* in your event methods.
*/
export declare class ParseTreeProperty<V> {
private _symbol;
constructor(name?: string);
get(node: ParseTree): V;
set(node: ParseTree, value: V): void;
removeFrom(node: ParseTree): V;
}

View File

@@ -0,0 +1,41 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseTreeProperty = void 0;
/**
* Associate a property with a parse tree node. Useful with parse tree listeners
* that need to associate values with particular tree nodes, kind of like
* specifying a return value for the listener event method that visited a
* particular node. Example:
*
* ```
* ParseTreeProperty<Integer> values = new ParseTreeProperty<Integer>();
* values.put(tree, 36);
* int x = values.get(tree);
* values.removeFrom(tree);
* ```
*
* You would make one decl (values here) in the listener and use lots of times
* in your event methods.
*/
class ParseTreeProperty {
constructor(name = "ParseTreeProperty") {
this._symbol = Symbol(name);
}
get(node) {
return node[this._symbol];
}
set(node, value) {
node[this._symbol] = value;
}
removeFrom(node) {
let result = node[this._symbol];
delete node[this._symbol];
return result;
}
}
exports.ParseTreeProperty = ParseTreeProperty;
//# sourceMappingURL=ParseTreeProperty.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParseTreeProperty.js","sourceRoot":"","sources":["../../../src/tree/ParseTreeProperty.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH;;;;;;;;;;;;;;;GAeG;AACH,MAAa,iBAAiB;IAG7B,YAAY,OAAe,mBAAmB;QAC7C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAC,IAAe;QACzB,OAAQ,IAAY,CAAC,IAAI,CAAC,OAAO,CAAM,CAAC;IACzC,CAAC;IAEM,GAAG,CAAC,IAAe,EAAE,KAAQ;QAClC,IAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;IACrC,CAAC;IAEM,UAAU,CAAC,IAAe;QAChC,IAAI,MAAM,GAAI,IAAY,CAAC,IAAI,CAAC,OAAO,CAAM,CAAC;QAC9C,OAAQ,IAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AApBD,8CAoBC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:47.6782223-07:00\r\n\r\nimport { ParseTree } from \"./ParseTree\";\r\n\r\n/**\r\n * Associate a property with a parse tree node. Useful with parse tree listeners\r\n * that need to associate values with particular tree nodes, kind of like\r\n * specifying a return value for the listener event method that visited a\r\n * particular node. Example:\r\n *\r\n * ```\r\n * ParseTreeProperty<Integer> values = new ParseTreeProperty<Integer>();\r\n * values.put(tree, 36);\r\n * int x = values.get(tree);\r\n * values.removeFrom(tree);\r\n * ```\r\n *\r\n * You would make one decl (values here) in the listener and use lots of times\r\n * in your event methods.\r\n */\r\nexport class ParseTreeProperty<V> {\r\n\tprivate _symbol: symbol;\r\n\r\n\tconstructor(name: string = \"ParseTreeProperty\") {\r\n\t\tthis._symbol = Symbol(name);\r\n\t}\r\n\r\n\tpublic get(node: ParseTree): V {\r\n\t\treturn (node as any)[this._symbol] as V;\r\n\t}\r\n\r\n\tpublic set(node: ParseTree, value: V): void {\r\n\t\t(node as any)[this._symbol] = value;\r\n\t}\r\n\r\n\tpublic removeFrom(node: ParseTree): V {\r\n\t\tlet result = (node as any)[this._symbol] as V;\r\n\t\tdelete (node as any)[this._symbol];\r\n\t\treturn result;\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,48 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ErrorNode } from "./ErrorNode";
import { ParseTree } from "./ParseTree";
import { RuleNode } from "./RuleNode";
import { TerminalNode } from "./TerminalNode";
/**
* This interface defines the basic notion of a parse tree visitor. Generated
* visitors implement this interface and the `XVisitor` interface for
* grammar `X`.
*
* @author Sam Harwell
* @param <Result> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
export interface ParseTreeVisitor<Result> {
/**
* Visit a parse tree, and return a user-defined result of the operation.
*
* @param tree The {@link ParseTree} to visit.
* @returns The result of visiting the parse tree.
*/
visit(/*@NotNull*/ tree: ParseTree): Result;
/**
* Visit the children of a node, and return a user-defined result
* of the operation.
*
* @param node The {@link RuleNode} whose children should be visited.
* @returns The result of visiting the children of the node.
*/
visitChildren(/*@NotNull*/ node: RuleNode): Result;
/**
* Visit a terminal node, and return a user-defined result of the operation.
*
* @param node The {@link TerminalNode} to visit.
* @returns The result of visiting the node.
*/
visitTerminal(/*@NotNull*/ node: TerminalNode): Result;
/**
* Visit an error node, and return a user-defined result of the operation.
*
* @param node The {@link ErrorNode} to visit.
* @returns The result of visiting the node.
*/
visitErrorNode(/*@NotNull*/ node: ErrorNode): Result;
}

View File

@@ -0,0 +1,7 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=ParseTreeVisitor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParseTreeVisitor.js","sourceRoot":"","sources":["../../../src/tree/ParseTreeVisitor.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:47.7512217-07:00\r\n\r\nimport { ErrorNode } from \"./ErrorNode\";\r\nimport { ParseTree } from \"./ParseTree\";\r\nimport { RuleNode } from \"./RuleNode\";\r\nimport { TerminalNode } from \"./TerminalNode\";\r\n\r\n/**\r\n * This interface defines the basic notion of a parse tree visitor. Generated\r\n * visitors implement this interface and the `XVisitor` interface for\r\n * grammar `X`.\r\n *\r\n * @author Sam Harwell\r\n * @param <Result> The return type of the visit operation. Use {@link Void} for\r\n * operations with no return type.\r\n */\r\nexport interface ParseTreeVisitor<Result> {\r\n\r\n\t/**\r\n\t * Visit a parse tree, and return a user-defined result of the operation.\r\n\t *\r\n\t * @param tree The {@link ParseTree} to visit.\r\n\t * @returns The result of visiting the parse tree.\r\n\t */\r\n\tvisit(/*@NotNull*/ tree: ParseTree): Result;\r\n\r\n\t/**\r\n\t * Visit the children of a node, and return a user-defined result\r\n\t * of the operation.\r\n\t *\r\n\t * @param node The {@link RuleNode} whose children should be visited.\r\n\t * @returns The result of visiting the children of the node.\r\n\t */\r\n\tvisitChildren(/*@NotNull*/ node: RuleNode): Result;\r\n\r\n\t/**\r\n\t * Visit a terminal node, and return a user-defined result of the operation.\r\n\t *\r\n\t * @param node The {@link TerminalNode} to visit.\r\n\t * @returns The result of visiting the node.\r\n\t */\r\n\tvisitTerminal(/*@NotNull*/ node: TerminalNode): Result;\r\n\r\n\t/**\r\n\t * Visit an error node, and return a user-defined result of the operation.\r\n\t *\r\n\t * @param node The {@link ErrorNode} to visit.\r\n\t * @returns The result of visiting the node.\r\n\t */\r\n\tvisitErrorNode(/*@NotNull*/ node: ErrorNode): Result;\r\n\r\n}\r\n"]}

View File

@@ -0,0 +1,35 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "./ParseTree";
import { ParseTreeListener } from "./ParseTreeListener";
import { RuleNode } from "./RuleNode";
export declare class ParseTreeWalker {
/**
* Performs a walk on the given parse tree starting at the root and going down recursively
* with depth-first search. On each node, {@link ParseTreeWalker#enterRule} is called before
* recursively walking down into child nodes, then
* {@link ParseTreeWalker#exitRule} is called after the recursive call to wind up.
* @param listener The listener used by the walker to process grammar rules
* @param t The parse tree to be walked on
*/
walk<T extends ParseTreeListener>(listener: T, t: ParseTree): void;
/**
* Enters a grammar rule by first triggering the generic event {@link ParseTreeListener#enterEveryRule}
* then by triggering the event specific to the given parse tree node
* @param listener The listener responding to the trigger events
* @param r The grammar rule containing the rule context
*/
protected enterRule(listener: ParseTreeListener, r: RuleNode): void;
/**
* Exits a grammar rule by first triggering the event specific to the given parse tree node
* then by triggering the generic event {@link ParseTreeListener#exitEveryRule}
* @param listener The listener responding to the trigger events
* @param r The grammar rule containing the rule context
*/
protected exitRule(listener: ParseTreeListener, r: RuleNode): void;
}
export declare namespace ParseTreeWalker {
const DEFAULT: ParseTreeWalker;
}

View File

@@ -0,0 +1,104 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseTreeWalker = void 0;
const ErrorNode_1 = require("./ErrorNode");
const TerminalNode_1 = require("./TerminalNode");
const RuleNode_1 = require("./RuleNode");
class ParseTreeWalker {
/**
* Performs a walk on the given parse tree starting at the root and going down recursively
* with depth-first search. On each node, {@link ParseTreeWalker#enterRule} is called before
* recursively walking down into child nodes, then
* {@link ParseTreeWalker#exitRule} is called after the recursive call to wind up.
* @param listener The listener used by the walker to process grammar rules
* @param t The parse tree to be walked on
*/
walk(listener, t) {
let nodeStack = [];
let indexStack = [];
let currentNode = t;
let currentIndex = 0;
while (currentNode) {
// pre-order visit
if (currentNode instanceof ErrorNode_1.ErrorNode) {
if (listener.visitErrorNode) {
listener.visitErrorNode(currentNode);
}
}
else if (currentNode instanceof TerminalNode_1.TerminalNode) {
if (listener.visitTerminal) {
listener.visitTerminal(currentNode);
}
}
else {
this.enterRule(listener, currentNode);
}
// Move down to first child, if exists
if (currentNode.childCount > 0) {
nodeStack.push(currentNode);
indexStack.push(currentIndex);
currentIndex = 0;
currentNode = currentNode.getChild(0);
continue;
}
// No child nodes, so walk tree
do {
// post-order visit
if (currentNode instanceof RuleNode_1.RuleNode) {
this.exitRule(listener, currentNode);
}
// No parent, so no siblings
if (nodeStack.length === 0) {
currentNode = undefined;
currentIndex = 0;
break;
}
// Move to next sibling if possible
let last = nodeStack[nodeStack.length - 1];
currentIndex++;
currentNode = currentIndex < last.childCount ? last.getChild(currentIndex) : undefined;
if (currentNode) {
break;
}
// No next sibling, so move up
currentNode = nodeStack.pop();
currentIndex = indexStack.pop();
} while (currentNode);
}
}
/**
* Enters a grammar rule by first triggering the generic event {@link ParseTreeListener#enterEveryRule}
* then by triggering the event specific to the given parse tree node
* @param listener The listener responding to the trigger events
* @param r The grammar rule containing the rule context
*/
enterRule(listener, r) {
let ctx = r.ruleContext;
if (listener.enterEveryRule) {
listener.enterEveryRule(ctx);
}
ctx.enterRule(listener);
}
/**
* Exits a grammar rule by first triggering the event specific to the given parse tree node
* then by triggering the generic event {@link ParseTreeListener#exitEveryRule}
* @param listener The listener responding to the trigger events
* @param r The grammar rule containing the rule context
*/
exitRule(listener, r) {
let ctx = r.ruleContext;
ctx.exitRule(listener);
if (listener.exitEveryRule) {
listener.exitEveryRule(ctx);
}
}
}
exports.ParseTreeWalker = ParseTreeWalker;
(function (ParseTreeWalker) {
ParseTreeWalker.DEFAULT = new ParseTreeWalker();
})(ParseTreeWalker = exports.ParseTreeWalker || (exports.ParseTreeWalker = {}));
//# sourceMappingURL=ParseTreeWalker.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,21 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { RuleContext } from "../RuleContext";
import { ParseTree } from "./ParseTree";
import { ParseTreeVisitor } from "./ParseTreeVisitor";
import { Parser } from "../Parser";
import { Interval } from "../misc/Interval";
export declare abstract class RuleNode implements ParseTree {
abstract readonly ruleContext: RuleContext;
abstract readonly parent: RuleNode | undefined;
abstract setParent(parent: RuleContext): void;
abstract getChild(i: number): ParseTree;
abstract accept<T>(visitor: ParseTreeVisitor<T>): T;
abstract readonly text: string;
abstract toStringTree(parser?: Parser | undefined): string;
abstract readonly sourceInterval: Interval;
abstract readonly payload: any;
abstract readonly childCount: number;
}

View File

@@ -0,0 +1,11 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RuleNode = void 0;
class RuleNode {
}
exports.RuleNode = RuleNode;
//# sourceMappingURL=RuleNode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"RuleNode.js","sourceRoot":"","sources":["../../../src/tree/RuleNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,MAAsB,QAAQ;CAqB7B;AArBD,4BAqBC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:47.9232756-07:00\r\n\r\nimport { RuleContext } from \"../RuleContext\";\r\nimport { ParseTree } from \"./ParseTree\";\r\nimport { ParseTreeVisitor } from \"./ParseTreeVisitor\";\r\nimport { Parser } from \"../Parser\";\r\nimport { Interval } from \"../misc/Interval\";\r\n\r\nexport abstract class RuleNode implements ParseTree {\r\n\tpublic abstract readonly ruleContext: RuleContext;\r\n\r\n\t//@Override\r\n\tpublic abstract readonly parent: RuleNode | undefined;\r\n\r\n\tpublic abstract setParent(parent: RuleContext): void;\r\n\r\n\tpublic abstract getChild(i: number): ParseTree;\r\n\r\n\tpublic abstract accept<T>(visitor: ParseTreeVisitor<T>): T;\r\n\r\n\tpublic abstract readonly text: string;\r\n\r\n\tpublic abstract toStringTree(parser?: Parser | undefined): string;\r\n\r\n\tpublic abstract readonly sourceInterval: Interval;\r\n\r\n\tpublic abstract readonly payload: any;\r\n\r\n\tpublic abstract readonly childCount: number;\r\n}\r\n"]}

View File

@@ -0,0 +1,29 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Tree } from "./Tree";
import { Interval } from "../misc/Interval";
/** A tree that knows about an interval in a token stream
* is some kind of syntax tree. Subinterfaces distinguish
* between parse trees and other kinds of syntax trees we might want to create.
*/
export interface SyntaxTree extends Tree {
/**
* Return an {@link Interval} indicating the index in the
* {@link TokenStream} of the first and last token associated with this
* subtree. If this node is a leaf, then the interval represents a single
* token and has interval i..i for token index i.
*
* An interval of i..i-1 indicates an empty interval at position
* i in the input stream, where 0 &lt;= i &lt;= the size of the input
* token stream. Currently, the code base can only have i=0..n-1 but
* in concept one could have an empty interval after EOF.
*
* If source interval is unknown, this returns {@link Interval#INVALID}.
*
* As a weird special case, the source interval for rules matched after
* EOF is unspecified.
*/
readonly sourceInterval: Interval;
}

View File

@@ -0,0 +1,7 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=SyntaxTree.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SyntaxTree.js","sourceRoot":"","sources":["../../../src/tree/SyntaxTree.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:47.9953174-07:00\r\n\r\nimport { Tree } from \"./Tree\";\r\nimport { Interval } from \"../misc/Interval\";\r\n\r\n/** A tree that knows about an interval in a token stream\r\n * is some kind of syntax tree. Subinterfaces distinguish\r\n * between parse trees and other kinds of syntax trees we might want to create.\r\n */\r\nexport interface SyntaxTree extends Tree {\r\n\t/**\r\n\t * Return an {@link Interval} indicating the index in the\r\n\t * {@link TokenStream} of the first and last token associated with this\r\n\t * subtree. If this node is a leaf, then the interval represents a single\r\n\t * token and has interval i..i for token index i.\r\n\t *\r\n\t * An interval of i..i-1 indicates an empty interval at position\r\n\t * i in the input stream, where 0 &lt;= i &lt;= the size of the input\r\n\t * token stream. Currently, the code base can only have i=0..n-1 but\r\n\t * in concept one could have an empty interval after EOF.\r\n\t *\r\n\t * If source interval is unknown, this returns {@link Interval#INVALID}.\r\n\t *\r\n\t * As a weird special case, the source interval for rules matched after\r\n\t * EOF is unspecified.\r\n\t */\r\n\t//@NotNull\r\n\treadonly sourceInterval: Interval;\r\n}\r\n"]}

View File

@@ -0,0 +1,27 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Interval } from "../misc/Interval";
import { Parser } from "../Parser";
import { ParseTree } from "./ParseTree";
import { ParseTreeVisitor } from "./ParseTreeVisitor";
import { RuleContext } from "../RuleContext";
import { RuleNode } from "./RuleNode";
import { Token } from "../Token";
export declare class TerminalNode implements ParseTree {
_symbol: Token;
_parent: RuleNode | undefined;
constructor(symbol: Token);
getChild(i: number): never;
get symbol(): Token;
get parent(): RuleNode | undefined;
setParent(parent: RuleContext): void;
get payload(): Token;
get sourceInterval(): Interval;
get childCount(): number;
accept<T>(visitor: ParseTreeVisitor<T>): T;
get text(): string;
toStringTree(parser?: Parser): string;
toString(): string;
}

View File

@@ -0,0 +1,91 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TerminalNode = void 0;
// ConvertTo-TS run at 2016-10-04T11:26:48.1433686-07:00
const Interval_1 = require("../misc/Interval");
const Decorators_1 = require("../Decorators");
const Token_1 = require("../Token");
class TerminalNode {
constructor(symbol) {
this._symbol = symbol;
}
getChild(i) {
throw new RangeError("Terminal Node has no children.");
}
get symbol() {
return this._symbol;
}
get parent() {
return this._parent;
}
setParent(parent) {
this._parent = parent;
}
get payload() {
return this._symbol;
}
get sourceInterval() {
let tokenIndex = this._symbol.tokenIndex;
return new Interval_1.Interval(tokenIndex, tokenIndex);
}
get childCount() {
return 0;
}
accept(visitor) {
return visitor.visitTerminal(this);
}
get text() {
return this._symbol.text || "";
}
toStringTree(parser) {
return this.toString();
}
toString() {
if (this._symbol.type === Token_1.Token.EOF) {
return "<EOF>";
}
return this._symbol.text || "";
}
}
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "getChild", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "parent", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "setParent", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "payload", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "sourceInterval", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "childCount", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "accept", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "text", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "toStringTree", null);
__decorate([
Decorators_1.Override
], TerminalNode.prototype, "toString", null);
exports.TerminalNode = TerminalNode;
//# sourceMappingURL=TerminalNode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TerminalNode.js","sourceRoot":"","sources":["../../../src/tree/TerminalNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,wDAAwD;AAExD,+CAA4C;AAC5C,8CAAyC;AAMzC,oCAAiC;AAEjC,MAAa,YAAY;IAIxB,YAAY,MAAa;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACvB,CAAC;IAGM,QAAQ,CAAC,CAAS;QACxB,MAAM,IAAI,UAAU,CAAC,gCAAgC,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAGD,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAGM,SAAS,CAAC,MAAmB;QACnC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACvB,CAAC;IAGD,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAGD,IAAI,cAAc;QACjB,IAAI,UAAU,GAAW,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACjD,OAAO,IAAI,mBAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;IAGD,IAAI,UAAU;QACb,OAAO,CAAC,CAAC;IACV,CAAC;IAGM,MAAM,CAAI,OAA4B;QAC5C,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAGD,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;IAChC,CAAC;IAGM,YAAY,CAAC,MAAe;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAGM,QAAQ;QACd,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,aAAK,CAAC,GAAG,EAAE;YACpC,OAAO,OAAO,CAAC;SACf;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;IAChC,CAAC;CACD;AAzDA;IADC,qBAAQ;4CAGR;AAOD;IADC,qBAAQ;0CAGR;AAGD;IADC,qBAAQ;6CAGR;AAGD;IADC,qBAAQ;2CAGR;AAGD;IADC,qBAAQ;kDAIR;AAGD;IADC,qBAAQ;8CAGR;AAGD;IADC,qBAAQ;0CAGR;AAGD;IADC,qBAAQ;wCAGR;AAGD;IADC,qBAAQ;gDAGR;AAGD;IADC,qBAAQ;4CAOR;AAjEF,oCAkEC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:48.1433686-07:00\r\n\r\nimport { Interval } from \"../misc/Interval\";\r\nimport { Override } from \"../Decorators\";\r\nimport { Parser } from \"../Parser\";\r\nimport { ParseTree } from \"./ParseTree\";\r\nimport { ParseTreeVisitor } from \"./ParseTreeVisitor\";\r\nimport { RuleContext } from \"../RuleContext\";\r\nimport { RuleNode } from \"./RuleNode\";\r\nimport { Token } from \"../Token\";\r\n\r\nexport class TerminalNode implements ParseTree {\r\n\tpublic _symbol: Token;\r\n\tpublic _parent: RuleNode | undefined;\r\n\r\n\tconstructor(symbol: Token) {\r\n\t\tthis._symbol = symbol;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic getChild(i: number): never {\r\n\t\tthrow new RangeError(\"Terminal Node has no children.\");\r\n\t}\r\n\r\n\tget symbol(): Token {\r\n\t\treturn this._symbol;\r\n\t}\r\n\r\n\t@Override\r\n\tget parent(): RuleNode | undefined {\r\n\t\treturn this._parent;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic setParent(parent: RuleContext): void {\r\n\t\tthis._parent = parent;\r\n\t}\r\n\r\n\t@Override\r\n\tget payload(): Token {\r\n\t\treturn this._symbol;\r\n\t}\r\n\r\n\t@Override\r\n\tget sourceInterval(): Interval {\r\n\t\tlet tokenIndex: number = this._symbol.tokenIndex;\r\n\t\treturn new Interval(tokenIndex, tokenIndex);\r\n\t}\r\n\r\n\t@Override\r\n\tget childCount(): number {\r\n\t\treturn 0;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic accept<T>(visitor: ParseTreeVisitor<T>): T {\r\n\t\treturn visitor.visitTerminal(this);\r\n\t}\r\n\r\n\t@Override\r\n\tget text(): string {\r\n\t\treturn this._symbol.text || \"\";\r\n\t}\r\n\r\n\t@Override\r\n\tpublic toStringTree(parser?: Parser): string {\r\n\t\treturn this.toString();\r\n\t}\r\n\r\n\t@Override\r\n\tpublic toString(): string {\r\n\t\tif (this._symbol.type === Token.EOF) {\r\n\t\t\treturn \"<EOF>\";\r\n\t\t}\r\n\r\n\t\treturn this._symbol.text || \"\";\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,36 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
/** The basic notion of a tree has a parent, a payload, and a list of children.
* It is the most abstract interface for all the trees used by ANTLR.
*/
export interface Tree {
/** The parent of this node. If the return value is `undefined`, then this
* node is the root of the tree.
*/
readonly parent: Tree | undefined;
/**
* This method returns whatever object represents the data at this node. For
* example, for parse trees, the payload can be a {@link Token} representing
* a leaf node or a {@link RuleContext} object representing a rule
* invocation. For abstract syntax trees (ASTs), this is a {@link Token}
* object.
*/
readonly payload: {
text?: string;
};
/**
* If there are children, get the `i`th value indexed from 0. Throws a `RangeError` if `i` is less than zero, or
* greater than or equal to `childCount`.
*/
getChild(i: number): Tree;
/** How many children are there? If there is none, then this
* node represents a leaf node.
*/
readonly childCount: number;
/** Print out a whole tree, not just a node, in LISP format
* `(root child1 .. childN)`. Print just a node if this is a leaf.
*/
toStringTree(): string;
}

View File

@@ -0,0 +1,7 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Tree.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../src/tree/Tree.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-02T21:58:18.5966470-07:00\r\n\r\n/** The basic notion of a tree has a parent, a payload, and a list of children.\r\n * It is the most abstract interface for all the trees used by ANTLR.\r\n */\r\nexport interface Tree {\r\n\t/** The parent of this node. If the return value is `undefined`, then this\r\n\t * node is the root of the tree.\r\n\t */\r\n\treadonly parent: Tree | undefined;\r\n\r\n\t/**\r\n\t * This method returns whatever object represents the data at this node. For\r\n\t * example, for parse trees, the payload can be a {@link Token} representing\r\n\t * a leaf node or a {@link RuleContext} object representing a rule\r\n\t * invocation. For abstract syntax trees (ASTs), this is a {@link Token}\r\n\t * object.\r\n\t */\r\n\treadonly payload: { text?: string };\r\n\r\n\t/**\r\n\t * If there are children, get the `i`th value indexed from 0. Throws a `RangeError` if `i` is less than zero, or\r\n\t * greater than or equal to `childCount`.\r\n\t */\r\n\tgetChild(i: number): Tree;\r\n\r\n\t/** How many children are there? If there is none, then this\r\n\t * node represents a leaf node.\r\n\t */\r\n\treadonly childCount: number;\r\n\r\n\t/** Print out a whole tree, not just a node, in LISP format\r\n\t * `(root child1 .. childN)`. Print just a node if this is a leaf.\r\n\t */\r\n\ttoStringTree(): string;\r\n}\r\n"]}

View File

@@ -0,0 +1,75 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Parser } from "../Parser";
import { ParserRuleContext } from "../ParserRuleContext";
import { ParseTree } from "./ParseTree";
import { Tree } from "./Tree";
/** A set of utility routines useful for all kinds of ANTLR trees. */
export declare class Trees {
/** Print out a whole tree in LISP form. {@link #getNodeText} is used on the
* node payloads to get the text for the nodes. Detect
* parse trees and extract data appropriately.
*/
static toStringTree(/*@NotNull*/ t: Tree): string;
/** Print out a whole tree in LISP form. {@link #getNodeText} is used on the
* node payloads to get the text for the nodes. Detect
* parse trees and extract data appropriately.
*/
static toStringTree(/*@NotNull*/ t: Tree, recog: Parser | undefined): string;
/** Print out a whole tree in LISP form. {@link #getNodeText} is used on the
* node payloads to get the text for the nodes.
*/
static toStringTree(/*@NotNull*/ t: Tree, /*@Nullable*/ ruleNames: string[] | undefined): string;
static toStringTree(/*@NotNull*/ t: Tree, arg2?: Parser | string[]): string;
static getNodeText(/*@NotNull*/ t: Tree, recog: Parser | undefined): string;
static getNodeText(/*@NotNull*/ t: Tree, ruleNames: string[] | undefined): string;
/** Return ordered list of all children of this node */
static getChildren(t: ParseTree): ParseTree[];
static getChildren(t: Tree): Tree[];
/** Return a list of all ancestors of this node. The first node of
* list is the root and the last is the parent of this node.
*
* @since 4.5.1
*/
static getAncestors(t: ParseTree): ParseTree[];
static getAncestors(t: Tree): Tree[];
/** Return true if t is u's parent or a node on path to root from u.
* Use === not equals().
*
* @since 4.5.1
*/
static isAncestorOf(t: Tree, u: Tree): boolean;
static findAllTokenNodes(t: ParseTree, ttype: number): ParseTree[];
static findAllRuleNodes(t: ParseTree, ruleIndex: number): ParseTree[];
static findAllNodes(t: ParseTree, index: number, findTokens: boolean): ParseTree[];
static _findAllNodes(t: ParseTree, index: number, findTokens: boolean, nodes: ParseTree[]): void;
/** Get all descendents; includes t itself.
*
* @since 4.5.1
*/
static getDescendants(t: ParseTree): ParseTree[];
/** Find smallest subtree of t enclosing range startTokenIndex..stopTokenIndex
* inclusively using postorder traversal. Recursive depth-first-search.
*
* @since 4.5
*/
static getRootOfSubtreeEnclosingRegion(t: ParseTree, startTokenIndex: number, // inclusive
stopTokenIndex: number): ParserRuleContext | undefined;
/** Replace any subtree siblings of root that are completely to left
* or right of lookahead range with a CommonToken(Token.INVALID_TYPE,"...")
* node. The source interval for t is not altered to suit smaller range!
*
* WARNING: destructive to t.
*
* @since 4.5.1
*/
static stripChildrenOutOfRange(t: ParserRuleContext, root: ParserRuleContext, startIndex: number, stopIndex: number): void;
/** Return first node satisfying the pred
*
* @since 4.5.1
*/
static findNodeSuchThat(t: ParseTree, pred: (tree: ParseTree) => boolean): ParseTree | undefined;
static findNodeSuchThat(t: Tree, pred: (tree: Tree) => boolean): Tree | undefined;
}

View File

@@ -0,0 +1,243 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Trees = void 0;
const ATN_1 = require("../atn/ATN");
const CommonToken_1 = require("../CommonToken");
const ErrorNode_1 = require("./ErrorNode");
const Decorators_1 = require("../Decorators");
const Parser_1 = require("../Parser");
const ParserRuleContext_1 = require("../ParserRuleContext");
const RuleNode_1 = require("./RuleNode");
const TerminalNode_1 = require("./TerminalNode");
const Token_1 = require("../Token");
const Utils = require("../misc/Utils");
/** A set of utility routines useful for all kinds of ANTLR trees. */
class Trees {
static toStringTree(t, arg2) {
let ruleNames;
if (arg2 instanceof Parser_1.Parser) {
ruleNames = arg2.ruleNames;
}
else {
ruleNames = arg2;
}
let s = Utils.escapeWhitespace(this.getNodeText(t, ruleNames), false);
if (t.childCount === 0) {
return s;
}
let buf = "";
buf += ("(");
s = Utils.escapeWhitespace(this.getNodeText(t, ruleNames), false);
buf += (s);
buf += (" ");
for (let i = 0; i < t.childCount; i++) {
if (i > 0) {
buf += (" ");
}
buf += (this.toStringTree(t.getChild(i), ruleNames));
}
buf += (")");
return buf;
}
static getNodeText(t, arg2) {
let ruleNames;
if (arg2 instanceof Parser_1.Parser) {
ruleNames = arg2.ruleNames;
}
else if (arg2) {
ruleNames = arg2;
}
else {
// no recog or rule names
let payload = t.payload;
if (typeof payload.text === "string") {
return payload.text;
}
return t.payload.toString();
}
if (t instanceof RuleNode_1.RuleNode) {
let ruleContext = t.ruleContext;
let ruleIndex = ruleContext.ruleIndex;
let ruleName = ruleNames[ruleIndex];
let altNumber = ruleContext.altNumber;
if (altNumber !== ATN_1.ATN.INVALID_ALT_NUMBER) {
return ruleName + ":" + altNumber;
}
return ruleName;
}
else if (t instanceof ErrorNode_1.ErrorNode) {
return t.toString();
}
else if (t instanceof TerminalNode_1.TerminalNode) {
let symbol = t.symbol;
return symbol.text || "";
}
throw new TypeError("Unexpected node type");
}
static getChildren(t) {
let kids = [];
for (let i = 0; i < t.childCount; i++) {
kids.push(t.getChild(i));
}
return kids;
}
static getAncestors(t) {
let ancestors = [];
let p = t.parent;
while (p) {
ancestors.unshift(p); // insert at start
p = p.parent;
}
return ancestors;
}
/** Return true if t is u's parent or a node on path to root from u.
* Use === not equals().
*
* @since 4.5.1
*/
static isAncestorOf(t, u) {
if (!t || !u || !t.parent) {
return false;
}
let p = u.parent;
while (p) {
if (t === p) {
return true;
}
p = p.parent;
}
return false;
}
static findAllTokenNodes(t, ttype) {
return Trees.findAllNodes(t, ttype, true);
}
static findAllRuleNodes(t, ruleIndex) {
return Trees.findAllNodes(t, ruleIndex, false);
}
static findAllNodes(t, index, findTokens) {
let nodes = [];
Trees._findAllNodes(t, index, findTokens, nodes);
return nodes;
}
static _findAllNodes(t, index, findTokens, nodes) {
// check this node (the root) first
if (findTokens && t instanceof TerminalNode_1.TerminalNode) {
if (t.symbol.type === index) {
nodes.push(t);
}
}
else if (!findTokens && t instanceof ParserRuleContext_1.ParserRuleContext) {
if (t.ruleIndex === index) {
nodes.push(t);
}
}
// check children
for (let i = 0; i < t.childCount; i++) {
Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
}
}
/** Get all descendents; includes t itself.
*
* @since 4.5.1
*/
static getDescendants(t) {
let nodes = [];
function recurse(e) {
nodes.push(e);
const n = e.childCount;
for (let i = 0; i < n; i++) {
recurse(e.getChild(i));
}
}
recurse(t);
return nodes;
}
/** Find smallest subtree of t enclosing range startTokenIndex..stopTokenIndex
* inclusively using postorder traversal. Recursive depth-first-search.
*
* @since 4.5
*/
static getRootOfSubtreeEnclosingRegion(t, startTokenIndex, // inclusive
stopTokenIndex) {
let n = t.childCount;
for (let i = 0; i < n; i++) {
let child = t.getChild(i);
let r = Trees.getRootOfSubtreeEnclosingRegion(child, startTokenIndex, stopTokenIndex);
if (r) {
return r;
}
}
if (t instanceof ParserRuleContext_1.ParserRuleContext) {
let stopToken = t.stop;
if (startTokenIndex >= t.start.tokenIndex && // is range fully contained in t?
(stopToken == null || stopTokenIndex <= stopToken.tokenIndex)) {
// note: r.stop==null likely implies that we bailed out of parser and there's nothing to the right
return t;
}
}
return undefined;
}
/** Replace any subtree siblings of root that are completely to left
* or right of lookahead range with a CommonToken(Token.INVALID_TYPE,"...")
* node. The source interval for t is not altered to suit smaller range!
*
* WARNING: destructive to t.
*
* @since 4.5.1
*/
static stripChildrenOutOfRange(t, root, startIndex, stopIndex) {
if (!t) {
return;
}
let count = t.childCount;
for (let i = 0; i < count; i++) {
let child = t.getChild(i);
let range = child.sourceInterval;
if (child instanceof ParserRuleContext_1.ParserRuleContext && (range.b < startIndex || range.a > stopIndex)) {
if (Trees.isAncestorOf(child, root)) { // replace only if subtree doesn't have displayed root
let abbrev = new CommonToken_1.CommonToken(Token_1.Token.INVALID_TYPE, "...");
t.children[i] = new TerminalNode_1.TerminalNode(abbrev); // HACK access to private
}
}
}
}
static findNodeSuchThat(t, pred) {
// No type check needed as long as users only use one of the available overloads
if (pred(t)) {
return t;
}
let n = t.childCount;
for (let i = 0; i < n; i++) {
let u = Trees.findNodeSuchThat(t.getChild(i), pred);
if (u !== undefined) {
return u;
}
}
return undefined;
}
}
__decorate([
__param(0, Decorators_1.NotNull)
], Trees, "toStringTree", null);
__decorate([
Decorators_1.NotNull,
__param(0, Decorators_1.NotNull)
], Trees, "getAncestors", null);
__decorate([
__param(0, Decorators_1.NotNull)
], Trees, "getRootOfSubtreeEnclosingRegion", null);
exports.Trees = Trees;
//# sourceMappingURL=Trees.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
export * from "./AbstractParseTreeVisitor";
export * from "./ErrorNode";
export * from "./ParseTree";
export * from "./ParseTreeListener";
export * from "./ParseTreeProperty";
export * from "./ParseTreeVisitor";
export * from "./ParseTreeWalker";
export * from "./RuleNode";
export * from "./SyntaxTree";
export * from "./TerminalNode";
export * from "./Tree";
export * from "./Trees";

View File

@@ -0,0 +1,29 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./AbstractParseTreeVisitor"), exports);
__exportStar(require("./ErrorNode"), exports);
__exportStar(require("./ParseTree"), exports);
__exportStar(require("./ParseTreeListener"), exports);
__exportStar(require("./ParseTreeProperty"), exports);
__exportStar(require("./ParseTreeVisitor"), exports);
__exportStar(require("./ParseTreeWalker"), exports);
__exportStar(require("./RuleNode"), exports);
__exportStar(require("./SyntaxTree"), exports);
__exportStar(require("./TerminalNode"), exports);
__exportStar(require("./Tree"), exports);
__exportStar(require("./Trees"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,6DAA2C;AAC3C,8CAA4B;AAC5B,8CAA4B;AAC5B,sDAAoC;AACpC,sDAAoC;AACpC,qDAAmC;AACnC,oDAAkC;AAClC,6CAA2B;AAC3B,+CAA6B;AAC7B,iDAA+B;AAC/B,yCAAuB;AACvB,0CAAwB","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\nexport * from \"./AbstractParseTreeVisitor\";\r\nexport * from \"./ErrorNode\";\r\nexport * from \"./ParseTree\";\r\nexport * from \"./ParseTreeListener\";\r\nexport * from \"./ParseTreeProperty\";\r\nexport * from \"./ParseTreeVisitor\";\r\nexport * from \"./ParseTreeWalker\";\r\nexport * from \"./RuleNode\";\r\nexport * from \"./SyntaxTree\";\r\nexport * from \"./TerminalNode\";\r\nexport * from \"./Tree\";\r\nexport * from \"./Trees\";\r\n"]}

View File

@@ -0,0 +1,17 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
/**
* A chunk is either a token tag, a rule tag, or a span of literal text within a
* tree pattern.
*
* The method {@link ParseTreePatternMatcher#split(String)} returns a list of
* chunks in preparation for creating a token stream by
* {@link ParseTreePatternMatcher#tokenize(String)}. From there, we get a parse
* tree from with {@link ParseTreePatternMatcher#compile(String, int)}. These
* chunks are converted to {@link RuleTagToken}, {@link TokenTagToken}, or the
* regular tokens of the text surrounding the tags.
*/
export declare abstract class Chunk {
}

View File

@@ -0,0 +1,23 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Chunk = void 0;
// ConvertTo-TS run at 2016-10-04T11:26:45.2799060-07:00
/**
* A chunk is either a token tag, a rule tag, or a span of literal text within a
* tree pattern.
*
* The method {@link ParseTreePatternMatcher#split(String)} returns a list of
* chunks in preparation for creating a token stream by
* {@link ParseTreePatternMatcher#tokenize(String)}. From there, we get a parse
* tree from with {@link ParseTreePatternMatcher#compile(String, int)}. These
* chunks are converted to {@link RuleTagToken}, {@link TokenTagToken}, or the
* regular tokens of the text surrounding the tags.
*/
class Chunk {
}
exports.Chunk = Chunk;
//# sourceMappingURL=Chunk.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Chunk.js","sourceRoot":"","sources":["../../../../src/tree/pattern/Chunk.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,wDAAwD;AAExD;;;;;;;;;;GAUG;AACH,MAAsB,KAAK;CAC1B;AADD,sBACC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:45.2799060-07:00\r\n\r\n/**\r\n * A chunk is either a token tag, a rule tag, or a span of literal text within a\r\n * tree pattern.\r\n *\r\n * The method {@link ParseTreePatternMatcher#split(String)} returns a list of\r\n * chunks in preparation for creating a token stream by\r\n * {@link ParseTreePatternMatcher#tokenize(String)}. From there, we get a parse\r\n * tree from with {@link ParseTreePatternMatcher#compile(String, int)}. These\r\n * chunks are converted to {@link RuleTagToken}, {@link TokenTagToken}, or the\r\n * regular tokens of the text surrounding the tags.\r\n */\r\nexport abstract class Chunk {\r\n}\r\n"]}

View File

@@ -0,0 +1,124 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { MultiMap } from "../../misc/MultiMap";
import { ParseTree } from "../ParseTree";
import { ParseTreePattern } from "./ParseTreePattern";
/**
* Represents the result of matching a {@link ParseTree} against a tree pattern.
*/
export declare class ParseTreeMatch {
/**
* This is the backing field for `tree`.
*/
private _tree;
/**
* This is the backing field for `pattern`.
*/
private _pattern;
/**
* This is the backing field for `labels`.
*/
private _labels;
/**
* This is the backing field for `mismatchedNode`.
*/
private _mismatchedNode?;
/**
* Constructs a new instance of {@link ParseTreeMatch} from the specified
* parse tree and pattern.
*
* @param tree The parse tree to match against the pattern.
* @param pattern The parse tree pattern.
* @param labels A mapping from label names to collections of
* {@link ParseTree} objects located by the tree pattern matching process.
* @param mismatchedNode The first node which failed to match the tree
* pattern during the matching process.
*
* @throws {@link Error} if `tree` is not defined
* @throws {@link Error} if `pattern` is not defined
* @throws {@link Error} if `labels` is not defined
*/
constructor(tree: ParseTree, pattern: ParseTreePattern, labels: MultiMap<string, ParseTree>, mismatchedNode: ParseTree | undefined);
/**
* Get the last node associated with a specific `label`.
*
* For example, for pattern `<id:ID>`, `get("id")` returns the
* node matched for that `ID`. If more than one node
* matched the specified label, only the last is returned. If there is
* no node associated with the label, this returns `undefined`.
*
* Pattern tags like `<ID>` and `<expr>` without labels are
* considered to be labeled with `ID` and `expr`, respectively.
*
* @param label The label to check.
*
* @returns The last {@link ParseTree} to match a tag with the specified
* label, or `undefined` if no parse tree matched a tag with the label.
*/
get(label: string): ParseTree | undefined;
/**
* Return all nodes matching a rule or token tag with the specified label.
*
* If the `label` is the name of a parser rule or token in the
* grammar, the resulting list will contain both the parse trees matching
* rule or tags explicitly labeled with the label and the complete set of
* parse trees matching the labeled and unlabeled tags in the pattern for
* the parser rule or token. For example, if `label` is `"foo"`,
* the result will contain *all* of the following.
*
* * Parse tree nodes matching tags of the form `<foo:anyRuleName>` and
* `<foo:AnyTokenName>`.
* * Parse tree nodes matching tags of the form `<anyLabel:foo>`.
* * Parse tree nodes matching tags of the form `<foo>`.
*
* @param label The label.
*
* @returns A collection of all {@link ParseTree} nodes matching tags with
* the specified `label`. If no nodes matched the label, an empty list
* is returned.
*/
getAll(label: string): ParseTree[];
/**
* Return a mapping from label &rarr; [list of nodes].
*
* The map includes special entries corresponding to the names of rules and
* tokens referenced in tags in the original pattern. For additional
* information, see the description of {@link #getAll(String)}.
*
* @returns A mapping from labels to parse tree nodes. If the parse tree
* pattern did not contain any rule or token tags, this map will be empty.
*/
get labels(): MultiMap<string, ParseTree>;
/**
* Get the node at which we first detected a mismatch.
*
* @returns the node at which we first detected a mismatch, or `undefined`
* if the match was successful.
*/
get mismatchedNode(): ParseTree | undefined;
/**
* Gets a value indicating whether the match operation succeeded.
*
* @returns `true` if the match operation succeeded; otherwise,
* `false`.
*/
get succeeded(): boolean;
/**
* Get the tree pattern we are matching against.
*
* @returns The tree pattern we are matching against.
*/
get pattern(): ParseTreePattern;
/**
* Get the parse tree we are trying to match to a pattern.
*
* @returns The {@link ParseTree} we are trying to match to a pattern.
*/
get tree(): ParseTree;
/**
* {@inheritDoc}
*/
toString(): string;
}

View File

@@ -0,0 +1,179 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseTreeMatch = void 0;
const Decorators_1 = require("../../Decorators");
/**
* Represents the result of matching a {@link ParseTree} against a tree pattern.
*/
let ParseTreeMatch = class ParseTreeMatch {
/**
* Constructs a new instance of {@link ParseTreeMatch} from the specified
* parse tree and pattern.
*
* @param tree The parse tree to match against the pattern.
* @param pattern The parse tree pattern.
* @param labels A mapping from label names to collections of
* {@link ParseTree} objects located by the tree pattern matching process.
* @param mismatchedNode The first node which failed to match the tree
* pattern during the matching process.
*
* @throws {@link Error} if `tree` is not defined
* @throws {@link Error} if `pattern` is not defined
* @throws {@link Error} if `labels` is not defined
*/
constructor(tree, pattern, labels, mismatchedNode) {
if (!tree) {
throw new Error("tree cannot be null");
}
if (!pattern) {
throw new Error("pattern cannot be null");
}
if (!labels) {
throw new Error("labels cannot be null");
}
this._tree = tree;
this._pattern = pattern;
this._labels = labels;
this._mismatchedNode = mismatchedNode;
}
/**
* Get the last node associated with a specific `label`.
*
* For example, for pattern `<id:ID>`, `get("id")` returns the
* node matched for that `ID`. If more than one node
* matched the specified label, only the last is returned. If there is
* no node associated with the label, this returns `undefined`.
*
* Pattern tags like `<ID>` and `<expr>` without labels are
* considered to be labeled with `ID` and `expr`, respectively.
*
* @param label The label to check.
*
* @returns The last {@link ParseTree} to match a tag with the specified
* label, or `undefined` if no parse tree matched a tag with the label.
*/
get(label) {
let parseTrees = this._labels.get(label);
if (!parseTrees || parseTrees.length === 0) {
return undefined;
}
return parseTrees[parseTrees.length - 1]; // return last if multiple
}
/**
* Return all nodes matching a rule or token tag with the specified label.
*
* If the `label` is the name of a parser rule or token in the
* grammar, the resulting list will contain both the parse trees matching
* rule or tags explicitly labeled with the label and the complete set of
* parse trees matching the labeled and unlabeled tags in the pattern for
* the parser rule or token. For example, if `label` is `"foo"`,
* the result will contain *all* of the following.
*
* * Parse tree nodes matching tags of the form `<foo:anyRuleName>` and
* `<foo:AnyTokenName>`.
* * Parse tree nodes matching tags of the form `<anyLabel:foo>`.
* * Parse tree nodes matching tags of the form `<foo>`.
*
* @param label The label.
*
* @returns A collection of all {@link ParseTree} nodes matching tags with
* the specified `label`. If no nodes matched the label, an empty list
* is returned.
*/
getAll(label) {
const nodes = this._labels.get(label);
if (!nodes) {
return [];
}
return nodes;
}
/**
* Return a mapping from label &rarr; [list of nodes].
*
* The map includes special entries corresponding to the names of rules and
* tokens referenced in tags in the original pattern. For additional
* information, see the description of {@link #getAll(String)}.
*
* @returns A mapping from labels to parse tree nodes. If the parse tree
* pattern did not contain any rule or token tags, this map will be empty.
*/
get labels() {
return this._labels;
}
/**
* Get the node at which we first detected a mismatch.
*
* @returns the node at which we first detected a mismatch, or `undefined`
* if the match was successful.
*/
get mismatchedNode() {
return this._mismatchedNode;
}
/**
* Gets a value indicating whether the match operation succeeded.
*
* @returns `true` if the match operation succeeded; otherwise,
* `false`.
*/
get succeeded() {
return !this._mismatchedNode;
}
/**
* Get the tree pattern we are matching against.
*
* @returns The tree pattern we are matching against.
*/
get pattern() {
return this._pattern;
}
/**
* Get the parse tree we are trying to match to a pattern.
*
* @returns The {@link ParseTree} we are trying to match to a pattern.
*/
get tree() {
return this._tree;
}
/**
* {@inheritDoc}
*/
toString() {
return `Match ${this.succeeded ? "succeeded" : "failed"}; found ${this.labels.size} labels`;
}
};
__decorate([
Decorators_1.NotNull,
__param(0, Decorators_1.NotNull)
], ParseTreeMatch.prototype, "getAll", null);
__decorate([
Decorators_1.NotNull
], ParseTreeMatch.prototype, "labels", null);
__decorate([
Decorators_1.NotNull
], ParseTreeMatch.prototype, "pattern", null);
__decorate([
Decorators_1.NotNull
], ParseTreeMatch.prototype, "tree", null);
__decorate([
Decorators_1.Override
], ParseTreeMatch.prototype, "toString", null);
ParseTreeMatch = __decorate([
__param(0, Decorators_1.NotNull),
__param(1, Decorators_1.NotNull),
__param(2, Decorators_1.NotNull)
], ParseTreeMatch);
exports.ParseTreeMatch = ParseTreeMatch;
//# sourceMappingURL=ParseTreeMatch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,98 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
import { ParseTreeMatch } from "./ParseTreeMatch";
import { ParseTreePatternMatcher } from "./ParseTreePatternMatcher";
/**
* A pattern like `<ID> = <expr>;` converted to a {@link ParseTree} by
* {@link ParseTreePatternMatcher#compile(String, int)}.
*/
export declare class ParseTreePattern {
/**
* This is the backing field for `patternRuleIndex`.
*/
private _patternRuleIndex;
/**
* This is the backing field for `pattern`.
*/
private _pattern;
/**
* This is the backing field for `patternTree`.
*/
private _patternTree;
/**
* This is the backing field for `matcher`.
*/
private _matcher;
/**
* Construct a new instance of the {@link ParseTreePattern} class.
*
* @param matcher The {@link ParseTreePatternMatcher} which created this
* tree pattern.
* @param pattern The tree pattern in concrete syntax form.
* @param patternRuleIndex The parser rule which serves as the root of the
* tree pattern.
* @param patternTree The tree pattern in {@link ParseTree} form.
*/
constructor(matcher: ParseTreePatternMatcher, pattern: string, patternRuleIndex: number, patternTree: ParseTree);
/**
* Match a specific parse tree against this tree pattern.
*
* @param tree The parse tree to match against this tree pattern.
* @returns A {@link ParseTreeMatch} object describing the result of the
* match operation. The `ParseTreeMatch.succeeded` method can be
* used to determine whether or not the match was successful.
*/
match(tree: ParseTree): ParseTreeMatch;
/**
* Determine whether or not a parse tree matches this tree pattern.
*
* @param tree The parse tree to match against this tree pattern.
* @returns `true` if `tree` is a match for the current tree
* pattern; otherwise, `false`.
*/
matches(tree: ParseTree): boolean;
/**
* Find all nodes using XPath and then try to match those subtrees against
* this tree pattern.
*
* @param tree The {@link ParseTree} to match against this pattern.
* @param xpath An expression matching the nodes
*
* @returns A collection of {@link ParseTreeMatch} objects describing the
* successful matches. Unsuccessful matches are omitted from the result,
* regardless of the reason for the failure.
*/
findAll(tree: ParseTree, xpath: string): ParseTreeMatch[];
/**
* Get the {@link ParseTreePatternMatcher} which created this tree pattern.
*
* @returns The {@link ParseTreePatternMatcher} which created this tree
* pattern.
*/
get matcher(): ParseTreePatternMatcher;
/**
* Get the tree pattern in concrete syntax form.
*
* @returns The tree pattern in concrete syntax form.
*/
get pattern(): string;
/**
* Get the parser rule which serves as the outermost rule for the tree
* pattern.
*
* @returns The parser rule which serves as the outermost rule for the tree
* pattern.
*/
get patternRuleIndex(): number;
/**
* Get the tree pattern as a {@link ParseTree}. The rule and token tags from
* the pattern are present in the parse tree as terminal nodes with a symbol
* of type {@link RuleTagToken} or {@link TokenTagToken}.
*
* @returns The tree pattern as a {@link ParseTree}.
*/
get patternTree(): ParseTree;
}

View File

@@ -0,0 +1,157 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseTreePattern = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const Decorators_1 = require("../../Decorators");
const XPath_1 = require("../xpath/XPath");
/**
* A pattern like `<ID> = <expr>;` converted to a {@link ParseTree} by
* {@link ParseTreePatternMatcher#compile(String, int)}.
*/
let ParseTreePattern = class ParseTreePattern {
/**
* Construct a new instance of the {@link ParseTreePattern} class.
*
* @param matcher The {@link ParseTreePatternMatcher} which created this
* tree pattern.
* @param pattern The tree pattern in concrete syntax form.
* @param patternRuleIndex The parser rule which serves as the root of the
* tree pattern.
* @param patternTree The tree pattern in {@link ParseTree} form.
*/
constructor(matcher, pattern, patternRuleIndex, patternTree) {
this._matcher = matcher;
this._patternRuleIndex = patternRuleIndex;
this._pattern = pattern;
this._patternTree = patternTree;
}
/**
* Match a specific parse tree against this tree pattern.
*
* @param tree The parse tree to match against this tree pattern.
* @returns A {@link ParseTreeMatch} object describing the result of the
* match operation. The `ParseTreeMatch.succeeded` method can be
* used to determine whether or not the match was successful.
*/
match(tree) {
return this._matcher.match(tree, this);
}
/**
* Determine whether or not a parse tree matches this tree pattern.
*
* @param tree The parse tree to match against this tree pattern.
* @returns `true` if `tree` is a match for the current tree
* pattern; otherwise, `false`.
*/
matches(tree) {
return this._matcher.match(tree, this).succeeded;
}
/**
* Find all nodes using XPath and then try to match those subtrees against
* this tree pattern.
*
* @param tree The {@link ParseTree} to match against this pattern.
* @param xpath An expression matching the nodes
*
* @returns A collection of {@link ParseTreeMatch} objects describing the
* successful matches. Unsuccessful matches are omitted from the result,
* regardless of the reason for the failure.
*/
findAll(tree, xpath) {
let subtrees = XPath_1.XPath.findAll(tree, xpath, this._matcher.parser);
let matches = [];
for (let t of subtrees) {
let match = this.match(t);
if (match.succeeded) {
matches.push(match);
}
}
return matches;
}
/**
* Get the {@link ParseTreePatternMatcher} which created this tree pattern.
*
* @returns The {@link ParseTreePatternMatcher} which created this tree
* pattern.
*/
get matcher() {
return this._matcher;
}
/**
* Get the tree pattern in concrete syntax form.
*
* @returns The tree pattern in concrete syntax form.
*/
get pattern() {
return this._pattern;
}
/**
* Get the parser rule which serves as the outermost rule for the tree
* pattern.
*
* @returns The parser rule which serves as the outermost rule for the tree
* pattern.
*/
get patternRuleIndex() {
return this._patternRuleIndex;
}
/**
* Get the tree pattern as a {@link ParseTree}. The rule and token tags from
* the pattern are present in the parse tree as terminal nodes with a symbol
* of type {@link RuleTagToken} or {@link TokenTagToken}.
*
* @returns The tree pattern as a {@link ParseTree}.
*/
get patternTree() {
return this._patternTree;
}
};
__decorate([
Decorators_1.NotNull
], ParseTreePattern.prototype, "_pattern", void 0);
__decorate([
Decorators_1.NotNull
], ParseTreePattern.prototype, "_patternTree", void 0);
__decorate([
Decorators_1.NotNull
], ParseTreePattern.prototype, "_matcher", void 0);
__decorate([
Decorators_1.NotNull,
__param(0, Decorators_1.NotNull)
], ParseTreePattern.prototype, "match", null);
__decorate([
__param(0, Decorators_1.NotNull)
], ParseTreePattern.prototype, "matches", null);
__decorate([
Decorators_1.NotNull,
__param(0, Decorators_1.NotNull), __param(1, Decorators_1.NotNull)
], ParseTreePattern.prototype, "findAll", null);
__decorate([
Decorators_1.NotNull
], ParseTreePattern.prototype, "matcher", null);
__decorate([
Decorators_1.NotNull
], ParseTreePattern.prototype, "pattern", null);
__decorate([
Decorators_1.NotNull
], ParseTreePattern.prototype, "patternTree", null);
ParseTreePattern = __decorate([
__param(0, Decorators_1.NotNull),
__param(1, Decorators_1.NotNull),
__param(3, Decorators_1.NotNull)
], ParseTreePattern);
exports.ParseTreePattern = ParseTreePattern;
//# sourceMappingURL=ParseTreePattern.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,166 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Chunk } from "./Chunk";
import { Lexer } from "../../Lexer";
import { MultiMap } from "../../misc/MultiMap";
import { Parser } from "../../Parser";
import { ParseTree } from "../ParseTree";
import { ParseTreeMatch } from "./ParseTreeMatch";
import { ParseTreePattern } from "./ParseTreePattern";
import { RuleTagToken } from "./RuleTagToken";
import { Token } from "../../Token";
/**
* A tree pattern matching mechanism for ANTLR {@link ParseTree}s.
*
* Patterns are strings of source input text with special tags representing
* token or rule references such as:
*
* ```
* <ID> = <expr>;
* ```
*
* Given a pattern start rule such as `statement`, this object constructs
* a {@link ParseTree} with placeholders for the `ID` and `expr`
* subtree. Then the {@link #match} routines can compare an actual
* {@link ParseTree} from a parse with this pattern. Tag `<ID>` matches
* any `ID` token and tag `<expr>` references the result of the
* `expr` rule (generally an instance of `ExprContext`.
*
* Pattern `x = 0;` is a similar pattern that matches the same pattern
* except that it requires the identifier to be `x` and the expression to
* be `0`.
*
* The {@link #matches} routines return `true` or `false` based
* upon a match for the tree rooted at the parameter sent in. The
* {@link #match} routines return a {@link ParseTreeMatch} object that
* contains the parse tree, the parse tree pattern, and a map from tag name to
* matched nodes (more below). A subtree that fails to match, returns with
* {@link ParseTreeMatch#mismatchedNode} set to the first tree node that did not
* match.
*
* For efficiency, you can compile a tree pattern in string form to a
* {@link ParseTreePattern} object.
*
* See `TestParseTreeMatcher` for lots of examples.
* {@link ParseTreePattern} has two static helper methods:
* {@link ParseTreePattern#findAll} and {@link ParseTreePattern#match} that
* are easy to use but not super efficient because they create new
* {@link ParseTreePatternMatcher} objects each time and have to compile the
* pattern in string form before using it.
*
* The lexer and parser that you pass into the {@link ParseTreePatternMatcher}
* constructor are used to parse the pattern in string form. The lexer converts
* the `<ID> = <expr>;` into a sequence of four tokens (assuming lexer
* throws out whitespace or puts it on a hidden channel). Be aware that the
* input stream is reset for the lexer (but not the parser; a
* {@link ParserInterpreter} is created to parse the input.). Any user-defined
* fields you have put into the lexer might get changed when this mechanism asks
* it to scan the pattern string.
*
* Normally a parser does not accept token `<expr>` as a valid
* `expr` but, from the parser passed in, we create a special version of
* the underlying grammar representation (an {@link ATN}) that allows imaginary
* tokens representing rules (`<expr>`) to match entire rules. We call
* these *bypass alternatives*.
*
* Delimiters are `<`} and `>`}, with `\` as the escape string
* by default, but you can set them to whatever you want using
* {@link #setDelimiters}. You must escape both start and stop strings
* `\<` and `\>`.
*/
export declare class ParseTreePatternMatcher {
/**
* This is the backing field for `lexer`.
*/
private _lexer;
/**
* This is the backing field for `parser`.
*/
private _parser;
protected start: string;
protected stop: string;
protected escape: string;
/**
* Regular expression corresponding to escape, for global replace
*/
protected escapeRE: RegExp;
/**
* Constructs a {@link ParseTreePatternMatcher} or from a {@link Lexer} and
* {@link Parser} object. The lexer input stream is altered for tokenizing
* the tree patterns. The parser is used as a convenient mechanism to get
* the grammar name, plus token, rule names.
*/
constructor(lexer: Lexer, parser: Parser);
/**
* Set the delimiters used for marking rule and token tags within concrete
* syntax used by the tree pattern parser.
*
* @param start The start delimiter.
* @param stop The stop delimiter.
* @param escapeLeft The escape sequence to use for escaping a start or stop delimiter.
*
* @throws {@link Error} if `start` is not defined or empty.
* @throws {@link Error} if `stop` is not defined or empty.
*/
setDelimiters(start: string, stop: string, escapeLeft: string): void;
/** Does `pattern` matched as rule `patternRuleIndex` match `tree`? */
matches(tree: ParseTree, pattern: string, patternRuleIndex: number): boolean;
/** Does `pattern` matched as rule patternRuleIndex match tree? Pass in a
* compiled pattern instead of a string representation of a tree pattern.
*/
matches(tree: ParseTree, pattern: ParseTreePattern): boolean;
/**
* Compare `pattern` matched as rule `patternRuleIndex` against
* `tree` and return a {@link ParseTreeMatch} object that contains the
* matched elements, or the node at which the match failed.
*/
match(tree: ParseTree, pattern: string, patternRuleIndex: number): ParseTreeMatch;
/**
* Compare `pattern` matched against `tree` and return a
* {@link ParseTreeMatch} object that contains the matched elements, or the
* node at which the match failed. Pass in a compiled pattern instead of a
* string representation of a tree pattern.
*/
match(tree: ParseTree, pattern: ParseTreePattern): ParseTreeMatch;
/**
* For repeated use of a tree pattern, compile it to a
* {@link ParseTreePattern} using this method.
*/
compile(pattern: string, patternRuleIndex: number): ParseTreePattern;
/**
* Used to convert the tree pattern string into a series of tokens. The
* input stream is reset.
*/
get lexer(): Lexer;
/**
* Used to collect to the grammar file name, token names, rule names for
* used to parse the pattern into a parse tree.
*/
get parser(): Parser;
/**
* Recursively walk `tree` against `patternTree`, filling
* `match.`{@link ParseTreeMatch#labels labels}.
*
* @returns the first node encountered in `tree` which does not match
* a corresponding node in `patternTree`, or `undefined` if the match
* was successful. The specific node returned depends on the matching
* algorithm used by the implementation, and may be overridden.
*/
protected matchImpl(tree: ParseTree, patternTree: ParseTree, labels: MultiMap<string, ParseTree>): ParseTree | undefined;
/** Is `t` `(expr <expr>)` subtree? */
protected getRuleTagToken(t: ParseTree): RuleTagToken | undefined;
tokenize(pattern: string): Token[];
/** Split `<ID> = <e:expr> ;` into 4 chunks for tokenizing by {@link #tokenize}. */
split(pattern: string): Chunk[];
}
export declare namespace ParseTreePatternMatcher {
class CannotInvokeStartRule extends Error {
error: Error;
constructor(error: Error);
}
class StartRuleDoesNotConsumeFullPattern extends Error {
constructor();
}
}

View File

@@ -0,0 +1,477 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseTreePatternMatcher = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const BailErrorStrategy_1 = require("../../BailErrorStrategy");
const CharStreams_1 = require("../../CharStreams");
const CommonTokenStream_1 = require("../../CommonTokenStream");
const ListTokenSource_1 = require("../../ListTokenSource");
const MultiMap_1 = require("../../misc/MultiMap");
const Decorators_1 = require("../../Decorators");
const ParseCancellationException_1 = require("../../misc/ParseCancellationException");
const ParserInterpreter_1 = require("../../ParserInterpreter");
const ParserRuleContext_1 = require("../../ParserRuleContext");
const ParseTreeMatch_1 = require("./ParseTreeMatch");
const ParseTreePattern_1 = require("./ParseTreePattern");
const RecognitionException_1 = require("../../RecognitionException");
const RuleNode_1 = require("../RuleNode");
const RuleTagToken_1 = require("./RuleTagToken");
const TagChunk_1 = require("./TagChunk");
const TerminalNode_1 = require("../TerminalNode");
const TextChunk_1 = require("./TextChunk");
const Token_1 = require("../../Token");
const TokenTagToken_1 = require("./TokenTagToken");
/**
* A tree pattern matching mechanism for ANTLR {@link ParseTree}s.
*
* Patterns are strings of source input text with special tags representing
* token or rule references such as:
*
* ```
* <ID> = <expr>;
* ```
*
* Given a pattern start rule such as `statement`, this object constructs
* a {@link ParseTree} with placeholders for the `ID` and `expr`
* subtree. Then the {@link #match} routines can compare an actual
* {@link ParseTree} from a parse with this pattern. Tag `<ID>` matches
* any `ID` token and tag `<expr>` references the result of the
* `expr` rule (generally an instance of `ExprContext`.
*
* Pattern `x = 0;` is a similar pattern that matches the same pattern
* except that it requires the identifier to be `x` and the expression to
* be `0`.
*
* The {@link #matches} routines return `true` or `false` based
* upon a match for the tree rooted at the parameter sent in. The
* {@link #match} routines return a {@link ParseTreeMatch} object that
* contains the parse tree, the parse tree pattern, and a map from tag name to
* matched nodes (more below). A subtree that fails to match, returns with
* {@link ParseTreeMatch#mismatchedNode} set to the first tree node that did not
* match.
*
* For efficiency, you can compile a tree pattern in string form to a
* {@link ParseTreePattern} object.
*
* See `TestParseTreeMatcher` for lots of examples.
* {@link ParseTreePattern} has two static helper methods:
* {@link ParseTreePattern#findAll} and {@link ParseTreePattern#match} that
* are easy to use but not super efficient because they create new
* {@link ParseTreePatternMatcher} objects each time and have to compile the
* pattern in string form before using it.
*
* The lexer and parser that you pass into the {@link ParseTreePatternMatcher}
* constructor are used to parse the pattern in string form. The lexer converts
* the `<ID> = <expr>;` into a sequence of four tokens (assuming lexer
* throws out whitespace or puts it on a hidden channel). Be aware that the
* input stream is reset for the lexer (but not the parser; a
* {@link ParserInterpreter} is created to parse the input.). Any user-defined
* fields you have put into the lexer might get changed when this mechanism asks
* it to scan the pattern string.
*
* Normally a parser does not accept token `<expr>` as a valid
* `expr` but, from the parser passed in, we create a special version of
* the underlying grammar representation (an {@link ATN}) that allows imaginary
* tokens representing rules (`<expr>`) to match entire rules. We call
* these *bypass alternatives*.
*
* Delimiters are `<`} and `>`}, with `\` as the escape string
* by default, but you can set them to whatever you want using
* {@link #setDelimiters}. You must escape both start and stop strings
* `\<` and `\>`.
*/
class ParseTreePatternMatcher {
/**
* Constructs a {@link ParseTreePatternMatcher} or from a {@link Lexer} and
* {@link Parser} object. The lexer input stream is altered for tokenizing
* the tree patterns. The parser is used as a convenient mechanism to get
* the grammar name, plus token, rule names.
*/
constructor(lexer, parser) {
this.start = "<";
this.stop = ">";
this.escape = "\\"; // e.g., \< and \> must escape BOTH!
/**
* Regular expression corresponding to escape, for global replace
*/
this.escapeRE = /\\/g;
this._lexer = lexer;
this._parser = parser;
}
/**
* Set the delimiters used for marking rule and token tags within concrete
* syntax used by the tree pattern parser.
*
* @param start The start delimiter.
* @param stop The stop delimiter.
* @param escapeLeft The escape sequence to use for escaping a start or stop delimiter.
*
* @throws {@link Error} if `start` is not defined or empty.
* @throws {@link Error} if `stop` is not defined or empty.
*/
setDelimiters(start, stop, escapeLeft) {
if (!start) {
throw new Error("start cannot be null or empty");
}
if (!stop) {
throw new Error("stop cannot be null or empty");
}
this.start = start;
this.stop = stop;
this.escape = escapeLeft;
this.escapeRE = new RegExp(escapeLeft.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g");
}
matches(tree, pattern, patternRuleIndex = 0) {
if (typeof pattern === "string") {
let p = this.compile(pattern, patternRuleIndex);
return this.matches(tree, p);
}
else {
let labels = new MultiMap_1.MultiMap();
let mismatchedNode = this.matchImpl(tree, pattern.patternTree, labels);
return !mismatchedNode;
}
}
// Implementation of match
match(tree, pattern, patternRuleIndex = 0) {
if (typeof pattern === "string") {
let p = this.compile(pattern, patternRuleIndex);
return this.match(tree, p);
}
else {
let labels = new MultiMap_1.MultiMap();
let mismatchedNode = this.matchImpl(tree, pattern.patternTree, labels);
return new ParseTreeMatch_1.ParseTreeMatch(tree, pattern, labels, mismatchedNode);
}
}
/**
* For repeated use of a tree pattern, compile it to a
* {@link ParseTreePattern} using this method.
*/
compile(pattern, patternRuleIndex) {
let tokenList = this.tokenize(pattern);
let tokenSrc = new ListTokenSource_1.ListTokenSource(tokenList);
let tokens = new CommonTokenStream_1.CommonTokenStream(tokenSrc);
const parser = this._parser;
let parserInterp = new ParserInterpreter_1.ParserInterpreter(parser.grammarFileName, parser.vocabulary, parser.ruleNames, parser.getATNWithBypassAlts(), tokens);
let tree;
try {
parserInterp.errorHandler = new BailErrorStrategy_1.BailErrorStrategy();
tree = parserInterp.parse(patternRuleIndex);
// System.out.println("pattern tree = "+tree.toStringTree(parserInterp));
}
catch (e) {
if (e instanceof ParseCancellationException_1.ParseCancellationException) {
throw e.getCause();
}
else if (e instanceof RecognitionException_1.RecognitionException) {
throw e;
}
else if (e instanceof Error) {
throw new ParseTreePatternMatcher.CannotInvokeStartRule(e);
}
else {
throw e;
}
}
// Make sure tree pattern compilation checks for a complete parse
if (tokens.LA(1) !== Token_1.Token.EOF) {
throw new ParseTreePatternMatcher.StartRuleDoesNotConsumeFullPattern();
}
return new ParseTreePattern_1.ParseTreePattern(this, pattern, patternRuleIndex, tree);
}
/**
* Used to convert the tree pattern string into a series of tokens. The
* input stream is reset.
*/
get lexer() {
return this._lexer;
}
/**
* Used to collect to the grammar file name, token names, rule names for
* used to parse the pattern into a parse tree.
*/
get parser() {
return this._parser;
}
// ---- SUPPORT CODE ----
/**
* Recursively walk `tree` against `patternTree`, filling
* `match.`{@link ParseTreeMatch#labels labels}.
*
* @returns the first node encountered in `tree` which does not match
* a corresponding node in `patternTree`, or `undefined` if the match
* was successful. The specific node returned depends on the matching
* algorithm used by the implementation, and may be overridden.
*/
matchImpl(tree, patternTree, labels) {
if (!tree) {
throw new TypeError("tree cannot be null");
}
if (!patternTree) {
throw new TypeError("patternTree cannot be null");
}
// x and <ID>, x and y, or x and x; or could be mismatched types
if (tree instanceof TerminalNode_1.TerminalNode && patternTree instanceof TerminalNode_1.TerminalNode) {
let mismatchedNode;
// both are tokens and they have same type
if (tree.symbol.type === patternTree.symbol.type) {
if (patternTree.symbol instanceof TokenTagToken_1.TokenTagToken) { // x and <ID>
let tokenTagToken = patternTree.symbol;
// track label->list-of-nodes for both token name and label (if any)
labels.map(tokenTagToken.tokenName, tree);
const l = tokenTagToken.label;
if (l) {
labels.map(l, tree);
}
}
else if (tree.text === patternTree.text) {
// x and x
}
else {
// x and y
if (!mismatchedNode) {
mismatchedNode = tree;
}
}
}
else {
if (!mismatchedNode) {
mismatchedNode = tree;
}
}
return mismatchedNode;
}
if (tree instanceof ParserRuleContext_1.ParserRuleContext
&& patternTree instanceof ParserRuleContext_1.ParserRuleContext) {
let mismatchedNode;
// (expr ...) and <expr>
let ruleTagToken = this.getRuleTagToken(patternTree);
if (ruleTagToken) {
let m;
if (tree.ruleContext.ruleIndex === patternTree.ruleContext.ruleIndex) {
// track label->list-of-nodes for both rule name and label (if any)
labels.map(ruleTagToken.ruleName, tree);
const l = ruleTagToken.label;
if (l) {
labels.map(l, tree);
}
}
else {
if (!mismatchedNode) {
mismatchedNode = tree;
}
}
return mismatchedNode;
}
// (expr ...) and (expr ...)
if (tree.childCount !== patternTree.childCount) {
if (!mismatchedNode) {
mismatchedNode = tree;
}
return mismatchedNode;
}
let n = tree.childCount;
for (let i = 0; i < n; i++) {
let childMatch = this.matchImpl(tree.getChild(i), patternTree.getChild(i), labels);
if (childMatch) {
return childMatch;
}
}
return mismatchedNode;
}
// if nodes aren't both tokens or both rule nodes, can't match
return tree;
}
/** Is `t` `(expr <expr>)` subtree? */
getRuleTagToken(t) {
if (t instanceof RuleNode_1.RuleNode) {
if (t.childCount === 1 && t.getChild(0) instanceof TerminalNode_1.TerminalNode) {
let c = t.getChild(0);
if (c.symbol instanceof RuleTagToken_1.RuleTagToken) {
// System.out.println("rule tag subtree "+t.toStringTree(parser));
return c.symbol;
}
}
}
return undefined;
}
tokenize(pattern) {
// split pattern into chunks: sea (raw input) and islands (<ID>, <expr>)
let chunks = this.split(pattern);
// create token stream from text and tags
let tokens = [];
for (let chunk of chunks) {
if (chunk instanceof TagChunk_1.TagChunk) {
let tagChunk = chunk;
const firstChar = tagChunk.tag.substr(0, 1);
// add special rule token or conjure up new token from name
if (firstChar === firstChar.toUpperCase()) {
let ttype = this._parser.getTokenType(tagChunk.tag);
if (ttype === Token_1.Token.INVALID_TYPE) {
throw new Error("Unknown token " + tagChunk.tag + " in pattern: " + pattern);
}
let t = new TokenTagToken_1.TokenTagToken(tagChunk.tag, ttype, tagChunk.label);
tokens.push(t);
}
else if (firstChar === firstChar.toLowerCase()) {
let ruleIndex = this._parser.getRuleIndex(tagChunk.tag);
if (ruleIndex === -1) {
throw new Error("Unknown rule " + tagChunk.tag + " in pattern: " + pattern);
}
let ruleImaginaryTokenType = this._parser.getATNWithBypassAlts().ruleToTokenType[ruleIndex];
tokens.push(new RuleTagToken_1.RuleTagToken(tagChunk.tag, ruleImaginaryTokenType, tagChunk.label));
}
else {
throw new Error("invalid tag: " + tagChunk.tag + " in pattern: " + pattern);
}
}
else {
let textChunk = chunk;
this._lexer.inputStream = CharStreams_1.CharStreams.fromString(textChunk.text);
let t = this._lexer.nextToken();
while (t.type !== Token_1.Token.EOF) {
tokens.push(t);
t = this._lexer.nextToken();
}
}
}
// System.out.println("tokens="+tokens);
return tokens;
}
/** Split `<ID> = <e:expr> ;` into 4 chunks for tokenizing by {@link #tokenize}. */
split(pattern) {
let p = 0;
let n = pattern.length;
let chunks = [];
let buf;
// find all start and stop indexes first, then collect
let starts = [];
let stops = [];
while (p < n) {
if (p === pattern.indexOf(this.escape + this.start, p)) {
p += this.escape.length + this.start.length;
}
else if (p === pattern.indexOf(this.escape + this.stop, p)) {
p += this.escape.length + this.stop.length;
}
else if (p === pattern.indexOf(this.start, p)) {
starts.push(p);
p += this.start.length;
}
else if (p === pattern.indexOf(this.stop, p)) {
stops.push(p);
p += this.stop.length;
}
else {
p++;
}
}
// System.out.println("");
// System.out.println(starts);
// System.out.println(stops);
if (starts.length > stops.length) {
throw new Error("unterminated tag in pattern: " + pattern);
}
if (starts.length < stops.length) {
throw new Error("missing start tag in pattern: " + pattern);
}
let ntags = starts.length;
for (let i = 0; i < ntags; i++) {
if (starts[i] >= stops[i]) {
throw new Error("tag delimiters out of order in pattern: " + pattern);
}
}
// collect into chunks now
if (ntags === 0) {
let text = pattern.substring(0, n);
chunks.push(new TextChunk_1.TextChunk(text));
}
if (ntags > 0 && starts[0] > 0) { // copy text up to first tag into chunks
let text = pattern.substring(0, starts[0]);
chunks.push(new TextChunk_1.TextChunk(text));
}
for (let i = 0; i < ntags; i++) {
// copy inside of <tag>
let tag = pattern.substring(starts[i] + this.start.length, stops[i]);
let ruleOrToken = tag;
let label;
let colon = tag.indexOf(":");
if (colon >= 0) {
label = tag.substring(0, colon);
ruleOrToken = tag.substring(colon + 1, tag.length);
}
chunks.push(new TagChunk_1.TagChunk(ruleOrToken, label));
if (i + 1 < ntags) {
// copy from end of <tag> to start of next
let text = pattern.substring(stops[i] + this.stop.length, starts[i + 1]);
chunks.push(new TextChunk_1.TextChunk(text));
}
}
if (ntags > 0) {
let afterLastTag = stops[ntags - 1] + this.stop.length;
if (afterLastTag < n) { // copy text from end of last tag to end
let text = pattern.substring(afterLastTag, n);
chunks.push(new TextChunk_1.TextChunk(text));
}
}
// strip out the escape sequences from text chunks but not tags
for (let i = 0; i < chunks.length; i++) {
let c = chunks[i];
if (c instanceof TextChunk_1.TextChunk) {
let unescaped = c.text.replace(this.escapeRE, "");
if (unescaped.length < c.text.length) {
chunks[i] = new TextChunk_1.TextChunk(unescaped);
}
}
}
return chunks;
}
}
__decorate([
Decorators_1.NotNull,
__param(1, Decorators_1.NotNull)
], ParseTreePatternMatcher.prototype, "match", null);
__decorate([
Decorators_1.NotNull
], ParseTreePatternMatcher.prototype, "lexer", null);
__decorate([
Decorators_1.NotNull
], ParseTreePatternMatcher.prototype, "parser", null);
__decorate([
__param(0, Decorators_1.NotNull),
__param(1, Decorators_1.NotNull),
__param(2, Decorators_1.NotNull)
], ParseTreePatternMatcher.prototype, "matchImpl", null);
exports.ParseTreePatternMatcher = ParseTreePatternMatcher;
(function (ParseTreePatternMatcher) {
class CannotInvokeStartRule extends Error {
constructor(error) {
super(`CannotInvokeStartRule: ${error}`);
this.error = error;
}
}
ParseTreePatternMatcher.CannotInvokeStartRule = CannotInvokeStartRule;
// Fixes https://github.com/antlr/antlr4/issues/413
// "Tree pattern compilation doesn't check for a complete parse"
class StartRuleDoesNotConsumeFullPattern extends Error {
constructor() {
super("StartRuleDoesNotConsumeFullPattern");
}
}
ParseTreePatternMatcher.StartRuleDoesNotConsumeFullPattern = StartRuleDoesNotConsumeFullPattern;
})(ParseTreePatternMatcher = exports.ParseTreePatternMatcher || (exports.ParseTreePatternMatcher = {}));
//# sourceMappingURL=ParseTreePatternMatcher.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,122 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { CharStream } from "../../CharStream";
import { Token } from "../../Token";
import { TokenSource } from "../../TokenSource";
/**
* A {@link Token} object representing an entire subtree matched by a parser
* rule; e.g., `<expr>`. These tokens are created for {@link TagChunk}
* chunks where the tag corresponds to a parser rule.
*/
export declare class RuleTagToken implements Token {
/**
* This is the backing field for `ruleName`.
*/
private _ruleName;
/**
* The token type for the current token. This is the token type assigned to
* the bypass alternative for the rule during ATN deserialization.
*/
private bypassTokenType;
/**
* This is the backing field for `label`.
*/
private _label?;
/**
* Constructs a new instance of {@link RuleTagToken} with the specified rule
* name, bypass token type, and label.
*
* @param ruleName The name of the parser rule this rule tag matches.
* @param bypassTokenType The bypass token type assigned to the parser rule.
* @param label The label associated with the rule tag, or `undefined` if
* the rule tag is unlabeled.
*
* @exception IllegalArgumentException if `ruleName` is not defined
* or empty.
*/
constructor(ruleName: string, bypassTokenType: number, label?: string);
/**
* Gets the name of the rule associated with this rule tag.
*
* @returns The name of the parser rule associated with this rule tag.
*/
get ruleName(): string;
/**
* Gets the label associated with the rule tag.
*
* @returns The name of the label associated with the rule tag, or
* `undefined` if this is an unlabeled rule tag.
*/
get label(): string | undefined;
/**
* {@inheritDoc}
*
* Rule tag tokens are always placed on the {@link #DEFAULT_CHANNEL}.
*/
get channel(): number;
/**
* {@inheritDoc}
*
* This method returns the rule tag formatted with `<` and `>`
* delimiters.
*/
get text(): string;
/**
* {@inheritDoc}
*
* Rule tag tokens have types assigned according to the rule bypass
* transitions created during ATN deserialization.
*/
get type(): number;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns 0.
*/
get line(): number;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get charPositionInLine(): number;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get tokenIndex(): number;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get startIndex(): number;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get stopIndex(): number;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns `undefined`.
*/
get tokenSource(): TokenSource | undefined;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns `undefined`.
*/
get inputStream(): CharStream | undefined;
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} returns a string of the form
* `ruleName:bypassTokenType`.
*/
toString(): string;
}

View File

@@ -0,0 +1,197 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RuleTagToken = void 0;
const Decorators_1 = require("../../Decorators");
const Token_1 = require("../../Token");
/**
* A {@link Token} object representing an entire subtree matched by a parser
* rule; e.g., `<expr>`. These tokens are created for {@link TagChunk}
* chunks where the tag corresponds to a parser rule.
*/
let RuleTagToken = class RuleTagToken {
/**
* Constructs a new instance of {@link RuleTagToken} with the specified rule
* name, bypass token type, and label.
*
* @param ruleName The name of the parser rule this rule tag matches.
* @param bypassTokenType The bypass token type assigned to the parser rule.
* @param label The label associated with the rule tag, or `undefined` if
* the rule tag is unlabeled.
*
* @exception IllegalArgumentException if `ruleName` is not defined
* or empty.
*/
constructor(ruleName, bypassTokenType, label) {
if (ruleName == null || ruleName.length === 0) {
throw new Error("ruleName cannot be null or empty.");
}
this._ruleName = ruleName;
this.bypassTokenType = bypassTokenType;
this._label = label;
}
/**
* Gets the name of the rule associated with this rule tag.
*
* @returns The name of the parser rule associated with this rule tag.
*/
get ruleName() {
return this._ruleName;
}
/**
* Gets the label associated with the rule tag.
*
* @returns The name of the label associated with the rule tag, or
* `undefined` if this is an unlabeled rule tag.
*/
get label() {
return this._label;
}
/**
* {@inheritDoc}
*
* Rule tag tokens are always placed on the {@link #DEFAULT_CHANNEL}.
*/
get channel() {
return Token_1.Token.DEFAULT_CHANNEL;
}
/**
* {@inheritDoc}
*
* This method returns the rule tag formatted with `<` and `>`
* delimiters.
*/
get text() {
if (this._label != null) {
return "<" + this._label + ":" + this._ruleName + ">";
}
return "<" + this._ruleName + ">";
}
/**
* {@inheritDoc}
*
* Rule tag tokens have types assigned according to the rule bypass
* transitions created during ATN deserialization.
*/
get type() {
return this.bypassTokenType;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns 0.
*/
get line() {
return 0;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get charPositionInLine() {
return -1;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get tokenIndex() {
return -1;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get startIndex() {
return -1;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns -1.
*/
get stopIndex() {
return -1;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns `undefined`.
*/
get tokenSource() {
return undefined;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} always returns `undefined`.
*/
get inputStream() {
return undefined;
}
/**
* {@inheritDoc}
*
* The implementation for {@link RuleTagToken} returns a string of the form
* `ruleName:bypassTokenType`.
*/
toString() {
return this._ruleName + ":" + this.bypassTokenType;
}
};
__decorate([
Decorators_1.NotNull
], RuleTagToken.prototype, "ruleName", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "channel", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "text", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "type", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "line", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "charPositionInLine", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "tokenIndex", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "startIndex", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "stopIndex", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "tokenSource", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "inputStream", null);
__decorate([
Decorators_1.Override
], RuleTagToken.prototype, "toString", null);
RuleTagToken = __decorate([
__param(0, Decorators_1.NotNull)
], RuleTagToken);
exports.RuleTagToken = RuleTagToken;
//# sourceMappingURL=RuleTagToken.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,59 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Chunk } from "./Chunk";
/**
* Represents a placeholder tag in a tree pattern. A tag can have any of the
* following forms.
*
* * `expr`: An unlabeled placeholder for a parser rule `expr`.
* * `ID`: An unlabeled placeholder for a token of type `ID`.
* * `e:expr`: A labeled placeholder for a parser rule `expr`.
* * `id:ID`: A labeled placeholder for a token of type `ID`.
*
* This class does not perform any validation on the tag or label names aside
* from ensuring that the tag is a defined, non-empty string.
*/
export declare class TagChunk extends Chunk {
/**
* This is the backing field for `tag`.
*/
private _tag;
/**
* This is the backing field for `label`.
*/
private _label?;
/**
* Construct a new instance of {@link TagChunk} using the specified label
* and tag.
*
* @param label The label for the tag. If this is `undefined`, the
* {@link TagChunk} represents an unlabeled tag.
* @param tag The tag, which should be the name of a parser rule or token
* type.
*
* @exception IllegalArgumentException if `tag` is not defined or
* empty.
*/
constructor(tag: string, label?: string);
/**
* Get the tag for this chunk.
*
* @returns The tag for the chunk.
*/
get tag(): string;
/**
* Get the label, if any, assigned to this chunk.
*
* @returns The label assigned to this chunk, or `undefined` if no label is
* assigned to the chunk.
*/
get label(): string | undefined;
/**
* This method returns a text representation of the tag chunk. Labeled tags
* are returned in the form `label:tag`, and unlabeled tags are
* returned as just the tag name.
*/
toString(): string;
}

View File

@@ -0,0 +1,86 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TagChunk = void 0;
// ConvertTo-TS run at 2016-10-04T11:26:46.1670669-07:00
const Chunk_1 = require("./Chunk");
const Decorators_1 = require("../../Decorators");
/**
* Represents a placeholder tag in a tree pattern. A tag can have any of the
* following forms.
*
* * `expr`: An unlabeled placeholder for a parser rule `expr`.
* * `ID`: An unlabeled placeholder for a token of type `ID`.
* * `e:expr`: A labeled placeholder for a parser rule `expr`.
* * `id:ID`: A labeled placeholder for a token of type `ID`.
*
* This class does not perform any validation on the tag or label names aside
* from ensuring that the tag is a defined, non-empty string.
*/
class TagChunk extends Chunk_1.Chunk {
/**
* Construct a new instance of {@link TagChunk} using the specified label
* and tag.
*
* @param label The label for the tag. If this is `undefined`, the
* {@link TagChunk} represents an unlabeled tag.
* @param tag The tag, which should be the name of a parser rule or token
* type.
*
* @exception IllegalArgumentException if `tag` is not defined or
* empty.
*/
constructor(tag, label) {
super();
if (tag == null || tag.length === 0) {
throw new Error("tag cannot be null or empty");
}
this._tag = tag;
this._label = label;
}
/**
* Get the tag for this chunk.
*
* @returns The tag for the chunk.
*/
get tag() {
return this._tag;
}
/**
* Get the label, if any, assigned to this chunk.
*
* @returns The label assigned to this chunk, or `undefined` if no label is
* assigned to the chunk.
*/
get label() {
return this._label;
}
/**
* This method returns a text representation of the tag chunk. Labeled tags
* are returned in the form `label:tag`, and unlabeled tags are
* returned as just the tag name.
*/
toString() {
if (this._label != null) {
return this._label + ":" + this._tag;
}
return this._tag;
}
}
__decorate([
Decorators_1.NotNull
], TagChunk.prototype, "tag", null);
__decorate([
Decorators_1.Override
], TagChunk.prototype, "toString", null);
exports.TagChunk = TagChunk;
//# sourceMappingURL=TagChunk.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TagChunk.js","sourceRoot":"","sources":["../../../../src/tree/pattern/TagChunk.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,wDAAwD;AAExD,mCAAgC;AAChC,iDAAqD;AAErD;;;;;;;;;;;GAWG;AACH,MAAa,QAAS,SAAQ,aAAK;IAUlC;;;;;;;;;;;OAWG;IACH,YAAY,GAAW,EAAE,KAAc;QACtC,KAAK,EAAE,CAAC;QAER,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAC/C;QAED,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;OAIG;IAEH,IAAI,GAAG;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED;;;;OAIG;IAEI,QAAQ;QACd,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;YACxB,OAAO,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;SACrC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;CACD;AA3BA;IADC,oBAAO;mCAGP;AAkBD;IADC,qBAAQ;wCAOR;AAjEF,4BAkEC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:46.1670669-07:00\r\n\r\nimport { Chunk } from \"./Chunk\";\r\nimport { NotNull, Override } from \"../../Decorators\";\r\n\r\n/**\r\n * Represents a placeholder tag in a tree pattern. A tag can have any of the\r\n * following forms.\r\n *\r\n * * `expr`: An unlabeled placeholder for a parser rule `expr`.\r\n * * `ID`: An unlabeled placeholder for a token of type `ID`.\r\n * * `e:expr`: A labeled placeholder for a parser rule `expr`.\r\n * * `id:ID`: A labeled placeholder for a token of type `ID`.\r\n *\r\n * This class does not perform any validation on the tag or label names aside\r\n * from ensuring that the tag is a defined, non-empty string.\r\n */\r\nexport class TagChunk extends Chunk {\r\n\t/**\r\n\t * This is the backing field for `tag`.\r\n\t */\r\n\tprivate _tag: string;\r\n\t/**\r\n\t * This is the backing field for `label`.\r\n\t */\r\n\tprivate _label?: string;\r\n\r\n\t/**\r\n\t * Construct a new instance of {@link TagChunk} using the specified label\r\n\t * and tag.\r\n\t *\r\n\t * @param label The label for the tag. If this is `undefined`, the\r\n\t * {@link TagChunk} represents an unlabeled tag.\r\n\t * @param tag The tag, which should be the name of a parser rule or token\r\n\t * type.\r\n\t *\r\n\t * @exception IllegalArgumentException if `tag` is not defined or\r\n\t * empty.\r\n\t */\r\n\tconstructor(tag: string, label?: string) {\r\n\t\tsuper();\r\n\r\n\t\tif (tag == null || tag.length === 0) {\r\n\t\t\tthrow new Error(\"tag cannot be null or empty\");\r\n\t\t}\r\n\r\n\t\tthis._tag = tag;\r\n\t\tthis._label = label;\r\n\t}\r\n\r\n\t/**\r\n\t * Get the tag for this chunk.\r\n\t *\r\n\t * @returns The tag for the chunk.\r\n\t */\r\n\t@NotNull\r\n\tget tag(): string {\r\n\t\treturn this._tag;\r\n\t}\r\n\r\n\t/**\r\n\t * Get the label, if any, assigned to this chunk.\r\n\t *\r\n\t * @returns The label assigned to this chunk, or `undefined` if no label is\r\n\t * assigned to the chunk.\r\n\t */\r\n\tget label(): string | undefined {\r\n\t\treturn this._label;\r\n\t}\r\n\r\n\t/**\r\n\t * This method returns a text representation of the tag chunk. Labeled tags\r\n\t * are returned in the form `label:tag`, and unlabeled tags are\r\n\t * returned as just the tag name.\r\n\t */\r\n\t@Override\r\n\tpublic toString(): string {\r\n\t\tif (this._label != null) {\r\n\t\t\treturn this._label + \":\" + this._tag;\r\n\t\t}\r\n\r\n\t\treturn this._tag;\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,35 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Chunk } from "./Chunk";
/**
* Represents a span of raw text (concrete syntax) between tags in a tree
* pattern string.
*/
export declare class TextChunk extends Chunk {
/**
* This is the backing field for {@link #getText}.
*/
private _text;
/**
* Constructs a new instance of {@link TextChunk} with the specified text.
*
* @param text The text of this chunk.
* @exception IllegalArgumentException if `text` is not defined.
*/
constructor(text: string);
/**
* Gets the raw text of this chunk.
*
* @returns The text of the chunk.
*/
get text(): string;
/**
* {@inheritDoc}
*
* The implementation for {@link TextChunk} returns the result of
* `text` in single quotes.
*/
toString(): string;
}

View File

@@ -0,0 +1,69 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextChunk = void 0;
// ConvertTo-TS run at 2016-10-04T11:26:46.2521448-07:00
const Chunk_1 = require("./Chunk");
const Decorators_1 = require("../../Decorators");
/**
* Represents a span of raw text (concrete syntax) between tags in a tree
* pattern string.
*/
let TextChunk = class TextChunk extends Chunk_1.Chunk {
/**
* Constructs a new instance of {@link TextChunk} with the specified text.
*
* @param text The text of this chunk.
* @exception IllegalArgumentException if `text` is not defined.
*/
constructor(text) {
super();
if (text == null) {
throw new Error("text cannot be null");
}
this._text = text;
}
/**
* Gets the raw text of this chunk.
*
* @returns The text of the chunk.
*/
get text() {
return this._text;
}
/**
* {@inheritDoc}
*
* The implementation for {@link TextChunk} returns the result of
* `text` in single quotes.
*/
toString() {
return "'" + this._text + "'";
}
};
__decorate([
Decorators_1.NotNull
], TextChunk.prototype, "_text", void 0);
__decorate([
Decorators_1.NotNull
], TextChunk.prototype, "text", null);
__decorate([
Decorators_1.Override
], TextChunk.prototype, "toString", null);
TextChunk = __decorate([
__param(0, Decorators_1.NotNull)
], TextChunk);
exports.TextChunk = TextChunk;
//# sourceMappingURL=TextChunk.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TextChunk.js","sourceRoot":"","sources":["../../../../src/tree/pattern/TextChunk.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,wDAAwD;AAExD,mCAAgC;AAChC,iDAAqD;AAErD;;;GAGG;AACH,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,aAAK;IAOnC;;;;;OAKG;IACH,YAAqB,IAAY;QAChC,KAAK,EAAE,CAAC;QAER,IAAI,IAAI,IAAI,IAAI,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACvC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IAEH,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IAEI,QAAQ;QACd,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IAC/B,CAAC;CACD,CAAA;AAtCA;IADC,oBAAO;wCACc;AAwBtB;IADC,oBAAO;qCAGP;AASD;IADC,qBAAQ;yCAGR;AA1CW,SAAS;IAaR,WAAA,oBAAO,CAAA;GAbR,SAAS,CA2CrB;AA3CY,8BAAS","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:46.2521448-07:00\r\n\r\nimport { Chunk } from \"./Chunk\";\r\nimport { NotNull, Override } from \"../../Decorators\";\r\n\r\n/**\r\n * Represents a span of raw text (concrete syntax) between tags in a tree\r\n * pattern string.\r\n */\r\nexport class TextChunk extends Chunk {\r\n\t/**\r\n\t * This is the backing field for {@link #getText}.\r\n\t */\r\n\t@NotNull\r\n\tprivate _text: string;\r\n\r\n\t/**\r\n\t * Constructs a new instance of {@link TextChunk} with the specified text.\r\n\t *\r\n\t * @param text The text of this chunk.\r\n\t * @exception IllegalArgumentException if `text` is not defined.\r\n\t */\r\n\tconstructor(@NotNull text: string) {\r\n\t\tsuper();\r\n\r\n\t\tif (text == null) {\r\n\t\t\tthrow new Error(\"text cannot be null\");\r\n\t\t}\r\n\r\n\t\tthis._text = text;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the raw text of this chunk.\r\n\t *\r\n\t * @returns The text of the chunk.\r\n\t */\r\n\t@NotNull\r\n\tget text(): string {\r\n\t\treturn this._text;\r\n\t}\r\n\r\n\t/**\r\n\t * {@inheritDoc}\r\n\t *\r\n\t * The implementation for {@link TextChunk} returns the result of\r\n\t * `text` in single quotes.\r\n\t */\r\n\t@Override\r\n\tpublic toString(): string {\r\n\t\treturn \"'\" + this._text + \"'\";\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,56 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { CommonToken } from "../../CommonToken";
/**
* A {@link Token} object representing a token of a particular type; e.g.,
* `<ID>`. These tokens are created for {@link TagChunk} chunks where the
* tag corresponds to a lexer rule or token type.
*/
export declare class TokenTagToken extends CommonToken {
/**
* This is the backing field for `tokenName`.
*/
private _tokenName;
/**
* This is the backing field for `label`.
*/
private _label;
/**
* Constructs a new instance of {@link TokenTagToken} with the specified
* token name, type, and label.
*
* @param tokenName The token name.
* @param type The token type.
* @param label The label associated with the token tag, or `undefined` if
* the token tag is unlabeled.
*/
constructor(tokenName: string, type: number, label?: string);
/**
* Gets the token name.
* @returns The token name.
*/
get tokenName(): string;
/**
* Gets the label associated with the rule tag.
*
* @returns The name of the label associated with the rule tag, or
* `undefined` if this is an unlabeled rule tag.
*/
get label(): string | undefined;
/**
* {@inheritDoc}
*
* The implementation for {@link TokenTagToken} returns the token tag
* formatted with `<` and `>` delimiters.
*/
get text(): string;
/**
* {@inheritDoc}
*
* The implementation for {@link TokenTagToken} returns a string of the form
* `tokenName:type`.
*/
toString(): string;
}

View File

@@ -0,0 +1,94 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TokenTagToken = void 0;
// ConvertTo-TS run at 2016-10-04T11:26:46.3281988-07:00
const CommonToken_1 = require("../../CommonToken");
const Decorators_1 = require("../../Decorators");
/**
* A {@link Token} object representing a token of a particular type; e.g.,
* `<ID>`. These tokens are created for {@link TagChunk} chunks where the
* tag corresponds to a lexer rule or token type.
*/
let TokenTagToken = class TokenTagToken extends CommonToken_1.CommonToken {
/**
* Constructs a new instance of {@link TokenTagToken} with the specified
* token name, type, and label.
*
* @param tokenName The token name.
* @param type The token type.
* @param label The label associated with the token tag, or `undefined` if
* the token tag is unlabeled.
*/
constructor(tokenName, type, label) {
super(type);
this._tokenName = tokenName;
this._label = label;
}
/**
* Gets the token name.
* @returns The token name.
*/
get tokenName() {
return this._tokenName;
}
/**
* Gets the label associated with the rule tag.
*
* @returns The name of the label associated with the rule tag, or
* `undefined` if this is an unlabeled rule tag.
*/
get label() {
return this._label;
}
/**
* {@inheritDoc}
*
* The implementation for {@link TokenTagToken} returns the token tag
* formatted with `<` and `>` delimiters.
*/
get text() {
if (this._label != null) {
return "<" + this._label + ":" + this._tokenName + ">";
}
return "<" + this._tokenName + ">";
}
/**
* {@inheritDoc}
*
* The implementation for {@link TokenTagToken} returns a string of the form
* `tokenName:type`.
*/
toString() {
return this._tokenName + ":" + this.type;
}
};
__decorate([
Decorators_1.NotNull
], TokenTagToken.prototype, "_tokenName", void 0);
__decorate([
Decorators_1.NotNull
], TokenTagToken.prototype, "tokenName", null);
__decorate([
Decorators_1.Override
], TokenTagToken.prototype, "text", null);
__decorate([
Decorators_1.Override
], TokenTagToken.prototype, "toString", null);
TokenTagToken = __decorate([
__param(0, Decorators_1.NotNull)
], TokenTagToken);
exports.TokenTagToken = TokenTagToken;
//# sourceMappingURL=TokenTagToken.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TokenTagToken.js","sourceRoot":"","sources":["../../../../src/tree/pattern/TokenTagToken.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,wDAAwD;AAExD,mDAAgD;AAChD,iDAAqD;AAErD;;;;GAIG;AACH,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,yBAAW;IAW7C;;;;;;;;OAQG;IACH,YAAqB,SAAiB,EAAE,IAAY,EAAE,KAAc;QACnE,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;OAGG;IAEH,IAAI,SAAS;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IAEH,IAAI,IAAI;QACP,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;YACxB,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;SACvD;QAED,OAAO,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IAEI,QAAQ;QACd,OAAO,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;IAC1C,CAAC;CACD,CAAA;AAjEA;IADC,oBAAO;iDACmB;AA0B3B;IADC,oBAAO;8CAGP;AAmBD;IADC,qBAAQ;yCAOR;AASD;IADC,qBAAQ;6CAGR;AArEW,aAAa;IAoBZ,WAAA,oBAAO,CAAA;GApBR,aAAa,CAsEzB;AAtEY,sCAAa","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// ConvertTo-TS run at 2016-10-04T11:26:46.3281988-07:00\r\n\r\nimport { CommonToken } from \"../../CommonToken\";\r\nimport { NotNull, Override } from \"../../Decorators\";\r\n\r\n/**\r\n * A {@link Token} object representing a token of a particular type; e.g.,\r\n * `<ID>`. These tokens are created for {@link TagChunk} chunks where the\r\n * tag corresponds to a lexer rule or token type.\r\n */\r\nexport class TokenTagToken extends CommonToken {\r\n\t/**\r\n\t * This is the backing field for `tokenName`.\r\n\t */\r\n\t@NotNull\r\n\tprivate _tokenName: string;\r\n\t/**\r\n\t * This is the backing field for `label`.\r\n\t */\r\n\tprivate _label: string | undefined;\r\n\r\n\t/**\r\n\t * Constructs a new instance of {@link TokenTagToken} with the specified\r\n\t * token name, type, and label.\r\n\t *\r\n\t * @param tokenName The token name.\r\n\t * @param type The token type.\r\n\t * @param label The label associated with the token tag, or `undefined` if\r\n\t * the token tag is unlabeled.\r\n\t */\r\n\tconstructor(@NotNull tokenName: string, type: number, label?: string) {\r\n\t\tsuper(type);\r\n\t\tthis._tokenName = tokenName;\r\n\t\tthis._label = label;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the token name.\r\n\t * @returns The token name.\r\n\t */\r\n\t@NotNull\r\n\tget tokenName(): string {\r\n\t\treturn this._tokenName;\r\n\t}\r\n\r\n\t/**\r\n\t * Gets the label associated with the rule tag.\r\n\t *\r\n\t * @returns The name of the label associated with the rule tag, or\r\n\t * `undefined` if this is an unlabeled rule tag.\r\n\t */\r\n\tget label(): string | undefined {\r\n\t\treturn this._label;\r\n\t}\r\n\r\n\t/**\r\n\t * {@inheritDoc}\r\n\t *\r\n\t * The implementation for {@link TokenTagToken} returns the token tag\r\n\t * formatted with `<` and `>` delimiters.\r\n\t */\r\n\t@Override\r\n\tget text(): string {\r\n\t\tif (this._label != null) {\r\n\t\t\treturn \"<\" + this._label + \":\" + this._tokenName + \">\";\r\n\t\t}\r\n\r\n\t\treturn \"<\" + this._tokenName + \">\";\r\n\t}\r\n\r\n\t/**\r\n\t * {@inheritDoc}\r\n\t *\r\n\t * The implementation for {@link TokenTagToken} returns a string of the form\r\n\t * `tokenName:type`.\r\n\t */\r\n\t@Override\r\n\tpublic toString(): string {\r\n\t\treturn this._tokenName + \":\" + this.type;\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,9 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
export * from "./ParseTreeMatch";
export * from "./ParseTreePattern";
export * from "./ParseTreePatternMatcher";
export * from "./RuleTagToken";
export * from "./TokenTagToken";

View File

@@ -0,0 +1,28 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./ParseTreeMatch"), exports);
__exportStar(require("./ParseTreePattern"), exports);
__exportStar(require("./ParseTreePatternMatcher"), exports);
__exportStar(require("./RuleTagToken"), exports);
__exportStar(require("./TokenTagToken"), exports);
// The following are "package-private modules" - exported individually but don't need to be part of the public API
// exposed by this file.
//
// export * from "./Chunk";
// export * from "./TagChunk";
// export * from "./TextChunk";
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tree/pattern/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,mDAAiC;AACjC,qDAAmC;AACnC,4DAA0C;AAC1C,iDAA+B;AAC/B,kDAAgC;AAEhC,kHAAkH;AAClH,wBAAwB;AACxB,EAAE;AACF,2BAA2B;AAC3B,8BAA8B;AAC9B,+BAA+B","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\nexport * from \"./ParseTreeMatch\";\r\nexport * from \"./ParseTreePattern\";\r\nexport * from \"./ParseTreePatternMatcher\";\r\nexport * from \"./RuleTagToken\";\r\nexport * from \"./TokenTagToken\";\r\n\r\n// The following are \"package-private modules\" - exported individually but don't need to be part of the public API\r\n// exposed by this file.\r\n//\r\n// export * from \"./Chunk\";\r\n// export * from \"./TagChunk\";\r\n// export * from \"./TextChunk\";\r\n"]}

View File

@@ -0,0 +1,66 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { Parser } from "../../Parser";
import { ParseTree } from "../ParseTree";
import { Token } from "../../Token";
import { XPathElement } from "./XPathElement";
/**
* Represent a subset of XPath XML path syntax for use in identifying nodes in
* parse trees.
*
* Split path into words and separators `/` and `//` via ANTLR
* itself then walk path elements from left to right. At each separator-word
* pair, find set of nodes. Next stage uses those as work list.
*
* The basic interface is
* {@link XPath#findAll ParseTree.findAll}`(tree, pathString, parser)`.
* But that is just shorthand for:
*
* ```
* let p = new XPath(parser, pathString);
* return p.evaluate(tree);
* ```
*
* See `TestXPath` for descriptions. In short, this
* allows operators:
*
* | | |
* | --- | --- |
* | `/` | root |
* | `//` | anywhere |
* | `!` | invert; this much appear directly after root or anywhere operator |
*
* and path elements:
*
* | | |
* | --- | --- |
* | `ID` | token name |
* | `'string'` | any string literal token from the grammar |
* | `expr` | rule name |
* | `*` | wildcard matching any node |
*
* Whitespace is not allowed.
*/
export declare class XPath {
static readonly WILDCARD: string;
static readonly NOT: string;
protected path: string;
protected elements: XPathElement[];
protected parser: Parser;
constructor(parser: Parser, path: string);
split(path: string): XPathElement[];
/**
* Convert word like `*` or `ID` or `expr` to a path
* element. `anywhere` is `true` if `//` precedes the
* word.
*/
protected getXPathElement(wordToken: Token, anywhere: boolean): XPathElement;
static findAll(tree: ParseTree, xpath: string, parser: Parser): Set<ParseTree>;
/**
* Return a list of all nodes starting at `t` as root that satisfy the
* path. The root `/` is relative to the node passed to {@link evaluate}.
*/
evaluate(t: ParseTree): Set<ParseTree>;
}

View File

@@ -0,0 +1,196 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPath = void 0;
// ConvertTo-TS run at 2016-10-04T11:26:46.4373888-07:00
const CharStreams_1 = require("../../CharStreams");
const CommonTokenStream_1 = require("../../CommonTokenStream");
const LexerNoViableAltException_1 = require("../../LexerNoViableAltException");
const ParserRuleContext_1 = require("../../ParserRuleContext");
const Token_1 = require("../../Token");
const XPathLexer_1 = require("./XPathLexer");
const XPathLexerErrorListener_1 = require("./XPathLexerErrorListener");
const XPathRuleAnywhereElement_1 = require("./XPathRuleAnywhereElement");
const XPathRuleElement_1 = require("./XPathRuleElement");
const XPathTokenAnywhereElement_1 = require("./XPathTokenAnywhereElement");
const XPathTokenElement_1 = require("./XPathTokenElement");
const XPathWildcardAnywhereElement_1 = require("./XPathWildcardAnywhereElement");
const XPathWildcardElement_1 = require("./XPathWildcardElement");
/**
* Represent a subset of XPath XML path syntax for use in identifying nodes in
* parse trees.
*
* Split path into words and separators `/` and `//` via ANTLR
* itself then walk path elements from left to right. At each separator-word
* pair, find set of nodes. Next stage uses those as work list.
*
* The basic interface is
* {@link XPath#findAll ParseTree.findAll}`(tree, pathString, parser)`.
* But that is just shorthand for:
*
* ```
* let p = new XPath(parser, pathString);
* return p.evaluate(tree);
* ```
*
* See `TestXPath` for descriptions. In short, this
* allows operators:
*
* | | |
* | --- | --- |
* | `/` | root |
* | `//` | anywhere |
* | `!` | invert; this much appear directly after root or anywhere operator |
*
* and path elements:
*
* | | |
* | --- | --- |
* | `ID` | token name |
* | `'string'` | any string literal token from the grammar |
* | `expr` | rule name |
* | `*` | wildcard matching any node |
*
* Whitespace is not allowed.
*/
class XPath {
constructor(parser, path) {
this.parser = parser;
this.path = path;
this.elements = this.split(path);
// console.log(this.elements.toString());
}
// TODO: check for invalid token/rule names, bad syntax
split(path) {
let lexer = new XPathLexer_1.XPathLexer(CharStreams_1.CharStreams.fromString(path));
lexer.recover = (e) => { throw e; };
lexer.removeErrorListeners();
lexer.addErrorListener(new XPathLexerErrorListener_1.XPathLexerErrorListener());
let tokenStream = new CommonTokenStream_1.CommonTokenStream(lexer);
try {
tokenStream.fill();
}
catch (e) {
if (e instanceof LexerNoViableAltException_1.LexerNoViableAltException) {
let pos = lexer.charPositionInLine;
let msg = "Invalid tokens or characters at index " + pos + " in path '" + path + "' -- " + e.message;
throw new RangeError(msg);
}
throw e;
}
let tokens = tokenStream.getTokens();
// console.log("path=" + path + "=>" + tokens);
let elements = [];
let n = tokens.length;
let i = 0;
loop: while (i < n) {
let el = tokens[i];
let next;
switch (el.type) {
case XPathLexer_1.XPathLexer.ROOT:
case XPathLexer_1.XPathLexer.ANYWHERE:
let anywhere = el.type === XPathLexer_1.XPathLexer.ANYWHERE;
i++;
next = tokens[i];
let invert = next.type === XPathLexer_1.XPathLexer.BANG;
if (invert) {
i++;
next = tokens[i];
}
let pathElement = this.getXPathElement(next, anywhere);
pathElement.invert = invert;
elements.push(pathElement);
i++;
break;
case XPathLexer_1.XPathLexer.TOKEN_REF:
case XPathLexer_1.XPathLexer.RULE_REF:
case XPathLexer_1.XPathLexer.WILDCARD:
elements.push(this.getXPathElement(el, false));
i++;
break;
case Token_1.Token.EOF:
break loop;
default:
throw new Error("Unknowth path element " + el);
}
}
return elements;
}
/**
* Convert word like `*` or `ID` or `expr` to a path
* element. `anywhere` is `true` if `//` precedes the
* word.
*/
getXPathElement(wordToken, anywhere) {
if (wordToken.type === Token_1.Token.EOF) {
throw new Error("Missing path element at end of path");
}
let word = wordToken.text;
if (word == null) {
throw new Error("Expected wordToken to have text content.");
}
let ttype = this.parser.getTokenType(word);
let ruleIndex = this.parser.getRuleIndex(word);
switch (wordToken.type) {
case XPathLexer_1.XPathLexer.WILDCARD:
return anywhere ?
new XPathWildcardAnywhereElement_1.XPathWildcardAnywhereElement() :
new XPathWildcardElement_1.XPathWildcardElement();
case XPathLexer_1.XPathLexer.TOKEN_REF:
case XPathLexer_1.XPathLexer.STRING:
if (ttype === Token_1.Token.INVALID_TYPE) {
throw new Error(word + " at index " +
wordToken.startIndex +
" isn't a valid token name");
}
return anywhere ?
new XPathTokenAnywhereElement_1.XPathTokenAnywhereElement(word, ttype) :
new XPathTokenElement_1.XPathTokenElement(word, ttype);
default:
if (ruleIndex === -1) {
throw new Error(word + " at index " +
wordToken.startIndex +
" isn't a valid rule name");
}
return anywhere ?
new XPathRuleAnywhereElement_1.XPathRuleAnywhereElement(word, ruleIndex) :
new XPathRuleElement_1.XPathRuleElement(word, ruleIndex);
}
}
static findAll(tree, xpath, parser) {
let p = new XPath(parser, xpath);
return p.evaluate(tree);
}
/**
* Return a list of all nodes starting at `t` as root that satisfy the
* path. The root `/` is relative to the node passed to {@link evaluate}.
*/
evaluate(t) {
let dummyRoot = new ParserRuleContext_1.ParserRuleContext();
dummyRoot.addChild(t);
let work = new Set([dummyRoot]);
let i = 0;
while (i < this.elements.length) {
let next = new Set();
for (let node of work) {
if (node.childCount > 0) {
// only try to match next element if it has children
// e.g., //func/*/stat might have a token node for which
// we can't go looking for stat nodes.
let matching = this.elements[i].evaluate(node);
matching.forEach(next.add, next);
}
}
i++;
work = next;
}
return work;
}
}
exports.XPath = XPath;
XPath.WILDCARD = "*"; // word not operator/separator
XPath.NOT = "!"; // word for invert operator
//# sourceMappingURL=XPath.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
export declare abstract class XPathElement {
protected nodeName: string;
invert: boolean;
/** Construct element like `/ID` or `ID` or `/*` etc...
* op is null if just node
*/
constructor(nodeName: string);
/**
* Given tree rooted at `t` return all nodes matched by this path
* element.
*/
abstract evaluate(t: ParseTree): ParseTree[];
toString(): string;
}

View File

@@ -0,0 +1,34 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathElement = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const Decorators_1 = require("../../Decorators");
class XPathElement {
/** Construct element like `/ID` or `ID` or `/*` etc...
* op is null if just node
*/
constructor(nodeName) {
this.nodeName = nodeName;
this.invert = false;
}
toString() {
let inv = this.invert ? "!" : "";
let className = Object.constructor.name;
return className + "[" + inv + this.nodeName + "]";
}
}
__decorate([
Decorators_1.Override
], XPathElement.prototype, "toString", null);
exports.XPathElement = XPathElement;
//# sourceMappingURL=XPathElement.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathElement.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathElement.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+CAA+C;AAC/C,iDAA4C;AAG5C,MAAsB,YAAY;IAIjC;;OAEG;IACH,YAAY,QAAgB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACrB,CAAC;IASM,QAAQ;QACd,IAAI,GAAG,GAAW,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,IAAI,SAAS,GAAW,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;QAChD,OAAO,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;IACpD,CAAC;CACD;AALA;IADC,qBAAQ;4CAKR;AAvBF,oCAwBC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\nimport { Override } from \"../../Decorators\";\r\nimport { ParseTree } from \"../ParseTree\";\r\n\r\nexport abstract class XPathElement {\r\n\tprotected nodeName: string;\r\n\tpublic invert: boolean;\r\n\r\n\t/** Construct element like `/ID` or `ID` or `/*` etc...\r\n\t * op is null if just node\r\n\t */\r\n\tconstructor(nodeName: string) {\r\n\t\tthis.nodeName = nodeName;\r\n\t\tthis.invert = false;\r\n\t}\r\n\r\n\t/**\r\n\t * Given tree rooted at `t` return all nodes matched by this path\r\n\t * element.\r\n\t */\r\n\tpublic abstract evaluate(t: ParseTree): ParseTree[];\r\n\r\n\t@Override\r\n\tpublic toString(): string {\r\n\t\tlet inv: string = this.invert ? \"!\" : \"\";\r\n\t\tlet className: string = Object.constructor.name;\r\n\t\treturn className + \"[\" + inv + this.nodeName + \"]\";\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,36 @@
import { ATN } from "../../atn/ATN";
import { CharStream } from "../../CharStream";
import { Lexer } from "../../Lexer";
import { RuleContext } from "../../RuleContext";
import { Vocabulary } from "../../Vocabulary";
export declare class XPathLexer extends Lexer {
static readonly TOKEN_REF = 1;
static readonly RULE_REF = 2;
static readonly ANYWHERE = 3;
static readonly ROOT = 4;
static readonly WILDCARD = 5;
static readonly BANG = 6;
static readonly ID = 7;
static readonly STRING = 8;
static readonly channelNames: string[];
static readonly modeNames: string[];
static readonly ruleNames: string[];
private static readonly _LITERAL_NAMES;
private static readonly _SYMBOLIC_NAMES;
static readonly VOCABULARY: Vocabulary;
get vocabulary(): Vocabulary;
constructor(input: CharStream);
get grammarFileName(): string;
get ruleNames(): string[];
get serializedATN(): string;
get channelNames(): string[];
get modeNames(): string[];
action(_localctx: RuleContext, ruleIndex: number, actionIndex: number): void;
private ID_action;
private static readonly _serializedATNSegments;
private static readonly _serializedATNSegment0;
private static readonly _serializedATNSegment1;
static readonly _serializedATN: string;
static __ATN: ATN;
static get _ATN(): ATN;
}

View File

@@ -0,0 +1,474 @@
"use strict";
// Generated from XPathLexer.g4 by ANTLR 4.9.0-SNAPSHOT
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathLexer = void 0;
const ATNDeserializer_1 = require("../../atn/ATNDeserializer");
const Lexer_1 = require("../../Lexer");
const LexerATNSimulator_1 = require("../../atn/LexerATNSimulator");
const VocabularyImpl_1 = require("../../VocabularyImpl");
const Utils = require("../../misc/Utils");
class XPathLexer extends Lexer_1.Lexer {
// tslint:enable:no-trailing-whitespace
constructor(input) {
super(input);
this._interp = new LexerATNSimulator_1.LexerATNSimulator(XPathLexer._ATN, this);
}
// @Override
// @NotNull
get vocabulary() {
return XPathLexer.VOCABULARY;
}
// @Override
get grammarFileName() { return "XPathLexer.g4"; }
// @Override
get ruleNames() { return XPathLexer.ruleNames; }
// @Override
get serializedATN() { return XPathLexer._serializedATN; }
// @Override
get channelNames() { return XPathLexer.channelNames; }
// @Override
get modeNames() { return XPathLexer.modeNames; }
// @Override
action(_localctx, ruleIndex, actionIndex) {
switch (ruleIndex) {
case 4:
this.ID_action(_localctx, actionIndex);
break;
}
}
ID_action(_localctx, actionIndex) {
switch (actionIndex) {
case 0:
let text = this.text;
if (text.charAt(0) === text.charAt(0).toUpperCase()) {
this.type = XPathLexer.TOKEN_REF;
}
else {
this.type = XPathLexer.RULE_REF;
}
break;
}
}
static get _ATN() {
if (!XPathLexer.__ATN) {
XPathLexer.__ATN = new ATNDeserializer_1.ATNDeserializer().deserialize(Utils.toCharArray(XPathLexer._serializedATN));
}
return XPathLexer.__ATN;
}
}
exports.XPathLexer = XPathLexer;
XPathLexer.TOKEN_REF = 1;
XPathLexer.RULE_REF = 2;
XPathLexer.ANYWHERE = 3;
XPathLexer.ROOT = 4;
XPathLexer.WILDCARD = 5;
XPathLexer.BANG = 6;
XPathLexer.ID = 7;
XPathLexer.STRING = 8;
// tslint:disable:no-trailing-whitespace
XPathLexer.channelNames = [
"DEFAULT_TOKEN_CHANNEL", "HIDDEN",
];
// tslint:disable:no-trailing-whitespace
XPathLexer.modeNames = [
"DEFAULT_MODE",
];
XPathLexer.ruleNames = [
"ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar",
"STRING",
];
XPathLexer._LITERAL_NAMES = [
undefined, undefined, undefined, "'//'", "'/'", "'*'", "'!'",
];
XPathLexer._SYMBOLIC_NAMES = [
undefined, "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG",
"ID", "STRING",
];
XPathLexer.VOCABULARY = new VocabularyImpl_1.VocabularyImpl(XPathLexer._LITERAL_NAMES, XPathLexer._SYMBOLIC_NAMES, []);
XPathLexer._serializedATNSegments = 2;
XPathLexer._serializedATNSegment0 = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\n2\b\x01\x04" +
"\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04" +
"\x07\t\x07\x04\b\t\b\x04\t\t\t\x03\x02\x03\x02\x03\x02\x03\x03\x03\x03" +
"\x03\x04\x03\x04\x03\x05\x03\x05\x03\x06\x03\x06\x07\x06\x1F\n\x06\f\x06" +
"\x0E\x06\"\v\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\b\x03\b\x03\t\x03" +
"\t\x07\t,\n\t\f\t\x0E\t/\v\t\x03\t\x03\t\x03-\x02\x02\n\x03\x02\x05\x05" +
"\x02\x06\x07\x02\x07\t\x02\b\v\x02\t\r\x02\x02\x0F\x02\x02\x11\x02\n\x03" +
"\x02\x02\x04\u02B6\x02\x02\x02\n\x02\x10\x02\x1D\x022\x02;\x02C\x02\\" +
"\x02a\x02a\x02c\x02|\x02\x81\x02\xA1\x02\xAC\x02\xAC\x02\xAF\x02\xAF\x02" +
"\xB7\x02\xB7\x02\xBC\x02\xBC\x02\xC2\x02\xD8\x02\xDA\x02\xF8\x02\xFA\x02" +
"\u02C3\x02\u02C8\x02\u02D3\x02\u02E2\x02\u02E6\x02\u02EE\x02\u02EE\x02" +
"\u02F0\x02\u02F0\x02\u0302\x02\u0376\x02\u0378\x02\u0379\x02\u037C\x02" +
"\u037F\x02\u0381\x02\u0381\x02\u0388\x02\u0388\x02\u038A\x02\u038C\x02" +
"\u038E\x02\u038E\x02\u0390\x02\u03A3\x02\u03A5\x02\u03F7\x02\u03F9\x02" +
"\u0483\x02\u0485\x02\u0489\x02\u048C\x02\u0531\x02\u0533\x02\u0558\x02" +
"\u055B\x02\u055B\x02\u0563\x02\u0589\x02\u0593\x02\u05BF\x02\u05C1\x02" +
"\u05C1\x02\u05C3\x02\u05C4\x02\u05C6\x02\u05C7\x02\u05C9\x02\u05C9\x02" +
"\u05D2\x02\u05EC\x02\u05F2\x02\u05F4\x02\u0602\x02\u0607\x02\u0612\x02" +
"\u061C\x02\u061E\x02\u061E\x02\u0622\x02\u066B\x02\u0670\x02\u06D5\x02" +
"\u06D7\x02\u06DF\x02\u06E1\x02\u06EA\x02\u06EC\x02\u06FE\x02\u0701\x02" +
"\u0701\x02\u0711\x02\u074C\x02\u074F\x02\u07B3\x02\u07C2\x02\u07F7\x02" +
"\u07FC\x02\u07FC\x02\u0802\x02\u082F\x02\u0842\x02\u085D\x02\u08A2\x02" +
"\u08B6\x02\u08B8\x02\u08BF\x02\u08D6\x02\u0965\x02\u0968\x02\u0971\x02" +
"\u0973\x02\u0985\x02\u0987\x02\u098E\x02\u0991\x02\u0992\x02\u0995\x02" +
"\u09AA\x02\u09AC\x02\u09B2\x02\u09B4\x02\u09B4\x02\u09B8\x02\u09BB\x02" +
"\u09BE\x02\u09C6\x02\u09C9\x02\u09CA\x02\u09CD\x02\u09D0\x02\u09D9\x02" +
"\u09D9\x02\u09DE\x02\u09DF\x02\u09E1\x02\u09E5\x02\u09E8\x02\u09F3\x02" +
"\u0A03\x02\u0A05\x02\u0A07\x02\u0A0C\x02\u0A11\x02\u0A12\x02\u0A15\x02" +
"\u0A2A\x02\u0A2C\x02\u0A32\x02\u0A34\x02\u0A35\x02\u0A37\x02\u0A38\x02" +
"\u0A3A\x02\u0A3B\x02\u0A3E\x02\u0A3E\x02\u0A40\x02\u0A44\x02\u0A49\x02" +
"\u0A4A\x02\u0A4D\x02\u0A4F\x02\u0A53\x02\u0A53\x02\u0A5B\x02\u0A5E\x02" +
"\u0A60\x02\u0A60\x02\u0A68\x02\u0A77\x02\u0A83\x02\u0A85\x02\u0A87\x02" +
"\u0A8F\x02\u0A91\x02\u0A93\x02\u0A95\x02\u0AAA\x02\u0AAC\x02\u0AB2\x02" +
"\u0AB4\x02\u0AB5\x02\u0AB7\x02\u0ABB\x02\u0ABE\x02\u0AC7\x02\u0AC9\x02" +
"\u0ACB\x02\u0ACD\x02\u0ACF\x02\u0AD2\x02\u0AD2\x02\u0AE2\x02\u0AE5\x02" +
"\u0AE8\x02\u0AF1\x02\u0AFB\x02\u0AFB\x02\u0B03\x02\u0B05\x02\u0B07\x02" +
"\u0B0E\x02\u0B11\x02\u0B12\x02\u0B15\x02\u0B2A\x02\u0B2C\x02\u0B32\x02" +
"\u0B34\x02\u0B35\x02\u0B37\x02\u0B3B\x02\u0B3E\x02\u0B46\x02\u0B49\x02" +
"\u0B4A\x02\u0B4D\x02\u0B4F\x02\u0B58\x02\u0B59\x02\u0B5E\x02\u0B5F\x02" +
"\u0B61\x02\u0B65\x02\u0B68\x02\u0B71\x02\u0B73\x02\u0B73\x02\u0B84\x02" +
"\u0B85\x02\u0B87\x02\u0B8C\x02\u0B90\x02\u0B92\x02\u0B94\x02\u0B97\x02" +
"\u0B9B\x02\u0B9C\x02\u0B9E\x02\u0B9E\x02\u0BA0\x02\u0BA1\x02\u0BA5\x02" +
"\u0BA6\x02\u0BAA\x02\u0BAC\x02\u0BB0\x02\u0BBB\x02\u0BC0\x02\u0BC4\x02" +
"\u0BC8\x02\u0BCA\x02\u0BCC\x02\u0BCF\x02\u0BD2\x02\u0BD2\x02\u0BD9\x02" +
"\u0BD9\x02\u0BE8\x02\u0BF1\x02\u0C02\x02\u0C05\x02\u0C07\x02\u0C0E\x02" +
"\u0C10\x02\u0C12\x02\u0C14\x02\u0C2A\x02\u0C2C\x02\u0C3B\x02\u0C3F\x02" +
"\u0C46\x02\u0C48\x02\u0C4A\x02\u0C4C\x02\u0C4F\x02\u0C57\x02\u0C58\x02" +
"\u0C5A\x02\u0C5C\x02\u0C62\x02\u0C65\x02\u0C68\x02\u0C71\x02\u0C82\x02" +
"\u0C85\x02\u0C87\x02\u0C8E\x02\u0C90\x02\u0C92\x02\u0C94\x02\u0CAA\x02" +
"\u0CAC\x02\u0CB5\x02\u0CB7\x02\u0CBB\x02\u0CBE\x02\u0CC6\x02\u0CC8\x02" +
"\u0CCA\x02\u0CCC\x02\u0CCF\x02\u0CD7\x02\u0CD8\x02\u0CE0\x02\u0CE0\x02" +
"\u0CE2\x02\u0CE5\x02\u0CE8\x02\u0CF1\x02\u0CF3\x02\u0CF4\x02\u0D03\x02" +
"\u0D05\x02\u0D07\x02\u0D0E\x02\u0D10\x02\u0D12\x02\u0D14\x02\u0D3C\x02" +
"\u0D3F\x02\u0D46\x02\u0D48\x02\u0D4A\x02\u0D4C\x02\u0D50\x02\u0D56\x02" +
"\u0D59\x02\u0D61\x02\u0D65\x02\u0D68\x02\u0D71\x02\u0D7C\x02\u0D81\x02" +
"\u0D84\x02\u0D85\x02\u0D87\x02\u0D98\x02\u0D9C\x02\u0DB3\x02\u0DB5\x02" +
"\u0DBD\x02\u0DBF\x02\u0DBF\x02\u0DC2\x02\u0DC8\x02\u0DCC\x02\u0DCC\x02" +
"\u0DD1\x02\u0DD6\x02\u0DD8\x02\u0DD8\x02\u0DDA\x02\u0DE1\x02\u0DE8\x02" +
"\u0DF1\x02\u0DF4\x02\u0DF5\x02\u0E03\x02\u0E3C\x02\u0E42\x02\u0E50\x02" +
"\u0E52\x02\u0E5B\x02\u0E83\x02\u0E84\x02\u0E86\x02\u0E86\x02\u0E89\x02" +
"\u0E8A\x02\u0E8C\x02\u0E8C\x02\u0E8F\x02\u0E8F\x02\u0E96\x02\u0E99\x02" +
"\u0E9B\x02\u0EA1\x02\u0EA3\x02\u0EA5\x02\u0EA7\x02\u0EA7\x02\u0EA9\x02" +
"\u0EA9\x02\u0EAC\x02\u0EAD\x02\u0EAF\x02\u0EBB\x02\u0EBD\x02\u0EBF\x02" +
"\u0EC2\x02\u0EC6\x02\u0EC8\x02\u0EC8\x02\u0ECA\x02\u0ECF\x02\u0ED2\x02" +
"\u0EDB\x02\u0EDE\x02\u0EE1\x02\u0F02\x02\u0F02\x02\u0F1A\x02\u0F1B\x02" +
"\u0F22\x02\u0F2B\x02\u0F37\x02\u0F37\x02\u0F39\x02\u0F39\x02\u0F3B\x02" +
"\u0F3B\x02\u0F40\x02\u0F49\x02\u0F4B\x02\u0F6E\x02\u0F73\x02\u0F86\x02" +
"\u0F88\x02\u0F99\x02\u0F9B\x02\u0FBE\x02\u0FC8\x02\u0FC8\x02\u1002\x02" +
"\u104B\x02\u1052\x02\u109F\x02\u10A2\x02\u10C7\x02\u10C9\x02\u10C9\x02" +
"\u10CF\x02\u10CF\x02\u10D2\x02\u10FC\x02\u10FE\x02\u124A\x02\u124C\x02" +
"\u124F\x02\u1252\x02\u1258\x02\u125A\x02\u125A\x02\u125C\x02\u125F\x02" +
"\u1262\x02\u128A\x02\u128C\x02\u128F\x02\u1292\x02\u12B2\x02\u12B4\x02" +
"\u12B7\x02\u12BA\x02\u12C0\x02\u12C2\x02\u12C2\x02\u12C4\x02\u12C7\x02" +
"\u12CA\x02\u12D8\x02\u12DA\x02\u1312\x02\u1314\x02\u1317\x02\u131A\x02" +
"\u135C\x02\u135F\x02\u1361\x02\u1382\x02\u1391\x02\u13A2\x02\u13F7\x02" +
"\u13FA\x02\u13FF\x02\u1403\x02\u166E\x02\u1671\x02\u1681\x02\u1683\x02" +
"\u169C\x02\u16A2\x02\u16EC\x02\u16F0\x02\u16FA\x02\u1702\x02\u170E\x02" +
"\u1710\x02\u1716\x02\u1722\x02\u1736\x02\u1742\x02\u1755\x02\u1762\x02" +
"\u176E\x02\u1770\x02\u1772\x02\u1774\x02\u1775\x02\u1782\x02\u17D5\x02" +
"\u17D9\x02\u17D9\x02\u17DE\x02\u17DF\x02\u17E2\x02\u17EB\x02\u180D\x02" +
"\u1810\x02\u1812\x02\u181B\x02\u1822\x02\u1879\x02\u1882\x02\u18AC\x02" +
"\u18B2\x02\u18F7\x02\u1902\x02\u1920\x02\u1922\x02\u192D\x02\u1932\x02" +
"\u193D\x02\u1948\x02\u196F\x02\u1972\x02\u1976\x02\u1982\x02\u19AD\x02" +
"\u19B2\x02\u19CB\x02\u19D2\x02\u19DB\x02\u1A02\x02\u1A1D\x02\u1A22\x02" +
"\u1A60\x02\u1A62\x02\u1A7E\x02\u1A81\x02\u1A8B\x02\u1A92\x02\u1A9B\x02" +
"\u1AA9\x02\u1AA9\x02\u1AB2\x02\u1ABF\x02\u1B02\x02\u1B4D\x02\u1B52\x02" +
"\u1B5B\x02\u1B6D\x02\u1B75\x02\u1B82\x02\u1BF5\x02\u1C02\x02\u1C39\x02" +
"\u1C42\x02\u1C4B\x02\u1C4F\x02\u1C7F\x02\u1C82\x02\u1C8A\x02\u1CD2\x02" +
"\u1CD4\x02\u1CD6\x02\u1CF8\x02\u1CFA\x02\u1CFB\x02\u1D02\x02\u1DF7\x02" +
"\u1DFD\x02\u1F17\x02\u1F1A\x02\u1F1F\x02\u1F22\x02\u1F47\x02\u1F4A\x02" +
"\u1F4F\x02\u1F52\x02\u1F59\x02\u1F5B\x02\u1F5B\x02\u1F5D\x02\u1F5D\x02" +
"\u1F5F\x02\u1F5F\x02\u1F61\x02\u1F7F\x02\u1F82\x02\u1FB6\x02\u1FB8\x02" +
"\u1FBE\x02\u1FC0\x02\u1FC0\x02\u1FC4\x02\u1FC6\x02\u1FC8\x02\u1FCE\x02" +
"\u1FD2\x02\u1FD5\x02\u1FD8\x02\u1FDD\x02\u1FE2\x02\u1FEE\x02\u1FF4\x02" +
"\u1FF6\x02\u1FF8\x02\u1FFE\x02\u200D\x02\u2011\x02\u202C\x02\u2030\x02" +
"\u2041\x02\u2042\x02\u2056\x02\u2056\x02\u2062\x02\u2066\x02\u2068\x02" +
"\u2071\x02\u2073\x02\u2073\x02\u2081\x02\u2081\x02\u2092\x02\u209E\x02" +
"\u20D2\x02\u20DE\x02\u20E3\x02\u20E3\x02\u20E7\x02\u20F2\x02\u2104\x02" +
"\u2104\x02\u2109\x02\u2109\x02\u210C\x02\u2115\x02\u2117\x02\u2117\x02" +
"\u211B\x02\u211F\x02\u2126\x02\u2126\x02\u2128\x02\u2128\x02\u212A\x02" +
"\u212A\x02\u212C\x02\u212F\x02\u2131\x02\u213B\x02\u213E\x02\u2141\x02" +
"\u2147\x02\u214B\x02\u2150\x02\u2150\x02\u2162\x02\u218A\x02\u2C02\x02" +
"\u2C30\x02\u2C32\x02\u2C60\x02\u2C62\x02\u2CE6\x02\u2CED\x02\u2CF5\x02" +
"\u2D02\x02\u2D27\x02\u2D29\x02\u2D29\x02\u2D2F\x02\u2D2F\x02\u2D32\x02" +
"\u2D69\x02\u2D71\x02\u2D71\x02\u2D81\x02\u2D98\x02\u2DA2\x02\u2DA8\x02" +
"\u2DAA\x02\u2DB0\x02\u2DB2\x02\u2DB8\x02\u2DBA\x02\u2DC0\x02\u2DC2\x02" +
"\u2DC8\x02\u2DCA\x02\u2DD0\x02\u2DD2\x02\u2DD8\x02\u2DDA\x02\u2DE0\x02" +
"\u2DE2\x02\u2E01\x02\u2E31\x02\u2E31\x02\u3007\x02\u3009\x02\u3023\x02" +
"\u3031\x02\u3033\x02\u3037\x02\u303A\x02\u303E\x02\u3043\x02\u3098\x02" +
"\u309B\x02\u309C\x02\u309F\x02\u30A1\x02\u30A3\x02\u30FC\x02\u30FE\x02" +
"\u3101\x02\u3107\x02\u312F\x02\u3133\x02\u3190\x02\u31A2\x02\u31BC\x02" +
"\u31F2\x02\u3201\x02\u3402\x02\u4DB7\x02\u4E02\x02\u9FD7\x02\uA002\x02" +
"\uA48E\x02\uA4D2\x02\uA4FF\x02\uA502\x02\uA60E\x02\uA612\x02\uA62D\x02" +
"\uA642\x02\uA671\x02\uA676\x02\uA67F\x02\uA681\x02\uA6F3\x02\uA719\x02" +
"\uA721\x02\uA724\x02\uA78A\x02\uA78D\x02\uA7B0\x02\uA7B2\x02\uA7B9\x02" +
"\uA7F9\x02\uA829\x02\uA842\x02\uA875\x02\uA882\x02\uA8C7\x02\uA8D2\x02" +
"\uA8DB\x02\uA8E2\x02\uA8F9\x02\uA8FD\x02\uA8FD\x02\uA8FF\x02\uA8FF\x02" +
"\uA902\x02\uA92F\x02\uA932\x02\uA955\x02\uA962\x02\uA97E\x02\uA982\x02" +
"\uA9C2\x02\uA9D1\x02\uA9DB\x02\uA9E2\x02\uAA00\x02\uAA02\x02\uAA38\x02" +
"\uAA42\x02\uAA4F\x02\uAA52\x02\uAA5B\x02\uAA62\x02\uAA78\x02\uAA7C\x02" +
"\uAAC4\x02\uAADD\x02\uAADF\x02\uAAE2\x02\uAAF1\x02\uAAF4\x02\uAAF8\x02" +
"\uAB03\x02\uAB08\x02\uAB0B\x02\uAB10\x02\uAB13\x02\uAB18\x02\uAB22\x02" +
"\uAB28\x02\uAB2A\x02\uAB30\x02\uAB32\x02\uAB5C\x02\uAB5E\x02\uAB67\x02" +
"\uAB72\x02\uABEC\x02\uABEE\x02\uABEF\x02\uABF2\x02\uABFB\x02\uAC02\x02" +
"\uD7A5\x02\uD7B2\x02\uD7C8\x02\uD7CD\x02\uD7FD\x02\uF902\x02\uFA6F\x02" +
"\uFA72\x02\uFADB\x02\uFB02\x02\uFB08\x02\uFB15\x02\uFB19\x02\uFB1F\x02" +
"\uFB2A\x02\uFB2C\x02\uFB38\x02\uFB3A\x02\uFB3E\x02\uFB40\x02\uFB40\x02" +
"\uFB42\x02\uFB43\x02\uFB45\x02\uFB46\x02\uFB48\x02\uFBB3\x02\uFBD5\x02" +
"\uFD3F\x02\uFD52\x02\uFD91\x02\uFD94\x02\uFDC9\x02\uFDF2\x02\uFDFD\x02" +
"\uFE02\x02\uFE11\x02\uFE22\x02\uFE31\x02\uFE35\x02\uFE36\x02\uFE4F\x02" +
"\uFE51\x02\uFE72\x02\uFE76\x02\uFE78\x02\uFEFE\x02\uFF01\x02\uFF01\x02" +
"\uFF12\x02\uFF1B\x02\uFF23\x02\uFF3C\x02\uFF41\x02\uFF41\x02\uFF43\x02" +
"\uFF5C\x02\uFF68\x02\uFFC0\x02\uFFC4\x02\uFFC9\x02\uFFCC\x02\uFFD1\x02" +
"\uFFD4\x02\uFFD9\x02\uFFDC\x02\uFFDE\x02\uFFFB\x02\uFFFD\x02\x02\x03\r" +
"\x03\x0F\x03(\x03*\x03<\x03>\x03?\x03A\x03O\x03R\x03_\x03\x82\x03\xFC" +
"\x03\u0142\x03\u0176\x03\u01FF\x03\u01FF\x03\u0282\x03\u029E\x03\u02A2" +
"\x03\u02D2\x03\u02E2\x03\u02E2\x03\u0302\x03\u0321\x03\u0332\x03\u034C" +
"\x03\u0352\x03\u037C\x03\u0382\x03\u039F\x03\u03A2\x03\u03C5\x03\u03CA" +
"\x03\u03D1\x03\u03D3\x03\u03D7\x03\u0402\x03\u049F\x03\u04A2\x03\u04AB" +
"\x03\u04B2\x03\u04D5\x03\u04DA\x03\u04FD\x03\u0502\x03\u0529\x03\u0532" +
"\x03\u0565\x03\u0602\x03\u0738\x03\u0742\x03\u0757\x03\u0762\x03\u0769" +
"\x03\u0802\x03\u0807\x03\u080A\x03\u080A\x03\u080C\x03\u0837\x03\u0839" +
"\x03\u083A\x03\u083E\x03\u083E\x03\u0841\x03\u0857\x03\u0862\x03\u0878" +
"\x03\u0882\x03\u08A0\x03\u08E2\x03\u08F4\x03\u08F6\x03\u08F7\x03\u0902" +
"\x03\u0917\x03\u0922\x03\u093B\x03\u0982\x03\u09B9\x03\u09C0\x03\u09C1" +
"\x03\u0A02\x03\u0A05\x03\u0A07\x03\u0A08\x03\u0A0E\x03\u0A15\x03\u0A17" +
"\x03\u0A19\x03\u0A1B\x03\u0A35\x03\u0A3A\x03\u0A3C\x03\u0A41\x03\u0A41" +
"\x03\u0A62\x03\u0A7E\x03\u0A82\x03\u0A9E\x03\u0AC2\x03\u0AC9\x03\u0ACB" +
"\x03\u0AE8\x03\u0B02\x03\u0B37\x03\u0B42\x03\u0B57\x03\u0B62\x03\u0B74" +
"\x03\u0B82\x03\u0B93\x03\u0C02\x03\u0C4A\x03\u0C82\x03\u0CB4\x03\u0CC2" +
"\x03\u0CF4\x03\u1002\x03\u1048\x03\u1068\x03\u1071\x03\u1081\x03\u10BC" +
"\x03\u10BF\x03\u10BF\x03\u10D2\x03\u10EA\x03\u10F2\x03\u10FB\x03\u1102" +
"\x03\u1136\x03\u1138\x03\u1141\x03\u1152\x03\u1175\x03\u1178\x03\u1178" +
"\x03\u1182\x03\u11C6\x03\u11CC\x03\u11CE\x03\u11D2\x03\u11DC\x03\u11DE" +
"\x03\u11DE\x03\u1202\x03\u1213\x03\u1215\x03\u1239\x03\u1240\x03\u1240" +
"\x03\u1282\x03\u1288\x03\u128A\x03\u128A\x03\u128C\x03\u128F\x03\u1291" +
"\x03\u129F\x03\u12A1\x03\u12AA\x03\u12B2\x03\u12EC\x03\u12F2\x03\u12FB" +
"\x03\u1302\x03\u1305\x03\u1307\x03\u130E\x03\u1311\x03\u1312\x03\u1315" +
"\x03\u132A\x03\u132C\x03\u1332\x03\u1334\x03\u1335\x03\u1337\x03\u133B" +
"\x03\u133E\x03\u1346\x03\u1349\x03\u134A\x03\u134D\x03\u134F\x03\u1352" +
"\x03\u1352\x03\u1359\x03\u1359\x03\u135F\x03\u1365\x03\u1368\x03\u136E" +
"\x03\u1372\x03\u1376\x03\u1402\x03\u144C\x03\u1452\x03\u145B\x03\u1482" +
"\x03\u14C7\x03\u14C9\x03\u14C9\x03\u14D2\x03\u14DB\x03\u1582\x03\u15B7" +
"\x03\u15BA\x03\u15C2\x03\u15DA\x03\u15DF\x03\u1602\x03\u1642\x03\u1646" +
"\x03\u1646\x03\u1652\x03\u165B\x03\u1682\x03\u16B9\x03\u16C2\x03\u16CB" +
"\x03\u1702\x03\u171B\x03\u171F\x03\u172D\x03\u1732\x03\u173B\x03\u18A2" +
"\x03\u18EB\x03\u1901\x03\u1901\x03\u1AC2\x03\u1AFA\x03\u1C02\x03\u1C0A" +
"\x03\u1C0C\x03\u1C38\x03\u1C3A\x03\u1C42\x03\u1C52\x03\u1C5B\x03\u1C74" +
"\x03\u1C91\x03\u1C94\x03\u1CA9\x03\u1CAB\x03\u1CB8\x03\u2002\x03\u239B" +
"\x03\u2402\x03\u2470\x03\u2482\x03\u2545\x03\u3002\x03\u3430\x03\u4402" +
"\x03\u4648\x03\u6802\x03\u6A3A\x03\u6A42\x03\u6A60\x03\u6A62\x03\u6A6B" +
"\x03\u6AD2\x03\u6AEF\x03\u6AF2\x03\u6AF6\x03\u6B02\x03\u6B38\x03\u6B42" +
"\x03\u6B45\x03\u6B52\x03\u6B5B\x03\u6B65\x03\u6B79\x03\u6B7F\x03\u6B91" +
"\x03\u6F02\x03\u6F46\x03\u6F52\x03\u6F80\x03\u6F91\x03\u6FA1\x03\u6FE2" +
"\x03\u6FE2\x03\u7002\x03\u87EE\x03\u8802\x03\u8AF4\x03\uB002\x03\uB003" +
"\x03\uBC02\x03\uBC6C\x03\uBC72\x03\uBC7E\x03\uBC82\x03\uBC8A\x03\uBC92" +
"\x03\uBC9B\x03\uBC9F\x03\uBCA0\x03\uBCA2\x03\uBCA5\x03\uD167\x03\uD16B" +
"\x03\uD16F\x03\uD184\x03\uD187\x03\uD18D\x03\uD1AC\x03\uD1AF\x03\uD244" +
"\x03\uD246\x03\uD402\x03\uD456\x03\uD458\x03\uD49E\x03\uD4A0\x03\uD4A1" +
"\x03\uD4A4\x03\uD4A4\x03\uD4A7\x03\uD4A8\x03\uD4AB\x03\uD4AE\x03\uD4B0" +
"\x03\uD4BB\x03\uD4BD\x03\uD4BD\x03\uD4BF\x03\uD4C5\x03\uD4C7\x03\uD507" +
"\x03\uD509\x03\uD50C\x03\uD50F\x03\uD516\x03\uD518\x03\uD51E\x03\uD520" +
"\x03\uD53B\x03\uD53D\x03\uD540\x03\uD542\x03\uD546\x03\uD548\x03\uD548" +
"\x03\uD54C\x03\uD552\x03\uD554\x03\uD6A7\x03\uD6AA\x03\uD6C2\x03\uD6C4" +
"\x03\uD6DC\x03\uD6DE\x03\uD6FC\x03\uD6FE\x03\uD716\x03\uD718\x03\uD736" +
"\x03\uD738\x03\uD750\x03\uD752\x03\uD770\x03\uD772\x03\uD78A\x03\uD78C" +
"\x03\uD7AA\x03\uD7AC\x03\uD7C4\x03\uD7C6\x03\uD7CD\x03\uD7D0\x03\uD801" +
"\x03\uDA02\x03\uDA38\x03\uDA3D\x03\uDA6E\x03\uDA77\x03\uDA77\x03\uDA86" +
"\x03\uDA86\x03\uDA9D\x03\uDAA1\x03\uDAA3\x03\uDAB1\x03\uE002\x03\uE008" +
"\x03\uE00A\x03\uE01A\x03\uE01D\x03\uE023\x03\uE025\x03\uE026\x03\uE028" +
"\x03\uE02C\x03\uE802\x03\uE8C6\x03\uE8D2\x03\uE8D8\x03\uE902\x03\uE94C" +
"\x03\uE952\x03\uE95B\x03\uEE02\x03\uEE05\x03\uEE07\x03\uEE21\x03\uEE23" +
"\x03\uEE24\x03\uEE26\x03\uEE26\x03\uEE29\x03\uEE29\x03\uEE2B\x03\uEE34" +
"\x03\uEE36\x03\uEE39\x03\uEE3B\x03\uEE3B\x03\uEE3D\x03\uEE3D\x03\uEE44" +
"\x03\uEE44\x03\uEE49\x03\uEE49\x03\uEE4B\x03\uEE4B\x03\uEE4D\x03\uEE4D" +
"\x03\uEE4F\x03\uEE51\x03\uEE53\x03\uEE54\x03\uEE56\x03\uEE56\x03\uEE59" +
"\x03\uEE59\x03\uEE5B\x03\uEE5B\x03\uEE5D\x03\uEE5D\x03\uEE5F\x03\uEE5F" +
"\x03\uEE61\x03\uEE61\x03\uEE63\x03\uEE64\x03\uEE66\x03\uEE66\x03\uEE69" +
"\x03\uEE6C\x03\uEE6E\x03\uEE74\x03\uEE76\x03\uEE79\x03\uEE7B\x03\uEE7E" +
"\x03\uEE80\x03\uEE80\x03\uEE82\x03\uEE8B\x03\uEE8D\x03\uEE9D\x03\uEEA3" +
"\x03\uEEA5\x03\uEEA7\x03\uEEAB\x03\uEEAD\x03\uEEBD\x03\x02\x04\uA6D8\x04" +
"\uA702\x04\uB736\x04\uB742\x04\uB81F\x04\uB822\x04\uCEA3\x04\uF802\x04" +
"\uFA1F\x04\x03\x10\x03\x10\"\x10\x81\x10\u0102\x10\u01F1\x10\u0240\x02" +
"C\x02\\\x02c\x02|\x02\xAC\x02\xAC\x02\xB7\x02\xB7\x02\xBC\x02\xBC\x02" +
"\xC2\x02\xD8\x02\xDA\x02\xF8\x02\xFA\x02\u02C3\x02\u02C8\x02\u02D3\x02" +
"\u02E2\x02\u02E6\x02\u02EE\x02\u02EE\x02\u02F0\x02\u02F0\x02\u0372\x02" +
"\u0376\x02\u0378\x02\u0379\x02\u037C\x02\u037F\x02\u0381\x02\u0381\x02" +
"\u0388\x02\u0388\x02\u038A\x02\u038C\x02\u038E\x02\u038E\x02\u0390\x02" +
"\u03A3\x02\u03A5\x02\u03F7\x02\u03F9\x02\u0483\x02\u048C\x02\u0531\x02" +
"\u0533\x02\u0558\x02\u055B\x02\u055B\x02\u0563\x02\u0589\x02\u05D2\x02" +
"\u05EC\x02\u05F2\x02\u05F4\x02\u0622\x02\u064C\x02\u0670\x02\u0671\x02" +
"\u0673\x02\u06D5\x02\u06D7\x02\u06D7\x02\u06E7\x02\u06E8\x02\u06F0\x02" +
"\u06F1\x02\u06FC\x02\u06FE\x02\u0701\x02\u0701\x02\u0712\x02\u0712\x02" +
"\u0714\x02\u0731\x02\u074F\x02\u07A7\x02\u07B3\x02\u07B3\x02\u07CC\x02" +
"\u07EC\x02\u07F6\x02\u07F7\x02\u07FC\x02\u07FC\x02\u0802\x02\u0817\x02" +
"\u081C\x02\u081C\x02\u0826\x02\u0826\x02\u082A\x02\u082A\x02\u0842\x02" +
"\u085A\x02\u08A2\x02\u08B6\x02\u08B8\x02\u08BF\x02\u0906\x02\u093B\x02" +
"\u093F\x02\u093F\x02\u0952\x02\u0952\x02\u095A\x02\u0963\x02\u0973\x02" +
"\u0982\x02\u0987\x02\u098E\x02\u0991\x02\u0992\x02\u0995\x02\u09AA\x02" +
"\u09AC\x02\u09B2\x02\u09B4\x02\u09B4\x02\u09B8\x02\u09BB\x02\u09BF\x02" +
"\u09BF\x02\u09D0\x02\u09D0\x02\u09DE\x02\u09DF\x02\u09E1\x02\u09E3\x02" +
"\u09F2\x02\u09F3\x02\u0A07\x02\u0A0C\x02\u0A11\x02\u0A12\x02\u0A15\x02" +
"\u0A2A\x02\u0A2C\x02\u0A32\x02\u0A34\x02\u0A35\x02\u0A37\x02\u0A38\x02" +
"\u0A3A\x02\u0A3B\x02\u0A5B\x02\u0A5E\x02\u0A60\x02\u0A60\x02\u0A74\x02" +
"\u0A76\x02\u0A87\x02\u0A8F\x02\u0A91\x02\u0A93\x02\u0A95\x02\u0AAA\x02" +
"\u0AAC\x02\u0AB2\x02\u0AB4\x02\u0AB5\x02\u0AB7\x02\u0ABB\x02\u0ABF\x02" +
"\u0ABF\x02\u0AD2\x02\u0AD2\x02\u0AE2\x02\u0AE3\x02\u0AFB\x02\u0AFB\x02" +
"\u0B07\x02\u0B0E\x02\u0B11\x02\u0B12\x02\u0B15\x02\u0B2A\x02\u0B2C\x02" +
"\u0B32\x02\u0B34\x02\u0B35\x02\u0B37\x02\u0B3B\x02\u0B3F\x02\u0B3F\x02" +
"\u0B5E\x02\u0B5F\x02\u0B61\x02\u0B63\x02\u0B73\x02\u0B73\x02\u0B85\x02" +
"\u0B85\x02\u0B87\x02\u0B8C\x02\u0B90\x02\u0B92\x02\u0B94\x02\u0B97\x02" +
"\u0B9B\x02\u0B9C\x02\u0B9E\x02\u0B9E\x02\u0BA0\x02\u0BA1\x02\u0BA5\x02" +
"\u0BA6\x02\u0BAA\x02\u0BAC\x02\u0BB0\x02\u0BBB\x02\u0BD2\x02\u0BD2\x02" +
"\u0C07\x02\u0C0E\x02\u0C10\x02\u0C12\x02\u0C14\x02\u0C2A\x02\u0C2C\x02" +
"\u0C3B\x02\u0C3F\x02\u0C3F\x02\u0C5A\x02\u0C5C\x02\u0C62\x02\u0C63\x02" +
"\u0C82\x02\u0C82\x02\u0C87\x02\u0C8E\x02\u0C90\x02\u0C92\x02\u0C94\x02" +
"\u0CAA\x02\u0CAC\x02\u0CB5\x02\u0CB7\x02\u0CBB\x02\u0CBF\x02\u0CBF\x02" +
"\u0CE0\x02\u0CE0\x02\u0CE2\x02\u0CE3\x02\u0CF3\x02\u0CF4\x02\u0D07\x02" +
"\u0D0E\x02\u0D10\x02\u0D12\x02\u0D14\x02\u0D3C\x02\u0D3F\x02\u0D3F\x02" +
"\u0D50\x02\u0D50\x02\u0D56\x02\u0D58\x02\u0D61\x02\u0D63\x02\u0D7C\x02" +
"\u0D81\x02\u0D87\x02\u0D98\x02\u0D9C\x02\u0DB3\x02\u0DB5\x02\u0DBD\x02" +
"\u0DBF\x02\u0DBF\x02\u0DC2\x02\u0DC8\x02\u0E03\x02\u0E32\x02\u0E34\x02" +
"\u0E35\x02\u0E42\x02\u0E48\x02\u0E83\x02\u0E84\x02\u0E86\x02\u0E86\x02" +
"\u0E89\x02\u0E8A\x02\u0E8C\x02\u0E8C\x02\u0E8F\x02\u0E8F\x02\u0E96\x02" +
"\u0E99\x02\u0E9B\x02\u0EA1\x02\u0EA3\x02\u0EA5\x02\u0EA7\x02\u0EA7\x02" +
"\u0EA9\x02\u0EA9\x02\u0EAC\x02\u0EAD\x02\u0EAF\x02\u0EB2\x02\u0EB4\x02" +
"\u0EB5\x02\u0EBF\x02\u0EBF\x02\u0EC2\x02\u0EC6\x02\u0EC8\x02\u0EC8\x02" +
"\u0EDE\x02\u0EE1\x02\u0F02\x02\u0F02\x02\u0F42\x02\u0F49\x02\u0F4B\x02" +
"\u0F6E\x02\u0F8A\x02\u0F8E\x02\u1002\x02\u102C\x02\u1041\x02\u1041\x02" +
"\u1052\x02\u1057\x02\u105C\x02\u105F\x02\u1063\x02\u1063\x02\u1067\x02" +
"\u1068\x02\u1070\x02\u1072\x02\u1077\x02\u1083\x02\u1090\x02\u1090\x02" +
"\u10A2\x02\u10C7\x02\u10C9\x02\u10C9\x02\u10CF\x02\u10CF\x02\u10D2\x02" +
"\u10FC\x02\u10FE\x02\u124A\x02\u124C\x02\u124F\x02\u1252\x02\u1258\x02" +
"\u125A\x02\u125A\x02\u125C\x02\u125F\x02\u1262\x02\u128A\x02\u128C\x02" +
"\u128F\x02\u1292\x02\u12B2\x02\u12B4\x02\u12B7\x02\u12BA\x02\u12C0\x02" +
"\u12C2\x02\u12C2\x02\u12C4\x02\u12C7\x02\u12CA\x02\u12D8\x02\u12DA\x02" +
"\u1312\x02\u1314\x02\u1317\x02\u131A\x02\u135C\x02\u1382\x02\u1391\x02" +
"\u13A2\x02\u13F7\x02\u13FA\x02\u13FF\x02\u1403\x02\u166E\x02\u1671\x02" +
"\u1681\x02\u1683\x02\u169C\x02\u16A2\x02\u16EC\x02\u16F0\x02\u16FA\x02" +
"\u1702\x02\u170E\x02\u1710\x02\u1713\x02\u1722\x02\u1733\x02\u1742\x02" +
"\u1753\x02\u1762\x02\u176E\x02\u1770\x02\u1772\x02\u1782\x02\u17B5\x02" +
"\u17D9\x02\u17D9\x02\u17DE\x02\u17DE\x02\u1822\x02\u1879\x02\u1882\x02" +
"\u1886\x02\u1889\x02\u18AA\x02\u18AC\x02\u18AC\x02\u18B2\x02\u18F7\x02" +
"\u1902\x02\u1920\x02\u1952\x02\u196F\x02\u1972\x02\u1976\x02\u1982\x02" +
"\u19AD\x02\u19B2\x02\u19CB\x02\u1A02\x02\u1A18\x02\u1A22\x02\u1A56\x02" +
"\u1AA9\x02\u1AA9\x02\u1B07\x02\u1B35\x02\u1B47\x02\u1B4D\x02\u1B85\x02" +
"\u1BA2\x02\u1BB0\x02\u1BB1\x02\u1BBC\x02\u1BE7\x02\u1C02\x02\u1C25\x02" +
"\u1C4F\x02\u1C51\x02\u1C5C\x02\u1C7F\x02\u1C82\x02\u1C8A\x02\u1CEB\x02" +
"\u1CEE\x02\u1CF0\x02\u1CF3\x02\u1CF7\x02\u1CF8\x02\u1D02\x02\u1DC1\x02" +
"\u1E02\x02\u1F17\x02\u1F1A\x02\u1F1F\x02\u1F22\x02\u1F47\x02\u1F4A\x02" +
"\u1F4F\x02\u1F52\x02\u1F59\x02\u1F5B\x02\u1F5B\x02\u1F5D\x02\u1F5D\x02" +
"\u1F5F\x02\u1F5F\x02\u1F61\x02\u1F7F\x02\u1F82\x02\u1FB6\x02\u1FB8\x02" +
"\u1FBE\x02\u1FC0\x02\u1FC0\x02\u1FC4\x02\u1FC6\x02\u1FC8\x02\u1FCE\x02" +
"\u1FD2\x02\u1FD5\x02\u1FD8\x02\u1FDD\x02\u1FE2\x02\u1FEE\x02\u1FF4\x02" +
"\u1FF6\x02\u1FF8\x02\u1FFE\x02\u2073\x02\u2073\x02\u2081\x02\u2081\x02" +
"\u2092\x02\u209E\x02\u2104\x02\u2104\x02\u2109\x02\u2109\x02\u210C\x02" +
"\u2115\x02\u2117\x02\u2117\x02\u211B\x02\u211F\x02\u2126\x02\u2126\x02" +
"\u2128\x02\u2128\x02\u212A\x02\u212A\x02\u212C\x02\u212F\x02\u2131\x02" +
"\u213B\x02\u213E\x02\u2141\x02\u2147\x02\u214B\x02\u2150\x02\u2150\x02" +
"\u2162\x02\u218A\x02\u2C02\x02\u2C30\x02\u2C32\x02\u2C60\x02\u2C62\x02" +
"\u2CE6\x02\u2CED\x02\u2CF0\x02\u2CF4\x02\u2CF5\x02\u2D02\x02\u2D27\x02" +
"\u2D29\x02\u2D29\x02\u2D2F\x02\u2D2F\x02\u2D32\x02\u2D69\x02\u2D71\x02" +
"\u2D71\x02\u2D82\x02\u2D98\x02\u2DA2\x02\u2DA8\x02\u2DAA\x02\u2DB0\x02" +
"\u2DB2\x02\u2DB8\x02\u2DBA\x02\u2DC0\x02\u2DC2\x02\u2DC8\x02\u2DCA\x02" +
"\u2DD0\x02\u2DD2\x02\u2DD8\x02\u2DDA\x02\u2DE0\x02\u2E31\x02\u2E31\x02" +
"\u3007\x02\u3009\x02\u3023\x02\u302B\x02\u3033\x02\u3037\x02\u303A\x02" +
"\u303E\x02\u3043\x02\u3098\x02\u309F\x02\u30A1\x02\u30A3\x02\u30FC\x02" +
"\u30FE\x02\u3101\x02\u3107\x02\u312F\x02\u3133\x02\u3190\x02\u31A2\x02" +
"\u31BC\x02\u31F2\x02\u3201\x02\u3402\x02\u4DB7\x02\u4E02\x02\u9FD7\x02" +
"\uA002\x02\uA48E\x02\uA4D2\x02\uA4FF\x02\uA502\x02\uA60E\x02\uA612\x02" +
"\uA621\x02\uA62C\x02\uA62D\x02\uA642\x02\uA670\x02\uA681\x02\uA69F\x02" +
"\uA6A2\x02\uA6F1\x02\uA719\x02\uA721\x02\uA724\x02\uA78A\x02\uA78D\x02" +
"\uA7B0\x02\uA7B2\x02\uA7B9\x02\uA7F9\x02\uA803\x02\uA805\x02\uA807\x02" +
"\uA809\x02\uA80C\x02\uA80E\x02\uA824\x02\uA842\x02\uA875\x02\uA884\x02" +
"\uA8B5\x02\uA8F4\x02\uA8F9\x02\uA8FD\x02\uA8FD\x02\uA8FF\x02\uA8FF\x02" +
"\uA90C\x02\uA927\x02\uA932\x02\uA948\x02\uA962\x02\uA97E\x02\uA986\x02" +
"\uA9B4\x02\uA9D1\x02\uA9D1\x02\uA9E2\x02\uA9E6\x02\uA9E8\x02\uA9F1\x02" +
"\uA9FC\x02\uAA00\x02\uAA02\x02\uAA2A\x02\uAA42\x02\uAA44\x02\uAA46\x02" +
"\uAA4D\x02\uAA62\x02\uAA78\x02\uAA7C\x02\uAA7C\x02\uAA80\x02\uAAB1\x02" +
"\uAAB3\x02\uAAB3\x02\uAAB7\x02\uAAB8\x02\uAABB\x02\uAABF\x02\uAAC2\x02" +
"\uAAC2\x02\uAAC4\x02\uAAC4\x02\uAADD\x02\uAADF\x02\uAAE2\x02\uAAEC\x02" +
"\uAAF4\x02\uAAF6\x02\uAB03\x02\uAB08\x02\uAB0B\x02\uAB10\x02\uAB13\x02" +
"\uAB18\x02\uAB22\x02\uAB28\x02\uAB2A\x02\uAB30\x02\uAB32\x02\uAB5C\x02" +
"\uAB5E\x02\uAB67\x02\uAB72\x02\uABE4\x02\uAC02\x02\uD7A5\x02\uD7B2\x02" +
"\uD7C8\x02\uD7CD\x02\uD7FD\x02\uF902\x02\uFA6F\x02\uFA72\x02\uFADB\x02" +
"\uFB02\x02\uFB08\x02\uFB15\x02\uFB19\x02\uFB1F\x02\uFB1F\x02\uFB21\x02" +
"\uFB2A\x02\uFB2C\x02\uFB38\x02\uFB3A\x02\uFB3E\x02\uFB40\x02\uFB40\x02" +
"\uFB42\x02\uFB43\x02\uFB45\x02\uFB46\x02\uFB48\x02\uFBB3\x02\uFBD5\x02" +
"\uFD3F\x02\uFD52\x02\uFD91\x02\uFD94\x02\uFDC9\x02\uFDF2\x02\uFDFD\x02" +
"\uFE72\x02\uFE76\x02\uFE78\x02\uFEFE\x02\uFF23\x02\uFF3C\x02\uFF43\x02" +
"\uFF5C\x02\uFF68\x02\uFFC0\x02\uFFC4\x02\uFFC9\x02\uFFCC\x02\uFFD1\x02" +
"\uFFD4\x02\uFFD9\x02\uFFDC\x02\uFFDE\x02\x02\x03\r\x03\x0F\x03(\x03*\x03" +
"<\x03>\x03?\x03A\x03O\x03R\x03_\x03\x82\x03\xFC\x03\u0142\x03\u0176\x03" +
"\u0282\x03\u029E\x03\u02A2\x03\u02D2\x03\u0302\x03\u0321\x03\u0332\x03" +
"\u034C\x03\u0352\x03\u0377\x03\u0382\x03\u039F\x03\u03A2\x03\u03C5\x03" +
"\u03CA\x03\u03D1\x03\u03D3\x03\u03D7\x03\u0402\x03\u049F\x03\u04B2\x03" +
"\u04D5\x03\u04DA\x03\u04FD\x03\u0502\x03\u0529\x03\u0532\x03\u0565\x03" +
"\u0602\x03\u0738\x03\u0742\x03\u0757\x03\u0762\x03\u0769\x03\u0802\x03" +
"\u0807\x03\u080A\x03\u080A\x03\u080C\x03\u0837\x03\u0839\x03\u083A\x03" +
"\u083E\x03\u083E\x03\u0841\x03\u0857\x03\u0862\x03\u0878\x03\u0882\x03" +
"\u08A0\x03\u08E2\x03\u08F4\x03\u08F6\x03\u08F7\x03\u0902\x03\u0917\x03" +
"\u0922\x03\u093B\x03\u0982\x03\u09B9\x03\u09C0\x03\u09C1\x03\u0A02\x03" +
"\u0A02\x03\u0A12\x03\u0A15\x03\u0A17\x03\u0A19\x03\u0A1B\x03\u0A35\x03" +
"\u0A62\x03\u0A7E\x03\u0A82\x03\u0A9E\x03\u0AC2\x03\u0AC9\x03\u0ACB\x03" +
"\u0AE6\x03\u0B02\x03\u0B37\x03\u0B42\x03\u0B57\x03\u0B62\x03\u0B74\x03" +
"\u0B82\x03\u0B93\x03\u0C02\x03\u0C4A\x03\u0C82\x03\u0CB4\x03\u0CC2\x03" +
"\u0CF4\x03\u1005\x03\u1039\x03\u1085\x03\u10B1\x03\u10D2\x03\u10EA\x03" +
"\u1105\x03\u1128\x03\u1152\x03\u1174\x03\u1178\x03\u1178\x03\u1185\x03" +
"\u11B4\x03\u11C3\x03\u11C6\x03\u11DC\x03\u11DC\x03\u11DE\x03\u11DE\x03" +
"\u1202\x03\u1213\x03\u1215\x03\u122D\x03\u1282\x03\u1288\x03\u128A\x03" +
"\u128A\x03\u128C\x03\u128F\x03\u1291\x03\u129F\x03\u12A1\x03\u12AA\x03" +
"\u12B2\x03\u12E0\x03\u1307\x03\u130E\x03\u1311\x03\u1312\x03\u1315\x03" +
"\u132A\x03\u132C\x03\u1332\x03\u1334\x03\u1335\x03\u1337\x03\u133B\x03" +
"\u133F\x03\u133F\x03\u1352\x03\u1352\x03\u135F\x03\u1363\x03\u1402\x03" +
"\u1436\x03\u1449\x03\u144C\x03\u1482\x03\u14B1\x03\u14C6\x03\u14C7\x03" +
"\u14C9\x03\u14C9\x03\u1582\x03\u15B0\x03\u15DA\x03\u15DD\x03\u1602\x03" +
"\u1631\x03\u1646\x03\u1646\x03\u1682\x03\u16AC\x03\u1702\x03\u171B\x03" +
"\u18A2\x03\u18E1\x03\u1901\x03\u1901\x03\u1AC2\x03\u1AFA\x03\u1C02\x03" +
"\u1C0A\x03\u1C0C\x03\u1C30\x03\u1C42\x03\u1C42\x03\u1C74\x03\u1C91\x03" +
"\u2002\x03\u239B\x03\u2402\x03\u2470\x03\u2482\x03\u2545\x03\u3002\x03" +
"\u3430\x03\u4402\x03\u4648\x03\u6802\x03\u6A3A\x03\u6A42\x03\u6A60\x03" +
"\u6AD2\x03\u6AEF\x03\u6B02\x03\u6B31\x03\u6B42\x03\u6B45\x03\u6B65\x03" +
"\u6B79\x03\u6B7F\x03\u6B91\x03\u6F02\x03\u6F46\x03\u6F52\x03\u6F52\x03" +
"\u6F95\x03\u6FA1\x03\u6FE2\x03\u6FE2\x03\u7002\x03\u87EE\x03\u8802\x03" +
"\u8AF4\x03\uB002\x03\uB003\x03\uBC02\x03\uBC6C\x03\uBC72\x03\uBC7E\x03" +
"\uBC82\x03\uBC8A\x03\uBC92\x03\uBC9B\x03\uD402\x03\uD456\x03\uD458\x03" +
"\uD49E\x03\uD4A0\x03\uD4A1\x03\uD4A4\x03\uD4A4\x03\uD4A7\x03\uD4A8\x03" +
"\uD4AB\x03\uD4AE\x03\uD4B0\x03\uD4BB\x03\uD4BD\x03\uD4BD\x03\uD4BF\x03" +
"\uD4C5\x03\uD4C7\x03\uD507\x03\uD509\x03\uD50C\x03\uD50F\x03\uD516\x03" +
"\uD518\x03\uD51E\x03\uD520\x03\uD53B\x03\uD53D\x03\uD540\x03\uD542\x03" +
"\uD546\x03\uD548\x03\uD548";
XPathLexer._serializedATNSegment1 = "\x03\uD54C\x03\uD552\x03\uD554\x03\uD6A7\x03\uD6AA\x03\uD6C2\x03\uD6C4" +
"\x03\uD6DC\x03\uD6DE\x03\uD6FC\x03\uD6FE\x03\uD716\x03\uD718\x03\uD736" +
"\x03\uD738\x03\uD750\x03\uD752\x03\uD770\x03\uD772\x03\uD78A\x03\uD78C" +
"\x03\uD7AA\x03\uD7AC\x03\uD7C4\x03\uD7C6\x03\uD7CD\x03\uE802\x03\uE8C6" +
"\x03\uE902\x03\uE945\x03\uEE02\x03\uEE05\x03\uEE07\x03\uEE21\x03\uEE23" +
"\x03\uEE24\x03\uEE26\x03\uEE26\x03\uEE29\x03\uEE29\x03\uEE2B\x03\uEE34" +
"\x03\uEE36\x03\uEE39\x03\uEE3B\x03\uEE3B\x03\uEE3D\x03\uEE3D\x03\uEE44" +
"\x03\uEE44\x03\uEE49\x03\uEE49\x03\uEE4B\x03\uEE4B\x03\uEE4D\x03\uEE4D" +
"\x03\uEE4F\x03\uEE51\x03\uEE53\x03\uEE54\x03\uEE56\x03\uEE56\x03\uEE59" +
"\x03\uEE59\x03\uEE5B\x03\uEE5B\x03\uEE5D\x03\uEE5D\x03\uEE5F\x03\uEE5F" +
"\x03\uEE61\x03\uEE61\x03\uEE63\x03\uEE64\x03\uEE66\x03\uEE66\x03\uEE69" +
"\x03\uEE6C\x03\uEE6E\x03\uEE74\x03\uEE76\x03\uEE79\x03\uEE7B\x03\uEE7E" +
"\x03\uEE80\x03\uEE80\x03\uEE82\x03\uEE8B\x03\uEE8D\x03\uEE9D\x03\uEEA3" +
"\x03\uEEA5\x03\uEEA7\x03\uEEAB\x03\uEEAD\x03\uEEBD\x03\x02\x04\uA6D8\x04" +
"\uA702\x04\uB736\x04\uB742\x04\uB81F\x04\uB822\x04\uCEA3\x04\uF802\x04" +
"\uFA1F\x041\x02\x03\x03\x02\x02\x02\x02\x05\x03\x02\x02\x02\x02\x07\x03" +
"\x02\x02\x02\x02\t\x03\x02\x02\x02\x02\v\x03\x02\x02\x02\x02\x11\x03\x02" +
"\x02\x02\x03\x13\x03\x02\x02\x02\x05\x16\x03\x02\x02\x02\x07\x18\x03\x02" +
"\x02\x02\t\x1A\x03\x02\x02\x02\v\x1C\x03\x02\x02\x02\r%\x03\x02\x02\x02" +
"\x0F\'\x03\x02\x02\x02\x11)\x03\x02\x02\x02\x13\x14\x071\x02\x02\x14\x15" +
"\x071\x02\x02\x15\x04\x03\x02\x02\x02\x16\x17\x071\x02\x02\x17\x06\x03" +
"\x02\x02\x02\x18\x19\x07,\x02\x02\x19\b\x03\x02\x02\x02\x1A\x1B\x07#\x02" +
"\x02\x1B\n\x03\x02\x02\x02\x1C \x05\x0F\b\x02\x1D\x1F\x05\r\x07\x02\x1E" +
"\x1D\x03\x02\x02\x02\x1F\"\x03\x02\x02\x02 \x1E\x03\x02\x02\x02 !\x03" +
"\x02\x02\x02!#\x03\x02\x02\x02\" \x03\x02\x02\x02#$\b\x06\x02\x02$\f\x03" +
"\x02\x02\x02%&\t\x02\x02\x02&\x0E\x03\x02\x02\x02\'(\t\x03\x02\x02(\x10" +
"\x03\x02\x02\x02)-\x07)\x02\x02*,\v\x02\x02\x02+*\x03\x02\x02\x02,/\x03" +
"\x02\x02\x02-.\x03\x02\x02\x02-+\x03\x02\x02\x02.0\x03\x02\x02\x02/-\x03" +
"\x02\x02\x0201\x07)\x02\x021\x12\x03\x02\x02\x02\x05\x02 -\x03\x03\x06" +
"\x02";
XPathLexer._serializedATN = Utils.join([
XPathLexer._serializedATNSegment0,
XPathLexer._serializedATNSegment1,
], "");
//# sourceMappingURL=XPathLexer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ANTLRErrorListener } from "../../ANTLRErrorListener";
import { Recognizer } from "../../Recognizer";
import { RecognitionException } from "../../RecognitionException";
export declare class XPathLexerErrorListener implements ANTLRErrorListener<number> {
syntaxError<T extends number>(recognizer: Recognizer<T, any>, offendingSymbol: T | undefined, line: number, charPositionInLine: number, msg: string, e: RecognitionException | undefined): void;
}

View File

@@ -0,0 +1,24 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathLexerErrorListener = void 0;
const Decorators_1 = require("../../Decorators");
class XPathLexerErrorListener {
syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
// intentionally empty
}
}
__decorate([
Decorators_1.Override
], XPathLexerErrorListener.prototype, "syntaxError", null);
exports.XPathLexerErrorListener = XPathLexerErrorListener;
//# sourceMappingURL=XPathLexerErrorListener.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathLexerErrorListener.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathLexerErrorListener.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAKH,iDAA4C;AAI5C,MAAa,uBAAuB;IAE5B,WAAW,CACjB,UAA8B,EAAE,eAA8B,EAC9D,IAAY,EAAE,kBAA0B,EAAE,GAAW,EACrD,CAAmC;QACnC,sBAAsB;IACvB,CAAC;CACD;AANA;IADC,qBAAQ;0DAMR;AAPF,0DAQC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\n\r\nimport { ANTLRErrorListener } from \"../../ANTLRErrorListener\";\r\nimport { Override } from \"../../Decorators\";\r\nimport { Recognizer } from \"../../Recognizer\";\r\nimport { RecognitionException } from \"../../RecognitionException\";\r\n\r\nexport class XPathLexerErrorListener implements ANTLRErrorListener<number> {\r\n\t@Override\r\n\tpublic syntaxError<T extends number>(\r\n\t\trecognizer: Recognizer<T, any>, offendingSymbol: T | undefined,\r\n\t\tline: number, charPositionInLine: number, msg: string,\r\n\t\te: RecognitionException | undefined): void {\r\n\t\t// intentionally empty\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,14 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
import { XPathElement } from "./XPathElement";
/**
* Either `ID` at start of path or `...//ID` in middle of path.
*/
export declare class XPathRuleAnywhereElement extends XPathElement {
protected ruleIndex: number;
constructor(ruleName: string, ruleIndex: number);
evaluate(t: ParseTree): ParseTree[];
}

View File

@@ -0,0 +1,33 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathRuleAnywhereElement = void 0;
const Decorators_1 = require("../../Decorators");
const Trees_1 = require("../Trees");
const XPathElement_1 = require("./XPathElement");
/**
* Either `ID` at start of path or `...//ID` in middle of path.
*/
class XPathRuleAnywhereElement extends XPathElement_1.XPathElement {
constructor(ruleName, ruleIndex) {
super(ruleName);
this.ruleIndex = ruleIndex;
}
evaluate(t) {
return Trees_1.Trees.findAllRuleNodes(t, this.ruleIndex);
}
}
__decorate([
Decorators_1.Override
], XPathRuleAnywhereElement.prototype, "evaluate", null);
exports.XPathRuleAnywhereElement = XPathRuleAnywhereElement;
//# sourceMappingURL=XPathRuleAnywhereElement.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathRuleAnywhereElement.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathRuleAnywhereElement.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAIH,iDAA4C;AAE5C,oCAAiC;AACjC,iDAA8C;AAE9C;;GAEG;AACH,MAAa,wBAAyB,SAAQ,2BAAY;IAEzD,YAAY,QAAgB,EAAE,SAAiB;QAC9C,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAGM,QAAQ,CAAC,CAAY;QAC3B,OAAO,aAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACD;AAHA;IADC,qBAAQ;wDAGR;AAVF,4DAWC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\nimport { ParserRuleContext } from \"../../ParserRuleContext\";\r\nimport { Override } from \"../../Decorators\";\r\nimport { ParseTree } from \"../ParseTree\";\r\nimport { Trees } from \"../Trees\";\r\nimport { XPathElement } from \"./XPathElement\";\r\n\r\n/**\r\n * Either `ID` at start of path or `...//ID` in middle of path.\r\n */\r\nexport class XPathRuleAnywhereElement extends XPathElement {\r\n\tprotected ruleIndex: number;\r\n\tconstructor(ruleName: string, ruleIndex: number) {\r\n\t\tsuper(ruleName);\r\n\t\tthis.ruleIndex = ruleIndex;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic evaluate(t: ParseTree): ParseTree[] {\r\n\t\treturn Trees.findAllRuleNodes(t, this.ruleIndex);\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,11 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
import { XPathElement } from "./XPathElement";
export declare class XPathRuleElement extends XPathElement {
protected ruleIndex: number;
constructor(ruleName: string, ruleIndex: number);
evaluate(t: ParseTree): ParseTree[];
}

View File

@@ -0,0 +1,42 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathRuleElement = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const ParserRuleContext_1 = require("../../ParserRuleContext");
const Decorators_1 = require("../../Decorators");
const Trees_1 = require("../Trees");
const XPathElement_1 = require("./XPathElement");
class XPathRuleElement extends XPathElement_1.XPathElement {
constructor(ruleName, ruleIndex) {
super(ruleName);
this.ruleIndex = ruleIndex;
}
evaluate(t) {
// return all children of t that match nodeName
let nodes = [];
for (let c of Trees_1.Trees.getChildren(t)) {
if (c instanceof ParserRuleContext_1.ParserRuleContext) {
if ((c.ruleIndex === this.ruleIndex && !this.invert) ||
(c.ruleIndex !== this.ruleIndex && this.invert)) {
nodes.push(c);
}
}
}
return nodes;
}
}
__decorate([
Decorators_1.Override
], XPathRuleElement.prototype, "evaluate", null);
exports.XPathRuleElement = XPathRuleElement;
//# sourceMappingURL=XPathRuleElement.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathRuleElement.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathRuleElement.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+CAA+C;AAC/C,+DAA4D;AAC5D,iDAA4C;AAE5C,oCAAiC;AACjC,iDAA8C;AAE9C,MAAa,gBAAiB,SAAQ,2BAAY;IAEjD,YAAY,QAAgB,EAAE,SAAiB;QAC9C,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAGM,QAAQ,CAAC,CAAY;QAC3B,+CAA+C;QAC/C,IAAI,KAAK,GAAgB,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,IAAI,aAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;YACnC,IAAI,CAAC,YAAY,qCAAiB,EAAE;gBACnC,IAAI,CAAC,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;oBACnD,CAAC,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;oBACjD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACd;aACD;SACD;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAbA;IADC,qBAAQ;gDAaR;AApBF,4CAqBC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\nimport { ParserRuleContext } from \"../../ParserRuleContext\";\r\nimport { Override } from \"../../Decorators\";\r\nimport { ParseTree } from \"../ParseTree\";\r\nimport { Trees } from \"../Trees\";\r\nimport { XPathElement } from \"./XPathElement\";\r\n\r\nexport class XPathRuleElement extends XPathElement {\r\n\tprotected ruleIndex: number;\r\n\tconstructor(ruleName: string, ruleIndex: number) {\r\n\t\tsuper(ruleName);\r\n\t\tthis.ruleIndex = ruleIndex;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic evaluate(t: ParseTree): ParseTree[] {\r\n\t\t// return all children of t that match nodeName\r\n\t\tlet nodes: ParseTree[] = [];\r\n\t\tfor (let c of Trees.getChildren(t)) {\r\n\t\t\tif (c instanceof ParserRuleContext) {\r\n\t\t\t\tif ((c.ruleIndex === this.ruleIndex && !this.invert) ||\r\n\t\t\t\t\t(c.ruleIndex !== this.ruleIndex && this.invert)) {\r\n\t\t\t\t\tnodes.push(c);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn nodes;\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,11 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
import { XPathElement } from "./XPathElement";
export declare class XPathTokenAnywhereElement extends XPathElement {
protected tokenType: number;
constructor(tokenName: string, tokenType: number);
evaluate(t: ParseTree): ParseTree[];
}

View File

@@ -0,0 +1,31 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathTokenAnywhereElement = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const Decorators_1 = require("../../Decorators");
const Trees_1 = require("../Trees");
const XPathElement_1 = require("./XPathElement");
class XPathTokenAnywhereElement extends XPathElement_1.XPathElement {
constructor(tokenName, tokenType) {
super(tokenName);
this.tokenType = tokenType;
}
evaluate(t) {
return Trees_1.Trees.findAllTokenNodes(t, this.tokenType);
}
}
__decorate([
Decorators_1.Override
], XPathTokenAnywhereElement.prototype, "evaluate", null);
exports.XPathTokenAnywhereElement = XPathTokenAnywhereElement;
//# sourceMappingURL=XPathTokenAnywhereElement.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathTokenAnywhereElement.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathTokenAnywhereElement.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+CAA+C;AAC/C,iDAA4C;AAE5C,oCAAiC;AACjC,iDAA8C;AAE9C,MAAa,yBAA0B,SAAQ,2BAAY;IAE1D,YAAY,SAAiB,EAAE,SAAiB;QAC/C,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAGM,QAAQ,CAAC,CAAY;QAC3B,OAAO,aAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACD;AAHA;IADC,qBAAQ;yDAGR;AAVF,8DAWC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\nimport { Override } from \"../../Decorators\";\r\nimport { ParseTree } from \"../ParseTree\";\r\nimport { Trees } from \"../Trees\";\r\nimport { XPathElement } from \"./XPathElement\";\r\n\r\nexport class XPathTokenAnywhereElement extends XPathElement {\r\n\tprotected tokenType: number;\r\n\tconstructor(tokenName: string, tokenType: number) {\r\n\t\tsuper(tokenName);\r\n\t\tthis.tokenType = tokenType;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic evaluate(t: ParseTree): ParseTree[] {\r\n\t\treturn Trees.findAllTokenNodes(t, this.tokenType);\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,11 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
import { XPathElement } from "./XPathElement";
export declare class XPathTokenElement extends XPathElement {
protected tokenType: number;
constructor(tokenName: string, tokenType: number);
evaluate(t: ParseTree): ParseTree[];
}

View File

@@ -0,0 +1,42 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathTokenElement = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const Decorators_1 = require("../../Decorators");
const TerminalNode_1 = require("../TerminalNode");
const Trees_1 = require("../Trees");
const XPathElement_1 = require("./XPathElement");
class XPathTokenElement extends XPathElement_1.XPathElement {
constructor(tokenName, tokenType) {
super(tokenName);
this.tokenType = tokenType;
}
evaluate(t) {
// return all children of t that match nodeName
let nodes = [];
for (let c of Trees_1.Trees.getChildren(t)) {
if (c instanceof TerminalNode_1.TerminalNode) {
if ((c.symbol.type === this.tokenType && !this.invert) ||
(c.symbol.type !== this.tokenType && this.invert)) {
nodes.push(c);
}
}
}
return nodes;
}
}
__decorate([
Decorators_1.Override
], XPathTokenElement.prototype, "evaluate", null);
exports.XPathTokenElement = XPathTokenElement;
//# sourceMappingURL=XPathTokenElement.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathTokenElement.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathTokenElement.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+CAA+C;AAC/C,iDAA4C;AAE5C,kDAA+C;AAC/C,oCAAiC;AACjC,iDAA8C;AAE9C,MAAa,iBAAkB,SAAQ,2BAAY;IAElD,YAAY,SAAiB,EAAE,SAAiB;QAC/C,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAGM,QAAQ,CAAC,CAAY;QAC3B,+CAA+C;QAC/C,IAAI,KAAK,GAAgB,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,IAAI,aAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;YACnC,IAAI,CAAC,YAAY,2BAAY,EAAE;gBAC9B,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;oBACrD,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;oBACnD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACd;aACD;SACD;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAbA;IADC,qBAAQ;iDAaR;AApBF,8CAqBC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\nimport { Override } from \"../../Decorators\";\r\nimport { ParseTree } from \"../ParseTree\";\r\nimport { TerminalNode } from \"../TerminalNode\";\r\nimport { Trees } from \"../Trees\";\r\nimport { XPathElement } from \"./XPathElement\";\r\n\r\nexport class XPathTokenElement extends XPathElement {\r\n\tprotected tokenType: number;\r\n\tconstructor(tokenName: string, tokenType: number) {\r\n\t\tsuper(tokenName);\r\n\t\tthis.tokenType = tokenType;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic evaluate(t: ParseTree): ParseTree[] {\r\n\t\t// return all children of t that match nodeName\r\n\t\tlet nodes: ParseTree[] = [];\r\n\t\tfor (let c of Trees.getChildren(t)) {\r\n\t\t\tif (c instanceof TerminalNode) {\r\n\t\t\t\tif ((c.symbol.type === this.tokenType && !this.invert) ||\r\n\t\t\t\t\t(c.symbol.type !== this.tokenType && this.invert)) {\r\n\t\t\t\t\tnodes.push(c);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn nodes;\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,10 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
import { XPathElement } from "./XPathElement";
export declare class XPathWildcardAnywhereElement extends XPathElement {
constructor();
evaluate(t: ParseTree): ParseTree[];
}

View File

@@ -0,0 +1,35 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathWildcardAnywhereElement = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const Decorators_1 = require("../../Decorators");
const Trees_1 = require("../Trees");
const XPath_1 = require("./XPath");
const XPathElement_1 = require("./XPathElement");
class XPathWildcardAnywhereElement extends XPathElement_1.XPathElement {
constructor() {
super(XPath_1.XPath.WILDCARD);
}
evaluate(t) {
if (this.invert) {
// !* is weird but valid (empty)
return [];
}
return Trees_1.Trees.getDescendants(t);
}
}
__decorate([
Decorators_1.Override
], XPathWildcardAnywhereElement.prototype, "evaluate", null);
exports.XPathWildcardAnywhereElement = XPathWildcardAnywhereElement;
//# sourceMappingURL=XPathWildcardAnywhereElement.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathWildcardAnywhereElement.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathWildcardAnywhereElement.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+CAA+C;AAC/C,iDAA4C;AAG5C,oCAAiC;AACjC,mCAAgC;AAChC,iDAA8C;AAE9C,MAAa,4BAA6B,SAAQ,2BAAY;IAC7D;QACC,KAAK,CAAC,aAAK,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAGM,QAAQ,CAAC,CAAY;QAC3B,IAAI,IAAI,CAAC,MAAM,EAAE;YAChB,gCAAgC;YAChC,OAAO,EAAE,CAAC;SACV;QACD,OAAO,aAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;CACD;AAPA;IADC,qBAAQ;4DAOR;AAZF,oEAaC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\nimport { Override } from \"../../Decorators\";\r\nimport { ParseTree } from \"../ParseTree\";\r\nimport { TerminalNode } from \"../TerminalNode\";\r\nimport { Trees } from \"../Trees\";\r\nimport { XPath } from \"./XPath\";\r\nimport { XPathElement } from \"./XPathElement\";\r\n\r\nexport class XPathWildcardAnywhereElement extends XPathElement {\r\n\tconstructor() {\r\n\t\tsuper(XPath.WILDCARD);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic evaluate(t: ParseTree): ParseTree[] {\r\n\t\tif (this.invert) {\r\n\t\t\t// !* is weird but valid (empty)\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\treturn Trees.getDescendants(t);\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,10 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
import { ParseTree } from "../ParseTree";
import { XPathElement } from "./XPathElement";
export declare class XPathWildcardElement extends XPathElement {
constructor();
evaluate(t: ParseTree): ParseTree[];
}

View File

@@ -0,0 +1,39 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPathWildcardElement = void 0;
// CONVERSTION complete, Burt Harris 10/14/2016
const Decorators_1 = require("../../Decorators");
const Trees_1 = require("../Trees");
const XPath_1 = require("./XPath");
const XPathElement_1 = require("./XPathElement");
class XPathWildcardElement extends XPathElement_1.XPathElement {
constructor() {
super(XPath_1.XPath.WILDCARD);
}
evaluate(t) {
let kids = [];
if (this.invert) {
// !* is weird but valid (empty)
return kids;
}
for (let c of Trees_1.Trees.getChildren(t)) {
kids.push(c);
}
return kids;
}
}
__decorate([
Decorators_1.Override
], XPathWildcardElement.prototype, "evaluate", null);
exports.XPathWildcardElement = XPathWildcardElement;
//# sourceMappingURL=XPathWildcardElement.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathWildcardElement.js","sourceRoot":"","sources":["../../../../src/tree/xpath/XPathWildcardElement.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+CAA+C;AAC/C,iDAA4C;AAG5C,oCAAiC;AACjC,mCAAgC;AAChC,iDAA8C;AAE9C,MAAa,oBAAqB,SAAQ,2BAAY;IACrD;QACC,KAAK,CAAC,aAAK,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAGM,QAAQ,CAAC,CAAY;QAC3B,IAAI,IAAI,GAAgB,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,MAAM,EAAE;YAChB,gCAAgC;YAChC,OAAO,IAAI,CAAC;SACZ;QACD,KAAK,IAAI,CAAC,IAAI,aAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACb;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAXA;IADC,qBAAQ;oDAWR;AAhBF,oDAiBC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\n// CONVERSTION complete, Burt Harris 10/14/2016\r\nimport { Override } from \"../../Decorators\";\r\nimport { ParseTree } from \"../ParseTree\";\r\nimport { TerminalNode } from \"../TerminalNode\";\r\nimport { Trees } from \"../Trees\";\r\nimport { XPath } from \"./XPath\";\r\nimport { XPathElement } from \"./XPathElement\";\r\n\r\nexport class XPathWildcardElement extends XPathElement {\r\n\tconstructor() {\r\n\t\tsuper(XPath.WILDCARD);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic evaluate(t: ParseTree): ParseTree[] {\r\n\t\tlet kids: ParseTree[] = [];\r\n\t\tif (this.invert) {\r\n\t\t\t// !* is weird but valid (empty)\r\n\t\t\treturn kids;\r\n\t\t}\r\n\t\tfor (let c of Trees.getChildren(t)) {\r\n\t\t\tkids.push(c);\r\n\t\t}\r\n\t\treturn kids;\r\n\t}\r\n}\r\n"]}

View File

@@ -0,0 +1,14 @@
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
export * from "./XPath";
export * from "./XPathElement";
export * from "./XPathLexer";
export * from "./XPathLexerErrorListener";
export * from "./XPathRuleAnywhereElement";
export * from "./XPathRuleElement";
export * from "./XPathTokenAnywhereElement";
export * from "./XPathTokenElement";
export * from "./XPathWildcardAnywhereElement";
export * from "./XPathWildcardElement";

View File

@@ -0,0 +1,27 @@
"use strict";
/*!
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./XPath"), exports);
__exportStar(require("./XPathElement"), exports);
__exportStar(require("./XPathLexer"), exports);
__exportStar(require("./XPathLexerErrorListener"), exports);
__exportStar(require("./XPathRuleAnywhereElement"), exports);
__exportStar(require("./XPathRuleElement"), exports);
__exportStar(require("./XPathTokenAnywhereElement"), exports);
__exportStar(require("./XPathTokenElement"), exports);
__exportStar(require("./XPathWildcardAnywhereElement"), exports);
__exportStar(require("./XPathWildcardElement"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tree/xpath/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,0CAAwB;AACxB,iDAA+B;AAC/B,+CAA6B;AAC7B,4DAA0C;AAC1C,6DAA2C;AAC3C,qDAAmC;AACnC,8DAA4C;AAC5C,sDAAoC;AACpC,iEAA+C;AAC/C,yDAAuC","sourcesContent":["/*!\r\n * Copyright 2016 The ANTLR Project. All rights reserved.\r\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\r\n */\r\n\r\nexport * from \"./XPath\";\r\nexport * from \"./XPathElement\";\r\nexport * from \"./XPathLexer\";\r\nexport * from \"./XPathLexerErrorListener\";\r\nexport * from \"./XPathRuleAnywhereElement\";\r\nexport * from \"./XPathRuleElement\";\r\nexport * from \"./XPathTokenAnywhereElement\";\r\nexport * from \"./XPathTokenElement\";\r\nexport * from \"./XPathWildcardAnywhereElement\";\r\nexport * from \"./XPathWildcardElement\";\r\n"]}