X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Flexer%2Fsegment.at;h=86a09411947f883538d3fcedb2482908817832b4;hb=76e0b3df102f54672f8d4dfcc19c144e52a8ff4e;hp=b55216cfefaf54b05a1e913c7d788b0f2a7bb580;hpb=ed109bf498216cef15a3cbf180827dc8b20eff0b;p=pspp diff --git a/tests/language/lexer/segment.at b/tests/language/lexer/segment.at index b55216cfef..86a0941194 100644 --- a/tests/language/lexer/segment.at +++ b/tests/language/lexer/segment.at @@ -16,7 +16,8 @@ dnl along with this program. If not, see . dnl AT_BANNER([syntax segmentation]) m4_define([PSPP_CHECK_SEGMENT], - [for strip in "" "-s"; do + [AT_CAPTURE_FILE([input]) + for strip in "" "-s"; do case $strip in # ( '') sed 's/^-//' < expout-base > expout ;; # ( -s) sed '/^-/d' < expout-base > expout ;; @@ -507,7 +508,8 @@ shbang #!_/usr/bin/pspp newline \n (first) identifier title space -unquoted_string my_title +identifier my space +identifier title end_command . newline \n (first) @@ -673,18 +675,9 @@ end PSPP_CHECK_SEGMENT([-i]) AT_CLEANUP -AT_SETUP([TITLE, SUBTITLE, FILE LABEL commands]) +AT_SETUP([FILE LABEL command]) AT_KEYWORDS([segment]) AT_DATA([input], [dnl -title/**/'Quoted string title'. -tit /* -"Quoted string on second line". -sub "Quoted string subtitle" - . - -TITL /* Not a */ quoted string title. -SUBT Not a quoted string /* subtitle - FIL label isn't quoted. FILE lab 'is quoted'. @@ -693,42 +686,6 @@ FILE /* ]) AT_DATA([expout-base], [dnl -identifier title -comment /**/ -quoted_string 'Quoted_string_title' -end_command . -newline \n (first) - -identifier tit space -comment /* -newline \n (later) - -quoted_string "Quoted_string_on_second_line" -end_command . -newline \n (first) - -identifier sub space -quoted_string "Quoted_string_subtitle" -newline \n (later) - space -end_command . -newline \n (first) - -separate_commands -newline \n (first) - -identifier TITL space -unquoted_string /*_Not_a_*/_quoted_string_title -end_command . -newline \n (first) - -identifier SUBT space -unquoted_string Not_a_quoted_string_/*_subtitle -newline \n (later) - -separate_commands -newline \n (first) - identifier FIL space identifier label space unquoted_string isn't_quoted @@ -1053,6 +1010,417 @@ end PSPP_CHECK_SEGMENT([-b]) AT_CLEANUP +AT_SETUP([DEFINE command - simple]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1() +var1 var2 var3 "!enddefine" +!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +punct ) +spaces +newline \n (DEFINE) + +macro_body var1_var2_var3_"!enddefine" +newline \n (DEFINE) + +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - no newline after parentheses]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1() var1 var2 var3 /* !enddefine +!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +punct ) +macro_body _var1_var2_var3_/*_!enddefine +newline \n (DEFINE) + +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - no newline before !ENDDEFINE]) +AT_KEYWORDS([segment ENDDEFINE]) +AT_DATA([input], [dnl +define !macro1() +var1 var2 var3!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +punct ) +spaces +newline \n (DEFINE) + +macro_body var1_var2_var3 +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - all on one line]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1()var1 var2 var3!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +punct ) +macro_body var1_var2_var3 +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - empty]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1() +!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +punct ) +spaces +newline \n (DEFINE) + +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - blank lines]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1() + + +!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +punct ) +spaces +newline \n (DEFINE) + +macro_body +newline \n (DEFINE) + +macro_body +newline \n (DEFINE) + +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - arguments]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1(a(), b(), c()) +!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +identifier a +punct ( +punct ) +punct , space +identifier b +punct ( +punct ) +punct , space +identifier c +punct ( +punct ) +punct ) +spaces +newline \n (DEFINE) + +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - multiline arguments]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1( + a(), b( + ), + c() +) +!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +newline \n (later) + +spaces __ +identifier a +punct ( +punct ) +punct , space +identifier b +punct ( +newline \n (later) + +spaces __ +punct ) +punct , +newline \n (later) + +spaces __ +identifier c +punct ( +punct ) +newline \n (later) + +punct ) +spaces +newline \n (DEFINE) + +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - arguments start on second line]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1 +(x,y,z +) +content 1 +content 2 +!enddefine. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +newline \n (later) + +punct ( +identifier x +punct , +identifier y +punct , +identifier z +newline \n (later) + +punct ) +spaces +newline \n (DEFINE) + +macro_body content_1 +newline \n (DEFINE) + +macro_body content_2 +newline \n (DEFINE) + +macro_id !enddefine +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - early end of command 1]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1. +data list /x 1. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +end_command . +newline \n (first) + +identifier data space +identifier list space +punct / +identifier x space +number 1 +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - early end of command 2]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1 +x. +data list /x 1. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +newline \n (later) + +identifier x +end_command . +newline \n (first) + +identifier data space +identifier list space +punct / +identifier x space +number 1 +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - early end of command 3]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1(. +x. +data list /x 1. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +end_command . +newline \n (first) + +identifier x +end_command . +newline \n (first) + +identifier data space +identifier list space +punct / +identifier x space +number 1 +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - early end of command 4]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +dnl Notice the command terminator at the end of the DEFINE command, +dnl which should not be there and ends it early. +define !macro1. +data list /x 1. +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +end_command . +newline \n (first) + +identifier data space +identifier list space +punct / +identifier x space +number 1 +end_command . +-newline \n (first) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + +AT_SETUP([DEFINE command - missing !ENDDEFINE]) +AT_KEYWORDS([segment]) +AT_DATA([input], [dnl +define !macro1() +content line 1 +content line 2 +]) +AT_DATA([expout-base], [dnl +identifier define space +macro_id !macro1 +punct ( +punct ) +spaces +newline \n (DEFINE) + +macro_body content_line_1 +newline \n (DEFINE) + +macro_body content_line_2 +-newline \n (DEFINE) +- +end +]) +PSPP_CHECK_SEGMENT([-i]) +AT_CLEANUP + AT_SETUP([batch mode]) AT_KEYWORDS([segment]) AT_DATA([input], [dnl