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