fix existing tags

new tags: for,cycle
This commit is contained in:
harttle
2016-06-17 08:39:23 +08:00
parent 8b9e9f759a
commit 0b7da2abf7
24 changed files with 432 additions and 195 deletions
+6 -15
View File
@@ -4,27 +4,18 @@ const error = require('./error.js');
var scope = {
get: function(str) {
str = str && str.trim();
if(!str) return '';
if (lexical.isLiteral(str)) {
var a = lexical.parseLiteral(str);
return lexical.parseLiteral(str);
}
if (lexical.isVariable(str)) {
for (var i = this.scopes.length - 1; i >= 0; i--) {
var v = _.get(this.scopes[i], str);
if (v !== undefined) return v;
}
for (var i = this.scopes.length - 1; i >= 0; i--) {
var v = _.get(this.scopes[i], str);
if (v !== undefined) return v;
}
return '';
},
set: function(k, v){
this.scopes[this.scopes.length-1][k] = v;
set: function(k, v) {
_.set(this.scopes[this.scopes.length - 1], k, v);
return this;
},
push: function(ctx) {
if(!ctx) error(`trying to push ${ctx} into scopes`);
if (!ctx) error(`trying to push ${ctx} into scopes`);
return this.scopes.push(ctx);
},
pop: function() {