1 # $NetBSD: varparse-mod.mk,v 1.1 2020/10/02 20:34:59 rillig Exp $
3 # Tests for parsing variable expressions with modifiers.
5 # As of 2020-10-02, the below condition does not result in a parse error.
6 # The condition contains two separate mistakes. The first mistake is that
7 # the :!cmd! modifier is missing the closing '!'. The second mistake is that
8 # there is a stray '}' at the end of the whole condition.
10 # As of 2020-10-02, the actual parse result of this condition is a single
11 # variable expression with 2 modifiers. The first modifier is
12 # ":!echo "\$VAR"} !". Afterwards, the parser optionally skips a ':' (at the
13 # bottom of ApplyModifiers) and continues with the next modifier, in this case
14 # "= "value"", which is interpreted as a SysV substitution modifier with an
15 # empty left-hand side, thereby appending the string " "value"" to each word
18 # As of 2020-10-02, some modifiers ensure that they are followed by either a
19 # ':' or the closing brace or parenthesis of the expression. The modifiers
20 # that don't ensure this are (in order of appearance in ApplyModifier):
28 # :M (because '}' and ')' are treated the same)
29 # :N (because '}' and ')' are treated the same)
33 # On the other hand, these modifiers ensure that they are followed by a
38 # :gmtime (if not followed by '=')
39 # :hash (if not followed by '=')
40 # :localtime (if not followed by '=')
48 # :range (if not followed by '=')
52 # These modifiers don't care since they reach until the closing character
53 # of the expression, which is either ')' or '}':
54 # ::= (as well as the other assignment modifiers)
57 .if ${:!echo "\$VAR"} != "value"}