dnl
AT_BANNER([DEFINE])
-m4_define([PSPP_CHECK_MACRO_EXPANSION],
- [AT_SETUP([macro expansion - $1])
- AT_KEYWORDS([m4_bpatsubst([$1], [!], [])])
- AT_DATA([define.sps], [$2
-DEBUG EXPAND.
-$3
-])
- AT_CAPTURE_FILE([define.sps])
- AT_DATA([expout], [$4
-])
- AT_CHECK([pspp --testing-mode define.sps | sed '/^$/d'], [$6], [expout])
- AT_CLEANUP])
-
AT_SETUP([simple macro expansion])
AT_DATA([define.sps], [dnl
DEFINE !macro()
])
AT_CLEANUP
-PSPP_CHECK_MACRO_EXPANSION([one !TOKENS(1) positional argument],
- [DEFINE !t1(!positional !tokens(1)) t1 (!1) !ENDDEFINE.],
- [!t1 a.
+AT_SETUP([macro expansion - one !TOKENS(1) positional argument])
+AT_KEYWORDS([TOKENS])
+AT_DATA([define.sps], [dnl
+DEFINE !t1(!positional !tokens(1)) t1 (!1) !ENDDEFINE.
+DEBUG EXPAND.
+!t1 a.
!t1 b.
-!t1 a b.],
- [t1(a)
+!t1 a b.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+t1(a)
+
t1(b)
+
t1(a)
-note: unexpanded token "b"])
+
+note: unexpanded token "b"
+])
+AT_CLEANUP
AT_SETUP([macro expansion with positional arguments])
AT_DATA([define.sps], [dnl
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
"Too few tokens for !TOKENS."
-define.sps:13: error: DEBUG EXPAND: Unexpected end of command reading
+define.sps:13.7: error: DEBUG EXPAND: Unexpected end of command reading
argument !3 to macro !p.
note: unexpanded token "!p"
note: unexpanded token "b"
-define.sps:14: error: DEBUG EXPAND: Unexpected end of command reading
+define.sps:14.5: error: DEBUG EXPAND: Unexpected end of command reading
argument !2 to macro !p.
note: unexpanded token "!p"
note: unexpanded token "a"
-define.sps:15: error: DEBUG EXPAND: Unexpected end of command reading
+define.sps:15.3: error: DEBUG EXPAND: Unexpected end of command reading
argument !1 to macro !p.
note: unexpanded token "!p"
"Missing charend delimiter."
-define.sps:18: error: DEBUG EXPAND: Unexpected end of command reading
+define.sps:18.10: error: DEBUG EXPAND: Unexpected end of command reading
argument !1 to macro !ce.
note: unexpanded token "!ce"
"Missing start delimiter."
-define.sps:21: error: DEBUG EXPAND: Found `a' while expecting `{' reading
+define.sps:21.7: error: DEBUG EXPAND: Found `a' while expecting `{' reading
argument !1 to macro !enc1.
note: unexpanded token "!enc1"
"Missing end delimiter."
-define.sps:24: error: DEBUG EXPAND: Unexpected end of command reading
+define.sps:24.12: error: DEBUG EXPAND: Unexpected end of command reading
argument !1 to macro !enc1.
note: unexpanded token "!enc1"
])
AT_CLEANUP
-PSPP_CHECK_MACRO_EXPANSION([one !TOKENS(1) keyword argument],
- [DEFINE !k(arg1 = !TOKENS(1)) k(!arg1) !ENDDEFINE.],
- [!k arg1=x.
+AT_SETUP([macro expansion - one !TOKENS(1) keyword argument])
+AT_KEYWORDS([TOKENS])
+AT_DATA([define.sps], [dnl
+DEFINE !k(arg1 = !TOKENS(1)) k(!arg1) !ENDDEFINE.
+DEBUG EXPAND.
+!k arg1=x.
!k arg1=x y.
-!k.],
- [k(x)
+!k.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
k(x)
+
+k(x)
+
note: unexpanded token "y"
-k( )])
-PSPP_CHECK_MACRO_EXPANSION([one !TOKENS(1) keyword argument - negative],
- [DEFINE !k(arg1 = !TOKENS(1)) k(!arg1) !ENDDEFINE.],
- [!k arg1.
-!k arg1=.], [dnl
-define.sps:3: error: DEBUG EXPAND: Found `.' while expecting `=' reading
+k( )
+])
+AT_CLEANUP
+
+AT_SETUP([macro expansion - one !TOKENS(1) keyword argument - negative])
+AT_KEYWORDS([TOKENS])
+AT_DATA([define.sps], [dnl
+DEFINE !k(arg1 = !TOKENS(1)) k(!arg1) !ENDDEFINE.
+DEBUG EXPAND.
+!k arg1.
+!k arg1=.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
+define.sps:3.8: error: DEBUG EXPAND: Found `.' while expecting `=' reading
argument !arg1 to macro !k.
+
note: unexpanded token "!k"
+
note: unexpanded token "arg1"
-define.sps:4: error: DEBUG EXPAND: Unexpected end of command reading argument !
-arg1 to macro !k.
+
+define.sps:4.9: error: DEBUG EXPAND: Unexpected end of command reading argument
+!arg1 to macro !k.
+
note: unexpanded token "!k"
+
note: unexpanded token "arg1"
-note: unexpanded token "="], [1])
-PSPP_CHECK_MACRO_EXPANSION([!CHAREND('/') keyword arguments], [dnl
+note: unexpanded token "="
+])
+AT_CLEANUP
+
+AT_SETUP([macro expansion - !CHAREND('/') keyword arguments])
+AT_KEYWORDS([CHAREND])
+AT_DATA([define.sps], [dnl
DEFINE !k(arg1 = !CHAREND('/')
/arg2 = !CHAREND('/'))
k(!arg1, !arg2)
-!ENDDEFINE.],
- [!k arg1=x/ arg2=y/.
+!ENDDEFINE.
+DEBUG EXPAND.
+!k arg1=x/ arg2=y/.
!k arg1=x/.
!k arg2=y/.
-!k.],
- [k(x, y)
+!k.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+k(x, y)
+
k(x, )
+
k(, y)
-k(, )])
-PSPP_CHECK_MACRO_EXPANSION([!CHAREND('/') keyword arguments - negative], [dnl
+k(, )
+])
+AT_CLEANUP
+
+AT_SETUP([macro expansion - !CHAREND('/') keyword arguments - negative])
+AT_KEYWORDS([CHAREND])
+AT_DATA([define.sps], [dnl
DEFINE !k(arg1 = !CHAREND('/')
/arg2 = !CHAREND('/'))
k(!arg1, !arg2)
-!ENDDEFINE.],
- [!k arg1.
+!ENDDEFINE.
+DEBUG EXPAND.
+!k arg1.
!k arg1=.
!k arg1=x.
-!k arg1=x/ arg2=y.],
- [define.sps:6: error: DEBUG EXPAND: Found `.' while expecting `=' reading
+!k arg1=x/ arg2=y.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
+define.sps:6.8: error: DEBUG EXPAND: Found `.' while expecting `=' reading
argument !arg1 to macro !k.
+
note: unexpanded token "!k"
+
note: unexpanded token "arg1"
-define.sps:7: error: DEBUG EXPAND: Unexpected end of command reading argument !
-arg1 to macro !k.
+
+define.sps:7.9: error: DEBUG EXPAND: Unexpected end of command reading argument
+!arg1 to macro !k.
+
note: unexpanded token "!k"
+
note: unexpanded token "arg1"
+
note: unexpanded token "="
-define.sps:8: error: DEBUG EXPAND: Unexpected end of command reading argument !
-arg1 to macro !k.
+
+define.sps:8.10: error: DEBUG EXPAND: Unexpected end of command reading
+argument !arg1 to macro !k.
+
note: unexpanded token "!k"
+
note: unexpanded token "arg1"
+
note: unexpanded token "="
+
note: unexpanded token "x"
-define.sps:9: error: DEBUG EXPAND: Unexpected end of command reading argument !
-arg2 to macro !k.
+
+define.sps:9.18: error: DEBUG EXPAND: Unexpected end of command reading
+argument !arg2 to macro !k.
+
note: unexpanded token "!k"
+
note: unexpanded token "arg1"
+
note: unexpanded token "="
+
note: unexpanded token "x"
+
note: unexpanded token "/"
+
note: unexpanded token "arg2"
+
note: unexpanded token "="
-note: unexpanded token "y"])
-PSPP_CHECK_MACRO_EXPANSION([default keyword arguments],
- [DEFINE !k(arg1 = !DEFAULT(a b c) !CMDEND) k(!arg1) !ENDDEFINE],
- [!k arg1=x.
-!k],
- [k(x)
-k(a b c)])
+note: unexpanded token "y"
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !BLANKS in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!BLANKS],
- [DEFINE !b()
+AT_SETUP([macro expansion - !BLANKS])
+AT_KEYWORDS([BLANKS])
+AT_DATA([define.sps], [dnl
+DEFINE !b()
!BLANKS(0).
!QUOTE(!BLANKS(0)).
!BLANKS(1).
!QUOTE(!BLANKS(2)).
!BLANKS(5).
!QUOTE(!BLANKS(5)).
-!ENDDEFINE],
- [!b.],
- [.
+!ENDDEFINE.
+DEBUG EXPAND.
+!b.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+.
''.
.
' '.
.
' '.
.
-' '.])
+' '.
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !CONCAT in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!CONCAT],
- [DEFINE !c()
+AT_SETUP([macro expansion - !CONCAT])
+AT_KEYWORDS([CONCAT])
+AT_DATA([define.sps], [dnl
+DEFINE !c()
!CONCAT(x, y).
!CONCAT('x', 'y').
!CONCAT(12, 34).
!CONCAT(x, 0, y).
!CONCAT(0, x).
!CONCAT(0, x, y).
-!ENDDEFINE],
- [!c.],
- [xy.
+!ENDDEFINE.
+DEBUG EXPAND.
+!c
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+xy.
xy.
1234.
123.
x0.
x0y.
0 x.
-0 xy.])
+0 xy.
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !EVAL in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!EVAL],
- [DEFINE !vars() a b c !ENDDEFINE.
+AT_SETUP([macro expansion - !EVAL])
+AT_KEYWORDS([EVAL])
+AT_DATA([define.sps], [dnl
+DEFINE !vars() a b c !ENDDEFINE.
+
DEFINE !e()
!vars.
!QUOTE(!vars).
!EVAL(!vars).
!QUOTE(!EVAL(!vars)).
!ENDDEFINE
+
DEFINE !e2(!positional !enclose('(',')'))
!1.
!QUOTE(!1).
!EVAL(!1).
!QUOTE(!EVAL(!1)).
-!ENDDEFINE],
- [!e.
-!e2(!vars)],
- [a b c.
+!ENDDEFINE.
+DEBUG EXPAND.
+!e.
+!e2(!vars).
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+a b c.
'!vars'.
a b c.
'a b c'.
+
a b c.
'!vars'.
a b c.
-'a b c'.])
+'a b c'.
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !HEAD in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!HEAD],
- [DEFINE !h()
+AT_SETUP([macro expansion - !HEAD])
+AT_KEYWORDS([HEAD])
+AT_DATA([define.sps], [dnl
+DEFINE !h()
!HEAD('a b c').
!HEAD('a').
!HEAD(!NULL).
!HEAD('').
-!ENDDEFINE],
- [!h.],
- [a.
+!ENDDEFINE.
+DEBUG EXPAND.
+!h.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
a.
+a.
+.
.
-.])
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !TAIL in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!TAIL],
- [DEFINE !t()
+AT_SETUP([macro expansion - !TAIL])
+AT_KEYWORDS([TAIL])
+AT_DATA([define.sps], [dnl
+DEFINE !t()
!TAIL('a b c').
!TAIL('a').
!TAIL(!NULL).
!TAIL('').
-!ENDDEFINE],
- [!t.],
- [b c.
+!ENDDEFINE.
+DEBUG EXPAND.
+!t.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+b c.
.
.
-.])
+.
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !INDEX in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!INDEX],
- [DEFINE !i()
+AT_SETUP([macro expansion - !INDEX])
+AT_KEYWORDS([INDEX])
+AT_DATA([define.sps], [dnl
+DEFINE !i()
!INDEX(banana, an).
!INDEX(banana, nan).
!INDEX(banana, apple).
!INDEX("banana", nan).
!INDEX("banana", "nan").
!INDEX(!UNQUOTE("banana"), !UNQUOTE("nan")).
-!ENDDEFINE],
- [!i.],
- [2.
+!ENDDEFINE.
+DEBUG EXPAND.
+!i.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+2.
3.
0.
4.
0.
-3.])
+3.
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !LENGTH in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!LENGTH],
- [DEFINE !l()
+AT_SETUP([macro expansion - !LENGTH])
+AT_KEYWORDS([LENGTH])
+AT_DATA([define.sps], [dnl
+DEFINE !l()
!LENGTH(123).
!LENGTH(123.00).
!LENGTH( 123 ).
!ENDDEFINE.
DEFINE !la(!positional !enclose('(',')'))
!LENGTH(!1).
-!ENDDEFINE.],
- [!l.
+!ENDDEFINE.
+DEBUG EXPAND.
+!l.
!la(a b c).
-!la().],
- [3.
+!la().
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+3.
6.
3.
5.
5.
6.
0.
+
5.
-0.])
+
+0.
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !SUBSTR in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!SUBSTR],
- [DEFINE !s()
+AT_SETUP([macro expansion - !SUBSTR])
+AT_KEYWORDS([SUBSTR])
+AT_DATA([define.sps], [dnl
+DEFINE !s()
!SUBSTR(banana, 3).
!SUBSTR(banana, 3, 3).
!SUBSTR("banana", 1, 3).
!SUBSTR(banana, 3, 0).
!SUBSTR(banana, 3, 10).
!SUBSTR(banana, 10, 3).
-!ENDDEFINE.],
- [!s.],
- [define.sps:1-10: At `"ba' in the expansion of `!s',dnl "
+!ENDDEFINE.
+DEBUG EXPAND.
+!s.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
+define.sps:1-10: At `"ba' in the expansion of `!s',dnl "
+
+define.sps:12.1-12.2: error: DEBUG EXPAND: Unterminated string constant.
-define.sps:12: error: DEBUG EXPAND: Unterminated string constant.
nana.
nan.
.
ana.
.
nana.
-.])
+.
+])
+AT_CLEANUP
dnl Keep this test in sync with the examples for !UPCASE in the manual.
-PSPP_CHECK_MACRO_EXPANSION([!UPCASE],
- [DEFINE !u()
+AT_SETUP([macro expansion - !UPCASE])
+AT_KEYWORDS([UPCASE])
+AT_DATA([define.sps], [dnl
+DEFINE !u()
!UPCASE(freckle).
!UPCASE('freckle').
!UPCASE('a b c').
!UPCASE('A B C').
-!ENDDEFINE.],
- [!u.],
- [FRECKLE.
+!ENDDEFINE.
+DEBUG EXPAND.
+!u.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+FRECKLE.
FRECKLE.
A B C.
-A B C.])
-
+A B C.
+])
+AT_CLEANUP
dnl !* is implemented separately inside and outside function arguments
dnl so this test makes sure to include both.
-PSPP_CHECK_MACRO_EXPANSION([!*], [dnl
+AT_SETUP([macro expansion - !*])
+AT_DATA([define.sps], [dnl
DEFINE !m(!POSITIONAL !TOKENS(1)
/!POSITIONAL !TOKENS(1))
!*/
!LENGTH(!*)/
!SUBSTR(!*, 3)/
!QUOTE(!*).
-!ENDDEFINE.],
- [!m 123 b
+!ENDDEFINE.
+DEBUG EXPAND.
+!m 123 b
!m 2 3
!m '' 'b'.
-], [123 b / 5 / 3 b / '123 b'.
+])
+AT_CAPTURE_FILE([define.sps])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+123 b / 5 / 3 b / '123 b'.
+
2 3 / 3 / 3 / '2 3'.
-'' 'b' / 6 / 'b' / ''''' ''b'''.])
+
+'' 'b' / 6 / 'b' / ''''' ''b'''.
+])
+AT_CLEANUP
AT_SETUP([macro maximum nesting level (MNEST)])
AT_KEYWORDS([MNEST])
define.sps:1-3: inside the expansion of `!macro',
define.sps:1-3: inside the expansion of `!macro',
define.sps:1-3: inside the expansion of `!macro',
-define.sps:4: error: DEFINE: Maximum nesting level 50 exceeded. (Use SET MNEST to change the limit.)"
+define.sps:4.1-4.6: error: DEFINE: Maximum nesting level 50 exceeded. (Use SET MNEST to change the limit.)"
define.sps:4.1-4.6: error: Syntax error at `!macro' (in expansion of `!macro'): expecting command name.
])
])
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
define.sps:1-3: At `!x' in the expansion of `!for',
-define.sps:10: error: DEBUG EXPAND: Cannot use argument name or macro keyword
-as !DO variable.
+define.sps:10.1-10.12: error: DEBUG EXPAND: Cannot use argument name or macro
+keyword as !DO variable.
!DO 1 = 1 !TO 5 !var !DOEND.
define.sps:5-7: At `!noexpand' in the expansion of `!for2',
-define.sps:11: error: DEBUG EXPAND: Cannot use argument name or macro keyword
-as !DO variable.
+define.sps:11.1-11.13: error: DEBUG EXPAND: Cannot use argument name or macro
+keyword as !DO variable.
!DO !noexpand = 1 !TO 5 !var !DOEND.
])
In the expansion of `!DO',
define.sps:3-5: inside the expansion of `!for',
-define.sps:14: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum number
-of iterations 3. (Use SET MITERATE to change the limit.)
+define.sps:14.1-14.8: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum
+number of iterations 3. (Use SET MITERATE to change the limit.)
1 2 3 4.
In the expansion of `!DO',
define.sps:7-9: inside the expansion of `!forby',
-define.sps:15: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum number
-of iterations 3. (Use SET MITERATE to change the limit.)
+define.sps:15.1-15.12: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum
+number of iterations 3. (Use SET MITERATE to change the limit.)
1 2 3 4.
In the expansion of `!DO',
define.sps:7-9: inside the expansion of `!forby',
-define.sps:23: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum number
-of iterations 3. (Use SET MITERATE to change the limit.)
+define.sps:23.1-23.13: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum
+number of iterations 3. (Use SET MITERATE to change the limit.)
5 4 3 2.
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
In the expansion of `!DO',
define.sps:1-3: inside the expansion of `!for',
-define.sps:7: error: DEBUG EXPAND: !DO loop over list exceeded maximum number
-of iterations 2. (Use SET MITERATE to change the limit.)
+define.sps:7.1-7.11: error: DEBUG EXPAND: !DO loop over list exceeded maximum
+number of iterations 2. (Use SET MITERATE to change the limit.)
( (a) (b) ).
In the expansion of `!DO',
define.sps:1-3: inside the expansion of `!for',
-define.sps:8: error: DEBUG EXPAND: !DO loop over list exceeded maximum number
-of iterations 2. (Use SET MITERATE to change the limit.)
+define.sps:8.1-8.24: error: DEBUG EXPAND: !DO loop over list exceeded maximum
+number of iterations 2. (Use SET MITERATE to change the limit.)
( (foo) (bar) ).
])
AT_CHECK([pspp --testing-mode define.sps -O format=csv], [1], [dnl
"define.sps:1-3: At `!x' in the expansion of `!macro',
-define.sps:10: error: DEBUG EXPAND: Cannot use argument name or macro keyword ""!x"" as !LET variable."
+define.sps:10.1-10.10: error: DEBUG EXPAND: Cannot use argument name or macro keyword ""!x"" as !LET variable."
!LET 1 = 1
"define.sps:5-7: At `!do' in the expansion of `!macro2',
-define.sps:11: error: DEBUG EXPAND: Cannot use argument name or macro keyword ""!do"" as !LET variable."
+define.sps:11.1-11.7: error: DEBUG EXPAND: Cannot use argument name or macro keyword ""!do"" as !LET variable."
"define.sps:5-7: At `=' in the expansion of `!macro2',
-define.sps:11: error: DEBUG EXPAND: Expected macro variable name following !DO."
+define.sps:11.1-11.7: error: DEBUG EXPAND: Expected macro variable name following !DO."
!LET !do = x
])
])
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
define.sps:1: In the expansion of `!a',
-define.sps:18: error: DEBUG EXPAND: `@{:@' expected following !SUBSTR.
+define.sps:18.1-18.2: error: DEBUG EXPAND: `@{:@' expected following !SUBSTR.
!SUBSTR
define.sps:2: At `x' in the expansion of `!b',
-define.sps:19: error: DEBUG EXPAND: `@{:@' expected following !SUBSTR.
+define.sps:19.1-19.2: error: DEBUG EXPAND: `@{:@' expected following !SUBSTR.
!SUBSTR x
define.sps:3: At `x' in the expansion of `!c',
-define.sps:20: error: DEBUG EXPAND: `,' or `@:}@' expected in call to macro
+define.sps:20.1-20.2: error: DEBUG EXPAND: `,' or `@:}@' expected in call to macro
function !SUBSTR.
!SUBSTR(1 x)
define.sps:4: In the expansion of `!d',
-define.sps:21: error: DEBUG EXPAND: Missing `@:}@' in call to macro function !
-SUBSTR.
+define.sps:21.1-21.2: error: DEBUG EXPAND: Missing `@:}@' in call to macro
+function !SUBSTR.
!SUBSTR@{:@1
define.sps:5: In the expansion of `!narg_blanks',
-define.sps:22: error: DEBUG EXPAND: Macro function !BLANKS takes one argument
-(not 0).
+define.sps:22.1-22.12: error: DEBUG EXPAND: Macro function !BLANKS takes one
+argument (not 0).
!BLANKS( )
define.sps:6: In the expansion of `!narg_concat',
-define.sps:23: error: DEBUG EXPAND: Macro function !CONCAT needs at least one
-argument.
+define.sps:23.1-23.12: error: DEBUG EXPAND: Macro function !CONCAT needs at
+least one argument.
!CONCAT( )
define.sps:7: In the expansion of `!narg_eval',
-define.sps:24: error: DEBUG EXPAND: Macro function !EVAL takes one argument
-(not 0).
+define.sps:24.1-24.10: error: DEBUG EXPAND: Macro function !EVAL takes one
+argument (not 0).
!EVAL( )
define.sps:8: In the expansion of `!narg_head',
-define.sps:25: error: DEBUG EXPAND: Macro function !HEAD takes one argument
-(not 0).
+define.sps:25.1-25.10: error: DEBUG EXPAND: Macro function !HEAD takes one
+argument (not 0).
!HEAD( )
define.sps:9: In the expansion of `!narg_index',
-define.sps:26: error: DEBUG EXPAND: Macro function !INDEX takes two arguments
-(not 0).
+define.sps:26.1-26.11: error: DEBUG EXPAND: Macro function !INDEX takes two
+arguments (not 0).
!INDEX( )
define.sps:10: In the expansion of `!narg_length',
-define.sps:27: error: DEBUG EXPAND: Macro function !LENGTH takes one argument
-(not 0).
+define.sps:27.1-27.12: error: DEBUG EXPAND: Macro function !LENGTH takes one
+argument (not 0).
!LENGTH( )
( )
define.sps:12: In the expansion of `!narg_quote',
-define.sps:29: error: DEBUG EXPAND: Macro function !QUOTE takes one argument
-(not 0).
+define.sps:29.1-29.11: error: DEBUG EXPAND: Macro function !QUOTE takes one
+argument (not 0).
!QUOTE( )
define.sps:13: In the expansion of `!narg_substr',
-define.sps:30: error: DEBUG EXPAND: Macro function !SUBSTR takes two or three
-arguments (not 0).
+define.sps:30.1-30.12: error: DEBUG EXPAND: Macro function !SUBSTR takes two or
+three arguments (not 0).
!SUBSTR( )
define.sps:14: In the expansion of `!narg_tail',
-define.sps:31: error: DEBUG EXPAND: Macro function !TAIL takes one argument
-(not 0).
+define.sps:31.1-31.10: error: DEBUG EXPAND: Macro function !TAIL takes one
+argument (not 0).
!TAIL( )
define.sps:15: In the expansion of `!narg_unquote',
-define.sps:32: error: DEBUG EXPAND: Macro function !UNQUOTE takes one argument
-(not 0).
+define.sps:32.1-32.13: error: DEBUG EXPAND: Macro function !UNQUOTE takes one
+argument (not 0).
!UNQUOTE( )
define.sps:16: In the expansion of `!narg_upcase',
-define.sps:33: error: DEBUG EXPAND: Macro function !UPCASE takes one argument
-(not 0).
+define.sps:33.1-33.12: error: DEBUG EXPAND: Macro function !UPCASE takes one
+argument (not 0).
!UPCASE( )
])
])
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
define.sps:1: In the expansion of `!a',
-define.sps:5: error: DEBUG EXPAND: Argument to !BLANKS must be non-negative
-integer (not "x").
+define.sps:5.1-5.2: error: DEBUG EXPAND: Argument to !BLANKS must be non-
+negative integer (not "x").
!BLANKS(x).
define.sps:2: In the expansion of `!b',
-define.sps:6: error: DEBUG EXPAND: Second argument of !SUBSTR must be positive
-integer (not "y").
+define.sps:6.1-6.2: error: DEBUG EXPAND: Second argument of !SUBSTR must be
+positive integer (not "y").
!SUBSTR(x, y).
define.sps:3: In the expansion of `!c',
-define.sps:7: error: DEBUG EXPAND: Third argument of !SUBSTR must be non-
+define.sps:7.1-7.2: error: DEBUG EXPAND: Third argument of !SUBSTR must be non-
negative integer (not "z").
!SUBSTR(x, 1, z).
])
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
define.sps:1-2: At `.' in the expansion of `!a',
-define.sps:5: error: DEBUG EXPAND: Expecting ')' in macro expression.
+define.sps:5.1-5.2: error: DEBUG EXPAND: Expecting ')' in macro expression.
!LET !x = (1.
At `x' in the expansion of `!DO',
define.sps:2: inside the expansion of `!b',
-define.sps:6: error: DEBUG EXPAND: Macro expression must evaluate to a number
-(not "x").
+define.sps:6.1-6.2: error: DEBUG EXPAND: Macro expression must evaluate to a
+number (not "x").
!DO !x = x.
define.sps:3: At `)' in the expansion of `!c',
-define.sps:7: error: DEBUG EXPAND: Expecting literal or function invocation in
-macro expression.
+define.sps:7.1-7.2: error: DEBUG EXPAND: Expecting literal or function
+invocation in macro expression.
!LET !x = ( ).
])
])
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
define.sps:1: In the expansion of `!a',
-define.sps:5: error: DEBUG EXPAND: !THEN expected in macro !IF construct.
+define.sps:5.1-5.2: error: DEBUG EXPAND: !THEN expected in macro !IF construct.
!IF 1
define.sps:2: In the expansion of `!b',
-define.sps:6: error: DEBUG EXPAND: !ELSE or !IFEND expected in macro !IF
+define.sps:6.1-6.2: error: DEBUG EXPAND: !ELSE or !IFEND expected in macro !IF
construct.
!IF 1 !THEN
define.sps:3: In the expansion of `!c',
-define.sps:7: error: DEBUG EXPAND: !IFEND expected in macro !IF construct.
+define.sps:7.1-7.2: error: DEBUG EXPAND: !IFEND expected in macro !IF
+construct.
!IF 1 !THEN !ELSE
])
])
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
define.sps:1: In the expansion of `!a',
-define.sps:6: error: DEBUG EXPAND: Expected macro variable name following !LET.
+define.sps:6.1-6.2: error: DEBUG EXPAND: Expected macro variable name following
+!LET.
!LET
define.sps:2: At `0' in the expansion of `!b',
-define.sps:7: error: DEBUG EXPAND: Expected macro variable name following !LET.
+define.sps:7.1-7.2: error: DEBUG EXPAND: Expected macro variable name following
+!LET.
!LET 0
define.sps:3: In the expansion of `!c',
-define.sps:8: error: DEBUG EXPAND: Expected `=' following !LET.
+define.sps:8.1-8.2: error: DEBUG EXPAND: Expected `=' following !LET.
!LET !x
define.sps:4: At `y' in the expansion of `!d',
-define.sps:9: error: DEBUG EXPAND: Expected `=' following !LET.
+define.sps:9.1-9.2: error: DEBUG EXPAND: Expected `=' following !LET.
!LET !x y
])
])
AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
define.sps:1: In the expansion of `!a',
-define.sps:12: error: DEBUG EXPAND: Expected macro variable name following !DO.
+define.sps:12.1-12.2: error: DEBUG EXPAND: Expected macro variable name
+following !DO.
!DO
define.sps:2: At `0' in the expansion of `!b',
-define.sps:13: error: DEBUG EXPAND: Expected macro variable name following !DO.
+define.sps:13.1-13.2: error: DEBUG EXPAND: Expected macro variable name
+following !DO.
!DO 0
define.sps:3: In the expansion of `!c',
-define.sps:14: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
+define.sps:14.1-14.2: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
!DO !x
In the expansion of `!DO',
define.sps:4: inside the expansion of `!d',
-define.sps:15: error: DEBUG EXPAND: Missing !DOEND.
+define.sps:15.1-15.2: error: DEBUG EXPAND: Missing !DOEND.
!DO !x !in(x)
At `x' in the expansion of `!DO',
define.sps:5: inside the expansion of `!e',
-define.sps:16: error: DEBUG EXPAND: Macro expression must evaluate to a number
-(not "x").
+define.sps:16.1-16.2: error: DEBUG EXPAND: Macro expression must evaluate to a
+number (not "x").
!DO !x = x.
At `x' in the expansion of `!DO',
define.sps:6: inside the expansion of `!f',
-define.sps:17: error: DEBUG EXPAND: Expected !TO in numerical !DO loop.
+define.sps:17.1-17.2: error: DEBUG EXPAND: Expected !TO in numerical !DO loop.
!DO !x = 5 x
In the expansion of `!DO',
define.sps:7: inside the expansion of `!g',
-define.sps:18: error: DEBUG EXPAND: !BY value cannot be zero.
+define.sps:18.1-18.2: error: DEBUG EXPAND: !BY value cannot be zero.
!DO !x = 5 !TO 6 !BY 0
define.sps:8: In the expansion of `!h',
-define.sps:19: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
+define.sps:19.1-19.2: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
!DO !x
define.sps:9: At `0' in the expansion of `!i',
-define.sps:20: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
+define.sps:20.1-20.2: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
!DO !x 0
define.sps:10: At `!BREAK' in the expansion of `!j',
-define.sps:21: error: DEBUG EXPAND: !BREAK outside !DO.
+define.sps:21.1-21.2: error: DEBUG EXPAND: !BREAK outside !DO.
])
AT_CLEANUP
DEFINE !macro(x=!CHAREND('x' 9)) !ENDDEFINE.
DEFINE !macro(x=!WTF) !ENDDEFINE.
DEFINE !macro(x=!TOKENS(1) x) !ENDDEFINE.
+DEFINE !macro(x=!DEFAULT() !DEFAULT()) !ENDDEFINE.
+DEFINE !macro(x=!TOKENS(1) !CMDEND) !ENDDEFINE.
DEFINE !macro()
])
AT_CHECK([pspp define.sps], [1], [dnl
define.sps:21.28: error: DEFINE: Syntax error at `x': expecting `/'.
-define.sps:23.1: error: DEFINE: Syntax error at end of command: Expecting macro
+define.sps:22.36: error: DEFINE: Syntax error at `(': !DEFAULT is allowed only
+once per argument.
+
+define.sps:23.35: error: DEFINE: Syntax error at `)': Only one of !TOKENS, !
+CHAREND, !ENCLOSE, or !CMDEND is allowed.
+
+define.sps:25.1: error: DEFINE: Syntax error at end of command: Expecting macro
body or !ENDDEFINE.
])
+AT_CLEANUP
+
+AT_SETUP([macro expansion with token merging])
+AT_DATA([define.sps], [dnl
+DEFINE !foo() "foo" !ENDDEFINE.
+DEFINE !bar() "bar" !ENDDEFINE.
+DEFINE !plus() + !ENDDEFINE.
+DEFINE !minus() - !ENDDEFINE.
+DEFINE !one() 1 !ENDDEFINE.
+ECHO "foo" + "bar".
+ECHO !foo.
+ECHO !bar.
+ECHO !foo + "quux".
+ECHO "baz" + !bar.
+ECHO !foo + !bar.
+ECHO !foo !plus !bar.
+ECHO "two" "strings".
+N OF CASES -/**/1.
+N OF CASES !minus 1.
+N OF CASES - !one.
+N OF CASES !minus !one.
+])
+AT_CHECK([pspp define.sps], [1], [dnl
+foobar
+
+foo
+
+bar
+
+fooquux
+
+bazbar
+
+foobar
+
+foobar
+
+two
+
+define.sps:13.12-13.20: error: ECHO: Syntax error at `"strings"': expecting end
+of command.
+
+define.sps:14.12-14.17: error: N OF CASES: Syntax error at `-/**/1': Expected
+positive integer for N OF CASES.
+
+define.sps:15.12-15.19: error: N OF CASES: Syntax error at `!minus 1': Expected
+positive integer for N OF CASES.
+
+define.sps:16.12-16.17: error: N OF CASES: Syntax error at `- !one': Expected
+positive integer for N OF CASES.
+
+define.sps:17.12-17.22: error: N OF CASES: Syntax error at `!minus !one':
+Expected positive integer for N OF CASES.
+])
AT_CLEANUP
\ No newline at end of file