Index: /trunk/src/VBox/Storage/testcase/VDScript.cpp
===================================================================
--- /trunk/src/VBox/Storage/testcase/VDScript.cpp	(revision 44841)
+++ /trunk/src/VBox/Storage/testcase/VDScript.cpp	(revision 44842)
@@ -51,6 +51,6 @@
 #include <VBox/log.h>
 
-#include "VDScript.h"
 #include "VDScriptAst.h"
+#include "VDScriptInternal.h"
 
 /**
@@ -181,6 +181,4 @@
     PVDSCRIPTTOKEN pTokenNext;
 } VDTOKENIZER;
-/** Pointer to a tokenize state. */
-typedef struct VDTOKENIZER *PVDTOKENIZER;
 
 /**
@@ -220,19 +218,4 @@
 } VDSCRIPTFN;
 typedef VDSCRIPTFN *PVDSCRIPTFN;
-
-/**
- * Script context.
- */
-typedef struct VDSCRIPTCTXINT
-{
-    /** String space of external registered and source defined functions. */
-    RTSTRSPACE        hStrSpaceFn;
-    /** List of ASTs for functions - VDSCRIPTASTFN. */
-    RTLISTANCHOR      ListAst;
-    /** Pointer to the current tokenizer state. */
-    PVDTOKENIZER      pTokenizer;
-} VDSCRIPTCTXINT;
-/** Pointer to a script context. */
-typedef VDSCRIPTCTXINT *PVDSCRIPTCTXINT;
 
 /**
@@ -512,5 +495,5 @@
         ch = vdScriptTokenizerGetCh(pTokenizer);
     }
-    while (RT_C_IS_ALNUM(ch));
+    while (RT_C_IS_ALNUM(ch) || ch == '_');
 
     /* Check whether we got an identifier or an reserved keyword. */
@@ -950,4 +933,6 @@
     int rc = VINF_SUCCESS;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     if (vdScriptTokenizerSkipIfIsPunctuatorEqual(pThis->pTokenizer, '('))
     {
@@ -1001,4 +986,5 @@
     }
 
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1016,4 +1002,6 @@
     PVDSCRIPTASTEXPR pExpr = NULL;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     rc = vdScriptParseAssignmentExpression(pThis, &pExpr);
     if (RT_SUCCESS(rc))
@@ -1033,4 +1021,5 @@
     }
 
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1054,4 +1043,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pExpr = NULL;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParsePrimaryExpression(pThis, &pExpr);
@@ -1113,4 +1104,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1139,6 +1132,9 @@
     PVDSCRIPTASTEXPR pExprTop = NULL;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     while (true)
     {
+        bool fQuit = false;
         PVDSCRIPTASTEXPR pExprNew = NULL;
 
@@ -1195,4 +1191,5 @@
             /* Must be a postfix expression. */
             rc = vdScriptParsePostfixExpression(pThis, &pExprNew);
+            fQuit = true;
         }
 
@@ -1209,4 +1206,6 @@
                 pExpr = pExprNew;
             }
+            if (fQuit)
+                break;
         }
         else
@@ -1219,4 +1218,5 @@
         vdScriptAstNodeFree(&pExprTop->Core);
 
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1241,4 +1241,6 @@
     PVDSCRIPTASTEXPR pExpr = NULL;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     rc = vdScriptParseUnaryExpression(pThis, &pExpr);
     if (RT_SUCCESS(rc))
@@ -1286,4 +1288,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1307,4 +1311,6 @@
     PVDSCRIPTASTEXPR pExpr = NULL;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     rc = vdScriptParseMultiplicativeExpression(pThis, &pExpr);
     if (RT_SUCCESS(rc))
@@ -1344,4 +1350,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1365,4 +1373,6 @@
     PVDSCRIPTASTEXPR pExpr = NULL;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     rc = vdScriptParseAdditiveExpression(pThis, &pExpr);
     if (RT_SUCCESS(rc))
@@ -1402,4 +1412,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1425,4 +1437,6 @@
     PVDSCRIPTASTEXPR pExpr = NULL;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     rc = vdScriptParseShiftExpression(pThis, &pExpr);
     if (RT_SUCCESS(rc))
@@ -1478,4 +1492,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1499,4 +1515,6 @@
     PVDSCRIPTASTEXPR pExpr = NULL;
 
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
+
     rc = vdScriptParseRelationalExpression(pThis, &pExpr);
     if (RT_SUCCESS(rc))
@@ -1536,4 +1554,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1555,4 +1575,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pExpr = NULL;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParseEqualityExpression(pThis, &pExpr);
@@ -1582,4 +1604,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1601,4 +1625,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pExpr = NULL;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParseBitwiseAndExpression(pThis, &pExpr);
@@ -1628,4 +1654,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1647,4 +1675,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pExpr = NULL;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParseBitwiseXorExpression(pThis, &pExpr);
@@ -1674,4 +1704,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1693,4 +1725,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pExpr = NULL;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParseBitwiseOrExpression(pThis, &pExpr);
@@ -1720,4 +1754,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1739,4 +1775,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pExpr = NULL;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParseLogicalAndExpression(pThis, &pExpr);
@@ -1766,4 +1804,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1800,4 +1840,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pExpr;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParseLogicalOrExpression(pThis, &pExpr);
@@ -1910,4 +1952,6 @@
             vdScriptAstNodeFree(&pExpr->Core);
     }
+
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1929,4 +1973,6 @@
     int rc = VINF_SUCCESS;
     PVDSCRIPTASTEXPR pAssignExpr = NULL;
