Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-9163

Lexer incorrectly identifying list starts inside heredocs

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 4.10.0, PUP 6.0.0
    • PUP 5.5.7, PUP 6.0.1
    • None
    • None
    • Coremunity
    • Platform Core KANBAN
    • Bug Fix
    • Hide
      When using interpolation inside a heredoc the position and location information for the interpolated expressions were wrong. This could lead to two problems;
      * if using {{[]}} expressions a mysterious Syntax Error would be raised if an
      seemingly arbitrary position after the interpolation contained white-space.
      * If there were errors in the interpolation they could end up being reported for the wrong line and position on the line.

      This is now fixed.
      Show
      When using interpolation inside a heredoc the position and location information for the interpolated expressions were wrong. This could lead to two problems; * if using {{[]}} expressions a mysterious Syntax Error would be raised if an seemingly arbitrary position after the interpolation contained white-space. * If there were errors in the interpolation they could end up being reported for the wrong line and position on the line. This is now fixed.
    • Needs Assessment

    Description

      Square brackets that are:

      • Inside heredocs
      • Inside an interpolation

      Are sometimes being incorrectly lexed as TOKEN_LISTSTART.

      Simplest example

      Create test.pp:

      $xxxxxxx = @("END")
      ${facts['os']['family']}
      XXXXXXX XXX
      END
      notice($xxxxxxx)

      Puppet apply it.

      What I expect

      Some text to appear showing the OS family.

      What I actually see

      Error: Could not parse for environment production: Syntax error at '[' (file: /Users/alexharvey/git/home/puppet-test/test.pp, line: 2, column: 14)
      

      More info

      Note the space inside XXX XX. That space is matching in the lexer on this line here, leading to the '[' being lexed as TOKEN_LISTSTART.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              alexharv074 Alex Harvey
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support