diff --git a/src/__tests__/fixtures/attr-complex-instanceof/__snapshots__/attr-complex-instanceof.expected.txt b/src/__tests__/fixtures/attr-complex-instanceof/__snapshots__/attr-complex-instanceof.expected.txt index 93667a66..a223340a 100644 --- a/src/__tests__/fixtures/attr-complex-instanceof/__snapshots__/attr-complex-instanceof.expected.txt +++ b/src/__tests__/fixtures/attr-complex-instanceof/__snapshots__/attr-complex-instanceof.expected.txt @@ -1,7 +1,74 @@ 1╭─ var a = 'foo' instanceof String - │ │ │ │ │ ├─ closeTag(var) - │ │ │ │ │ ╰─ openTagEnd(var) │ │ │ │ ╰─ attrValue.value "'foo' instanceof String" │ │ │ ╰─ attrValue "= 'foo' instanceof String" │ │ ╰─ attrName - ╰─ ╰─ tagName "var" \ No newline at end of file + ╰─ ╰─ tagName "var" +2╭─ + ╰─ ╰─ openTagEnd(var) +3╭─ tag a = 'foo' instanceof = String + │ │ │ │ │ │ │ ╰─ attrValue.value "String" + │ │ │ │ │ │ ╰─ attrValue "= String" + │ │ │ │ │ ╰─ attrName "instanceof" + │ │ │ │ ╰─ attrValue.value "'foo'" + │ │ │ ╰─ attrValue "= 'foo'" + │ │ ╰─ attrName + │ ├─ closeTag(var) + ╰─ ╰─ tagName "tag" +4╭─ tag a = 'foo' instanceof := String + │ │ │ │ │ │ │ ╰─ attrValue:bound.value "String" + │ │ │ │ │ │ ╰─ attrValue:bound ":= String" + │ │ │ │ │ ╰─ attrName "instanceof" + │ │ │ │ ╰─ attrValue.value "'foo'" + │ │ │ ╰─ attrValue "= 'foo'" + │ │ ╰─ attrName + │ ├─ closeTag(tag) + │ ├─ openTagEnd(tag) + ╰─ ╰─ tagName "tag" +5╭─ tag a = 'foo' instanceof= String + │ │ │ │ │ │ │ ╰─ attrValue.value "String" + │ │ │ │ │ │ ╰─ attrValue "= String" + │ │ │ │ │ ╰─ attrName "instanceof" + │ │ │ │ ╰─ attrValue.value "'foo'" + │ │ │ ╰─ attrValue "= 'foo'" + │ │ ╰─ attrName + │ ├─ closeTag(tag) + │ ├─ openTagEnd(tag) + ╰─ ╰─ tagName "tag" +6╭─ tag a = 'foo' instanceof; + │ │ │ │ │ ╰─ attrName "instanceof" + │ │ │ │ ╰─ attrValue.value "'foo'" + │ │ │ ╰─ attrValue "= 'foo'" + │ │ ╰─ attrName + │ ├─ closeTag(tag) + │ ├─ openTagEnd(tag) + ╰─ ╰─ tagName "tag" +7╭─ + ╰─ ╰─ openTagEnd(tag) +8╭─ tag a = 'foo' instanceof, b + │ │ │ │ │ │ ╰─ attrName + │ │ │ │ │ ╰─ attrName "instanceof" + │ │ │ │ ╰─ attrValue.value "'foo'" + │ │ │ ╰─ attrValue "= 'foo'" + │ │ ╰─ attrName + │ ├─ closeTag(tag) + ╰─ ╰─ tagName "tag" +9╭─ + ╰─ ╰─ openTagEnd(tag) +10╭─ + │ ││ │ │ │ │ ││ ╰─ closeTag(tag).value "tag" + │ ││ │ │ │ │ │╰─ closeTag(tag) "" + │ ││ │ │ │ │ ╰─ openTagEnd(tag) + │ ││ │ │ │ ╰─ attrName "instanceof" + │ ││ │ │ ╰─ attrValue.value "'foo'" + │ ││ │ ╰─ attrValue "= 'foo'" + │ ││ ╰─ attrName + │ │╰─ tagName "tag" + ╰─ ╰─ closeTag(tag) +11╭─ + │ │ │ │ │ │ │ ╰─ closeTag(tag) + │ │ │ │ │ │ ╰─ openTagEnd(tag) "/>" + │ │ │ │ │ ╰─ attrName "instanceof" + │ │ │ │ ╰─ attrValue.value "'foo'" + │ │ │ ╰─ attrValue "= 'foo'" + │ │ ╰─ attrName + ╰─ ╰─ tagName "tag" \ No newline at end of file diff --git a/src/__tests__/fixtures/attr-complex-instanceof/input.marko b/src/__tests__/fixtures/attr-complex-instanceof/input.marko index bb6e2c72..5bb5fcf5 100644 --- a/src/__tests__/fixtures/attr-complex-instanceof/input.marko +++ b/src/__tests__/fixtures/attr-complex-instanceof/input.marko @@ -1 +1,11 @@ -var a = 'foo' instanceof String \ No newline at end of file +var a = 'foo' instanceof String + +tag a = 'foo' instanceof = String +tag a = 'foo' instanceof := String +tag a = 'foo' instanceof= String +tag a = 'foo' instanceof; + +tag a = 'foo' instanceof, b + + + \ No newline at end of file diff --git a/src/states/EXPRESSION.ts b/src/states/EXPRESSION.ts index 8a55e35a..18a3cb43 100644 --- a/src/states/EXPRESSION.ts +++ b/src/states/EXPRESSION.ts @@ -322,7 +322,7 @@ function canCharCodeBeFollowedByDivision(code: number) { function escapeOperator(str: string) { if (/^[A-Z]+$/i.test(str)) { - return "\\b" + escapeNonAlphaNumeric(str) + "\\b"; + return "\\b" + escapeNonAlphaNumeric(str) + "(?=\\s+[^=/,;:>])"; } if (str === "/") { return "\\/(?:\\b|\\s)"; //make sure this isn't a comment