我的parser-1测试隐式类型转换时输出的kind等键值对与标准输出相同,且顺序结构相同,但会出现key not match :kind报错 #80
Replies: 1 comment
-
请学会使用 markdown 的代码块贴输出内容,不然根本看不出你的输出的层级结构.... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
这是我利用tester/function_test2022/00_main.sysu.c进行测试时修改的代码:
const float PI = 5.5;
int main(){
return 3;
}
这是标准输出:
{
"id": "0x1edc598",
"kind": "TranslationUnitDecl",
"loc": {},
"range": {
"begin": {},
"end": {}
},
"inner": [
{
"id": "0x1f1bd30",
"kind": "VarDecl",
"loc": {
"offset": 207,
"file": "",
"line": 8,
"presumedFile": "tester/function_test2022/00_main.sysu.c",
"presumedLine": 1,
"col": 13,
"tokLen": 2
},
"range": {
"begin": {
"offset": 195,
"col": 1,
"tokLen": 5
},
"end": {
"offset": 212,
"col": 18,
"tokLen": 3
}
},
"name": "PI",
"mangledName": "PI",
"type": {
"qualType": "const float"
},
"init": "c",
"inner": [
{
"id": "0x1f1be00",
"kind": "ImplicitCastExpr",
"range": {
"begin": {
"offset": 212,
"col": 18,
"tokLen": 3
},
"end": {
"offset": 212,
"col": 18,
"tokLen": 3
}
},
"type": {
"qualType": "float"
},
"valueCategory": "rvalue",
"castKind": "FloatingCast",
"inner": [
{
"id": "0x1f1bde0",
"kind": "FloatingLiteral",
"range": {
"begin": {
"offset": 212,
"col": 18,
"tokLen": 3
},
"end": {
"offset": 212,
"col": 18,
"tokLen": 3
}
},
"type": {
"qualType": "double"
},
"valueCategory": "rvalue",
"value": "5.5"
}
]
}
]
},
{
"id": "0x1f1be78",
"kind": "FunctionDecl",
"loc": {
"offset": 221,
"line": 9,
"presumedLine": 2,
"col": 5,
"tokLen": 4
},
"range": {
"begin": {
"offset": 217,
"col": 1,
"tokLen": 3
},
"end": {
"offset": 243,
"line": 11,
"presumedLine": 4,
"col": 1,
"tokLen": 1
}
},
"name": "main",
"mangledName": "main",
"type": {
"qualType": "int ()"
},
"inner": [
{
"id": "0x1f1bf48",
"kind": "CompoundStmt",
"range": {
"begin": {
"offset": 227,
"line": 9,
"presumedLine": 2,
"col": 11,
"tokLen": 1
},
"end": {
"offset": 243,
"line": 11,
"presumedLine": 4,
"col": 1,
"tokLen": 1
}
},
"inner": [
{
"id": "0x1f1bf38",
"kind": "ReturnStmt",
"range": {
"begin": {
"offset": 233,
"line": 10,
"presumedLine": 3,
"col": 5,
"tokLen": 6
},
"end": {
"offset": 240,
"col": 12,
"tokLen": 1
}
},
"inner": [
{
"id": "0x1f1bf18",
"kind": "IntegerLiteral",
"range": {
"begin": {
"offset": 240,
"col": 12,
"tokLen": 1
},
"end": {
"offset": 240,
"col": 12,
"tokLen": 1
}
},
"type": {
"qualType": "int"
},
"valueCategory": "rvalue",
"value": "3"
}
]
}
]
}
]
}
]
}
这是我的输出(已经利用网站转换为YAML格式):
inner:
range: []
type:
qualType: double
value: '5.500000e+00'
valueCategory: rvalue
kind: ImplicitCastExpr
type:
qualType: int
valueCategory: rvalue
kind: VarDecl
loc: []
mangledName: PI
name: PI
range: []
type:
qualType: const float
range: []
type:
qualType: int
value: '3'
valueCategory: rvalue
kind: ReturnStmt
range: []
kind: CompoundStmt
range: []
kind: FunctionDecl
loc: []
mangledName: main
name: main
range: []
type:
qualType: int ()
kind: TranslationUnitDecl
range: []
请帮助我发现问题出在哪里,谢谢
Beta Was this translation helpful? Give feedback.
All reactions