@abapify/abap-ast 0.4.31 → 0.4.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -184
- package/dist/index.d.mts +57 -62
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +100 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,46 +1,25 @@
|
|
|
1
1
|
# @abapify/abap-ast
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@abapify/abap-ast)
|
|
4
|
+
[](https://github.com/abapify/adt-cli/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Zero-dependency typed AST and pretty-printer for ABAP source code (classes, interfaces, types, statements).
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
model for ABAP classes, interfaces, types, statements, and expressions, plus
|
|
9
|
-
a single `print()` entry point that serialises any node to valid ABAP source.
|
|
10
|
-
|
|
11
|
-
There is **no parser (yet)** — this package is emit-only. A future `.aclass`
|
|
12
|
-
parser (e.g. Chevrotain-based) will produce the same AST, so code built on
|
|
13
|
-
top of this package stays forward-compatible.
|
|
14
|
-
|
|
15
|
-
Primary consumer: [`@abapify/openai-codegen`](../openai-codegen).
|
|
16
|
-
|
|
17
|
-
### What it gives you
|
|
18
|
-
|
|
19
|
-
- Typed factory functions for every node kind (classes, interfaces,
|
|
20
|
-
methods, types, statements, expressions).
|
|
21
|
-
- A deterministic printer: identical input produces byte-identical output,
|
|
22
|
-
across runs, platforms, and Node versions.
|
|
23
|
-
- Configurable keyword case, indent, and line ending.
|
|
24
|
-
- No runtime dependencies.
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
8
|
+
## Install
|
|
27
9
|
|
|
28
10
|
```bash
|
|
29
|
-
|
|
11
|
+
npm install @abapify/abap-ast
|
|
30
12
|
```
|
|
31
13
|
|
|
32
|
-
##
|
|
14
|
+
## Usage
|
|
33
15
|
|
|
34
|
-
```
|
|
16
|
+
```ts
|
|
35
17
|
import {
|
|
36
18
|
print,
|
|
37
19
|
classDef,
|
|
38
20
|
section,
|
|
39
|
-
typeDef,
|
|
40
21
|
methodDef,
|
|
41
22
|
methodImpl,
|
|
42
|
-
methodParam,
|
|
43
|
-
builtinType,
|
|
44
23
|
returnStmt,
|
|
45
24
|
} from '@abapify/abap-ast';
|
|
46
25
|
|
|
@@ -50,171 +29,25 @@ const cls = classDef({
|
|
|
50
29
|
sections: [
|
|
51
30
|
section({
|
|
52
31
|
visibility: 'public',
|
|
53
|
-
members: [
|
|
54
|
-
typeDef({ name: 'ty_name', type: builtinType({ name: 'string' }) }),
|
|
55
|
-
methodDef({
|
|
56
|
-
name: 'greet',
|
|
57
|
-
visibility: 'public',
|
|
58
|
-
params: [
|
|
59
|
-
methodParam({
|
|
60
|
-
paramKind: 'importing',
|
|
61
|
-
name: 'iv_name',
|
|
62
|
-
typeRef: builtinType({ name: 'string' }),
|
|
63
|
-
}),
|
|
64
|
-
methodParam({
|
|
65
|
-
paramKind: 'returning',
|
|
66
|
-
name: 'rv_msg',
|
|
67
|
-
typeRef: builtinType({ name: 'string' }),
|
|
68
|
-
}),
|
|
69
|
-
],
|
|
70
|
-
}),
|
|
71
|
-
],
|
|
32
|
+
members: [methodDef({ name: 'greet', visibility: 'public' })],
|
|
72
33
|
}),
|
|
73
34
|
],
|
|
74
35
|
implementations: [methodImpl({ name: 'greet', body: [returnStmt()] })],
|
|
75
36
|
});
|
|
76
37
|
|
|
77
|
-
console.log(print(cls));
|
|
38
|
+
console.log(print(cls)); // CLASS zcl_greeter DEFINITION PUBLIC FINAL ...
|
|
78
39
|
```
|
|
79
40
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```abap
|
|
83
|
-
CLASS zcl_greeter DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
84
|
-
PUBLIC SECTION.
|
|
85
|
-
TYPES ty_name TYPE string.
|
|
86
|
-
METHODS greet
|
|
87
|
-
IMPORTING iv_name TYPE string
|
|
88
|
-
RETURNING VALUE(rv_msg) TYPE string.
|
|
89
|
-
ENDCLASS.
|
|
90
|
-
|
|
91
|
-
CLASS zcl_greeter IMPLEMENTATION.
|
|
92
|
-
METHOD greet.
|
|
93
|
-
RETURN.
|
|
94
|
-
ENDMETHOD.
|
|
95
|
-
ENDCLASS.
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Node kinds
|
|
99
|
-
|
|
100
|
-
Every node has a `kind: NodeKind` PascalCase discriminant. Nodes are grouped
|
|
101
|
-
by topic under `src/nodes/`; each module exports interfaces plus matching
|
|
102
|
-
factory functions. You rarely need the raw interfaces — the factories are
|
|
103
|
-
the public surface.
|
|
104
|
-
|
|
105
|
-
| Module | Factories |
|
|
106
|
-
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
107
|
-
| `base.ts` | `comment` (plus shared types: `NodeKind`, `Visibility`, `Identifier`) |
|
|
108
|
-
| `types.ts` | `builtinType`, `namedTypeRef`, `tableType`, `structureType`, `enumType`, `typeDef` |
|
|
109
|
-
| `data.ts` | `dataDecl`, `constantDecl`, `fieldSymbolDecl` |
|
|
110
|
-
| `expressions.ts` | `literal`, `identifierExpr`, `constructorExpr`, `methodCallExpr`, `binOp`, `stringTemplate`, `cast` |
|
|
111
|
-
| `statements.ts` | `assign`, `call`, `raise`, `ifStmt`, `loop`, `returnStmt`, `tryStmt`, `append`, `insert`, `read`, `clear`, `exit`, `continueStmt`, `raw` |
|
|
112
|
-
| `members.ts` | `methodParam`, `methodDef`, `methodImpl`, `eventDef`, `attributeDef` |
|
|
113
|
-
| `class.ts` | `section`, `classDef`, `localClassDef` |
|
|
114
|
-
| `interface.ts` | `interfaceDef` |
|
|
115
|
-
|
|
116
|
-
See [`src/nodes/`](src/nodes) for the full signatures — each factory is a
|
|
117
|
-
one-argument function taking a named-input object and returning a frozen
|
|
118
|
-
AST node.
|
|
119
|
-
|
|
120
|
-
`raw({ source })` is an escape hatch for ABAP fragments that are not yet
|
|
121
|
-
representable in the AST. Consumers should prefer structured nodes and
|
|
122
|
-
confine `raw` to known-safe cases.
|
|
123
|
-
|
|
124
|
-
## ABAPDoc comments
|
|
125
|
-
|
|
126
|
-
Declaration nodes (`TypeDef`, `MethodDef`, `AttributeDef`, `InterfaceDef`,
|
|
127
|
-
`ClassDef`) accept an optional `abapDoc: readonly string[]` field. The
|
|
128
|
-
printer emits each line verbatim prefixed with `"!` at the declaration's
|
|
129
|
-
own indentation, immediately above it. This is the standard ABAP way to
|
|
130
|
-
attach structured metadata to a declaration (ABAPDoc / Knowledge Transfer
|
|
131
|
-
comments).
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
134
|
-
import { print, methodDef, methodParam, builtinType } from '@abapify/abap-ast';
|
|
135
|
-
|
|
136
|
-
const m = methodDef({
|
|
137
|
-
name: 'get_foo',
|
|
138
|
-
visibility: 'public',
|
|
139
|
-
abapDoc: [
|
|
140
|
-
'@openapi-operation getFoo',
|
|
141
|
-
'@openapi-path GET /foo/{id}',
|
|
142
|
-
'Return a foo by id.',
|
|
143
|
-
],
|
|
144
|
-
params: [
|
|
145
|
-
methodParam({
|
|
146
|
-
paramKind: 'importing',
|
|
147
|
-
name: 'id',
|
|
148
|
-
typeRef: builtinType({ name: 'string' }),
|
|
149
|
-
}),
|
|
150
|
-
],
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
console.log(print(m));
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
emits:
|
|
157
|
-
|
|
158
|
-
```abap
|
|
159
|
-
"! @openapi-operation getFoo
|
|
160
|
-
"! @openapi-path GET /foo/{id}
|
|
161
|
-
"! Return a foo by id.
|
|
162
|
-
METHODS get_foo
|
|
163
|
-
IMPORTING id TYPE string.
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Lines are written verbatim: no automatic wrapping, no escaping, no tag
|
|
167
|
-
rewriting. Consumers own their tag conventions.
|
|
168
|
-
|
|
169
|
-
## Printer
|
|
170
|
-
|
|
171
|
-
```typescript
|
|
172
|
-
import { print, type PrintOptions } from '@abapify/abap-ast';
|
|
173
|
-
|
|
174
|
-
const source: string = print(node, options?);
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
| Option | Type | Default | Notes |
|
|
178
|
-
| ------------- | -------------------- | --------- | ------------------------------------------- |
|
|
179
|
-
| `indent` | `number` | `2` | Spaces per indentation level. |
|
|
180
|
-
| `keywordCase` | `'upper' \| 'lower'` | `'upper'` | Case of ABAP keywords (`CLASS`, `METHODS`). |
|
|
181
|
-
| `eol` | `string` | `'\n'` | Line ending (`'\r\n'` for CRLF output). |
|
|
182
|
-
|
|
183
|
-
**Determinism guarantee.** For a given input tree and resolved options,
|
|
184
|
-
`print()` always returns the same string. The printer does no implicit
|
|
185
|
-
sorting, random id generation, or environment lookup. Snapshot-testing the
|
|
186
|
-
output is safe and is how this package is validated (see
|
|
187
|
-
`tests/printer.test.ts`).
|
|
188
|
-
|
|
189
|
-
The printer accepts most nodes at the top level, but a few internal nodes
|
|
190
|
-
(`Section`, `MethodParam`, and bare `TableType`/`StructureType` etc.) throw
|
|
191
|
-
if passed directly — wrap them in their enclosing node (`ClassDef`,
|
|
192
|
-
`MethodDef`, `TypeDef`) first.
|
|
193
|
-
|
|
194
|
-
## Design
|
|
195
|
-
|
|
196
|
-
This package deliberately mirrors the `ts.factory` pattern from the
|
|
197
|
-
TypeScript compiler API:
|
|
198
|
-
|
|
199
|
-
- The AST is the single source of truth for ABAP structure.
|
|
200
|
-
- Factories validate required fields at construction time and freeze the
|
|
201
|
-
returned node.
|
|
202
|
-
- The printer is a pure function of the tree.
|
|
203
|
-
- No string concatenation leaks into consumer code — they always go through
|
|
204
|
-
a typed factory.
|
|
41
|
+
## Features
|
|
205
42
|
|
|
206
|
-
|
|
207
|
-
|
|
43
|
+
- Typed node factories for classes, interfaces, types, and statements
|
|
44
|
+
- Deterministic pretty-printer with ABAPDoc support
|
|
45
|
+
- Zero runtime dependencies
|
|
208
46
|
|
|
209
|
-
##
|
|
47
|
+
## Documentation
|
|
210
48
|
|
|
211
|
-
-
|
|
212
|
-
generator. Builds two `InterfaceDef`s, one `ClassDef` for the
|
|
213
|
-
implementation, and one `ClassDef` for the exception. Uses the
|
|
214
|
-
`abapDoc` field to attach round-trip `@openapi-*` markers on every
|
|
215
|
-
generated type and operation, and relies on the printer's determinism
|
|
216
|
-
guarantee for reproducible artefacts.
|
|
49
|
+
**[adt-cli.netlify.app/sdk/packages/abap-ast](https://adt-cli.netlify.app/sdk/packages/abap-ast)**
|
|
217
50
|
|
|
218
|
-
|
|
51
|
+
---
|
|
219
52
|
|
|
220
|
-
|
|
53
|
+
Part of [**abapify**](https://github.com/abapify/adt-cli) — open, typed tooling for SAP ABAP Development Tools (ADT): CLI, MCP server, and SDK.
|
package/dist/index.d.mts
CHANGED
|
@@ -5,23 +5,18 @@ declare function requireField<T>(value: T | undefined | null, field: string, nod
|
|
|
5
5
|
/** All node kinds in the AST. */
|
|
6
6
|
type NodeKind = 'BuiltinType' | 'TableType' | 'StructureType' | 'NamedTypeRef' | 'EnumType' | 'TypeDef' | 'DataDecl' | 'ConstantDecl' | 'FieldSymbolDecl' | 'Assign' | 'Call' | 'Raise' | 'If' | 'Loop' | 'Return' | 'Try' | 'Append' | 'Insert' | 'Read' | 'Clear' | 'Exit' | 'Continue' | 'Raw' | 'Literal' | 'IdentifierExpr' | 'ConstructorExpr' | 'MethodCallExpr' | 'BinOp' | 'StringTemplate' | 'Cast' | 'MethodParam' | 'MethodDef' | 'MethodImpl' | 'EventDef' | 'AttributeDef' | 'Section' | 'ClassDef' | 'LocalClassDef' | 'InterfaceDef' | 'Comment';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* ABAPDoc metadata attached to a declaration node. Each entry is a single
|
|
9
|
+
* comment line, stored without the leading `"!` prefix (the prefix is added
|
|
10
|
+
* by the printer at emit time); printers emit one `"! <line>` per entry
|
|
11
|
+
* immediately above the declaration, at the same indentation as the
|
|
12
|
+
* declaration itself.
|
|
10
13
|
*/
|
|
11
|
-
type
|
|
12
|
-
/**
|
|
13
|
-
* ABAPDoc metadata attached to a declaration node. Each entry is a logical
|
|
14
|
-
* line; printers emit one `"! <line>` per entry immediately above the
|
|
15
|
-
* declaration, at the same indentation as the declaration itself.
|
|
16
|
-
*/
|
|
17
|
-
type AbapDoc = readonly AbapDocLine[];
|
|
14
|
+
type AbapDoc = readonly string[];
|
|
18
15
|
/** Base shape for any AST node. */
|
|
19
16
|
interface AbapNode {
|
|
20
17
|
readonly kind: NodeKind;
|
|
21
18
|
readonly abapDoc?: AbapDoc;
|
|
22
19
|
}
|
|
23
|
-
/** An ABAP identifier (not validated beyond presence). */
|
|
24
|
-
type Identifier = string;
|
|
25
20
|
/** An ABAP comment. Star comments begin at column 1; line comments use `"`. */
|
|
26
21
|
interface Comment extends AbapNode {
|
|
27
22
|
readonly kind: 'Comment';
|
|
@@ -50,10 +45,10 @@ declare function builtinType(input: {
|
|
|
50
45
|
/** Reference to a named type (e.g. `zif_foo=>ty_bar`). */
|
|
51
46
|
interface NamedTypeRef extends AbapNode {
|
|
52
47
|
readonly kind: 'NamedTypeRef';
|
|
53
|
-
readonly name:
|
|
48
|
+
readonly name: string;
|
|
54
49
|
}
|
|
55
50
|
declare function namedTypeRef(input: {
|
|
56
|
-
name:
|
|
51
|
+
name: string;
|
|
57
52
|
}): NamedTypeRef;
|
|
58
53
|
/** Type reference used in declarations. */
|
|
59
54
|
type TypeRef = BuiltinType | NamedTypeRef | TableType | StructureType;
|
|
@@ -63,17 +58,17 @@ interface TableType extends AbapNode {
|
|
|
63
58
|
readonly rowType: TypeRef;
|
|
64
59
|
readonly tableKind: 'standard' | 'sorted' | 'hashed';
|
|
65
60
|
readonly uniqueness?: 'unique' | 'non-unique';
|
|
66
|
-
readonly keyFields?: readonly
|
|
61
|
+
readonly keyFields?: readonly string[];
|
|
67
62
|
}
|
|
68
63
|
declare function tableType(input: {
|
|
69
64
|
rowType: TypeRef;
|
|
70
65
|
tableKind?: 'standard' | 'sorted' | 'hashed';
|
|
71
66
|
uniqueness?: 'unique' | 'non-unique';
|
|
72
|
-
keyFields?: readonly
|
|
67
|
+
keyFields?: readonly string[];
|
|
73
68
|
}): TableType;
|
|
74
69
|
/** Field of a structure type. */
|
|
75
70
|
interface StructureField {
|
|
76
|
-
readonly name:
|
|
71
|
+
readonly name: string;
|
|
77
72
|
readonly type: TypeRef;
|
|
78
73
|
}
|
|
79
74
|
/** ABAP `BEGIN OF ... END OF` structure type. */
|
|
@@ -86,7 +81,7 @@ declare function structureType(input: {
|
|
|
86
81
|
}): StructureType;
|
|
87
82
|
/** Enum-like type: a fixed set of name/value pairs with a base type. */
|
|
88
83
|
interface EnumMember {
|
|
89
|
-
readonly name:
|
|
84
|
+
readonly name: string;
|
|
90
85
|
readonly value: string | number;
|
|
91
86
|
}
|
|
92
87
|
interface EnumType extends AbapNode {
|
|
@@ -101,11 +96,11 @@ declare function enumType(input: {
|
|
|
101
96
|
/** Top-level `TYPES: <name> TYPE ...` declaration. */
|
|
102
97
|
interface TypeDef extends AbapNode {
|
|
103
98
|
readonly kind: 'TypeDef';
|
|
104
|
-
readonly name:
|
|
99
|
+
readonly name: string;
|
|
105
100
|
readonly type: TypeRef | EnumType;
|
|
106
101
|
}
|
|
107
102
|
declare function typeDef(input: {
|
|
108
|
-
name:
|
|
103
|
+
name: string;
|
|
109
104
|
type: TypeRef | EnumType;
|
|
110
105
|
abapDoc?: AbapDoc;
|
|
111
106
|
}): TypeDef;
|
|
@@ -124,14 +119,14 @@ declare function literal(input: {
|
|
|
124
119
|
/** A bare identifier used as an expression (variable, constant reference). */
|
|
125
120
|
interface IdentifierExpr extends AbapNode {
|
|
126
121
|
readonly kind: 'IdentifierExpr';
|
|
127
|
-
readonly name:
|
|
122
|
+
readonly name: string;
|
|
128
123
|
}
|
|
129
124
|
declare function identifierExpr(input: {
|
|
130
|
-
name:
|
|
125
|
+
name: string;
|
|
131
126
|
}): IdentifierExpr;
|
|
132
127
|
/** Named argument on a method call / constructor. */
|
|
133
128
|
interface NamedArg {
|
|
134
|
-
readonly name:
|
|
129
|
+
readonly name: string;
|
|
135
130
|
readonly value: Expression;
|
|
136
131
|
}
|
|
137
132
|
/** `NEW <type>( ... )`. */
|
|
@@ -148,13 +143,13 @@ declare function constructorExpr(input: {
|
|
|
148
143
|
interface MethodCallExpr extends AbapNode {
|
|
149
144
|
readonly kind: 'MethodCallExpr';
|
|
150
145
|
readonly receiver: Expression | undefined;
|
|
151
|
-
readonly method:
|
|
146
|
+
readonly method: string;
|
|
152
147
|
readonly callKind: 'static' | 'instance';
|
|
153
148
|
readonly args: readonly NamedArg[];
|
|
154
149
|
}
|
|
155
150
|
declare function methodCallExpr(input: {
|
|
156
151
|
receiver?: Expression;
|
|
157
|
-
method:
|
|
152
|
+
method: string;
|
|
158
153
|
callKind: 'static' | 'instance';
|
|
159
154
|
args?: readonly NamedArg[];
|
|
160
155
|
}): MethodCallExpr;
|
|
@@ -200,13 +195,13 @@ declare function cast(input: {
|
|
|
200
195
|
/** `DATA lv_x TYPE ... [VALUE ...]`. */
|
|
201
196
|
interface DataDecl extends AbapNode {
|
|
202
197
|
readonly kind: 'DataDecl';
|
|
203
|
-
readonly name:
|
|
198
|
+
readonly name: string;
|
|
204
199
|
readonly type: TypeRef;
|
|
205
200
|
readonly initial?: Expression;
|
|
206
201
|
readonly classData?: boolean;
|
|
207
202
|
}
|
|
208
203
|
declare function dataDecl(input: {
|
|
209
|
-
name:
|
|
204
|
+
name: string;
|
|
210
205
|
type: TypeRef;
|
|
211
206
|
initial?: Expression;
|
|
212
207
|
classData?: boolean;
|
|
@@ -214,13 +209,13 @@ declare function dataDecl(input: {
|
|
|
214
209
|
/** `CONSTANTS c_x TYPE ... VALUE ...`. */
|
|
215
210
|
interface ConstantDecl extends AbapNode {
|
|
216
211
|
readonly kind: 'ConstantDecl';
|
|
217
|
-
readonly name:
|
|
212
|
+
readonly name: string;
|
|
218
213
|
readonly type: TypeRef;
|
|
219
214
|
readonly value: Expression;
|
|
220
215
|
readonly classData?: boolean;
|
|
221
216
|
}
|
|
222
217
|
declare function constantDecl(input: {
|
|
223
|
-
name:
|
|
218
|
+
name: string;
|
|
224
219
|
type: TypeRef;
|
|
225
220
|
value: Expression;
|
|
226
221
|
classData?: boolean;
|
|
@@ -228,11 +223,11 @@ declare function constantDecl(input: {
|
|
|
228
223
|
/** `FIELD-SYMBOLS <fs_x> TYPE ...`. */
|
|
229
224
|
interface FieldSymbolDecl extends AbapNode {
|
|
230
225
|
readonly kind: 'FieldSymbolDecl';
|
|
231
|
-
readonly name:
|
|
226
|
+
readonly name: string;
|
|
232
227
|
readonly type: TypeRef;
|
|
233
228
|
}
|
|
234
229
|
declare function fieldSymbolDecl(input: {
|
|
235
|
-
name:
|
|
230
|
+
name: string;
|
|
236
231
|
type: TypeRef;
|
|
237
232
|
}): FieldSymbolDecl;
|
|
238
233
|
/** Union of all statement node types. */
|
|
@@ -251,13 +246,13 @@ declare function assign(input: {
|
|
|
251
246
|
interface Call extends AbapNode {
|
|
252
247
|
readonly kind: 'Call';
|
|
253
248
|
readonly receiver: Expression | undefined;
|
|
254
|
-
readonly method:
|
|
249
|
+
readonly method: string;
|
|
255
250
|
readonly callKind: 'static' | 'instance';
|
|
256
251
|
readonly args: readonly NamedArg[];
|
|
257
252
|
}
|
|
258
253
|
declare function call(input: {
|
|
259
254
|
receiver?: Expression;
|
|
260
|
-
method:
|
|
255
|
+
method: string;
|
|
261
256
|
callKind: 'static' | 'instance';
|
|
262
257
|
args?: readonly NamedArg[];
|
|
263
258
|
}): Call;
|
|
@@ -296,10 +291,10 @@ interface Loop extends AbapNode {
|
|
|
296
291
|
readonly table: Expression;
|
|
297
292
|
readonly binding: {
|
|
298
293
|
readonly bindKind: 'into';
|
|
299
|
-
readonly target:
|
|
294
|
+
readonly target: string;
|
|
300
295
|
} | {
|
|
301
296
|
readonly bindKind: 'assigning';
|
|
302
|
-
readonly fieldSymbol:
|
|
297
|
+
readonly fieldSymbol: string;
|
|
303
298
|
};
|
|
304
299
|
readonly body: readonly Statement[];
|
|
305
300
|
}
|
|
@@ -328,7 +323,7 @@ declare function returnStmt(input?: {
|
|
|
328
323
|
/** CATCH clause inside a TRY. */
|
|
329
324
|
interface CatchClause {
|
|
330
325
|
readonly exceptionTypes: readonly TypeRef[];
|
|
331
|
-
readonly into?:
|
|
326
|
+
readonly into?: string;
|
|
332
327
|
readonly body: readonly Statement[];
|
|
333
328
|
}
|
|
334
329
|
/** TRY / CATCH / CLEANUP. */
|
|
@@ -369,10 +364,10 @@ interface Read extends AbapNode {
|
|
|
369
364
|
readonly table: Expression;
|
|
370
365
|
readonly binding: {
|
|
371
366
|
readonly bindKind: 'into';
|
|
372
|
-
readonly target:
|
|
367
|
+
readonly target: string;
|
|
373
368
|
} | {
|
|
374
369
|
readonly bindKind: 'assigning';
|
|
375
|
-
readonly fieldSymbol:
|
|
370
|
+
readonly fieldSymbol: string;
|
|
376
371
|
};
|
|
377
372
|
readonly withKey?: readonly NamedArg[];
|
|
378
373
|
readonly index?: Expression;
|
|
@@ -414,21 +409,21 @@ type ParamKind = 'importing' | 'exporting' | 'changing' | 'returning';
|
|
|
414
409
|
interface MethodParam extends AbapNode {
|
|
415
410
|
readonly kind: 'MethodParam';
|
|
416
411
|
readonly paramKind: ParamKind;
|
|
417
|
-
readonly name:
|
|
412
|
+
readonly name: string;
|
|
418
413
|
readonly typeRef: TypeRef;
|
|
419
414
|
readonly optional?: boolean;
|
|
420
415
|
readonly default?: Expression;
|
|
421
416
|
}
|
|
422
417
|
declare function methodParam(input: {
|
|
423
418
|
paramKind: ParamKind;
|
|
424
|
-
name:
|
|
419
|
+
name: string;
|
|
425
420
|
typeRef: TypeRef;
|
|
426
421
|
optional?: boolean;
|
|
427
422
|
default?: Expression;
|
|
428
423
|
}): MethodParam;
|
|
429
424
|
interface MethodDef extends AbapNode {
|
|
430
425
|
readonly kind: 'MethodDef';
|
|
431
|
-
readonly name:
|
|
426
|
+
readonly name: string;
|
|
432
427
|
readonly params: readonly MethodParam[];
|
|
433
428
|
readonly raising: readonly TypeRef[];
|
|
434
429
|
readonly visibility: Visibility;
|
|
@@ -439,7 +434,7 @@ interface MethodDef extends AbapNode {
|
|
|
439
434
|
readonly isForTesting?: boolean;
|
|
440
435
|
}
|
|
441
436
|
declare function methodDef(input: {
|
|
442
|
-
name:
|
|
437
|
+
name: string;
|
|
443
438
|
params?: readonly MethodParam[];
|
|
444
439
|
raising?: readonly TypeRef[];
|
|
445
440
|
visibility: Visibility;
|
|
@@ -453,29 +448,29 @@ declare function methodDef(input: {
|
|
|
453
448
|
/** Body of a method in the IMPLEMENTATION block. */
|
|
454
449
|
interface MethodImpl extends AbapNode {
|
|
455
450
|
readonly kind: 'MethodImpl';
|
|
456
|
-
readonly name:
|
|
451
|
+
readonly name: string;
|
|
457
452
|
readonly body: readonly Statement[];
|
|
458
453
|
}
|
|
459
454
|
declare function methodImpl(input: {
|
|
460
|
-
name:
|
|
455
|
+
name: string;
|
|
461
456
|
body: readonly Statement[];
|
|
462
457
|
}): MethodImpl;
|
|
463
458
|
/** EVENT declaration (stub — body not modelled yet). */
|
|
464
459
|
interface EventDef extends AbapNode {
|
|
465
460
|
readonly kind: 'EventDef';
|
|
466
|
-
readonly name:
|
|
461
|
+
readonly name: string;
|
|
467
462
|
readonly visibility: Visibility;
|
|
468
463
|
readonly isClassEvent?: boolean;
|
|
469
464
|
}
|
|
470
465
|
declare function eventDef(input: {
|
|
471
|
-
name:
|
|
466
|
+
name: string;
|
|
472
467
|
visibility: Visibility;
|
|
473
468
|
isClassEvent?: boolean;
|
|
474
469
|
}): EventDef;
|
|
475
470
|
/** DATA / CLASS-DATA declaration inside a class section. */
|
|
476
471
|
interface AttributeDef extends AbapNode {
|
|
477
472
|
readonly kind: 'AttributeDef';
|
|
478
|
-
readonly name:
|
|
473
|
+
readonly name: string;
|
|
479
474
|
readonly type: TypeRef;
|
|
480
475
|
readonly visibility: Visibility;
|
|
481
476
|
readonly classData?: boolean;
|
|
@@ -483,7 +478,7 @@ interface AttributeDef extends AbapNode {
|
|
|
483
478
|
readonly initial?: Expression;
|
|
484
479
|
}
|
|
485
480
|
declare function attributeDef(input: {
|
|
486
|
-
name:
|
|
481
|
+
name: string;
|
|
487
482
|
type: TypeRef;
|
|
488
483
|
visibility: Visibility;
|
|
489
484
|
classData?: boolean;
|
|
@@ -506,9 +501,9 @@ declare function section(input: {
|
|
|
506
501
|
/** Top-level global class (`CLASS ... DEFINITION` + `IMPLEMENTATION`). */
|
|
507
502
|
interface ClassDef extends AbapNode {
|
|
508
503
|
readonly kind: 'ClassDef';
|
|
509
|
-
readonly name:
|
|
510
|
-
readonly superclass?:
|
|
511
|
-
readonly interfaces: readonly
|
|
504
|
+
readonly name: string;
|
|
505
|
+
readonly superclass?: string;
|
|
506
|
+
readonly interfaces: readonly string[];
|
|
512
507
|
readonly isFinal?: boolean;
|
|
513
508
|
readonly isAbstract?: boolean;
|
|
514
509
|
readonly isForTesting?: boolean;
|
|
@@ -517,9 +512,9 @@ interface ClassDef extends AbapNode {
|
|
|
517
512
|
readonly implementations: readonly MethodImpl[];
|
|
518
513
|
}
|
|
519
514
|
declare function classDef(input: {
|
|
520
|
-
name:
|
|
521
|
-
superclass?:
|
|
522
|
-
interfaces?: readonly
|
|
515
|
+
name: string;
|
|
516
|
+
superclass?: string;
|
|
517
|
+
interfaces?: readonly string[];
|
|
523
518
|
isFinal?: boolean;
|
|
524
519
|
isAbstract?: boolean;
|
|
525
520
|
isForTesting?: boolean;
|
|
@@ -531,9 +526,9 @@ declare function classDef(input: {
|
|
|
531
526
|
/** A local class inside a CLAS-POOL (same shape as ClassDef, flagged local). */
|
|
532
527
|
interface LocalClassDef extends AbapNode {
|
|
533
528
|
readonly kind: 'LocalClassDef';
|
|
534
|
-
readonly name:
|
|
535
|
-
readonly superclass?:
|
|
536
|
-
readonly interfaces: readonly
|
|
529
|
+
readonly name: string;
|
|
530
|
+
readonly superclass?: string;
|
|
531
|
+
readonly interfaces: readonly string[];
|
|
537
532
|
readonly isFinal?: boolean;
|
|
538
533
|
readonly isAbstract?: boolean;
|
|
539
534
|
readonly isForTesting?: boolean;
|
|
@@ -542,9 +537,9 @@ interface LocalClassDef extends AbapNode {
|
|
|
542
537
|
readonly local: true;
|
|
543
538
|
}
|
|
544
539
|
declare function localClassDef(input: {
|
|
545
|
-
name:
|
|
546
|
-
superclass?:
|
|
547
|
-
interfaces?: readonly
|
|
540
|
+
name: string;
|
|
541
|
+
superclass?: string;
|
|
542
|
+
interfaces?: readonly string[];
|
|
548
543
|
isFinal?: boolean;
|
|
549
544
|
isAbstract?: boolean;
|
|
550
545
|
isForTesting?: boolean;
|
|
@@ -556,11 +551,11 @@ type InterfaceMember = TypeDef | MethodDef;
|
|
|
556
551
|
/** `INTERFACE zif_foo. ... ENDINTERFACE.`. */
|
|
557
552
|
interface InterfaceDef extends AbapNode {
|
|
558
553
|
readonly kind: 'InterfaceDef';
|
|
559
|
-
readonly name:
|
|
554
|
+
readonly name: string;
|
|
560
555
|
readonly members: readonly InterfaceMember[];
|
|
561
556
|
}
|
|
562
557
|
declare function interfaceDef(input: {
|
|
563
|
-
name:
|
|
558
|
+
name: string;
|
|
564
559
|
members?: readonly InterfaceMember[];
|
|
565
560
|
abapDoc?: AbapDoc;
|
|
566
561
|
}): InterfaceDef;
|
|
@@ -602,5 +597,5 @@ declare function printInlineType(type: TypeRef, writer: Writer): string;
|
|
|
602
597
|
declare function printExpression(expr: Expression, writer: Writer): string;
|
|
603
598
|
/** Pretty-print an ABAP AST node to source code. */
|
|
604
599
|
declare function print(node: AbapNode, options?: PrintOptions): string;
|
|
605
|
-
export { AbapAstError, AbapDoc,
|
|
600
|
+
export { AbapAstError, AbapDoc, AbapNode, Append, Assign, AttributeDef, BinOp, BinOperator, BuiltinType, BuiltinTypeName, Call, Cast, CatchClause, ClassDef, Clear, Comment, ConstantDecl, ConstructorExpr, Continue, DataDecl, ElseIfBranch, EnumMember, EnumType, EventDef, Exit, Expression, FieldSymbolDecl, IdentifierExpr, If, Insert, InterfaceDef, InterfaceMember, Literal, LocalClassDef, Loop, MethodCallExpr, MethodDef, MethodImpl, MethodParam, NamedArg, NamedTypeRef, NodeKind, ParamKind, type PrintOptions, Raise, Raw, Read, type ResolvedPrintOptions, Return, Section, SectionMember, Statement, StringTemplate, StringTemplatePart, StructureField, StructureType, TableType, Try, TypeDef, TypeRef, Visibility, Writer, append, assign, attributeDef, binOp, builtinType, call, cast, classDef, clear, comment, constantDecl, constructorExpr, continueStmt, dataDecl, enumType, eventDef, exit, fieldSymbolDecl, identifierExpr, ifStmt, insert, interfaceDef, literal, localClassDef, loop, methodCallExpr, methodDef, methodImpl, methodParam, namedTypeRef, print, printExpression, printInlineType, raise, raw, read, requireField, returnStmt, section, stringTemplate, structureType, tableType, tryStmt, typeDef };
|
|
606
601
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/nodes/errors.ts","../src/nodes/base.ts","../src/nodes/types.ts","../src/nodes/expressions.ts","../src/nodes/data.ts","../src/nodes/statements.ts","../src/nodes/members.ts","../src/nodes/class.ts","../src/nodes/interface.ts","../src/printer/options.ts","../src/printer/writer.ts","../src/printer/print-types.ts","../src/printer/print-expressions.ts","../src/printer/index.ts"],"mappings":"A,cAAa,qBAAqB;EACpB,YAAA;;iBAME,aAAa,GAC3B,OAAO,sBACP,eACA,mBACC;;KCRS
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/nodes/errors.ts","../src/nodes/base.ts","../src/nodes/types.ts","../src/nodes/expressions.ts","../src/nodes/data.ts","../src/nodes/statements.ts","../src/nodes/members.ts","../src/nodes/class.ts","../src/nodes/interface.ts","../src/printer/options.ts","../src/printer/writer.ts","../src/printer/print-types.ts","../src/printer/print-expressions.ts","../src/printer/index.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