diff --git a/.abapgit.xml b/.abapgit.xml index 48a569a..26fde2e 100644 --- a/.abapgit.xml +++ b/.abapgit.xml @@ -2,21 +2,19 @@ + Text2tab E /src/ PREFIX /.gitignore /LICENSE - /.travis.yml - /-.travis.yml /changelog.txt - /abaplint.json + /abaplint.jsonc /README.md /CONTRIBUTING.md - /ci/ - /deploy-key.enc + ZIF_TEXT2TAB=>VERSION diff --git a/README.md b/README.md index b703aba..1c4e302 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ABAP text2tab parser and serializer (ex. Abap data parser) ![abaplint](https://github.com/sbcgua/text2tab/workflows/abaplint/badge.svg) -![Version](https://img.shields.io/github/v/tag/sbcgua/abap_data_parser.svg) +![Version](https://img.shields.io/github/v/tag/sbcgua/text2tab.svg) TAB-delimited text parser and serializer for ABAP *[changelog](./changelog.txt)* @@ -30,10 +30,12 @@ The package also contains 2 **examples**: ## Installation -You can install the whole code using [abapGit](https://github.com/larshp/abapGit) tool (recommended way). Alternatively, you can also copy content of `*.clas.abap` to your program (please keep the homepage reference and license text). +You can install the whole code using [abapGit](https://github.com/abapGit/abapGit) tool. The tool is open source and distributed under MIT license. It was initially created as a part of another project - [mockup loader](https://github.com/sbcgua/mockup_loader) - but then separated as an independent multi-usage tool. +The package contains 2 subpackages: `core` (the tool itself) and `examples` (example programs). The latter can be skipped for the deserialization (abapGit supports filename filtering - specify `*/examples/*` in the corresponding repo setting). + ## Example of usage Source text file (CRLF as a line delimiter, TAB as a field delimiter) @@ -391,7 +393,7 @@ This is supported in parser only at the moment. Serializer does not produce many ## Checking version -`zif_text2tab_constants` has the `version` attribute. And there is a helper method `check_version_fits` to check if the text2tab package has the minimal required version. +`zif_text2tab` has the `version` attribute. And there is a helper method `check_version_fits` to check if the text2tab package has the minimal required version. To extract the current version prefer `zcl_text2tab_parser=>version( )` method. ```abap * Assuming version is 2.1.0 diff --git a/changelog.txt b/changelog.txt index 97980f6..6fefa65 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,7 +8,12 @@ Legend + : added - : removed -v2.3.5, 2023-07-?? +v2.4.0, 2025-01-22 +------------------ +! BREAKING: version constant was moved zif_text2tab. zif_text2tab_constants is deleted. +! Restructured packages: core objects were separated from examples, to improve deployment (abapGit supports skipping packages, so examples package can be left out of the real system) + +v2.3.5, 2023-07-11 ------------------ * code and type cleanups + possibility to keep fields_only order during serialization #25 diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 0eb1032..0000000 --- a/package-lock.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "text2tab", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@abaplint/cli": { - "version": "2.79.29", - "resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.79.29.tgz", - "integrity": "sha512-irRY2YXeEp4OMfqDaErckNTjls+i0f6xEqnLQMsSc2Dx8Yshdfk60RbxATjg6dfJYa0p3tT3zjGoFxmmlkotXQ==" - }, - "@abaplint/runtime": { - "version": "1.6.47", - "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-1.6.47.tgz", - "integrity": "sha512-0kYnwMi2nbGBdIROfwdfR6Y0BtTmXTCJgO4nrCADvno9XkfY+SXshncOZqm3NDDE9pC0kJ3hXABoXWsv4jIvLA==", - "requires": { - "hdb": "^0.18.3", - "sql.js": "^1.6.2" - } - }, - "@abaplint/transpiler-cli": { - "version": "1.6.47", - "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-1.6.47.tgz", - "integrity": "sha512-FSghTSkdJPzee5hJm3o2/xsjshJLswyJiPNEDG0wLW3oLOwzOmcvyW8bL0z49BjLrnom5xIqRRqUrZBxRRSuwQ==" - }, - "hdb": { - "version": "0.18.3", - "resolved": "https://registry.npmjs.org/hdb/-/hdb-0.18.3.tgz", - "integrity": "sha512-VH65JBxILtRDFpWsl74sl12rzVVDgEgjmey8b+CyhzZgm2XwuLh20p99uce32s8om7rFFdOC6b/hwt8VHmU8iQ==", - "requires": { - "iconv-lite": "^0.4.18" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "sql.js": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/sql.js/-/sql.js-1.6.2.tgz", - "integrity": "sha512-9iucI5fXQa+Gspeqf/BNB20PxJIn5LhXDt4mjXoFPqXdR+NqtFs15SdKpSIJ6s529aGL9zFR9p2eSCIEiMsNGA==" - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 56acdc3..0000000 --- a/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "text2tab", - "version": "1.0.0", - "private": true, - "description": "abap tab-delimited tax parser/serializer", - "main": "js-transpiled/index.mjs", - "scripts": { - "test": "node js-transpiled/index.mjs", - "transpile": "abap_transpile abap_transpile.json" - }, - "repository": { - "type": "git", - "url": "git+https://sbcgua@github.com/sbcgua/text2tab.git" - }, - "author": "Alexander Tsybulsky", - "license": "MIT", - "bugs": { - "url": "https://github.com/sbcgua/text2tab/issues" - }, - "homepage": "https://github.com/sbcgua/text2tab#readme", - "dependencies": { - "@abaplint/cli": "^2.79.29", - "@abaplint/runtime": "^1.6.47", - "@abaplint/transpiler-cli": "^1.6.47" - } -} diff --git a/src/core/package.devc.xml b/src/core/package.devc.xml new file mode 100644 index 0000000..92a20dc --- /dev/null +++ b/src/core/package.devc.xml @@ -0,0 +1,10 @@ + + + + + + TEXT2TAB serializer/deserializer: core objects + + + + diff --git a/src/zcl_text2tab_parser.clas.abap b/src/core/zcl_text2tab_parser.clas.abap similarity index 99% rename from src/zcl_text2tab_parser.clas.abap rename to src/core/zcl_text2tab_parser.clas.abap index 4e9b05b..a35cd16 100644 --- a/src/zcl_text2tab_parser.clas.abap +++ b/src/core/zcl_text2tab_parser.clas.abap @@ -17,6 +17,9 @@ class zcl_text2tab_parser definition constants c_crlf like cl_abap_char_utilities=>cr_lf value cl_abap_char_utilities=>cr_lf. "#EC NOTEXT constants c_lf like cl_abap_char_utilities=>newline value cl_abap_char_utilities=>newline. "#EC NOTEXT + class-methods version + returning + value(r_version) type string . class-methods check_version_fits importing !i_required_version type string @@ -220,7 +223,7 @@ CLASS ZCL_TEXT2TAB_PARSER IMPLEMENTATION. method check_version_fits. r_fits = zcl_text2tab_utils=>check_version_fits( - i_current_version = zif_text2tab_constants=>version + i_current_version = zif_text2tab=>version i_required_version = i_required_version ). endmethod. @@ -983,4 +986,9 @@ CLASS ZCL_TEXT2TAB_PARSER IMPLEMENTATION. location = l_location. endmethod. + + + method version. + r_version = zif_text2tab=>version. + endmethod. ENDCLASS. diff --git a/src/zcl_text2tab_parser.clas.testclasses.abap b/src/core/zcl_text2tab_parser.clas.testclasses.abap similarity index 100% rename from src/zcl_text2tab_parser.clas.testclasses.abap rename to src/core/zcl_text2tab_parser.clas.testclasses.abap diff --git a/src/zcl_text2tab_parser.clas.xml b/src/core/zcl_text2tab_parser.clas.xml similarity index 100% rename from src/zcl_text2tab_parser.clas.xml rename to src/core/zcl_text2tab_parser.clas.xml diff --git a/src/zcl_text2tab_serializer.clas.abap b/src/core/zcl_text2tab_serializer.clas.abap similarity index 100% rename from src/zcl_text2tab_serializer.clas.abap rename to src/core/zcl_text2tab_serializer.clas.abap diff --git a/src/zcl_text2tab_serializer.clas.testclasses.abap b/src/core/zcl_text2tab_serializer.clas.testclasses.abap similarity index 100% rename from src/zcl_text2tab_serializer.clas.testclasses.abap rename to src/core/zcl_text2tab_serializer.clas.testclasses.abap diff --git a/src/zcl_text2tab_serializer.clas.xml b/src/core/zcl_text2tab_serializer.clas.xml similarity index 100% rename from src/zcl_text2tab_serializer.clas.xml rename to src/core/zcl_text2tab_serializer.clas.xml diff --git a/src/zcl_text2tab_utils.clas.abap b/src/core/zcl_text2tab_utils.clas.abap similarity index 100% rename from src/zcl_text2tab_utils.clas.abap rename to src/core/zcl_text2tab_utils.clas.abap diff --git a/src/zcl_text2tab_utils.clas.testclasses.abap b/src/core/zcl_text2tab_utils.clas.testclasses.abap similarity index 100% rename from src/zcl_text2tab_utils.clas.testclasses.abap rename to src/core/zcl_text2tab_utils.clas.testclasses.abap diff --git a/src/zcl_text2tab_utils.clas.xml b/src/core/zcl_text2tab_utils.clas.xml similarity index 100% rename from src/zcl_text2tab_utils.clas.xml rename to src/core/zcl_text2tab_utils.clas.xml diff --git a/src/zcx_text2tab_error.clas.abap b/src/core/zcx_text2tab_error.clas.abap similarity index 100% rename from src/zcx_text2tab_error.clas.abap rename to src/core/zcx_text2tab_error.clas.abap diff --git a/src/zcx_text2tab_error.clas.testclasses.abap b/src/core/zcx_text2tab_error.clas.testclasses.abap similarity index 100% rename from src/zcx_text2tab_error.clas.testclasses.abap rename to src/core/zcx_text2tab_error.clas.testclasses.abap diff --git a/src/zcx_text2tab_error.clas.xml b/src/core/zcx_text2tab_error.clas.xml similarity index 100% rename from src/zcx_text2tab_error.clas.xml rename to src/core/zcx_text2tab_error.clas.xml diff --git a/src/core/zif_text2tab.intf.abap b/src/core/zif_text2tab.intf.abap new file mode 100644 index 0000000..44ad8e8 --- /dev/null +++ b/src/core/zif_text2tab.intf.abap @@ -0,0 +1,12 @@ +interface zif_text2tab + public. + + types ty_begin_comment type c length 1. + + constants c_auto_detect_by_space type ty_begin_comment value cl_abap_char_utilities=>maxchar. + + constants version type string value 'v2.4.0'. "#EC NOTEXT + constants origin type string value 'https://github.com/sbcgua/text2tab'. "#EC NOTEXT + constants license type string value 'MIT'. "#EC NOTEXT + +endinterface. diff --git a/src/zif_text2tab.intf.xml b/src/core/zif_text2tab.intf.xml similarity index 100% rename from src/zif_text2tab.intf.xml rename to src/core/zif_text2tab.intf.xml diff --git a/src/zif_text2tab_deep_provider.intf.abap b/src/core/zif_text2tab_deep_provider.intf.abap similarity index 100% rename from src/zif_text2tab_deep_provider.intf.abap rename to src/core/zif_text2tab_deep_provider.intf.abap diff --git a/src/zif_text2tab_deep_provider.intf.xml b/src/core/zif_text2tab_deep_provider.intf.xml similarity index 100% rename from src/zif_text2tab_deep_provider.intf.xml rename to src/core/zif_text2tab_deep_provider.intf.xml diff --git a/src/examples/package.devc.xml b/src/examples/package.devc.xml new file mode 100644 index 0000000..1c8da4a --- /dev/null +++ b/src/examples/package.devc.xml @@ -0,0 +1,10 @@ + + + + + + TEXT2TAB serializer/deserializer: Examples + + + + diff --git a/src/ztext2tab_backup_example.prog.abap b/src/examples/ztext2tab_backup_example.prog.abap similarity index 99% rename from src/ztext2tab_backup_example.prog.abap rename to src/examples/ztext2tab_backup_example.prog.abap index d97c934..4f82be3 100644 --- a/src/ztext2tab_backup_example.prog.abap +++ b/src/examples/ztext2tab_backup_example.prog.abap @@ -460,7 +460,7 @@ form main if zcl_text2tab_parser=>check_version_fits( lv_required_text2tab_ver ) = abap_false. write: / 'Error: text2tab version is lower than required' color 6. "#EC NOTEXT write: / 'Required is:', lv_required_text2tab_ver. "#EC NOTEXT - write: / 'Installed is:', zif_text2tab_constants=>version. "#EC NOTEXT + write: / 'Installed is:', zif_text2tab=>version. "#EC NOTEXT write: / 'Please upgrade text2tab'. "#EC NOTEXT return. endif. diff --git a/src/ztext2tab_backup_example.prog.xml b/src/examples/ztext2tab_backup_example.prog.xml similarity index 100% rename from src/ztext2tab_backup_example.prog.xml rename to src/examples/ztext2tab_backup_example.prog.xml diff --git a/src/ztext2tab_benchmarks.prog.abap b/src/examples/ztext2tab_benchmarks.prog.abap similarity index 100% rename from src/ztext2tab_benchmarks.prog.abap rename to src/examples/ztext2tab_benchmarks.prog.abap diff --git a/src/ztext2tab_benchmarks.prog.xml b/src/examples/ztext2tab_benchmarks.prog.xml similarity index 100% rename from src/ztext2tab_benchmarks.prog.xml rename to src/examples/ztext2tab_benchmarks.prog.xml diff --git a/src/ztext2tab_example.prog.abap b/src/examples/ztext2tab_example.prog.abap similarity index 100% rename from src/ztext2tab_example.prog.abap rename to src/examples/ztext2tab_example.prog.abap diff --git a/src/ztext2tab_example.prog.xml b/src/examples/ztext2tab_example.prog.xml similarity index 100% rename from src/ztext2tab_example.prog.xml rename to src/examples/ztext2tab_example.prog.xml diff --git a/src/zif_text2tab.intf.abap b/src/zif_text2tab.intf.abap deleted file mode 100644 index 9142b10..0000000 --- a/src/zif_text2tab.intf.abap +++ /dev/null @@ -1,8 +0,0 @@ -interface zif_text2tab - public . - - types ty_begin_comment type c length 1. - - constants c_auto_detect_by_space type ty_begin_comment value cl_abap_char_utilities=>backspace. - -endinterface. diff --git a/src/zif_text2tab_constants.intf.abap b/src/zif_text2tab_constants.intf.abap deleted file mode 100644 index c65a795..0000000 --- a/src/zif_text2tab_constants.intf.abap +++ /dev/null @@ -1,6 +0,0 @@ -interface ZIF_TEXT2TAB_CONSTANTS - public . - constants version type string value 'v2.3.4'. "#EC NOTEXT - constants origin type string value 'https://github.com/sbcgua/text2tab'. "#EC NOTEXT - constants license type string value 'MIT'. "#EC NOTEXT -endinterface. diff --git a/src/zif_text2tab_constants.intf.xml b/src/zif_text2tab_constants.intf.xml deleted file mode 100644 index 9b1ee8c..0000000 --- a/src/zif_text2tab_constants.intf.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - ZIF_TEXT2TAB_CONSTANTS - E - Text2tab common package constants - 2 - 1 - X - - - -