Skip to content

Commit 5256de9

Browse files
committed
docs: update README section headings and remove development guide
- Change "Examples" to "Examples Input & Output" (h2 to h3) - Remove entire "Development(中文)" section including contribution guidelines and commit message format
1 parent 76bbd9d commit 5256de9

1 file changed

Lines changed: 1 addition & 84 deletions

File tree

README.md

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ fun analysisByFile(file: File): List<CodeDataStruct> {
180180
}
181181
```
182182

183-
## Examples
183+
### Examples Input & Output
184184

185185
Java source:
186186

@@ -305,89 +305,6 @@ code_property
305305
code_call
306306
```
307307

308-
## Development(中文)
309-
310-
环境:IntelliJ IDEA、JDK 11+
311-
312-
1. 克隆代码:`git clone https://github.com/phodal/chapi`
313-
2. 构建:`./gradlew build`
314-
315-
### 参与开发
316-
317-
为了尽可能降低 bug 的出现概率,项目采用 TDD 的方式进行:先编写对应的语法测试,再实现代码。通过尽可能高的测试覆盖率,来降低回归风险。
318-
319-
项目主要由 domain + 各语言 AST + application 构建:
320-
321-
- domain:统一代码模型
322-
- 各语言 AST:把源码转换为统一的层次抽象模型
323-
- application:对外暴露的简易 API
324-
325-
每个 AST 项目的入口是 `xxAnalyser`,返回的是一个 `CodeContainer`(代码容器)。在非 C# 语言中,它等同于 `CodeFile`(代码文件)。
326-
327-
`CodeContainer` 内对应的领域模型如下所示:
328-
329-
```
330-
// class-first or function-first
331-
code_data_struct // 类、struct、interface 等
332-
code_function // 函数。如果是头等函数语言(first-class function),会用 NodeName = "default" 包在 code_data_struct 模型里
333-
334-
// function or class detail
335-
code_annotation // 注解
336-
code_field // 全局变量
337-
code_import // 包依赖
338-
code_member // 保留字段
339-
code_position // 位置信息
340-
code_property // 参数相关
341-
342-
// method call information
343-
code_call // 函数调用,如 fmt.Println
344-
```
345-
346-
### 加入开发
347-
348-
1. 寻找感兴趣的语言 / 添加新的语言 AST。
349-
350-
通过 TDD 的方式逐步实现下面这些能力(推荐按顺序),示例可参考
351-
[JavaFullIdentListenerTest.kt](https://github.com/phodal/chapi/blob/master/chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaFullIdentListenerTest.kt)
352-
353-
1. package name
354-
2. import name
355-
3. class / data struct
356-
1. struct name
357-
2. struct parameters
358-
3. function name
359-
4. return types
360-
5. function parameters
361-
4. function
362-
1. function name
363-
2. return types
364-
3. function parameters
365-
5. method call
366-
1. new instance call
367-
2. parameter call
368-
3. field call
369-
4. other calls...
370-
371-
### 提交信息格式
372-
373-
发布时使用标准的 [CHANGELOG.md](CHANGELOG.md)
374-
375-
提交信息格式:`<type>[Language]: <message>`
376-
377-
示例:`feat(java): <grammars> init python & go grammars Phodal Huang 2020/2/2, 5:01 PM`
378-
379-
type 列表:
380-
381-
- build: 影响构建系统或外部依赖关系的更改(示例范围:gulp,broccoli,npm)
382-
- ci: 更改持续集成文件和脚本(示例范围:Travis,Circle,BrowserStack,SauceLabs)
383-
- docs: 仅文档更改
384-
- feat: 新功能
385-
- fix: 修复错误
386-
- perf: 性能优化
387-
- refactor: 代码重构(不修复 bug 也不添加功能)
388-
- style: 不影响代码含义的变化(空白、格式化、缺少分号等)
389-
- test: 添加缺失测试或更正现有测试
390-
391308
## License
392309

393310
[![Phodal's Idea](http://brand.phodal.com/shields/idea-small.svg)](http://ideas.phodal.com/)

0 commit comments

Comments
 (0)