beanit / asn1bean

ASN1bean (formerly known as jASN1) is a Java ASN.1 BER and DER encoding/decoding library
https://www.beanit.com/asn1/
Apache License 2.0
110 stars 45 forks source link

OBJECT IDENTIFIER (a | b ) error #5

Open elpadrinoIV opened 6 years ago

elpadrinoIV commented 6 years ago

The following snippet is adapted from PKIX1Implicit88:

PKIX1Implicit88 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-implicit(19)}
--
-- Copyright (C) The Internet Society (2002). This version of
-- this ASN.1 module is part of RFC 3280;
-- see the RFC itself for full legal notices.
--
DEFINITIONS IMPLICIT TAGS ::=

BEGIN
id-pkix  OBJECT IDENTIFIER  ::=
         { iso(1) identified-organization(3) dod(6) internet(1)
                    security(5) mechanisms(5) pkix(7) }
id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 }
id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 }
id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 }
PolicyQualifierId ::= OBJECT IDENTIFIER (id-qt-cps | id-qt-unotice)

Dummy ::= SEQUENCE {
  oid PolicyQualifierId
}
END

The following error occurs when trying to compile it:

$ ./run-scripts/jasn1-compiler -f sample.asn1 
Generated code will be saved in ./
Parsing "sample.asn1"
line 16:41: expecting "END", found '('
line 18:7: unexpected token: ::=
line 22:1: expecting "DEFINITIONS", found 'null'
Generating classes for module "PKIX1Implicit88"
Generating classes for module "Dummy"
done

This is a part of a much bigger definition. These errors break further parsing.

sfeuerhahn commented 6 years ago

I will try to fix that soon. For now you can comment out the part which would be ignored anyways: replace PolicyQualifierId ::= OBJECT IDENTIFIER (id-qt-cps | id-qt-unotice) with PolicyQualifierId ::= OBJECT IDENTIFIER -- (id-qt-cps | id-qt-unotice)

giridharkl commented 5 years ago

-- Module CMIP-1 (X.711:10/1997) CMIP-1 {joint-iso-itu-t ms(9) cmip(1) modules(0) protocol(3)} DEFINITIONS ::= BEGIN

IMPORTS ERROR, OPERATION FROM Remote-Operations-Information-Objects {joint-iso-itu-t remote-operations(4) informationObjects(5) version1(0)} ROS{}, InvokeId, noInvokeId FROM Remote-Operations-Generic-ROS-PDUs {joint-iso-itu-t remote-operations(4) generic-ROS-PDUs(6) version1(0)};

CMIP-Operations OPERATION ::= {m-Action | m-Action-Confirmed | m-CancelGet | m-Create | m-Delete | m-EventReport | m-EventReport-Confirmed | m-Get | m-Linked-Reply | m-Set | m-Set-Confirmed}

CMIP-Confirmed-Operations OPERATION ::= {m-Action-Confirmed | m-CancelGet | m-Create | m-Delete | m-EventReport-Confirmed | m-Get | m-Set-Confirmed}

-- CMISE error definitions accessDenied ERROR ::= {PRIORITY {0} CODE local:2 }

