Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
RauliL committed Feb 9, 2024
1 parent 2da4c01 commit bc4e8d1
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/c-cpp.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C/C++ CI
name: Build

on: [push]

Expand All @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: configure
run: pip install wheel && pip install cget && ~/.local/bin/cget install && mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS="-Wall -Werror" ..
- name: build
Expand Down
28 changes: 14 additions & 14 deletions include/plorth/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ namespace plorth::parser

if (!token_result)
{
return parse_result::error(*token_result.error());
return parse_result::error(token_result.error());
}
tokens.push_back(*token_result.value());
tokens.push_back(token_result.value());
}

return parse_result::ok(tokens);
Expand Down Expand Up @@ -193,7 +193,7 @@ namespace plorth::parser

if (value_result)
{
elements.push_back(*value_result.value());
elements.push_back(value_result.value());
if (utils::skip_whitespace(current, end, position)
|| (!utils::peek(current, end, U',')
&& !utils::peek(current, end, U']')))
Expand All @@ -205,7 +205,7 @@ namespace plorth::parser
}
utils::peek_advance(current, end, position, U',');
} else {
return parse_array_result::error(*value_result.error());
return parse_array_result::error(value_result.error());
}
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ namespace plorth::parser

if (!key_result)
{
return parse_object_result::error(*key_result.error());
return parse_object_result::error(key_result.error());
}

if (utils::skip_whitespace(current, end, position))
Expand All @@ -290,12 +290,12 @@ namespace plorth::parser

if (!value_result)
{
return parse_object_result::error(*value_result.error());
return parse_object_result::error(value_result.error());
}

properties.push_back(std::make_pair(
(*key_result.value())->value(),
*value_result.value()
key_result.value()->value(),
value_result.value()
));

if (utils::skip_whitespace(current, end, position)
Expand Down Expand Up @@ -368,9 +368,9 @@ namespace plorth::parser

if (child_result)
{
children.push_back(*child_result.value());
children.push_back(child_result.value());
} else {
return parse_quote_result::error(*child_result.error());
return parse_quote_result::error(child_result.error());
}
}
}
Expand Down Expand Up @@ -568,9 +568,9 @@ namespace plorth::parser

if (!escape_sequence_result)
{
return parse_string_result::error(*escape_sequence_result.error());
return parse_string_result::error(escape_sequence_result.error());
}
buffer.append(1, *escape_sequence_result.value());
buffer.append(1, escape_sequence_result.value());
} else {
buffer.append(1, utils::advance(current, position));
}
Expand Down Expand Up @@ -678,13 +678,13 @@ namespace plorth::parser

if (!symbol_result)
{
return parse_token_result::error(*symbol_result.error());
return parse_token_result::error(symbol_result.error());
}

return parse_token_result::ok(
std::make_shared<ast::word>(
symbol_or_word_position,
*symbol_result.value()
symbol_result.value()
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
peelonet/peelo-result@v0.2.0
peelonet/peelo-unicode@v0.2.0
peelonet/peelo-result@v0.3.0
peelonet/peelo-unicode@v1.0.0
8 changes: 4 additions & 4 deletions test/test_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,31 @@ static void test_empty_array()
const auto result = parse(U"[]");

assert(!!result);
assert((*result.value())->elements().size() == 0);
assert(result.value()->elements().size() == 0);
}

static void test_array_with_one_element()
{
const auto result = parse(U"[\"foo\"]");

assert(!!result);
assert((*result.value())->elements().size() == 1);
assert(result.value()->elements().size() == 1);
}

static void test_array_with_multiple_elements()
{
const auto result = parse(U"[\"foo\", \"bar\", \"baz\"]");

assert(!!result);
assert((*result.value())->elements().size() == 3);
assert(result.value()->elements().size() == 3);
}

static void test_array_with_multiple_elements_with_dangling_comma()
{
const auto result = parse(U"[\"foo\", \"bar\", \"baz\",]");

assert(!!result);
assert((*result.value())->elements().size() == 3);
assert(result.value()->elements().size() == 3);
}

int main(int argc, char** argv)
Expand Down
22 changes: 11 additions & 11 deletions test/test_escape_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ static void test_unrecognized()

static void test_recognized()
{
assert(*parse(U"\\b").value() == 010);
assert(*parse(U"\\t").value() == 011);
assert(*parse(U"\\n").value() == 012);
assert(*parse(U"\\f").value() == 014);
assert(*parse(U"\\r").value() == 015);
assert(*parse(U"\\\"").value() == U'"');
assert(*parse(U"\\'").value() == U'\'');
assert(*parse(U"\\\\").value() == U'\\');
assert(*parse(U"\\/").value() == U'/');
assert(parse(U"\\b").value() == 010);
assert(parse(U"\\t").value() == 011);
assert(parse(U"\\n").value() == 012);
assert(parse(U"\\f").value() == 014);
assert(parse(U"\\r").value() == 015);
assert(parse(U"\\\"").value() == U'"');
assert(parse(U"\\'").value() == U'\'');
assert(parse(U"\\\\").value() == U'\\');
assert(parse(U"\\/").value() == U'/');
}

static void test_hex_escape()
{
assert(*parse(U"\\u00e4").value() == 0x00e4);
assert(*parse(U"\\u0fe3").value() == 0x0fe3);
assert(parse(U"\\u00e4").value() == 0x00e4);
assert(parse(U"\\u0fe3").value() == 0x0fe3);
}

static void test_unterminated_hex_escape()
Expand Down
6 changes: 3 additions & 3 deletions test/test_hello_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ int main(int argc, char** argv)
const auto result = plorth::parser::parse(begin, end, position);

assert(!!result);
assert(result.value()->size() == 2);
assert(result.value()->at(0)->type() == plorth::parser::ast::token::type::string);
assert(result.value()->at(1)->type() == plorth::parser::ast::token::type::symbol);
assert(result.value().size() == 2);
assert(result.value()[0]->type() == plorth::parser::ast::token::type::string);
assert(result.value()[1]->type() == plorth::parser::ast::token::type::symbol);

return EXIT_SUCCESS;
}
14 changes: 7 additions & 7 deletions test/test_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,34 @@ static void test_empty_object()
const auto result = parse(U"{}");

