1 AT_BANNER([syntax segmentation])
2 m4_define([PSPP_CHECK_SEGMENT],
3 [AT_CHECK([segment-test $1 input], [0], [expout])
4 AT_CHECK([segment-test -1 $1 input], [0], [expout])])
6 AT_SETUP([identifiers])
13 grève@<00A0>@Ângstrom@<00A0>@poté
21 AT_DATA([expout], [dnl
66 identifier #12345 space
86 PSPP_CHECK_SEGMENT([-i])
89 AT_SETUP([identifiers that end in '.'])
90 AT_KEYWORDS([segment])
103 QRSTUV./* end of line comment */
104 qrstuv. /* end of line comment */
105 QrStUv./* end of line comment */ @&t@
106 wxyz./* unterminated end of line comment
107 WXYZ. /* unterminated end of line comment
108 WxYz./* unterminated end of line comment @&t@
110 AT_DATA([expout], [dnl
111 identifier abcd. space
116 identifier ABCD. space
121 identifier aBcD. space
153 start_command . space
162 comment /*_end_of_line_comment_*/
167 comment /*_end_of_line_comment_*/
172 comment /*_end_of_line_comment_*/ space
177 comment /*_unterminated_end_of_line_comment
182 comment /*_unterminated_end_of_line_comment
187 comment /*_unterminated_end_of_line_comment_
192 PSPP_CHECK_SEGMENT([-i])
195 AT_SETUP([reserved words])
196 AT_KEYWORDS([segment])
197 AT_DATA([input], [dnl
198 and or not eq ge gt le lt ne all by to with
199 AND OR NOT EQ GE GT LE LT NE ALL BY TO WITH
200 andx orx notx eqx gex gtx lex ltx nex allx byx tox withx
203 AT_DATA([expout], [dnl
204 reserved_word and space
205 reserved_word or space
206 reserved_word not space
207 reserved_word eq space
208 reserved_word ge space
209 reserved_word gt space
210 reserved_word le space
211 reserved_word lt space
212 reserved_word ne space
213 reserved_word all space
214 reserved_word by space
215 reserved_word to space
219 reserved_word AND space
220 reserved_word OR space
221 reserved_word NOT space
222 reserved_word EQ space
223 reserved_word GE space
224 reserved_word GT space
225 reserved_word LE space
226 reserved_word LT space
227 reserved_word NE space
228 reserved_word ALL space
229 reserved_word BY space
230 reserved_word TO space
234 identifier andx space
236 identifier notx space
243 identifier allx space
249 identifier and. space
256 PSPP_CHECK_SEGMENT([-i])
259 AT_SETUP([punctuation])
260 AT_KEYWORDS([segment])
261 AT_DATA([input], [dnl
262 ~ & | = >= > <= < ~= <> ( ) , - + * / [[ ]] **
263 ~&|=>=><=<~=<>(),-+*/[[]]**
265 AT_DATA([expout], [dnl
312 PSPP_CHECK_SEGMENT([-i])
316 AT_KEYWORDS([segment])
317 AT_DATA([input], [dnl
319 123. /* comment 1 */ /* comment 2 */
321 5e1 6E-1 7e+1 6E+01 6e-03
322 .3E1 .4e-1 .5E+1 .6e+01 .7E-03
323 1.23e1 45.6E-1 78.9e+1 99.9E+01 11.2e-03
326 AT_DATA([expout], [dnl
337 comment /*_comment_1_*/ space
338 comment /*_comment_2_*/
366 number 99.9E+01 space
370 start_command . space
371 expected_exponent 1e space
373 expected_exponent 1e+ space
374 expected_exponent 1e-
379 PSPP_CHECK_SEGMENT([-i])
383 AT_KEYWORDS([segment])
384 AT_DATA([input], [dnl
386 'Don''t' "Can't" 'Won''t'
387 """quoted""" '"quoted"'
390 "missing double quote
394 + /* comment */ 'string continuation'
395 + /* also a punctuator on blank line
398 AT_DATA([expout], [dnl
399 quoted_string 'x' space
400 quoted_string "y" space
404 quoted_string 'Don''t' space
405 quoted_string "Can't" space
406 quoted_string 'Won''t'
409 quoted_string """quoted""" space
410 quoted_string '"quoted"'
413 quoted_string '' space
417 expected_quote 'missing_end_quote
420 expected_quote "missing_double_quote
423 hex_string x"4142" space
427 unicode_string u'fffd' space
428 unicode_string U"041"
431 start_command + space
437 comment /*_comment_*/ space
438 quoted_string 'string_continuation'
442 comment /*_also_a_punctuator_on_blank_line
445 start_command - space
446 quoted_string 'new_command'
451 PSPP_CHECK_SEGMENT([-i])
454 AT_SETUP([@%:@! construct])
455 AT_KEYWORDS([segment])
456 AT_DATA([input], [dnl
461 AT_DATA([expout], [dnl
462 shbang #!_/usr/bin/pspp
465 identifier title space
466 unquoted_string my_title
471 unexpected_char ! space
482 PSPP_CHECK_SEGMENT([-i])
485 AT_SETUP([* and COMMENT commands])
486 AT_KEYWORDS([segment])
487 AT_DATA([input], [dnl
488 * Comment commands "don't
489 have to contain valid tokens.
491 ** Check ambiguity with ** token.
494 comment keyword works too.
496 com is ambiguous with COMPUTE.
498 * Comment need not start at left margin.
500 * Comment ends with blank line
505 AT_DATA([expout], [dnl
506 comment_command *_Comment_commands_"don't
509 comment_command have_to_contain_valid_tokens
516 comment_command **_Check_ambiguity_with_**_token
520 comment_command ****************
527 comment_command comment_keyword_works_too
531 comment_command COMM_also
537 identifier ambiguous space
538 reserved_word with space
547 comment_command *_Comment_need_not_start_at_left_margin
554 comment_command *_Comment_ends_with_blank_line
560 identifier next space
570 PSPP_CHECK_SEGMENT([-i])
573 AT_SETUP([DOCUMENT command])
574 AT_KEYWORDS([segment])
575 AT_DATA([input], [dnl
583 isn't parsed as tokens
587 AT_DATA([expout], [dnl
589 document DOCUMENT_one_line.
596 newline \n (DOCUMENT)
599 newline \n (DOCUMENT)
602 newline \n (DOCUMENT)
604 document ____________line.
611 newline \n (DOCUMENT)
613 document first.paragraph
614 newline \n (DOCUMENT)
616 document isn't_parsed_as_tokens
617 newline \n (DOCUMENT)
620 newline \n (DOCUMENT)
622 document second_paragraph.
629 PSPP_CHECK_SEGMENT([-i])
632 AT_SETUP([TITLE, SUBTITLE, FILE LABEL commands])
633 AT_KEYWORDS([segment])
634 AT_DATA([input], [dnl
635 title/**/'Quoted string title'.
637 "Quoted string on second line".
638 sub "Quoted string subtitle"
641 TITL /* Not a */ quoted string title.
642 SUBT Not a quoted string /* subtitle
644 FIL label isn't quoted.
648 /**/ lab not quoted here either
651 AT_DATA([expout], [dnl
654 quoted_string 'Quoted_string_title'
662 quoted_string "Quoted_string_on_second_line"
667 quoted_string "Quoted_string_subtitle"
676 identifier TITL space
677 unquoted_string /*_Not_a_*/_quoted_string_title
681 identifier SUBT space
682 unquoted_string Not_a_quoted_string_/*_subtitle
689 identifier label space
690 unquoted_string isn't_quoted
699 quoted_string 'is_quoted'
703 identifier FILE space
710 unquoted_string not_quoted_here_either
718 PSPP_CHECK_SEGMENT([-i])
721 AT_SETUP([BEGIN DATA command])
722 AT_KEYWORDS([segment])
723 AT_DATA([input], [dnl
748 AT_DATA([expout], [dnl
749 identifier begin space
762 identifier begin space
788 inline_data 5_6_7_/*_x
794 inline_data end__data
825 identifier begin space
826 identifier data space
831 identifier begin space
832 identifier data space
837 reserved_word not space
843 PSPP_CHECK_SEGMENT([-i])
846 AT_SETUP([DO REPEAT command])
847 AT_KEYWORDS([segment])
848 AT_DATA([input], [dnl
851 do repeat a=1 thru 5.
855 end /* x */ /* y */ repeat print.
863 AT_DATA([expout], [dnl
865 identifier repeat space
880 newline \n (DO REPEAT)
882 do_repeat_command __do_repeat_a=1_thru_5.
883 newline \n (DO REPEAT)
885 do_repeat_command another_command.
886 newline \n (DO REPEAT)
888 do_repeat_command second_command
889 newline \n (DO REPEAT)
891 do_repeat_command +_third_command.
892 newline \n (DO REPEAT)
894 do_repeat_command end_/*_x_*/_/*_y_*/_repeat_print.
895 newline \n (DO REPEAT)
908 identifier repeat space
913 newline \n (DO REPEAT)
915 do_repeat_command __inner_command.
916 newline \n (DO REPEAT)
925 PSPP_CHECK_SEGMENT([-i])
928 AT_SETUP([batch mode])
929 AT_KEYWORDS([segment])
930 AT_DATA([input], [dnl
932 another line of first command
939 AT_DATA([expout], [dnl
940 identifier first space
945 identifier another space
946 identifier line space
948 identifier first space
954 identifier second space
959 identifier third space
966 identifier fourth space
972 identifier fifth space
979 PSPP_CHECK_SEGMENT([-b])
982 AT_SETUP([auto mode])
983 AT_KEYWORDS([segment])
984 AT_DATA([input], [dnl
986 another line of command
989 another line of second command
999 AT_DATA([expout], [dnl
1004 identifier another space
1005 identifier line space
1017 identifier another space
1021 identifier another space
1022 identifier line space
1024 identifier second space
1029 identifier data space
1030 identifier list space
1037 identifier aggregate
1041 identifier print space
1046 identifier twostep space
1056 identifier fourth space
1062 identifier fifth space
1069 PSPP_CHECK_SEGMENT([-a])