puppetlabs/puppet — pull request #1908 by hlindberg (2013-09-17 16:48:42+00:00)
Title: (#22593) Fix interpolation issues in future parser lexer (braces/kw)

The lexer did not honor nested braces inside an interpolation of a
puppet expression. This is bad because it leads to strange errors due to
the lexer telling the parser a lie. the fix ensures that end of
interpolated expression is based on balanced braces.

The interpolation functionality that the first bare word is a variable
is troublesome when wanting to use expressions like if, case, unless,
true false, as they become variable references. This changes the
behavior to interpret these as expression keywords instead of variable
names. Users who insist on using keywords as variable names should if
they need to interpolate $if, use either "$if" or "${$if}".

Tests are added to cover these cases.