diff --git a/comdel/domain/schemacreator.cpp b/comdel/domain/schemacreator.cpp index 0cffec4..7bef32d 100644 --- a/comdel/domain/schemacreator.cpp +++ b/comdel/domain/schemacreator.cpp @@ -798,11 +798,6 @@ Schema* SchemaCreator::loadSchema(SchemaNode node, Library &library) } } - if(!conn.wire) { - errors.emplace_back(conn.span, "missing @wire"); - continue; - } - std::vector attributes; for(auto& attr: conn.attributes) { if(connection->hasAttribute(attr.name.value)) { diff --git a/comdel/parser/astnode.h b/comdel/parser/astnode.h index f96afec..62801c0 100644 --- a/comdel/parser/astnode.h +++ b/comdel/parser/astnode.h @@ -302,13 +302,6 @@ struct LibraryNode: public AstNode }; // SCHEMA models -struct WireInstanceNode: public AstNode -{ - IdentifierNode name; - std::optional position; - std::optional display; -}; - struct InstanceAttributeNode: public AstNode { IdentifierNode name; @@ -338,7 +331,6 @@ struct ConnectionInstanceNode: public AstNode std::optional second; IdentifierNode bus; - std::optional wire; std::vector attributes; }; @@ -349,7 +341,6 @@ struct SchemaNode: public AstNode std::optional source; std::vector instances; - std::vector wires; std::vector connections; std::optional library; diff --git a/comdel/parser/comdelparser.cpp b/comdel/parser/comdelparser.cpp index 5b1ec8f..6465fad 100644 --- a/comdel/parser/comdelparser.cpp +++ b/comdel/parser/comdelparser.cpp @@ -1170,8 +1170,6 @@ std::optional ComdelParser::parseSchema() { PResult> err; if(check(TokenType::KW_INSTANCE)){ APPEND_OR_SET_ERR(schema.instances, parseInstance()); - } else if(check(TokenType::KW_WIRE)) { - APPEND_OR_SET_ERR(schema.wires, parseWireInstance()); } else if(check(TokenType::KW_CONNECTION)) { APPEND_OR_SET_ERR(schema.connections, parseConnectionInstance()); } else { @@ -1181,6 +1179,10 @@ std::optional ComdelParser::parseSchema() { if(!err.has_value()) { errors.push_back(err.error()); skipUntilNextKeyword(); + if(check(TokenType::END_OF_FILE)) { + errors.emplace_back(current().span, "expected `}` reached EOF"); + return std::nullopt; + } } } if(!check(TokenType::RBRACE)) { @@ -1199,38 +1201,6 @@ std::optional ComdelParser::parseSchema() { return spanner(schema); } -PResult ComdelParser::parseWireInstance() { - auto spanner = getSpanner(); - WireInstanceNode wireInstance; - - RETURN_IF_NOT_TOKEN(TokenType::KW_WIRE); - ASSIGN_OR_RETURN_IF_ERR(wireInstance.name, parseIdentifier()); - RETURN_IF_NOT_TOKEN(TokenType::LBRACE); - - while(!check(TokenType::RBRACE)) { - PResult> err; - if(check(TokenType::KW_POSITION)) { - ASSIGN_OR_SET_ERR(wireInstance.position, parsePosition()); - } else if(check(TokenType::KW_DISPLAY)) { - ASSIGN_OR_SET_ERR(wireInstance.display, parseDisplay()); - } else { - err = unexpected(); - } - if(!err.has_value()) { - errors.push_back(err.error()); - skipUntilNextKeyword(); - if(check(TokenType::END_OF_FILE)) { - return PError({Span(spanner.lo), "Reached EOF"}); - } - } - } - - RETURN_IF_NOT_TOKEN(TokenType::RBRACE); - - return spanner(wireInstance); - -} - /**************************************************************************** * @@ -1333,13 +1303,11 @@ PResult ComdelParser::parseConnectionInstance() { while(!check(TokenType::RBRACE)) { PResult> err; - if(check(TokenType::KW_WIRE)) { - bump(); - ASSIGN_OR_SET_ERR(connection.wire, parseIdentifier()); - } else if(check(TokenType::KW_ATTRIBUTE)) { + if(check(TokenType::KW_ATTRIBUTE)) { APPEND_OR_SET_ERR(connection.attributes, parseInstanceAttribute()); } else { err = unexpected(); + bump(); } if(!err.has_value()) { errors.push_back(err.error()); diff --git a/comdel/parser/comdelparser.h b/comdel/parser/comdelparser.h index 6e75dc8..82f056e 100644 --- a/comdel/parser/comdelparser.h +++ b/comdel/parser/comdelparser.h @@ -88,7 +88,6 @@ private: PResult parseValue(); - PResult parseWireInstance(); PResult parsePosition(); PResult parseInstance(); PResult parseInstanceAttribute(); diff --git a/examples/simplified FRISC model/schema.csl b/examples/simplified FRISC model/schema.csl index 30f2771..79714ea 100644 --- a/examples/simplified FRISC model/schema.csl +++ b/examples/simplified FRISC model/schema.csl @@ -17,39 +17,7 @@ @size 100 } - @wire wire_001 { - @position (50, 116) - @display { - /* - line { - color: blue; - points: 100; - }*/ - line { - x1: 0; y1: 0; x2: 0; y2: 84; - } - } - } + @connection (proc.glavniPin, bus) {} - @wire wire_002 { - @position (50, 220) - @display { - /* - line { - color: blue; - points: 100; - }*/ - line { - x1: 0; y1: 0; x2: 0; y2: 14; - } - } - } - - @connection (proc.glavniPin, bus) { - @wire wire_001 - } - - @connection (mem.glavniPin, bus) { - @wire wire_002 - } + @connection (mem.glavniPin, bus) {} } \ No newline at end of file