#include <DeclParser.h>
Public Member Functions | |
DeclParser (SystemPtr systemIn, BehaviorTemplateTablePtr behTableIn, EntityTemplateTablePtr entityTableIn, MessageTemplateTablePtr msgTableIn, EntityPoolPtr entityInstancesIn) | |
standard constructor This constructs a DeclParser. It takes all the pools and system stuff to use for parsing. | |
void | parseFile (TokenIterator &curToken) |
This parses a file. This is the main parsing function. It parses the file and calls the resolve functions to finalize everything. | |
void | parseComplete () |
This does everything that needs to be done after parsing stops. Essentially this resolves all the variables and gets all the TemplateTables ready for running. | |
Private Member Functions | |
UnresOpSeqPtr | parseCode (TokenIterator &curToken, int ifInit, VariableTableTemplatePtr varTableSet) |
Parses imperative code segments. This parses a few frills but mostly calls ImpParser the imperative parser. It needs a table and outputs code. | |
void | parseArgList (TokenIterator &curToken, ArgListPtr argOut) |
Parses argument list like constructs. This parses any argument list like constructs. It only support constants right now. | |
void | parseVarDecStmt (TokenIterator &curToken, VariableTableTemplatePtr varTable) |
Parses variable declarations. This parses any variable declarations. It insists on the format being [type] [ident] = [init]. | |
void | parseParameterElem (TokenIterator &curToken, VariableTableTemplatePtr varTable) |
Parses one element in a parameter list This parses one element (between commas) thing in a parameter list. An element must be of the format [type] [ident] [init literal]. | |
void | parseParameterList (TokenIterator &curToken, VariableTableTemplatePtr argTable) |
Parses a parameter list This parses all of a parameter list by calling parseParameterElem on all elements. | |
std::string | parseEntityBehavior (TokenIterator &curToken, ArgListPtr behArgs) |
Parses behavior statments in entities This attaches the named behavior to the current entity. | |
std::string | parseClassific (TokenIterator &curToken) |
Parses classification statements This parses the classification list. Currently as classifications do nothing, this does nothing. | |
void | parseEntity (TokenIterator &curToken) |
This parses an entity. This does all needed to parse an entity. | |
void | parseBehavior (TokenIterator &curToken) |
This parses a behavior. This does all needed to parse a behavior. | |
void | parseMessage (TokenIterator &curToken) |
This parses a message. This does all needed to parse a message. | |
void | parseSceneEntity (TokenIterator &curToken) |
This parses an entity statement in scene. This parses it and calls spawn. | |
void | parseScene (TokenIterator &curToken) |
This parses a scene. This does all needed to parse a scene. | |
Private Attributes | |
SystemPtr | sysPtr |
BehaviorTemplateTablePtr | behaviorPool |
EntityTemplateTablePtr | entityPool |
MessageTemplateTablePtr | messagePool |
EntityPoolPtr | entityInstances |
std::vector< ArgListPtr > | sceneSpawnArgQueue |
std::vector< std::string > | sceneSpawnNameQueue |
This class is the main class for declarative parsing. It uses TokenSource for its input. It can be used for multiple sources if parseFile is called multiple times with multiple TokenSource classes.
Most things don't depend on things being declared before their used however entity behaviors and behavior messages do so its best to parse messages then behaviors then entities then scene.
DeclParser::DeclParser | ( | SystemPtr | systemIn, | |
BehaviorTemplateTablePtr | behTableIn, | |||
EntityTemplateTablePtr | entityTableIn, | |||
MessageTemplateTablePtr | msgTableIn, | |||
EntityPoolPtr | entityInstancesIn | |||
) |
standard constructor This constructs a DeclParser. It takes all the pools and system stuff to use for parsing.
systemIn | the system class to use | |
behTableIn | the behavior table to use | |
entityTableIn | the entity table to use | |
msgTableIn | the message table to use |
UnresOpSeqPtr DeclParser::parseCode | ( | TokenIterator & | curToken, | |
int | ifInit, | |||
VariableTableTemplatePtr | varTableSet | |||
) | [private] |
Parses imperative code segments. This parses a few frills but mostly calls ImpParser the imperative parser. It needs a table and outputs code.
curToken | the current token iterator | |
ifInit | a flag if the code is an init code block | |
varTableSet | the variable table to use |
void DeclParser::parseArgList | ( | TokenIterator & | curToken, | |
ArgListPtr | argOut | |||
) | [private] |
Parses argument list like constructs. This parses any argument list like constructs. It only support constants right now.
curToken | the current token iterator | |
argOut | the already allocated arg list to build on |
void DeclParser::parseVarDecStmt | ( | TokenIterator & | curToken, | |
VariableTableTemplatePtr | varTable | |||
) | [private] |
Parses variable declarations. This parses any variable declarations. It insists on the format being [type] [ident] = [init].
curToken | the current token iterator | |
varTableSet | the variable table to use |
void DeclParser::parseParameterElem | ( | TokenIterator & | curToken, | |
VariableTableTemplatePtr | varTable | |||
) | [private] |
Parses one element in a parameter list This parses one element (between commas) thing in a parameter list. An element must be of the format [type] [ident] [init literal].
curToken | the current token iterator | |
varTable | the var table to add to |
void DeclParser::parseParameterList | ( | TokenIterator & | curToken, | |
VariableTableTemplatePtr | argTable | |||
) | [private] |
Parses a parameter list This parses all of a parameter list by calling parseParameterElem on all elements.
curToken | the current token iterator | |
argTable | the already allocated table representing the parameters to put stuff in |
std::string DeclParser::parseEntityBehavior | ( | TokenIterator & | curToken, | |
ArgListPtr | behArgs | |||
) | [private] |
Parses behavior statments in entities This attaches the named behavior to the current entity.
curToken | the current token iterator | |
behArgs | preallocated argument list to build on |
std::string DeclParser::parseClassific | ( | TokenIterator & | curToken | ) | [private] |
Parses classification statements This parses the classification list. Currently as classifications do nothing, this does nothing.
curToken | the current token iterator |
void DeclParser::parseEntity | ( | TokenIterator & | curToken | ) | [private] |
This parses an entity. This does all needed to parse an entity.
curToken | the current token iterator |
void DeclParser::parseBehavior | ( | TokenIterator & | curToken | ) | [private] |
This parses a behavior. This does all needed to parse a behavior.
curToken | the current token iterator |
void DeclParser::parseMessage | ( | TokenIterator & | curToken | ) | [private] |
This parses a message. This does all needed to parse a message.
curToken | the current token iterator |
void DeclParser::parseSceneEntity | ( | TokenIterator & | curToken | ) | [private] |
This parses an entity statement in scene. This parses it and calls spawn.
curToken | the current token iterator |
void DeclParser::parseScene | ( | TokenIterator & | curToken | ) | [private] |
This parses a scene. This does all needed to parse a scene.
curToken | the current token iterator |
void DeclParser::parseFile | ( | TokenIterator & | curToken | ) |
This parses a file. This is the main parsing function. It parses the file and calls the resolve functions to finalize everything.
curToken | the current token iterator |
void DeclParser::parseComplete | ( | ) |
This does everything that needs to be done after parsing stops. Essentially this resolves all the variables and gets all the TemplateTables ready for running.
This is resolving the string of a behavior's listener message and turning it into a Key.
This is resolving all the behavior strings of every entity.
This is resolving all the behavior UnresOpSeq code to OpSeq code.
This is manually spawning all the entities declared in scene.