Browse Source

Fix expansion of several macros per line

Alois Mahdal 6 years ago
parent
commit
18675a9c97
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      src/include/build.sh

+ 9
- 5
src/include/build.sh View File

47
     local line=$1   # line to process
47
     local line=$1   # line to process
48
     local mname     # macro name
48
     local mname     # macro name
49
     local mvline    # line of macro value
49
     local mvline    # line of macro value
50
+    local xline     # expanded line
51
+    xline=$line
50
     for mname in "${!MacroMap[@]}"; do
52
     for mname in "${!MacroMap[@]}"; do
51
         if ! test "${line//$mname}" == "$line"; then
53
         if ! test "${line//$mname}" == "$line"; then
52
-            while IFS= read -r mvline; do
53
-                echo "${line//$mname/$mvline}"
54
-            done <<<"${MacroMap[$mname]}"
55
-            return 0
54
+            xline=$(
55
+                while IFS= read -r mvline; do
56
+                    echo "${line//$mname/$mvline}"
57
+                done <<<"${MacroMap[$mname]}"
58
+            )
56
         fi
59
         fi
60
+        line=$xline
57
     done
61
     done
58
-    echo "$line"
62
+    echo "$xline"
59
     return 1
63
     return 1
60
 }
64
 }
61
 
65