Search in sources :

Example 1 with IVarIndex

use of org.beetl.core.statement.IVarIndex in project beetl2.0 by javamonkey.

the class VarDescrption method anzlyszeGlobal.

public void anzlyszeGlobal() {
    int index = 0;
    for (Entry<String, VarDescrption> entry : globalVar.entrySet()) {
        globalIndexMap.put(entry.getKey(), index);
        VarDescrption vd = entry.getValue();
        String[] attrs = vd.attrList.toArray(new String[0]);
        globaVarAttr.put(entry.getKey(), attrs);
        for (ASTNode node : vd.where) {
            ((IVarIndex) node).setVarIndex(index);
        }
        index++;
    }
}
Also used : IVarIndex(org.beetl.core.statement.IVarIndex) ASTNode(org.beetl.core.statement.ASTNode)

Example 2 with IVarIndex

use of org.beetl.core.statement.IVarIndex in project beetl2.0 by javamonkey.

the class VarDescrption method anzlysze.

private void anzlysze(BlockEnvContext block, int nextIndex, boolean isRoot) {
    for (Entry<String, VarDescrption> entry : block.vars.entrySet()) {
        VarDescrption vd = entry.getValue();
        // if (!vd.where.isEmpty()) {
        for (ASTNode node : vd.where) {
            ((IVarIndex) node).setVarIndex(nextIndex);
            if (isRoot) {
                this.rootIndexMap.put(vd.getVarName(), nextIndex);
            }
        }
        nextIndex++;
    // }
    }
    varIndexSize = Math.max(varIndexSize, nextIndex);
    for (BlockEnvContext subBlock : block.blockList) {
        anzlysze(subBlock, nextIndex, false);
        int inc = subBlock.vars.size();
        varIndexSize = Math.max(varIndexSize, nextIndex + inc);
    }
}
Also used : IVarIndex(org.beetl.core.statement.IVarIndex) ASTNode(org.beetl.core.statement.ASTNode)

Example 3 with IVarIndex

use of org.beetl.core.statement.IVarIndex in project beetl2.0 by javamonkey.

the class VarDescrption method toString.

public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("").append(attrList).append("\n");
    sb.append("where:");
    ;
    for (ASTNode w : where) {
        sb.append("索引:").append(((IVarIndex) w).getVarIndex()).append(",").append(w.token.line).append("行");
        sb.append(";");
    }
    sb.append("\n");
    return sb.toString();
}
Also used : IVarIndex(org.beetl.core.statement.IVarIndex) ASTNode(org.beetl.core.statement.ASTNode)

Aggregations

ASTNode (org.beetl.core.statement.ASTNode)3 IVarIndex (org.beetl.core.statement.IVarIndex)3