Fixed all syntax errors, but NULL crops up where it shouldn't. Checks for it as stop-gap, creates very truncated trees. Does run, and still correctly accepts. Calling it a night.

This commit is contained in:
Nathan Braswell
2013-08-09 04:39:43 -04:00
parent 8570b8f641
commit 9f3370481e
3 changed files with 63 additions and 37 deletions

View File

@@ -9,6 +9,7 @@
#include "Parser.h"
#include "Symbol.h"
#include "GraphStructuredStack.h"
#include "util.h"
class RNGLRParser: public Parser {
public:
@@ -19,21 +20,21 @@ class RNGLRParser: public Parser {
private:
void reducer(int i);
void shifter(int i);
void addChildren(NodeTree<Symbol*>* parent, std::vector<NodeTree<Symbol*>*> children, int nullablePartsIndex);
void addChildren(NodeTree<Symbol*>* parent, std::vector<NodeTree<Symbol*>*>* children, int nullablePartsIndex);
void addStates(std::vector< State* >* stateSets, State* state);
bool reducesToNull(ParseRule* rule);
bool reducesToNull(ParseRule* rule, std::vector<Symbol*> avoidList);
bool belongsToFamily(NodeTree<Symbol*>* node, std::vector<NodeTree<Symbol*>*>* nodes);
bool arePacked(std::vector<NodeTree<Symbol*>*>* nodes);
bool arePacked(std::vector<NodeTree<Symbol*>*> nodes);
bool isPacked(NodeTree<Symbol*>* node);
void setPacked(NodeTree<Symbol*>* node, bool isPacked);
int getNullableIndex(ParseRule* rule);
NodeTree<Symbol*> getNullableParts(ParseRule* rule);
NodeTree<Symbol*> getNullableParts(Symbol* symbol);
NodeTree<Symbol*> getNullableParts(int index);
NodeTree<Symbol*>* getNullableParts(ParseRule* rule);
NodeTree<Symbol*>* getNullableParts(Symbol* symbol);
NodeTree<Symbol*>* getNullableParts(int index);
std::vector<NodeTree<Symbol*>*> getPathEdges(std::vector<NodeTree<int>*> path);
@@ -53,7 +54,7 @@ class RNGLRParser: public Parser {
std::vector<std::pair<NodeTree<Symbol*>*, int> > SPPFStepNodes;
std::vector<NodeTree<Symbol*>*> nullableParts;
std::map<NodeTree<Symbol*>*, bool> packedMap;
std::map<NodeTree<Symbol*>, bool> packedMap;
};
#endif