1 AT_BANNER([syntax scanning])
2 m4_define([PSPP_CHECK_SCAN],
3 [AT_CHECK([scan-test $1 input], [0], [expout])])
5 AT_SETUP([identifiers])
8 a aB i5 $x @efg @@. #.# .x _z.
10 QRSTUV./* end of line comment */
11 QrStUv./* end of line comment */ @&t@
12 WXYZ. /* unterminated end of line comment
13 �. /* U+FFFD is not valid in an identifier
15 AT_DATA([expout], [dnl
66 AT_SETUP([reserved words])
69 and or not eq ge gt le lt ne all by to with
70 AND OR NOT EQ GE GT LE LT NE ALL BY TO WITH
71 andx orx notx eqx gex gtx lex ltx nex allx byx tox withx
74 AT_DATA([expout], [dnl
160 PSPP_CHECK_SCAN([-i])
163 AT_SETUP([punctuation])
165 AT_DATA([input], [dnl
166 ~ & | = >= > <= < ~= <> ( ) , - + * / [[ ]] **
167 ~&|=>=><=<~=<>(),-+*/[[]]**
169 AT_DATA([expout], [dnl
233 PSPP_CHECK_SCAN([-i])
238 AT_DATA([input], [dnl
240 123. /* comment 1 */ /* comment 2 */
242 5e1 6E-1 7e+1 6E+01 6e-03
243 .3E1 .4e-1 .5E+1 .6e+01 .7E-03
244 1.23e1 45.6E-1 78.9e+1 99.9E+01 11.2e-03
247 AT_DATA([expout], [dnl
308 EXPECTED_EXPONENT "1e"
312 EXPECTED_EXPONENT "1e+"
314 EXPECTED_EXPONENT "1e-"
318 PSPP_CHECK_SCAN([-i])
323 AT_DATA([input], [dnl
325 'Don''t' "Can't" 'Won''t'
326 """quoted""" '"quoted"'
329 "missing double quote
332 'a' /* abc */ + "b" /*
333 + 'c' +/* */"d"/* */+'e'
335 + /* special case: + in column 0 would ordinarily start a new command
352 "abc"+U"FFFD"+u'3048'+"xyz"
354 AT_DATA([expout], [dnl
413 PSPP_CHECK_SCAN([-i])
416 AT_SETUP([@%:@! construct])
418 AT_DATA([input], [dnl
422 AT_DATA([expout], [dnl
437 PSPP_CHECK_SCAN([-i])
440 AT_SETUP([* and COMMENT commands])
442 AT_DATA([input], [dnl
443 * Comment commands "don't
444 have to contain valid tokens.
446 ** Check ambiguity with ** token.
449 comment keyword works too.
451 com is ambiguous with COMPUTE.
453 * Comment need not start at left margin.
455 * Comment ends with blank line
460 AT_DATA([expout], [dnl
514 PSPP_CHECK_SCAN([-i])
517 AT_SETUP([DOCUMENT command])
519 AT_DATA([input], [dnl
527 isn't parsed as tokens
531 AT_DATA([expout], [dnl
533 STRING "DOCUMENT one line."
551 STRING "first.paragraph"
553 STRING "isn't parsed as tokens"
557 STRING "second paragraph."
563 PSPP_CHECK_SCAN([-i])
566 AT_SETUP([TITLE, SUBTITLE, FILE LABEL commands])
568 AT_DATA([input], [dnl
569 title/**/'Quoted string title'.
571 "Quoted string on second line".
572 sub "Quoted string subtitle"
575 TITL /* Not a */ quoted string title.
576 SUBT Not a quoted string /* subtitle
578 FIL label isn't quoted.
582 /**/ lab not quoted here either
585 AT_DATA([expout], [dnl
588 STRING "Quoted string title"
595 STRING "Quoted string on second line"
600 STRING "Quoted string subtitle"
609 STRING "/* Not a */ quoted string title"
614 STRING "Not a quoted string /* subtitle"
622 STRING "isn't quoted"
641 STRING "not quoted here either"
647 PSPP_CHECK_SCAN([-i])
650 AT_SETUP([BEGIN DATA command])
652 AT_DATA([input], [dnl
665 AT_DATA([expout], [dnl
704 PSPP_CHECK_SCAN([-i])
707 AT_SETUP([DO REPEAT command])
709 AT_DATA([input], [dnl
712 do repeat a=1 thru 5.
716 end /* x */ /* y */ repeat print.
720 AT_DATA([expout], [dnl
743 STRING " do repeat a=1 thru 5."
745 STRING "another command."
747 STRING "second command"
749 STRING "+ third command."
751 STRING "end /* x */ /* y */ repeat print."
761 PSPP_CHECK_SCAN([-i])
764 AT_SETUP([batch mode])
766 AT_DATA([input], [dnl
768 another line of first command
775 AT_DATA([expout], [dnl
817 PSPP_CHECK_SCAN([-b])