@abaplint/core
Version:
abaplint - Core API
44 lines • 2.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectionScreen = void 0;
const Expressions = require("../../2_statements/expressions");
const _typed_identifier_1 = require("../../types/_typed_identifier");
const basic_1 = require("../../types/basic");
const _syntax_input_1 = require("../_syntax_input");
class SelectionScreen {
runSyntax(node, input) {
const blockNode = node.findFirstExpression(Expressions.BlockName);
const blockToken = blockNode === null || blockNode === void 0 ? void 0 : blockNode.getFirstToken();
const blockName = blockNode === null || blockNode === void 0 ? void 0 : blockNode.concatTokens();
const concat = node.concatTokens().toUpperCase();
const maxNameLengthAllowed = concat.includes("BEGIN OF TABBED BLOCK") ? 16 : 20;
if (blockName !== undefined && blockName.length > maxNameLengthAllowed) {
const message = "SELECTION-SCREEN block name too long, " + blockName;
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
return;
}
const field = node.findFirstExpression(Expressions.InlineField);
if (field !== undefined && field.getFirstToken().getStr().length > 8) {
const message = "SELECTION-SCREEN name too long, " + field.getFirstToken().getStr();
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, field.getFirstToken(), message));
return;
}
const fieldName = field === null || field === void 0 ? void 0 : field.getFirstToken();
if (concat.includes("BEGIN OF TABBED BLOCK") && blockToken) {
const type = new basic_1.StructureType([
{ name: "PROG", type: new basic_1.CharacterType(40) },
{ name: "DYNNR", type: new basic_1.CharacterType(4) },
{ name: "ACTIVETAB", type: new basic_1.CharacterType(132) },
]);
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(blockToken, input.filename, type, ["selection_screen_tab" /* IdentifierMeta.SelectionScreenTab */]));
}
else if (concat.startsWith("SELECTION-SCREEN TAB") && fieldName) {
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(fieldName, input.filename, new basic_1.CharacterType(83), ["selection_screen_tab" /* IdentifierMeta.SelectionScreenTab */]));
}
else if (fieldName) {
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(fieldName, input.filename, new basic_1.CharacterType(83)));
}
}
}
exports.SelectionScreen = SelectionScreen;
//# sourceMappingURL=selection_screen.js.map