You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parser: a regex literal cannot open a statement or tail expression ('expected expression') #2233
In a block body, a line that begins with a regex literal is refused:
fn strip(s: &str) -> str:
var out = s.to_owned()
/_[0-9]+/.replace(out, "_") // error: expected expression
The same expression bound with let r = /_[0-9]+/.replace(out, "_") parses. The statement parser sees / and takes it for a binary operator with a missing left operand; a regex literal is only recognized in operand position. §4 names regex literals as primary expressions, so a statement or a tail may start with one — exactly the one-liner spelling ... | with -p 'line = /a/.replace(line, "b")' already relies on in assignment position. Found writing tools/migrate_diff.w (#2230).
changed the title [-]parser: a regex literal cannot open a statement or tail expression ( is 'expected expression')[/-][+]parser: a regex literal cannot open a statement or tail expression ('expected expression')[/+]on Oct 7, 2026
Activity
[-]parser: a regex literal cannot open a statement or tail expression ( is 'expected expression')[/-][+]parser: a regex literal cannot open a statement or tail expression ('expected expression')[/+]migrate_diff: the migration differential; the 97 fallback discards pa…
lexer: a / first on its line opens a regex literal, never a division (#…