1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU nGeneral Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
19 AT_SETUP([simple macro expansion])
20 AT_DATA([define.sps], [dnl
28 "a" "b" "c" 'a' 'b' 'c'.
34 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
39 "a" "b" "c" 'a' 'b' 'c'.
44 AT_SETUP([macro expansion - one !TOKENS(1) positional argument])
46 AT_DATA([define.sps], [dnl
47 DEFINE !t1(!positional=!tokens(1)) t1 (!1) !ENDDEFINE.
53 AT_CAPTURE_FILE([define.sps])
54 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
61 note: unexpanded token "b"
65 AT_SETUP([macro expansion with positional arguments])
66 AT_DATA([define.sps], [dnl
67 DEFINE !title(!positional !tokens(1)) !1 !ENDDEFINE.
68 DEFINE !t1(!positional !tokens(1)) t1 (!1) !ENDDEFINE.
69 DEFINE !t2(!positional !tokens(2)) t2 (!1) !ENDDEFINE.
71 DEFINE !ce(!positional=!charend('/')) ce (!1) !ENDDEFINE.
72 DEFINE !ce2(!positional=!charend('(')
73 /!positional !charend(')'))
77 DEFINE !e(!positional !enclose('{','}')) e (!1) !ENDDEFINE.
79 DEFINE !cmd(!positional !cmdend) cmd(!1) !ENDDEFINE.
80 DEFINE !cmd2(!positional !cmdend
81 /!positional !tokens(1))
85 DEFINE !p(!positional !tokens(1)
86 /!positional !tokens(1)
87 /!positional !tokens(1))
92 !title "!TOKENS(1) argument."
97 !title "!TOKENS(2) argument."
101 !title "!CHAREND argument."
107 !title "Two !CHAREND arguments."
111 !title "!ENCLOSE argument."
116 !title "!CMDEND argument."
121 !title "Three !TOKENS(1) arguments."
125 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
126 "!TOKENS(1) argument."
134 note: unexpanded token "b"
136 "!TOKENS(2) argument."
142 note: unexpanded token "d"
154 "Two !CHAREND arguments."
174 "Three !TOKENS(1) arguments."
178 p(1, -2, -3) (1 -2 -3)
182 AT_SETUP([macro expansion with positional arguments - negative])
183 AT_DATA([define.sps], [dnl
184 DEFINE !title(!positional !tokens(1)) !1 !ENDDEFINE.
185 DEFINE !p(!positional !tokens(1)
186 /!positional !tokens(1)
187 /!positional !tokens(1))
191 DEFINE !ce(!positional !charend('/')) ce(!1) !ENDDEFINE.
193 DEFINE !enc1(!positional !enclose('{', '}')) enc1(!1) !ENDDEFINE.
195 !title "Too few tokens for !TOKENS."
200 !title "Missing charend delimiter."
203 !title "Missing start delimiter."
206 !title "Missing end delimiter."
209 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
210 "Too few tokens for !TOKENS."
212 define.sps:13.7: error: DEBUG EXPAND: Unexpected end of command reading
213 argument !3 to macro !p.
215 note: unexpanded token "!p"
217 note: unexpanded token "a"
219 note: unexpanded token "b"
221 define.sps:14.5: error: DEBUG EXPAND: Unexpected end of command reading
222 argument !2 to macro !p.
224 note: unexpanded token "!p"
226 note: unexpanded token "a"
228 define.sps:15.3: error: DEBUG EXPAND: Unexpected end of command reading
229 argument !1 to macro !p.
231 note: unexpanded token "!p"
233 "Missing charend delimiter."
235 define.sps:18.10: error: DEBUG EXPAND: Unexpected end of command reading
236 argument !1 to macro !ce.
238 note: unexpanded token "!ce"
240 note: unexpanded token "a"
242 note: unexpanded token "b"
244 note: unexpanded token "c"
246 "Missing start delimiter."
248 define.sps:21.7: error: DEBUG EXPAND: Found `a' while expecting `{' reading
249 argument !1 to macro !enc1.
251 note: unexpanded token "!enc1"
253 note: unexpanded token "a"
255 note: unexpanded token "b"
257 note: unexpanded token "c"
259 "Missing end delimiter."
261 define.sps:24.12: error: DEBUG EXPAND: Unexpected end of command reading
262 argument !1 to macro !enc1.
264 note: unexpanded token "!enc1"
266 note: unexpanded token "{"
268 note: unexpanded token "a"
270 note: unexpanded token "b"
272 note: unexpanded token "c"
276 AT_SETUP([keyword macro argument name with ! prefix])
277 AT_DATA([define.sps], [dnl
278 DEFINE !macro(!x !TOKENS(1).
280 AT_CHECK([pspp -O format=csv define.sps], [1], [dnl
281 "define.sps:1.15-1.16: error: DEFINE: Syntax error at `!x': Keyword macro parameter must be named in definition without ""!"" prefix."
285 AT_SETUP([reserved macro keyword argument name])
286 AT_DATA([define.sps], [dnl
287 DEFINE !macro(if=!TOKENS(1).
289 AT_CHECK([pspp -O format=csv define.sps], [1], [dnl
290 "define.sps:1.15-1.16: error: DEFINE: Syntax error at `if': Cannot use macro keyword ""if"" as an argument name."
294 AT_SETUP([macro expansion - one !TOKENS(1) keyword argument])
295 AT_KEYWORDS([TOKENS])
296 AT_DATA([define.sps], [dnl
297 DEFINE !k(arg1 = !TOKENS(1)) k(!arg1) !ENDDEFINE.
303 AT_CAPTURE_FILE([define.sps])
304 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
309 note: unexpanded token "y"
315 AT_SETUP([macro expansion - one !TOKENS(1) keyword argument - negative])
316 AT_KEYWORDS([TOKENS])
317 AT_DATA([define.sps], [dnl
318 DEFINE !k(arg1 !TOKENS(1)) k(!arg1) !ENDDEFINE.
323 AT_CAPTURE_FILE([define.sps])
324 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
325 define.sps:3.8: error: DEBUG EXPAND: Found `.' while expecting `=' reading
326 argument !arg1 to macro !k.
328 note: unexpanded token "!k"
330 note: unexpanded token "arg1"
332 define.sps:4.9: error: DEBUG EXPAND: Unexpected end of command reading argument
335 note: unexpanded token "!k"
337 note: unexpanded token "arg1"
339 note: unexpanded token "="
343 AT_SETUP([macro expansion - !CHAREND keyword arguments])
344 AT_KEYWORDS([CHAREND])
345 AT_DATA([define.sps], [dnl
346 DEFINE !k(arg1 = !CHAREND('/')
347 /arg2 = !CHAREND('/'))
356 AT_CAPTURE_FILE([define.sps])
357 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
368 AT_SETUP([macro expansion - !CHAREND keyword arguments - negative])
369 AT_KEYWORDS([CHAREND])
370 AT_DATA([define.sps], [dnl
371 DEFINE !k(arg1 = !CHAREND('/')
372 /arg2 = !CHAREND('/'))
381 AT_CAPTURE_FILE([define.sps])
382 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
383 define.sps:6.8: error: DEBUG EXPAND: Found `.' while expecting `=' reading
384 argument !arg1 to macro !k.
386 note: unexpanded token "!k"
388 note: unexpanded token "arg1"
390 define.sps:7.9: error: DEBUG EXPAND: Unexpected end of command reading argument
393 note: unexpanded token "!k"
395 note: unexpanded token "arg1"
397 note: unexpanded token "="
399 define.sps:8.10: error: DEBUG EXPAND: Unexpected end of command reading
400 argument !arg1 to macro !k.
402 note: unexpanded token "!k"
404 note: unexpanded token "arg1"
406 note: unexpanded token "="
408 note: unexpanded token "x"
410 define.sps:9.18: error: DEBUG EXPAND: Unexpected end of command reading
411 argument !arg2 to macro !k.
413 note: unexpanded token "!k"
415 note: unexpanded token "arg1"
417 note: unexpanded token "="
419 note: unexpanded token "x"
421 note: unexpanded token "/"
423 note: unexpanded token "arg2"
425 note: unexpanded token "="
427 note: unexpanded token "y"
431 AT_SETUP([macro expansion - !ENCLOSE keyword arguments])
432 AT_KEYWORDS([ENCLOSE])
433 AT_DATA([define.sps], [dnl
434 DEFINE !k(arg1 = !ENCLOSE('(',')')
435 /arg2 = !ENCLOSE('{','}'))
439 !k arg1=(x) arg2={y}.
444 AT_CAPTURE_FILE([define.sps])
445 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
456 AT_SETUP([macro expansion - !ENCLOSE keyword arguments - negative])
457 AT_KEYWORDS([ENCLOSE])
458 AT_DATA([define.sps], [dnl
459 DEFINE !k(arg1 = !ENCLOSE('(',')')
460 /arg2 = !ENCLOSE('{','}'))
473 AT_CAPTURE_FILE([define.sps])
474 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
475 define.sps:6.8: error: DEBUG EXPAND: Found `.' while expecting `=' reading
476 argument !arg1 to macro !k.
478 note: unexpanded token "!k"
480 note: unexpanded token "arg1"
482 define.sps:7.9: error: DEBUG EXPAND: Found `.' while expecting `@{:@' reading
483 argument !arg1 to macro !k.
485 note: unexpanded token "!k"
487 note: unexpanded token "arg1"
489 note: unexpanded token "="
491 define.sps:8.9: error: DEBUG EXPAND: Found `x' while expecting `@{:@' reading
492 argument !arg1 to macro !k.
494 note: unexpanded token "!k"
496 note: unexpanded token "arg1"
498 note: unexpanded token "="
500 note: unexpanded token "x"
502 define.sps:9.11: error: DEBUG EXPAND: Unexpected end of command reading
503 argument !arg1 to macro !k.
505 note: unexpanded token "!k"
507 note: unexpanded token "arg1"
509 note: unexpanded token "="
511 note: unexpanded token "@{:@"
513 note: unexpanded token "x"
515 define.sps:10.17: error: DEBUG EXPAND: Found `.' while expecting `=' reading
516 argument !arg2 to macro !k.
518 note: unexpanded token "!k"
520 note: unexpanded token "arg1"
522 note: unexpanded token "="
524 note: unexpanded token "@{:@"
526 note: unexpanded token "x"
528 note: unexpanded token "@:}@"
530 note: unexpanded token "arg2"
532 define.sps:11.18: error: DEBUG EXPAND: Found `.' while expecting `{' reading
533 argument !arg2 to macro !k.
535 note: unexpanded token "!k"
537 note: unexpanded token "arg1"
539 note: unexpanded token "="
541 note: unexpanded token "@{:@"
543 note: unexpanded token "x"
545 note: unexpanded token "@:}@"
547 note: unexpanded token "arg2"
549 note: unexpanded token "="
551 define.sps:12.18: error: DEBUG EXPAND: Found `y' while expecting `{' reading
552 argument !arg2 to macro !k.
554 note: unexpanded token "!k"
556 note: unexpanded token "arg1"
558 note: unexpanded token "="
560 note: unexpanded token "@{:@"
562 note: unexpanded token "x"
564 note: unexpanded token "@:}@"
566 note: unexpanded token "arg2"
568 note: unexpanded token "="
570 note: unexpanded token "y"
572 define.sps:13.18: error: DEBUG EXPAND: Found `@{:@' while expecting `{' reading
573 argument !arg2 to macro !k.
575 note: unexpanded token "!k"
577 note: unexpanded token "arg1"
579 note: unexpanded token "="
581 note: unexpanded token "@{:@"
583 note: unexpanded token "x"
585 note: unexpanded token "@:}@"
587 note: unexpanded token "arg2"
589 note: unexpanded token "="
591 note: unexpanded token "@{:@"
593 note: unexpanded token "y"
597 dnl Keep this test in sync with the examples for !BLANKS in the manual.
598 AT_SETUP([macro expansion - !BLANKS])
599 AT_KEYWORDS([BLANKS])
600 AT_DATA([define.sps], [dnl
614 AT_CAPTURE_FILE([define.sps])
615 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
627 dnl Keep this test in sync with the examples for !CONCAT in the manual.
628 AT_SETUP([macro expansion - !CONCAT])
629 AT_KEYWORDS([CONCAT])
630 AT_DATA([define.sps], [dnl
644 AT_CAPTURE_FILE([define.sps])
645 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
657 dnl Keep this test in sync with the examples for !EVAL in the manual.
658 AT_SETUP([macro expansion - !EVAL])
660 AT_DATA([define.sps], [dnl
661 DEFINE !vars() a b c !ENDDEFINE.
667 !QUOTE(!EVAL(!vars)).
670 DEFINE !e2(!positional !enclose('(',')'))
680 AT_CAPTURE_FILE([define.sps])
681 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
694 dnl Keep this test in sync with the examples for !HEAD in the manual.
695 AT_SETUP([macro expansion - !HEAD])
697 AT_DATA([define.sps], [dnl
707 AT_CAPTURE_FILE([define.sps])
708 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
716 dnl Keep this test in sync with the examples for !TAIL in the manual.
717 AT_SETUP([macro expansion - !TAIL])
719 AT_DATA([define.sps], [dnl
729 AT_CAPTURE_FILE([define.sps])
730 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
738 dnl Keep this test in sync with the examples for !INDEX in the manual.
739 AT_SETUP([macro expansion - !INDEX])
741 AT_DATA([define.sps], [dnl
745 !INDEX(banana, apple).
746 !INDEX("banana", nan).
747 !INDEX("banana", "nan").
748 !INDEX(!UNQUOTE("banana"), !UNQUOTE("nan")).
753 AT_CAPTURE_FILE([define.sps])
754 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
764 dnl Keep this test in sync with the examples for !LENGTH in the manual.
765 AT_SETUP([macro expansion - !LENGTH])
766 AT_KEYWORDS([LENGTH])
767 AT_DATA([define.sps], [dnl
776 !LENGTH(!UNQUOTE("xyzzy")).
777 !LENGTH(!UNQUOTE("xy""zzy")).
780 DEFINE !la(!positional !enclose('(',')'))
788 AT_CAPTURE_FILE([define.sps])
789 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
807 dnl Keep this test in sync with the examples for !SUBSTR in the manual.
808 AT_SETUP([macro expansion - !SUBSTR])
809 AT_KEYWORDS([SUBSTR])
810 AT_DATA([define.sps], [dnl
813 !SUBSTR(banana, 3, 3).
814 !SUBSTR("banana", 1, 3).
815 !SUBSTR(!UNQUOTE("banana"), 3).
816 !SUBSTR("banana", 3, 3).
817 !SUBSTR(banana, 3, 0).
818 !SUBSTR(banana, 3, 10).
819 !SUBSTR(banana, 10, 3).
824 AT_CAPTURE_FILE([define.sps])
825 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
826 define.sps:1-10: At `"ba' in the expansion of `!s',dnl "
828 define.sps:12.1-12.2: error: DEBUG EXPAND: Unterminated string constant.
841 dnl Keep this test in sync with the examples for !UPCASE in the manual.
842 AT_SETUP([macro expansion - !UPCASE])
843 AT_KEYWORDS([UPCASE])
844 AT_DATA([define.sps], [dnl
854 AT_CAPTURE_FILE([define.sps])
855 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
863 dnl !* is implemented separately inside and outside function arguments
864 dnl so this test makes sure to include both.
865 AT_SETUP([macro expansion - !*])
866 AT_DATA([define.sps], [dnl
867 DEFINE !m(!POSITIONAL !TOKENS(1)
868 /!POSITIONAL !TOKENS(1))
879 AT_CAPTURE_FILE([define.sps])
880 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
881 123 b / 5 / 3 b / '123 b'.
885 '' 'b' / 6 / 'b' / ''''' ''b'''.
889 AT_SETUP([macro maximum nesting level (MNEST)])
891 AT_DATA([define.sps], [dnl
897 AT_CHECK([pspp -O format=csv define.sps], [1], [dnl
898 "define.sps:1-3: In the expansion of `!macro',
899 define.sps:1-3: inside the expansion of `!macro',
900 define.sps:1-3: inside the expansion of `!macro',
901 define.sps:1-3: inside the expansion of `!macro',
902 define.sps:1-3: inside the expansion of `!macro',
903 define.sps:1-3: inside the expansion of `!macro',
904 define.sps:1-3: inside the expansion of `!macro',
905 define.sps:1-3: inside the expansion of `!macro',
906 define.sps:1-3: inside the expansion of `!macro',
907 define.sps:1-3: inside the expansion of `!macro',
908 define.sps:1-3: inside the expansion of `!macro',
909 define.sps:1-3: inside the expansion of `!macro',
910 define.sps:1-3: inside the expansion of `!macro',
911 define.sps:1-3: inside the expansion of `!macro',
912 define.sps:1-3: inside the expansion of `!macro',
913 define.sps:1-3: inside the expansion of `!macro',
914 define.sps:1-3: inside the expansion of `!macro',
915 define.sps:1-3: inside the expansion of `!macro',
916 define.sps:1-3: inside the expansion of `!macro',
917 define.sps:1-3: inside the expansion of `!macro',
918 define.sps:1-3: inside the expansion of `!macro',
919 define.sps:1-3: inside the expansion of `!macro',
920 define.sps:1-3: inside the expansion of `!macro',
921 define.sps:1-3: inside the expansion of `!macro',
922 define.sps:1-3: inside the expansion of `!macro',
923 define.sps:1-3: inside the expansion of `!macro',
924 define.sps:1-3: inside the expansion of `!macro',
925 define.sps:1-3: inside the expansion of `!macro',
926 define.sps:1-3: inside the expansion of `!macro',
927 define.sps:1-3: inside the expansion of `!macro',
928 define.sps:1-3: inside the expansion of `!macro',
929 define.sps:1-3: inside the expansion of `!macro',
930 define.sps:1-3: inside the expansion of `!macro',
931 define.sps:1-3: inside the expansion of `!macro',
932 define.sps:1-3: inside the expansion of `!macro',
933 define.sps:1-3: inside the expansion of `!macro',
934 define.sps:1-3: inside the expansion of `!macro',
935 define.sps:1-3: inside the expansion of `!macro',
936 define.sps:1-3: inside the expansion of `!macro',
937 define.sps:1-3: inside the expansion of `!macro',
938 define.sps:1-3: inside the expansion of `!macro',
939 define.sps:1-3: inside the expansion of `!macro',
940 define.sps:1-3: inside the expansion of `!macro',
941 define.sps:1-3: inside the expansion of `!macro',
942 define.sps:1-3: inside the expansion of `!macro',
943 define.sps:1-3: inside the expansion of `!macro',
944 define.sps:1-3: inside the expansion of `!macro',
945 define.sps:1-3: inside the expansion of `!macro',
946 define.sps:1-3: inside the expansion of `!macro',
947 define.sps:1-3: inside the expansion of `!macro',
948 define.sps:1-3: inside the expansion of `!macro',
949 define.sps:4.1-4.6: error: DEFINE: Maximum nesting level 50 exceeded. (Use SET MNEST to change the limit.)"
951 define.sps:4.1-4.6: error: Syntax error at `!macro' (in expansion of `!macro'): expecting command name.
955 AT_SETUP([macro !IF condition])
958 '!eq !ne !lt !gt !le !ge' \
963 cat > define.sps <<EOF
964 DEFINE !test(!positional !tokens(1))
965 !if (!1 $1 1) !then true !else false !ifend
966 !if (!1 $2 1) !then true !else false !ifend
967 !if (!1 $3 1) !then true !else false !ifend
968 !if (!1 $4 1) !then true !else false !ifend
969 !if (!1 $5 1) !then true !else false !ifend
970 !if (!1 $6 1) !then true !else false !ifend.
979 AT_CAPTURE_FILE([define.sps])
980 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
981 false true true false true false.
983 true false false false true true.
985 false true false true false true.
987 true false false false true true.
989 false true false true false true.
994 AT_SETUP([macro !IF condition -- case sensitivity])
997 '!eq !ne !lt !gt !le !ge' \
1001 AS_BOX([$operators])
1002 cat > define.sps <<EOF
1003 DEFINE !test(!positional !tokens(1))
1004 !if (!1 $1 a) !then true !else false !ifend
1005 !if (!1 $1 A) !then true !else false !ifend
1006 !if (!1 $2 a) !then true !else false !ifend
1007 !if (!1 $2 A) !then true !else false !ifend
1008 !if (!1 $3 a) !then true !else false !ifend
1009 !if (!1 $3 A) !then true !else false !ifend
1010 !if (!1 $4 a) !then true !else false !ifend
1011 !if (!1 $4 A) !then true !else false !ifend
1012 !if (!1 $5 a) !then true !else false !ifend
1013 !if (!1 $5 A) !then true !else false !ifend
1014 !if (!1 $6 a) !then true !else false !ifend
1015 !if (!1 $6 A) !then true !else false !ifend
1016 !if (!1 $1 !null) !then true !else false !ifend
1017 !if (!1 $2 !null) !then true !else false !ifend.
1025 AT_CAPTURE_FILE([define.sps])
1026 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1027 true false false true false false false true true false true true false true.
1029 false true true false true false false false true true false true false true.
1031 false false true true false false true true false false true true false true.
1033 false false true true true false false true true false false true false true.
1038 AT_SETUP([macro !IF condition -- logical operators])
1045 AS_BOX([$operators])
1046 cat > define.sps <<EOF
1047 DEFINE !test_binary(!positional !tokens(1)/!positional !tokens(1))
1048 !if !1 $1 !2 !then true !else false !ifend
1049 !if !1 $2 !2 !then true !else false !ifend.
1052 DEFINE !test_unary(!positional !tokens(1))
1053 !if $3 !1 !then true !else false !ifend.
1057 ((not A) and B) or C
1060 DEFINE !test_prec(!pos !tokens(1)/!pos !tokens(1)/!pos !tokens(1))
1061 !if $3 !1 $1 !2 $2 !3 !then true !else false !ifend
1062 !if $3 (!1 $1 !2) $2 !3 !then true !else false !ifend
1063 !if $3 !1 $1 (!2 $2 !3) !then true !else false !ifend
1073 !test_prec 0 0 0 !test_prec 0 0 1 !test_prec 0 1 0 !test_prec 0 1 1.
1074 !test_prec 1 0 0 !test_prec 1 0 1 !test_prec 1 1 0 !test_prec 1 1 1.
1076 AT_CAPTURE_FILE([define.sps])
1077 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1103 AT_SETUP([macro !LET])
1105 AT_DATA([define.sps], [dnl
1106 DEFINE !macro(!POS !CMDEND)
1107 !LET !v1 = !CONCAT('x',!1,'y')
1108 !LET !v2 = !QUOTE(!v1)
1109 !LET !v3 = (!LENGTH(!1) = 1)
1110 !LET !v4 = (!SUBSTR(!1, 3) = !NULL)
1121 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1139 AT_SETUP([macro indexed !DO])
1140 AT_KEYWORDS([index do])
1141 AT_DATA([define.sps], [dnl
1142 DEFINE !title(!POS !TOKENS(1)) !1. !ENDDEFINE.
1144 DEFINE !for(!POS !TOKENS(1) / !POS !TOKENS(1))
1145 !DO !var = !1 !TO !2 !var !DOEND.
1148 DEFINE !forby(!POS !TOKENS(1) / !POS !TOKENS(1) / !POS !TOKENS(1))
1149 !DO !var = !1 !TO !2 !BY !3 !var !DOEND.
1153 !title "increasing".
1160 !title "decreasing".
1167 !title "non-integer".
1170 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1201 AT_SETUP([macro !DO invalid variable names])
1202 AT_KEYWORDS([index do])
1203 AT_DATA([define.sps], [dnl
1204 DEFINE !for(x=!TOKENS(1) / y=!TOKENS(1))
1205 !DO !x = !x !TO !y !var !DOEND.
1208 DEFINE !for2(x=!TOKENS(1) / y=!TOKENS(1))
1209 !DO !noexpand = !x !TO !y !var !DOEND.
1216 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1217 define.sps:1-3: At `!x' in the expansion of `!for',
1218 define.sps:10.1-10.12: error: DEBUG EXPAND: Cannot use argument name or macro
1219 keyword as !DO variable.
1221 !DO 1 = 1 !TO 5 !var !DOEND.
1223 define.sps:5-7: At `!noexpand' in the expansion of `!for2',
1224 define.sps:11.1-11.13: error: DEBUG EXPAND: Cannot use argument name or macro
1225 keyword as !DO variable.
1227 !DO !noexpand = 1 !TO 5 !var !DOEND.
1231 AT_SETUP([macro indexed !DO reaches MITERATE])
1232 AT_KEYWORDS([index do])
1233 AT_DATA([define.sps], [dnl
1234 DEFINE !title(!POS !TOKENS(1)) !1. !ENDDEFINE.
1236 DEFINE !for(!POS !TOKENS(1) / !POS !TOKENS(1))
1237 !DO !var = !1 !TO !2 !var !DOEND.
1240 DEFINE !forby(!POS !TOKENS(1) / !POS !TOKENS(1) / !POS !TOKENS(1))
1241 !DO !var = !1 !TO !2 !BY !3 !var !DOEND.
1246 !title "increasing".
1253 !title "decreasing".
1260 !title "non-integer".
1263 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1266 In the expansion of `!DO',
1267 define.sps:3-5: inside the expansion of `!for',
1268 define.sps:14.1-14.8: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum
1269 number of iterations 3. (Use SET MITERATE to change the limit.)
1273 In the expansion of `!DO',
1274 define.sps:7-9: inside the expansion of `!forby',
1275 define.sps:15.1-15.12: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum
1276 number of iterations 3. (Use SET MITERATE to change the limit.)
1292 In the expansion of `!DO',
1293 define.sps:7-9: inside the expansion of `!forby',
1294 define.sps:23.1-23.13: error: DEBUG EXPAND: Numerical !DO loop exceeded maximum
1295 number of iterations 3. (Use SET MITERATE to change the limit.)
1309 AT_SETUP([!BREAK with macro indexed !DO])
1310 AT_KEYWORDS([index do break])
1311 AT_DATA([define.sps], [dnl
1312 DEFINE !title(!POS !TOKENS(1)) !1. !ENDDEFINE.
1314 DEFINE !for(!POS !TOKENS(1) / !POS !TOKENS(1) / !POS !TOKENS(1))
1315 !DO !var = !1 !TO !2
1331 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1336 AT_SETUP([macro list !DO])
1337 AT_KEYWORDS([index do])
1338 AT_DATA([define.sps], [dnl
1339 DEFINE !for(!POS !CMDEND)
1340 (!DO !i !IN (!1) (!i) !DOEND).
1345 !for 'foo bar baz quux'.
1348 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1351 ( (foo) (bar) (baz) (quux) ).
1357 AT_SETUP([macro list !DO reaches MITERATE])
1358 AT_KEYWORDS([index do])
1359 AT_DATA([define.sps], [dnl
1360 DEFINE !for(!POS !CMDEND)
1361 (!DO !i !IN (!1) (!i) !DOEND).
1367 !for 'foo bar baz quux'.
1370 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1371 In the expansion of `!DO',
1372 define.sps:1-3: inside the expansion of `!for',
1373 define.sps:7.1-7.11: error: DEBUG EXPAND: !DO loop over list exceeded maximum
1374 number of iterations 2. (Use SET MITERATE to change the limit.)
1378 In the expansion of `!DO',
1379 define.sps:1-3: inside the expansion of `!for',
1380 define.sps:8.1-8.24: error: DEBUG EXPAND: !DO loop over list exceeded maximum
1381 number of iterations 2. (Use SET MITERATE to change the limit.)
1389 AT_SETUP([!BREAK with macro list !DO])
1390 AT_KEYWORDS([index break do])
1391 AT_DATA([define.sps], [dnl
1392 DEFINE !for(!POS !TOKENS(1) / !POS !CMDEND)
1408 !for baz 'foo bar baz quux'.
1411 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1414 ( (foo), (bar), (baz)x).
1420 AT_SETUP([macro !LET])
1421 AT_DATA([define.sps], [dnl
1422 DEFINE !macro(!pos !enclose('(',')'))
1433 AT_CHECK([pspp --testing-mode define.sps -O format=csv], [0], [dnl
1440 AT_SETUP([macro !LET invalid variable names])
1441 AT_DATA([define.sps], [dnl
1442 DEFINE !macro(x=!tokens(1))
1454 AT_CHECK([pspp --testing-mode define.sps -O format=csv], [1], [dnl
1455 "define.sps:1-3: At `!x' in the expansion of `!macro',
1456 define.sps:10.1-10.10: error: DEBUG EXPAND: Cannot use argument name or macro keyword ""!x"" as !LET variable."
1460 "define.sps:5-7: At `!do' in the expansion of `!macro2',
1461 define.sps:11.1-11.7: error: DEBUG EXPAND: Cannot use argument name or macro keyword ""!do"" as !LET variable."
1463 "define.sps:5-7: At `=' in the expansion of `!macro2',
1464 define.sps:11.1-11.7: error: DEBUG EXPAND: Expected macro variable name following !DO."
1470 AT_SETUP([BEGIN DATA inside a macro])
1471 AT_DATA([define.sps], [dnl
1473 DATA LIST NOTABLE /x 1.
1484 AT_CHECK([pspp define.sps -O format=csv], [0], [dnl
1493 AT_SETUP([TITLE and SUBTITLE with macros])
1494 AT_KEYWORDS([macro])
1495 for command in TITLE SUBTITLE; do
1496 cat >title.sps <<EOF
1497 DEFINE !paste(!POS !TOKENS(1) / !POS !TOKENS(1))
1500 $command prefix !paste foo bar suffix.
1504 title.sps:5: note: SHOW: $command is prefix foobar suffix.
1506 AT_CHECK([pspp -O format=csv title.sps], [0], [expout])
1510 AT_SETUP([error message within macro expansion])
1511 AT_DATA([define.sps], [dnl
1512 DEFINE !vars(!POS !TOKENS(1)) a b C !ENDDEFINE.
1513 DATA LIST NOTABLE /a b 1-2.
1514 COMPUTE x = !vars x.
1516 AT_CHECK([pspp -O format=csv define.sps], [1], [dnl
1517 define.sps:3.13-3.19: error: COMPUTE: Syntax error at `b' (in expansion of `!vars x'): expecting end of command.
1521 dnl A macro with keyword arguments needs a token of lookahead
1522 dnl to find out whether another keyword is present. Test that
1523 dnl this special case works OK.
1524 AT_SETUP([macro calls in each others' lookahead])
1525 AT_DATA([define.sps], [dnl
1526 DEFINE !k(x=!DEFAULT(0) !TOKENS(1)/y=!DEFAULT(0) !TOKENS(1))
1536 AT_CHECK([pspp -O format=csv define.sps --testing-mode], [0], [dnl
1548 AT_SETUP([bad token in macro body])
1549 AT_DATA([define.sps], [dnl
1554 AT_CHECK([pspp define.sps], [1], [dnl
1555 define.sps:3: error: DEFINE: String of hex digits has 3 characters, which is
1556 not a multiple of 2.
1560 AT_SETUP([generic macro function syntax errors])
1561 AT_DATA([define.sps], [dnl
1562 DEFINE !a() !SUBSTR !ENDDEFINE.
1563 DEFINE !b() !SUBSTR x !ENDDEFINE.
1564 DEFINE !c() !SUBSTR(1x) !ENDDEFINE.
1565 DEFINE !d() !SUBSTR(1 !ENDDEFINE.
1566 DEFINE !narg_blanks() !BLANKS() !ENDDEFINE.
1567 DEFINE !narg_concat() !CONCAT() !ENDDEFINE.
1568 DEFINE !narg_eval() !EVAL() !ENDDEFINE.
1569 DEFINE !narg_head() !HEAD() !ENDDEFINE.
1570 DEFINE !narg_index() !INDEX() !ENDDEFINE.
1571 DEFINE !narg_length() !LENGTH() !ENDDEFINE.
1572 DEFINE !narg_null() !NULL() !ENDDEFINE.
1573 DEFINE !narg_quote() !QUOTE() !ENDDEFINE.
1574 DEFINE !narg_substr() !SUBSTR() !ENDDEFINE.
1575 DEFINE !narg_tail() !TAIL() !ENDDEFINE.
1576 DEFINE !narg_unquote() !UNQUOTE() !ENDDEFINE.
1577 DEFINE !narg_upcase() !UPCASE() !ENDDEFINE.
1597 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1598 define.sps:1: In the expansion of `!a',
1599 define.sps:18.1-18.2: error: DEBUG EXPAND: `@{:@' expected following !SUBSTR.
1603 define.sps:2: At `x' in the expansion of `!b',
1604 define.sps:19.1-19.2: error: DEBUG EXPAND: `@{:@' expected following !SUBSTR.
1608 define.sps:3: At `x' in the expansion of `!c',
1609 define.sps:20.1-20.2: error: DEBUG EXPAND: `,' or `@:}@' expected in call to macro
1614 define.sps:4: In the expansion of `!d',
1615 define.sps:21.1-21.2: error: DEBUG EXPAND: Missing `@:}@' in call to macro
1620 define.sps:5: In the expansion of `!narg_blanks',
1621 define.sps:22.1-22.12: error: DEBUG EXPAND: Macro function !BLANKS takes one
1626 define.sps:6: In the expansion of `!narg_concat',
1627 define.sps:23.1-23.12: error: DEBUG EXPAND: Macro function !CONCAT needs at
1632 define.sps:7: In the expansion of `!narg_eval',
1633 define.sps:24.1-24.10: error: DEBUG EXPAND: Macro function !EVAL takes one
1638 define.sps:8: In the expansion of `!narg_head',
1639 define.sps:25.1-25.10: error: DEBUG EXPAND: Macro function !HEAD takes one
1644 define.sps:9: In the expansion of `!narg_index',
1645 define.sps:26.1-26.11: error: DEBUG EXPAND: Macro function !INDEX takes two
1650 define.sps:10: In the expansion of `!narg_length',
1651 define.sps:27.1-27.12: error: DEBUG EXPAND: Macro function !LENGTH takes one
1658 define.sps:12: In the expansion of `!narg_quote',
1659 define.sps:29.1-29.11: error: DEBUG EXPAND: Macro function !QUOTE takes one
1664 define.sps:13: In the expansion of `!narg_substr',
1665 define.sps:30.1-30.12: error: DEBUG EXPAND: Macro function !SUBSTR takes two or
1666 three arguments (not 0).
1670 define.sps:14: In the expansion of `!narg_tail',
1671 define.sps:31.1-31.10: error: DEBUG EXPAND: Macro function !TAIL takes one
1676 define.sps:15: In the expansion of `!narg_unquote',
1677 define.sps:32.1-32.13: error: DEBUG EXPAND: Macro function !UNQUOTE takes one
1682 define.sps:16: In the expansion of `!narg_upcase',
1683 define.sps:33.1-33.12: error: DEBUG EXPAND: Macro function !UPCASE takes one
1690 AT_SETUP([specific macro function syntax errors])
1691 AT_DATA([define.sps], [dnl
1692 DEFINE !a() !BLANKS(x). !ENDDEFINE.
1693 DEFINE !b() !SUBSTR(x, y). !ENDDEFINE.
1694 DEFINE !c() !SUBSTR(x, 1, z). !ENDDEFINE.
1700 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1701 define.sps:1: In the expansion of `!a',
1702 define.sps:5.1-5.2: error: DEBUG EXPAND: Argument to !BLANKS must be non-
1703 negative integer (not "x").
1707 define.sps:2: In the expansion of `!b',
1708 define.sps:6.1-6.2: error: DEBUG EXPAND: Second argument of !SUBSTR must be
1709 positive integer (not "y").
1713 define.sps:3: In the expansion of `!c',
1714 define.sps:7.1-7.2: error: DEBUG EXPAND: Third argument of !SUBSTR must be non-
1715 negative integer (not "z").
1721 AT_SETUP([macro expression errors])
1722 AT_DATA([define.sps], [dnl
1723 DEFINE !a() !LET !x = (1. !ENDDEFINE dnl )
1725 DEFINE !b() !DO !x = x. !ENDDEFINE.
1726 DEFINE !c() !LET !x = (). !ENDDEFINE.
1732 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1733 define.sps:1-2: At `.' in the expansion of `!a',
1734 define.sps:5.1-5.2: error: DEBUG EXPAND: Expecting ')' in macro expression.
1738 At `x' in the expansion of `!DO',
1739 define.sps:2: inside the expansion of `!b',
1740 define.sps:6.1-6.2: error: DEBUG EXPAND: Macro expression must evaluate to a
1745 define.sps:3: At `)' in the expansion of `!c',
1746 define.sps:7.1-7.2: error: DEBUG EXPAND: Expecting literal or function
1747 invocation in macro expression.
1753 AT_SETUP([macro !IF errors])
1755 AT_DATA([define.sps], [dnl
1756 DEFINE !a() !IF 1 !ENDDEFINE.
1757 DEFINE !b() !IF 1 !THEN !ENDDEFINE.
1758 DEFINE !c() !IF 1 !THEN !ELSE !ENDDEFINE.
1764 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1765 define.sps:1: In the expansion of `!a',
1766 define.sps:5.1-5.2: error: DEBUG EXPAND: !THEN expected in macro !IF construct.
1770 define.sps:2: In the expansion of `!b',
1771 define.sps:6.1-6.2: error: DEBUG EXPAND: !ELSE or !IFEND expected in macro !IF
1776 define.sps:3: In the expansion of `!c',
1777 define.sps:7.1-7.2: error: DEBUG EXPAND: !IFEND expected in macro !IF
1784 AT_SETUP([macro !LET errors])
1786 AT_DATA([define.sps], [dnl
1787 DEFINE !a() !LET !ENDDEFINE.
1788 DEFINE !b() !LET 0 !ENDDEFINE.
1789 DEFINE !c() !LET !x !ENDDEFINE.
1790 DEFINE !d() !LET !x y !ENDDEFINE.
1797 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1798 define.sps:1: In the expansion of `!a',
1799 define.sps:6.1-6.2: error: DEBUG EXPAND: Expected macro variable name following
1804 define.sps:2: At `0' in the expansion of `!b',
1805 define.sps:7.1-7.2: error: DEBUG EXPAND: Expected macro variable name following
1810 define.sps:3: In the expansion of `!c',
1811 define.sps:8.1-8.2: error: DEBUG EXPAND: Expected `=' following !LET.
1815 define.sps:4: At `y' in the expansion of `!d',
1816 define.sps:9.1-9.2: error: DEBUG EXPAND: Expected `=' following !LET.
1822 AT_SETUP([macro !DO errors])
1824 AT_DATA([define.sps], [dnl
1825 DEFINE !a() !DO !ENDDEFINE.
1826 DEFINE !b() !DO 0 !ENDDEFINE.
1827 DEFINE !c() !DO !x !ENDDEFINE.
1828 DEFINE !d() !DO !x !in (x) !ENDDEFINE.
1829 DEFINE !e() !DO !x = x. !ENDDEFINE.
1830 DEFINE !f() !DO !x = 5 x !ENDDEFINE.
1831 DEFINE !g() !DO !x = 5 !TO 6 !BY 0 !ENDDEFINE.
1832 DEFINE !h() !DO !x !ENDDEFINE.
1833 DEFINE !i() !DO !x 0 !ENDDEFINE.
1834 DEFINE !j() !BREAK !ENDDEFINE.
1847 AT_CHECK([pspp --testing-mode define.sps], [1], [dnl
1848 define.sps:1: In the expansion of `!a',
1849 define.sps:12.1-12.2: error: DEBUG EXPAND: Expected macro variable name
1854 define.sps:2: At `0' in the expansion of `!b',
1855 define.sps:13.1-13.2: error: DEBUG EXPAND: Expected macro variable name
1860 define.sps:3: In the expansion of `!c',
1861 define.sps:14.1-14.2: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
1865 In the expansion of `!DO',
1866 define.sps:4: inside the expansion of `!d',
1867 define.sps:15.1-15.2: error: DEBUG EXPAND: Missing !DOEND.
1871 At `x' in the expansion of `!DO',
1872 define.sps:5: inside the expansion of `!e',
1873 define.sps:16.1-16.2: error: DEBUG EXPAND: Macro expression must evaluate to a
1878 At `x' in the expansion of `!DO',
1879 define.sps:6: inside the expansion of `!f',
1880 define.sps:17.1-17.2: error: DEBUG EXPAND: Expected !TO in numerical !DO loop.
1884 In the expansion of `!DO',
1885 define.sps:7: inside the expansion of `!g',
1886 define.sps:18.1-18.2: error: DEBUG EXPAND: !BY value cannot be zero.
1888 !DO !x = 5 !TO 6 !BY 0
1890 define.sps:8: In the expansion of `!h',
1891 define.sps:19.1-19.2: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
1895 define.sps:9: At `0' in the expansion of `!i',
1896 define.sps:20.1-20.2: error: DEBUG EXPAND: Expected `=' or !IN in !DO loop.
1900 define.sps:10: At `!BREAK' in the expansion of `!j',
1901 define.sps:21.1-21.2: error: DEBUG EXPAND: !BREAK outside !DO.
1906 AT_SETUP([macros in comments])
1907 AT_KEYWORDS([macro])
1908 AT_DATA([define.sps], [dnl
1909 DEFINE !macro() x y z !ENDDEFINE.
1915 AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
1920 AT_SETUP([DEFINE syntax errors])
1921 AT_KEYWORDS([macro])
1922 AT_DATA([define.sps], [dnl
1923 DEFINE !macro(!POSITIONAL !CHAREND('x y')) !ENDDEFINE.
1924 DEFINE !macro(a=!TOKENS(1)/!POSITIONAL !TOKENS(1)) !ENDDEFINE.
1925 DEFINE !macro(!a=!TOKENS(1)) !ENDDEFINE.
1926 DEFINE !macro(do=!TOKENS(1)) !ENDDEFINE.
1927 DEFINE 0() !ENDDEFINE.
1928 DEFINE x y () !ENDDEFINE.
1929 DEFINE !macro(1) !ENDDEFINE.
1930 DEFINE !macro(x 2) !ENDDEFINE.
1931 DEFINE !macro(x=!DEFAULT 3) !ENDDEFINE.
1932 DEFINE !macro(x=!TOKENS 4) !ENDDEFINE.
1933 DEFINE !macro(x=!TOKENS(x)) !ENDDEFINE.
1934 DEFINE !macro(x=!TOKENS(1 5)) !ENDDEFINE.
1935 DEFINE !macro(x=!ENCLOSE 6) !ENDDEFINE.
1936 DEFINE !macro(x=!ENCLOSE('x' y)) !ENDDEFINE.
1937 DEFINE !macro(x=!ENCLOSE('x',y)) !ENDDEFINE.
1938 DEFINE !macro(x=!ENCLOSE('x','y' z)) !ENDDEFINE.
1939 DEFINE !macro(x=!CHAREND 7) !ENDDEFINE.
1940 DEFINE !macro(x=!CHAREND(8)) !ENDDEFINE.
1941 DEFINE !macro(x=!CHAREND('x' 9)) !ENDDEFINE.
1942 DEFINE !macro(x=!WTF) !ENDDEFINE.
1943 DEFINE !macro(x=!TOKENS(1) x) !ENDDEFINE.
1944 DEFINE !macro(x=!DEFAULT() !DEFAULT()) !ENDDEFINE.
1945 DEFINE !macro(x=!TOKENS(1) !CMDEND) !ENDDEFINE.
1948 AT_CHECK([pspp define.sps], [1], [dnl
1949 define.sps:1.36-1.40: error: DEFINE: Syntax error at `'x y'': String must
1950 contain exactly one token.
1952 define.sps:2.40-2.46: error: DEFINE: Syntax error at `!TOKENS': Positional
1953 parameters must precede keyword parameters.
1955 define.sps:3.15-3.16: error: DEFINE: Syntax error at `!a': Keyword macro
1956 parameter must be named in definition without "!" prefix.
1958 define.sps:4.15-4.16: error: DEFINE: Syntax error at `do': Cannot use macro
1959 keyword "do" as an argument name.
1961 define.sps:5.8: error: DEFINE: Syntax error at `0': expecting identifier.
1963 define.sps:6.10: error: DEFINE: Syntax error at `y': expecting `@{:@'.
1965 define.sps:7.15: error: DEFINE: Syntax error at `1': expecting identifier.
1967 define.sps:8.17: error: DEFINE: Syntax error at `2': expecting !TOKENS, !
1968 CHAREND, !ENCLOSE, or !CMDEND.
1970 define.sps:9.26: error: DEFINE: Syntax error at `3': expecting `@{:@'.
1972 define.sps:10.25: error: DEFINE: Syntax error at `4': expecting `('.
1974 define.sps:11.25: error: DEFINE: Syntax error at `x': Expected positive integer
1977 define.sps:12.27: error: DEFINE: Syntax error at `5': expecting `)'.
1979 define.sps:13.26: error: DEFINE: Syntax error at `6': expecting `('.
1981 define.sps:14.30: error: DEFINE: Syntax error at `y': expecting `,'.
1983 define.sps:15.30: error: DEFINE: Syntax error at `y': expecting string.
1985 define.sps:16.34: error: DEFINE: Syntax error at `z': expecting `)'.
1987 define.sps:17.26: error: DEFINE: Syntax error at `7': expecting `('.
1989 define.sps:18.26: error: DEFINE: Syntax error at `8': expecting string.
1991 define.sps:19.30: error: DEFINE: Syntax error at `9': expecting `)'.
1993 define.sps:20.17-20.20: error: DEFINE: Syntax error at `!WTF': expecting !
1994 TOKENS, !CHAREND, !ENCLOSE, or !CMDEND.
1996 define.sps:21.28: error: DEFINE: Syntax error at `x': expecting `/'.
1998 define.sps:22.36: error: DEFINE: Syntax error at `(': !DEFAULT is allowed only
2001 define.sps:23.35: error: DEFINE: Syntax error at `)': Only one of !TOKENS, !
2002 CHAREND, !ENCLOSE, or !CMDEND is allowed.
2004 define.sps:25.1: error: DEFINE: Syntax error at end of command: Expecting macro
2009 AT_SETUP([macro expansion with token merging])
2010 AT_DATA([define.sps], [dnl
2011 DEFINE !foo() "foo" !ENDDEFINE.
2012 DEFINE !bar() "bar" !ENDDEFINE.
2013 DEFINE !plus() + !ENDDEFINE.
2014 DEFINE !minus() - !ENDDEFINE.
2015 DEFINE !one() 1 !ENDDEFINE.
2022 ECHO !foo !plus !bar.
2023 ECHO "two" "strings".
2025 N OF CASES !minus 1.
2027 N OF CASES !minus !one.
2029 AT_CHECK([pspp define.sps], [1], [dnl
2046 define.sps:13.12-13.20: error: ECHO: Syntax error at `"strings"': expecting end
2049 define.sps:14.12-14.17: error: N OF CASES: Syntax error at `-/**/1': Expected
2050 positive integer for N OF CASES.
2052 define.sps:15.12-15.19: error: N OF CASES: Syntax error at `!minus 1': Expected
2053 positive integer for N OF CASES.
2055 define.sps:16.12-16.17: error: N OF CASES: Syntax error at `- !one': Expected
2056 positive integer for N OF CASES.
2058 define.sps:17.12-17.22: error: N OF CASES: Syntax error at `!minus !one':
2059 Expected positive integer for N OF CASES.