diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-09-27 21:15:45 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-09-27 21:15:45 +0100 |
| commit | e300cd5236d238fcc3d638d4c481af017d2c623a (patch) | |
| tree | ad8697112146da3706df7f5c239f7abd0767149e | |
| parent | 99b2d79d13703939f37e3ecb5becfdbf928e604a (diff) | |
Expect end token when parsing style mappings
| -rw-r--r-- | NEWS | 5 | ||||
| -rw-r--r-- | lib/style-reader.js | 3 | ||||
| -rw-r--r-- | package.json | 3 | ||||
| -rw-r--r-- | test/style-reader.tests.js | 7 |
4 files changed, 16 insertions, 2 deletions
@@ -1,3 +1,8 @@ +# 1.2.3 + +* Expect end token when parsing style mappings. This causes warnings to be + emitted instead of silenting ignoring unparsed tokens. + # 1.2.2 * Ignore blank lines in style map. diff --git a/lib/style-reader.js b/lib/style-reader.js index fe60930..db3bdbc 100644 --- a/lib/style-reader.js +++ b/lib/style-reader.js @@ -23,7 +23,8 @@ function createStyleRule() { lop.rules.sequence.capture(lop.rules.optional(lop.rules.sequence( lop.rules.tokenOfType("whitespace"), lop.rules.sequence.capture(htmlPathRule()) - ).head())) + ).head())), + lop.rules.tokenOfType("end") ).map(function(documentMatcher, htmlPath) { return { from: documentMatcher, diff --git a/package.json b/package.json index e1c0fac..c466d9f 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "uglify-js": "~2.4.8", "temp": "~0.7.0", "eslint": "2.13.1", - "hamjest": "2.13.0" + "hamjest": "2.13.0", + "flow-bin": "^0.32.0" }, "browser": { "./lib/unzip.js": "./browser/unzip.js", diff --git a/test/style-reader.tests.js b/test/style-reader.tests.js index 19f9c00..ec17e3a 100644 --- a/test/style-reader.tests.js +++ b/test/style-reader.tests.js @@ -162,6 +162,13 @@ test("styleReader.read", { to: htmlPaths.empty } ); + }, + + "error when not all input is consumed": function() { + assert.deepEqual( + readStyle("r => span a"), + new results.Result(null, [results.warning("Did not understand this style mapping, so ignored it: r => span a\nError was at character number 10: Expected end but got whitespace")]) + ); } }); |