+
+    LogFlowFunc(("pThis=%p ppAstNodeExpr=%p\n"));
 
     rc = vdScriptParseAssignmentExpression(pThis, &pAssignExpr);
@@ -1959,4 +2005,5 @@
         *ppAstNodeExpr = pAssignExpr;
 
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -2434,4 +2481,5 @@
                     pAstNodeFn->pFnIde   = pFnIde;
                     pAstNodeFn->pRetType = pRetType;
+                    RTListInit(&pAstNodeFn->ListArgs);
 
                     pFnIde = NULL;
Index: /trunk/src/VBox/Storage/testcase/VDScriptChecker.cpp
===================================================================
--- /trunk/src/VBox/Storage/testcase/VDScriptChecker.cpp	(revision 44842)
+++ /trunk/src/VBox/Storage/testcase/VDScriptChecker.cpp	(revision 44842)
@@ -0,0 +1,30 @@
+/** @file
+ *
+ * VBox HDD container test utility - scripting engine, type and context checker.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#define LOGGROUP LOGGROUP_DEFAULT
+#include <iprt/list.h>
+#include <iprt/mem.h>
+#include <iprt/assert.h>
+
+#include <VBox/log.h>
+
+#include "VDScriptAst.h"
+#include "VDScriptInternal.h"
+
+DECLHIDDEN(int) vdScriptCtxCheck(PVDSCRIPTCTXINT pThis)
+{
+    return VERR_NOT_IMPLEMENTED;
+}
Index: /trunk/src/VBox/Storage/testcase/VDScriptInternal.h
===================================================================
--- /trunk/src/VBox/Storage/testcase/VDScriptInternal.h	(revision 44842)
+++ /trunk/src/VBox/Storage/testcase/VDScriptInternal.h	(revision 44842)
@@ -0,0 +1,65 @@
+/** @file
+ *
+ * VBox HDD container test utility - scripting engine, internal script structures.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#ifndef _VDScriptInternal_h__
+#define _VDScriptInternal_h__
+
+#include <iprt/list.h>
+#include <iprt/string.h>
+
+#include "VDScript.h"
+
+/** Pointer to a tokenize state. */
+typedef struct VDTOKENIZER *PVDTOKENIZER;
+
+/**
+ * Script context.
+ */
+typedef struct VDSCRIPTCTXINT
+{
+    /** String space of external registered and source defined functions. */
+    RTSTRSPACE        hStrSpaceFn;
+    /** List of ASTs for functions - VDSCRIPTASTFN. */
+    RTLISTANCHOR      ListAst;
+    /** Pointer to the current tokenizer state. */
+    PVDTOKENIZER      pTokenizer;
+} VDSCRIPTCTXINT;
+/** Pointer to a script context. */
+typedef VDSCRIPTCTXINT *PVDSCRIPTCTXINT;
+
+/**
+ * Check the context for type correctness.
+ *
+ * @returns VBox status code.
+ * @param   pThis    The script context.
+ */
+DECLHIDDEN(int) vdScriptCtxCheck(PVDSCRIPTCTXINT pThis);
+
+/**
+ * Interprete a given function AST.
+ *
+ * @returns VBox status code.
+ * @param   pThis    The script context.
+ * @param   pAstFn   The function AST to interpret.
+ * @param   paArgs   Arguments to pass to the function.
+ * @param   cArgs    Number of arguments.
+ * @param   pRet     Where to store the return value on success.
+ */
+DECLHIDDEN(int) vdScriptCtxInterprete(PVDSCRIPTCTXINT pThis, PVDSCRIPTASTFN pAstFn, 
+                                      PVDSCRIPTARG paArgs, unsigned cArgs,
+                                      PVDSCRIPTARG pRet);
+
+#endif /* _VDScriptInternal_h__ */
Index: /trunk/src/VBox/Storage/testcase/VDScriptInterp.cpp
===================================================================
--- /trunk/src/VBox/Storage/testcase/VDScriptInterp.cpp	(revision 44842)
+++ /trunk/src/VBox/Storage/testcase/VDScriptInterp.cpp	(revision 44842)
@@ -0,0 +1,53 @@
+/** @file
+ *
+ * VBox HDD container test utility - scripting engine, interpreter.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#define LOGGROUP LOGGROUP_DEFAULT
+#include <iprt/list.h>
+#include <iprt/mem.h>
+#include <iprt/assert.h>
+
+#include <VBox/log.h>
+
+#include "VDScriptAst.h"
+#include "VDScriptInternal.h"
+
+/**
+ * Interpreter context
+ */
+typedef struct VDSCRIPTINTERPCTX
+{
+    /** List of currently accessible variables and their value. */
+
+} VDSCRIPTINTERPCTX;
+/** Pointer to an interpreter context. */
+typedef VDSCRIPTINTERPCTX *PVDSCRIPTINTERPCTX;
+
+/**
+ * Record an error while interpreting.
+ *
+ * @returns VBox status code passed.
+ */
+static int vdScriptInterpreterError(PVDSCRIPTCTXINT pThis, int rc, RT_SRC_POS_DECL, const char *pszFmt, ...)
+{
+    return rc;
+}
+
+DECLHIDDEN(int) vdScriptCtxInterprete(PVDSCRIPTCTXINT pThis, PVDSCRIPTASTFN pAstFn, 
+                                      PVDSCRIPTARG paArgs, unsigned cArgs,
+                                      PVDSCRIPTARG pRet)
+{
+    return VERR_NOT_IMPLEMENTED;
+}
