VDScriptAst.cpp revision c299849be8ae3544715e8806e1433cae67d93e2e
/** $Id$ */
/** @file
*
* VBox HDD container test utility - scripting engine AST node related functions.
*/
/*
* 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;
* 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 "VDScriptAst.h"
/**
* Put all child nodes of the given expression AST node onto the given to free list.
*
* @returns nothing.
* @param pList The free list to append everything to.
* @param pAstNode The expression node to free.
*/
{
("Given AST node is not a statement\n"));
{
break;
break;
{
break;
}
{
{
}
break;
}
{
{
}
break;
}
{
break;
}
{
break;
}
case VDSCRIPTEXPRTYPE_MODULUS:
case VDSCRIPTEXPRTYPE_LSR:
case VDSCRIPTEXPRTYPE_LSL:
case VDSCRIPTEXPRTYPE_LOWER:
case VDSCRIPTEXPRTYPE_HIGHER:
case VDSCRIPTEXPRTYPE_EQUAL:
case VDSCRIPTEXPRTYPE_ASSIGN:
{
break;
}
case VDSCRIPTEXPRTYPE_INVALID:
default:
AssertMsgFailedReturnVoid(("Invalid AST node expression type %d\n",
}
}
/**
* Free a given statement AST node and put everything on the given to free list.
*
* @returns nothing.
* @param pList The free list to append everything to.
* @param pAstNode The statement node to free.
*/
{
("Given AST node is not a statement\n"));
switch (pStmt->enmStmtType)
{
{
/* Put all declarations on the to free list. */
{
}
/* Put all statements on the to free list. */
{
}
break;
}
{
break;
}
case VDSCRIPTSTMTTYPE_IF:
{
break;
}
case VDSCRIPTSTMTTYPE_SWITCH:
{
break;
}
case VDSCRIPTSTMTTYPE_WHILE:
{
break;
}
case VDSCRIPTSTMTTYPE_FOR:
{
break;
}
case VDSCRIPTSTMTTYPE_RETURN:
{
break;
}
case VDSCRIPTSTMTTYPE_CASE:
{
break;
}
case VDSCRIPTSTMTTYPE_DEFAULT:
{
break;
}
case VDSCRIPTSTMTTYPE_BREAK:
break;
case VDSCRIPTSTMTTYPE_INVALID:
default:
AssertMsgFailedReturnVoid(("Invalid AST node statement type %d\n",
pStmt->enmStmtType));
}
}
{
/*
* The node is not allowed to be part of a list because we need it
* for the nodes to free list.
*/
do
{
{
{
/* Put argument list on the to free list. */
{
}
/* Put compound statement onto the list. */
break;
}
{
if (pAstNodeArg->pType)
if (pAstNodeArg->pArgIde)
break;
}
break;
{
AssertMsgFailed(("TODO\n"));
break;
}
{
break;
}
{
break;
}
case VDSCRIPTASTCLASS_INVALID:
default:
}
} while (!RTListIsEmpty(&ListFree));
}
{
switch (enmClass)
{
cbAlloc = sizeof(VDSCRIPTASTFN);
break;
cbAlloc = sizeof(VDSCRIPTASTFNARG);
break;
cbAlloc = sizeof(VDSCRIPTASTDECL);
break;
cbAlloc = sizeof(VDSCRIPTASTSTMT);
break;
cbAlloc = sizeof(VDSCRIPTASTEXPR);
break;
cbAlloc = sizeof(VDSCRIPTASTTYPENAME);
break;
case VDSCRIPTASTCLASS_INVALID:
default:
}
if (pAstNode)
{
}
return pAstNode;
}
{
PVDSCRIPTASTIDE pAstNode = (PVDSCRIPTASTIDE)RTMemAllocZ(RT_OFFSETOF(VDSCRIPTASTIDE, aszIde[cchIde + 1]));
if (pAstNode)
{
}
return pAstNode;
}