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
Add a --metaocaml flag to enable MetaOCaml syntax (brackets .< >.,
escape .~, run .!) in the lexer and formatter.
Lexer changes:
- Split symbolchar into symbolcharnodot/symbolchar to avoid
capturing MetaOCaml tokens as operator characters
- Gate .~ (escape) and >. (bracket close) behind the metaocaml flag;
.< (bracket open) is always lexed as METAOCAML_BRACKET_OPEN
- Add symbolchars sub-lexer for consuming remaining operator chars
after >. when metaocaml is disabled
- Thread ~metaocaml through parse.ml to set lex_metaocaml ref
Formatter changes:
- Detect metaocaml.bracket and metaocaml.escape extension nodes
(synthetic, with ghost loc) and render them with sugar syntax
(.< expr >. and .~expr) instead of [%metaocaml.bracket ...]
- Parenthesize .~ argument unless it is a simple identifier
- Skip comment relocation for metaocaml extension nodes in Cmts
Configuration:
- Add metaocaml boolean to opr_opts (Conf_t), default false
- Wire --metaocaml/--no-metaocaml flag through Conf and CLI
- Thread ~metaocaml through Extended_ast, Std_ast,
Parse_with_comments, Toplevel_lexer
0 commit comments