Updated naming
This commit is contained in:
parent
c65d12a2a1
commit
883eaeb10a
|
@ -27,7 +27,7 @@ add_executable(SchemeEditor
|
|||
comdel/domain/instanceattribute.cpp
|
||||
comdel/domain/connection.cpp
|
||||
comdel/domain/instance.cpp
|
||||
comdel/domain/comdelgenerator.cpp
|
||||
comdel/domain/schemacreator.cpp
|
||||
comdel/parser/comdelparser.cpp
|
||||
comdel/parser/token.cpp
|
||||
comdel/parser/parser_util.cpp
|
||||
|
|
|
@ -15,7 +15,7 @@ SOURCES += \
|
|||
comdel/domain/addressspace.cpp \
|
||||
comdel/domain/attribute.cpp \
|
||||
comdel/domain/bus.cpp \
|
||||
comdel/domain/comdelgenerator.cpp \
|
||||
comdel/domain/schemacreator.cpp \
|
||||
comdel/domain/component.cpp \
|
||||
comdel/domain/connection.cpp \
|
||||
comdel/domain/connectioninstance.cpp \
|
||||
|
@ -29,7 +29,6 @@ SOURCES += \
|
|||
comdel/domain/schema.cpp \
|
||||
comdel/domain/value.cpp \
|
||||
comdel/domain/wireinstance.cpp \
|
||||
comdel/parser/assert.cpp \
|
||||
comdel/parser/astnode.cpp \
|
||||
comdel/parser/comdellexer.cpp \
|
||||
comdel/parser/comdelparser.cpp \
|
||||
|
@ -48,7 +47,7 @@ HEADERS += \
|
|||
comdel/domain/addressspace.h \
|
||||
comdel/domain/attribute.h \
|
||||
comdel/domain/bus.h \
|
||||
comdel/domain/comdelgenerator.h \
|
||||
comdel/domain/schemacreator.h \
|
||||
comdel/domain/component.h \
|
||||
comdel/domain/connection.h \
|
||||
comdel/domain/connectioninstance.h \
|
||||
|
@ -62,7 +61,6 @@ HEADERS += \
|
|||
comdel/domain/schema.h \
|
||||
comdel/domain/value.h \
|
||||
comdel/domain/wireinstance.h \
|
||||
comdel/parser/assert.h \
|
||||
comdel/parser/astnode.h \
|
||||
comdel/parser/comdellexer.h \
|
||||
comdel/parser/comdelparser.h \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 6.0.2, 2022-04-08T23:43:55. -->
|
||||
<!-- Written by QtCreator 6.0.2, 2022-04-09T20:03:04. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "comdelgenerator.h"
|
||||
#include "schemacreator.h"
|
||||
|
||||
#include<set>
|
||||
|
||||
|
@ -99,11 +99,11 @@ Popup::PopupType toType(PopupNode::PopupType type)
|
|||
return Popup::ON_DEMAND;
|
||||
}
|
||||
|
||||
ComdelGenerator::ComdelGenerator(std::vector<FunctionSignature> signatures)
|
||||
SchemaCreator::SchemaCreator(std::vector<FunctionSignature> signatures)
|
||||
: signatures(signatures)
|
||||
{}
|
||||
|
||||
std::optional<Library> ComdelGenerator::loadLibrary(LibraryNode node)
|
||||
std::optional<Library> SchemaCreator::loadLibrary(LibraryNode node)
|
||||
{
|
||||
// library fields
|
||||
if(!node.name) {
|
||||
|
@ -161,7 +161,7 @@ std::optional<Library> ComdelGenerator::loadLibrary(LibraryNode node)
|
|||
return Library(name, libraryInfo, header, componentDirectory, addressSpaces, components, buses, connections, messages);
|
||||
}
|
||||
|
||||
std::optional<Bus> ComdelGenerator::loadBus(BusNode node)
|
||||
std::optional<Bus> SchemaCreator::loadBus(BusNode node)
|
||||
{
|
||||
std::string name = node.name.value;
|
||||
|
||||
|
@ -215,12 +215,12 @@ std::optional<Bus> ComdelGenerator::loadBus(BusNode node)
|
|||
}
|
||||
|
||||
|
||||
std::optional<AddressSpace> ComdelGenerator::loadAddressSpace(AddressSpaceNode node)
|
||||
std::optional<AddressSpace> SchemaCreator::loadAddressSpace(AddressSpaceNode node)
|
||||
{
|
||||
return AddressSpace(node.name.value, node.start.value, node.end.value);
|
||||
}
|
||||
|
||||
std::optional<Connection> ComdelGenerator::loadConnection(ConnectionNode node)
|
||||
std::optional<Connection> SchemaCreator::loadConnection(ConnectionNode node)
|
||||
{
|
||||
push(ComdelContext("connection", false, true, false));
|
||||
|
||||
|
@ -369,9 +369,10 @@ std::optional<Connection> ComdelGenerator::loadConnection(ConnectionNode node)
|
|||
pop();
|
||||
errors.emplace_back(node.span, "unsupported connection type");
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<Component> ComdelGenerator::loadComponent(ComponentNode node)
|
||||
std::optional<Component> SchemaCreator::loadComponent(ComponentNode node)
|
||||
{
|
||||
push(ComdelContext(node.name.value, true, false, false));
|
||||
|
||||
|
@ -453,7 +454,7 @@ std::optional<Component> ComdelGenerator::loadComponent(ComponentNode node)
|
|||
return Component(name, tooltip, source, type, rules, instanceName, count, *display, pins, attributes);
|
||||
}
|
||||
|
||||
std::optional<Wire> ComdelGenerator::loadWire(WireNode node) {
|
||||
std::optional<Wire> SchemaCreator::loadWire(WireNode node) {
|
||||
return Wire(
|
||||
node.name.value,
|
||||
toType(node.type),
|
||||
|
@ -464,7 +465,7 @@ std::optional<Wire> ComdelGenerator::loadWire(WireNode node) {
|
|||
);
|
||||
}
|
||||
|
||||
optional<Pin> ComdelGenerator::loadPin(PinNode node)
|
||||
optional<Pin> SchemaCreator::loadPin(PinNode node)
|
||||
{
|
||||
std::string name = node.name.value;
|
||||
Pin::PinType type = toType(node.type);
|
||||
|
@ -519,7 +520,7 @@ int getIntProperty(DisplayItemNode &node, std::string property) {
|
|||
throw std::exception();
|
||||
}
|
||||
|
||||
std::optional<Display> ComdelGenerator::loadDisplay(DisplayNode node)
|
||||
std::optional<Display> SchemaCreator::loadDisplay(DisplayNode node)
|
||||
{
|
||||
std::vector<ui::Item> items;
|
||||
for(auto &item: node.items) {
|
||||
|
@ -555,14 +556,14 @@ std::optional<Display> ComdelGenerator::loadDisplay(DisplayNode node)
|
|||
}
|
||||
|
||||
|
||||
PinConnection ComdelGenerator::loadPinConnection(PinConnectionNode node)
|
||||
PinConnection SchemaCreator::loadPinConnection(PinConnectionNode node)
|
||||
{
|
||||
std::string message = node.message.asString();
|
||||
PinConnection::ConnectionType type = toType(node.type);
|
||||
return PinConnection(message, type);
|
||||
}
|
||||
|
||||
std::optional<Attribute> ComdelGenerator::loadAttribute(AttributeNode node)
|
||||
std::optional<Attribute> SchemaCreator::loadAttribute(AttributeNode node)
|
||||
{
|
||||
std::string name = node.name.value;
|
||||
pushAdditional(name);
|
||||
|
@ -603,7 +604,7 @@ std::optional<Attribute> ComdelGenerator::loadAttribute(AttributeNode node)
|
|||
return Attribute(name, value, popup);
|
||||
}
|
||||
|
||||
std::optional<Popup> ComdelGenerator::loadPopup(PopupNode node, std::string name, Value::ValueType type)
|
||||
std::optional<Popup> SchemaCreator::loadPopup(PopupNode node, std::string name, Value::ValueType type)
|
||||
{
|
||||
auto popupType = toType(*node.type);
|
||||
|
||||
|
@ -670,7 +671,7 @@ std::optional<Popup> ComdelGenerator::loadPopup(PopupNode node, std::string name
|
|||
return Popup(title, text, popupType, rules, enumeration);
|
||||
}
|
||||
|
||||
std::optional<Rule> ComdelGenerator::loadRule(RuleNode node)
|
||||
std::optional<Rule> SchemaCreator::loadRule(RuleNode node)
|
||||
{
|
||||
std::vector<IfStatement> statements;
|
||||
|
||||
|
@ -686,7 +687,7 @@ std::optional<Rule> ComdelGenerator::loadRule(RuleNode node)
|
|||
return Rule(statements);
|
||||
}
|
||||
|
||||
std::optional<Condition> ComdelGenerator::loadCondition(ConditionNode node)
|
||||
std::optional<Condition> SchemaCreator::loadCondition(ConditionNode node)
|
||||
{
|
||||
std::string function = node.functionName.value;
|
||||
|
||||
|
@ -727,7 +728,7 @@ std::optional<Condition> ComdelGenerator::loadCondition(ConditionNode node)
|
|||
}
|
||||
|
||||
|
||||
std::optional<Schema> ComdelGenerator::loadSchema(SchemaNode node, Library &library)
|
||||
std::optional<Schema> SchemaCreator::loadSchema(SchemaNode node, Library &library)
|
||||
{
|
||||
Schema schema;
|
||||
|
||||
|
@ -792,7 +793,7 @@ std::optional<Schema> ComdelGenerator::loadSchema(SchemaNode node, Library &libr
|
|||
continue;
|
||||
}
|
||||
} else {
|
||||
ConnectionComponent firstConn{firstComponent->name, conn.first.pin.value};
|
||||
ConnectionComponent firstConn{firstComponent->component.getName(), conn.first.pin.value};
|
||||
|
||||
if(library.hasConnection(firstConn,
|
||||
bus->bus.getName())) {
|
||||
|
@ -845,7 +846,7 @@ std::optional<Schema> ComdelGenerator::loadSchema(SchemaNode node, Library &libr
|
|||
return schema;
|
||||
}
|
||||
|
||||
ComponentInstance *ComdelGenerator::loadComponentInstance(InstanceNode instance, Library &library) {
|
||||
ComponentInstance *SchemaCreator::loadComponentInstance(InstanceNode instance, Library &library) {
|
||||
|
||||
auto name = instance.name.value;
|
||||
auto position = std::make_pair(instance.position->first.value, instance.position->second.value);
|
||||
|
@ -865,7 +866,7 @@ ComponentInstance *ComdelGenerator::loadComponentInstance(InstanceNode instance,
|
|||
|
||||
return new ComponentInstance(name, attributes, position, component);
|
||||
}
|
||||
BusInstance *ComdelGenerator::loadBusInstance(InstanceNode instance, Library &library) {
|
||||
BusInstance *SchemaCreator::loadBusInstance(InstanceNode instance, Library &library) {
|
||||
|
||||
auto name = instance.name.value;
|
||||
auto position = std::make_pair(instance.position->first.value, instance.position->second.value);
|
||||
|
@ -880,7 +881,7 @@ BusInstance *ComdelGenerator::loadBusInstance(InstanceNode instance, Library &li
|
|||
return new BusInstance(name, position, bus, size);
|
||||
}
|
||||
|
||||
std::optional<WireInstance*> ComdelGenerator::loadWireInstance(WireInstanceNode node) {
|
||||
std::optional<WireInstance*> SchemaCreator::loadWireInstance(WireInstanceNode node) {
|
||||
|
||||
if(!node.display) {
|
||||
errors.push_back(SourceError{node.span, "missing @text"});
|
|
@ -44,7 +44,7 @@ struct ComdelContext {
|
|||
|
||||
};
|
||||
|
||||
class ComdelGenerator
|
||||
class SchemaCreator
|
||||
{
|
||||
std::vector<ComdelContext> context;
|
||||
|
||||
|
@ -130,7 +130,7 @@ class ComdelGenerator
|
|||
}
|
||||
|
||||
public:
|
||||
ComdelGenerator(std::vector<FunctionSignature> signatures);
|
||||
SchemaCreator(std::vector<FunctionSignature> signatures);
|
||||
|
||||
std::vector<SourceError> getErrors() {
|
||||
return errors;
|
2
main.cpp
2
main.cpp
|
@ -4,8 +4,6 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <comdel/parser/parsecontext.h>
|
||||
#include <comdel/parser/parserutil.h>
|
||||
#include <comdel/domain/comdelgenerator.h>
|
||||
#include <comdel/domain/schemacreator.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -59,7 +59,7 @@ void MainWindow::onTestModal() {
|
|||
auto schemaNode = loadSchemaFromFile(&parseContext, filename.toStdString().c_str(), std::cout);
|
||||
|
||||
if(schemaNode) {
|
||||
domain::ComdelGenerator generator(signatures);
|
||||
domain::SchemaCreator generator(signatures);
|
||||
library = generator.loadLibrary(*schemaNode->library);
|
||||
|
||||
for (auto& error : generator.getErrors()) {
|
||||
|
@ -91,7 +91,7 @@ void MainWindow::onLoadLibrary() {
|
|||
ParseContext parseContext;
|
||||
auto libraryNode = loadLibraryFromFile(&parseContext, filename.toStdString().c_str(), std::cout);
|
||||
if(libraryNode) {
|
||||
domain::ComdelGenerator generator(signatures);
|
||||
domain::SchemaCreator generator(signatures);
|
||||
library = generator.loadLibrary(*libraryNode);
|
||||
|
||||
for (auto& error : generator.getErrors()) {
|
||||
|
@ -116,7 +116,7 @@ void MainWindow::onLoadSchema() {
|
|||
auto schemaNode = loadSchemaFromFile(&parseContext, filename.toStdString().c_str(), std::cout);
|
||||
|
||||
if(schemaNode) {
|
||||
domain::ComdelGenerator generator(signatures);
|
||||
domain::SchemaCreator generator(signatures);
|
||||
library = generator.loadLibrary(*schemaNode->library);
|
||||
|
||||
for (auto& error : generator.getErrors()) {
|
||||
|
|
|
@ -23,6 +23,21 @@
|
|||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionSave_schema"/>
|
||||
<addaction name="actionExport_schema"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEdit">
|
||||
<property name="title">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<addaction name="actionValidate"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuEdit"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
|
@ -36,6 +51,21 @@
|
|||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<action name="actionSave_schema">
|
||||
<property name="text">
|
||||
<string>Save schema</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport_schema">
|
||||
<property name="text">
|
||||
<string>Export schema</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionValidate">
|
||||
<property name="text">
|
||||
<string>Validate</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in New Issue