Skip to content

Adapt nyan to new specification #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 71 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
ef6cf3b
lexer: Add '!' (bang) as symbol.
heinezen Oct 5, 2020
ec687e0
lexer: Enforce 'version' as first argument in file.
heinezen Oct 6, 2020
e017655
lexer: Fix dates and include dict type.
heinezen Oct 12, 2020
05f74f6
parser: Read arbitrary member type arguments.
heinezen Oct 16, 2020
1083219
nyan: Allow floats for int operations.
heinezen Oct 17, 2020
d075d25
nyan: Define values for float/int positive and negative infinty.
heinezen Oct 17, 2020
c9a9daa
nyan: Calculus rules for infinity.
heinezen Oct 18, 2020
d2a9005
lexer: Parse inf/-inf tokens.
heinezen Oct 19, 2020
e29f7d4
nyan: Fix handling infinity pointer.
heinezen Oct 19, 2020
8e902ec
nyan: Change bool's True/False to pythonic notation.
heinezen Oct 19, 2020
0b873cf
nyan: ValueToken for more complex values.
heinezen Oct 24, 2020
096317c
nyan: Use ValueToken while creating AST and Value instances.
heinezen Oct 25, 2020
c1b62b5
parser: Parse dict items.
heinezen Oct 25, 2020
32df34b
nyan: Dict data type.
heinezen Oct 27, 2020
6b19fab
nyan: Make 'element_type' of Type a vector.
heinezen Nov 22, 2020
6902201
dict: Create dicts from nyan file.
heinezen Nov 22, 2020
4b005dd
dict: Intersection operation.
heinezen Nov 23, 2020
80ea0e9
dict: Iterator logic.
heinezen Nov 25, 2020
f4000a4
refactor: Rename container types to composite types. Include type mod…
heinezen Nov 26, 2020
5995d04
parser: Allow limiting the number of read elements in comma_list().
heinezen Nov 28, 2020
4497163
parser: Allow nested types.
heinezen Nov 28, 2020
5090faf
init: New function for extracting value from ValueToken.
heinezen Dec 11, 2020
28465f5
nyan: Check for "None" value.
heinezen Dec 11, 2020
436071b
nyan: None value.
heinezen Dec 12, 2020
2eee390
nyan: Check modifiers.
heinezen Dec 12, 2020
6d02965
refactor: Add comments to ast.h.
heinezen Dec 12, 2020
1af9713
refactor: Add comments to api_error.h.
heinezen Dec 16, 2020
f1a190e
refactor: Add comments to basic_type.h.
heinezen Dec 16, 2020
fee9488
refactor: Add comments to c3.h.
heinezen Dec 16, 2020
78cd996
refactor: Add comments to change_tracker.h.
heinezen Dec 16, 2020
aeeaa1b
refactor: Add comments to curve.h.
heinezen Dec 16, 2020
d1c52d9
refactor: Add comments to database.h.
heinezen Dec 16, 2020
9c2a7fe
refactor: Add comments to error.h.
heinezen Dec 16, 2020
06212ba
refactor: Add comments to file.h.
heinezen Dec 16, 2020
ecbb66f
refactor: Add comments to id_token.h.
heinezen Dec 16, 2020
ef2bf3a
refactor: Add comments to inheritance_change.h.
heinezen Dec 16, 2020
458bb5e
refactor: Add comments to lang_error.h.
heinezen Dec 16, 2020
9a4c8ab
refactor: Add comments to location.h.
heinezen Dec 16, 2020
6358d0e
refactor: Add comments to member_info.h.
heinezen Dec 19, 2020
36af270
refactor: Add comments to member.h.
heinezen Dec 19, 2020
312914b
refactor: Add comments to meta_info.h.
heinezen Dec 19, 2020
6756dc1
refactor: Add comments to namespace_finder.h.
heinezen Dec 20, 2020
d139bab
refactor: Add comments to namespace.h.
heinezen Dec 20, 2020
a54937e
refactor: Add comments to object_history.h.
heinezen Dec 20, 2020
bf5db02
refactor: Add comments to object_info.h.
heinezen Dec 20, 2020
4025fff
refactor: Add comments to object_notifier.h.
heinezen Dec 20, 2020
5ed8e63
refactor: Add comments to object_state.h.
heinezen Dec 20, 2020
d48c873
refactor: Add comments to object.h.
heinezen Dec 20, 2020
a345388
refactor: Add comments to ops.h.
heinezen Dec 20, 2020
492d730
refactor: Add comments to parser.h.
heinezen Dec 20, 2020
c6e080a
refactor: Add comments to patch_info.h.
heinezen Dec 20, 2020
0f79321
refactor: Add comments to state_history.h.
heinezen Dec 20, 2020
9122237
refactor: Add comments to state.h.
heinezen Dec 20, 2020
543478d
refactor: Add comments to token_stream.h.
heinezen Dec 20, 2020
8ba7e7a
refactor: Add comments to token.h.
heinezen Dec 20, 2020
549855c
refactor: Add comments to transaction.h.
heinezen Dec 21, 2020
ba2cdfc
refactor: Add comments to type.h.
heinezen Dec 21, 2020
7d5dfaa
refactor: Add comments to util.h.
heinezen Dec 21, 2020
22b1725
refactor: Add comments to value_token.h.
heinezen Dec 21, 2020
8fd9b9e
refactor: Add comments to value.h.
heinezen Dec 21, 2020
ccae9c0
refactor: Add comments to value_holder.h.
heinezen Dec 21, 2020
bb3dfd4
refactor: Convert tabs to spaces in files.
heinezen Dec 21, 2020
1a092e3
fix copyright dates.
heinezen Dec 21, 2020
90097df
nyan: Assign None directly on Member::apply().
heinezen Dec 23, 2020
3cb82d7
parser: Use switch statement for differentiating composite types.
heinezen Jan 15, 2021
590c268
dict: Comment fixes.
heinezen Jan 15, 2021
2831c7e
ast: Use size_t for comma list boundary.
heinezen Jan 15, 2021
a83907e
nyan: Cody styling for is_none() function.
heinezen Jan 15, 2021
8e537c9
nyan: Remove unused parameters from lambda functions.
heinezen Jan 15, 2021
b8952bf
nyan: Better description for None.
heinezen Jan 15, 2021
72f5e03
parser: Replace ifs in handle_modifiers() with switch statement.
heinezen Jan 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions nyan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ add_library(nyan SHARED
transaction.cpp
type.cpp
util.cpp
value_token.cpp
value/boolean.cpp
value/container.cpp
value/dict.cpp
value/file.cpp
value/none.cpp
value/number.cpp
value/object.cpp
value/orderedset.cpp
Expand Down
44 changes: 22 additions & 22 deletions nyan/api_error.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2019 the nyan authors, LGPLv3+. See copying.md for legal info.
// Copyright 2019-2020 the nyan authors, LGPLv3+. See copying.md for legal info.

#include "api_error.h"

Expand All @@ -8,40 +8,40 @@
namespace nyan {

APIError::APIError(const std::string &msg)
:
Error{msg} {}
:
Error{msg} {}


InvalidObjectError::InvalidObjectError()
:
APIError("uninitialized object was used") {}
:
APIError("uninitialized object was used") {}


MemberTypeError::MemberTypeError(const fqon_t &objname, const memberid_t &member,
const std::string &real_type, const std::string &wrong_type)
:
APIError{
(static_cast<const std::ostringstream&>(
std::ostringstream{} << "type mismatch for member " << objname + "." << member
<< ": tried to convert real type " << real_type << " to " << wrong_type)
).str()},
name{objname},
member{member},
real_type{real_type},
wrong_type{wrong_type} {}
:
APIError{
(static_cast<const std::ostringstream&>(
std::ostringstream{} << "type mismatch for member " << objname + "." << member
<< ": tried to convert real type " << real_type << " to " << wrong_type)
).str()},
objname{objname},
member{member},
real_type{real_type},
wrong_type{wrong_type} {}


ObjectNotFoundError::ObjectNotFoundError(const fqon_t &obj_name)
:
APIError{"object not found: " + obj_name},
name{obj_name} {}
:
APIError{"object not found: " + obj_name},
objname{obj_name} {}


MemberNotFoundError::MemberNotFoundError(const fqon_t &obj_name,
const memberid_t &member_name)
:
APIError{"Could not find member " + obj_name + "." + member_name},
obj_name{obj_name},
name{member_name} {}
:
APIError{"Could not find member " + obj_name + "." + member_name},
objname{obj_name},
name{member_name} {}

} // namespace nyan
55 changes: 40 additions & 15 deletions nyan/api_error.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2019 the nyan authors, LGPLv3+. See copying.md for legal info.
// Copyright 2019-2020 the nyan authors, LGPLv3+. See copying.md for legal info.
#pragma once

#include "error.h"
Expand All @@ -11,7 +11,7 @@ namespace nyan {
*/
class APIError : public Error {
public:
APIError(const std::string &msg);
APIError(const std::string &msg);
};


Expand All @@ -22,7 +22,7 @@ class APIError : public Error {
*/
class InvalidObjectError : public APIError {
public:
InvalidObjectError();
InvalidObjectError();
};


Expand All @@ -31,14 +31,29 @@ class InvalidObjectError : public APIError {
*/
class MemberTypeError : public APIError {
public:
MemberTypeError(const fqon_t &objname, const memberid_t &member,
const std::string &real_type, const std::string &wrong_type);
MemberTypeError(const fqon_t &objname, const memberid_t &member,
const std::string &real_type, const std::string &wrong_type);

protected:
fqon_t name;
memberid_t member;
std::string real_type;
std::string wrong_type;
/**
* Name (identifier) of the object the member is part of.
*/
fqon_t objname;

/**
* Name (identifier) of the member.
*/
memberid_t member;

/**
* Type that the member should have assigned.
*/
std::string real_type;

/**
* Type that the member has actually assigned.
*/
std::string wrong_type;
};


Expand All @@ -47,10 +62,13 @@ class MemberTypeError : public APIError {
*/
class ObjectNotFoundError : public APIError {
public:
ObjectNotFoundError(const fqon_t &objname);
ObjectNotFoundError(const fqon_t &objname);

protected:
fqon_t name;
/**
* Name (identifier) of the object.
*/
fqon_t objname;
};


Expand All @@ -59,12 +77,19 @@ class ObjectNotFoundError : public APIError {
*/
class MemberNotFoundError : public APIError {
public:
MemberNotFoundError(const fqon_t &objname,
const memberid_t &membername);
MemberNotFoundError(const fqon_t &objname,
const memberid_t &membername);

protected:
fqon_t obj_name;
memberid_t name;
/**
* Name (identifier) of the object the member is part of.
*/
fqon_t objname;

/**
* Name (identifier) of the member.
*/
memberid_t name;
};

} // namespace nyan
Loading