@abaplint/core
Version:
abaplint - Core API
32 lines • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Ranges = void 0;
const Expressions = require("../../2_statements/expressions");
const _typed_identifier_1 = require("../../types/_typed_identifier");
const basic_1 = require("../../types/basic");
const basic_types_1 = require("../basic_types");
const assert_error_1 = require("../assert_error");
class Ranges {
runSyntax(node, input) {
var _a;
const nameToken = (_a = node.findFirstExpression(Expressions.DefinitionName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
const typeExpression = node.findFirstExpression(Expressions.SimpleFieldChain2);
if (typeExpression === undefined) {
throw new assert_error_1.AssertError("Ranges, unexpected node");
}
const found = new basic_types_1.BasicTypes(input).parseType(typeExpression);
if (found && nameToken) {
const structure = new basic_1.StructureType([
{ name: "sign", type: new basic_1.CharacterType(1) },
{ name: "option", type: new basic_1.CharacterType(2) },
{ name: "low", type: found },
{ name: "high", type: found },
]);
const type = new basic_1.TableType(structure, { withHeader: true, keyType: basic_1.TableKeyType.default });
const id = new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, type);
input.scope.addIdentifier(id);
}
}
}
exports.Ranges = Ranges;
//# sourceMappingURL=ranges.js.map