Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpiler WIP #23

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Transpiler WIP #23

wants to merge 17 commits into from

Conversation

sbcgua
Copy link
Owner

@sbcgua sbcgua commented Oct 14, 2021

No description provided.

@larshp
Copy link
Contributor

larshp commented Oct 14, 2021

@abaplint/transpiler-cli instead of @abaplint/transpiler

@larshp
Copy link
Contributor

larshp commented Oct 14, 2021

raise conv_failed.

raising non class based exceptions is not implemented, and I dont think it will be anytime soon

suggest refactoring to a class based exception

@sbcgua
Copy link
Owner Author

sbcgua commented Oct 14, 2021

conv_failed

Hmm, yeah, I don't remember why I did like that in the first place

@sbcgua
Copy link
Owner Author

sbcgua commented Oct 14, 2021

Nice, it compiles !

@sbcgua
Copy link
Owner Author

sbcgua commented Oct 14, 2021

image

Looks like an operator is missing ?

    ro_parser.get().mt_components.set(await abap.Classes['ZCL_TEXT2TAB_UTILS'].describe_struct({i_struc: ro_parser.get().mo_struc_descr, i_is_deep: abap.builtin.boolc(abap.compare.initial(i_deep_provider) === false), i_ignore_nonflat: i_ignore_nonflat}));
    if ((abap.compare.initial(i_amount_format)abap.compare.initial(i_amount_format.getOffset({offset: 1, length: 1})))) {
      ro_parser.get().mv_amount_format.set(i_amount_format);
    }

@larshp
Copy link
Contributor

larshp commented Oct 14, 2021

yea, looks like a simple upper/lower case problem

image

