mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-11 04:30:14 +00:00
Add definitions for acorn tokenizer function
This commit is contained in:
@@ -67,3 +67,6 @@ acorn.getLineInfo('string', 56);
|
||||
|
||||
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
|
||||
}
|
||||
|
||||
acorn.tokenizer('console.log("hello world)', {locations: true}).getToken();
|
||||
acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next();
|
||||
|
||||
9
acorn/index.d.ts
vendored
9
acorn/index.d.ts
vendored
@@ -238,9 +238,12 @@ declare namespace acorn {
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
|
||||
|
||||
// todo: here the tokenizer function returns a Parser instance, that is targeting the detail of
|
||||
// Parser prototype. Someone need this please reade README.md first.
|
||||
// function tokenizer(options: Options, input: string): Parser;
|
||||
interface ITokenizer {
|
||||
getToken() : Token,
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
function tokenizer(input: string, options: Options): ITokenizer;
|
||||
|
||||
let parse_dammit: IParse | undefined;
|
||||
let LooseParser: ILooseParserClass | undefined;
|
||||
|
||||
Reference in New Issue
Block a user