Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some properties and methods missing on Parser class #1104

Merged
merged 3 commits into from
Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion acorn/dist/acorn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ declare namespace acorn {
[Symbol.iterator](): Iterator<Token>
}

type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'

interface Options {
ecmaVersion: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'
ecmaVersion: ecmaVersion
sourceType?: 'script' | 'module'
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
Expand All @@ -36,8 +38,41 @@ declare namespace acorn {
}

class Parser {
// state.js
lineStart: number;
options: Options;
curLine: number;
start: number;
end: number;
input: string;
type: TokenType;

// state.js
constructor(options: Options, input: string, startPos?: number)
parse(this: Parser): Node

// tokenize.js
next(): void;
nextToken(): void;

// statement.js
parseTopLevel(node: Node): Node;

// node.js
finishNode(node: Node, type: string): Node;
finishNodeAt(node: Node, type: string, pos: number, loc: Position): Node;

// location.js
raise(pos: number, message: string) : void;
raiseRecoverable?(pos: number, message: string) : void;

// parseutils.js
unexpected(pos: number) : void;

// index.js
static acorn: typeof acorn;

// state.js
static parse(this: typeof Parser, input: string, options: Options): Node
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options: Options): Node
static tokenizer(this: typeof Parser, input: string, options: Options): {
Expand Down