@abaplint/core
Version:
abaplint - Core API
21 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CDSString = void 0;
const combi_1 = require("../../abap/2_statements/combi");
class CDSString extends combi_1.Expression {
getRunnable() {
// Allow any character except unescaped single quote; escape sequences:
// '' — escaped single quote (doubling)
// \' — escaped single quote (backslash form)
// \\ — escaped backslash (e.g. '\\' in ltrim/rtrim calls)
// \x — other backslash sequences not followed by '
const reg = (0, combi_1.regex)(/^'(?:[^'\\]|''|\\'|\\\\|\\(?!'))*'$/);
// Typed literal: abap.int4'1', abap.char'X', abap.numc(3)'123', etc.
// Lexed as tokens: abap, ., typename, 'value'
const abapTypeName = (0, combi_1.regex)(/^(?:int[1-9]|sstring|char|numc|dats|tims|fltp|decfloat\d+|dec|string|raw|xstring|clnt|lang|unit|cuky|curr|quan|d|t|p|n|c|x|f)$/i);
const abap = (0, combi_1.seq)("abap", ".", abapTypeName, (0, combi_1.optPrio)((0, combi_1.seq)("(", (0, combi_1.regex)(/^\d+$/), ")")), reg);
return (0, combi_1.altPrio)(abap, reg);
}
}
exports.CDSString = CDSString;
//# sourceMappingURL=cds_string.js.map