Skip to content

Commit

Permalink
lexer: Fix dates and include dict type.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Oct 12, 2020
1 parent ec687e0 commit e017655
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
7 changes: 5 additions & 2 deletions nyan/ast.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2019 the nyan authors, LGPLv3+. See copying.md for legal info.
// Copyright 2016-2020 the nyan authors, LGPLv3+. See copying.md for legal info.

#include "ast.h"

Expand Down Expand Up @@ -129,7 +129,7 @@ ASTArgument::ASTArgument(TokenStream &tokens) {
throw ASTError("expected argument keyword, encountered", *token);
}

while (token->type != token_type::ENDLINE) {
while (not token->is_endmarker()) {
if (token->is_content()) {
this->params.emplace_back(*token, tokens);
token = tokens.next();
Expand Down Expand Up @@ -566,6 +566,7 @@ ASTMemberValue::ASTMemberValue(container_t type,
switch (this->container_type) {
case container_t::SET:
case container_t::ORDEREDSET:
case container_t::DICT:
end_token = token_type::RBRACE; break;

default:
Expand Down Expand Up @@ -731,6 +732,7 @@ void ASTMemberValue::strb(std::ostringstream &builder, int /*indentlevel*/) cons
return;

case container_t::SET:
case container_t::DICT:
builder << "{"; break;

case container_t::ORDEREDSET:
Expand All @@ -752,6 +754,7 @@ void ASTMemberValue::strb(std::ostringstream &builder, int /*indentlevel*/) cons
switch (this->container_type) {
case container_t::SET:
case container_t::ORDEREDSET:
case container_t::DICT:
builder << "}"; break;

default:
Expand Down
2 changes: 1 addition & 1 deletion nyan/ast.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2019 the nyan authors, LGPLv3+. See copying.md for legal info.
// Copyright 2016-2020 the nyan authors, LGPLv3+. See copying.md for legal info.
#pragma once


Expand Down
5 changes: 3 additions & 2 deletions nyan/basic_type.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2018 the nyan authors, LGPLv3+. See copying.md for legal info.
// Copyright 2016-2020 the nyan authors, LGPLv3+. See copying.md for legal info.

#include "basic_type.h"

Expand Down Expand Up @@ -56,7 +56,8 @@ BasicType BasicType::from_type_token(const IDToken &tok) {
// container type name map
static const std::unordered_map<std::string, container_t> container_types = {
{"set", container_t::SET},
{"orderedset", container_t::ORDEREDSET}
{"orderedset", container_t::ORDEREDSET},
{"dict", container_t::DICT}
};


Expand Down
6 changes: 3 additions & 3 deletions nyan/value/set.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2019 the nyan authors, LGPLv3+. See copying.md for legal info.
// Copyright 2016-2020 the nyan authors, LGPLv3+. See copying.md for legal info.
#pragma once


Expand All @@ -11,12 +11,12 @@

namespace nyan {

/** datatype used for ordered set storage */
/** datatype used for unordered set storage */
using set_t = std::unordered_set<ValueHolder>;


/**
* Value to store a unordered set of things.
* Nyan value to store a unordered set of things.
*/
class Set
: public SetBase<set_t> {
Expand Down

0 comments on commit e017655

Please sign in to comment.