From 7eacbab5fdc7a28344146a103676eb39db7cb7d7 Mon Sep 17 00:00:00 2001 From: Joshua Sullivan Date: Mon, 12 Feb 2018 08:24:50 -0800 Subject: [PATCH] New parser snapshots --- .../test/__snapshots__/index.test.js.snap | 472 +++++++++++++----- 1 file changed, 358 insertions(+), 114 deletions(-) diff --git a/packages/pug-parser/test/__snapshots__/index.test.js.snap b/packages/pug-parser/test/__snapshots__/index.test.js.snap index f5e7c5ee2..54a141c98 100644 --- a/packages/pug-parser/test/__snapshots__/index.test.js.snap +++ b/packages/pug-parser/test/__snapshots__/index.test.js.snap @@ -588,7 +588,7 @@ Object { "column": 8, "filename": "attrs.tokens.json", "line": 3, - "mustEscape": false, + "mustEscape": true, "name": "bar", "val": true, }, @@ -596,7 +596,7 @@ Object { "column": 13, "filename": "attrs.tokens.json", "line": 3, - "mustEscape": false, + "mustEscape": true, "name": "baz", "val": true, }, @@ -705,7 +705,7 @@ Object { "column": 23, "filename": "attrs.tokens.json", "line": 7, - "mustEscape": false, + "mustEscape": true, "name": "selected", "val": true, }, @@ -928,7 +928,7 @@ Object { "column": 7, "filename": "attrs.tokens.json", "line": 14, - "mustEscape": false, + "mustEscape": true, "name": "bar", "val": true, }, @@ -936,7 +936,7 @@ Object { "column": 11, "filename": "attrs.tokens.json", "line": 14, - "mustEscape": false, + "mustEscape": true, "name": "baz", "val": true, }, @@ -1045,7 +1045,7 @@ Object { "column": 22, "filename": "attrs.tokens.json", "line": 18, - "mustEscape": false, + "mustEscape": true, "name": "selected", "val": true, }, @@ -1244,7 +1244,7 @@ Object { "column": 5, "filename": "attrs.tokens.json", "line": 26, - "mustEscape": false, + "mustEscape": true, "name": "def", "val": true, }, @@ -1278,7 +1278,7 @@ Object { "column": 5, "filename": "attrs.tokens.json", "line": 28, - "mustEscape": false, + "mustEscape": true, "name": "def", "val": true, }, @@ -1312,7 +1312,7 @@ Object { "column": 3, "filename": "attrs.tokens.json", "line": 30, - "mustEscape": false, + "mustEscape": true, "name": "def", "val": true, }, @@ -1346,7 +1346,7 @@ Object { "column": 4, "filename": "attrs.tokens.json", "line": 32, - "mustEscape": false, + "mustEscape": true, "name": "def", "val": true, }, @@ -1380,7 +1380,7 @@ Object { "column": 3, "filename": "attrs.tokens.json", "line": 34, - "mustEscape": false, + "mustEscape": true, "name": "def", "val": true, }, @@ -1414,7 +1414,7 @@ Object { "column": 5, "filename": "attrs.tokens.json", "line": 36, - "mustEscape": false, + "mustEscape": true, "name": "def", "val": true, }, @@ -1480,7 +1480,7 @@ Object { "val": "\'foo\'", }, Object { - "column": 14, + "column": 13, "filename": "attrs.tokens.json", "line": 42, "mustEscape": true, @@ -1514,7 +1514,7 @@ Object { "val": "\'foo\'", }, Object { - "column": 14, + "column": 13, "filename": "attrs.tokens.json", "line": 43, "mustEscape": true, @@ -3055,6 +3055,110 @@ Object { "line": 9, "type": "Case", }, + Object { + "buffer": false, + "column": 5, + "filename": "case.tokens.json", + "isInline": false, + "line": 16, + "mustEscape": false, + "type": "Code", + "val": "var friend = \'Tim:G\'", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 18, + "nodes": Array [ + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 18, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 18, + "nodes": Array [ + Object { + "column": 26, + "filename": "case.tokens.json", + "line": 18, + "type": "Text", + "val": "Friend is a string", + }, + ], + "type": "Block", + }, + "column": 24, + "filename": "case.tokens.json", + "isInline": false, + "line": 18, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "column": 7, + "debug": false, + "expr": "\'Tim:G\'", + "filename": "case.tokens.json", + "line": 18, + "type": "When", + }, + Object { + "block": Object { + "filename": "case.tokens.json", + "line": 19, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "case.tokens.json", + "line": 19, + "nodes": Array [ + Object { + "column": 26, + "filename": "case.tokens.json", + "line": 19, + "type": "Text", + "val": "Friend is an object", + }, + ], + "type": "Block", + }, + "column": 24, + "filename": "case.tokens.json", + "isInline": false, + "line": 19, + "name": "p", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "column": 7, + "debug": false, + "expr": "{tim: \'g\'}", + "filename": "case.tokens.json", + "line": 19, + "type": "When", + }, + ], + "type": "Block", + }, + "column": 5, + "expr": "friend", + "filename": "case.tokens.json", + "line": 17, + "type": "Case", + }, ], "type": "Block", }, @@ -3414,6 +3518,58 @@ Object { "selfClosing": false, "type": "Tag", }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "column": 2, + "filename": "classes.tokens.json", + "line": 13, + "mustEscape": false, + "name": "class", + "val": "\'-foo\'", + }, + ], + "block": Object { + "filename": "classes.tokens.json", + "line": 13, + "nodes": Array [], + "type": "Block", + }, + "column": 1, + "filename": "classes.tokens.json", + "isInline": true, + "line": 13, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, + Object { + "attributeBlocks": Array [], + "attrs": Array [ + Object { + "column": 2, + "filename": "classes.tokens.json", + "line": 14, + "mustEscape": false, + "name": "class", + "val": "\'3foo\'", + }, + ], + "block": Object { + "filename": "classes.tokens.json", + "line": 14, + "nodes": Array [], + "type": "Block", + }, + "column": 1, + "filename": "classes.tokens.json", + "isInline": true, + "line": 14, + "name": "a", + "selfClosing": false, + "type": "Tag", + }, ], "type": "Block", } @@ -5044,7 +5200,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "comments.source.tokens.json", "line": 3, "type": "Text", @@ -5258,7 +5414,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "comments.tokens.json", "line": 12, "type": "Text", @@ -5310,7 +5466,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "comments.tokens.json", "line": 16, "type": "Text", @@ -5377,7 +5533,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "comments.tokens.json", "line": 21, "type": "Text", @@ -5444,7 +5600,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "comments.tokens.json", "line": 26, "type": "Text", @@ -6942,7 +7098,7 @@ Object { ", }, Object { - "column": 7, + "column": 1, "filename": "filters.custom.tokens.json", "line": 6, "type": "Text", @@ -7889,6 +8045,89 @@ Object { } `; +exports[`test filters.verbatim.tokens.json 1`] = ` +Object { + "filename": "filters.verbatim.tokens.json", + "line": 0, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "filters.verbatim.tokens.json", + "line": 1, + "nodes": Array [ + Object { + "attributeBlocks": Array [], + "attrs": Array [], + "block": Object { + "filename": "filters.verbatim.tokens.json", + "line": 2, + "nodes": Array [ + Object { + "attrs": Array [], + "block": Object { + "filename": "filters.verbatim.tokens.json", + "line": 3, + "nodes": Array [ + Object { + "column": 5, + "filename": "filters.verbatim.tokens.json", + "line": 4, + "type": "Text", + "val": "filters are applied at compile time", + }, + Object { + "column": 1, + "filename": "filters.verbatim.tokens.json", + "line": 5, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "filters.verbatim.tokens.json", + "line": 5, + "type": "Text", + "val": "with no #[b interpolation] at #{all}", + }, + ], + "type": "Block", + }, + "column": 3, + "filename": "filters.verbatim.tokens.json", + "line": 3, + "name": "verbatim", + "type": "Filter", + }, + ], + "type": "Block", + }, + "column": 2, + "filename": "filters.verbatim.tokens.json", + "isInline": false, + "line": 2, + "name": "div", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", + }, + "column": 1, + "filename": "filters.verbatim.tokens.json", + "isInline": false, + "line": 1, + "name": "html", + "selfClosing": false, + "type": "Tag", + }, + ], + "type": "Block", +} +`; + exports[`test filters-empty.tokens.json 1`] = ` Object { "filename": "filters-empty.tokens.json", @@ -8114,7 +8353,7 @@ Object { "column": 24, "filename": "html5.tokens.json", "line": 2, - "mustEscape": false, + "mustEscape": true, "name": "checked", "val": true, }, @@ -9981,7 +10220,7 @@ Object { }, Object { "buffer": true, - "column": 1, + "column": 15, "filename": "inline-block-comment.tokens.json", "line": 1, "type": "Comment", @@ -9998,7 +10237,7 @@ Object { }, Object { "buffer": true, - "column": 1, + "column": 16, "filename": "inline-block-comment.tokens.json", "line": 2, "type": "Comment", @@ -10015,7 +10254,7 @@ Object { }, Object { "buffer": true, - "column": 1, + "column": 17, "filename": "inline-block-comment.tokens.json", "line": 3, "type": "Comment", @@ -10255,7 +10494,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "inline-tag.tokens.json", "line": 9, "type": "Text", @@ -12494,7 +12733,7 @@ Object { "attributeBlocks": Array [], "attrs": Array [ Object { - "column": 31, + "column": 30, "filename": "mixin.attrs.tokens.json", "line": 41, "mustEscape": true, @@ -15552,7 +15791,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "pipeless-filters.tokens.json", "line": 3, "type": "Text", @@ -15730,7 +15969,7 @@ Object { ", }, Object { - "column": 3, + "column": 1, "filename": "pre.tokens.json", "line": 5, "type": "Text", @@ -16572,7 +16811,7 @@ Object { "column": 25, "filename": "source.tokens.json", "line": 2, - "mustEscape": false, + "mustEscape": true, "name": "autobuffer", "val": true, }, @@ -16580,7 +16819,7 @@ Object { "column": 37, "filename": "source.tokens.json", "line": 2, - "mustEscape": false, + "mustEscape": true, "name": "controls", "val": true, }, @@ -18179,10 +18418,40 @@ Object { ", }, Object { - "column": 5, + "column": 4, "filename": "text.tokens.json", "line": 10, "type": "Text", + "val": "", + }, + Object { + "column": 1, + "filename": "text.tokens.json", + "line": 11, + "type": "Text", + "val": " +", + }, + Object { + "column": 4, + "filename": "text.tokens.json", + "line": 11, + "type": "Text", + "val": " ", + }, + Object { + "column": 1, + "filename": "text.tokens.json", + "line": 12, + "type": "Text", + "val": " +", + }, + Object { + "column": 5, + "filename": "text.tokens.json", + "line": 12, + "type": "Text", "val": "baz", }, ], @@ -18201,49 +18470,49 @@ Object { "attrs": Array [], "block": Object { "filename": "text.tokens.json", - "line": 12, + "line": 14, "nodes": Array [ Object { "column": 3, "filename": "text.tokens.json", - "line": 13, + "line": 15, "type": "Text", "val": "foo", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 14, + "line": 16, "type": "Text", "val": " ", }, Object { - "column": 3, + "column": 1, "filename": "text.tokens.json", - "line": 14, + "line": 16, "type": "Text", "val": "", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 15, + "line": 17, "type": "Text", "val": " ", }, Object { - "column": 3, + "column": 1, "filename": "text.tokens.json", - "line": 15, + "line": 17, "type": "Text", "val": "", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 16, + "line": 18, "type": "Text", "val": " ", @@ -18251,14 +18520,14 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 16, + "line": 18, "type": "Text", "val": "bar", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 17, + "line": 19, "type": "Text", "val": " ", @@ -18266,22 +18535,22 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 17, + "line": 19, "type": "Text", "val": "baz", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 18, + "line": 20, "type": "Text", "val": " ", }, Object { - "column": 3, + "column": 1, "filename": "text.tokens.json", - "line": 18, + "line": 20, "type": "Text", "val": "", }, @@ -18291,7 +18560,7 @@ Object { "column": 1, "filename": "text.tokens.json", "isInline": false, - "line": 12, + "line": 14, "name": "p", "selfClosing": false, "textOnly": true, @@ -18300,44 +18569,44 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 22, + "line": 24, "type": "Text", "val": "foo", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 23, + "line": 25, "type": "Text", "val": " ", }, Object { - "column": 3, + "column": 1, "filename": "text.tokens.json", - "line": 23, + "line": 25, "type": "Text", "val": "", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 24, + "line": 26, "type": "Text", "val": " ", }, Object { - "column": 3, + "column": 1, "filename": "text.tokens.json", - "line": 24, + "line": 26, "type": "Text", "val": "", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 25, + "line": 27, "type": "Text", "val": " ", @@ -18345,14 +18614,14 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 25, + "line": 27, "type": "Text", "val": "bar", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 26, + "line": 28, "type": "Text", "val": " ", @@ -18360,22 +18629,22 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 26, + "line": 28, "type": "Text", "val": "baz", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 27, + "line": 29, "type": "Text", "val": " ", }, Object { - "column": 3, + "column": 1, "filename": "text.tokens.json", - "line": 27, + "line": 29, "type": "Text", "val": "", }, @@ -18384,19 +18653,19 @@ Object { "attrs": Array [], "block": Object { "filename": "text.tokens.json", - "line": 28, + "line": 30, "nodes": Array [ Object { "column": 5, "filename": "text.tokens.json", - "line": 29, + "line": 31, "type": "Text", "val": "foo", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 30, + "line": 32, "type": "Text", "val": " ", @@ -18404,14 +18673,14 @@ Object { Object { "column": 5, "filename": "text.tokens.json", - "line": 30, + "line": 32, "type": "Text", "val": " bar", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 31, + "line": 33, "type": "Text", "val": " ", @@ -18419,14 +18688,14 @@ Object { Object { "column": 5, "filename": "text.tokens.json", - "line": 31, + "line": 33, "type": "Text", "val": " baz", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 32, + "line": 34, "type": "Text", "val": " ", @@ -18434,7 +18703,7 @@ Object { Object { "column": 5, "filename": "text.tokens.json", - "line": 32, + "line": 34, "type": "Text", "val": ".", }, @@ -18444,7 +18713,7 @@ Object { "column": 1, "filename": "text.tokens.json", "isInline": false, - "line": 28, + "line": 30, "name": "pre", "selfClosing": false, "type": "Tag", @@ -18454,19 +18723,19 @@ Object { "attrs": Array [], "block": Object { "filename": "text.tokens.json", - "line": 34, + "line": 36, "nodes": Array [ Object { "column": 3, "filename": "text.tokens.json", - "line": 35, + "line": 37, "type": "Text", "val": "foo", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 36, + "line": 38, "type": "Text", "val": " ", @@ -18474,14 +18743,14 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 36, + "line": 38, "type": "Text", "val": " bar", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 37, + "line": 39, "type": "Text", "val": " ", @@ -18489,14 +18758,14 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 37, + "line": 39, "type": "Text", "val": " baz", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 38, + "line": 40, "type": "Text", "val": " ", @@ -18504,22 +18773,22 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 38, + "line": 40, "type": "Text", "val": ".", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 39, + "line": 41, "type": "Text", "val": " ", }, Object { - "column": 3, + "column": 1, "filename": "text.tokens.json", - "line": 39, + "line": 41, "type": "Text", "val": "", }, @@ -18529,7 +18798,7 @@ Object { "column": 1, "filename": "text.tokens.json", "isInline": false, - "line": 34, + "line": 36, "name": "pre", "selfClosing": false, "textOnly": true, @@ -18538,14 +18807,14 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 41, + "line": 43, "type": "Text", "val": "foo", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 42, + "line": 44, "type": "Text", "val": " ", @@ -18553,46 +18822,24 @@ Object { Object { "column": 3, "filename": "text.tokens.json", - "line": 42, + "line": 44, "type": "Text", "val": " bar", }, Object { "column": 1, "filename": "text.tokens.json", - "line": 43, - "type": "Text", - "val": " -", - }, - Object { - "column": 3, - "filename": "text.tokens.json", - "line": 43, - "type": "Text", - "val": " baz", - }, - Object { - "column": 1, - "filename": "text.tokens.json", - "line": 44, + "line": 45, "type": "Text", "val": " ", }, - Object { - "column": 3, - "filename": "text.tokens.json", - "line": 44, - "type": "Text", - "val": ".", - }, Object { "column": 3, "filename": "text.tokens.json", "line": 45, "type": "Text", - "val": "foo", + "val": " baz", }, Object { "column": 1, @@ -18603,14 +18850,11 @@ Object { ", }, Object { - "buffer": true, "column": 3, "filename": "text.tokens.json", - "isInline": true, "line": 46, - "mustEscape": true, - "type": "Code", - "val": "bar", + "type": "Text", + "val": ".", }, ], "type": "Block",