moo/000755 001751 000166 0000000000 14736320742013351 5ustar00runner000000 000000 1473632074214736320742moo/LICENSE000644 001751 000166 0000002165 14736320742014362 0ustar00runner000000 000000 1473632074214736320742 MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE moo/README.md000644 001751 000166 0000001042 14736320742014625 0ustar00runner000000 000000 1473632074214736320742# Installation > `npm install --save @types/moo` # Summary This package contains type definitions for moo (https://github.com/tjvr/moo#readme). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/moo. ### Additional Details * Last updated: Sat, 04 Jan 2025 21:02:26 GMT * Dependencies: none # Credits These definitions were written by [Nikita Litvin](https://github.com/deltaidea), [Jörg Vehlow](https://github.com/MofX), and [Martien Oranje](https://github.com/moranje). moo/index.d.ts000644 001751 000166 0000010070 14736320742015250 0ustar00runner000000 000000 1473632074214736320742export as namespace moo; /** * Reserved token for indicating a parse fail. */ export interface ErrorRule { error: true; } export const error: ErrorRule; /** * Reserved token for indicating a fallback rule. */ export interface FallbackRule { fallback: true; } export const fallback: FallbackRule; export type TypeMapper = (x: string) => string; export function keywords(kws: { [k: string]: string | string[] }): TypeMapper; export function compile(rules: Rules): Lexer; export function states(states: { [x: string]: Rules }, start?: string): Lexer; export interface Rule { match?: RegExp | string | string[] | undefined; /** * Moo tracks detailed information about the input for you. * It will track line numbers, as long as you apply the `lineBreaks: true` * option to any tokens which might contain newlines. Moo will try to warn you if you forget to do this. */ lineBreaks?: boolean | undefined; /** * Moves the lexer to a new state, and pushes the old state onto the stack. */ push?: string | undefined; /** * Returns to a previous state, by removing one or more states from the stack. */ pop?: number | undefined; /** * Moves to a new state, but does not affect the stack. */ next?: string | undefined; /** * You can have a token type that both matches tokens and contains error values. */ error?: true | undefined; /** * Moo doesn't allow capturing groups, but you can supply a transform function, value(), * which will be called on the value before storing it in the Token object. */ value?: ((x: string) => string) | undefined; /** * Used for mapping one set of types to another. * See https://github.com/no-context/moo#keywords for an example */ type?: TypeMapper | undefined; } export interface Rules { [x: string]: RegExp | RegExp[] | string | string[] | Rule | Rule[] | ErrorRule | FallbackRule; } export interface Lexer { /** * Returns a string with a pretty error message. */ formatError(token?: Token, message?: string): string; /** * @deprecated since 0.5.0. Now just returns true */ has(tokenType: string): boolean; /** * When you reach the end of Moo's internal buffer, next() will return undefined. * You can always reset() it and feed it more data when that happens. */ next(): Token | undefined; /** * Empty the internal buffer of the lexer, and set the line, column, and offset counts back to their initial value. */ reset(chunk?: string, state?: LexerState): this; /** * Returns current state, which you can later pass it as the second argument * to reset() to explicitly control the internal state of the lexer. */ save(): LexerState; /** * Transitions to the provided state and pushes the state onto the state * stack. */ pushState(state: string): void; /** * Returns back to the previous state in the stack. */ popState(): void; /** * Transitiosn to the provided state. Does not push onto the state stack. */ setState(state: string): void; [Symbol.iterator](): Iterator; } export interface Token { /** * Returns value of the token, or its type if value isn't available. */ toString(): string; /** * The name of the group, as passed to compile. */ type?: string | undefined; /** * The match contents. */ value: string; /** * The number of bytes from the start of the buffer where the match starts. */ offset: number; /** * The complete match. */ text: string; /** * The number of line breaks found in the match. (Always zero if this rule has lineBreaks: false.) */ lineBreaks: number; /** * The line number of the beginning of the match, starting from 1. */ line: number; /** * The column where the match begins, starting from 1. */ col: number; } export interface LexerState { line: number; col: number; state: string; } moo/package.json000644 001751 000166 0000002102 14736320742015632 0ustar00runner000000 000000 1473632074214736320742{ "name": "@types/moo", "version": "0.5.10", "description": "TypeScript definitions for moo", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/moo", "license": "MIT", "contributors": [ { "name": "Nikita Litvin", "githubUsername": "deltaidea", "url": "https://github.com/deltaidea" }, { "name": "Jörg Vehlow", "githubUsername": "MofX", "url": "https://github.com/MofX" }, { "name": "Martien Oranje", "githubUsername": "moranje", "url": "https://github.com/moranje" } ], "main": "", "types": "index.d.ts", "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", "directory": "types/moo" }, "scripts": {}, "dependencies": {}, "peerDependencies": {}, "typesPublisherContentHash": "918fa52c88044afbe70eafe1222c8765df348ade26bd0736f2822918ee3ebfb6", "typeScriptVersion": "5.0" }