@@ -0,0 +1,25 @@
{
"name": "text2tab",
"version": "1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a trick: you can set private: true so that it cannot accidently be published to npm

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@larshp
Copy link
Contributor

larshp commented Oct 15, 2021

next problem: Void type: RS38L_FNAM

Perhaps type as TFDIR-FUNCNAME instead, TFDIR will probably be added to open-abap sometime. RS38L_FNAM is a strange data element name

@sbcgua
Copy link
Owner Author

sbcgua commented Oct 15, 2021

Actually funcname DE is a good replacement. Part of SABP pacakge
image

TFDIR refers RS38L_FNAM too in fact ...

@sbcgua sbcgua force-pushed the transpiler branch 2 times, most recently from f71c8b9 to 9790a37 Compare July 29, 2023 09:48
@sbcgua
Copy link
Owner Author

sbcgua commented Jul 29, 2023

@larshp Trying to do this again ... May I ask for some assistance ? The message says something wrong with /ui2/cl_json.clas which is not used anyhow ... :/

package.json Outdated
Comment on lines 22 to 24
"@abaplint/cli": "^2.79.29",
"@abaplint/runtime": "^1.6.47",
"@abaplint/runtime": "^1.8.40",
"@abaplint/transpiler-cli": "^1.6.47"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try updating these to latest

@larshp
Copy link
Contributor

larshp commented Jul 29, 2023

anyhow, next problem to tackle is VERI_ALPHA, not really sure what to use instead

ideally something that is marked as released, https://abapedia.org/steampunk-2305-api/

@sbcgua
Copy link
Owner Author

sbcgua commented Jul 29, 2023

update didn't help: same error:

$node transpiled/index.mjs
file:///.../text2tab/transpiled/%23ui2%23cl_json.clas.locals.mjs:281
lcl_parser.ty_data_tt = abap.types.TableFactory.construct(new abap.types.Structure({"parent": new abap.types.String({qualifiedName: "LCL_PARSER=>TY_DATA-PARENT"}), "name": new abap.types.String({qualifiedName: "LCL_PARSER=>TY_DATA-NAME"}), "full_name": new abap.types.String({qualifiedName: "LCL_PARSER=>TY_DATA-FULL_NAME"}), "value": new abap.types.String({qualifiedName: "LCL_PARSER=>TY_DATA-VALUE"}), "type": new abap.types.String({qualifiedName: "LCL_PARSER=>TY_DATA-TYPE"})}, "lcl_parser=>ty_data"), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "lcl_parser=>ty_data_tt");
                                                ^

TypeError: Cannot read properties of undefined (reading 'construct')
    at file:///.../text2tab/transpiled/%23ui2%23cl_json.clas.locals.mjs:281:49

... And how do you see from it, that it is about VERI_ALPHA ?

@sbcgua
Copy link
Owner Author

sbcgua commented Jul 29, 2023

image

:/ I guess the only way is to create own DOMA ...

@larshp
Copy link
Contributor

larshp commented Jul 29, 2023

ALPHA: the xml generation might be bugged and remove the conversion routine

package.json: latest @abaplint/runtime is 2.7.54

@sbcgua
Copy link
Owner Author

sbcgua commented Jul 29, 2023

Added domain/dtel to "deps" but no effect - same error

@larshp
Copy link
Contributor

larshp commented Jul 29, 2023

try updating package.json to latest versions of the dependencies

@sbcgua
Copy link
Owner Author

sbcgua commented Jul 29, 2023

try updating package.json to latest versions of the dependencies

Yes, it's done 957b209

@sbcgua
Copy link
Owner Author

sbcgua commented Jul 29, 2023

Ah no, sorry (need to get rid of the package json in favor of script, it just makes things worse).
But there is now another error

$node transpiled/index.mjs
Void type: FLOAT

@sbcgua
Copy link
Owner Author

sbcgua commented Jul 29, 2023

OK, now it is some issue with conv_exit

ZCL_TEXT2TAB_PARSER: running ltcl_text2tab_parser_test->create
ZCL_TEXT2TAB_PARSER: running ltcl_text2tab_parser_test->apply_conv_exit
<ref *1> kernel_cx_assert [Error]
    at cl_abap_unit_assert.assert_equals (file:///C:/Users/at/Documents/devs/Abap/text2tab/transpiled/cl_abap_unit_assert.clas.mjs:355:32)
    at async ltcl_text2tab_parser_test.apply_conv_exit (file:///C:/Users/at/Documents/devs/Abap/text2tab/transpiled/zcl_text2tab_parser.clas.testclasses.mjs:312:5)
    at async run (file:///C:/Users/at/Documents/devs/Abap/text2tab/transpiled/index.mjs:45:9) {
  me: ABAPObject {
    qualifiedName: undefined,
    RTTIName: undefined,
    value: [Circular *1]
  },
  previous: ABAPObject {
    qualifiedName: 'CX_ROOT',
    RTTIName: '\\CLASS=CX_ROOT',
    value: undefined
  },
  textid: Character {
    constant: false,
    length: 32,
    extra: {},
    value: '                                '
  },
  get_longtext: [AsyncFunction: if_message$get_longtext],
  get_text: [AsyncFunction: if_message$get_text],
  actual: String { value: '123', qualifiedName: 'STRING' },
  expected: String { value: '0000000123', qualifiedName: 'STRING' },
  msg: String {
    value: "Expected '0000000123', got '123'",
    qualifiedName: 'STRING'
  },
  EXTRA_CX: {
    INTERNAL_FILENAME: 'cl_abap_unit_assert.clas.abap',
    INTERNAL_LINE: 349
  }
}

@larshp
Copy link
Contributor

larshp commented Jul 29, 2023

reproduced in unit test in open-abap/open-abap-core#720

@larshp
Copy link
Contributor

larshp commented Jul 29, 2023

try again

@larshp
Copy link
Contributor

larshp commented Jul 29, 2023

Void type: SYS_CALLS, suggest using type abap_callstack instead

@sbcgua
Copy link
Owner Author

sbcgua commented Jul 30, 2023

Hmmm

  actual: String { value: '', qualifiedName: 'STRING' },
  expected: String { value: '', qualifiedName: 'STRING' },

@larshp
Copy link
Contributor

larshp commented Jul 30, 2023

the code calls fail(), so there is no actual and expected,

suggest adding the error code to the text in:
image

@larshp
Copy link
Contributor

larshp commented Aug 9, 2023

the classes are not in open-abap yet, and there is a nice but to fix in the transpiler to give a better error message in this scenario

@larshp
Copy link
Contributor

larshp commented Aug 9, 2023

abaplint/transpiler#1295

@larshp
Copy link
Contributor

larshp commented Aug 9, 2023

@larshp
Copy link
Contributor

larshp commented Aug 9, 2023

@larshp
Copy link
Contributor

larshp commented Aug 9, 2023

add these two skips,

      { "object": "ZCL_TEXT2TAB_PARSER", "class": "ltcl_text2tab_parser_test", "method": "parse_df16",  "note": "TypeError: abap.types.typeTodoDecFloat16Type is not a constructor" },
      { "object": "ZCL_TEXT2TAB_PARSER", "class": "ltcl_text2tab_parser_test", "method": "parse_ignore_convexit",  "note": "CUNIT issue" },

not feeling like implementing DecFloat16 this week..

@sbcgua
Copy link
Owner Author

sbcgua commented Aug 9, 2023

:)

Done, though parse_ignore_convexit should theoretically work ... because the idea is to don't run the exit ... but can be checked later

@larshp
Copy link
Contributor

larshp commented Aug 10, 2023

current problem reproduced in open-abap/open-abap-core@2afe78a

@larshp
Copy link
Contributor

larshp commented Aug 10, 2023

two places where DMBTR is used,

image

@sbcgua
Copy link
Owner Author

sbcgua commented Aug 10, 2023

fixed.

P.S. is there any way to make the error output less cryptic? I can potentially contribute ... though ... I'm not sure I understand the output enough. E.g. these look the same

  actual: String {
    value: 'name: MANDT, type: [object Object], as_include: , suffix: ',
    qualifiedName: 'STRING'
  },
  expected: String {
    value: 'name: MANDT, type: [object Object], as_include: , suffix: ',
    qualifiedName: 'STRING'
  },

@larshp
Copy link
Contributor

larshp commented Aug 10, 2023

fixed.

P.S. is there any way to make the error output less cryptic? I can potentially contribute ... though ... I'm not sure I understand the output enough. E.g. these look the same

  actual: String {
    value: 'name: MANDT, type: [object Object], as_include: , suffix: ',
    qualifiedName: 'STRING'
  },
  expected: String {
    value: 'name: MANDT, type: [object Object], as_include: , suffix: ',
    qualifiedName: 'STRING'
  },

for the current issue, the commented testcases are in open-abap/open-abap-core#739

problem is the RTTI in open-abap doesnt return identical object references for identical types

I implemented cl_abap_weak_reference earlier today, think I'm gonna make the RTTI classes serializable, instantiate everything, and compare with a weak reference cache, but not sure, its difficult

a bit less cryptic, but still cryptic message fixed in https://github.com/open-abap/open-abap-core/pull/739/files#diff-c761d101268df6f7b95ee1c9f81a84d0c9bbc2d15a262804315573b258e13439

@sbcgua
Copy link
Owner Author

sbcgua commented Aug 22, 2023

Hi Lars, any progress with that issue? Can I do anything from my side?

@larshp
Copy link
Contributor

larshp commented Aug 24, 2023

not really sure what is the best way to fix the issue, perhaps just disable those testcases for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants