How to use the acorn.tokTypes.eof function in acorn

To help you get started, we’ve selected a few acorn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reboundjs / rebound / packages / property-compiler / lib / property-compiler.js View on Github external
}
          itr++;
        }
        token.nextToken();
      }
      workingpath.push(attrs);
    }

    if(listening && (_.indexOf(TERMINATORS, token.type.label) > -1 || _.indexOf(TERMINATORS, token.value) > -1)){
      workingpath = _.reduce(workingpath, reduceMemos, ['']);
      finishedPaths = _.compact(_.union(finishedPaths, workingpath));
      workingpath = [];
      listening--;
    }

  } while (token.start !== token.end && token.type !== tokTypes.eof);

  // Save our finished paths directly on the function
  prop.__params = finishedPaths;

  // Return the dependancies list
  return finishedPaths;

}
github wrleskovec / react-week-scheduler / node_modules / acorn / src / loose / state.js View on Github external
constructor(input, options = {}) {
    this.toks = tokenizer(input, options)
    this.options = this.toks.options
    this.input = this.toks.input
    this.tok = this.last = {type: tt.eof, start: 0, end: 0}
    if (this.options.locations) {
      let here = this.toks.curPosition()
      this.tok.loc = new SourceLocation(this.toks, here, here)
    }
    this.ahead = [] // Tokens ahead
    this.context = [] // Indentation contexted
    this.curIndent = 0
    this.curLineStart = 0
    this.nextLineStart = this.lineEnd(this.curLineStart) + 1
    // Load plugins
    this.options.pluginsLoose = options.pluginsLoose || {}
    this.loadPlugins(this.options.pluginsLoose)
  }
github stdlib-js / stdlib / lib / node_modules / @stdlib / repl / lib / acorn_detect_multiline_input.js View on Github external
CustomParser.prototype.nextToken = function nextToken() { // eslint-disable-line no-restricted-syntax
		Parser.prototype.nextToken.call( this );
		if ( this.type === tokTypes.eof ) {
			debug( 'Detected an error after an `eof` token.' );
			this.HAS_MULTILINE_ERROR = true;
		}
	};
github wrleskovec / react-week-scheduler / node_modules / acorn / src / loose / state.js View on Github external
canInsertSemicolon() {
    return this.tok.type === tt.eof || this.tok.type === tt.braceR ||
      lineBreak.test(this.input.slice(this.last.end, this.tok.start))
  }
github wrleskovec / react-week-scheduler / node_modules / acorn / src / loose / statement.js View on Github external
lp.parseTopLevel = function() {
  let node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0)
  node.body = []
  while (this.tok.type !== tt.eof) node.body.push(this.parseStatement())
  this.last = this.tok
  if (this.options.ecmaVersion >= 6) {
    node.sourceType = this.options.sourceType
  }
  return this.finishNode(node, "Program")
}
github acornjs / acorn / acorn-loose / src / state.js View on Github external
closes(closeTok, indent, line, blockHeuristic) {
    if (this.tok.type === closeTok || this.tok.type === tt.eof) return true
    return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
      (!blockHeuristic || this.nextLineStart >= this.input.length ||
       this.indentationAfter(this.nextLineStart) < indent)
  }
github observablehq / parser / src / parse.js View on Github external
parseTopLevel(node) {
    if (!node.cells) node.cells = [];
    while (this.type !== tt.eof) {
      const cell = this.parseCell(this.startNode());
      cell.input = this.input;
      node.cells.push(cell);
    }
    this.next();
    return this.finishNode(node, "Program");
  }
}
github acornjs / acorn / acorn-loose / src / statement.js View on Github external
lp.parseTopLevel = function() {
  let node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0)
  node.body = []
  while (this.tok.type !== tt.eof) node.body.push(this.parseStatement())
  this.toks.adaptDirectivePrologue(node.body)
  this.last = this.tok
  node.sourceType = this.options.sourceType
  return this.finishNode(node, "Program")
}
github wrleskovec / react-week-scheduler / node_modules / acorn / src / loose / statement.js View on Github external
return this.finishNode(node, "EmptyStatement")

  case tt._class:
    return this.parseClass(true)

  case tt._import:
    return this.parseImport()

  case tt._export:
    return this.parseExport()

  default:
    let expr = this.parseExpression()
    if (isDummy(expr)) {
      this.next()
      if (this.tok.type === tt.eof) return this.finishNode(node, "EmptyStatement")
      return this.parseStatement()
    } else if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) {
      node.body = this.parseStatement()
      node.label = expr
      return this.finishNode(node, "LabeledStatement")
    } else {
      node.expression = expr
      this.semicolon()
      return this.finishNode(node, "ExpressionStatement")
    }
  }
}
github observablehq / parser / src / parse.js View on Github external
unexpected(pos) {
    this.raise(
      pos != null ? pos : this.start,
      this.type === tt.eof ? "Unexpected end of input" : "Unexpected token"
    );
  }
  parseMaybeKeywordExpression(keyword, type) {