示例#1
0
文件: ast.cs 项目: bitdotgames/bhl
 public override void DoVisit(AST_Literal node)
 {
     if (node.type == ConstType.INT)
     {
         Console.Write(" (INT " + node.nval + ")");
     }
     else if (node.type == ConstType.FLT)
     {
         Console.Write(" (FLT " + node.nval + ")");
     }
     else if (node.type == ConstType.BOOL)
     {
         Console.Write(" (BOOL " + node.nval + ")");
     }
     else if (node.type == ConstType.STR)
     {
         Console.Write(" (STR '" + node.sval + "')");
     }
     else if (node.type == ConstType.NIL)
     {
         Console.Write(" (NULL)");
     }
 }
示例#2
0
 int AddConstant(AST_Literal lt)
 {
     return(AddConstant(new Const(lt.type, lt.nval, lt.sval)));
 }
示例#3
0
        public override void DoVisit(AST_Literal ast)
        {
            int literal_idx = AddConstant(ast);

            Emit(Opcodes.Constant, new int[] { literal_idx });
        }
示例#4
0
文件: ast.cs 项目: bitdotgames/bhl
 public abstract void DoVisit(AST_Literal ast);