Skip to main content

@abapify/acds

Parser for ABAP CDS DDL source (.acds/DDLS sources). Tokenizes, parses, and produces a typed AST for tables, structures, simple types, services, metadata extensions, and (phased) roles + view entities. Built on chevrotain with error recovery — partial ASTs plus structured errors are returned even on malformed input.

Install

bun add @abapify/acds

Public API

export { parse, type ParseResult } from '@abapify/acds';
// Re-exported from './ast', './tokens', './errors':
export type {
CdsSourceFile,
CdsDefinition,
TableDefinition,
StructureDefinition,
SimpleTypeDefinition,
ServiceDefinition,
MetadataExtension,
FieldDefinition,
IncludeDirective,
TypeRef,
BuiltinTypeRef,
NamedTypeRef,
CdsParseError,
} from '@abapify/acds';

Usage

import { parse } from '@abapify/acds';

const result = parse(`
@AbapCatalog.tableCategory : #TRANSPARENT
define table ztable {
key field1 : abap.char(10) not null;
field2 : some_data_element;
}
`);

if (result.errors.length === 0) {
const table = result.ast.definitions[0]; // TableDefinition
console.log(table.name, table.fields);
}

Dependencies

See also