diff options
Diffstat (limited to 'src/ArzuParser.cpp')
| -rw-r--r-- | src/ArzuParser.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ArzuParser.cpp b/src/ArzuParser.cpp index 0556a27..519bc76 100644 --- a/src/ArzuParser.cpp +++ b/src/ArzuParser.cpp @@ -7,7 +7,7 @@ bool isDigit(char ch) { } bool isName(char ch) { - return ch == '$'; + return 'a' <= ch && ch <= 'z'; } bool isSeparator(char ch) { @@ -63,7 +63,7 @@ MemoryData* arzu_Int_absorb(ifstream& inFile) { MemoryData* arzu_Name_absorb(ifstream& inFile) { Name* name = new Name(); - while (isDigit(inFile.peek()) || ('0' <= inFile.peek() && inFile.peek() <= 'z')) + while (!isSeparator(inFile.peek())) name->value.push_back(inFile.get()); return name; } @@ -75,6 +75,7 @@ ArzuParser::ArzuParser() : PNParser() { this->addInstr(Instruction("/", 2, arzu_div)); this->addInstr(Instruction("devar", 2, arzu_devar)); - this->addAtom(Atom(isDigit, arzu_Int_absorb)); + // Name atom MUST always be first atom!!! this->addAtom(Atom(isName, arzu_Name_absorb)); + this->addAtom(Atom(isDigit, arzu_Int_absorb)); } |
