Comparing version 2.0.2 to 2.0.3
@@ -0,1 +1,7 @@ | ||
2.0.3 / 2016-08-07 | ||
================== | ||
* Allow `when` expressions with colons | ||
* Fix incorrect location of some errors | ||
2.0.2 / 2016-06-02 | ||
@@ -2,0 +8,0 @@ ================== |
16
index.js
@@ -714,3 +714,5 @@ 'use strict'; | ||
if (tok) { | ||
this.incrementColumn(-tok.val.length); | ||
this.assertExpression(tok.val); | ||
this.incrementColumn(tok.val.length); | ||
this.tokens.push(tok); | ||
@@ -731,2 +733,16 @@ return true; | ||
if (tok) { | ||
var parser = characterParser(tok.val); | ||
while (parser.isNesting() || parser.isString()) { | ||
var rest = /:([^:\n]+)/.exec(this.input); | ||
if (!rest) break; | ||
tok.val += rest[0]; | ||
this.consume(rest[0].length); | ||
this.incrementColumn(rest[0].length); | ||
parser = characterParser(tok.val); | ||
} | ||
this.incrementColumn(-tok.val.length); | ||
this.assertExpression(tok.val); | ||
this.incrementColumn(tok.val.length); | ||
this.tokens.push(tok); | ||
@@ -733,0 +749,0 @@ return true; |
{ | ||
"name": "pug-lexer", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "The pug lexer (takes a string and converts it to an array of tokens)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,2 +8,3 @@ # pug-lexer | ||
[![NPM version](https://img.shields.io/npm/v/pug-lexer.svg)](https://www.npmjs.org/package/pug-lexer) | ||
[![Coverage Status](https://img.shields.io/codecov/c/github/pugjs/pug-lexer.svg)](https://codecov.io/gh/pugjs/pug-lexer) | ||
@@ -10,0 +11,0 @@ ## Installation |
@@ -77,8 +77,3 @@ {"type":"code","line":1,"col":1,"val":"var id = 5","mustEscape":false,"buffer":false} | ||
{"type":"&attributes","line":17,"col":22,"val":"{baz: 'baz'}"} | ||
{"type":"newline","line":19,"col":1} | ||
{"type":"tag","line":19,"col":1,"val":"a"} | ||
{"type":"start-attributes","line":19,"col":2} | ||
{"type":"attribute","line":19,"col":3,"name":"href","val":"`${42}/${42}`","mustEscape":true} | ||
{"type":"end-attributes","line":19,"col":21} | ||
{"type":"newline","line":20,"col":1} | ||
{"type":"eos","line":20,"col":1} | ||
{"type":"newline","line":18,"col":1} | ||
{"type":"eos","line":18,"col":1} |
@@ -23,3 +23,3 @@ {"type":"tag","line":1,"col":1,"val":"html"} | ||
{"type":"text","line":7,"col":18,"val":"you have "} | ||
{"type":"interpolated-code","line":7,"col":27,"val":"friends","mustEscape":true,"buffer":true} | ||
{"type":"interpolated-code","line":7,"col":27,"mustEscape":true,"buffer":true,"val":"friends"} | ||
{"type":"text","line":7,"col":37,"val":" friends"} | ||
@@ -42,8 +42,22 @@ {"type":"outdent","line":8,"col":5} | ||
{"type":"text","line":14,"col":11,"val":"you have "} | ||
{"type":"interpolated-code","line":14,"col":20,"val":"friends","mustEscape":true,"buffer":true} | ||
{"type":"interpolated-code","line":14,"col":20,"mustEscape":true,"buffer":true,"val":"friends"} | ||
{"type":"text","line":14,"col":30,"val":" friends"} | ||
{"type":"outdent","line":14,"col":38} | ||
{"type":"outdent","line":14,"col":38} | ||
{"type":"outdent","line":14,"col":38} | ||
{"type":"outdent","line":14,"col":38} | ||
{"type":"eos","line":14,"col":38} | ||
{"type":"outdent","line":16,"col":7} | ||
{"type":"outdent","line":16,"col":5} | ||
{"type":"code","line":16,"col":5,"val":"var friend = 'Tim:G'","mustEscape":false,"buffer":false} | ||
{"type":"newline","line":17,"col":1} | ||
{"type":"case","line":17,"col":5,"val":"friend"} | ||
{"type":"indent","line":18,"col":1,"val":6} | ||
{"type":"when","line":18,"col":7,"val":"'Tim:G'"} | ||
{"type":":","line":18,"col":19} | ||
{"type":"tag","line":18,"col":24,"val":"p"} | ||
{"type":"text","line":18,"col":26,"val":"Friend is a string"} | ||
{"type":"newline","line":19,"col":1} | ||
{"type":"when","line":19,"col":7,"val":"{tim: 'g'}"} | ||
{"type":":","line":19,"col":22} | ||
{"type":"tag","line":19,"col":24,"val":"p"} | ||
{"type":"text","line":19,"col":26,"val":"Friend is an object"} | ||
{"type":"outdent","line":20,"col":5} | ||
{"type":"outdent","line":20,"col":3} | ||
{"type":"outdent","line":20,"col":1} | ||
{"type":"eos","line":20,"col":1} |
@@ -1,19 +0,26 @@ | ||
{"type":"newline","line":2,"col":1} | ||
{"type":"text-html","line":2,"col":1,"val":"<ul>"} | ||
{"type":"indent","line":3,"col":1,"val":2} | ||
{"type":"text-html","line":3,"col":3,"val":"<li>foo</li>"} | ||
{"type":"newline","line":4,"col":1} | ||
{"type":"text-html","line":4,"col":3,"val":"<li>bar</li>"} | ||
{"type":"code","line":1,"col":1,"val":"var version = 1449104952939","mustEscape":false,"buffer":false} | ||
{"type":"newline","line":3,"col":1} | ||
{"type":"text-html","line":3,"col":1,"val":"<ul>"} | ||
{"type":"indent","line":4,"col":1,"val":2} | ||
{"type":"text-html","line":4,"col":3,"val":"<li>foo</li>"} | ||
{"type":"newline","line":5,"col":1} | ||
{"type":"text-html","line":5,"col":3,"val":"<li>baz</li>"} | ||
{"type":"outdent","line":6,"col":1} | ||
{"type":"text-html","line":6,"col":1,"val":"</ul>"} | ||
{"type":"newline","line":8,"col":1} | ||
{"type":"tag","line":8,"col":1,"val":"p"} | ||
{"type":"text","line":8,"col":3,"val":"You can <em>embed</em> html as well."} | ||
{"type":"text-html","line":5,"col":3,"val":"<li>bar</li>"} | ||
{"type":"newline","line":6,"col":1} | ||
{"type":"text-html","line":6,"col":3,"val":"<li>baz</li>"} | ||
{"type":"outdent","line":7,"col":1} | ||
{"type":"text-html","line":7,"col":1,"val":"</ul>"} | ||
{"type":"newline","line":9,"col":1} | ||
{"type":"tag","line":9,"col":1,"val":"p"} | ||
{"type":":","line":9,"col":2} | ||
{"type":"text-html","line":9,"col":4,"val":"<strong>Even</strong> as the body of a block expansion."} | ||
{"type":"text-html","line":9,"col":1,"val":"<!--build:js /js/app.min.js?v="} | ||
{"type":"interpolated-code","line":9,"col":31,"mustEscape":true,"buffer":true,"val":"version"} | ||
{"type":"text-html","line":9,"col":41,"val":"-->"} | ||
{"type":"newline","line":10,"col":1} | ||
{"type":"eos","line":10,"col":1} | ||
{"type":"text-html","line":10,"col":1,"val":"<!--endbuild-->"} | ||
{"type":"newline","line":12,"col":1} | ||
{"type":"tag","line":12,"col":1,"val":"p"} | ||
{"type":"text","line":12,"col":3,"val":"You can <em>embed</em> html as well."} | ||
{"type":"newline","line":13,"col":1} | ||
{"type":"tag","line":13,"col":1,"val":"p"} | ||
{"type":":","line":13,"col":2} | ||
{"type":"text-html","line":13,"col":4,"val":"<strong>Even</strong> as the body of a block expansion."} | ||
{"type":"newline","line":14,"col":1} | ||
{"type":"eos","line":14,"col":1} |
@@ -5,3 +5,3 @@ { | ||
"line": 1, | ||
"column": 38 | ||
} | ||
"column": 22 | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
223835
303
4497
73