UNPKG

478 BJavaScriptView Raw
1
2import {nextToken, skipLineComment} from "../tokenizer/index";
3import {charCodes} from "../util/charcodes";
4import {input, state} from "./base";
5import {parseTopLevel} from "./statement";
6
7export 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}