mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #480 from Fatsie/liberty_value_expression
Value of properties can be expression.
This commit is contained in:
commit
fefb652d56
|
@ -100,8 +100,15 @@ int LibertyParser::lexer(std::string &str)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
f.unget();
|
f.unget();
|
||||||
// fprintf(stderr, "LEX: identifier >>%s<<\n", str.c_str());
|
if (str == "+" || str == "-") {
|
||||||
return 'v';
|
/* 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 == '"') {
|
if (c == '"') {
|
||||||
|
@ -191,6 +198,19 @@ LibertyAst *LibertyParser::parse()
|
||||||
tok = lexer(ast->value);
|
tok = lexer(ast->value);
|
||||||
if (tok != 'v')
|
if (tok != 'v')
|
||||||
error();
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue