refactor: move file to token property

This commit is contained in:
harttle
2016-11-16 01:06:37 +08:00
parent 03b7ee95ed
commit 40bdd7e94a
4 changed files with 26 additions and 17 deletions
+3 -2
View File
@@ -3,7 +3,7 @@ const TokenizationError = require('./util/error.js').TokenizationError;
const _ = require('./util/underscore.js');
const assert = require('../src/util/assert.js');
function parse(html) {
function parse(html, filepath) {
assert(_.isString(html), 'illegal input type');
var tokens = [];
@@ -58,7 +58,8 @@ function parse(html) {
raw: match[offset],
value: match[offset + 1].trim(),
line: getLineNum(match),
input: html
input: html,
file: filepath
};
}