Skip to content

[bug]: Not recognizing escaped double quotes #16

@luiz00martins

Description

@luiz00martins

Description

Escaped double quotes are not properly recognized, leading to the string literal not being closed.

How to reproduce

Use the following code:

sqlString = "\"" (!"\"" .)* "\""

sqlInner
  = chars:sqlChar+ {
      return {
        statement: chars.map((c) => c.char).join(""),
        arguments: chars.flatMap((c) => (c.argNames ? c.argNames : [])),
      };
    }

Note that it contains escaped quotes on the first line, leading the subsequent lines to be recognized as part of the string:

image

Expected behaviour

To close the string, as when no escaped quotes are used:

sqlString = '"' (!'"' .)* '"'

sqlInner
  = chars:sqlChar+ {
      return {
        statement: chars.map((c) => c.char).join(""),
        arguments: chars.flatMap((c) => (c.argNames ? c.argNames : [])),
      };
    }

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions