@lcap/nasl-parser
Version:
Take Nasl text to Nasl AST with the help of generalized parsing.
109 lines • 4.46 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeAnnotation = exports.CallLogic = exports.Identifier = exports.TypeParam = exports.Function = exports.Logic = exports.Variable = exports.StructureProperty = exports.Structure = exports.CstNamespace = exports.SeqNasl = exports.EmptyBrackets = exports.EmptyBraces = exports.UsingNamespace = exports.CstIntEnumRef = exports.CstAnnotation = exports.CstAnnotationArg = exports.CstIdentifier = void 0;
const nasl_1 = require("@lcap/nasl");
class CstIdentifier {
name;
namespace;
}
exports.CstIdentifier = CstIdentifier;
class CstAnnotationArg {
name;
value;
constructor(name, value) {
this.name = name;
this.value = value;
}
}
exports.CstAnnotationArg = CstAnnotationArg;
class CstAnnotation {
type;
name;
value;
constructor(type, name, value) {
this.type = type;
this.name = name;
this.value = value;
}
}
exports.CstAnnotation = CstAnnotation;
// 专为 app::enums::MyEnum::1 设计
class CstIntEnumRef {
enumTypeName;
value;
constructor(enumTypeName, value) {
this.enumTypeName = enumTypeName;
this.value = value;
}
}
exports.CstIntEnumRef = CstIntEnumRef;
class UsingNamespace {
namespace;
constructor(nsp) {
this.namespace = nsp;
}
}
exports.UsingNamespace = UsingNamespace;
class EmptyBraces extends nasl_1.LogicItem {
} // { }
exports.EmptyBraces = EmptyBraces;
class EmptyBrackets extends nasl_1.LogicItem {
} // [ ]
exports.EmptyBrackets = EmptyBrackets;
class SeqNasl {
// namespace 依赖线性有序结构
nodes = new Array();
}
exports.SeqNasl = SeqNasl;
class CstNamespace {
name;
defs = new Array();
constructor(name, defs) {
this.name = name;
this.defs = defs;
}
}
exports.CstNamespace = CstNamespace;
__exportStar(require("@lcap/nasl"), exports);
var nasl_2 = require("@lcap/nasl");
Object.defineProperty(exports, "Structure", { enumerable: true, get: function () { return nasl_2.Structure; } });
Object.defineProperty(exports, "StructureProperty", { enumerable: true, get: function () { return nasl_2.StructureProperty; } });
Object.defineProperty(exports, "Variable", { enumerable: true, get: function () { return nasl_2.Variable; } });
Object.defineProperty(exports, "Logic", { enumerable: true, get: function () { return nasl_2.Logic; } });
Object.defineProperty(exports, "Function", { enumerable: true, get: function () { return nasl_2.Function; } });
Object.defineProperty(exports, "TypeParam", { enumerable: true, get: function () { return nasl_2.TypeParam; } });
Object.defineProperty(exports, "Identifier", { enumerable: true, get: function () { return nasl_2.Identifier; } });
Object.defineProperty(exports, "CallLogic", { enumerable: true, get: function () { return nasl_2.CallLogic; } });
Object.defineProperty(exports, "TypeAnnotation", { enumerable: true, get: function () { return nasl_2.TypeAnnotation; } });
// FROM(app.dataSources.defaultDS.entities.OrderProduct as OrderProduct)
// .INNER_JOIN(app.dataSources.defaultDS.entities.OrderForm as OrderForm)
// .ON(OrderProduct.orderId == OrderForm.id)
// .INNER_JOIN(app.dataSources.defaultDS.entities.Product as Product)
// .ON(OrderProduct.productId == Product.id)
// .WHERE(OrderProduct.createdBy == '张三' && OrderProduct.createdTime > startDateTime)
// .GROUP_BY(OrderProduct.productId, Product.name)
// .ORDER_BY([productName, 'ASC'])
// .SELECT({
// OrderProduct: OrderProduct,
// OrderForm: OrderForm,
// Product: Product,
// totalAmount: SUM(OrderProduct.amount),
// productId: OrderProduct.productId,
// productName: Product.name}
// )
// .PAGINATE([1, 1000])
//# sourceMappingURL=decorated-nasl-ast.js.map