核心解析引擎 (Parser): 接收如 */5 * * * *、0 12 * * 1-5 这样标准的 Cron 字符串,能够识别星号(*)、列表(,)、范围(-)和步长(/)等特殊语法,并转化为计算机可高效读取的内部结构。 调度验证器 (Matcher): 提供一个核心方法:输入任意一个指定的时间点(年、月、日、时、分),系统能够迅速判断该时间是否被当前的 Cron 规则所命中(即:是否应该触发
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Cron-Mbt
Cron-Mbtis a MoonBit cron expression library with a real parser, deterministic matcher, next-trigger calculator, and a usable CLI. The repository is being hardened for the MoonBit OSC2026 acceptance checklist, so the focus is on runnable examples, CI completeness, source clarity, and publish readiness rather than marketing-heavy claims.What It Supports
*,?,,,-,/, andLfor the last day of month.Lis accepted only in the day-of-month field; invalid placements returnErr.@yearly,@annually,@monthly,@weekly,@daily,@midnight,@hourly.0and7.Why This Revision Matters
The organizer feedback highlighted several concrete gaps:
moon info/moon fmtstyle checkscheck/build/fmt/info/teststagesThis revision addresses those issues directly.
Project Layout
Installation
Add the module to
moon.mod:Library Usage
Parse and inspect an expression:
Check whether a timestamp matches:
Compute the next trigger time:
CLI Usage
Parse:
Next trigger:
Match a timestamp:
Verification
Local checks used during this hardening pass:
The CI workflow uses the official MoonBit installer, prints
moon version --all, and runsmoon check --deny-warn,moon build,moon fmt,moon info, andmoon test --deny-warn.Mooncakes Status
cxh04/cron_mbt0.2.1moon publish --dry-runvalidates packaging before publication0.2.1contains the OSC2026 acceptance feedback fixesDocuments
License
Apache-2.0