UnaryExpression 一元表达式
1. 结构声明
- TS Declaration
- JSON Schema
class UnaryExpression extends LogicItem {
argument: LogicItem;
operator: '!' | 'isNull';
}
{
"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"
},
"argument": {
"$ref": "#/definitions/LogicItem"
},
"operator": {
"type": "string",
"enum": [
"!",
"isNull"
]
}
},
"required": [
"argument",
"operator"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "UnaryExpression",
"operator": "!",
"argument": {
"concept": "Identifier",
"namespace": "",
"name": "condition"
}
}
concept: UnaryExpression
operator: "!"
argument:
concept: Identifier
namespace: ""
name: condition
对应的代码如下:
- 文本化 NASL
- Natural TS
!condition
!(condition)
(2) 数据查询中的一元表达式
AST 如下:
- JSON
- YAML
{
"concept": "UnaryExpression",
"operator": "isNull",
"argument": {
"concept": "Identifier",
"namespace": "",
"name": "condition"
}
}
concept: UnaryExpression
operator: isNull
argument:
concept: Identifier
namespace: ""
name: condition
对应的代码如下:
- 文本化 NASL
- Natural TS
(condition) === null
((condition) === null)