VDScriptAst.h revision 8bce22f6f04047918df71d70b614262e1d08dc61
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * VBox HDD container test utility - scripting engine, AST related structures.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * Copyright (C) 2013 Oracle Corporation
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * available from http://www.virtualbox.org. This file is free software;
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * General Public License (GPL) as published by the Free Software
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync * Position information.
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsynctypedef struct VDSRCPOS
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Line in the source. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Current start character .*/
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Current end character. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync/** Pointer to a source position. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST node classes.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Invalid. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Function node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Function argument. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Identifier node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Declaration node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Statement node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Expression node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** @todo: Add if ... else, loops, ... */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** 32bit blowup. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an AST node class. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * Core AST structure.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The node class, used for verification. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** List which might be used. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Position in the source file of this node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an AST core structure. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an statement node - forward declaration. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync/** Pointer to an expression node - forward declaration. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST identifier node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Core structure. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Number of characters in the identifier, excluding the zero terminator. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Identifier, variable size. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an identifer node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST declaration node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Core structure. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** @todo */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an declaration node. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync * Expression types.
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Invalid. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Numerical constant. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** String constant. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Identifier. */
8bce22f6f04047918df71d70b614262e1d08dc61vboxsync /** List of assignment expressions as in a = b = c = ... . */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Postfix increment expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Postfix decrement expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Postfix function call expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Unary increment expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Unary decrement expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Unary positive sign expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Unary negtive sign expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Unary invert expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Unary negate expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Multiplicative expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Division expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Modulus expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Addition expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Subtraction expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Logical shift right. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Logical shift left. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Lower than expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Higher than expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Lower or equal than expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Higher or equal than expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Equals expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Not equal expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise and expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise xor expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise or expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Logical and expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Logical or expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Multiplicative assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Division assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Modulus assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Additive assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Subtractive assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise left shift assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise right shift assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise and assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise xor assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Bitwise or assign expression */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** 32bit hack. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync/** Pointer to an expression type. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST expression node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Core structure. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Expression type. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Expression type dependent data. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Numerical constant. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Primary identifier. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** String literal */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync const char *pszStr;
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** List of expressions - VDSCRIPTASTEXPR. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Pointer to another expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Function call expression. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Other postfix expression used as the identifier for the function. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Argument list if existing. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Binary operation. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Left operator. */
212ccded142c57ca5b0ce90d5b116d2e5e4c0195vboxsync /** Right operator. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST if node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Conditional expression. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The true branch */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The else branch, can be NULL if no else branch. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an expression node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST switch node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Conditional expression. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The statement to follow. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an expression node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST while or do ... while node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Flag whether this is a do while loop. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Conditional expression. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The statement to follow. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an expression node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST for node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Initializer expression. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The exit condition. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The third expression (normally used to increase/decrease loop variable). */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The for loop body. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to an expression node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * Statement types.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Invalid. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Compound statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Expression statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** if statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** switch statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** while statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** for statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** continue statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** break statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** return statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** case statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** default statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** 32bit hack. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to a statement type. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST statement node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Core structure. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Statement type */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Statement type dependent data. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Compound statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** List of declarations - VDSCRIPTASTDECL. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** List of statements - VDSCRIPTASTSTMT. */
8bce22f6f04047918df71d70b614262e1d08dc61vboxsync /** case, default statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Pointer to the expression. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Pointer to the statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** "if" statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** "switch" statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** "while" or "do ... while" loop. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** "for" loop. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Pointer to another statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Expression statement. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST node for one function argument.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Core structure. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Identifier describing the type of the argument. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** The name of the argument. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to a AST function argument node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * AST node describing a function.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Core structure. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Identifier describing the return type. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Name of the function. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Number of arguments in the list. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Argument list - VDSCRIPTASTFNARG. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync /** Compound statement node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync/** Pointer to a function AST node. */
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * Free the given AST node and all subsequent nodes pointed to
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * by the given node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * @returns nothing.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * @param pAstNode The AST node to free.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsyncDECLHIDDEN(void) vdScriptAstNodeFree(PVDSCRIPTASTCORE pAstNode);
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * Allocate a non variable in size AST node of the given class.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * @returns Pointer to the allocated node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * NULL if out of memory.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * @param enmClass The class of the AST node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsyncDECLHIDDEN(PVDSCRIPTASTCORE) vdScriptAstNodeAlloc(VDSCRIPTASTCLASS enmClass);
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * Allocate a IDE node which can hold the given number of characters.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * @returns Pointer to the allocated node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * NULL if out of memory.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync * @param cchIde Number of characters which can be stored in the node.
db453c26f429ba8057ea92644ddd59279b9a918dvboxsyncDECLHIDDEN(PVDSCRIPTASTIDE) vdScriptAstNodeIdeAlloc(unsigned cchIde);
db453c26f429ba8057ea92644ddd59279b9a918dvboxsync#endif /* _VDScriptAst_h__ */