Implemented domain

This commit is contained in:
Borna Rajkovic committed 2022-04-05 23:48:07 +02:00
1 parent f4450494d8
commit e416743908
29 files changed
+920 -72

No files matched your search

+5 -7
View File
@@ -104,7 +104,7 @@ public:
throw "cannot convert type to string";
}
std::string asIdentifier() {
if(is(IDENTIFIER)) {
if(is(IDENTIFIER) || is(WIRE)) {
return identifierValue.value();
}
throw "cannot convert type to identifier";
@@ -271,13 +271,11 @@ struct WireNode: public AstNode
WireType type;
IdentifierNode name;
NumberNode size;
/*
bool isTerminatedWith;
long terminatedWith;
bool isIfUntrminated;
long ifUnterminated;
*/
bool hidden;
bool hasTermination;
long long isUnterminated;
};
+11 -4
View File
@@ -144,7 +144,7 @@ ComdelParser::parseList(std::optional<TokenType> openDelim,
vec.push_back(*item);
}
return std::move(vec);
return vec;
}
const std::vector<SourceError> &ComdelParser::getErrors()
@@ -703,7 +703,7 @@ PResult<AttributeNode> ComdelParser::parseAttribute() {
} else if(check(TokenType::BOOL_TYPE)) {
attribute.type = ValueNode::BOOL;
} else if(check(TokenType::WIRE_TYPE)) {
attribute.type = ValueNode::IDENTIFIER;
attribute.type = ValueNode::WIRE;
} else {
return unexpected();
}
@@ -729,7 +729,7 @@ PResult<AttributeNode> ComdelParser::parseAttribute() {
} else if(attribute.type == ValueNode::STRING) {
if(check(TokenType::STRING)) {
auto string = parseString();
attribute.defaultValue = ValueNode::ofString(string->value);
attribute.defaultValue = ValueNode::ofString(string->asString());
} else {
return unexpected();
}
@@ -740,6 +740,13 @@ PResult<AttributeNode> ComdelParser::parseAttribute() {
} else {
return unexpected();
}
} else if(attribute.type == ValueNode::WIRE) {
if(check(TokenType::IDENTIFIER)) {
auto identifier = parseIdentifier();
attribute.defaultValue = ValueNode::ofWire(identifier->value);
} else {
return unexpected();
}
}
if(check(TokenType::LBRACE)) {
@@ -964,7 +971,7 @@ PResult<ValueNode> ComdelParser::parseValue() {
if(check(TokenType::IDENTIFIER)) {
value = ValueNode::ofIdentifier(parseIdentifier()->value);
} else if(check(TokenType::STRING)) {
value = ValueNode::ofString(parseString()->value);
value = ValueNode::ofString(parseString()->asString());
} else if(check(TokenType::NUMBER)) {
value = ValueNode::ofInt(parseNumber()->value);
} else if(check(TokenType::TRUE)) {