christoph2 / pyA2L

ASAM ASAP2 Library for Python
GNU General Public License v2.0
138 stars 71 forks source link

Token recognition error #39

Open simonas88 opened 2 years ago

simonas88 commented 2 years ago

I'm trying to parse an a2l file using pyA2L library.

Here's a snippet:

  /begin MOD_PAR "D915E_N46A610"
    VERSION "[REDACTED]"
    ADDR_EPK 0x1C21F0
    EPK "[READACTED]"
    CUSTOMER_NO "5"
    USER "GS-ES/EAD1-Richard"
    PHONE_NO ""
    CPU_TYPE "GoldenOak"
    ECU "[REDACTED]"
  /end

When using db.import_a2l to parse a file containg the snippet above I get a bunch parsing errors (line 880 is CUSTOMER_NO):

[INFO (pya2l.Preprocessor)]: Pre-processing 'definitions.a2l'[UTF-8-SIG]
[INFO (pya2l.DB)]: Parsing pre-processed data ...
definitions.a2l::line 880:17 extraneous input '5' expecting {'VERSION', 'ADDR_EPK', 'CPU_TYPE', 'CUSTOMER', 'CUSTOMER_NO', 'ECU', 'ECU_CALIBRATION_OFFSET', 'EPK', 'NO_OF_INTERFACES', 'PHONE_NO', 'SUPPLIER', 'SYSTEM_CONSTANT', 'USER', '/begin', '/end'}
definitions.a2l::line 881:12 token recognition error at: '-E'
definitions.a2l::line 881:15 token recognition error at: '/E'
definitions.a2l::line 881:20 token recognition error at: '-R'

Is there a problem with the library or do I need to fix my a2l file?