1# $NetBSD: varparse-mod.mk,v 1.2 2023/11/19 21:47:52 rillig Exp $ 2 3# Tests for parsing expressions with modifiers. 4 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. 9# 10# As of 2020-10-02, the actual parse result of this condition is a single 11# 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 16# of the expression. 17# 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): 21# :@var@replacement@ 22# :_ 23# :L 24# :P 25# :!cmd! 26# :gmtime=... 27# :localtime=... 28# :M (because '}' and ')' are treated the same) 29# :N (because '}' and ')' are treated the same) 30# :S 31# :C 32# :range=... 33# On the other hand, these modifiers ensure that they are followed by a 34# delimiter: 35# :D 36# :U 37# :[...] 38# :gmtime (if not followed by '=') 39# :hash (if not followed by '=') 40# :localtime (if not followed by '=') 41# :t 42# :q 43# :Q 44# :T 45# :H 46# :E 47# :R 48# :range (if not followed by '=') 49# :O 50# :u 51# :sh 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) 55# :? 56# 57.if ${:!echo "\$VAR"} != "value"} 58.endif 59 60all: 61 @: 62