Typos
This commit is contained in:
parent
0a0b20a156
commit
9bd68ecf23
|
@ -28,8 +28,7 @@ add_executable(SchemeEditor
|
|||
comdel/domain/connection.cpp
|
||||
comdel/domain/instance.cpp
|
||||
comdel/domain/comdelgenerator.cpp
|
||||
comdel/parser/assert.cpp
|
||||
comdel/parser/comdelparser.cpp
|
||||
comdel/parser/comdelparser.cpp
|
||||
comdel/parser/token.cpp
|
||||
comdel/parser/parser_util.cpp
|
||||
comdel/parser/sourceerror.cpp
|
||||
|
|
|
@ -7,19 +7,19 @@ Component *Component::ofWire(domain::WireInstance *wire) {
|
|||
component->wireInstance = wire;
|
||||
component->redraw();
|
||||
return component;
|
||||
};
|
||||
}
|
||||
Component *Component::ofComponent(domain::ComponentInstance *instance) {
|
||||
auto component = new Component();
|
||||
component->componentInstance = instance;
|
||||
component->redraw();
|
||||
return component;
|
||||
};
|
||||
}
|
||||
Component *Component::ofBus(domain::BusInstance *instance) {
|
||||
auto component = new Component();
|
||||
component->busInstance = instance;
|
||||
component->redraw();
|
||||
return component;
|
||||
};
|
||||
}
|
||||
|
||||
void Component::redraw() {
|
||||
if(componentInstance) {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#ifndef DOMAIN_ADDRESSSPACE_H
|
||||
#define DOMAIN_ADDRESSSPACE_H
|
||||
#ifndef DOMAIN_ADDRESS_SPACE_H
|
||||
#define DOMAIN_ADDRESS_SPACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
namespace domain {
|
||||
|
||||
class AddressSpace
|
||||
|
@ -23,4 +21,4 @@ public:
|
|||
|
||||
} // namespace domain
|
||||
|
||||
#endif // DOMAIN_ADDRESSSPACE_H
|
||||
#endif // DOMAIN_ADDRESS_SPACE_H
|
||||
|
|
|
@ -432,7 +432,7 @@ std::optional<Display> ComdelGenerator::loadDisplay(DisplayNode node)
|
|||
h = getIntProperty(item, "h");
|
||||
displayItem.pin = ui::Pin(x, y, w, h);
|
||||
} else {
|
||||
errors.push_back(SourceError{item.type.span, "unsuported display type"});
|
||||
errors.push_back(SourceError{item.type.span, "unsupported display type"});
|
||||
}
|
||||
items.push_back(displayItem);
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ std::optional<Popup> ComdelGenerator::loadPopup(PopupNode node, std::string name
|
|||
}
|
||||
} else {
|
||||
if(type == Value::WIRE_REFERENCE && !current().inConnection) {
|
||||
errors.push_back(SourceError{node.span, "@enumeration is required for atributes of type wire"});
|
||||
errors.push_back(SourceError{node.span, "@enumeration is required for attributes of type wire"});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ std::optional<Condition> ComdelGenerator::loadCondition(ConditionNode node)
|
|||
}
|
||||
return Condition(function, params, node.negated);
|
||||
} else {
|
||||
errors.push_back(SourceError{node.functionName.span, "wrong number of parametars"});
|
||||
errors.push_back(SourceError{node.functionName.span, "wrong number of parameters"});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DOMAIN_COMDELGENERATOR_H
|
||||
#define DOMAIN_COMDELGENERATOR_H
|
||||
#ifndef DOMAIN_COMDEL_GENERATOR_H
|
||||
#define DOMAIN_COMDEL_GENERATOR_H
|
||||
|
||||
#include "library.h"
|
||||
#include "schema.h"
|
||||
|
@ -143,4 +143,4 @@ public:
|
|||
|
||||
} // namespace domain
|
||||
|
||||
#endif // DOMAIN_COMDELGENERATOR_H
|
||||
#endif // DOMAIN_COMDEL_GENERATOR_H
|
||||
|
|
|
@ -11,7 +11,7 @@ BusConnectionInstance::BusConnectionInstance(ComponentInstance *instance, std::v
|
|||
: ConnectionInstance(instance, attributes, wire, connection), bus(bus)
|
||||
{}
|
||||
|
||||
DirectConnectionInstance::DirectConnectionInstance(ComponentInstance *instance, ComponentInstance *secondsInstance, std::vector<InstanceAttribute*> attributes, BusInstance *bus, WireInstance *wire, Connection connection)
|
||||
DirectConnectionInstance::DirectConnectionInstance(ComponentInstance *instance, ComponentInstance *secondInstance, std::vector<InstanceAttribute*> attributes, BusInstance *bus, WireInstance *wire, Connection connection)
|
||||
: ConnectionInstance(instance, attributes, wire, connection), secondInstance(secondInstance), bus(bus)
|
||||
{}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DOMAIN_CONNECTIONINSTANCE_H
|
||||
#define DOMAIN_CONNECTIONINSTANCE_H
|
||||
#ifndef DOMAIN_CONNECTION_INSTANCE_H
|
||||
#define DOMAIN_CONNECTION_INSTANCE_H
|
||||
|
||||
#include "connection.h"
|
||||
#include "instance.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DOMAIN_FUNCTIONSIGNATURE_H
|
||||
#define DOMAIN_FUNCTIONSIGNATURE_H
|
||||
#ifndef DOMAIN_FUNCTION_SIGNATURE_H
|
||||
#define DOMAIN_FUNCTION_SIGNATURE_H
|
||||
|
||||
#include<functional>
|
||||
#include "value.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DOMAIN_INSTANCEATTRIBUTE_H
|
||||
#define DOMAIN_INSTANCEATTRIBUTE_H
|
||||
#ifndef DOMAIN_INSTANCE_ATTRIBUTE_H
|
||||
#define DOMAIN_INSTANCE_ATTRIBUTE_H
|
||||
|
||||
#include "attribute.h"
|
||||
#include "value.h"
|
||||
|
@ -23,4 +23,4 @@ public:
|
|||
|
||||
} // namespace domain
|
||||
|
||||
#endif // DOMAIN_INSTANCEATTRIBUTE_H
|
||||
#endif // DOMAIN_INSTANCE_ATTRIBUTE_H
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DOMAIN_WIREINSTANCE_H
|
||||
#define DOMAIN_WIREINSTANCE_H
|
||||
#ifndef DOMAIN_WIRE_INSTANCE_H
|
||||
#define DOMAIN_WIRE_INSTANCE_H
|
||||
|
||||
#include "display.h"
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include "assert.h"
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef ASSERT_H
|
||||
#define ASSERT_H
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
class AtlasException : public std::exception {
|
||||
|
||||
const std::string fileName;
|
||||
const int fileLine;
|
||||
|
||||
const std::string message;
|
||||
|
||||
protected:
|
||||
virtual void buildString(std::ostream& stream) const;
|
||||
std::string fullMessage;
|
||||
|
||||
public:
|
||||
explicit AtlasException(const std::string& file, int line,
|
||||
const std::string& msg);
|
||||
|
||||
virtual ~AtlasException() {
|
||||
}
|
||||
|
||||
virtual std::string buildMessage() const;
|
||||
|
||||
virtual std::string toString() const {
|
||||
return fullMessage;
|
||||
}
|
||||
|
||||
virtual const char* what() const noexcept {
|
||||
return fullMessage.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ASSERT_H
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef ASTNODE_H
|
||||
#define ASTNODE_H
|
||||
#ifndef AST_NODE_H
|
||||
#define AST_NODE_H
|
||||
|
||||
#include "token.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* AST base class, all AST node classes extand this class. Class contains basic
|
||||
* information about a nodes location in file.
|
||||
* AST base class, all AST node classes extend this class. Class contains basic
|
||||
* information about nodes location in file.
|
||||
*/
|
||||
class AstNode {
|
||||
public:
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
struct IfStatementnode: AstNode
|
||||
struct IfStatementNode: AstNode
|
||||
{
|
||||
ConditionNode condition;
|
||||
ActionNode action;
|
||||
|
@ -184,7 +184,7 @@ struct IfStatementnode: AstNode
|
|||
|
||||
struct RuleNode: AstNode
|
||||
{
|
||||
std::vector<IfStatementnode> statements;
|
||||
std::vector<IfStatementNode> statements;
|
||||
};
|
||||
|
||||
|
||||
|
@ -400,4 +400,4 @@ struct SchemaNode: AstNode
|
|||
std::optional<LibraryNode> library;
|
||||
};
|
||||
|
||||
#endif // ASTNODE_H
|
||||
#endif // AST_NODE_H
|
||||
|
|
|
@ -39,7 +39,7 @@ ComdelLexer::ComdelLexer(std::string fileName, std::string source,
|
|||
ParseContext* parseContext)
|
||||
: source(std::move(source)),
|
||||
parseContext(parseContext),
|
||||
// qqq zamijeniti poziv path_absolute sa Qt-ovim pozivom
|
||||
// TODO Update this
|
||||
fileId(this->parseContext->addFile(fileName, this->source)),
|
||||
position(this->fileId, 1, 1, 0),
|
||||
ch(this->source[0])
|
||||
|
@ -101,8 +101,8 @@ unsigned ComdelLexer::takeNumberInRadix(Radix radix) {
|
|||
|
||||
bool ComdelLexer::digitIsValid(char ch, Radix radix) {
|
||||
|
||||
// Check digits in normal numbers
|
||||
//digit is 0..1
|
||||
// Check valid digits
|
||||
// digit is 0..1
|
||||
if(ch == '1' || ch == '0') {
|
||||
// OK for all radixes
|
||||
return true;
|
||||
|
@ -137,7 +137,7 @@ ComdelLexer::Radix ComdelLexer::takeRadix(){
|
|||
}
|
||||
|
||||
|
||||
// color is sequence of hex-digits (preceeded with # which is already consumed)
|
||||
// color is sequence of hex-digits (preceded with # which is already consumed)
|
||||
unsigned ComdelLexer::takeHexColor() {
|
||||
unsigned digitsTaken = 0;
|
||||
|
||||
|
@ -159,7 +159,7 @@ PResult<TokenType> ComdelLexer::takeString() {
|
|||
return PError({Span(lo), "expected string here"});
|
||||
bump(); // skip starting "
|
||||
|
||||
// Check ecsape-sequences \t \n \\ \" but leave them in string.
|
||||
// Check escape-sequences \t \n \\ \" but leave them in string.
|
||||
// They will be replaced in the constructor of StringLiteral AST-node.
|
||||
while (ch != '"' && ch != '\n' && !eof()) {
|
||||
if(ch == '"') {
|
||||
|
@ -189,7 +189,7 @@ PResult<TokenType> ComdelLexer::takeRawString()
|
|||
return PError({Span(lo), "expected string here"});
|
||||
bump(); // skip starting '
|
||||
|
||||
// Ignore ecsape-sequences - take all characters until closing '
|
||||
// Ignore escape-sequences - take all characters until closing '
|
||||
while (ch != '`' && !eof()) {
|
||||
bump(); // skip characters
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ PResult<TokenType> ComdelLexer::nextTokenType() {
|
|||
return TokenType::COLOR;
|
||||
} else {
|
||||
return PError({Span(tokenBegin, position),
|
||||
"unexpected #"});;
|
||||
"unexpected #"});
|
||||
}
|
||||
}
|
||||
else if (ch == '@')
|
||||
|
@ -366,7 +366,7 @@ PResult<TokenType> ComdelLexer::nextTokenType() {
|
|||
return TokenType::COMMENT;
|
||||
}
|
||||
return PError({Span(tokenBegin, position),
|
||||
"unexpected /"});;
|
||||
"unexpected /"});
|
||||
}
|
||||
else if (ch == '.')
|
||||
{
|
||||
|
@ -431,7 +431,7 @@ void ComdelLexer::bump(unsigned count) {
|
|||
|
||||
// Fetch and return next character without moving position.
|
||||
// Fetch does not cross line boundary.
|
||||
// Returns \n when next char does not exists (end of line or end of file)
|
||||
// Returns \n when next char does not exist (end of line or end of file)
|
||||
char ComdelLexer::peek() {
|
||||
if(position.offset+1 == source.size()) // eof
|
||||
return '\n';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef COMDELLEXER_H
|
||||
#define COMDELLEXER_H
|
||||
#ifndef COMDEL_LEXER_H
|
||||
#define COMDEL_LEXER_H
|
||||
|
||||
#include "parsecontext.h"
|
||||
#include "presult.h"
|
||||
|
@ -60,4 +60,4 @@ private:
|
|||
bool eof();
|
||||
};
|
||||
|
||||
#endif // COMDELLEXER_H
|
||||
#endif // COMDEL_LEXER_H
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#include "comdelparser.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "poly.h"
|
||||
#include "tokenstype.h"
|
||||
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <cctype>
|
||||
#include <sstream>
|
||||
|
||||
ComdelParser::ComdelParser(std::vector<Token> tokens)
|
||||
|
@ -107,12 +105,12 @@ PError ComdelParser::unexpected() {
|
|||
//
|
||||
// 'openDelim' and 'separator' are optional (could be nullopt).
|
||||
//
|
||||
// 'closeDelim' is mandatory and it will be consumed.
|
||||
// 'closeDelim' is mandatory, and it will be consumed.
|
||||
//
|
||||
// Function 'parse_f' should only parse a single node of type T.
|
||||
//
|
||||
// Parameter allowTrailing==true means that the list should ends with
|
||||
// 'separator' and otherwise the list should ends with 'node'. This
|
||||
// Parameter allowTrailing==true means that the list should end with
|
||||
// 'separator' and otherwise the list should end with 'node'. This
|
||||
// parameter is false in every call-site!
|
||||
template<typename T> PResult<std::vector<T>>
|
||||
ComdelParser::parseList(std::optional<TokenType> openDelim,
|
||||
|
@ -374,7 +372,7 @@ PResult<PropertyNode> ComdelParser::parseProperty(std::optional<TokenType> value
|
|||
|
||||
/****************************************************************************
|
||||
*
|
||||
* AddressSpaceNode := "@address" + IDENTIFIER "(" + NUMER + "," + NUMBER + ")"
|
||||
* AddressSpaceNode := "@address" + IDENTIFIER "(" + NUMBER + "," + NUMBER + ")"
|
||||
*
|
||||
****************************************************************************/
|
||||
PResult<AddressSpaceNode> ComdelParser::parseAddress()
|
||||
|
@ -917,9 +915,9 @@ PResult<RuleNode> ComdelParser::parseRule() {
|
|||
* IfStatement := "if(!function(params...)) { error(MESSAGE) | warning(MESSAGE) }
|
||||
*
|
||||
****************************************************************************/
|
||||
PResult<IfStatementnode> ComdelParser::parseIfStatement() {
|
||||
PResult<IfStatementNode> ComdelParser::parseIfStatement() {
|
||||
auto spanner = getSpanner();
|
||||
IfStatementnode ifStatement;
|
||||
IfStatementNode ifStatement;
|
||||
|
||||
RETURN_IF_NOT_TOKEN(TokenType::IF);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef COMDELPARSER_H
|
||||
#define COMDELPARSER_H
|
||||
#ifndef COMDEL_PARSER_H
|
||||
#define COMDEL_PARSER_H
|
||||
|
||||
#include "sourceerror.h"
|
||||
#include "presult.h"
|
||||
|
@ -61,7 +61,6 @@ private:
|
|||
|
||||
Spanner getSpanner();
|
||||
|
||||
void parseBlock();
|
||||
|
||||
PResult<StringNode> parseString();
|
||||
PResult<IdentifierNode> parseIdentifier();
|
||||
|
@ -82,7 +81,7 @@ private:
|
|||
PResult<WireNode> parseWire();
|
||||
PResult<ConnectionNode> parseConnection();
|
||||
PResult<DisplayItemNode> parseDisplayItem();
|
||||
PResult<IfStatementnode> parseIfStatement();
|
||||
PResult<IfStatementNode> parseIfStatement();
|
||||
PResult<ValueNode> parseValue();
|
||||
|
||||
PResult<WireInstanceNode> parseWireInstance();
|
||||
|
@ -98,4 +97,4 @@ public:
|
|||
const std::vector<SourceError>& getErrors();
|
||||
};
|
||||
|
||||
#endif // COMDELPARSER_H
|
||||
#endif // COMDEL_PARSER_H
|
||||
|
|
|
@ -345,7 +345,7 @@ static constexpr no_init_t no_init{};
|
|||
// Implements the storage of the values, and ensures that the destructor is
|
||||
// trivial if it can be.
|
||||
//
|
||||
// This specialization is for where neither `T` or `E` is trivially
|
||||
// This specialization is for where neither `T` nor `E` is trivially
|
||||
// destructible, so the destructors must be called on destruction of the
|
||||
// `expected`
|
||||
template <class T, class E, bool = std::is_trivially_destructible<T>::value,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef PARSECONTEXT_H
|
||||
#define PARSECONTEXT_H
|
||||
#ifndef PARSE_CONTEXT_H
|
||||
#define PARSE_CONTEXT_H
|
||||
|
||||
|
||||
#include "sourceerror.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef PARSERUTIL_H
|
||||
#define PARSERUTIL_H
|
||||
#ifndef PARSER_UTIL_H
|
||||
#define PARSER_UTIL_H
|
||||
|
||||
#include "astnode.h"
|
||||
#include "parsecontext.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SOURCEERROR_H
|
||||
#define SOURCEERROR_H
|
||||
#ifndef SOURCE_ERROR_H
|
||||
#define SOURCE_ERROR_H
|
||||
|
||||
#include "token.h"
|
||||
#include <string>
|
||||
|
@ -11,4 +11,4 @@ struct SourceError {
|
|||
SourceError(Span span, std::string message);
|
||||
};
|
||||
|
||||
#endif // SOURCEERROR_H
|
||||
#endif // SOURCE_ERROR_H
|
||||
|
|
|
@ -157,14 +157,4 @@ TokenType TokenTables::tokenize(std::string value, TokenType initial) {
|
|||
|
||||
TokenType from_token(std::string value, TokenType initial) {
|
||||
return tokenTables.tokenize(value, initial);
|
||||
}
|
||||
|
||||
bool isBuiltInFunc(TokenType tokenType)
|
||||
{
|
||||
return tokenTables.allTokensInfo[tokenType].attributes & BUILT_IN_FUNC;
|
||||
}
|
||||
|
||||
bool isKeyword(TokenType tokenType)
|
||||
{
|
||||
return tokenTables.allTokensInfo[tokenType].attributes & KEYWORD_NAME;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef TOKENSTYPE_H
|
||||
#define TOKENSTYPE_H
|
||||
#ifndef TOKENS_TYPE_H
|
||||
#define TOKENS_TYPE_H
|
||||
|
||||
#include "token.h"
|
||||
|
||||
|
@ -8,9 +8,6 @@
|
|||
|
||||
const std::string& tokenTypeToString(TokenType tokenType);
|
||||
|
||||
bool isBuiltInFunc(TokenType tokenType);
|
||||
bool isDataType(TokenType tokenType);
|
||||
|
||||
TokenType from_token(std::string value, TokenType initial);
|
||||
|
||||
#endif // TOKENSTYPE_H
|
||||
#endif // TOKENS_TYPE_H
|
||||
|
|
7
main.cpp
7
main.cpp
|
@ -2,13 +2,6 @@
|
|||
|
||||
#include <QApplication>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <comdel/parser/parsecontext.h>
|
||||
#include <comdel/parser/parserutil.h>
|
||||
|
||||
#include <comdel/domain/comdelgenerator.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#ifndef MAIN_WINDOW_H
|
||||
#define MAIN_WINDOW_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include <QMainWindow>
|
||||
|
@ -41,4 +41,4 @@ private slots:
|
|||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
#endif // MAIN_WINDOW_H
|
||||
|
|
Loading…
Reference in New Issue