Variable 变量
1. 结构声明
- TS Declaration
- JSON Schema
class Variable extends BaseNode {
name: string = '';
description?: string;
typeAnnotation: TypeAnnotation;
defaultValue?: DefaultValue;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"defaultValue": {
"$ref": "#/definitions/DefaultValue"
}
},
"required": [
"name",
"typeAnnotation"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Variable",
"name": "total",
"description": "",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
concept: Variable
name: total
description: ""
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
对应的代码如下:
- 文本化 NASL
total: Integer