assert(!!result);
assert((*result.value())->properties().size() == 0);
assert(result.value()->properties().size() == 0);
}

static void test_object_with_one_property()
{
const auto result = parse(U"{\"foo\": \"bar\"}");

assert(!!result);
assert((*result.value())->properties().size() == 1);
assert((*result.value())->properties()[0].first == U"foo");
assert(result.value()->properties().size() == 1);
assert(result.value()->properties()[0].first == U"foo");
}

static void test_object_with_multiple_properties()
{
const auto result = parse(U"{\"foo\": \"bar\", \"baz\": \"quux\"}");

assert(!!result);
assert((*result.value())->properties().size() == 2);
assert((*result.value())->properties()[0].first == U"foo");
assert((*result.value())->properties()[1].first == U"baz");
assert(result.value()->properties().size() == 2);
assert(result.value()->properties()[0].first == U"foo");
assert(result.value()->properties()[1].first == U"baz");
}

static void test_object_with_multiple_properties_with_dangling_comma()
{
const auto result = parse(U"{\"foo\": \"bar\", \"baz\": \"quux\",}");

assert(!!result);
assert((*result.value())->properties().size() == 2);
assert(result.value()->properties().size() == 2);
}

int main(int argc, char** argv)
Expand Down
6 changes: 3 additions & 3 deletions test/test_quote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@ static void test_empty_quote()
const auto result = parse(U"()");

assert(!!result);
assert((*result.value())->children().size() == 0);
assert(result.value()->children().size() == 0);
}

static void test_quote_with_one_child()
{
const auto result = parse(U"( foo )");

assert(!!result);
assert((*result.value())->children().size() == 1);
assert(result.value()->children().size() == 1);
}

static void test_quote_with_multiple_children()
{
const auto result = parse(U"( foo \"bar\" [] )");

assert(!!result);
assert((*result.value())->children().size() == 3);
assert(result.value()->children().size() == 3);
}

int main(int argc, char** argv)
Expand Down
6 changes: 3 additions & 3 deletions test/test_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ static void test_quotation_mark_separator()
const auto result = parse(U"\"foo\"");

assert(!!result);
assert((*result.value())->value() == U"foo");
assert(result.value()->value() == U"foo");
}

static void test_apostrophe_separator()
{
const auto result = parse(U"'foo'");

assert(!!result);
assert((*result.value())->value() == U"foo");
assert(result.value()->value() == U"foo");
}

static void test_escape_sequence()
{
const auto result = parse(U"\"\\t\\u0023\"");

assert(!!result);
assert((*result.value())->value() == U"\t#");
assert(result.value()->value() == U"\t#");
}

int main(int argc, char** argv)
Expand Down
2 changes: 1 addition & 1 deletion test/test_symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static void test_symbol()
const auto result = parse(U"foo-bar-baz");

assert(!!result);
assert((*result.value())->id() == U"foo-bar-baz");
assert(result.value()->id() == U"foo-bar-baz");
}

int main(int argc, char** argv)
Expand Down
14 changes: 7 additions & 7 deletions test/test_token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,55 +27,55 @@ static void test_array()
const auto result = parse(U"[\"foo\", \"bar\", \"baz\"]");

assert(!!result);
assert((*result.value())->type() == token::type::array);
assert(result.value()->type() == token::type::array);
}

static void test_object()
{
const auto result = parse(U"{\"foo\": \"bar\"}");

assert(!!result);
assert((*result.value())->type() == token::type::object);
assert(result.value()->type() == token::type::object);
}

static void test_quote()
{
const auto result = parse(U"(foo bar)");

assert(!!result);
assert((*result.value())->type() == token::type::quote);
assert(result.value()->type() == token::type::quote);
}

static void test_string_with_quotation_mark()
{
const auto result = parse(U"\"foo\"");

assert(!!result);
assert((*result.value())->type() == token::type::string);
assert(result.value()->type() == token::type::string);
}

static void test_string_with_apostrophe()
{
const auto result = parse(U"'foo'");

assert(!!result);
assert((*result.value())->type() == token::type::string);
assert(result.value()->type() == token::type::string);
}

static void test_word()
{
const auto result = parse(U"-> foo");

assert(!!result);
assert((*result.value())->type() == token::type::word);
assert(result.value()->type() == token::type::word);
}

static void test_symbol()
{
const auto result = parse(U"foo");

assert(!!result);
assert((*result.value())->type() == token::type::symbol);
assert(result.value()->type() == token::type::symbol);
}

int main(int argc, char** argv)
Expand Down
4 changes: 2 additions & 2 deletions test/test_word.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static void test_no_arrow_found()
const auto result = parse(U"invalid");

assert(result);
assert((*result.value())->type() == token::type::symbol);
assert(result.value()->type() == token::type::symbol);
}

static void test_no_symbol_found()
Expand All @@ -48,7 +48,7 @@ static void test_parse()
assert(!!result);
assert(
std::static_pointer_cast<plorth::parser::ast::word>(
(*result.value())
result.value()
)->symbol()->id() == U"foo"
);
}
Expand Down

0 comments on commit bc4e8d1

Please sign in to comment.