summaryrefslogtreecommitdiff
path: root/passes/techmap/libparse.cc
diff options
context:
space:
mode:
authorRuben Undheim <ruben.undheim@gmail.com>2018-08-30 20:46:20 +0200
committerRuben Undheim <ruben.undheim@gmail.com>2018-08-30 20:46:20 +0200
commit5033b51947a6ef02cb785b5622e993335efa750a (patch)
tree7bed18c526bd94917fa2f08e3df12209863698a1 /passes/techmap/libparse.cc
parentfefe0fc0430f4f173a25e674708aa0f4f0854b31 (diff)
New upstream version 0.7+20180830git0b7a184
Diffstat (limited to 'passes/techmap/libparse.cc')
-rw-r--r--passes/techmap/libparse.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/passes/techmap/libparse.cc b/passes/techmap/libparse.cc
index d5254c02..d3b1ff02 100644
--- a/passes/techmap/libparse.cc
+++ b/passes/techmap/libparse.cc
@@ -100,8 +100,15 @@ int LibertyParser::lexer(std::string &str)
break;
}
f.unget();
- // fprintf(stderr, "LEX: identifier >>%s<<\n", str.c_str());
- return 'v';
+ if (str == "+" || str == "-") {
+ /* Single operator is not an identifier */
+ // fprintf(stderr, "LEX: char >>%s<<\n", str.c_str());
+ return str[0];
+ }
+ else {
+ // fprintf(stderr, "LEX: identifier >>%s<<\n", str.c_str());
+ return 'v';
+ }
}
if (c == '"') {
@@ -191,6 +198,19 @@ LibertyAst *LibertyParser::parse()
tok = lexer(ast->value);
if (tok != 'v')
error();
+ tok = lexer(str);
+ while (tok == '+' || tok == '-' || tok == '*' || tok == '/') {
+ ast->value += tok;
+ tok = lexer(str);
+ if (tok != 'v')
+ error();
+ ast->value += str;
+ tok = lexer(str);
+ }
+ if (tok == ';')
+ break;
+ else
+ error();
continue;
}