{"_id":"@abapify/abap-ast","_rev":"6-ba1ff08911f5b21fce801e079091e4b7","name":"@abapify/abap-ast","dist-tags":{"latest":"0.4.1"},"versions":{"0.0.0":{"name":"@abapify/abap-ast","version":"0.0.0","_id":"@abapify/abap-ast@0.0.0","maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"dist":{"shasum":"eda1546f636d73c17f11cfac1202ec0dca1ea787","tarball":"https://registry.npmjs.org/@abapify/abap-ast/-/abap-ast-0.0.0.tgz","fileCount":2,"integrity":"sha512-1RZ4XhDp+iQ+na66ebn6G+rheYxgF9W9lPAezaVwoWV1v+5hqoUcY/7RNAII5XUX06GoeHzxJBj/2yOYGvWXvg==","signatures":[{"sig":"MEUCIQDanJgj3uKs870OJXaM286+4dk58jIpNFH1UFQfqUQBOgIgR1DpdmOyGA/utgd9CTCZVeLTO6ZQEZH3fJtJiGSnGd4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":224},"_npmUser":{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"},"_npmVersion":"11.12.1","description":"Placeholder — real package is published via CI/CD (trusted publishing).","directories":{},"_nodeVersion":"24.10.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/abap-ast_0.0.0_1776719529646_0.8538595445269477","host":"s3://npm-registry-packages-npm-production"}},"0.3.4":{"name":"@abapify/abap-ast","version":"0.3.4","keywords":["abap","ast","codegen","sap"],"author":{"name":"abapify"},"license":"MIT","_id":"@abapify/abap-ast@0.3.4","maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"homepage":"https://github.com/abapify/adt-cli/tree/main/packages/abap-ast#readme","bugs":{"url":"https://github.com/abapify/adt-cli/issues"},"dist":{"shasum":"d7b65c6de84fee398a7fd9b713b4b81bf9501276","tarball":"https://registry.npmjs.org/@abapify/abap-ast/-/abap-ast-0.3.4.tgz","fileCount":2,"integrity":"sha512-YQMgL3ZBtxpXSGUQNstxggtGdJL8OYNnGBZCgAt7lI/CTKjzYECJnWLljNly3KmeRmWKG5BAQbHeoE29ee7EvA==","signatures":[{"sig":"MEUCIFwtcyrg7tKOZWzxRQ+BpNK/4QK3UuFBwxiKXvMwNDrVAiEAvMX2OzA3o9hA0/BcRTLcBmb7+Tx7aRbDFzz9WDW/rmQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@abapify%2fabap-ast@0.3.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8624},"type":"module","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"gitHead":"6a630228129c616054aad8dfafe17c42f389986e","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1b8f9142-548b-4efc-a5ef-f5cddf901a46"}},"repository":{"url":"git+https://github.com/abapify/adt-cli.git","type":"git","directory":"packages/abap-ast"},"_npmVersion":"11.12.1","description":"Zero-dependency typed AST and pretty-printer for ABAP source code (classes, interfaces, types, statements)","directories":{},"_nodeVersion":"24.14.1","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/abap-ast_0.3.4_1776722406909_0.36418957827840215","host":"s3://npm-registry-packages-npm-production"}},"0.3.5":{"name":"@abapify/abap-ast","version":"0.3.5","keywords":["abap","ast","codegen","sap"],"author":{"name":"abapify"},"license":"MIT","_id":"@abapify/abap-ast@0.3.5","maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"homepage":"https://github.com/abapify/adt-cli/tree/main/packages/abap-ast#readme","bugs":{"url":"https://github.com/abapify/adt-cli/issues"},"dist":{"shasum":"bc227ab238dd98571a318c978069ed77531e1bd5","tarball":"https://registry.npmjs.org/@abapify/abap-ast/-/abap-ast-0.3.5.tgz","fileCount":2,"integrity":"sha512-Vj+FTw7EVX4EntLa31N/F3LZh25Pzu4c17g5ps/Oau725ecr3nBD7ykqeL3glfpvlPNzSt2CILzbihNVbOAgjg==","signatures":[{"sig":"MEYCIQCIOCjRWO5+H0sMLShksxiljhc5vCWxLmdc065ElIsC8gIhAKOnAdRGaPpnFQ1a2pSNTxyrhaLd1IQYSGADY5nmCzIE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@abapify%2fabap-ast@0.3.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8624},"type":"module","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"gitHead":"185666fe6ccb304e7b08529eb376ec2493131a7a","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1b8f9142-548b-4efc-a5ef-f5cddf901a46"}},"repository":{"url":"git+https://github.com/abapify/adt-cli.git","type":"git","directory":"packages/abap-ast"},"_npmVersion":"11.12.1","description":"Zero-dependency typed AST and pretty-printer for ABAP source code (classes, interfaces, types, statements)","directories":{},"_nodeVersion":"24.14.1","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/abap-ast_0.3.5_1776723649916_0.04919025663563725","host":"s3://npm-registry-packages-npm-production"}},"0.3.6":{"name":"@abapify/abap-ast","version":"0.3.6","keywords":["abap","ast","codegen","sap"],"author":{"name":"abapify"},"license":"MIT","_id":"@abapify/abap-ast@0.3.6","maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"homepage":"https://github.com/abapify/adt-cli/tree/main/packages/abap-ast#readme","bugs":{"url":"https://github.com/abapify/adt-cli/issues"},"dist":{"shasum":"2a89783546e5cea65b49217ede93d4645f626220","tarball":"https://registry.npmjs.org/@abapify/abap-ast/-/abap-ast-0.3.6.tgz","fileCount":2,"integrity":"sha512-L5PNIvyskdiYz8MQPm1U+f+QDp+e9QmP31YnFsDaySfAesq6wg42PoGV0wviJ4fXZfAsEn7KQ4fRVgIzYSRVOQ==","signatures":[{"sig":"MEUCIDjV9AIaNM+yN63ZeLKH6AxoCB3U58DRMeeyICXIazj6AiEA5u/0OslykzKXq9sYRkrA1fll0AsQcuUAx3qBFDNZe1M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@abapify%2fabap-ast@0.3.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8624},"type":"module","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"gitHead":"489b2b4ad7c2ea972f323d4c356997ac5962ba9e","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1b8f9142-548b-4efc-a5ef-f5cddf901a46"}},"repository":{"url":"git+https://github.com/abapify/adt-cli.git","type":"git","directory":"packages/abap-ast"},"_npmVersion":"11.11.0","description":"Zero-dependency typed AST and pretty-printer for ABAP source code (classes, interfaces, types, statements)","directories":{},"_nodeVersion":"24.14.1","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/abap-ast_0.3.6_1776744797185_0.49610381877656495","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@abapify/abap-ast","version":"0.4.0","keywords":["abap","ast","codegen","sap"],"author":{"name":"abapify"},"license":"MIT","_id":"@abapify/abap-ast@0.4.0","maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"homepage":"https://github.com/abapify/adt-cli/tree/main/packages/abap-ast#readme","bugs":{"url":"https://github.com/abapify/adt-cli/issues"},"dist":{"shasum":"d766e90d0a29f0179fadf50650569f17985aba1e","tarball":"https://registry.npmjs.org/@abapify/abap-ast/-/abap-ast-0.4.0.tgz","fileCount":2,"integrity":"sha512-RV6w0qu8BwYkGEwsCqHqaQ3S8/5hAoiEyJs6ElZ7rXUrAjjTa40Cc+QkGfkaPvF03ciCYVzTnFD43+4yExp/zw==","signatures":[{"sig":"MEYCIQDQswWBo1xFSi0vbUrAPwdl7/dylg6C/rONjTF66ZxGXwIhALqhoYck2RInz2sm9hOkU5PDblY07ugc/lOzuVhYsJic","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@abapify%2fabap-ast@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8624},"type":"module","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"gitHead":"81dc9eea47fe419e41d246f0ec212fa78570a489","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1b8f9142-548b-4efc-a5ef-f5cddf901a46"}},"repository":{"url":"git+https://github.com/abapify/adt-cli.git","type":"git","directory":"packages/abap-ast"},"_npmVersion":"11.13.0","description":"Zero-dependency typed AST and pretty-printer for ABAP source code (classes, interfaces, types, statements)","directories":{},"_nodeVersion":"24.16.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/abap-ast_0.4.0_1780072637131_0.18786602921018947","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@abapify/abap-ast","publishConfig":{"access":"public"},"version":"0.4.1","description":"Zero-dependency typed AST and pretty-printer for ABAP source code (classes, interfaces, types, statements)","type":"module","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"dependencies":{},"keywords":["abap","ast","codegen","sap"],"author":{"name":"abapify"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/abapify/adt-cli.git","directory":"packages/abap-ast"},"homepage":"https://github.com/abapify/adt-cli/tree/main/packages/abap-ast#readme","bugs":{"url":"https://github.com/abapify/adt-cli/issues"},"gitHead":"9d3b996a5c760a8db67e28c4df3c30098bd29e4a","_id":"@abapify/abap-ast@0.4.1","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-Ruq0P5UTURACoU9uUIi0O2R2oztdNpc4mZ0nGyOJW3zsMJ59ffSenTYLROhAsdOB7Oc/kevkyyelfi2NlvVfpg==","shasum":"e2c65bba46cc2556ecfba0e7c741764c2cac72e5","tarball":"https://registry.npmjs.org/@abapify/abap-ast/-/abap-ast-0.4.1.tgz","fileCount":6,"unpackedSize":184098,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@abapify%2fabap-ast@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD2/bkYzXPIWB7URwR5D11W4aCzuzrG+dEsFwyc6jSkLgIhAIX7BN+PstOKw1SuSz+fOYKjsXBv/9V4R74rwQYcmfng"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1b8f9142-548b-4efc-a5ef-f5cddf901a46"}},"directories":{},"maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/abap-ast_0.4.1_1780074934415_0.368614233677943"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-20T21:12:09.491Z","modified":"2026-05-29T17:15:34.860Z","0.0.0":"2026-04-20T21:12:09.790Z","0.3.4":"2026-04-20T22:00:07.030Z","0.3.5":"2026-04-20T22:20:50.044Z","0.3.6":"2026-04-21T04:13:17.321Z","0.4.0":"2026-05-29T16:37:17.324Z","0.4.1":"2026-05-29T17:15:34.590Z"},"bugs":{"url":"https://github.com/abapify/adt-cli/issues"},"author":{"name":"abapify"},"license":"MIT","homepage":"https://github.com/abapify/adt-cli/tree/main/packages/abap-ast#readme","keywords":["abap","ast","codegen","sap"],"repository":{"type":"git","url":"git+https://github.com/abapify/adt-cli.git","directory":"packages/abap-ast"},"description":"Zero-dependency typed AST and pretty-printer for ABAP source code (classes, interfaces, types, statements)","maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"readme":"# @abapify/abap-ast\n\n**Zero-dependency typed AST and deterministic pretty-printer for ABAP source code.**\n\n## Overview\n\n`@abapify/abap-ast` is the `ts.factory` of ABAP. It provides a typed node\nmodel for ABAP classes, interfaces, types, statements, and expressions, plus\na single `print()` entry point that serialises any node to valid ABAP source.\n\nThere is **no parser (yet)** — this package is emit-only. A future `.aclass`\nparser (e.g. Chevrotain-based) will produce the same AST, so code built on\ntop of this package stays forward-compatible.\n\nPrimary consumer: [`@abapify/openai-codegen`](../openai-codegen).\n\n### What it gives you\n\n- Typed factory functions for every node kind (classes, interfaces,\n  methods, types, statements, expressions).\n- A deterministic printer: identical input produces byte-identical output,\n  across runs, platforms, and Node versions.\n- Configurable keyword case, indent, and line ending.\n- No runtime dependencies.\n\n## Installation\n\n```bash\nbun add @abapify/abap-ast\n```\n\n## Quick Start\n\n```typescript\nimport {\n  print,\n  classDef,\n  section,\n  typeDef,\n  methodDef,\n  methodImpl,\n  methodParam,\n  builtinType,\n  returnStmt,\n} from '@abapify/abap-ast';\n\nconst cls = classDef({\n  name: 'zcl_greeter',\n  isFinal: true,\n  sections: [\n    section({\n      visibility: 'public',\n      members: [\n        typeDef({ name: 'ty_name', type: builtinType({ name: 'string' }) }),\n        methodDef({\n          name: 'greet',\n          visibility: 'public',\n          params: [\n            methodParam({\n              paramKind: 'importing',\n              name: 'iv_name',\n              typeRef: builtinType({ name: 'string' }),\n            }),\n            methodParam({\n              paramKind: 'returning',\n              name: 'rv_msg',\n              typeRef: builtinType({ name: 'string' }),\n            }),\n          ],\n        }),\n      ],\n    }),\n  ],\n  implementations: [methodImpl({ name: 'greet', body: [returnStmt()] })],\n});\n\nconsole.log(print(cls));\n```\n\nemits:\n\n```abap\nCLASS zcl_greeter DEFINITION PUBLIC FINAL CREATE PUBLIC.\n  PUBLIC SECTION.\n    TYPES ty_name TYPE string.\n    METHODS greet\n      IMPORTING iv_name TYPE string\n      RETURNING VALUE(rv_msg) TYPE string.\nENDCLASS.\n\nCLASS zcl_greeter IMPLEMENTATION.\n  METHOD greet.\n    RETURN.\n  ENDMETHOD.\nENDCLASS.\n```\n\n## Node kinds\n\nEvery node has a `kind: NodeKind` PascalCase discriminant. Nodes are grouped\nby topic under `src/nodes/`; each module exports interfaces plus matching\nfactory functions. You rarely need the raw interfaces — the factories are\nthe public surface.\n\n| Module           | Factories                                                                                                                                |\n| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| `base.ts`        | `comment` (plus shared types: `NodeKind`, `Visibility`, `Identifier`)                                                                    |\n| `types.ts`       | `builtinType`, `namedTypeRef`, `tableType`, `structureType`, `enumType`, `typeDef`                                                       |\n| `data.ts`        | `dataDecl`, `constantDecl`, `fieldSymbolDecl`                                                                                            |\n| `expressions.ts` | `literal`, `identifierExpr`, `constructorExpr`, `methodCallExpr`, `binOp`, `stringTemplate`, `cast`                                      |\n| `statements.ts`  | `assign`, `call`, `raise`, `ifStmt`, `loop`, `returnStmt`, `tryStmt`, `append`, `insert`, `read`, `clear`, `exit`, `continueStmt`, `raw` |\n| `members.ts`     | `methodParam`, `methodDef`, `methodImpl`, `eventDef`, `attributeDef`                                                                     |\n| `class.ts`       | `section`, `classDef`, `localClassDef`                                                                                                   |\n| `interface.ts`   | `interfaceDef`                                                                                                                           |\n\nSee [`src/nodes/`](src/nodes) for the full signatures — each factory is a\none-argument function taking a named-input object and returning a frozen\nAST node.\n\n`raw({ source })` is an escape hatch for ABAP fragments that are not yet\nrepresentable in the AST. Consumers should prefer structured nodes and\nconfine `raw` to known-safe cases.\n\n## ABAPDoc comments\n\nDeclaration nodes (`TypeDef`, `MethodDef`, `AttributeDef`, `InterfaceDef`,\n`ClassDef`) accept an optional `abapDoc: readonly string[]` field. The\nprinter emits each line verbatim prefixed with `\"!` at the declaration's\nown indentation, immediately above it. This is the standard ABAP way to\nattach structured metadata to a declaration (ABAPDoc / Knowledge Transfer\ncomments).\n\n```typescript\nimport { print, methodDef, methodParam, builtinType } from '@abapify/abap-ast';\n\nconst m = methodDef({\n  name: 'get_foo',\n  visibility: 'public',\n  abapDoc: [\n    '@openapi-operation getFoo',\n    '@openapi-path GET /foo/{id}',\n    'Return a foo by id.',\n  ],\n  params: [\n    methodParam({\n      paramKind: 'importing',\n      name: 'id',\n      typeRef: builtinType({ name: 'string' }),\n    }),\n  ],\n});\n\nconsole.log(print(m));\n```\n\nemits:\n\n```abap\n\"! @openapi-operation getFoo\n\"! @openapi-path GET /foo/{id}\n\"! Return a foo by id.\nMETHODS get_foo\n  IMPORTING id TYPE string.\n```\n\nLines are written verbatim: no automatic wrapping, no escaping, no tag\nrewriting. Consumers own their tag conventions.\n\n## Printer\n\n```typescript\nimport { print, type PrintOptions } from '@abapify/abap-ast';\n\nconst source: string = print(node, options?);\n```\n\n| Option        | Type                 | Default   | Notes                                       |\n| ------------- | -------------------- | --------- | ------------------------------------------- |\n| `indent`      | `number`             | `2`       | Spaces per indentation level.               |\n| `keywordCase` | `'upper' \\| 'lower'` | `'upper'` | Case of ABAP keywords (`CLASS`, `METHODS`). |\n| `eol`         | `string`             | `'\\n'`    | Line ending (`'\\r\\n'` for CRLF output).     |\n\n**Determinism guarantee.** For a given input tree and resolved options,\n`print()` always returns the same string. The printer does no implicit\nsorting, random id generation, or environment lookup. Snapshot-testing the\noutput is safe and is how this package is validated (see\n`tests/printer.test.ts`).\n\nThe printer accepts most nodes at the top level, but a few internal nodes\n(`Section`, `MethodParam`, and bare `TableType`/`StructureType` etc.) throw\nif passed directly — wrap them in their enclosing node (`ClassDef`,\n`MethodDef`, `TypeDef`) first.\n\n## Design\n\nThis package deliberately mirrors the `ts.factory` pattern from the\nTypeScript compiler API:\n\n- The AST is the single source of truth for ABAP structure.\n- Factories validate required fields at construction time and freeze the\n  returned node.\n- The printer is a pure function of the tree.\n- No string concatenation leaks into consumer code — they always go through\n  a typed factory.\n\nA future `.aclass` Chevrotain parser will populate the same AST, at which\npoint `print(parse(src)) ≈ src` becomes the round-trip contract.\n\n## Consumers\n\n- [`@abapify/openai-codegen`](../openai-codegen) — OpenAPI → ABAP client\n  generator. Builds two `InterfaceDef`s, one `ClassDef` for the\n  implementation, and one `ClassDef` for the exception. Uses the\n  `abapDoc` field to attach round-trip `@openapi-*` markers on every\n  generated type and operation, and relies on the printer's determinism\n  guarantee for reproducible artefacts.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}