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])
5 AT_CHECK([segment-test -0 $1 input])
6 AT_CHECK([segment-test -01 $1 input])])
8 AT_SETUP([identifiers])
15 grève@<00A0>@Ângstrom@<00A0>@poté
23 AT_DATA([expout], [dnl
68 identifier #12345 space
88 PSPP_CHECK_SEGMENT([-i])
91 AT_SETUP([identifiers that end in '.'])
92 AT_KEYWORDS([segment])
105 QRSTUV./* end of line comment */
106 qrstuv. /* end of line comment */
107 QrStUv./* end of line comment */ @&t@
108 wxyz./* unterminated end of line comment
109 WXYZ. /* unterminated end of line comment
110 WxYz./* unterminated end of line comment @&t@
112 AT_DATA([expout], [dnl
113 identifier abcd. space
118 identifier ABCD. space
123 identifier aBcD. space
155 start_command . space
164 comment /*_end_of_line_comment_*/
169 comment /*_end_of_line_comment_*/
174 comment /*_end_of_line_comment_*/ space
179 comment /*_unterminated_end_of_line_comment
184 comment /*_unterminated_end_of_line_comment
189 comment /*_unterminated_end_of_line_comment_
194 PSPP_CHECK_SEGMENT([-i])
197 AT_SETUP([reserved words])
198 AT_KEYWORDS([segment])
199 AT_DATA([input], [dnl
200 and or not eq ge gt le lt ne all by to with
201 AND OR NOT EQ GE GT LE LT NE ALL BY TO WITH
202 andx orx notx eqx gex gtx lex ltx nex allx byx tox withx
205 AT_DATA([expout], [dnl
206 reserved_word and space
207 reserved_word or space
208 reserved_word not space
209 reserved_word eq space
210 reserved_word ge space
211 reserved_word gt space
212 reserved_word le space
213 reserved_word lt space
214 reserved_word ne space
215 reserved_word all space
216 reserved_word by space
217 reserved_word to space
221 reserved_word AND space
222 reserved_word OR space
223 reserved_word NOT space
224 reserved_word EQ space
225 reserved_word GE space
226 reserved_word GT space
227 reserved_word LE space
228 reserved_word LT space
229 reserved_word NE space
230 reserved_word ALL space
231 reserved_word BY space
232 reserved_word TO space
236 identifier andx space
238 identifier notx space
245 identifier allx space
251 identifier and. space
258 PSPP_CHECK_SEGMENT([-i])
261 AT_SETUP([punctuation])
262 AT_KEYWORDS([segment])
263 AT_DATA([input], [dnl
264 ~ & | = >= > <= < ~= <> ( ) , - + * / [[ ]] **
265 ~&|=>=><=<~=<>(),-+*/[[]]**
267 AT_DATA([expout], [dnl
314 PSPP_CHECK_SEGMENT([-i])
318 AT_KEYWORDS([segment])
319 AT_DATA([input], [dnl
321 123. /* comment 1 */ /* comment 2 */
323 5e1 6E-1 7e+1 6E+01 6e-03
324 .3E1 .4e-1 .5E+1 .6e+01 .7E-03
325 1.23e1 45.6E-1 78.9e+1 99.9E+01 11.2e-03
328 AT_DATA([expout], [dnl
339 comment /*_comment_1_*/ space
340 comment /*_comment_2_*/
368 number 99.9E+01 space
372 start_command . space
373 expected_exponent 1e space
375 expected_exponent 1e+ space
376 expected_exponent 1e-
381 PSPP_CHECK_SEGMENT([-i])
385 AT_KEYWORDS([segment])
386 AT_DATA([input], [dnl
388 'Don''t' "Can't" 'Won''t'
389 """quoted""" '"quoted"'
392 "missing double quote
396 + /* comment */ 'string continuation'
397 + /* also a punctuator on blank line
400 AT_DATA([expout], [dnl
401 quoted_string 'x' space
402 quoted_string "y" space
406 quoted_string 'Don''t' space
407 quoted_string "Can't" space
408 quoted_string 'Won''t'
411 quoted_string """quoted""" space
412 quoted_string '"quoted"'
415 quoted_string '' space
419 expected_quote 'missing_end_quote
422 expected_quote "missing_double_quote
425 hex_string x"4142" space
429 unicode_string u'fffd' space
430 unicode_string U"041"
433 start_command + space
439 comment /*_comment_*/ space
440 quoted_string 'string_continuation'
444 comment /*_also_a_punctuator_on_blank_line
447 start_command - space
448 quoted_string 'new_command'
453 PSPP_CHECK_SEGMENT([-i])
456 AT_SETUP([@%:@! construct])
457 AT_KEYWORDS([segment])
458 AT_DATA([input], [dnl
463 AT_DATA([expout], [dnl
464 shbang #!_/usr/bin/pspp
467 identifier title space
468 unquoted_string my_title
473 unexpected_char ! space
484 PSPP_CHECK_SEGMENT([-i])
487 AT_SETUP([* and COMMENT commands])
488 AT_KEYWORDS([segment])
489 AT_DATA([input], [dnl
490 * Comment commands "don't
491 have to contain valid tokens.
493 ** Check ambiguity with ** token.
496 comment keyword works too.
498 com is ambiguous with COMPUTE.
500 * Comment need not start at left margin.
502 * Comment ends with blank line
507 AT_DATA([expout], [dnl
508 comment_command *_Comment_commands_"don't
511 comment_command have_to_contain_valid_tokens
518 comment_command **_Check_ambiguity_with_**_token
522 comment_command ****************
529 comment_command comment_keyword_works_too
533 comment_command COMM_also
539 identifier ambiguous space
540 reserved_word with space
549 comment_command *_Comment_need_not_start_at_left_margin
556 comment_command *_Comment_ends_with_blank_line
562 identifier next space
572 PSPP_CHECK_SEGMENT([-i])
575 AT_SETUP([DOCUMENT command])
576 AT_KEYWORDS([segment])
577 AT_DATA([input], [dnl
585 isn't parsed as tokens
589 AT_DATA([expout], [dnl
591 document DOCUMENT_one_line.
598 newline \n (DOCUMENT)
601 newline \n (DOCUMENT)
604 newline \n (DOCUMENT)
606 document ____________line.
613 newline \n (DOCUMENT)
615 document first.paragraph
616 newline \n (DOCUMENT)
618 document isn't_parsed_as_tokens
619 newline \n (DOCUMENT)
622 newline \n (DOCUMENT)
624 document second_paragraph.
631 PSPP_CHECK_SEGMENT([-i])
634 AT_SETUP([TITLE, SUBTITLE, FILE LABEL commands])
635 AT_KEYWORDS([segment])
636 AT_DATA([input], [dnl
637 title/**/'Quoted string title'.
639 "Quoted string on second line".
640 sub "Quoted string subtitle"
643 TITL /* Not a */ quoted string title.
644 SUBT Not a quoted string /* subtitle
646 FIL label isn't quoted.
650 /**/ lab not quoted here either
653 AT_DATA([expout], [dnl
656 quoted_string 'Quoted_string_title'
664 quoted_string "Quoted_string_on_second_line"
669 quoted_string "Quoted_string_subtitle"
678 identifier TITL space
679 unquoted_string /*_Not_a_*/_quoted_string_title
683 identifier SUBT space
684 unquoted_string Not_a_quoted_string_/*_subtitle
691 identifier label space
692 unquoted_string isn't_quoted
701 quoted_string 'is_quoted'
705 identifier FILE space
712 unquoted_string not_quoted_here_either
720 PSPP_CHECK_SEGMENT([-i])
723 AT_SETUP([BEGIN DATA command])
724 AT_KEYWORDS([segment])
725 AT_DATA([input], [dnl
750 AT_DATA([expout], [dnl
751 identifier begin space
764 identifier begin space
790 inline_data 5_6_7_/*_x
796 inline_data end__data
827 identifier begin space
828 identifier data space
833 identifier begin space
834 identifier data space
839 reserved_word not space
845 PSPP_CHECK_SEGMENT([-i])
848 AT_SETUP([DO REPEAT command])
849 AT_KEYWORDS([segment])
850 AT_DATA([input], [dnl
853 do repeat a=1 thru 5.
857 end /* x */ /* y */ repeat print.
865 AT_DATA([expout], [dnl
867 identifier repeat space
882 newline \n (DO REPEAT)
884 do_repeat_command __do_repeat_a=1_thru_5.
885 newline \n (DO REPEAT)
887 do_repeat_command another_command.
888 newline \n (DO REPEAT)
890 do_repeat_command second_command
891 newline \n (DO REPEAT)
893 do_repeat_command +_third_command.
894 newline \n (DO REPEAT)
896 do_repeat_command end_/*_x_*/_/*_y_*/_repeat_print.
897 newline \n (DO REPEAT)
910 identifier repeat space
915 newline \n (DO REPEAT)
917 do_repeat_command __inner_command.
918 newline \n (DO REPEAT)
927 PSPP_CHECK_SEGMENT([-i])
930 AT_SETUP([batch mode])
931 AT_KEYWORDS([segment])
932 AT_DATA([input], [dnl
934 another line of first command
941 AT_DATA([expout], [dnl
942 identifier first space
947 identifier another space
948 identifier line space
950 identifier first space
956 identifier second space
961 identifier third space
968 identifier fourth space
974 identifier fifth space
981 PSPP_CHECK_SEGMENT([-b])
984 AT_SETUP([auto mode])
985 AT_KEYWORDS([segment])
986 AT_DATA([input], [dnl
988 another line of command
991 another line of second command
1001 AT_DATA([expout], [dnl
1006 identifier another space
1007 identifier line space
1019 identifier another space
1023 identifier another space
1024 identifier line space
1026 identifier second space
1031 identifier data space
1032 identifier list space
1039 identifier aggregate
1043 identifier print space
1048 identifier twostep space
1058 identifier fourth space
1064 identifier fifth space
1071 PSPP_CHECK_SEGMENT([-a])