add startLine option (#346)

This commit is contained in:
Raphael Mu
2017-02-10 06:06:28 -08:00
committed by Daniel Tschinder
parent 407c97c9c2
commit f25a2fbc78
6 changed files with 471 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
export const defaultOptions: {
sourceType: string,
sourceFilename: any,
startLine: number,
allowReturnOutsideFunction: boolean,
allowImportExportEverywhere: boolean,
allowSuperOutsideMethod: boolean,
@@ -14,6 +15,9 @@ export const defaultOptions: {
sourceType: "script",
// Source filename.
sourceFilename: undefined,
// Line from which to start counting source. Useful for
// integration with other tools.
startLine: 1,
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,

View File

@@ -34,7 +34,7 @@ export default class State {
this.commentStack = [];
this.pos = this.lineStart = 0;
this.curLine = 1;
this.curLine = options.startLine;
this.type = tt.eof;
this.value = null;