From 8cf23935113ad8f35c294f23148ec0ff7d99c4e9 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 30 Nov 2022 09:35:42 +0200 Subject: [PNP] Fixed setting variables --- src/ArzuParser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ArzuParser.cpp') 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)); } -- cgit v1.2.3