I get the following error line 13:1: unexpected token: CMIP-Operations line 14:13: unexpected token: | line 14:15: expecting ASSIGN_OP, found 'm-Action-Confirmed' line 14:48: unexpected token: | line 14:50: expecting ASSIGN_OP, found 'm-Create' line 14:70: unexpected token: | line 15:4: expecting ASSIGN_OP, found 'm-EventReport' line 15:44: unexpected token: | line 15:46: expecting ASSIGN_OP, found 'm-Get' line 15:69: unexpected token: | line 15:71: expecting ASSIGN_OP, found 'm-Set' line 16:19: unexpected token: } line 18:1: expecting ASSIGN_OP, found 'CMIP-Confirmed-Operations' line 19:23: unexpected token: | line 19:25: expecting ASSIGN_OP, found 'm-CancelGet' line 19:48: unexpected token: | line 19:50: expecting ASSIGN_OP, found 'm-Delete' line 20:28: unexpected token: | line 20:30: expecting ASSIGN_OP, found 'm-Get' line 20:53: unexpected token: } line 23:1: expecting ASSIGN_OP, found 'accessDenied' line 23:36: unexpected token: 0 line 24:25: expecting ASSIGN_OP, found 'CODE' line 24:40: unexpected token: : line 24:41: expecting ASSIGN_OP, found '2' line 27:23: unexpected token: ERROR line 28:3: expecting R_BRACE, found 'PARAMETER' line 29:14: expecting ASSIGN_OP, found '{' line 30:3: unexpected token: CODE line 30:19: unexpected token: : line 30:20: expecting ASSIGN_OP, found '19' line 33:22: unexpected token: ERROR line 34:3: expecting R_BRACE, found 'PARAMETER' line 34:14: unexpected token: ComplexityLimitation line 36:15: unexpected token: 1 line 37:3: expecting ASSIGN_OP, found 'CODE' line 37:19: unexpected token: : line 37:20: expecting ASSIGN_OP, found '20' line 40:32: unexpected token: ERROR line 41:3: expecting R_BRACE, found 'PARAMETER' line 42:14: expecting ASSIGN_OP, found '{' line 43:3: unexpected token: CODE line 43:19: unexpected token: : line 43:20: expecting ASSIGN_OP, found '11' line 46:14: unexpected token: ERROR line 47:3: expecting R_BRACE, found 'PARAMETER' line 48:14: expecting ASSIGN_OP, found '{' line 49:3: unexpected token: CODE line 49:19: unexpected token: : line 49:20: expecting ASSIGN_OP, found '7' line 52:22: unexpected token: ERROR line 53:3: expecting R_BRACE, found 'PARAMETER' line 54:14: expecting ASSIGN_OP, found '{' line 55:3: unexpected token: CODE line 55:19: unexpected token: : line 55:20: expecting ASSIGN_OP, found '15' line 58:23: unexpected token: ERROR line 59:3: expecting R_BRACE, found 'PARAMETER' line 60:14: expecting ASSIGN_OP, found '{' line 61:3: unexpected token: CODE line 61:19: unexpected token: : line 61:20: expecting ASSIGN_OP, found '6' line 64:15: unexpected token: ERROR line 65:3: expecting R_BRACE, found 'PARAMETER' line 66:14: expecting ASSIGN_OP, found '{' line 67:3: unexpected token: CODE line 67:19: unexpected token: : line 67:20: expecting ASSIGN_OP, found '4' line 70:23: unexpected token: ERROR line 71:3: expecting R_BRACE, found 'PARAMETER' line 72:14: expecting ASSIGN_OP, found '{' line 73:3: unexpected token: CODE line 73:19: unexpected token: : line 73:20: expecting ASSIGN_OP, found '17' line 76:14: unexpected token: ERROR line 76:25: expecting R_BRACE, found 'PARAMETER' line 77:36: expecting ASSIGN_OP, found '{' line 78:25: unexpected token: CODE line 78:41: unexpected token: : line 78:42: expecting ASSIGN_OP, found '16' line 81:23: unexpected token: ERROR line 82:3: expecting R_BRACE, found 'PARAMETER' line 83:14: expecting ASSIGN_OP, found '{' line 84:3: unexpected token: CODE line 84:19: unexpected token: : line 84:20: expecting ASSIGN_OP, found '18' line 87:19: unexpected token: ERROR line 87:40: expecting R_BRACE, found '{' line 88:30: unexpected token: CODE line 88:45: unexpected token: : line 88:46: expecting ASSIGN_OP, found '21' line 91:14: unexpected token: ERROR line 92:3: expecting R_BRACE, found 'PARAMETER' line 93:14: expecting ASSIGN_OP, found '{' line 94:3: unexpected token: CODE line 94:19: unexpected token: : line 94:20: expecting ASSIGN_OP, found '9' line 97:16: unexpected token: ERROR line 98:3: expecting R_BRACE, found 'PARAMETER' line 99:14: expecting ASSIGN_OP, found '{' line 100:3: unexpected token: CODE line 100:19: unexpected token: : line 100:20: expecting ASSIGN_OP, found '14' line 103:17: unexpected token: ERROR line 104:3: expecting R_BRACE, found 'PARAMETER' line 105:14: expecting ASSIGN_OP, found '{' line 106:3: unexpected token: CODE line 106:19: unexpected token: : line 106:20: expecting ASSIGN_OP, found '5' line 109:17: unexpected token: ERROR line 110:3: expecting R_BRACE, found 'PARAMETER' line 111:14: expecting ASSIGN_OP, found '{' line 112:3: unexpected token: CODE line 112:19: unexpected token: : line 112:20: expecting ASSIGN_OP, found '13' line 115:16: unexpected token: ERROR line 116:3: expecting R_BRACE, found 'PARAMETER' line 117:14: expecting ASSIGN_OP, found '{' line 118:3: unexpected token: CODE line 118:19: unexpected token: : line 118:20: expecting ASSIGN_OP, found '22' line 121:19: unexpected token: ERROR line 122:3: expecting R_BRACE, found 'PARAMETER' line 123:14: expecting ASSIGN_OP, found '{' line 124:3: unexpected token: CODE line 124:19: unexpected token: : line 124:20: expecting ASSIGN_OP, found '0' line 127:22: unexpected token: ERROR line 128:3: expecting R_BRACE, found 'PARAMETER' line 129:14: expecting ASSIGN_OP, found '{' line 130:3: unexpected token: CODE line 130:19: unexpected token: : line 130:20: expecting ASSIGN_OP, found '1' line 133:23: unexpected token: ERROR line 134:3: expecting R_BRACE, found 'PARAMETER' line 135:14: expecting ASSIGN_OP, found '{' line 136:3: unexpected token: CODE line 136:19: unexpected token: : line 136:20: expecting ASSIGN_OP, found '12' line 139:20: unexpected token: ERROR line 139:41: expecting R_BRACE, found '{' line 140:31: unexpected token: CODE line 140:46: unexpected token: : line 140:47: expecting ASSIGN_OP, found '23' line 143:19: unexpected token: ERROR line 144:3: expecting R_BRACE, found 'PARAMETER' line 144:14: unexpected token: ProcessingFailure line 146:15: unexpected token: 1 line 147:3: expecting ASSIGN_OP, found 'CODE' line 147:19: unexpected token: : line 147:20: expecting ASSIGN_OP, found '10' line 150:14: unexpected token: ERROR line 151:3: expecting R_BRACE, found 'PARAMETER' line 152:14: expecting ASSIGN_OP, found '{' line 153:3: unexpected token: CODE line 153:19: unexpected token: : line 153:20: expecting ASSIGN_OP, found '8' line 156:18: unexpected token: ERROR line 157:3: expecting R_BRACE, found 'PARAMETER' line 158:14: expecting ASSIGN_OP, found '{' line 159:3: unexpected token: CODE line 159:19: unexpected token: : line 159:20: expecting ASSIGN_OP, found '3' line 164:10: unexpected token: OPERATION line 165:3: expecting R_BRACE, found 'ARGUMENT' line 166:10: expecting ASSIGN_OP, found 'RESULT' line 167:20: expecting ASSIGN_OP, found 'FALSE' line 168:3: unexpected token: CODE line 168:25: unexpected token: : line 168:26: expecting ASSIGN_OP, found '6' line 171:20: unexpected token: OPERATION line 172:3: expecting R_BRACE, found 'ARGUMENT' line 172:13: unexpected token: ActionArgument line 173:13: unexpected token: ActionResult line 177:19: unexpected token: | line 177:21: expecting ASSIGN_OP, found 'classInstanceConflict' line 177:66: unexpected token: | line 177:68: expecting ASSIGN_OP, found 'invalidScope' line 178:30: unexpected token: | line 178:32: expecting ASSIGN_OP, found 'invalidFilter' line 178:61: unexpected token: | line 178:63: expecting ASSIGN_OP, found 'noSuchArgument' line 179:25: unexpected token: | line 179:27: expecting ASSIGN_OP, found 'noSuchObjectInstance' line 179:68: unexpected token: | line 180:7: expecting ASSIGN_OP, found 'syncNotSupported' line 181:28: unexpected token: } line 182:3: expecting ASSIGN_OP, found 'CODE' line 182:18: unexpected token: : line 182:19: expecting ASSIGN_OP, found '7' line 186:13: unexpected token: OPERATION line 187:3: expecting R_BRACE, found 'ARGUMENT' line 188:10: expecting ASSIGN_OP, found 'RESULT' line 189:37: unexpected token: | line 189:39: expecting ASSIGN_OP, found 'noSuchInvokeId' line 189:73: unexpected token: } line 190:3: expecting ASSIGN_OP, found 'CODE' line 190:23: unexpected token: : line 190:24: expecting ASSIGN_OP, found '10' line 194:10: unexpected token: OPERATION line 195:3: expecting R_BRACE, found 'ARGUMENT' line 195:13: unexpected token: CreateArgument line 196:13: unexpected token: CreateResult line 200:19: unexpected token: | line 200:21: expecting ASSIGN_OP, found 'classInstanceConflict' line 200:76: unexpected token: | line 201:7: expecting ASSIGN_OP, found 'invalidAttributeValue' line 201:53: unexpected token: | line 201:55: expecting ASSIGN_OP, found 'missingAttributeValue' line 202:23: unexpected token: | line 202:25: expecting ASSIGN_OP, found 'noSuchObjectClass' line 202:66: unexpected token: | line 203:7: expecting ASSIGN_OP, found 'noSuchReferenceObject' line 203:48: unexpected token: } line 204:3: expecting ASSIGN_OP, found 'CODE' line 204:18: unexpected token: : line 204:19: expecting ASSIGN_OP, found '8' line 208:10: unexpected token: OPERATION line 209:3: expecting R_BRACE, found 'ARGUMENT' line 209:13: unexpected token: DeleteArgument line 210:13: unexpected token: DeleteResult line 214:19: unexpected token: | line 214:21: expecting ASSIGN_OP, found 'classInstanceConflict' line 214:66: unexpected token: | line 215:7: expecting ASSIGN_OP, found 'invalidFilter' line 215:36: unexpected token: | line 215:38: expecting ASSIGN_OP, found 'noSuchObjectClass' line 215:79: unexpected token: | line 216:7: expecting ASSIGN_OP, found 'processingFailure' line 216:43: unexpected token: } line 217:13: expecting ASSIGN_OP, found '{' line 217:28: unexpected token: } line 218:3: expecting ASSIGN_OP, found 'CODE' line 218:18: unexpected token: : line 218:19: expecting ASSIGN_OP, found '9' line 222:15: unexpected token: OPERATION line 223:3: expecting R_BRACE, found 'ARGUMENT' line 224:10: expecting ASSIGN_OP, found 'RESULT' line 225:20: expecting ASSIGN_OP, found 'FALSE' line 226:3: unexpected token: CODE line 226:25: unexpected token: : line 226:26: expecting ASSIGN_OP, found '0' line 229:25: unexpected token: OPERATION line 230:3: expecting R_BRACE, found 'ARGUMENT' line 230:13: unexpected token: EventReportArgument line 231:13: unexpected token: EventReportResult line 234:27: unexpected token: | line 234:29: expecting ASSIGN_OP, found 'noSuchArgument' line 234:62: unexpected token: | line 235:7: expecting ASSIGN_OP, found 'noSuchObjectClass' line 235:48: unexpected token: | line 235:50: expecting ASSIGN_OP, found 'processingFailure' line 236:3: unexpected token: CODE line 236:18: unexpected token: : line 236:19: expecting ASSIGN_OP, found '1' line 240:7: unexpected token: OPERATION line 241:3: expecting R_BRACE, found 'ARGUMENT' line 241:13: unexpected token: GetArgument line 242:13: unexpected token: GetResult line 246:19: unexpected token: | line 246:21: expecting ASSIGN_OP, found 'classInstanceConflict' line 246:66: unexpected token: | line 246:68: expecting ASSIGN_OP, found 'getListError' line 247:23: unexpected token: | line 247:25: expecting ASSIGN_OP, found 'invalidScope' line 247:58: unexpected token: | line 247:60: expecting ASSIGN_OP, found 'noSuchObjectInstance' line 248:28: unexpected token: | line 248:30: expecting ASSIGN_OP, found 'processingFailure' line 248:66: unexpected token: } line 249:13: expecting ASSIGN_OP, found '{' line 249:28: unexpected token: } line 250:3: expecting ASSIGN_OP, found 'CODE' line 250:18: unexpected token: : line 250:19: expecting ASSIGN_OP, found '3' line 254:16: unexpected token: OPERATION line 254:31: expecting R_BRACE, found 'ARGUMENT' line 255:41: expecting ASSIGN_OP, found 'local' line 259:7: unexpected token: OPERATION line 260:3: expecting R_BRACE, found 'ARGUMENT' line 261:10: expecting ASSIGN_OP, found 'RESULT' line 262:20: expecting ASSIGN_OP, found 'FALSE' line 263:3: unexpected token: CODE line 263:25: unexpected token: : line 263:26: expecting ASSIGN_OP, found '4' line 266:17: unexpected token: OPERATION line 267:3: expecting R_BRACE, found 'ARGUMENT' line 267:13: unexpected token: SetArgument line 268:13: unexpected token: SetResult line 272:19: unexpected token: | line 272:21: expecting ASSIGN_OP, found 'classInstanceConflict' line 272:66: unexpected token: | line 273:7: expecting ASSIGN_OP, found 'invalidFilter' line 273:36: unexpected token: | line 273:38: expecting ASSIGN_OP, found 'noSuchObjectClass' line 273:79: unexpected token: | line 274:7: expecting ASSIGN_OP, found 'processingFailure' line 274:40: unexpected token: | line 274:42: expecting ASSIGN_OP, found 'syncNotSupported' line 275:28: unexpected token: } line 276:3: expecting ASSIGN_OP, found 'CODE' line 276:18: unexpected token: : line 276:19: expecting ASSIGN_OP, found '5'

Do we have a fix for this issue?

saumilsdk commented 4 years ago

I am also having the same issue line 5030:27: unexpected token: REG-EXT-ID-AND-TYPE for the asn file line Reg-TestMessage15 DSRC.REG-EXT-ID-AND-TYPE ::= { ... }