/** * Copyright 2017 Matt Acosta * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { ISourceTextSyntaxNode } from './SourceTextSyntaxNode'; import { ISyntaxNode, ISyntaxNodeOrList } from './ISyntaxNode'; import { ISyntaxToken, SyntaxTokenFilter } from './ISyntaxToken'; /** * Provides helper methods for working with `ISyntaxNode` objects. */ export declare class SyntaxNodeExtensions { /** * Determines if the given object is shaped like `ISourceTextSyntaxNode`. */ static isSourceTextSyntaxNode(node: object): node is ISourceTextSyntaxNode; /** * Attempts to get the first token within the given node. * * @param {ISyntaxNodeOrList} node * The parent node. * @param {SyntaxTokenFilter=} tokenFilter * A callback used to limit what tokens are returned. */ static tryGetFirstToken(node: ISyntaxNodeOrList, tokenFilter?: SyntaxTokenFilter): ISyntaxToken | null; /** * Attempts to get the last token within the given node. * * @param {ISyntaxNodeOrList} node * The parent node. * @param {SyntaxTokenFilter=} tokenFilter * A callback used to limit what tokens are returned. */ static tryGetLastToken(node: ISyntaxNodeOrList, tokenFilter?: SyntaxTokenFilter): ISyntaxToken | null; /** * Attempts to get the first token within the next node. * * So if parent node `A` has two children `B` and `C`, and the given node * is `B`, then this method will return the first token within `C`. * * @param {ISyntaxNode} node * The current node. * @param {SyntaxTokenFilter=} tokenFilter * A callback used to limit what tokens are returned. */ static tryGetNextToken(node: ISyntaxNode, tokenFilter?: SyntaxTokenFilter): ISyntaxToken | null; /** * Attempts to get the last token within the previous node. * * So if parent node `A` has two children `B` and `C`, and the given node * is `C`, then this method will return the last token within `B`. * * @param {ISyntaxNode} node * The current node. * @param {SyntaxTokenFilter=} tokenFilter * A callback used to limit what tokens are returned. */ static tryGetPreviousToken(node: ISyntaxNode, tokenFilter?: SyntaxTokenFilter): ISyntaxToken | null; }