@abaplint/transpiler
Version:
46 lines • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DescribeTranspiler = void 0;
const chunk_1 = require("../chunk");
class DescribeTranspiler {
transpile(node, traversal) {
const options = [];
const concat = node.concatTokens().toUpperCase();
const field = node.findExpressionAfterToken("FIELD");
if (field) {
options.push("field: " + traversal.traverse(field).getCode());
}
const type = node.findExpressionAfterToken("TYPE");
if (type) {
options.push("type: " + traversal.traverse(type).getCode());
}
const length = node.findExpressionAfterToken("LENGTH");
if (length) {
options.push("length: " + traversal.traverse(length).getCode());
}
const decimals = node.findExpressionAfterToken("DECIMALS");
if (decimals) {
options.push("decimals: " + traversal.traverse(decimals).getCode());
}
const lines = node.findExpressionAfterToken("LINES");
if (lines) {
options.push("lines: " + traversal.traverse(lines).getCode());
}
const table = node.findExpressionAfterToken("TABLE");
if (table) {
options.push("table: " + traversal.traverse(table).getCode());
}
if (concat.includes("IN CHARACTER MODE")) {
options.push("mode: 'CHARACTER'");
}
if (concat.includes("IN BYTE MODE")) {
options.push("mode: 'BYTE'");
}
return new chunk_1.Chunk()
.append("abap.statements.describe({", node, traversal)
.appendString(options.join(", "))
.append("});", node.getLastToken(), traversal);
}
}
exports.DescribeTranspiler = DescribeTranspiler;
//# sourceMappingURL=describe.js.map