From 39f19113d30e87c1604ed4e8e39ea95f87296767 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 28 Nov 2014 08:54:40 +0100 Subject: m + macro call alternation elimination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- test-files/mds-kbdc/make-tree/README | 4 ++ test-files/mds-kbdc/simplify-tree/README | 4 ++ test-files/mds-kbdc/simplify-tree/valid/macro_call | 12 +++++ .../simplify-tree/valid/macro_call_alternation | 59 ++++++++++++++++++++++ .../valid/macro_call_alternation_with_nothing | 25 +++++++++ .../simplify-tree/valid/macro_call_with_nothing | 19 +++++++ 6 files changed, 123 insertions(+) create mode 100644 test-files/mds-kbdc/make-tree/README create mode 100644 test-files/mds-kbdc/simplify-tree/README create mode 100644 test-files/mds-kbdc/simplify-tree/valid/macro_call create mode 100644 test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation create mode 100644 test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation_with_nothing create mode 100644 test-files/mds-kbdc/simplify-tree/valid/macro_call_with_nothing (limited to 'test-files') diff --git a/test-files/mds-kbdc/make-tree/README b/test-files/mds-kbdc/make-tree/README new file mode 100644 index 0000000..97fc927 --- /dev/null +++ b/test-files/mds-kbdc/make-tree/README @@ -0,0 +1,4 @@ +When testing these files it is important to +`goto stop;` after `parse_to_tree` been called +in `mds-kbdc.c`. + diff --git a/test-files/mds-kbdc/simplify-tree/README b/test-files/mds-kbdc/simplify-tree/README new file mode 100644 index 0000000..33776bb --- /dev/null +++ b/test-files/mds-kbdc/simplify-tree/README @@ -0,0 +1,4 @@ +When testing these files it is important to +`goto stop;` after `simplify_tree` been called +in `mds-kbdc.c`. + diff --git a/test-files/mds-kbdc/simplify-tree/valid/macro_call b/test-files/mds-kbdc/simplify-tree/valid/macro_call new file mode 100644 index 0000000..9341a8b --- /dev/null +++ b/test-files/mds-kbdc/simplify-tree/valid/macro_call @@ -0,0 +1,12 @@ +my_macro() +my_macro(1) + +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments nil) +# ) +# (macro_call (@ 2 0-8) ‘my_macro’ +# (.arguments +# (string (@ 2 9-10) ‘1’) +# ) +# ) + diff --git a/test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation b/test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation new file mode 100644 index 0000000..0122c06 --- /dev/null +++ b/test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation @@ -0,0 +1,59 @@ +my_macro([1 2] [3 4] [5 6]) + +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 10-11) ‘1’) +# (string (@ 1 16-17) ‘3’) +# (string (@ 1 22-23) ‘5’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 10-11) ‘1’) +# (string (@ 1 16-17) ‘3’) +# (string (@ 1 24-25) ‘6’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 10-11) ‘1’) +# (string (@ 1 18-19) ‘4’) +# (string (@ 1 22-23) ‘5’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 10-11) ‘1’) +# (string (@ 1 18-19) ‘4’) +# (string (@ 1 24-25) ‘6’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 12-13) ‘2’) +# (string (@ 1 16-17) ‘3’) +# (string (@ 1 22-23) ‘5’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 12-13) ‘2’) +# (string (@ 1 16-17) ‘3’) +# (string (@ 1 24-25) ‘6’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 12-13) ‘2’) +# (string (@ 1 18-19) ‘4’) +# (string (@ 1 22-23) ‘5’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 12-13) ‘2’) +# (string (@ 1 18-19) ‘4’) +# (string (@ 1 24-25) ‘6’) +# ) +# ) + diff --git a/test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation_with_nothing b/test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation_with_nothing new file mode 100644 index 0000000..0c7096e --- /dev/null +++ b/test-files/mds-kbdc/simplify-tree/valid/macro_call_alternation_with_nothing @@ -0,0 +1,25 @@ +my_macro([1 2] [3 .]) + +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 10-11) ‘1’) +# (string (@ 1 16-17) ‘3’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 10-11) ‘1’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 12-13) ‘2’) +# (string (@ 1 16-17) ‘3’) +# ) +# ) +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments +# (string (@ 1 12-13) ‘2’) +# ) +# ) + diff --git a/test-files/mds-kbdc/simplify-tree/valid/macro_call_with_nothing b/test-files/mds-kbdc/simplify-tree/valid/macro_call_with_nothing new file mode 100644 index 0000000..f067b27 --- /dev/null +++ b/test-files/mds-kbdc/simplify-tree/valid/macro_call_with_nothing @@ -0,0 +1,19 @@ +my_macro(.) +my_macro(. .) + +# (macro_call (@ 1 0-8) ‘my_macro’ +# (.arguments nil) +# ) +# (macro_call (@ 2 0-8) ‘my_macro’ +# (.arguments nil) +# ) +# :1:9–10: warning: ‘.’ outside alternation has no effect +# my_macro(.) +# ^ +# :2:9–10: warning: ‘.’ outside alternation has no effect +# my_macro(. .) +# ^ +# :2:11–12: warning: ‘.’ outside alternation has no effect +# my_macro(. .) +# ^ + -- cgit v1.2.3-70-g09d2