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

An error occurs in LTE RRC Protocol compilation #88

Closed
ghost opened this issue Feb 23, 2023 · 8 comments
Closed

An error occurs in LTE RRC Protocol compilation #88

ghost opened this issue Feb 23, 2023 · 8 comments

Comments

@ghost
Copy link

ghost commented Feb 23, 2023

Hi
Using the following command, I generated the 36331-h20.asn file

python parse_spec.py 36331-h20.docx -o 36331-h20.asn

then I compiled the 336331-h20.asn file using the following command

hampi-rs-asn1c -m lte_rrc.rs --codec uper --derive all -- 36331-h20.asn

But the following error occurs:

INFO asn1_compiler::compiler] Processing file: "36331-h20.asn"
Error: Custom { kind: InvalidInput, error: "Tokenize Error (16) at Line: 6143, Column: 68" }

36331-h20.zip

@gabhijit
Copy link
Collaborator

gabhijit commented Feb 23, 2023

Hi @hiranshahi : It seems there is an issue with the generated ASN, from the docx - at line 6143

The line looks like as follows -

simultaneousAckNackAndCQI-Format4-Format5-r13           ENUMERATED {setup}              OPTIONAL-- Need OR

Note the missing space after the OPTIONAL. If I fix the line by hand to add a space after OPTIONAL then this error is gone, but similar error exists at line 12845 in the generated file.

If both these errors are fixed, Now, there's a parse error on line 22151. -

asn1_compiler::parser::asn::defs] Failed to parse a definition at Token: Token { type: Identifier, span: Span { start: LineColumn { line: 22171, column: 0 }, end: LineColumn { line: 22171, column: 9 } }, text: "AS-Config" }

Not sure why this error comes - will check. But the original error and another similar error are due to generated ASN.1 files.

@gabhijit
Copy link
Collaborator

gabhijit commented Feb 23, 2023

update: Likely some parts of this structure definition are not handled yet. If you don't need to use this structure in your generated code, you can comment out the definition of this structure and see if that works for you. Will take a detailed look at it a bit later.

@ghost
Copy link
Author

ghost commented Feb 23, 2023

Thanks for the reply.

@gabhijit
Copy link
Collaborator

The issue appears to be with handling of WITH COMPONENTS constraint. The way we can deal with this is - make sure the parsing is successful. But the actual handling of the constraint is to be handled in the code that uses the struct.

Started with a PR that just makes a test case for this. The initial goal is to pass this test and then fix any other issues that may be required to be fixed to get this working.

gabhijit added a commit that referenced this issue Mar 1, 2023
Added support for missing `WITH COMPONENTS` constraint. Currently, only
the constraint is parsed, the code generation does not deal with this
constraint. This will have to be handled at the application level.

For `SEQUENCE OF` types, the dependent references on the `SIZE`
constraints were not considered, this caused resolution error. Fixed
that.

Added a test case for parsing `WITH COMPONENTS` and changed the
`compile_string` API to take a param `parse_only` to test for correct
parsing. This API currently is used only by tests.
gabhijit added a commit that referenced this issue Mar 1, 2023
Added support for missing `WITH COMPONENTS` constraint. Currently, only
the constraint is parsed, the code generation does not deal with this
constraint. This will have to be handled at the application level.

For `SEQUENCE OF` types, the dependent references on the `SIZE`
constraints were not considered, this caused resolution error. Fixed
that.

Added a test case for parsing `WITH COMPONENTS` and changed the
`compile_string` API to take a param `parse_only` to test for correct
parsing. This API currently is used only by tests.
@gabhijit
Copy link
Collaborator

gabhijit commented Mar 1, 2023

@hiranshahi : The fix for this issue is in the master. You may want to try and see if the code generation is fine. You might have to review the generated code.

One issue that I observed is - the code generation for additional sequence components (See for example AS-Config). Will look at that in a separate issue.

Also, note codec support for these sequence extensions is missing yet. (#1).

But I believe current implementation is enough for the fix of the present issue.

@ghost
Copy link
Author

ghost commented Mar 1, 2023

The problem still exists. Thank you for taking the time to look into the issue.
Error: Custom { kind: InvalidInput, error: "Tokenize Error (16) at Line: 6143, Column: 68" }

@gabhijit
Copy link
Collaborator

gabhijit commented Mar 2, 2023

@hiranshahi : you will need to edit the generated .asn file to fix this error. This is because the generated file does not have a space before the comment prefix (--) . There are two such errors. Fixing this issue is out of scope for the compiler per se, because this is an issue with .asn file. Please refer to the first comment above. There are two such occurrences.

@ghost
Copy link
Author

ghost commented Mar 2, 2023

The problem was solved. Thank you.

@ghost ghost closed this as completed Mar 2, 2023
This issue was closed.
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

No branches or pull requests

1 participant