Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion basic/pkg.generated.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub impl Show for Position
pub(all) struct Report {
loc : Location
msg : String
}
} derive(@debug.Debug)
pub impl Show for Report
pub impl ToJson for Report

Expand Down
2 changes: 1 addition & 1 deletion basic/report.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pub(all) struct Report {
loc : Location
msg : String
}
} derive(Debug)

///|
pub impl Show for Report with output(self, logger) {
Expand Down
2 changes: 1 addition & 1 deletion handrolled_parser/parse_expr_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn simple_parse_expr(source : String) -> @syntax.Expr raise {
if reports.is_empty() {
return expr
} else {
fail(reports.to_string())
fail("\{to_repr(reports)}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion lexer/lexer.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///|
let use_utf16_location : Ref[Bool] = Ref::new(false)
let use_utf16_location : Ref[Bool] = Ref(false)

///|
fn lex_tokens(
Expand Down
2 changes: 1 addition & 1 deletion moon.mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moonbitlang/parser",
"version": "0.2.5",
"version": "0.2.6",
"deps": {
"moonbitlang/x": "0.4.39",
"moonbitlang/yacc": "0.7.13"
Expand Down
4 changes: 2 additions & 2 deletions pkg_parser/parser.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ fn parse_apply(state : State) -> (String, Ast) {
state.report_expected_here("\"(\"")
state.skip_until_statement_end()
let loc = Location::{ start: args_start, end: args_start }
return (name, Obj(map=Map::new(), loc~))
return (name, Obj(map=Map([]), loc~))
}
let args = parse_comma_separated(state, right=TK_RPAREN, parse_argument)
(name, Obj(map=Map::from_array(args), loc=state.loc_start_with(args_start)))
Expand Down Expand Up @@ -612,7 +612,7 @@ fn parse_statements(state : State) -> Array[(String, Ast)] {
pub fn moon_pkg_of_tokens(tokens : Triples) -> (Ast, Array[Report]) {
if tokens.is_empty() {
let loc = Location::{ start: dummy_pos, end: dummy_pos }
return (Obj(map=Map::new(), loc~), [])
return (Obj(map=Map([]), loc~), [])
}
let start = tokens[0].1
let state = State::{
Expand Down
2 changes: 1 addition & 1 deletion pkg_parser/pkg_parser_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn ast_summary(ast : Ast) -> Json {
Json::object(Map::from_array([("$number", Json::string(float))]))
Arr(content~, ..) => Json::array(content.map(ast_summary))
Obj(map~, ..) => {
let object : Map[String, Json] = Map::new()
let object : Map[String, Json] = Map([])
for key, value in map {
object[key] = ast_summary(value)
}
Expand Down
20 changes: 10 additions & 10 deletions syntax/map_visitor_wbtest.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -80,46 +80,46 @@ test "Pattern" {
is_closed=false,
loc=dummy_loc,
)
assert_eq(
@test.assert_eq(
any_with_alias.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), any_with_alias).json_repr(),
)
assert_eq(
@test.assert_eq(
array_patterns.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), array_patterns).json_repr(),
)
assert_eq(
@test.assert_eq(
constant_pattern.json_repr(),
MapVisitorBase::visit_Expr(MapVisitorBase(Identity(())), constant_pattern).json_repr(),
)
assert_eq(
@test.assert_eq(
constraint_pattern.json_repr(),
MapVisitorBase::visit_Pattern(
MapVisitorBase(Identity(())),
constraint_pattern,
).json_repr(),
)
assert_eq(
@test.assert_eq(
constr_pattern.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), constr_pattern).json_repr(),
)
assert_eq(
@test.assert_eq(
or_pattern.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), or_pattern).json_repr(),
)
assert_eq(
@test.assert_eq(
tuple_pattern.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), tuple_pattern).json_repr(),
)
assert_eq(
@test.assert_eq(
record_pattern.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), record_pattern).json_repr(),
)
assert_eq(
@test.assert_eq(
map_pattern.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), map_pattern).json_repr(),
)
assert_eq(
@test.assert_eq(
range_pattern.json_repr(),
MapVisitorBase::visit_Pattern(MapVisitorBase(Identity(())), range_pattern).json_repr(),
)
Expand Down
4 changes: 4 additions & 0 deletions syntax/moon.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ import {
"moonbitlang/core/json",
} for "test"

import {
"moonbitlang/core/test",
} for "wbtest"

warnings = "-28"
2 changes: 1 addition & 1 deletion syntax/utils.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Translated from src/ast/parsing_util.ml

// Global counter for generating unique variable names
let counter : Ref[Int] = Ref::new(0)
let counter : Ref[Int] = Ref(0)

///|
/// Create constant expression with location
Expand Down
2 changes: 1 addition & 1 deletion test/sync_test/loc_regression_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn parse_loc_regression(
parser~,
)
if !diagnostics.is_empty() {
fail(diagnostics.to_string())
fail("\{to_repr(diagnostics)}")
}
let mut brace_group_loc = None
let mut params_loc = None
Expand Down
Loading