mirror of
https://github.com/sigmasternchen/sh.js
synced 2025-03-15 07:28:55 +00:00
fixed variable expansion in single-quotes
This commit is contained in:
parent
97b4860961
commit
741ff1c347
1 changed files with 8 additions and 4 deletions
|
@ -283,7 +283,7 @@
|
||||||
if (buffer[0] == '$') {
|
if (buffer[0] == '$') {
|
||||||
value.add(astValueVar(buffer.substring(1)));
|
value.add(astValueVar(buffer.substring(1)));
|
||||||
} else {
|
} else {
|
||||||
value.add(astValueString(buffer));
|
value.add(astValueString(buffer.replaceAll('\\$', '$')));
|
||||||
}
|
}
|
||||||
buffer = "";
|
buffer = "";
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@
|
||||||
if (buffer[0] == '$') {
|
if (buffer[0] == '$') {
|
||||||
current.add(astValueVar(buffer.substring(1)));
|
current.add(astValueVar(buffer.substring(1)));
|
||||||
} else {
|
} else {
|
||||||
current.add(astValueString(buffer));
|
current.add(astValueString(buffer.replaceAll('\\$', '$')));
|
||||||
}
|
}
|
||||||
buffer = "";
|
buffer = "";
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@
|
||||||
if (buffer[0] == '$') {
|
if (buffer[0] == '$') {
|
||||||
value.add(astValueVar(buffer.substring(1)));
|
value.add(astValueVar(buffer.substring(1)));
|
||||||
} else {
|
} else {
|
||||||
value.add(astValueString(buffer));
|
value.add(astValueString(buffer.replaceAll('\\$', '$')));
|
||||||
}
|
}
|
||||||
buffer = "";
|
buffer = "";
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@
|
||||||
if (buffer[0] == '$') {
|
if (buffer[0] == '$') {
|
||||||
current.add(astValueVar(buffer.substring(1)));
|
current.add(astValueVar(buffer.substring(1)));
|
||||||
} else {
|
} else {
|
||||||
current.add(astValueString(buffer));
|
current.add(astValueString(buffer.replaceAll('\\$', '$')));
|
||||||
}
|
}
|
||||||
buffer = "";
|
buffer = "";
|
||||||
}
|
}
|
||||||
|
@ -339,6 +339,10 @@
|
||||||
} else if (c == "'") {
|
} else if (c == "'") {
|
||||||
const end = findSymbolInScope(content, line, "'", i + 1, length);
|
const end = findSymbolInScope(content, line, "'", i + 1, length);
|
||||||
buffer += content.substring(i + 1, end);
|
buffer += content.substring(i + 1, end);
|
||||||
|
if (buffer && buffer[0] == '$') {
|
||||||
|
// mask dollar sign in buffer so the variable is not expanded
|
||||||
|
buffer = '\\' + buffer;
|
||||||
|
}
|
||||||
i = end;
|
i = end;
|
||||||
} else if (c == '=' && current.size() == 0) {
|
} else if (c == '=' && current.size() == 0) {
|
||||||
current = astAssignment(buffer);
|
current = astAssignment(buffer);
|
||||||
|
|
Loading…
Reference in a new issue