StringInterpolation 字符串插值
1. 结构声明
- TS Declaration
- JSON Schema
class StringInterpolation extends LogicItem {
expressions: 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"
},
"expressions": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
}
},
"required": [
"expressions"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "StringInterpolation",
"expressions": [
{
"concept": "StringLiteral",
"value": "总数:"
},
{
"concept": "Identifier",
"namespace": "",
"name": "total"
},
{
"concept": "StringLiteral",
"value": "\\n价格:"
},
{
"concept": "Identifier",
"namespace": "",
"name": "price"
}
]
}
concept: StringInterpolation
expressions:
- concept: StringLiteral
value: 总数:
- concept: Identifier
namespace: ""
name: total
- concept: StringLiteral
value: |-
价格:
- concept: Identifier
namespace: ""
name: price
对应的代码如下:
- 文本化 NASL
s"总数:\$\{total}
价格:\$\{price}"