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
8 changes: 4 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: install
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: Setup Moonbit
uses: hustcer/setup-moonbit@v1
# with:
# version: "nightly"

# - name: moon check
# run: moon check
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: release

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Setup Moonbit
uses: hustcer/setup-moonbit@v1
# with:
# version: "nightly"

- name: moon check
run: moon update && moon version && moon check --target js

- name: moon test
run: moon build --target js --debug
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The step named "moon test" is running moon build --target js --debug, which does not execute the test suite. Rename the step to reflect what it does or switch the command to moon test (and keep build as a separate step if needed) so releases don’t bypass tests.

Suggested change
run: moon build --target js --debug
run: moon test --target js --debug

Copilot uses AI. Check for mistakes.

- name: setup credentials
run: |
mkdir -p ~/.moon
echo '${{ secrets.MOON_CREDENTIALS }}' > ~/.moon/credentials.json
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing ${{ secrets.MOON_CREDENTIALS }} with echo is brittle because echo can treat leading -n/-e as options and it always appends a newline, which can corrupt the credentials payload. Use a safer write (e.g., printf '%s' or a heredoc) to ensure the secret is written verbatim.

Suggested change
echo '${{ secrets.MOON_CREDENTIALS }}' > ~/.moon/credentials.json
printf '%s' '${{ secrets.MOON_CREDENTIALS }}' > ~/.moon/credentials.json

Copilot uses AI. Check for mistakes.

- name: moon publish
run: moon publish
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ trace.json
.DS_Store

*.mbti

_build

.github/skills/
2 changes: 1 addition & 1 deletion moon.mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiye/cirru-parser",
"version": "0.2.1",
"version": "0.2.2",
"deps": {},
"readme": "README.md",
"repository": "https://github.com/Cirru/parser.mbt",
Expand Down
6 changes: 3 additions & 3 deletions src/main/main.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ pub fn main_writer() -> Unit {
let demo = "unfolding"
let demo_file = fsReadSync("./test/cirru/\{demo}.cirru")
let json_file = fsReadSync("./test/data/\{demo}.json")
let defined = (try? @json.parse(json_file)).unwrap()
let tree : Array[Cirru] = (try? @json.from_json(defined)).unwrap()
let defined = try! @json.parse(json_file)
let tree : Array[Cirru] = try! @json.from_json(defined)
println("TREE:")
for item in tree {
println(item.to_json().stringify())
}
let ret = (try? Cirru::format(tree, use_inline=false)).unwrap()
let ret = try! Cirru::format(tree, use_inline=false)
println("Generated:")
println(ret)
println("Expected:")
Expand Down
11 changes: 11 additions & 0 deletions src/main/moon.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
"moonbitlang/core/json" @json,
"tiye/cirru-parser" @lib,
}

import {
} for "test"

options(
"is-main": true,
)
10 changes: 0 additions & 10 deletions src/main/moon.pkg.json

This file was deleted.

8 changes: 8 additions & 0 deletions src/moon.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
"moonbitlang/core/cmp" @cmp,
"moonbitlang/core/json" @json,
}

import {
"tiye/cirru-parser" @lib,
} for "test"
9 changes: 0 additions & 9 deletions src/moon.pkg.json

This file was deleted.

4 changes: 3 additions & 1 deletion src/parser.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ pub fn Cirru::parse(code : String) -> Array[Cirru] raise CirruParseError {
}

///|
suberror CirruParseError String
suberror CirruParseError {
CirruParseError(String)
}

///|
/// display Cirru parse error
Expand Down
6 changes: 3 additions & 3 deletions src/parser_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ test "existed demos" {
for demo in demos {
let demo_file = fsReadSync("./test/cirru/\{demo}.cirru")
let json_file = fsReadSync("./test/data/\{demo}.json")
let tree = (try? Cirru::parse(demo_file)).unwrap().to_json().stringify()
let defined = (try? @json.parse(json_file)).unwrap()
let tree = (try! Cirru::parse(demo_file)).to_json().stringify()
let defined = try! @json.parse(json_file)
let defined_str = defined.stringify()
assert_eq(tree, defined_str)
let formatted = Cirru::format(@json.from_json(defined), use_inline=false)
let ret = (try? Cirru::parse(formatted)).unwrap().to_json().stringify()
let ret = (try! Cirru::parse(formatted)).to_json().stringify()
assert_eq(ret, defined_str)
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/s_expr.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
///|
suberror FormatError String
suberror FormatError {
FormatError(String)
}

///|
/// format program to Cirru to Lisp-like code
Expand Down Expand Up @@ -56,7 +58,7 @@ fn Cirru::format_lispy_expr(
} else {
let s0 = token[0]
if s0 == '|' || s0 == '"' {
let sliced = (try? token[1:]).unwrap().to_string()
let sliced = (try! token[1:]).to_string()
"\"" + escape_string(sliced) + "\""
} else if token.contains(" ") ||
token.contains("\n") ||
Expand Down
4 changes: 3 additions & 1 deletion src/writer.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ fn Cirru::get_node_kind(self : Cirru) -> WriterNode {
}

///|
pub(all) suberror FormatCirruError String derive(Show)
pub(all) suberror FormatCirruError {
FormatCirruError(String)
} derive(Show)

///|
fn generate_tree(
Expand Down