Groovy
  1. Groovy
  2. GROOVY-675

multiple backslashes and backslash plus dollarsign are not correctly interpreted

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-beta-8
    • Fix Version/s: 1.0-beta-10
    • Component/s: ast builder, lexer, parser
    • Labels:
      None

      Description

      the folowing lines are failing

      assert "\\$"=="
      "+"$"
      assert "\\\\"=="\\"+"
      "

      but the following are not

      assert "
      $"=="$"
      assert "\\\\"=="
      "
      assert "\\\\\\"=="\\"+"
      "
      assert "\\\\\\\\"=="\\"+"
      "
      assert "\\\\\\\\\\"=="\\""\\""
      "
      assert "\\\\\\\\\\\\"=="\\""\\""
      "

      2 backslashes are reduced to just one backslash, and the dollar sign seems to "consume" the leading backslash

      1. StringLexer.diff.txt
        2 kB
        Kim, Pilho
      2. GROOVY675Test.groovy
        0.9 kB
        Kim, Pilho
      3. changes.txt
        5 kB
        Kim, Pilho
      4. Groovy675_Bug.groovy
        1.0 kB
        Kim, Pilho

        Activity

        Jochen Theodorou created issue -
        Hide
        Jochen Theodorou added a comment -

        typo corrected

        Show
        Jochen Theodorou added a comment - typo corrected
        Jochen Theodorou made changes -
        Field Original Value New Value
        Summary multiple backslashes and backslahs plus dollarsign are not correctly interpreted multiple backslashes and backslash plus dollarsign are not correctly interpreted
        Hide
        Kim, Pilho added a comment -

        The attached file will fix such a bug
        for strings containing backslash character().

        Show
        Kim, Pilho added a comment - The attached file will fix such a bug for strings containing backslash character().
        Kim, Pilho made changes -
        Attachment StringLexer.diff.txt [ 13884 ]
        Kim, Pilho made changes -
        Attachment GROOVY675Test.groovy [ 13885 ]
        Hide
        Kim, Pilho added a comment -

        The above patch is incomplete yet,
        cause of "\"", "
        "+"A", and etc.

        Show
        Kim, Pilho added a comment - The above patch is incomplete yet, cause of "\"", " "+"A", and etc.
        Kim, Pilho made changes -
        Attachment changes.txt [ 13904 ]
        Kim, Pilho made changes -
        Attachment Groovy675_Bug.groovy [ 13905 ]
        Hide
        Kim, Pilho added a comment -

        Ignore GROOVY675Test.groovy and StringLexer.diff.txt

        I have attached two files
        changes.txt and Groovy675_Bug.groovy
        to fix two issues GROOVY-675 and GROOVY-700.

        This fix have passed also the test scripts:
        EscapedMetaCharacterTest.groovy
        Base64Test.groovy
        DollarEscapingTest.groovy

        Examples)
        x = 2+3
        println "A\\\\ $

        {x}" # Output: A
        5
        println 'A\\\\ ${x}

        ' # Output: A
        $

        {x}
        println "A\\\\ \${x}

        " # Output: A
        $

        {x}

        println "
        " # Output: \
        println "\"" # Output: "
        println "\\\"\\\\" # Output: \"

        Show
        Kim, Pilho added a comment - Ignore GROOVY675Test.groovy and StringLexer.diff.txt I have attached two files changes.txt and Groovy675_Bug.groovy to fix two issues GROOVY-675 and GROOVY-700 . This fix have passed also the test scripts: EscapedMetaCharacterTest.groovy Base64Test.groovy DollarEscapingTest.groovy Examples) x = 2+3 println "A\\\\ $ {x}" # Output: A 5 println 'A\\\\ ${x} ' # Output: A $ {x} println "A\\\\ \${x} " # Output: A $ {x} println " " # Output: \ println "\"" # Output: " println "\\\"\\\\" # Output: \"
        Kim, Pilho made changes -
        Fix Version/s 1.0-beta-10 [ 11467 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Kim, Pilho made changes -
        Comment [ 29535 ]
        Hide
        Kim, Pilho added a comment -

        It is possible to handle strings and gstrings which contain meta characters
        and/or $.
        This fixes the issue GROOVY-700, too.

        Show
        Kim, Pilho added a comment - It is possible to handle strings and gstrings which contain meta characters and/or $. This fixes the issue GROOVY-700 , too.
        Kim, Pilho made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12729832 ] Default workflow, editable Closed status [ 12741869 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12968392 ] Default workflow, editable Closed status [ 12976170 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        55d 15h 49m 1 Kim, Pilho 03/Feb/05 10:05
        Resolved Resolved Closed Closed
        4m 2s 1 Kim, Pilho 03/Feb/05 10:09

          People

          • Assignee:
            james strachan
            Reporter:
            Jochen Theodorou
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development