segment: Fix segmentation of integer followed by "." at end of file.
[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- 1.
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-    space
399 number          1
400 end_command     .
401 -newline         \n (first)
402 -
403 end
404 ])
405 PSPP_CHECK_SEGMENT([-i])
406 AT_CLEANUP
407 \f
408 AT_SETUP([strings])
409 AT_KEYWORDS([segment])
410 AT_DATA([input], [dnl
411 'x' "y" 'abc'
412 'Don''t' "Can't" 'Won''t'
413 """quoted""" '"quoted"'
414 '' ""
415 'missing end quote
416 "missing double quote
417 x"4142" X'5152'
418 u'fffd' U"041"
419 + new command
420 + /* comment */ 'string continuation'
421 + /* also a punctuator on blank line
422 - 'new command'
423 ])
424 AT_DATA([expout-base], [dnl
425 quoted_string   'x'    space
426 quoted_string   "y"    space
427 quoted_string   'abc'
428 newline         \n (later)
429
430 quoted_string   'Don''t'    space
431 quoted_string   "Can't"    space
432 quoted_string   'Won''t'
433 newline         \n (later)
434
435 quoted_string   """quoted"""    space
436 quoted_string   '"quoted"'
437 newline         \n (later)
438
439 quoted_string   ''    space
440 quoted_string   ""
441 newline         \n (later)
442
443 expected_quote  'missing_end_quote
444 newline         \n (later)
445
446 expected_quote  "missing_double_quote
447 newline         \n (later)
448
449 hex_string      x"4142"    space
450 hex_string      X'5152'
451 newline         \n (later)
452
453 unicode_string  u'fffd'    space
454 unicode_string  U"041"
455 newline         \n (later)
456
457 start_command   +    space
458 identifier      new    space
459 identifier      command
460 newline         \n (later)
461
462 punct           +    space
463 comment         /*_comment_*/    space
464 quoted_string   'string_continuation'
465 newline         \n (later)
466
467 punct           +    space
468 comment         /*_also_a_punctuator_on_blank_line
469 newline         \n (later)
470
471 start_command   -    space
472 quoted_string   'new_command'
473 -newline         \n (later)
474 -
475 end
476 ])
477 PSPP_CHECK_SEGMENT([-i])
478 AT_CLEANUP
479 \f
480 AT_SETUP([@%:@! construct])
481 AT_KEYWORDS([segment])
482 AT_DATA([input], [dnl
483 #! /usr/bin/pspp
484 title my title.
485 #! /usr/bin/pspp
486 ])
487 AT_DATA([expout-base], [dnl
488 shbang          #!_/usr/bin/pspp
489 newline         \n (first)
490
491 identifier      title    space
492 unquoted_string my_title
493 end_command     .
494 newline         \n (first)
495
496 identifier      #
497 unexpected_char !    space
498 punct           /
499 identifier      usr
500 punct           /
501 identifier      bin
502 punct           /
503 identifier      pspp
504 -newline         \n (later)
505 -
506 end
507 ])
508 PSPP_CHECK_SEGMENT([-i])
509 AT_CLEANUP
510 \f
511 AT_SETUP([* and COMMENT commands])
512 AT_KEYWORDS([segment])
513 AT_DATA([input], [dnl
514 * Comment commands "don't
515 have to contain valid tokens.
516
517 ** Check ambiguity with ** token.
518 ****************.
519
520 comment keyword works too.
521 COMM also.
522 com is ambiguous with COMPUTE.
523
524    * Comment need not start at left margin.
525
526 * Comment ends with blank line
527
528 next command.
529
530 ])
531 AT_DATA([expout-base], [dnl
532 comment_command *_Comment_commands_"don't
533 newline         \n (COMMENT)
534
535 comment_command have_to_contain_valid_tokens
536 end_command     .
537 newline         \n (first)
538
539 separate_commands
540 newline         \n (first)
541
542 comment_command **_Check_ambiguity_with_**_token
543 end_command     .
544 newline         \n (first)
545
546 comment_command ****************
547 end_command     .
548 newline         \n (first)
549
550 separate_commands
551 newline         \n (first)
552
553 comment_command comment_keyword_works_too
554 end_command     .
555 newline         \n (first)
556
557 comment_command COMM_also
558 end_command     .
559 newline         \n (first)
560
561 identifier      com    space
562 identifier      is    space
563 identifier      ambiguous    space
564 reserved_word   with    space
565 identifier      COMPUTE
566 end_command     .
567 newline         \n (first)
568
569 separate_commands
570 newline         \n (first)
571
572 spaces          ___
573 comment_command *_Comment_need_not_start_at_left_margin
574 end_command     .
575 newline         \n (first)
576
577 separate_commands
578 newline         \n (first)
579
580 comment_command *_Comment_ends_with_blank_line
581 newline         \n (COMMENT)
582
583 separate_commands
584 newline         \n (first)
585
586 identifier      next    space
587 identifier      command
588 end_command     .
589 newline         \n (first)
590
591 -separate_commands
592 -newline         \n (first)
593 -
594 end
595 ])
596 PSPP_CHECK_SEGMENT([-i])
597 AT_CLEANUP
598 \f
599 AT_SETUP([DOCUMENT command])
600 AT_KEYWORDS([segment])
601 AT_DATA([input], [dnl
602 DOCUMENT one line.
603 DOC more
604     than
605         one
606             line.
607 docu
608 first.paragraph
609 isn't parsed as tokens
610
611 second paragraph.
612 ])
613 AT_DATA([expout-base], [dnl
614 start_document
615 document        DOCUMENT_one_line.
616 end_command
617 separate_commands
618 newline         \n (first)
619
620 start_document
621 document        DOC_more
622 newline         \n (DOCUMENT)
623
624 document        ____than
625 newline         \n (DOCUMENT)
626
627 document        ________one
628 newline         \n (DOCUMENT)
629
630 document        ____________line.
631 end_command
632 separate_commands
633 newline         \n (first)
634
635 start_document
636 document        docu
637 newline         \n (DOCUMENT)
638
639 document        first.paragraph
640 newline         \n (DOCUMENT)
641
642 document        isn't_parsed_as_tokens
643 newline         \n (DOCUMENT)
644
645 document
646 newline         \n (DOCUMENT)
647
648 document        second_paragraph.
649 -end_command
650 -separate_commands
651 -newline         \n (first)
652 -
653 end
654 ])
655 PSPP_CHECK_SEGMENT([-i])
656 AT_CLEANUP
657 \f
658 AT_SETUP([TITLE, SUBTITLE, FILE LABEL commands])
659 AT_KEYWORDS([segment])
660 AT_DATA([input], [dnl
661 title/**/'Quoted string title'.
662 tit /*
663 "Quoted string on second line".
664 sub "Quoted string subtitle"
665  .
666
667 TITL /* Not a */ quoted string title.
668 SUBT Not a quoted string /* subtitle
669
670 FIL label isn't quoted.
671 FILE
672   lab 'is quoted'.
673 FILE /*
674 /**/  lab not quoted here either
675
676 ])
677 AT_DATA([expout-base], [dnl
678 identifier      title
679 comment         /**/
680 quoted_string   'Quoted_string_title'
681 end_command     .
682 newline         \n (first)
683
684 identifier      tit    space
685 comment         /*
686 newline         \n (later)
687
688 quoted_string   "Quoted_string_on_second_line"
689 end_command     .
690 newline         \n (first)
691
692 identifier      sub    space
693 quoted_string   "Quoted_string_subtitle"
694 newline         \n (later)
695     space
696 end_command     .
697 newline         \n (first)
698
699 separate_commands
700 newline         \n (first)
701
702 identifier      TITL    space
703 unquoted_string /*_Not_a_*/_quoted_string_title
704 end_command     .
705 newline         \n (first)
706
707 identifier      SUBT    space
708 unquoted_string Not_a_quoted_string_/*_subtitle
709 newline         \n (later)
710
711 separate_commands
712 newline         \n (first)
713
714 identifier      FIL    space
715 identifier      label    space
716 unquoted_string isn't_quoted
717 end_command     .
718 newline         \n (first)
719
720 identifier      FILE
721 newline         \n (later)
722
723 spaces          __
724 identifier      lab    space
725 quoted_string   'is_quoted'
726 end_command     .
727 newline         \n (first)
728
729 identifier      FILE    space
730 comment         /*
731 newline         \n (later)
732
733 comment         /**/
734 spaces          __
735 identifier      lab    space
736 unquoted_string not_quoted_here_either
737 newline         \n (later)
738
739 -separate_commands
740 -newline         \n (first)
741 -
742 end
743 ])
744 PSPP_CHECK_SEGMENT([-i])
745 AT_CLEANUP
746 \f
747 AT_SETUP([BEGIN DATA command])
748 AT_KEYWORDS([segment])
749 AT_DATA([input], [dnl
750 begin data.
751 end data.
752
753 begin data. /*
754 123
755 xxx
756 end data.
757
758 BEG /**/ DAT /*
759 5 6 7 /* x
760
761 end  data
762 end data
763 .
764
765 begin
766  data.
767 data
768 end data.
769
770 begin data "xxx".
771 begin data 123.
772 not data
773 ])
774 AT_DATA([expout-base], [dnl
775 identifier      begin    space
776 identifier      data
777 end_command     .
778 newline         \n (data)
779
780 identifier      end    space
781 identifier      data
782 end_command     .
783 newline         \n (first)
784
785 separate_commands
786 newline         \n (first)
787
788 identifier      begin    space
789 identifier      data
790 end_command     .    space
791 comment         /*
792 newline         \n (data)
793
794 inline_data     123
795 newline         \n (data)
796
797 inline_data     xxx
798 newline         \n (data)
799
800 identifier      end    space
801 identifier      data
802 end_command     .
803 newline         \n (first)
804
805 separate_commands
806 newline         \n (first)
807
808 identifier      BEG    space
809 comment         /**/    space
810 identifier      DAT    space
811 comment         /*
812 newline         \n (data)
813
814 inline_data     5_6_7_/*_x
815 newline         \n (data)
816
817 inline_data
818 newline         \n (data)
819
820 inline_data     end__data
821 newline         \n (data)
822
823 identifier      end    space
824 identifier      data
825 newline         \n (later)
826
827 start_command   .
828 newline         \n (first)
829
830 separate_commands
831 newline         \n (first)
832
833 identifier      begin
834 newline         \n (later)
835     space
836 identifier      data
837 end_command     .
838 newline         \n (data)
839
840 inline_data     data
841 newline         \n (data)
842
843 identifier      end    space
844 identifier      data
845 end_command     .
846 newline         \n (first)
847
848 separate_commands
849 newline         \n (first)
850
851 identifier      begin    space
852 identifier      data    space
853 quoted_string   "xxx"
854 end_command     .
855 newline         \n (first)
856
857 identifier      begin    space
858 identifier      data    space
859 number          123
860 end_command     .
861 newline         \n (first)
862
863 reserved_word   not    space
864 identifier      data
865 -newline         \n (later)
866 -
867 end
868 ])
869 PSPP_CHECK_SEGMENT([-i])
870 AT_CLEANUP
871 \f
872 AT_SETUP([DO REPEAT command])
873 AT_KEYWORDS([segment])
874 AT_DATA([input], [dnl
875 do repeat x=a b c
876           y=d e f.
877   do repeat a=1 thru 5.
878 another command.
879 second command
880 + third command.
881 end /* x */ /* y */ repeat print.
882 end
883  repeat.
884 do
885   repeat #a=1.
886   inner command.
887 end repeat.
888 ])
889 AT_DATA([expout-base], [dnl
890 identifier      do    space
891 identifier      repeat    space
892 identifier      x
893 punct           =
894 identifier      a    space
895 identifier      b    space
896 identifier      c
897 newline         \n (later)
898
899 spaces          __________
900 identifier      y
901 punct           =
902 identifier      d    space
903 identifier      e    space
904 identifier      f
905 end_command     .
906 newline         \n (DO REPEAT)
907
908 do_repeat_command __do_repeat_a=1_thru_5.
909 newline         \n (DO REPEAT)
910
911 do_repeat_command another_command.
912 newline         \n (DO REPEAT)
913
914 do_repeat_command second_command
915 newline         \n (DO REPEAT)
916
917 do_repeat_command +_third_command.
918 newline         \n (DO REPEAT)
919
920 do_repeat_command end_/*_x_*/_/*_y_*/_repeat_print.
921 newline         \n (DO REPEAT)
922
923 identifier      end
924 newline         \n (later)
925     space
926 identifier      repeat
927 end_command     .
928 newline         \n (first)
929
930 identifier      do
931 newline         \n (later)
932
933 spaces          __
934 identifier      repeat    space
935 identifier      #a
936 punct           =
937 number          1
938 end_command     .
939 newline         \n (DO REPEAT)
940
941 do_repeat_command __inner_command.
942 newline         \n (DO REPEAT)
943
944 identifier      end    space
945 identifier      repeat
946 end_command     .
947 -newline         \n (first)
948 -
949 end
950 ])
951 PSPP_CHECK_SEGMENT([-i])
952 AT_CLEANUP
953 \f
954 AT_SETUP([DO REPEAT command in batch mode])
955 AT_KEYWORDS([segment])
956 AT_DATA([input], [dnl
957 do repeat x=a b c
958           y=d e f
959 do repeat a=1 thru 5
960 another command
961 second command
962 + third command
963 end /* x */ /* y */ repeat print
964 end
965  repeat
966 do
967   repeat #a=1
968
969   inner command
970 end repeat
971 ])
972 AT_DATA([expout-base], [dnl
973 identifier      do    space
974 identifier      repeat    space
975 identifier      x
976 punct           =
977 identifier      a    space
978 identifier      b    space
979 identifier      c
980 newline         \n (later)
981
982 spaces          __________
983 identifier      y
984 punct           =
985 identifier      d    space
986 identifier      e    space
987 identifier      f
988 newline         \n (later)
989
990 start_command
991 do_repeat_command do_repeat_a=1_thru_5
992 newline         \n (DO REPEAT)
993
994 do_repeat_command another_command
995 newline         \n (DO REPEAT)
996
997 do_repeat_command second_command
998 newline         \n (DO REPEAT)
999
1000 do_repeat_command +_third_command
1001 newline         \n (DO REPEAT)
1002
1003 do_repeat_command end_/*_x_*/_/*_y_*/_repeat_print
1004 newline         \n (DO REPEAT)
1005
1006 identifier      end
1007 newline         \n (later)
1008     space
1009 identifier      repeat
1010 newline         \n (later)
1011
1012 start_command
1013 identifier      do
1014 newline         \n (later)
1015
1016 spaces          __
1017 identifier      repeat    space
1018 identifier      #a
1019 punct           =
1020 number          1
1021 newline         \n (later)
1022
1023 separate_commands
1024 newline         \n (DO REPEAT)
1025
1026 do_repeat_command __inner_command
1027 newline         \n (DO REPEAT)
1028
1029 identifier      end    space
1030 identifier      repeat
1031 -newline         \n (later)
1032 -
1033 end
1034 ])
1035 PSPP_CHECK_SEGMENT([-b])
1036 AT_CLEANUP
1037 \f
1038 AT_SETUP([batch mode])
1039 AT_KEYWORDS([segment])
1040 AT_DATA([input], [dnl
1041 first command
1042      another line of first command
1043 +  second command
1044 third command
1045
1046 fourth command.
1047    fifth command.
1048 ])
1049 AT_DATA([expout-base], [dnl
1050 identifier      first    space
1051 identifier      command
1052 newline         \n (later)
1053
1054 spaces          _____
1055 identifier      another    space
1056 identifier      line    space
1057 identifier      of    space
1058 identifier      first    space
1059 identifier      command
1060 newline         \n (later)
1061
1062 start_command   +
1063 spaces          __
1064 identifier      second    space
1065 identifier      command
1066 newline         \n (later)
1067
1068 start_command
1069 identifier      third    space
1070 identifier      command
1071 newline         \n (later)
1072
1073 separate_commands
1074 newline         \n (first)
1075
1076 identifier      fourth    space
1077 identifier      command
1078 end_command     .
1079 newline         \n (first)
1080
1081 spaces          ___
1082 identifier      fifth    space
1083 identifier      command
1084 end_command     .
1085 -newline         \n (first)
1086 -
1087 end
1088 ])
1089 PSPP_CHECK_SEGMENT([-b])
1090 AT_CLEANUP
1091 \f
1092 AT_SETUP([auto mode])
1093 AT_KEYWORDS([segment])
1094 AT_DATA([input], [dnl
1095 command
1096      another line of command
1097 2sls
1098 +  another command
1099 another line of second command
1100 data list /x 1
1101 aggregate.
1102 print eject.
1103 twostep cluster
1104
1105
1106 fourth command.
1107    fifth command.
1108 ])
1109 AT_DATA([expout-base], [dnl
1110 identifier      command
1111 newline         \n (later)
1112
1113 spaces          _____
1114 identifier      another    space
1115 identifier      line    space
1116 identifier      of    space
1117 identifier      command
1118 newline         \n (later)
1119
1120 start_command
1121 number          2
1122 identifier      sls
1123 newline         \n (later)
1124
1125 start_command   +
1126 spaces          __
1127 identifier      another    space
1128 identifier      command
1129 newline         \n (later)
1130
1131 identifier      another    space
1132 identifier      line    space
1133 identifier      of    space
1134 identifier      second    space
1135 identifier      command
1136 newline         \n (later)
1137
1138 start_command
1139 identifier      data    space
1140 identifier      list    space
1141 punct           /
1142 identifier      x    space
1143 number          1
1144 newline         \n (later)
1145
1146 start_command
1147 identifier      aggregate
1148 end_command     .
1149 newline         \n (first)
1150
1151 identifier      print    space
1152 identifier      eject
1153 end_command     .
1154 newline         \n (first)
1155
1156 identifier      twostep    space
1157 identifier      cluster
1158 newline         \n (later)
1159
1160 separate_commands
1161 newline         \n (first)
1162
1163 separate_commands
1164 newline         \n (first)
1165
1166 identifier      fourth    space
1167 identifier      command
1168 end_command     .
1169 newline         \n (first)
1170
1171 spaces          ___
1172 identifier      fifth    space
1173 identifier      command
1174 end_command     .
1175 -newline         \n (first)
1176 -
1177 end
1178 ])
1179 PSPP_CHECK_SEGMENT([-a])
1180 AT_CLEANUP