Assignment 赋值语句
1. 结构声明
- TS Declaration
- JSON Schema
class Assignment extends LogicItem {
left: LogicItem;
right: LogicItem;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"changedTime": {
"$ref": "#/definitions/long"
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"folded": {
"type": "boolean"
},
"offsetX": {
"type": "number"
},
"offsetY": {
"type": "number"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"breakpoint": {
"type": "string",
"enum": [
"ENABLED",
"DISABLED"
]
},
"left": {
"$ref": "#/definitions/LogicItem"
},
"right": {
"$ref": "#/definitions/LogicItem"
}
},
"required": [
"left",
"right"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Assignment",
"label": "赋值",
"left": {
"concept": "Identifier",
"namespace": "",
"name": "result"
},
"right": {
"concept": "MemberExpression",
"object": {
"concept": "Identifier",
"namespace": "",
"name": "product"
},
"property": {
"concept": "Identifier",
"namespace": "",
"name": "price"
}
}
}
concept: Assignment
label: 赋值
left:
concept: Identifier
namespace: ""
name: result
right:
concept: MemberExpression
object:
concept: Identifier
namespace: ""
name: product
property:
concept: Identifier
namespace: ""
name: price
对应的代码如下:
- 文本化 NASL
- Natural TS
result = product.price
result = product.price