1 |
|
2 | import {nextToken, skipLineComment} from "../tokenizer/index";
|
3 | import {charCodes} from "../util/charcodes";
|
4 | import {input, state} from "./base";
|
5 | import {parseTopLevel} from "./statement";
|
6 |
|
7 | export function parseFile() {
|
8 | // If enabled, skip leading hashbang line.
|
9 | if (
|
10 | state.pos === 0 &&
|
11 | input.charCodeAt(0) === charCodes.numberSign &&
|
12 | input.charCodeAt(1) === charCodes.exclamationMark
|
13 | ) {
|
14 | skipLineComment(2);
|
15 | }
|
16 | nextToken();
|
17 | return parseTopLevel();
|
18 | }
|