04a77a9b8fd103ebc0b09e3a2533cc7e13d7d32d
[pspp] / tests / language / lexer / segment.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl
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.
8 dnl
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 General Public License for more details.
13 dnl
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/>.
16 dnl
17 AT_BANNER([syntax segmentation])
18 m4_define([PSPP_CHECK_SEGMENT],
19   [for strip in "" "-s"; do
20      case $strip in # (
21         '') sed 's/^-//' < expout-base > expout ;; # (
22         -s) sed '/^-/d' < expout-base > expout ;;
23      esac
24      AT_CHECK([segment-test $1 $strip input], [0], [expout])
25      AT_CHECK([segment-test -1 $strip $1 input], [0], [expout])
26      AT_CHECK([segment-test -0 $strip $1 input])
27      AT_CHECK([segment-test -01 $strip $1 input])
28    done])
29 \f
30 AT_SETUP([identifiers])
31 AT_KEYWORDS([segment])
32 AT_DATA([input], [dnl
33 a ab abc abcd
34 A AB ABC ABCD
35 aB aBC aBcD
36 $x $y $z
37 grève@<00A0>@Ângstrom@<00A0>@poté
38 #a #b #c ## #d
39 @efg @ @@. @#@ @&t@
40 ## # #12345 #.#
41 f@#_.#6
42 GhIjK
43 .x 1y _z
44 ])
45 AT_DATA([expout-base], [dnl
46 identifier      a    space
47 identifier      ab    space
48 identifier      abc    space
49 identifier      abcd
50 newline         \n (later)
51
52 identifier      A    space
53 identifier      AB    space
54 identifier      ABC    space
55 identifier      ABCD
56 newline         \n (later)
57
58 identifier      aB    space
59 identifier      aBC    space
60 identifier      aBcD
61 newline         \n (later)
62
63 identifier      $x    space
64 identifier      $y    space
65 identifier      $z
66 newline         \n (later)
67
68 identifier      grève
69 spaces          <U+00A0>
70 identifier      Ângstrom
71 spaces          <U+00A0>
72 identifier      poté
73 newline         \n (later)
74
75 identifier      #a    space
76 identifier      #b    space
77 identifier      #c    space
78 identifier      ##    space
79 identifier      #d
80 newline         \n (later)
81
82 identifier      @efg    space
83 identifier      @    space
84 identifier      @@.    space
85 identifier      @#@    space
86 newline         \n (later)
87
88 identifier      ##    space
89 identifier      #    space
90 identifier      #12345    space
91 identifier      #.#
92 newline         \n (later)
93
94 identifier      f@#\_.#6
95 newline         \n (later)
96
97 identifier      GhIjK
98 newline         \n (later)
99
100 start_command   .
101 identifier      x    space
102 number          1
103 identifier      y    space
104 unexpected_char \_
105 identifier      z
106 -newline         \n (later)
107 -
108 end
109 ])
110 PSPP_CHECK_SEGMENT([-i])
111 AT_CLEANUP
112 \f
113 AT_SETUP([identifiers that end in '.'])
114 AT_KEYWORDS([segment])
115 AT_DATA([input], [dnl
116 abcd. abcd.
117 ABCD. ABCD.
118 aBcD. aBcD. @&t@
119 $y. $z. あいうえお.
120 #c. #d..
121 @@. @@....
122 #.#.
123 #abcd.
124 .
125 . @&t@
126 LMNOP. @&t@
127 QRSTUV./* end of line comment */
128 qrstuv. /* end of line comment */
129 QrStUv./* end of line comment */ @&t@
130 wxyz./* unterminated end of line comment
131 WXYZ. /* unterminated end of line comment
132 WxYz./* unterminated end of line comment @&t@
133 ])
134 AT_DATA([expout-base], [dnl
135 identifier      abcd.    space
136 identifier      abcd
137 end_command     .
138 newline         \n (first)
139
140 identifier      ABCD.    space
141 identifier      ABCD
142 end_command     .
143 newline         \n (first)
144
145 identifier      aBcD.    space
146 identifier      aBcD
147 end_command     .    space
148 newline         \n (first)
149
150 identifier      $y.    space
151 identifier      $z.    space
152 identifier      あいうえお
153 end_command     .
154 newline         \n (first)
155
156 identifier      #c.    space
157 identifier      #d.
158 end_command     .
159 newline         \n (first)
160
161 identifier      @@.    space
162 identifier      @@...
163 end_command     .
164 newline         \n (first)
165
166 identifier      #.#
167 end_command     .
168 newline         \n (first)
169
170 identifier      #abcd
171 end_command     .
172 newline         \n (first)
173
174 start_command   .
175 newline         \n (first)
176
177 start_command   .    space
178 newline         \n (first)
179
180 identifier      LMNOP
181 end_command     .    space
182 newline         \n (first)
183
184 identifier      QRSTUV
185 end_command     .
186 comment         /*_end_of_line_comment_*/
187 newline         \n (first)
188
189 identifier      qrstuv
190 end_command     .    space
191 comment         /*_end_of_line_comment_*/
192 newline         \n (first)
193
194 identifier      QrStUv
195 end_command     .
196 comment         /*_end_of_line_comment_*/    space
197 newline         \n (first)
198
199 identifier      wxyz
200 end_command     .
201 comment         /*_unterminated_end_of_line_comment
202 newline         \n (first)
203
204 identifier      WXYZ
205 end_command     .    space
206 comment         /*_unterminated_end_of_line_comment
207 newline         \n (first)
208
209 identifier      WxYz
210 end_command     .
211 comment         /*_unterminated_end_of_line_comment_
212 -newline         \n (first)
213 -
214 end
215 ])
216 PSPP_CHECK_SEGMENT([-i])
217 AT_CLEANUP
218 \f
219 AT_SETUP([reserved words])
220 AT_KEYWORDS([segment])
221 AT_DATA([input], [dnl
222 and or not eq ge gt le lt ne all by to with
223 AND OR NOT EQ GE GT LE LT NE ALL BY TO WITH
224 andx orx notx eqx gex gtx lex ltx nex allx byx tox withx
225 and. with.
226 ])
227 AT_DATA([expout-base], [dnl
228 reserved_word   and    space
229 reserved_word   or    space
230 reserved_word   not    space
231 reserved_word   eq    space
232 reserved_word   ge    space
233 reserved_word   gt    space
234 reserved_word   le    space
235 reserved_word   lt    space
236 reserved_word   ne    space
237 reserved_word   all    space
238 reserved_word   by    space
239 reserved_word   to    space
240 reserved_word   with
241 newline         \n (later)
242
243 reserved_word   AND    space
244 reserved_word   OR    space
245 reserved_word   NOT    space
246 reserved_word   EQ    space
247 reserved_word   GE    space
248 reserved_word   GT    space
249 reserved_word   LE    space
250 reserved_word   LT    space
251 reserved_word   NE    space
252 reserved_word   ALL    space
253 reserved_word   BY    space
254 reserved_word   TO    space
255 reserved_word   WITH
256 newline         \n (later)
257
258 identifier      andx    space
259 identifier      orx    space
260 identifier      notx    space
261 identifier      eqx    space
262 identifier      gex    space
263 identifier      gtx    space
264 identifier      lex    space
265 identifier      ltx    space
266 identifier      nex    space
267 identifier      allx    space
268 identifier      byx    space
269 identifier      tox    space
270 identifier      withx
271 newline         \n (later)
272
273 identifier      and.    space
274 reserved_word   with
275 end_command     .
276 -newline         \n (first)
277 -
278 end
279 ])
280 PSPP_CHECK_SEGMENT([-i])
281 AT_CLEANUP
282 \f
283 AT_SETUP([punctuation])
284 AT_KEYWORDS([segment])
285 AT_DATA([input], [dnl
286 ~ & | = >= > <= < ~= <> ( ) , - + * / [[ ]] **
287 ~&|=>=><=<~=<>(),-+*/[[]]**
288 ])
289 AT_DATA([expout-base], [dnl
290 punct           ~    space
291 punct           &    space
292 punct           |    space
293 punct           =    space
294 punct           >=    space
295 punct           >    space
296 punct           <=    space
297 punct           <    space
298 punct           ~=    space
299 punct           <>    space
300 punct           (    space
301 punct           )    space
302 punct           ,    space
303 punct           -    space
304 punct           +    space
305 punct           *    space
306 punct           /    space
307 punct           [[    space
308 punct           ]]    space
309 punct           **
310 newline         \n (later)
311
312 punct           ~
313 punct           &
314 punct           |
315 punct           =
316 punct           >=
317 punct           >
318 punct           <=
319 punct           <
320 punct           ~=
321 punct           <>
322 punct           (
323 punct           )
324 punct           ,
325 punct           -
326 punct           +
327 punct           *
328 punct           /
329 punct           [[
330 punct           ]]
331 punct           **
332 -newline         \n (later)
333 -
334 end
335 ])
336 PSPP_CHECK_SEGMENT([-i])
337 AT_CLEANUP
338 \f
339 AT_SETUP([numbers])
340 AT_KEYWORDS([segment])
341 AT_DATA([input], [dnl
342 0 1 01 001. 1.
343 123. /* comment 1 */ /* comment 2 */
344 .1 0.1 00.1 00.10
345 5e1 6E-1 7e+1 6E+01 6e-03
346 .3E1 .4e-1 .5E+1 .6e+01 .7E-03
347 1.23e1 45.6E-1 78.9e+1 99.9E+01 11.2e-03
348 . 1e e1 1e+ 1e-
349 ])
350 AT_DATA([expout-base], [dnl
351 number          0    space
352 number          1    space
353 number          01    space
354 number          001.    space
355 number          1
356 end_command     .
357 newline         \n (first)
358
359 number          123
360 end_command     .    space
361 comment         /*_comment_1_*/    space
362 comment         /*_comment_2_*/
363 newline         \n (first)
364
365 start_command   .
366 number          1    space
367 number          0.1    space
368 number          00.1    space
369 number          00.10
370 newline         \n (later)
371
372 number          5e1    space
373 number          6E-1    space
374 number          7e+1    space
375 number          6E+01    space
376 number          6e-03
377 newline         \n (later)
378
379 start_command   .
380 number          3E1    space
381 number          .4e-1    space
382 number          .5E+1    space
383 number          .6e+01    space
384 number          .7E-03
385 newline         \n (later)
386
387 number          1.23e1    space
388 number          45.6E-1    space
389 number          78.9e+1    space
390 number          99.9E+01    space
391 number          11.2e-03
392 newline         \n (later)
393
394 start_command   .    space
395 expected_exponent 1e    space
396 identifier      e1    space
397 expected_exponent 1e+    space
398 expected_exponent 1e-
399 -newline         \n (later)
400 -
401 end
402 ])
403 PSPP_CHECK_SEGMENT([-i])
404 AT_CLEANUP
405 \f
406 AT_SETUP([strings])
407 AT_KEYWORDS([segment])
408 AT_DATA([input], [dnl
409 'x' "y" 'abc'
410 'Don''t' "Can't" 'Won''t'
411 """quoted""" '"quoted"'
412 '' ""
413 'missing end quote
414 "missing double quote
415 x"4142" X'5152'
416 u'fffd' U"041"
417 + new command
418 + /* comment */ 'string continuation'
419 + /* also a punctuator on blank line
420 - 'new command'
421 ])
422 AT_DATA([expout-base], [dnl
423 quoted_string   'x'    space
424 quoted_string   "y"    space
425 quoted_string   'abc'
426 newline         \n (later)
427
428 quoted_string   'Don''t'    space
429 quoted_string   "Can't"    space
430 quoted_string   'Won''t'
431 newline         \n (later)
432
433 quoted_string   """quoted"""    space
434 quoted_string   '"quoted"'
435 newline         \n (later)
436
437 quoted_string   ''    space
438 quoted_string   ""
439 newline         \n (later)
440
441 expected_quote  'missing_end_quote
442 newline         \n (later)
443
444 expected_quote  "missing_double_quote
445 newline         \n (later)
446
447 hex_string      x"4142"    space
448 hex_string      X'5152'
449 newline         \n (later)
450
451 unicode_string  u'fffd'    space
452 unicode_string  U"041"
453 newline         \n (later)
454
455 start_command   +    space
456 identifier      new    space
457 identifier      command
458 newline         \n (later)
459
460 punct           +    space
461 comment         /*_comment_*/    space
462 quoted_string   'string_continuation'
463 newline         \n (later)
464
465 punct           +    space
466 comment         /*_also_a_punctuator_on_blank_line
467 newline         \n (later)
468
469 start_command   -    space
470 quoted_string   'new_command'
471 -newline         \n (later)
472 -
473 end
474 ])
475 PSPP_CHECK_SEGMENT([-i])
476 AT_CLEANUP
477 \f
478 AT_SETUP([@%:@! construct])
479 AT_KEYWORDS([segment])
480 AT_DATA([input], [dnl
481 #! /usr/bin/pspp
482 title my title.
483 #! /usr/bin/pspp
484 ])
485 AT_DATA([expout-base], [dnl
486 shbang          #!_/usr/bin/pspp
487 newline         \n (first)
488
489 identifier      title    space
490 unquoted_string my_title
491 end_command     .
492 newline         \n (first)
493
494 identifier      #
495 unexpected_char !    space
496 punct           /
497 identifier      usr
498 punct           /
499 identifier      bin
500 punct           /
501 identifier      pspp
502 -newline         \n (later)
503 -
504 end
505 ])
506 PSPP_CHECK_SEGMENT([-i])
507 AT_CLEANUP
508 \f
509 AT_SETUP([* and COMMENT commands])
510 AT_KEYWORDS([segment])
511 AT_DATA([input], [dnl
512 * Comment commands "don't
513 have to contain valid tokens.
514
515 ** Check ambiguity with ** token.
516 ****************.
517
518 comment keyword works too.
519 COMM also.
520 com is ambiguous with COMPUTE.
521
522    * Comment need not start at left margin.
523
524 * Comment ends with blank line
525
526 next command.
527
528 ])
529 AT_DATA([expout-base], [dnl
530 comment_command *_Comment_commands_"don't
531 newline         \n (COMMENT)
532
533 comment_command have_to_contain_valid_tokens
534 end_command     .
535 newline         \n (first)
536
537 separate_commands
538 newline         \n (first)
539
540 comment_command **_Check_ambiguity_with_**_token
541 end_command     .
542 newline         \n (first)
543
544 comment_command ****************
545 end_command     .
546 newline         \n (first)
547
548 separate_commands
549 newline         \n (first)
550
551 comment_command comment_keyword_works_too
552 end_command     .
553 newline         \n (first)
554
555 comment_command COMM_also
556 end_command     .
557 newline         \n (first)
558
559 identifier      com    space
560 identifier      is    space
561 identifier      ambiguous    space
562 reserved_word   with    space
563 identifier      COMPUTE
564 end_command     .
565 newline         \n (first)
566
567 separate_commands
568 newline         \n (first)
569
570 spaces          ___
571 comment_command *_Comment_need_not_start_at_left_margin
572 end_command     .
573 newline         \n (first)
574
575 separate_commands
576 newline         \n (first)
577
578 comment_command *_Comment_ends_with_blank_line
579 newline         \n (COMMENT)
580
581 separate_commands
582 newline         \n (first)
583
584 identifier      next    space
585 identifier      command
586 end_command     .
587 newline         \n (first)
588
589 -separate_commands
590 -newline         \n (first)
591 -
592 end
593 ])
594 PSPP_CHECK_SEGMENT([-i])
595 AT_CLEANUP
596 \f
597 AT_SETUP([DOCUMENT command])
598 AT_KEYWORDS([segment])
599 AT_DATA([input], [dnl
600 DOCUMENT one line.
601 DOC more
602     than
603         one
604             line.
605 docu
606 first.paragraph
607 isn't parsed as tokens
608
609 second paragraph.
610 ])
611 AT_DATA([expout-base], [dnl
612 start_document
613 document        DOCUMENT_one_line.
614 end_command
615 separate_commands
616 newline         \n (first)
617
618 start_document
619 document        DOC_more
620 newline         \n (DOCUMENT)
621
622 document        ____than
623 newline         \n (DOCUMENT)
624
625 document        ________one
626 newline         \n (DOCUMENT)
627
628 document        ____________line.
629 end_command
630 separate_commands
631 newline         \n (first)
632
633 start_document
634 document        docu
635 newline         \n (DOCUMENT)
636
637 document        first.paragraph
638 newline         \n (DOCUMENT)
639
640 document        isn't_parsed_as_tokens
641 newline         \n (DOCUMENT)
642
643 document
644 newline         \n (DOCUMENT)
645
646 document        second_paragraph.
647 -end_command
648 -separate_commands
649 -newline         \n (first)
650 -
651 end
652 ])
653 PSPP_CHECK_SEGMENT([-i])
654 AT_CLEANUP
655 \f
656 AT_SETUP([TITLE, SUBTITLE, FILE LABEL commands])
657 AT_KEYWORDS([segment])
658 AT_DATA([input], [dnl
659 title/**/'Quoted string title'.
660 tit /*
661 "Quoted string on second line".
662 sub "Quoted string subtitle"
663  .
664
665 TITL /* Not a */ quoted string title.
666 SUBT Not a quoted string /* subtitle
667
668 FIL label isn't quoted.
669 FILE
670   lab 'is quoted'.
671 FILE /*
672 /**/  lab not quoted here either
673
674 ])
675 AT_DATA([expout-base], [dnl
676 identifier      title
677 comment         /**/
678 quoted_string   'Quoted_string_title'
679 end_command     .
680 newline         \n (first)
681
682 identifier      tit    space
683 comment         /*
684 newline         \n (later)
685
686 quoted_string   "Quoted_string_on_second_line"
687 end_command     .
688 newline         \n (first)
689
690 identifier      sub    space
691 quoted_string   "Quoted_string_subtitle"
692 newline         \n (later)
693     space
694 end_command     .
695 newline         \n (first)
696
697 separate_commands
698 newline         \n (first)
699
700 identifier      TITL    space
701 unquoted_string /*_Not_a_*/_quoted_string_title
702 end_command     .
703 newline         \n (first)
704
705 identifier      SUBT    space
706 unquoted_string Not_a_quoted_string_/*_subtitle
707 newline         \n (later)
708
709 separate_commands
710 newline         \n (first)
711
712 identifier      FIL    space
713 identifier      label    space
714 unquoted_string isn't_quoted
715 end_command     .
716 newline         \n (first)
717
718 identifier      FILE
719 newline         \n (later)
720
721 spaces          __
722 identifier      lab    space
723 quoted_string   'is_quoted'
724 end_command     .
725 newline         \n (first)
726
727 identifier      FILE    space
728 comment         /*
729 newline         \n (later)
730
731 comment         /**/
732 spaces          __
733 identifier      lab    space
734 unquoted_string not_quoted_here_either
735 newline         \n (later)
736
737 -separate_commands
738 -newline         \n (first)
739 -
740 end
741 ])
742 PSPP_CHECK_SEGMENT([-i])
743 AT_CLEANUP
744 \f
745 AT_SETUP([BEGIN DATA command])
746 AT_KEYWORDS([segment])
747 AT_DATA([input], [dnl
748 begin data.
749 end data.
750
751 begin data. /*
752 123
753 xxx
754 end data.
755
756 BEG /**/ DAT /*
757 5 6 7 /* x
758
759 end  data
760 end data
761 .
762
763 begin
764  data.
765 data
766 end data.
767
768 begin data "xxx".
769 begin data 123.
770 not data
771 ])
772 AT_DATA([expout-base], [dnl
773 identifier      begin    space
774 identifier      data
775 end_command     .
776 newline         \n (data)
777
778 identifier      end    space
779 identifier      data
780 end_command     .
781 newline         \n (first)
782
783 separate_commands
784 newline         \n (first)
785
786 identifier      begin    space
787 identifier      data
788 end_command     .    space
789 comment         /*
790 newline         \n (data)
791
792 inline_data     123
793 newline         \n (data)
794
795 inline_data     xxx
796 newline         \n (data)
797
798 identifier      end    space
799 identifier      data
800 end_command     .
801 newline         \n (first)
802
803 separate_commands
804 newline         \n (first)
805
806 identifier      BEG    space
807 comment         /**/    space
808 identifier      DAT    space
809 comment         /*
810 newline         \n (data)
811
812 inline_data     5_6_7_/*_x
813 newline         \n (data)
814
815 inline_data
816 newline         \n (data)
817
818 inline_data     end__data
819 newline         \n (data)
820
821 identifier      end    space
822 identifier      data
823 newline         \n (later)
824
825 start_command   .
826 newline         \n (first)
827
828 separate_commands
829 newline         \n (first)
830
831 identifier      begin
832 newline         \n (later)
833     space
834 identifier      data
835 end_command     .
836 newline         \n (data)
837
838 inline_data     data
839 newline         \n (data)
840
841 identifier      end    space
842 identifier      data
843 end_command     .
844 newline         \n (first)
845
846 separate_commands
847 newline         \n (first)
848
849 identifier      begin    space
850 identifier      data    space
851 quoted_string   "xxx"
852 end_command     .
853 newline         \n (first)
854
855 identifier      begin    space
856 identifier      data    space
857 number          123
858 end_command     .
859 newline         \n (first)
860
861 reserved_word   not    space
862 identifier      data
863 -newline         \n (later)
864 -
865 end
866 ])
867 PSPP_CHECK_SEGMENT([-i])
868 AT_CLEANUP
869 \f
870 AT_SETUP([DO REPEAT command])
871 AT_KEYWORDS([segment])
872 AT_DATA([input], [dnl
873 do repeat x=a b c
874           y=d e f.
875   do repeat a=1 thru 5.
876 another command.
877 second command
878 + third command.
879 end /* x */ /* y */ repeat print.
880 end
881  repeat.
882 do
883   repeat #a=1.
884   inner command.
885 end repeat.
886 ])
887 AT_DATA([expout-base], [dnl
888 identifier      do    space
889 identifier      repeat    space
890 identifier      x
891 punct           =
892 identifier      a    space
893 identifier      b    space
894 identifier      c
895 newline         \n (later)
896
897 spaces          __________
898 identifier      y
899 punct           =
900 identifier      d    space
901 identifier      e    space
902 identifier      f
903 end_command     .
904 newline         \n (DO REPEAT)
905
906 do_repeat_command __do_repeat_a=1_thru_5.
907 newline         \n (DO REPEAT)
908
909 do_repeat_command another_command.
910 newline         \n (DO REPEAT)
911
912 do_repeat_command second_command
913 newline         \n (DO REPEAT)
914
915 do_repeat_command +_third_command.
916 newline         \n (DO REPEAT)
917
918 do_repeat_command end_/*_x_*/_/*_y_*/_repeat_print.
919 newline         \n (DO REPEAT)
920
921 identifier      end
922 newline         \n (later)
923     space
924 identifier      repeat
925 end_command     .
926 newline         \n (first)
927
928 identifier      do
929 newline         \n (later)
930
931 spaces          __
932 identifier      repeat    space
933 identifier      #a
934 punct           =
935 number          1
936 end_command     .
937 newline         \n (DO REPEAT)
938
939 do_repeat_command __inner_command.
940 newline         \n (DO REPEAT)
941
942 identifier      end    space
943 identifier      repeat
944 end_command     .
945 -newline         \n (first)
946 -
947 end
948 ])
949 PSPP_CHECK_SEGMENT([-i])
950 AT_CLEANUP
951 \f
952 AT_SETUP([DO REPEAT command in batch mode])
953 AT_KEYWORDS([segment])
954 AT_DATA([input], [dnl
955 do repeat x=a b c
956           y=d e f
957 do repeat a=1 thru 5
958 another command
959 second command
960 + third command
961 end /* x */ /* y */ repeat print
962 end
963  repeat
964 do
965   repeat #a=1
966
967   inner command
968 end repeat
969 ])
970 AT_DATA([expout-base], [dnl
971 identifier      do    space
972 identifier      repeat    space
973 identifier      x
974 punct           =
975 identifier      a    space
976 identifier      b    space
977 identifier      c
978 newline         \n (later)
979
980 spaces          __________
981 identifier      y
982 punct           =
983 identifier      d    space
984 identifier      e    space
985 identifier      f
986 newline         \n (later)
987
988 start_command
989 do_repeat_command do_repeat_a=1_thru_5
990 newline         \n (DO REPEAT)
991
992 do_repeat_command another_command
993 newline         \n (DO REPEAT)
994
995 do_repeat_command second_command
996 newline         \n (DO REPEAT)
997
998 do_repeat_command +_third_command
999 newline         \n (DO REPEAT)
1000
1001 do_repeat_command end_/*_x_*/_/*_y_*/_repeat_print
1002 newline         \n (DO REPEAT)
1003
1004 identifier      end
1005 newline         \n (later)
1006     space
1007 identifier      repeat
1008 newline         \n (later)
1009
1010 start_command
1011 identifier      do
1012 newline         \n (later)
1013
1014 spaces          __
1015 identifier      repeat    space
1016 identifier      #a
1017 punct           =
1018 number          1
1019 newline         \n (later)
1020
1021 separate_commands
1022 newline         \n (DO REPEAT)
1023
1024 do_repeat_command __inner_command
1025 newline         \n (DO REPEAT)
1026
1027 identifier      end    space
1028 identifier      repeat
1029 -newline         \n (later)
1030 -
1031 end
1032 ])
1033 PSPP_CHECK_SEGMENT([-b])
1034 AT_CLEANUP
1035 \f
1036 AT_SETUP([batch mode])
1037 AT_KEYWORDS([segment])
1038 AT_DATA([input], [dnl
1039 first command
1040      another line of first command
1041 +  second command
1042 third command
1043
1044 fourth command.
1045    fifth command.
1046 ])
1047 AT_DATA([expout-base], [dnl
1048 identifier      first    space
1049 identifier      command
1050 newline         \n (later)
1051
1052 spaces          _____
1053 identifier      another    space
1054 identifier      line    space
1055 identifier      of    space
1056 identifier      first    space
1057 identifier      command
1058 newline         \n (later)
1059
1060 start_command   +
1061 spaces          __
1062 identifier      second    space
1063 identifier      command
1064 newline         \n (later)
1065
1066 start_command
1067 identifier      third    space
1068 identifier      command
1069 newline         \n (later)
1070
1071 separate_commands
1072 newline         \n (first)
1073
1074 identifier      fourth    space
1075 identifier      command
1076 end_command     .
1077 newline         \n (first)
1078
1079 spaces          ___
1080 identifier      fifth    space
1081 identifier      command
1082 end_command     .
1083 -newline         \n (first)
1084 -
1085 end
1086 ])
1087 PSPP_CHECK_SEGMENT([-b])
1088 AT_CLEANUP
1089 \f
1090 AT_SETUP([auto mode])
1091 AT_KEYWORDS([segment])
1092 AT_DATA([input], [dnl
1093 command
1094      another line of command
1095 2sls
1096 +  another command
1097 another line of second command
1098 data list /x 1
1099 aggregate.
1100 print eject.
1101 twostep cluster
1102
1103
1104 fourth command.
1105    fifth command.
1106 ])
1107 AT_DATA([expout-base], [dnl
1108 identifier      command
1109 newline         \n (later)
1110
1111 spaces          _____
1112 identifier      another    space
1113 identifier      line    space
1114 identifier      of    space
1115 identifier      command
1116 newline         \n (later)
1117
1118 start_command
1119 number          2
1120 identifier      sls
1121 newline         \n (later)
1122
1123 start_command   +
1124 spaces          __
1125 identifier      another    space
1126 identifier      command
1127 newline         \n (later)
1128
1129 identifier      another    space
1130 identifier      line    space
1131 identifier      of    space
1132 identifier      second    space
1133 identifier      command
1134 newline         \n (later)
1135
1136 start_command
1137 identifier      data    space
1138 identifier      list    space
1139 punct           /
1140 identifier      x    space
1141 number          1
1142 newline         \n (later)
1143
1144 start_command
1145 identifier      aggregate
1146 end_command     .
1147 newline         \n (first)
1148
1149 identifier      print    space
1150 identifier      eject
1151 end_command     .
1152 newline         \n (first)
1153
1154 identifier      twostep    space
1155 identifier      cluster
1156 newline         \n (later)
1157
1158 separate_commands
1159 newline         \n (first)
1160
1161 separate_commands
1162 newline         \n (first)
1163
1164 identifier      fourth    space
1165 identifier      command
1166 end_command     .
1167 newline         \n (first)
1168
1169 spaces          ___
1170 identifier      fifth    space
1171 identifier      command
1172 end_command     .
1173 -newline         \n (first)
1174 -
1175 end
1176 ])
1177 PSPP_CHECK_SEGMENT([-a])
1178 AT_CLEANUP