Scala Programming Language
  1. Scala Programming Language
  2. SI-4138

stringLiteral parser of JavaTokenParsers does not accept escaped double quotes.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Misc Compiler
    • Labels:
      None
    • Environment:

      stringLiteral double quotes

      Description

      Should not stringLiteral parser be like this:

      ("\""+"""([^"\p{Cntrl}\\]|\\[\\/bfnrt"]|\\u[a-fA-F0-9]{4})*"""+"\"").r
      

        Activity

        Hide
        Donna Mithra Malayeri added a comment -

        Lukas, can you verify the proposed change is correct?

        Show
        Donna Mithra Malayeri added a comment - Lukas, can you verify the proposed change is correct?
        Hide
        Donna Mithra Malayeri added a comment -

        What is the difference here? What parses and doesn't parse? We need to a way to verify the proposed fix.

        Show
        Donna Mithra Malayeri added a comment - What is the difference here? What parses and doesn't parse? We need to a way to verify the proposed fix.
        Hide
        Eric Bowman added a comment -

        I ran into this trying to parse a string like:

        "for all good \"men\" to come to the aid of their country"

        I ended up overriding stringLiteral and doing exactly what the original report suggested; I concur, this is a bug, and the fix is quite safe.

        Show
        Eric Bowman added a comment - I ran into this trying to parse a string like: "for all good \"men\" to come to the aid of their country" I ended up overriding stringLiteral and doing exactly what the original report suggested; I concur, this is a bug, and the fix is quite safe.
        Show
        Lukas Rytz added a comment - fixed in https://github.com/scala/scala/commit/800bdf81228cf10e6c93ae39030f9edfae96c679

          People

          • Assignee:
            Lukas Rytz
            Reporter:
            Martins
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development