Understand the Esprima Syntax Tree Format
mainEsprima's syntax tree format is based on the Mozilla Parser API and follows the ESTree specification. Every node in the tree is a JavaScript object containing a type property that identifies its variant.
If location information is enabled during parsing, nodes will also include range and loc properties for mapping back to the source code.
interface Node {
type: string;
range?: [number, number];
loc?: SourceLocation;
}
interface SourceLocation {
start: Position;
end: Position;
source?: string | null;
}
interface Position {
line: number;
column: number;
}