Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Produce UTS from `#lang resyntax/test`

未关闭
#586 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
领域
tooling

调研方向

该 issue 没有列出文件或测试;首先定位 #lang resyntax/test reader 及其 read-syntax 实现。将其输出与列出的 UTS 要求和 original-reader 的 UTS 要求进行比较,然后解决所述的未决问题,再将该 reader 视为完成。

由索引模型根据 Issue 内容生成。

描述

testing

The language's read-syntax implementation should produce Universal Tagged Syntax (UTS), which is my term for the kind of syntax objects I'm using to make Resyntax work on non-s-expression #langs. This implies a few restrictions:

  • The result of syntax-e anyways produces either an atom (a value with no syntax objects inside it) or a compound, which is a proper list of proper syntax objects.
  • Every list syntax object's first child is a shape tag, which is a keyword used to label the type of the surface syntax node.
  • Every atom has a 'uts-content syntax property whose value is a string. This is used as the textual form of the atom when writing the syntax object as text.
  • Every shape tag has a 'uts-separators syntax property whose value is a list of strings. The list should be equal to one plus the number of non-tag children in the tagged syntax object. This is combined with the textual forms of the child syntax objects when writing the tagged syntax object as text. The first separator is the prefix before the first child, the last separator is the suffix after the last child, and the middle separators are inserted between the children. The shape tags themselves are not written.

The one exception to the above is that the outermost syntax object returned by a #lang's reader is allowed to start with (module ...), with no shape tag. This is required for compatibility with Racket's #lang mechanism.

In addition to the above, a #lang's reader should produce original reader UTS, which is UTS where every syntax object is syntax-original? and where all syntax object source locations adhere to these rules:

  • Source locations never partially overlap.
  • One source location encloses another only when the first location's syntax object contains the second location's syntax object as a descendant.
  • One source location starting before another implies its syntax object comes before the other one's during a preorder traversal of the entire source file's syntax object.
  • Every syntax object's syntax-source value is the same and is in some way related to the original file or string containing the #lang directive.
  • Shape tags start at the same position as their parent syntax object and have a span of zero
  • Atoms have a uts-content string equal to the text at their source location in the original source code. Similarly, compounds have a uts-separators list whose strings are the substrings between its children, between the compound's start position and its first child's start, and between the compound's end position and its last child's end.
  • The syntax-span of a compound is equal to the spans of its children plus the total number of characters in the compound's uts-separators list.

Open questions include specifying how the #lang text should be reflected in the UTS properties, how autoformatting should work, how to detect comments, how indentation works, and probably lots of other stuff.

主要语言
Racket
星标
70
派生
11
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jackfirth/resyntax 的其他 Issue

查看 jackfirth/resyntax 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。