Block Block 语句
1. 结构声明
- TS Declaration
- JSON Schema
class Block extends LogicItem {
logicItems: Array<LogicItem>;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"folded": {
"type": "boolean"
},
"offsetX": {
"type": "number"
},
"offsetY": {
"type": "number"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"logicItems": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
}
},
"required": [
"logicItems"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Block",
"logicItems": [
{
"concept": "Assignment",
"label": "赋值",
"left": {
"concept": "Identifier",
"namespace": "",
"name": "result"
},
"right": {
"concept": "NullLiteral"
}
},
{
"concept": "CallLogic",
"uuid": "11fe6dacbd3f42749c14c272fad6ffbb",
"calleeNamespace": "nasl.logging",
"calleeName": "INFO",
"shortcut": true,
"arguments": [
{
"concept": "Argument",
"keyword": "模板",
"expression": {
"concept": "StringLiteral",
"value": "其它情况"
}
}
]
}
]
}
concept: Block
logicItems:
- concept: Assignment
label: 赋值
left:
concept: Identifier
namespace: ""
name: result
right:
concept: NullLiteral
- concept: CallLogic
uuid: 11fe6dacbd3f42749c14c272fad6ffbb
calleeNamespace: nasl.logging
calleeName: INFO
shortcut: true
arguments:
- concept: Argument
keyword: 模板
expression:
concept: StringLiteral
value: 其它情况
对应的代码如下:
- 文本化 NASL
- Natural TS
{
result = null;
nasl::logging::INFO('其它情况');
}
{
result = null;
nasl.logging.INFO('其它情况');
}