Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-698

Here-docs should allow spaces after initial token (and better errors when unterminated)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.0-beta-7, 1.0-beta-8
    • 1.0-JSR-2
    • None
    • None

    Description

      Here-docs seem to treat the entire text from <<< to the end of the line as the token. It can be very difficult to find this bug with the lack of a line number on the error message. I.e.

      Code like this:

      print(<<<EOS
      hello
      EOS);

      which contains a hidden space after the <<<EOS, yields this error message

      Caught: C:\projects\groovy-1.0-beta-8\test2.groovy: -1: expected ")"; found '' at -1:-1

      The lack of any line number makes this very difficult to track down in a large file.

      Spaces after the opening here-doc token seem to be legal in my version of perl (5.8.x) – though not spaces before the closing token, which would be a nice addition that should be in perl 6.

      Also would be nice if the docs noted the rules about here-docs. I'd be happy to fix those if someone tells me the desired functionality.

      Attachments

        Activity

          People

            sstirling sstirling
            markigra Mark Igra
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: