diff --git a/Tag.cpp b/Tag.cpp
index ec8a17a..316e781 100644
--- a/Tag.cpp
+++ b/Tag.cpp
@@ -202,7 +202,10 @@ namespace jet {
}
} else if(in.startsWith("$[") || in.startsWith("#[")) {
global.errorCursor = in.getCursor();
- out.write(global.getVariable(in, variables));
+ if(resolveContainerParent)
+ out.write(global.getVariable(in, parent->variables));
+ else
+ out.write(global.getVariable(in, variables));
} else {
out.write(in.nextChar());
}
diff --git a/Tag.h b/Tag.h
index cd2ed97..5bb67dc 100644
--- a/Tag.h
+++ b/Tag.h
@@ -40,6 +40,7 @@ namespace jet {
bool filterBlankLines = false;
bool trimLines = false;
bool cleanWhitespace = false;
+ bool resolveContainerParent = false;
private:
bool containerOnly = false;
diff --git a/__set.cpp b/__set.cpp
index c7e2114..78cbea1 100644
--- a/__set.cpp
+++ b/__set.cpp
@@ -8,6 +8,7 @@ namespace jet {
__set::__set(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
output = false;
+ resolveContainerParent = true;
if(!variableDefined("name"))
throw coreutils::Exception("set tag must have name defined.");
if(!variableDefined("expr") && variableDefined("value") && hasContainer)
diff --git a/jet-2.0.cpp b/jet-2.0.cpp
index 0da4518..8ceffe6 100644
--- a/jet-2.0.cpp
+++ b/jet-2.0.cpp
@@ -16,7 +16,6 @@ int main(int argc, char **argv, char **envp) {
try {
coreutils::MString out;
- data.reset();
global.errorCursor = data.getCursor();
jet::__jet *jet = new jet::__jet(data, out, global, NULL);
delete jet;
diff --git a/tests/testjet.jet b/tests/testjet.jet
index e8bfaaf..e16fcdd 100755
--- a/tests/testjet.jet
+++ b/tests/testjet.jet
@@ -3,7 +3,7 @@
This is a comment and should not show up in the output.
- ---
+ ---#[name1]
$[modified1;tohex]
@@ -23,8 +23,8 @@
-
- $[$nested]
+
+ $[nested]
0123456789
lefty=[$[lefty]]
@@ -34,8 +34,8 @@
5*3($[multiplication])
5/3($[division])
- this is the value store in #[name].
- this is the value store in #[name].
+ this is the value store in #[name1].
+ this is the value store in #[name1].
another container value
include: $[include]
diff --git a/tests/testscope.jet b/tests/testscope.jet
index c3064c8..3dcf55b 100755
--- a/tests/testscope.jet
+++ b/tests/testscope.jet
@@ -1,8 +1,5 @@
#!../jet-2.0
-
- #[testvar]
-
- -->#[ix]<--
-
+
+ $[x] $[x]