Skip to content

Transpiler WIP#23

Open
sbcgua wants to merge 17 commits into
masterfrom
transpiler
Open

Transpiler WIP#23
sbcgua wants to merge 17 commits into
masterfrom
transpiler

Conversation

@sbcgua

@sbcgua sbcgua commented Oct 14, 2021

Copy link
Copy Markdown
Owner

No description provided.

@larshp

larshp commented Oct 14, 2021

Copy link
Copy Markdown
Contributor

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

@larshp

larshp commented Oct 14, 2021

Copy link
Copy Markdown
Contributor

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

sbcgua commented Oct 14, 2021

Copy link
Copy Markdown
Owner Author

conv_failed

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

@sbcgua

sbcgua commented Oct 14, 2021

Copy link
Copy Markdown
Owner Author

Nice, it compiles !

@sbcgua

sbcgua commented Oct 14, 2021

Copy link
Copy Markdown
Owner Author

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

larshp commented Oct 14, 2021

Copy link
Copy Markdown
Contributor

yea, looks like a simple upper/lower case problem

image

Comment thread package.json
@@ -0,0 +1,25 @@
{
"name": "text2tab",
"version": "1.0.0",

Copy link
Copy Markdown
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
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

👍

@larshp

larshp commented Oct 15, 2021

Copy link
Copy Markdown
Contributor

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

sbcgua commented Oct 15, 2021

Copy link
Copy Markdown
Owner Author

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

sbcgua commented Jul 29, 2023

Copy link
Copy Markdown
Owner Author

@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 ... :/

Comment thread 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
Copy Markdown
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

larshp commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

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

sbcgua commented Jul 29, 2023

Copy link
Copy Markdown
Owner Author

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

sbcgua commented Jul 29, 2023

Copy link
Copy Markdown
Owner Author

image

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

@larshp

larshp commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

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

package.json: latest @abaplint/runtime is 2.7.54

@sbcgua

sbcgua commented Jul 29, 2023

Copy link
Copy Markdown
Owner Author

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

@larshp

larshp commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

try updating package.json to latest versions of the dependencies

@sbcgua

sbcgua commented Jul 29, 2023

Copy link
Copy Markdown
Owner Author

try updating package.json to latest versions of the dependencies

Yes, it's done 957b209

@sbcgua

sbcgua commented Jul 29, 2023

Copy link
Copy Markdown
Owner Author

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

sbcgua commented Jul 29, 2023

Copy link
Copy Markdown
Owner Author

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

larshp commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

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

@larshp

larshp commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

try again

@larshp

larshp commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

Void type: SYS_CALLS, suggest using type abap_callstack instead

@sbcgua

sbcgua commented Jul 30, 2023

Copy link
Copy Markdown
Owner Author

Hmmm

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

@larshp

larshp commented Jul 30, 2023

Copy link
Copy Markdown
Contributor

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

suggest adding the error code to the text in:
image

@larshp

larshp commented Aug 9, 2023

Copy link
Copy Markdown
Contributor

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

larshp commented Aug 9, 2023

Copy link
Copy Markdown
Contributor

abaplint/transpiler#1295

@larshp

larshp commented Aug 9, 2023

Copy link
Copy Markdown
Contributor

@larshp

larshp commented Aug 9, 2023

Copy link
Copy Markdown
Contributor

@larshp

larshp commented Aug 9, 2023

Copy link
Copy Markdown
Contributor

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

sbcgua commented Aug 9, 2023

Copy link
Copy Markdown
Owner Author

:)

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

@larshp

larshp commented Aug 10, 2023

Copy link
Copy Markdown
Contributor

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

@larshp

larshp commented Aug 10, 2023

Copy link
Copy Markdown
Contributor

two places where DMBTR is used,

image

@sbcgua

sbcgua commented Aug 10, 2023

Copy link
Copy Markdown
Owner Author

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

larshp commented Aug 10, 2023

Copy link
Copy Markdown
Contributor

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

sbcgua commented Aug 22, 2023

Copy link
Copy Markdown
Owner Author

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

@larshp

larshp commented Aug 24, 2023

Copy link
Copy Markdown
Contributor

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