@@ -15,8 +15,11 @@ rule authors can rely on today.
1515
1616Rules use YAML format. Every ` shape ` value is MoonBit surface syntax. The scanner
1717matches parsed MoonBit expression structure and does not match raw text.
18- Formatting and comments are not significant. Expression form, operators,
19- literal values, labels, callee names, and argument structure are significant.
18+ Whitespace formatting and comments are not significant. Literal source spelling
19+ is an exception: constants are compared by their parser AST kind and preserved
20+ source spelling, not by normalized semantic value. Equivalent values such as
21+ ` 1000 ` and ` 1_000 ` therefore do not necessarily match. Expression form,
22+ operators, labels, callee names, and argument structure are also significant.
2023Wildcards and declared metavariables modify these matching requirements as
2124documented below.
2225
@@ -130,13 +133,14 @@ It is one item and cannot represent a whole file or import list.
130133Shapes are structural:
131134
132135- undeclared identifiers and labels match literally
133- - constants match by value
136+ - constants match by parser AST kind and preserved source spelling; equivalent
137+ values such as ` 1000 ` and ` 1_000 ` do not necessarily match
134138- operators match literally
135139- call and method-call argument kinds, labels, order, and arity must match
136140- type annotations and type names in matched syntax must match where present
137- - source locations and formatting do not participate in matching; top-level
138- documentation is an AST field and follows the ` inside-toplevel ` matching
139- mode
141+ - source locations, comments, and whitespace formatting do not participate in
142+ matching; top-level documentation is an AST field and follows the
143+ ` inside-toplevel ` matching mode
140144
141145The scanner does not type-check shapes and does not resolve names semantically.
142146For example, two imported names that refer to the same definition compare as
@@ -487,8 +491,9 @@ Qualified constructor identities include their extra info, such as `@pkg.Ctor`,
487491
488492A `const` metavar captures a parsed MoonBit constant. In expression position,
489493it matches `Expr::Constant`; in pattern position, it matches `Pattern::Constant`.
490- It compares the parser AST constant kind and value only; it does not type-check
491- or normalize equivalent values.
494+ It compares the parser AST constant kind and preserved source spelling; it does
495+ not type-check or normalize equivalent values. For example, `1000` and `1_000`
496+ do not necessarily compare as the same constant.
492497
493498Example :
494499
0 commit comments