/** * 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 { INode } from '../node/INode'; import { ISyntaxToken, SyntaxTokenFilter } from './ISyntaxToken'; import { ISyntaxTrivia, SyntaxTriviaFilter } from './ISyntaxTrivia'; import { ISyntaxTriviaList } from './ISyntaxTriviaList'; import { SyntaxTrivia } from './SyntaxTrivia'; import { TextSpan } from '../../text/TextSpan'; /** * Represents a collection of trivia nodes. */ export declare class SyntaxTriviaList implements ISyntaxTriviaList { /** * @inheritDoc */ token: ISyntaxToken; /** * @todo Experimental. */ protected index: number; /** * An object containing the metadata for this trivia list. */ protected node: INode | null; /** * The absolute location of this token in the source text. * * @see SyntaxToken.span * @see SyntaxToken.fullSpan */ protected offset: number; /** * Constructs a `SyntaxTriviaList` object. */ constructor(node: INode | null, token: ISyntaxToken, offset: number, index?: number); /** * @inheritDoc */ get count(): number; /** * @inheritDoc */ get fullSpan(): TextSpan; /** * @inheritDoc */ get span(): TextSpan; /** * Attempts to get the first token from a trivia node containing structure. * * @param {ISyntaxTriviaList} triviaList * The list of trivia to search. * @param {SyntaxTriviaFilter=} triviaFilter * A callback used to limit which trivia nodes are searched. * @param {SyntaxTokenFilter=} tokenFilter * A callback used to limit which structured nodes are returned. * * @return {ISyntaxToken|null} * The first matching token, or `null` if either a trivia filter was not * provided or no tokens matched the token filter. */ static tryGetFirstToken(triviaList: ISyntaxTriviaList, triviaFilter?: SyntaxTriviaFilter, tokenFilter?: SyntaxTokenFilter): ISyntaxToken | null; /** * Attempts to get the last token from a trivia node containing structure * while searching in reversed order. * * @param {ISyntaxTriviaList} triviaList * The list of trivia to search. * @param {SyntaxTriviaFilter=} triviaFilter * A callback used to limit which trivia nodes are searched. * @param {SyntaxTokenFilter=} tokenFilter * A callback used to limit which structured nodes are returned. * * @return {ISyntaxToken|null} * The last matching token, or `null` if either a trivia filter was not * provided or no tokens matched the token filter. */ static tryGetLastToken(triviaList: ISyntaxTriviaList, triviaFilter?: SyntaxTriviaFilter, tokenFilter?: SyntaxTokenFilter): ISyntaxToken | null; /** * @todo Experimental. */ [Symbol.iterator](): IterableIterator; /** * @inheritDoc */ equals(value: SyntaxTriviaList): boolean; /** * @inheritDoc */ reversed(): IterableIterator; /** * @inheritDoc */ triviaAt(index: number): ISyntaxTrivia; /** * @todo Experimental. */ protected toArray(): ISyntaxTrivia[]; }