Skip to content

Commit 5b05cd4

Browse files
committed
spec: define TypeParam fields
1 parent ac8ba3a commit 5b05cd4

4 files changed

Lines changed: 22 additions & 16 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Based on these features, developers can easily implement or enhance their AI-ass
2121

2222
## Universal Abstract-Syntax-Tree Specification
2323

24-
see [UniAST Specification](docs/uniast-zh.md)
24+
see [UniAST Specification](docs/uniast-en.md)
2525

2626

2727
# Quick Start
@@ -117,19 +117,19 @@ $ exit
117117

118118
ABCoder currently supports the following languages:
119119

120-
| Language | Parser | Writer |
121-
| -------- | ----------- | ----------- |
122-
| Go | ||
123-
| Rust | | Coming Soon |
124-
| C | | Coming Soon |
125-
| Python | | Coming Soon |
120+
| Language | Parser | Writer |
121+
| -------- | ------ | ----------- |
122+
| Go || |
123+
| Rust || Coming Soon |
124+
| C || Coming Soon |
125+
| Python || Coming Soon |
126126

127127

128128
# Getting Involved
129129

130130
We encourage developers to contribute and make this tool more powerful. If you are interested in contributing to ABCoder
131131
project, kindly check out our guide:
132-
- [Parser Extension](docs/parser-zh.md)
132+
- [Parser Extension](docs/parser-en.md)
133133

134134
> Note: This is a dynamic README and is subject to changes as the project evolves.
135135

docs/uniast-en.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ Function type AST Node entity, corresponding to [NodeType] as FUNC, including fu
249249
"EndOffset": 3573,
250250
"Content": "// BindSession binds the session with current goroutine\nfunc (self *SessionManager) BindSession(Identity SessionIdentity, s Session) {\n\tshard : = self.shards[uint64(Identity)%uint64(self.opts.ShardNumber)]\n\n\tshard.Store(Identity, s)\n\n\tif self.opts.EnableImplicitlyTransmitAsync {\n\t\ttransmitSessionIdentity(Identity)\n\t}\n}",
251251
"Signature": "func (self *SessionManager) BindSession(Identity SessionIdentity, s Session)",
252+
"TypeParams": [],
252253
"Receiver": {
253254
"IsPointer": true,
254255
"Type": {
@@ -334,6 +335,8 @@ Function type AST Node entity, corresponding to [NodeType] as FUNC, including fu
334335

335336
- Signature: Function signature, including function name, parameters, return values, etc.
336337

338+
- TypeParams: Generic type parameters (Dependency structure)
339+
337340
- IsInterfaceMethod: Whether it is an interface method -- Here abcoder parse collects InterfaceMethod for easier LLM understanding, but it is not considered a language entity in write
338341

339342

@@ -420,9 +423,8 @@ Type definition, [NodeType] is TYPE, including type definitions in specific lang
420423
"StartOffset": 725,
421424
"EndOffset": 1027,
422425
"Content": "// Session represents a local storage for one session\ntype Session interface {\n\t// IsValid tells if the session is valid at present\n\tIsValid() bool\n\n\t// Get returns value for specific key\n\tGet(key interface{}) interface{}\n\n\t// WithValue sets value for specific key,and return newly effective session\n\tWithValue(key interface{}, val interface{}) Session\n}",
423-
"InlineStruct": [
424-
{} // dependency
425-
],
426+
"InlineStruct": [],
427+
"TypeParams": [],
426428
"Methods": {
427429
"Get": {
428430
"ModPath": "github.com/cloudwego/localsession",
@@ -475,6 +477,7 @@ Type definition, [NodeType] is TYPE, including type definitions in specific lang
475477

476478
- Reason: In some languages like Golang, methods of nested sub-structs are inherited by the parent struct, so they are distinguished from general sub-structs to facilitate tracing all methods owned by the type
477479

480+
- TypeParams: Generic type parameters (Dependency structure)
478481

479482
- Methods: All method Identities corresponding to the struct. The key is the method name, and the value is the function Identity.
480483

docs/uniast-zh.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Universal Abstract-Syntax-Tree Specification (v0.1.3)
1+
# Universal Abstract-Syntax-Tree Specification (v0.1.4)
22

33
Universal Abstract-Syntax-Tree 是 ABCoder 建立的一种 LLM 亲和、语言无关的代码上下文数据结构,表示某个仓库代码的统一抽象语法树。收集了语言实体(函数、类型、常(变)量)的定义及其相互依赖关系,用于后续的 AI 理解、coding-workflow 开发。
44

@@ -250,6 +250,7 @@ Universal Abstract-Syntax-Tree 是 ABCoder 建立的一种 LLM 亲和、语言
250250
"EndOffset": 3573,
251251
"Content": "// BindSession binds the session with current goroutine\nfunc (self *SessionManager) BindSession(Identity SessionIdentity, s Session) {\n\tshard : = self.shards[uint64(Identity)%uint64(self.opts.ShardNumber)]\n\n\tshard.Store(Identity, s)\n\n\tif self.opts.EnableImplicitlyTransmitAsync {\n\t\ttransmitSessionIdentity(Identity)\n\t}\n}",
252252
"Signature": "func (self *SessionManager) BindSession(Identity SessionIdentity, s Session)",
253+
"TypeParams": [],
253254
"Receiver": {
254255
"IsPointer": true,
255256
"Type": {
@@ -335,6 +336,8 @@ Universal Abstract-Syntax-Tree 是 ABCoder 建立的一种 LLM 亲和、语言
335336

336337
- Signature: 函数签名,包括函数名、参数、返回值等
337338

339+
- TypeParams: 泛型的类型参数 (Dependency 结构)
340+
338341
- IsInterfaceMethod: 是否是接口的方法--这里 abcoder parse 收集 InterfaceMethod 为了方便 LLM 理解,但是实际上 write 中并不会认为其是一个语言实体
339342

340343

@@ -421,9 +424,8 @@ Universal Abstract-Syntax-Tree 是 ABCoder 建立的一种 LLM 亲和、语言
421424
"StartOffset": 725,
422425
"EndOffset": 1027,
423426
"Content": "// Session represents a local storage for one session\ntype Session interface {\n\t// IsValid tells if the session is valid at present\n\tIsValid() bool\n\n\t// Get returns value for specific key\n\tGet(key interface{}) interface{}\n\n\t// WithValue sets value for specific key,and return newly effective session\n\tWithValue(key interface{}, val interface{}) Session\n}",
424-
"InlineStruct": [
425-
{} // dependency
426-
],
427+
"InlineStruct": [],
428+
"TypeParams": [],
427429
"Methods": {
428430
"Get": {
429431
"ModPath": "github.com/cloudwego/localsession",
@@ -476,6 +478,7 @@ Universal Abstract-Syntax-Tree 是 ABCoder 建立的一种 LLM 亲和、语言
476478

477479
- 原因: 在某些语言如 Golang 中嵌套子结构体的 methods 会被继承到父结构体中,因此和一般子结构体区分开,方便回溯该类型拥有的所有 method
478480

481+
- TypeParams: 泛型的类型参数 (Dependency 结构)
479482

480483
- Methods: 结构体对应的全部方法 **Identity**,key 为方法名,val 为函数 Identity。
481484

lang/uniast/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
package uniast
1818

19-
const Version = "v0.1.3"
19+
const Version = "v0.1.4"

0 commit comments

Comments
 (0)