ElftosbAST.h
/*
* File: ElftosbAST.h
*
* Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
* See included license file for license details.
*/
#if !defined(_ElftosbAST_h_)
#define _ElftosbAST_h_
#include "stdafx.h"
#include <string>
#include <list>
#include "smart_ptr.h"
#include "EvalContext.h"
namespace elftosb
{
// forward reference
class SymbolASTNode;
struct token_loc_t
{
int m_firstLine;
int m_lastLine;
};
class ASTNode
{
public:
ASTNode()
: m_parent(0)
{
}
ASTNode(ASTNode *parent)
: m_parent(parent)
, m_location{ 0, 0 }
{
}
ASTNode(const ASTNode &other)
: m_parent(other.m_parent)
, m_location(other.m_location)
{
}
virtual ~ASTNode() {}
virtual ASTNode *clone() const = 0;
virtual std::string nodeName() const { return "ASTNode"; }
virtual ASTNode *getParent() const { return m_parent; }
virtual void setParent(ASTNode *newParent) { m_parent = newParent; }
virtual void printTree() const { printTree(0); }
virtual void printTree(int indent) const;
virtual void setLocation(token_loc_t &loc) { m_location = loc; }
virtual void setLocation(token_loc_t &first, token_loc_t &last);
virtual void setLocation(ASTNode *loc) { setLocation(loc->getLocation()); }
virtual void setLocation(ASTNode *first, ASTNode *last);
virtual token_loc_t &getLocation() { return m_location; }
virtual const token_loc_t &getLocation() const { return m_location; }
virtual int getFirstLine() { return m_location.m_firstLine; }
virtual int getLastLine() { return m_location.m_lastLine; }
protected:
ASTNode *m_parent;
token_loc_t m_location;
void printIndent(int indent) const;
};
class ListASTNode : public ASTNode
{
public:
typedef std::list</*smart_ptr<ASTNode>*/ ASTNode *> ast_list_t;
typedef ast_list_t::iterator iterator;
typedef ast_list_t::const_iterator const_iterator;
public:
ListASTNode() {}
ListASTNode(const ListASTNode &other);
virtual ~ListASTNode();
virtual ASTNode *clone() const { return new ListASTNode(*this); }
virtual std::string nodeName() const { return "ListASTNode"; }
virtual void printTree(int indent) const;
virtual void appendNode(ASTNode *node);
virtual unsigned nodeCount() const { return static_cast<unsigned>(m_list.size()); }
inline iterator begin() { return m_list.begin(); }
inline iterator end() { return m_list.end(); }
inline const_iterator begin() const { return m_list.begin(); }
inline const_iterator end() const { return m_list.end(); }
virtual void updateLocation();
protected:
ast_list_t m_list;
};
class OptionsBlockASTNode : public ASTNode
{
public:
OptionsBlockASTNode(ListASTNode *options)
: ASTNode()
, m_options(options)
{
}
inline ListASTNode *getOptions() { return m_options; }
virtual ASTNode *clone() const { return NULL; }
protected:
smart_ptr<ListASTNode> m_options;
};
class ConstantsBlockASTNode : public ASTNode
{
public:
ConstantsBlockASTNode(ListASTNode *constants)
: ASTNode()
, m_constants(constants)
{
}
inline ListASTNode *getConstants() { return m_constants; }
virtual ASTNode *clone() const { return NULL; }
protected:
smart_ptr<ListASTNode> m_constants;
};
class SourcesBlockASTNode : public ASTNode
{
public:
SourcesBlockASTNode(ListASTNode *sources)
: ASTNode()
, m_sources(sources)
{
}
inline ListASTNode *getSources() { return m_sources; }
virtual ASTNode *clone() const { return NULL; }
protected:
smart_ptr<ListASTNode> m_sources;
};
class ExprASTNode;
class KeyblobBlockASTNode : public ASTNode
{
public:
KeyblobBlockASTNode(ListASTNode *entries)
: ASTNode()
, m_entries(entries)
, m_keyblobNumberExpr()
{
}
inline ListASTNode *getEntries() { return m_entries; }
virtual ASTNode *clone() const { return NULL; }
inline void setKeyblobNumberExpr(ExprASTNode *numExpr) { m_keyblobNumberExpr = numExpr; }
inline ExprASTNode *getKeyblobNumberExpr() { return m_keyblobNumberExpr; }
protected:
smart_ptr<ListASTNode> m_entries;
smart_ptr<ExprASTNode> m_keyblobNumberExpr;
};
class ExprASTNode : public ASTNode
{
public:
ExprASTNode()
: ASTNode()
{
}
ExprASTNode(const ExprASTNode &other)
: ASTNode(other)
{
}
virtual std::string nodeName() const { return "ExprASTNode"; }
virtual ExprASTNode *reduce(EvalContext &context) { return this; }
int_size_t resultIntSize(int_size_t a, int_size_t b);
};
class ConstASTNode : public ASTNode
{
public:
ConstASTNode()
: ASTNode()
{
}
ConstASTNode(const ConstASTNode &other)
: ASTNode(other)
{
}
protected:
};
class KeyblobEntryASTNode : public ConstASTNode
{
public:
KeyblobEntryASTNode()
: ConstASTNode()
, m_fields()
{
}
KeyblobEntryASTNode(const KeyblobEntryASTNode &other);
virtual ASTNode *clone() const { return new KeyblobEntryASTNode(*this); }
virtual std::string nodeName() const { return "KeyblobEntryASTNode"; }
virtual void printTree(int indent) const;
void setFieldAssignments(ListASTNode *fields) { m_fields = fields; }
ListASTNode *getFieldAssignments() { return m_fields; }
protected:
smart_ptr<ListASTNode> m_fields;
};
class CommandFileASTNode : public ASTNode
{
public:
CommandFileASTNode();
CommandFileASTNode(const CommandFileASTNode &other);
virtual std::string nodeName() const { return "CommandFileASTNode"; }
virtual ASTNode *clone() const { return new CommandFileASTNode(*this); }
virtual void printTree(int indent) const;
inline void setBlocks(ListASTNode *blocks) { m_blocks = blocks; }
inline void setOptions(ListASTNode *options) { m_options = options; }
inline void setConstants(ListASTNode *constants) { m_constants = constants; }
inline void setSources(ListASTNode *sources) { m_sources = sources; }
inline void setSections(ListASTNode *sections) { m_sections = sections; }
inline ListASTNode *getBlocks() { return m_blocks; }
inline ListASTNode *getOptions() { return m_options; }
inline ListASTNode *getConstants() { return m_constants; }
inline ListASTNode *getSources() { return m_sources; }
inline ListASTNode *getSections() { return m_sections; }
protected:
smart_ptr<ListASTNode> m_blocks;
smart_ptr<ListASTNode> m_options;
smart_ptr<ListASTNode> m_constants;
smart_ptr<ListASTNode> m_sources;
smart_ptr<ListASTNode> m_sections;
};
class IntConstExprASTNode : public ExprASTNode
{
public:
IntConstExprASTNode(uint32_t value, int_size_t size = kWordSize)
: ExprASTNode()
, m_value(value)
, m_size(size)
{
}
IntConstExprASTNode(const IntConstExprASTNode &other);
virtual std::string nodeName() const { return "IntConstExprASTNode"; }
virtual ASTNode *clone() const { return new IntConstExprASTNode(*this); }
virtual void printTree(int indent) const;
uint32_t getValue() const { return m_value; }
int_size_t getSize() const { return m_size; }
protected:
uint32_t m_value;
int_size_t m_size;
};
class VariableExprASTNode : public ExprASTNode
{
public:
VariableExprASTNode(std::string *name)
: ExprASTNode()
, m_variable(name)
{
}
VariableExprASTNode(const VariableExprASTNode &other);
inline std::string *getVariableName() { return m_variable; }
virtual ASTNode *clone() const { return new VariableExprASTNode(*this); }
virtual std::string nodeName() const { return "VariableExprASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
protected:
smart_ptr<std::string> m_variable;
};
class SymbolRefExprASTNode : public ExprASTNode
{
public:
SymbolRefExprASTNode(SymbolASTNode *sym)
: ExprASTNode()
, m_symbol(sym)
{
}
SymbolRefExprASTNode(const SymbolRefExprASTNode &other);
virtual ASTNode *clone() const { return new SymbolRefExprASTNode(*this); }
virtual std::string nodeName() const { return "SymbolRefExprASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
protected:
SymbolASTNode *m_symbol;
};
class NegativeExprASTNode : public ExprASTNode
{
public:
NegativeExprASTNode(ExprASTNode *expr)
: ExprASTNode()
, m_expr(expr)
{
}
NegativeExprASTNode(const NegativeExprASTNode &other);
virtual ASTNode *clone() const { return new NegativeExprASTNode(*this); }
virtual std::string nodeName() const { return "NegativeExprASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
ExprASTNode *getExpr() { return m_expr; }
protected:
smart_ptr<ExprASTNode> m_expr;
};
class BooleanNotExprASTNode : public ExprASTNode
{
public:
BooleanNotExprASTNode(ExprASTNode *expr)
: ExprASTNode()
, m_expr(expr)
{
}
BooleanNotExprASTNode(const BooleanNotExprASTNode &other);
virtual ASTNode *clone() const { return new BooleanNotExprASTNode(*this); }
virtual std::string nodeName() const { return "BooleanNotExprASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
ExprASTNode *getExpr() { return m_expr; }
protected:
smart_ptr<ExprASTNode> m_expr;
};
class SourceFileFunctionASTNode : public ExprASTNode
{
public:
SourceFileFunctionASTNode(std::string *functionName, std::string *sourceFileName)
: ExprASTNode()
, m_functionName(functionName)
, m_sourceFile(sourceFileName)
{
}
SourceFileFunctionASTNode(const SourceFileFunctionASTNode &other);
virtual ASTNode *clone() const { return new SourceFileFunctionASTNode(*this); }
virtual std::string nodeName() const { return "SourceFileFunctionASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
std::string *getFunctionName() { return m_functionName; }
std::string *getSourceFile() { return m_sourceFile; }
protected:
smart_ptr<std::string> m_functionName;
smart_ptr<std::string> m_sourceFile;
};
class DefinedOperatorASTNode : public ExprASTNode
{
public:
DefinedOperatorASTNode(std::string *constantName)
: ExprASTNode()
, m_constantName(constantName)
{
}
DefinedOperatorASTNode(const DefinedOperatorASTNode &other);
virtual ASTNode *clone() const { return new DefinedOperatorASTNode(*this); }
virtual std::string nodeName() const { return "DefinedOperatorASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
std::string *getConstantName() { return m_constantName; }
protected:
smart_ptr<std::string> m_constantName;
};
class SymbolASTNode;
class SizeofOperatorASTNode : public ExprASTNode
{
public:
SizeofOperatorASTNode(std::string *constantName)
: ExprASTNode()
, m_constantName(constantName)
, m_symbol()
{
}
SizeofOperatorASTNode(SymbolASTNode *symbol)
: ExprASTNode()
, m_constantName()
, m_symbol(symbol)
{
}
SizeofOperatorASTNode(const SizeofOperatorASTNode &other);
virtual ASTNode *clone() const { return new SizeofOperatorASTNode(*this); }
virtual std::string nodeName() const { return "SizeofOperatorASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
std::string *getConstantName() { return m_constantName; }
SymbolASTNode *getSymbol() { return m_symbol; }
protected:
smart_ptr<std::string> m_constantName;
smart_ptr<SymbolASTNode>
m_symbol;
};
class BinaryOpExprASTNode : public ExprASTNode
{
public:
enum operator_t
{
kAdd,
kSubtract,
kMultiply,
kDivide,
kModulus,
kPower,
kBitwiseAnd,
kBitwiseOr,
kBitwiseXor,
kShiftLeft,
kShiftRight,
kLessThan,
kGreaterThan,
kLessThanEqual,
kGreaterThanEqual,
kEqual,
kNotEqual,
kBooleanAnd,
kBooleanOr
};
BinaryOpExprASTNode(ExprASTNode *left, operator_t op, ExprASTNode *right)
: ExprASTNode()
, m_left(left)
, m_op(op)
, m_right(right)
{
}
BinaryOpExprASTNode(const BinaryOpExprASTNode &other);
virtual ASTNode *clone() const { return new BinaryOpExprASTNode(*this); }
virtual std::string nodeName() const { return "BinaryOpExprASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
ExprASTNode *getLeftExpr() { return m_left; }
ExprASTNode *getRightExpr() { return m_right; }
operator_t getOp() const { return m_op; }
protected:
smart_ptr<ExprASTNode> m_left;
smart_ptr<ExprASTNode> m_right;
operator_t m_op;
std::string getOperatorName() const;
};
class IntSizeExprASTNode : public ExprASTNode
{
public:
IntSizeExprASTNode(ExprASTNode *expr, int_size_t intSize)
: ExprASTNode()
, m_expr(expr)
, m_size(intSize)
{
}
IntSizeExprASTNode(const IntSizeExprASTNode &other);
virtual ASTNode *clone() const { return new IntSizeExprASTNode(*this); }
virtual std::string nodeName() const { return "IntSizeExprASTNode"; }
virtual void printTree(int indent) const;
virtual ExprASTNode *reduce(EvalContext &context);
ExprASTNode *getExpr() { return m_expr; }
int_size_t getIntSize() { return m_size; }
protected:
smart_ptr<ExprASTNode> m_expr;
int_size_t m_size;
};
class ExprConstASTNode : public ConstASTNode
{
public:
ExprConstASTNode(ExprASTNode *expr)
: ConstASTNode()
, m_expr(expr)
{
}
ExprConstASTNode(const ExprConstASTNode &other);
virtual ASTNode *clone() const { return new ExprConstASTNode(*this); }
virtual std::string nodeName() const { return "ExprConstASTNode"; }
virtual void printTree(int indent) const;
ExprASTNode *getExpr() { return m_expr; }
protected:
smart_ptr<ExprASTNode> m_expr;
};
class StringConstASTNode : public ConstASTNode
{
public:
StringConstASTNode(std::string *value)
: ConstASTNode()
, m_value(value)
{
}
StringConstASTNode(const StringConstASTNode &other);
virtual ASTNode *clone() const { return new StringConstASTNode(*this); }
virtual std::string nodeName() const { return "StringConstASTNode"; }
virtual void printTree(int indent) const;
std::string *getString() { return m_value; }
protected:
smart_ptr<std::string> m_value;
};
class BlobConstASTNode : public ConstASTNode
{
public:
BlobConstASTNode(Blob *value)
: ConstASTNode()
, m_blob(value)
{
}
BlobConstASTNode(const BlobConstASTNode &other);
virtual ASTNode *clone() const { return new BlobConstASTNode(*this); }
virtual std::string nodeName() const { return "BlobConstASTNode"; }
virtual void printTree(int indent) const;
Blob *getBlob() { return m_blob; }
protected:
smart_ptr<Blob> m_blob;
};
// Forward declaration.
struct hab_ivt;
class IVTConstASTNode : public ConstASTNode
{
public:
IVTConstASTNode()
: ConstASTNode()
, m_fields()
{
}
IVTConstASTNode(const IVTConstASTNode &other);
virtual ASTNode *clone() const { return new IVTConstASTNode(*this); }
virtual std::string nodeName() const { return "IVTConstASTNode"; }
virtual void printTree(int indent) const;
void setFieldAssignments(ListASTNode *fields) { m_fields = fields; }
ListASTNode *getFieldAssignments() { return m_fields; }
protected:
smart_ptr<ListASTNode> m_fields;
};
class AssignmentASTNode : public ASTNode
{
public:
AssignmentASTNode(std::string *ident, ASTNode *value)
: ASTNode()
, m_ident(ident)
, m_value(value)
{
}
AssignmentASTNode(const AssignmentASTNode &other);
virtual ASTNode *clone() const { return new AssignmentASTNode(*this); }
virtual std::string nodeName() const { return "AssignmentASTNode"; }
virtual void printTree(int indent) const;
inline std::string *getIdent() { return m_ident; }
inline ASTNode *getValue() { return m_value; }
protected:
smart_ptr<std::string> m_ident;
smart_ptr<ASTNode> m_value;
};
class SourceDefASTNode : public ASTNode
{
public:
SourceDefASTNode(std::string *name)
: m_name(name)
{
}
SourceDefASTNode(const SourceDefASTNode &other);
inline std::string *getName() { return m_name; }
inline void setAttributes(ListASTNode *attributes) { m_attributes = attributes; }
inline ListASTNode *getAttributes() { return m_attributes; }
protected:
smart_ptr<std::string> m_name;
smart_ptr<ListASTNode> m_attributes;
};
class PathSourceDefASTNode : public SourceDefASTNode
{
public:
PathSourceDefASTNode(std::string *name, std::string *path)
: SourceDefASTNode(name)
, m_path(path)
{
}
PathSourceDefASTNode(const PathSourceDefASTNode &other);
virtual PathSourceDefASTNode *clone() const { return new PathSourceDefASTNode(*this); }
virtual std::string nodeName() const { return "PathSourceDefASTNode"; }
virtual void printTree(int indent) const;
std::string *getPath() { return m_path; }
protected:
smart_ptr<std::string> m_path;
};
class ExternSourceDefASTNode : public SourceDefASTNode
{
public:
ExternSourceDefASTNode(std::string *name, ExprASTNode *expr)
: SourceDefASTNode(name)
, m_expr(expr)
{
}
ExternSourceDefASTNode(const ExternSourceDefASTNode &other);
virtual ASTNode *clone() const { return new ExternSourceDefASTNode(*this); }
virtual std::string nodeName() const { return "ExternSourceDefASTNode"; }
virtual void printTree(int indent) const;
ExprASTNode *getSourceNumberExpr() { return m_expr; }
protected:
smart_ptr<ExprASTNode> m_expr;
};
class SectionContentsASTNode : public ASTNode
{
public:
SectionContentsASTNode()
: m_sectionExpr()
{
}
SectionContentsASTNode(ExprASTNode *section)
: m_sectionExpr(section)
{
}
SectionContentsASTNode(const SectionContentsASTNode &other);
virtual ASTNode *clone() const { return new SectionContentsASTNode(*this); }
virtual std::string nodeName() const { return "SectionContentsASTNode"; }
virtual void printTree(int indent) const;
inline void setSectionNumberExpr(ExprASTNode *section) { m_sectionExpr = section; }
inline ExprASTNode *getSectionNumberExpr() { return m_sectionExpr; }
inline void setOptions(ListASTNode *options) { m_options = options; }
inline ListASTNode *getOptions() { return m_options; }
protected:
smart_ptr<ExprASTNode> m_sectionExpr;
smart_ptr<ListASTNode> m_options;
};
class DataSectionContentsASTNode : public SectionContentsASTNode
{
public:
DataSectionContentsASTNode(ASTNode *contents)
: SectionContentsASTNode()
, m_contents(contents)
{
}
DataSectionContentsASTNode(const DataSectionContentsASTNode &other);
virtual ASTNode *clone() const { return new DataSectionContentsASTNode(*this); }
virtual std::string nodeName() const { return "DataSectionContentsASTNode"; }
virtual void printTree(int indent) const;
ASTNode *getContents() { return m_contents; }
protected:
smart_ptr<ASTNode> m_contents;
};
class BootableSectionContentsASTNode : public SectionContentsASTNode
{
public:
BootableSectionContentsASTNode(ListASTNode *statements)
: SectionContentsASTNode()
, m_statements(statements)
{
}
BootableSectionContentsASTNode(const BootableSectionContentsASTNode &other);
virtual ASTNode *clone() const { return new BootableSectionContentsASTNode(*this); }
virtual std::string nodeName() const { return "BootableSectionContentsASTNode"; }
virtual void printTree(int indent) const;
ListASTNode *getStatements() { return m_statements; }
protected:
smart_ptr<ListASTNode> m_statements;
};
class StatementASTNode : public ASTNode
{
public:
StatementASTNode()
: ASTNode()
{
}
StatementASTNode(const StatementASTNode &other)
: ASTNode(other)
{
}
protected:
};
class IfStatementASTNode : public StatementASTNode
{
public:
IfStatementASTNode()
: StatementASTNode()
, m_ifStatements()
, m_nextIf()
, m_elseStatements()
{
}
IfStatementASTNode(const IfStatementASTNode &other);
virtual ASTNode *clone() const { return new IfStatementASTNode(*this); }
void setConditionExpr(ExprASTNode *expr) { m_conditionExpr = expr; }
ExprASTNode *getConditionExpr() { return m_conditionExpr; }
void setIfStatements(ListASTNode *statements) { m_ifStatements = statements; }
ListASTNode *getIfStatements() { return m_ifStatements; }
void setNextIf(IfStatementASTNode *nextIf) { m_nextIf = nextIf; }
IfStatementASTNode *getNextIf() { return m_nextIf; }
void setElseStatements(ListASTNode *statements) { m_elseStatements = statements; }
ListASTNode *getElseStatements() { return m_elseStatements; }
protected:
smart_ptr<ExprASTNode> m_conditionExpr;
smart_ptr<ListASTNode> m_ifStatements;
smart_ptr<IfStatementASTNode>
m_nextIf;
smart_ptr<ListASTNode> m_elseStatements;
};
class ModeStatementASTNode : public StatementASTNode
{
public:
ModeStatementASTNode()
: StatementASTNode()
, m_modeExpr()
{
}
ModeStatementASTNode(ExprASTNode *modeExpr)
: StatementASTNode()
, m_modeExpr(modeExpr)
{
}
ModeStatementASTNode(const ModeStatementASTNode &other);
virtual ASTNode *clone() const { return new ModeStatementASTNode(*this); }
virtual std::string nodeName() const { return "ModeStatementASTNode"; }
virtual void printTree(int indent) const;
inline void setModeExpr(ExprASTNode *modeExpr) { m_modeExpr = modeExpr; }
inline ExprASTNode *getModeExpr() { return m_modeExpr; }
protected:
smart_ptr<ExprASTNode> m_modeExpr;
};
class EraseStatementASTNode : public StatementASTNode
{
public:
EraseStatementASTNode()
: StatementASTNode()
, m_doEraseAll(false)
, m_doEraseAllUnsecure(false)
, m_memOption()
, m_rangeExpr()
{
}
EraseStatementASTNode(ASTNode *rangeExpr)
: StatementASTNode()
, m_doEraseAll(false)
, m_doEraseAllUnsecure(false)
, m_memOption()
, m_rangeExpr(rangeExpr)
{
}
EraseStatementASTNode(const EraseStatementASTNode &other);
virtual ASTNode *clone() const { return new EraseStatementASTNode(*this); }
virtual std::string nodeName() const { return "EraseStatementASTNode"; }
virtual void printTree(int indent) const;
void setEraseAll(bool doIt) { m_doEraseAll = doIt; }
bool getEraseAll() const { return m_doEraseAll; }
void setEraseAllUnsecure(bool doIt) { m_doEraseAllUnsecure = doIt; }
bool getEraseAllUnsecure() const { return m_doEraseAllUnsecure; }
inline void setRangeExpr(ASTNode *rangeExpr) { m_rangeExpr = rangeExpr; }
inline ASTNode *getRangeExpr() { return m_rangeExpr; }
inline void setMemOption(ASTNode *memOpt) { m_memOption = memOpt; }
inline ASTNode *getMemOption() { return m_memOption; }
protected:
bool m_doEraseAll;
bool m_doEraseAllUnsecure;
smart_ptr<ASTNode> m_rangeExpr;
smart_ptr<ASTNode> m_memOption;
};
class MessageStatementASTNode : public StatementASTNode
{
public:
enum _message_type
{
kInfo,
kWarning,
kError
};
typedef enum _message_type message_type_t;
public:
MessageStatementASTNode(message_type_t messageType, std::string *message)
: StatementASTNode()
, m_type(messageType)
, m_message(message)
{
}
MessageStatementASTNode(const MessageStatementASTNode &other);
virtual ASTNode *clone() const { return new MessageStatementASTNode(*this); }
virtual std::string nodeName() const { return "MessageStatementASTNode"; }
virtual void printTree(int indent) const;
inline message_type_t getType() { return m_type; }
inline std::string *getMessage() { return m_message; }
const char *getTypeName() const;
protected:
message_type_t m_type;
smart_ptr<std::string> m_message;
};
class LoadStatementASTNode : public StatementASTNode
{
public:
LoadStatementASTNode()
: StatementASTNode()
, m_data()
, m_target()
, m_loadOption()
{
}
LoadStatementASTNode(ASTNode *data, ASTNode *target)
: StatementASTNode()
, m_data(data)
, m_target()
, m_loadOption()
{
}
LoadStatementASTNode(const LoadStatementASTNode &other);
virtual ASTNode *clone() const { return new LoadStatementASTNode(*this); }
virtual std::string nodeName() const { return "LoadStatementASTNode"; }
virtual void printTree(int indent) const;
inline void setData(ASTNode *data) { m_data = data; }
inline ASTNode *getData() { return m_data; }
inline void setTarget(ASTNode *target) { m_target = target; }
inline ASTNode *getTarget() { return m_target; }
inline void setLoadOption(ASTNode *memOpt) { m_loadOption = memOpt; }
inline ASTNode *getLoadOption() { return m_loadOption; }
protected:
smart_ptr<ASTNode> m_data;
smart_ptr<ASTNode> m_target;
smart_ptr<ASTNode> m_loadOption;
};
class CallStatementASTNode : public StatementASTNode
{
public:
typedef enum
{
kCallType,
kJumpType
} call_type_t;
public:
CallStatementASTNode(call_type_t callType = kCallType)
: StatementASTNode()
, m_type(callType)
, m_target()
, m_arg()
, m_isHAB(false)
, m_stackPointer()
{
}
CallStatementASTNode(call_type_t callType, ASTNode *target, ASTNode *arg, ASTNode *sp)
: StatementASTNode()
, m_type(callType)
, m_target(target)
, m_arg(arg)
, m_isHAB(false)
, m_stackPointer(sp)
{
}
CallStatementASTNode(const CallStatementASTNode &other);
virtual ASTNode *clone() const { return new CallStatementASTNode(*this); }
virtual std::string nodeName() const { return "CallStatementASTNode"; }
virtual void printTree(int indent) const;
inline void setCallType(call_type_t callType) { m_type = callType; }
inline call_type_t getCallType() { return m_type; }
inline void setTarget(ASTNode *target) { m_target = target; }
inline ASTNode *getTarget() { return m_target; }
inline void setArgument(ASTNode *arg) { m_arg = arg; }
inline ASTNode *getArgument() { return m_arg; }
inline void setIsHAB(bool isHAB) { m_isHAB = isHAB; }
inline bool isHAB() const { return m_isHAB; }
inline void setStackPointer(ASTNode *arg) { m_stackPointer = arg; }
inline ASTNode *getStackPointer() { return m_stackPointer; }
protected:
call_type_t m_type;
smart_ptr<ASTNode> m_target;
smart_ptr<ASTNode> m_arg;
smart_ptr<ASTNode> m_stackPointer;
bool m_isHAB;
};
class ResetStatementASTNode : public StatementASTNode
{
public:
ResetStatementASTNode()
: StatementASTNode()
{
}
ResetStatementASTNode(const ResetStatementASTNode &other)
: StatementASTNode(other)
{
}
virtual ASTNode *clone() const { return new ResetStatementASTNode(*this); }
virtual std::string nodeName() const { return "ResetStatementASTNode"; }
virtual void printTree(int indent) const;
protected:
};
class MemEnableStatementASTNode : public StatementASTNode
{
public:
MemEnableStatementASTNode()
: StatementASTNode()
, m_memOption()
, m_rangeExpr()
{
}
MemEnableStatementASTNode(ASTNode *rangeExpr)
: StatementASTNode()
, m_memOption()
, m_rangeExpr(rangeExpr)
{
}
MemEnableStatementASTNode(const MemEnableStatementASTNode &other);
virtual ASTNode *clone() const { return new MemEnableStatementASTNode(*this); }
virtual std::string nodeName() const { return "MemEnableStatementASTNode"; }
virtual void printTree(int indent) const;
inline void setRangeExpr(ASTNode *rangeExpr) { m_rangeExpr = rangeExpr; }
inline ASTNode *getRangeExpr() { return m_rangeExpr; }
inline void setMemOption(ASTNode *memOpt) { m_memOption = memOpt; }
inline ASTNode *getMemOption() { return m_memOption; }
protected:
smart_ptr<ASTNode> m_rangeExpr;
smart_ptr<ASTNode> m_memOption;
};
class SourceASTNode : public ASTNode
{
public:
SourceASTNode(std::string *name)
: ASTNode()
, m_name(name)
{
}
SourceASTNode(const SourceASTNode &other);
virtual ASTNode *clone() const { return new SourceASTNode(*this); }
virtual std::string nodeName() const { return "SourceASTNode"; }
virtual void printTree(int indent) const;
inline std::string *getSourceName() { return m_name; }
protected:
smart_ptr<std::string> m_name;
};
class SectionMatchListASTNode : public ASTNode
{
public:
SectionMatchListASTNode(ListASTNode *sections)
: ASTNode()
, m_sections(sections)
, m_source()
{
}
SectionMatchListASTNode(ListASTNode *sections, std::string *source)
: ASTNode()
, m_sections(sections)
, m_source(source)
{
}
SectionMatchListASTNode(const SectionMatchListASTNode &other);
virtual ASTNode *clone() const { return new SectionMatchListASTNode(*this); }
virtual std::string nodeName() const { return "SectionMatchListASTNode"; }
virtual void printTree(int indent) const;
inline ListASTNode *getSections() { return m_sections; }
inline std::string *getSourceName() { return m_source; }
protected:
smart_ptr<ListASTNode> m_sections;
smart_ptr<std::string> m_source;
};
class SectionASTNode : public ASTNode
{
public:
typedef enum
{
kInclude,
kExclude
} match_action_t;
public:
SectionASTNode(std::string *name)
: ASTNode()
, m_action(kInclude)
, m_name(name)
, m_source()
{
}
SectionASTNode(std::string *name, match_action_t action)
: ASTNode()
, m_action(action)
, m_name(name)
, m_source()
{
}
SectionASTNode(std::string *name, std::string *source)
: ASTNode()
, m_action(kInclude)
, m_name(name)
, m_source(source)
{
}
SectionASTNode(const SectionASTNode &other);
virtual ASTNode *clone() const { return new SectionASTNode(*this); }
virtual std::string nodeName() const { return "SectionASTNode"; }
virtual void printTree(int indent) const;
inline match_action_t getAction() { return m_action; }
inline std::string *getSectionName() { return m_name; }
inline std::string *getSourceName() { return m_source; }
protected:
match_action_t m_action;
smart_ptr<std::string> m_name;
smart_ptr<std::string> m_source;
};
class SymbolASTNode : public ASTNode
{
public:
SymbolASTNode()
: ASTNode()
, m_symbol()
, m_source()
{
}
SymbolASTNode(std::string *symbol, std::string *source = 0)
: ASTNode()
, m_symbol(symbol)
, m_source(source)
{
}
SymbolASTNode(const SymbolASTNode &other);
virtual ASTNode *clone() const { return new SymbolASTNode(*this); }
virtual std::string nodeName() const { return "SymbolASTNode"; }
virtual void printTree(int indent) const;
inline void setSymbolName(std::string *symbol) { m_symbol = symbol; }
inline std::string *getSymbolName() { return m_symbol; }
inline void setSource(std::string *source) { m_source = source; }
inline std::string *getSource() { return m_source; }
protected:
smart_ptr<std::string> m_symbol;
smart_ptr<std::string> m_source;
};
class AddressRangeASTNode : public ASTNode
{
public:
AddressRangeASTNode()
: ASTNode()
, m_begin()
, m_end()
{
}
AddressRangeASTNode(ASTNode *begin, ASTNode *end)
: ASTNode()
, m_begin(begin)
, m_end(end)
{
}
AddressRangeASTNode(const AddressRangeASTNode &other);
virtual ASTNode *clone() const { return new AddressRangeASTNode(*this); }
virtual std::string nodeName() const { return "AddressRangeASTNode"; }
virtual void printTree(int indent) const;
inline void setBegin(ASTNode *begin) { m_begin = begin; }
inline ASTNode *getBegin() { return m_begin; }
inline void setEnd(ASTNode *end) { m_end = end; }
inline ASTNode *getEnd() { return m_end; }
protected:
smart_ptr<ASTNode> m_begin;
smart_ptr<ASTNode> m_end;
};
class NaturalLocationASTNode : public ASTNode
{
public:
NaturalLocationASTNode()
: ASTNode()
{
}
NaturalLocationASTNode(const NaturalLocationASTNode &other)
: ASTNode(other)
{
}
virtual ASTNode *clone() const { return new NaturalLocationASTNode(*this); }
virtual std::string nodeName() const { return "NaturalLocationASTNode"; }
};
class FromStatementASTNode : public StatementASTNode
{
public:
FromStatementASTNode()
: StatementASTNode()
{
}
FromStatementASTNode(std::string *source, ListASTNode *statements);
FromStatementASTNode(const FromStatementASTNode &other);
virtual ASTNode *clone() const { return new FromStatementASTNode(*this); }
virtual std::string nodeName() const { return "FromStatementASTNode"; }
virtual void printTree(int indent) const;
inline void setSourceName(std::string *source) { m_source = source; }
inline std::string *getSourceName() { return m_source; }
inline void setStatements(ListASTNode *statements) { m_statements = statements; }
inline ListASTNode *getStatements() { return m_statements; }
protected:
smart_ptr<std::string> m_source;
smart_ptr<ListASTNode> m_statements;
};
class EncryptStatementASTNode : public StatementASTNode
{
public:
EncryptStatementASTNode();
EncryptStatementASTNode(ListASTNode *statements)
: StatementASTNode()
, m_statements(statements)
, m_keyblobNumberExpr()
{
}
EncryptStatementASTNode(const EncryptStatementASTNode &other);
virtual ASTNode *clone() const { return new EncryptStatementASTNode(*this); }
virtual std::string nodeName() const { return "EncryptStatementASTNode"; }
virtual void printTree(int indent) const;
inline void setStatements(ListASTNode *statements) { m_statements = statements; }
inline ListASTNode *getStatements() { return m_statements; }
inline void setKeyblobNumberExpr(ExprASTNode *numExpr) { m_keyblobNumberExpr = numExpr; }
inline ExprASTNode *getKeyblobNumberExpr() { return m_keyblobNumberExpr; }
protected:
smart_ptr<ListASTNode> m_statements;
smart_ptr<ExprASTNode> m_keyblobNumberExpr;
};
class KeywrapStatementASTNode : public StatementASTNode
{
public:
KeywrapStatementASTNode();
KeywrapStatementASTNode(ListASTNode *statements)
: StatementASTNode()
, m_statements(statements)
, m_keyblobNumberExpr()
{
}
KeywrapStatementASTNode(const KeywrapStatementASTNode &other);
virtual ASTNode *clone() const { return new KeywrapStatementASTNode(*this); }
virtual std::string nodeName() const { return "KeywrapStatementASTNode"; }
virtual void printTree(int indent) const;
inline void setStatements(ListASTNode *statements) { m_statements = statements; }
inline ListASTNode *getStatements() { return m_statements; }
inline void setKeyblobNumberExpr(ExprASTNode *numExpr) { m_keyblobNumberExpr = numExpr; }
inline ExprASTNode *getKeyblobNumberExpr() { return m_keyblobNumberExpr; }
protected:
smart_ptr<ListASTNode> m_statements;
smart_ptr<ExprASTNode> m_keyblobNumberExpr;
};
}; // namespace elftosb
#endif // _ElftosbAST_h_
elftosb::EncryptStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1433
elftosb::ASTNode::ASTNode
ASTNode(const ASTNode &other)
Copy constructor.
Definition: ElftosbAST.h:50
elftosb::SourceDefASTNode
Definition: ElftosbAST.h:741
elftosb::SourceFileFunctionASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:463
elftosb::NegativeExprASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:414
elftosb::BooleanNotExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:439
elftosb::ConstASTNode
Definition: ElftosbAST.h:256
elftosb::SymbolASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1324
elftosb::SectionMatchListASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1235
elftosb::CallStatementASTNode::call_type_t
call_type_t
Possible sub-types of call statements.
Definition: ElftosbAST.h:1084
elftosb::EncryptStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1432
elftosb::SymbolASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1323
elftosb::ExprConstASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:633
elftosb::IntConstExprASTNode
Definition: ElftosbAST.h:329
elftosb::EncryptStatementASTNode
Definition: ElftosbAST.h:1420
elftosb::SourceASTNode
Definition: ElftosbAST.h:1193
elftosb::KeyblobEntryASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:284
elftosb::MemEnableStatementASTNode::m_rangeExpr
smart_ptr< ASTNode > m_rangeExpr
Expression that evaluates to the config block address range.
Definition: ElftosbAST.h:1186
elftosb::ModeStatementASTNode::m_modeExpr
smart_ptr< ExprASTNode > m_modeExpr
Expression that evaluates to the new boot mode.
Definition: ElftosbAST.h:954
elftosb::SectionMatchListASTNode
List of section matches for a particular source name.
Definition: ElftosbAST.h:1215
elftosb::ExternSourceDefASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:795
elftosb::NaturalLocationASTNode
Definition: ElftosbAST.h:1374
elftosb::ModeStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:947
elftosb::StatementASTNode
Definition: ElftosbAST.h:882
elftosb::KeyblobBlockASTNode
Definition: ElftosbAST.h:209
elftosb::IfStatementASTNode::m_conditionExpr
smart_ptr< ExprASTNode > m_conditionExpr
Boolean expression.
Definition: ElftosbAST.h:922
elftosb::BootableSectionContentsASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:871
elftosb::KeywrapStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1460
elftosb::MessageStatementASTNode::kInfo
Prints an informational messag to the user.
Definition: ElftosbAST.h:1008
elftosb::DefinedOperatorASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:490
elftosb::IfStatementASTNode::m_elseStatements
smart_ptr< ListASTNode > m_elseStatements
Statements for the "else" part of the statements.
Definition: ElftosbAST.h:926
elftosb::IVTConstASTNode
Node for a constant IVT structure as used by HAB4.
Definition: ElftosbAST.h:691
elftosb::BlobConstASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:676
elftosb::DefinedOperatorASTNode
Returns true or false depending on whether a constant is defined.
Definition: ElftosbAST.h:479
elftosb::KeyblobEntryASTNode
Node for a keyblob entry.
Definition: ElftosbAST.h:274
elftosb::MessageStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1025
smart_ptr< std::string >
elftosb::SectionASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1288
elftosb::BooleanNotExprASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:438
elftosb::token_loc_t::m_lastLine
int m_lastLine
Ending line of the token.
Definition: ElftosbAST.h:27
elftosb::ModeStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:948
elftosb::DefinedOperatorASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:489
elftosb::SizeofOperatorASTNode::m_constantName
smart_ptr< std::string > m_constantName
Name of the constant.
Definition: ElftosbAST.h:531
elftosb::LoadStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1061
elftosb::SymbolRefExprASTNode
Expression node for a symbol reference.
Definition: ElftosbAST.h:381
elftosb::CallStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1114
elftosb::IfStatementASTNode::m_nextIf
smart_ptr< IfStatementASTNode > m_nextIf
Link to next "else if". If this is non-NULL then m_elseStatements must be NULL and vice-versa...
Definition: ElftosbAST.h:925
elftosb::LoadStatementASTNode::m_loadOption
smart_ptr< ASTNode > m_loadOption
Load option identifier.
Definition: ElftosbAST.h:1074
elftosb::DataSectionContentsASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:848
elftosb::NaturalLocationASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1387
elftosb::OptionsBlockASTNode
Definition: ElftosbAST.h:153
elftosb::ExprConstASTNode
Definition: ElftosbAST.h:622
elftosb::ExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:243
elftosb::BlobConstASTNode
Definition: ElftosbAST.h:666
elftosb::ResetStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1150
elftosb::FromStatementASTNode
Definition: ElftosbAST.h:1394
elftosb::KeyblobEntryASTNode::m_fields
smart_ptr< ListASTNode > m_fields
Fields are set through assignment statements.
Definition: ElftosbAST.h:292
elftosb::IfStatementASTNode
Definition: ElftosbAST.h:900
elftosb::AssignmentASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:728
elftosb::SectionASTNode::kInclude
Include sections matched by this node.
Definition: ElftosbAST.h:1257
elftosb::AddressRangeASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1358
elftosb::EncryptStatementASTNode::m_keyblobNumberExpr
smart_ptr< ExprASTNode > m_keyblobNumberExpr
Expression that evaluates to the keyblob instance number.
Definition: ElftosbAST.h:1442
elftosb::BootableSectionContentsASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:870
elftosb::EvalContext
Context for evaluating AST tree and expressions.
Definition: EvalContext.h:28
elftosb::SizeofOperatorASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:523
elftosb::KeyblobEntryASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:285
elftosb::SourceASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1203
elftosb::BooleanNotExprASTNode
Performa a boolean inversion.
Definition: ElftosbAST.h:428
elftosb::NaturalLocationASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1388
elftosb::MemEnableStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1177
elftosb::ExprConstASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:632
elftosb::MessageStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1024
elftosb::PathSourceDefASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:773
elftosb::AddressRangeASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1359
elftosb::AssignmentASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:727
elftosb::ASTNode::ASTNode
ASTNode()
Default constructor.
Definition: ElftosbAST.h:37
elftosb::MemEnableStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1178
elftosb::BlobConstASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:677
smart_ptr
Simple, standard smart pointer class.
Definition: apps/elftosb/common/smart_ptr.h:18
elftosb::SymbolASTNode::m_symbol
smart_ptr< std::string > m_symbol
Required.
Definition: ElftosbAST.h:1332
elftosb::MessageStatementASTNode
Statement to print a message to the elftosb user.
Definition: ElftosbAST.h:1003
elftosb::EraseStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:981
elftosb::IfStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:912
elftosb::MessageStatementASTNode::kWarning
Prints a warning to the user.
Definition: ElftosbAST.h:1009
elftosb::IntSizeExprASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:606
elftosb::IfStatementASTNode::m_ifStatements
smart_ptr< ListASTNode > m_ifStatements
List of "if" section statements.
Definition: ElftosbAST.h:923
elftosb::SectionASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1289
elftosb::EraseStatementASTNode::m_memOption
smart_ptr< ASTNode > m_memOption
Memory option identifier.
Definition: ElftosbAST.h:997
elftosb::SizeofOperatorASTNode::m_symbol
smart_ptr< SymbolASTNode > m_symbol
Symbol reference. If this is non-NULL then the constant name is used instead.
Definition: ElftosbAST.h:533
elftosb
Definition: BootImage.h:13
elftosb::FromStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1404
elftosb::ResetStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1151
elftosb::KeywrapStatementASTNode
Definition: ElftosbAST.h:1448
elftosb::SectionASTNode::match_action_t
match_action_t
Possible actions for a section match list.
Definition: ElftosbAST.h:1255
elftosb::SizeofOperatorASTNode
Returns an integer that is the size in bytes of the operand.
Definition: ElftosbAST.h:505
elftosb::MessageStatementASTNode::m_message
smart_ptr< std::string > m_message
Message to report.
Definition: ElftosbAST.h:1034
elftosb::CallStatementASTNode::m_target
smart_ptr< ASTNode > m_target
This becomes the IVT address in HAB mode.
Definition: ElftosbAST.h:1129
elftosb::token_loc_t
Token location in the source file.
Definition: ElftosbAST.h:24
elftosb::CallStatementASTNode::m_isHAB
bool m_isHAB
Stack pointer node for "jump sp" command.
Definition: ElftosbAST.h:1132
elftosb::ASTNode::m_parent
ASTNode * m_parent
Pointer to parent node of this object. May be NULL.
Definition: ElftosbAST.h:89
elftosb::ExprASTNode::reduce
virtual ExprASTNode * reduce(EvalContext &context)
Evaluate the expression and produce a result node to replace this one.
Definition: ElftosbAST.h:249
elftosb::BootableSectionContentsASTNode
Definition: ElftosbAST.h:859
elftosb::DefinedOperatorASTNode::m_constantName
smart_ptr< std::string > m_constantName
Name of the constant.
Definition: ElftosbAST.h:497
elftosb::SectionASTNode
AST node for a section glob.
Definition: ElftosbAST.h:1251
elftosb::CallStatementASTNode
AST node for a call statement.
Definition: ElftosbAST.h:1080
elftosb::EraseStatementASTNode
Statement to insert a ROM_ERASE_CMD command.
Definition: ElftosbAST.h:960
elftosb::FromStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1405
elftosb::ListASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:121
elftosb::KeyblobBlockASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:220
elftosb::NegativeExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:415
elftosb::CommandFileASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:305
elftosb::VariableExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:367
elftosb::IVTConstASTNode::m_fields
smart_ptr< ListASTNode > m_fields
Fields of the IVT are set through assignment statements.
Definition: ElftosbAST.h:709
elftosb::DataSectionContentsASTNode
Node representing a raw binary section definition.
Definition: ElftosbAST.h:836
elftosb::StringConstASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:654
elftosb::SourcesBlockASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:199
elftosb::ExternSourceDefASTNode
Definition: ElftosbAST.h:784
elftosb::ListASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:120
elftosb::BinaryOpExprASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:575
hab_ivt
Definition: IVTDataSource.h:91
elftosb::CommandFileASTNode
Root node for the entire file.
Definition: ElftosbAST.h:298
elftosb::IntSizeExprASTNode
Negates an expression.
Definition: ElftosbAST.h:595
elftosb::DataSectionContentsASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:847
elftosb::PathSourceDefASTNode::clone
virtual PathSourceDefASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:772
elftosb::SourceASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1204
elftosb::VariableExprASTNode
Definition: ElftosbAST.h:355
elftosb::IVTConstASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:702
elftosb::LoadStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1062
elftosb::ASTNode::m_location
token_loc_t m_location
Location of this node in the source file.
Definition: ElftosbAST.h:90
elftosb::EraseStatementASTNode::m_rangeExpr
smart_ptr< ASTNode > m_rangeExpr
Expression that evaluates to the erase address range.
Definition: ElftosbAST.h:996
elftosb::CallStatementASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1113
elftosb::SectionContentsASTNode
Definition: ElftosbAST.h:807
elftosb::MessageStatementASTNode::_message_type
_message_type
Definition: ElftosbAST.h:1006
elftosb::MemEnableStatementASTNode::m_memOption
smart_ptr< ASTNode > m_memOption
Memory option identifier.
Definition: ElftosbAST.h:1187
elftosb::ListASTNode::m_list
ast_list_t m_list
Ordered list of child nodes.
Definition: ElftosbAST.h:147
elftosb::IVTConstASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:701
elftosb::KeywrapStatementASTNode::m_keyblobNumberExpr
smart_ptr< ExprASTNode > m_keyblobNumberExpr
Expression that evaluates to the keyblob instance number.
Definition: ElftosbAST.h:1470
elftosb::NegativeExprASTNode
Negates an expression.
Definition: ElftosbAST.h:404
elftosb::SizeofOperatorASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:522
elftosb::VariableExprASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:366
elftosb::IntConstExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:341
elftosb::MemEnableStatementASTNode
Statement to insert a ROM_MEM_ENABLE_CMD command.
Definition: ElftosbAST.h:1160
elftosb::SourceFileFunctionASTNode
Calls a built-in function with a source as the parameter.
Definition: ElftosbAST.h:452
elftosb::ConstantsBlockASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:181
elftosb::ASTNode::ASTNode
ASTNode(ASTNode *parent)
Constructor taking a parent node.
Definition: ElftosbAST.h:43
elftosb::IntConstExprASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:342
elftosb::SectionContentsASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:820
elftosb::StringConstASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:655
elftosb::AssignmentASTNode
Definition: ElftosbAST.h:715
elftosb::ExprASTNode
Abstract base class for all expression AST nodes.
Definition: ElftosbAST.h:231
elftosb::AddressRangeASTNode
Definition: ElftosbAST.h:1339
elftosb::ModeStatementASTNode
Statement to insert a ROM_MODE_CMD command.
Definition: ElftosbAST.h:932
elftosb::KeyblobBlockASTNode::m_keyblobNumberExpr
smart_ptr< ExprASTNode > m_keyblobNumberExpr
Expression that evaluates to the keyblob instance number.
Definition: ElftosbAST.h:225
elftosb::BinaryOpExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:576
elftosb::IntSizeExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:607
elftosb::ASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:62
elftosb::EraseStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:982
Blob
Manages a binary object of arbitrary length.
Definition: apps/elftosb/common/Blob.h:18
elftosb::CommandFileASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:304
elftosb::ExternSourceDefASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:796
elftosb::LoadStatementASTNode
AST node for a load statement.
Definition: ElftosbAST.h:1040
elftosb::SourcesBlockASTNode
Definition: ElftosbAST.h:189
elftosb::ListASTNode
AST node that contains other AST nodes.
Definition: ElftosbAST.h:107
elftosb::SymbolRefExprASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:392
elftosb::ListASTNode::nodeCount
virtual unsigned nodeCount() const
Returns the number of nodes in this list.
Definition: ElftosbAST.h:130
elftosb::SourceFileFunctionASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:464
elftosb::SectionContentsASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:821
elftosb::ResetStatementASTNode
Statement to insert a ROM_RESET_CMD command.
Definition: ElftosbAST.h:1138
elftosb::SymbolASTNode::m_source
smart_ptr< std::string > m_source
Optional, may be NULL;.
Definition: ElftosbAST.h:1333
elftosb::PathSourceDefASTNode
Definition: ElftosbAST.h:761
elftosb::OptionsBlockASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:163
elftosb::KeywrapStatementASTNode::nodeName
virtual std::string nodeName() const
Returns the name of the object&#39;s class.
Definition: ElftosbAST.h:1461
elftosb::ConstantsBlockASTNode
Definition: ElftosbAST.h:171
elftosb::SymbolRefExprASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:391
elftosb::StringConstASTNode
Definition: ElftosbAST.h:644
elftosb::ASTNode
The base class for all AST node classes.
Definition: ElftosbAST.h:33
elftosb::BinaryOpExprASTNode
Definition: ElftosbAST.h:539
elftosb::ASTNode::~ASTNode
virtual ~ASTNode()
Destructor.
Definition: ElftosbAST.h:57
elftosb::SectionMatchListASTNode::clone
virtual ASTNode * clone() const
Returns an exact duplicate of this object.
Definition: ElftosbAST.h:1234
elftosb::SymbolASTNode
Definition: ElftosbAST.h:1304
elftosb::token_loc_t::m_firstLine
int m_firstLine
Starting line of the token.
Definition: ElftosbAST.h:26