aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-03 17:45:57 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-03 17:46:11 +0100
commit1816931fc0645f187c0ca9395cba14cd16a87be4 (patch)
tree568d5636a6754c5deea1e58d536cb4d11e11e8eb
parentmds-kbdc: make-tree: whitespace (diff)
downloadmds-1816931fc0645f187c0ca9395cba14cd16a87be4.tar.gz
mds-1816931fc0645f187c0ca9395cba14cd16a87be4.tar.bz2
mds-1816931fc0645f187c0ca9395cba14cd16a87be4.tar.xz
mds-kbdc: m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/mds-kbdc/make-tree.c2
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/README4
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/alive-code/for-function-return-end-alive25
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/alive-code/for-macro-return-end-alive25
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead3
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead3
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead3
-rw-r--r--test-files/mds-kbdc/process-includes/README4
-rw-r--r--test-files/mds-kbdc/simplify-tree/invalid/map_to_unordered_and_alternative (renamed from test-files/mds-kbdc/simplify-tree/invalid/map_to_unorderd_and_alternative)0
-rw-r--r--test-files/mds-kbdc/validate-tree/README4
-rw-r--r--test-files/mds-kbdc/validate-tree/invalid/function-map3
11 files changed, 72 insertions, 4 deletions
diff --git a/src/mds-kbdc/make-tree.c b/src/mds-kbdc/make-tree.c
index 964de3e..e6705fc 100644
--- a/src/mds-kbdc/make-tree.c
+++ b/src/mds-kbdc/make-tree.c
@@ -1186,6 +1186,7 @@ static int parse_map(void)
#define inner result
stack_ptr--;
*end = prev_end_char;
+ supernode->loc_end = (size_t)(end - LINE);
SKIP_SPACES(line);
if (colon = line, *line++ != ':')
{
@@ -1200,6 +1201,7 @@ static int parse_map(void)
SEQUENCE_FULLY_POPPED;
stack_ptr--;
*end = prev_end_char;
+ supernode->loc_end = (size_t)(end - LINE);
SKIP_SPACES(line);
#define node supernode
LEAF;
diff --git a/test-files/mds-kbdc/eliminate-dead-code/README b/test-files/mds-kbdc/eliminate-dead-code/README
new file mode 100644
index 0000000..a277219
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/README
@@ -0,0 +1,4 @@
+When testing these files it is important to
+`goto stop;` after `eliminate_dead_code` been
+called in `mds-kbdc.c`.
+
diff --git a/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-function-return-end-alive b/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-function-return-end-alive
new file mode 100644
index 0000000..7a02539
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-function-return-end-alive
@@ -0,0 +1,25 @@
+for 1 to 2 as \1
+ function f/0
+ return
+ end function
+ <alive> : "code"
+end for
+
+# (for (@ 1 0-3) ‘1’ ‘2’ (.variable ‘\1’)
+# (.inner
+# (function (@ 2 2-10) ‘f/0’
+# (.inner
+# (return (@ 3 4-10))
+# )
+# )
+# (map (@ 5 2-18)
+# (.sequence
+# (keys (@ 5 2-9) ‘<alive>’)
+# )
+# (.result
+# (string (@ 5 12-18) ‘"code"’)
+# )
+# )
+# )
+# )
+
diff --git a/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-macro-return-end-alive b/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-macro-return-end-alive
new file mode 100644
index 0000000..516e622
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-macro-return-end-alive
@@ -0,0 +1,25 @@
+for 1 to 2 as \1
+ macro m/0
+ return
+ end macro
+ <alive> : "code"
+end for
+
+# (for (@ 1 0-3) ‘1’ ‘2’ (.variable ‘\1’)
+# (.inner
+# (macro (@ 2 2-7) ‘m/0’
+# (.inner
+# (return (@ 3 4-10))
+# )
+# )
+# (map (@ 5 2-18)
+# (.sequence
+# (keys (@ 5 2-9) ‘<alive>’)
+# )
+# (.result
+# (string (@ 5 12-18) ‘"code"’)
+# )
+# )
+# )
+# )
+
diff --git a/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead b/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead
index 108c7b0..e817aa9 100644
--- a/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead
+++ b/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead
@@ -19,7 +19,8 @@ end for
# )
# )
# )
-# :7:2–2: warning: statement is unreachable
+# :7:2–27: warning: statement is unreachable
# <dead code> : "dead code"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^
#
diff --git a/test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead b/test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead
index 39fb763..beb504f 100644
--- a/test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead
+++ b/test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead
@@ -14,7 +14,8 @@ end function
# )
# )
# )
-# :5:2–2: warning: statement is unreachable
+# :5:2–13: warning: statement is unreachable
# "dead code"
+# ^^^^^^^^^^^
#
diff --git a/test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead b/test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead
index eb8fdaa..b7a42f8 100644
--- a/test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead
+++ b/test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead
@@ -14,7 +14,8 @@ end macro
# )
# )
# )
-# :5:2–2: warning: statement is unreachable
+# :5:2–27: warning: statement is unreachable
# <dead code> : "dead code"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^
#
diff --git a/test-files/mds-kbdc/process-includes/README b/test-files/mds-kbdc/process-includes/README
new file mode 100644
index 0000000..f99d64b
--- /dev/null
+++ b/test-files/mds-kbdc/process-includes/README
@@ -0,0 +1,4 @@
+When testing these files it is important to
+`goto stop;` after `process_includes` been called
+in `mds-kbdc.c`.
+
diff --git a/test-files/mds-kbdc/simplify-tree/invalid/map_to_unorderd_and_alternative b/test-files/mds-kbdc/simplify-tree/invalid/map_to_unordered_and_alternative
index 283d6c3..283d6c3 100644
--- a/test-files/mds-kbdc/simplify-tree/invalid/map_to_unorderd_and_alternative
+++ b/test-files/mds-kbdc/simplify-tree/invalid/map_to_unordered_and_alternative
diff --git a/test-files/mds-kbdc/validate-tree/README b/test-files/mds-kbdc/validate-tree/README
new file mode 100644
index 0000000..6481bd2
--- /dev/null
+++ b/test-files/mds-kbdc/validate-tree/README
@@ -0,0 +1,4 @@
+When testing these files it is important to
+`goto stop;` after `validate_tree` been called
+in `mds-kbdc.c`.
+
diff --git a/test-files/mds-kbdc/validate-tree/invalid/function-map b/test-files/mds-kbdc/validate-tree/invalid/function-map
index 1768d63..fbf1968 100644
--- a/test-files/mds-kbdc/validate-tree/invalid/function-map
+++ b/test-files/mds-kbdc/validate-tree/invalid/function-map
@@ -16,7 +16,8 @@ end function
# )
# )
# )
-# :2:2–2: error: mapping-statement inside function definition
+# :2:2–30: error: mapping-statement inside function definition
# <dead compose> "a" "e" : "æ"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#