estools/esquery

quoted attribute values consume too much

michaelficarra opened this issue · 0 comments

a[b="c"][d="e"]

parses as

{
  "type": "compound",
  "selectors": [
    {
      "type": "identifier",
      "value": "a"
    },
    {
      "type": "attribute",
      "name": "b",
      "operator": "=",
      "value": {
        "type": "literal",
        "value": "c\"][d=\"e"
      }
    }
  ]
}

I expected

{
  "type": "compound",
  "selectors": [
    {
      "type": "identifier",
      "value": "a"
    },
    {
      "type": "attribute",
      "name": "b",
      "operator": "=",
      "value": {
        "type": "literal",
        "value": "c"
      }
    },
    {
      "type": "attribute",
      "name": "d",
      "operator": "=",
      "value": {
        "type": "literal",
        "value": "e"
      }
    }
  ]
}

... which is how the above selector parses when then the value is unquoted.