mouse07410 / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
101 stars 73 forks source link

Problem parsing ISO-TS-19091-addgrp-C-2018.asn #125

Open MartijnHarmenzon opened 1 year ago

MartijnHarmenzon commented 1 year ago

Trying to parse the following: https://standards.iso.org/iso/ts/19091/ed-2/en/ISO-TS-19091-addgrp-C-2018.asn

With the statement below: asn1c ISO-TS-19091-addgrp-C-2018.asn

Resulting in: ASN.1 grammar parse error near line 244 (token "IDENTIFIED"): syntax error, unexpected TOK_capitalreference, expecting '}' Cannot parse "ISO-TS-19091-addgrp-C-2018.asn"

Any ideas? Help is much appreciated.

mouse07410 commented 1 year ago

Sorry, I don't know. In general, the newer "baroque"-style ASN.1 goes poorly with asn1c, which is moch better suited towards simpler ASN.1 definitions...

Maybe somebody else here could comment...?

kentkost commented 1 year ago

The simple answer is that asn1c just doesn't support the token IDENTIFIED BY (X.681 10.7). However IDENTIFIED BY is not really a keyword. As I've been given to understand it is merely syntactic sugar that should make it more readable for humans. You might be able to parse the grammar if you just removed it.

I am also not that well versed in this style of ASN.1. Frankly I find the entire grammar confusing. Implementing 3 modules - where each module use IMPORT from eachother to get type definitions from other modules. I can't tell where one module starts and another ends. The module ´REGION´ in this case imports addGrpC and REG-EXT-ID-AND-TYPE from the module DSRC. addGrpC just seems to be value reference with a constant equal to 3. REG-EXT-ID-AND-TYPE is a CLASS

But the line

    {ConnectionManeuverAssist-addGrpC  IDENTIFIED BY addGrpC},

Suggests that the type ConnectionManeuverAssist-addGrpC which is imported from the module AddGrpC is IDENTIFIED BY the value addGrpC which was imported from DSRC. Shouldn't it have been:

    {ConnectionManeuverAssist-addGrpC  IDENTIFIED BY AddGrpC},

Or am I misunderstanding something?