mirror of https://gerrit.osmocom.org/asn1c
new WITH SYNTAX clause parsing
This commit is contained in:
parent
5a405b25c9
commit
9d542d2232
|
@ -65,16 +65,3 @@ asn1f_class_access(arg_t *arg, asn1p_module_t *mod, asn1p_ref_t *ref) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
asn1f_parse_class_with_syntax(arg_t *arg) {
|
||||
asn1p_expr_t *expr = arg->expr;
|
||||
|
||||
if(expr->expr_type != A1TC_CLASSDEF
|
||||
|| expr->with_syntax == NULL)
|
||||
return 0;
|
||||
|
||||
DEBUG("Class %s: checking WITH SYNTAX", expr->Identifier);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,4 @@ asn1p_expr_t *asn1f_class_access(arg_t *, asn1p_module_t *mod, asn1p_ref_t *);
|
|||
asn1p_expr_t *asn1f_class_access2(asn1p_t *asn, asn1p_module_t *mod,
|
||||
asn1p_expr_t *expr, asn1p_ref_t *);
|
||||
|
||||
/*
|
||||
* CLASS may contain the "WITH SYNTAX" clause, in which case we are
|
||||
* going to parse it.
|
||||
*/
|
||||
int asn1f_parse_class_with_syntax(arg_t *arg);
|
||||
|
||||
#endif /* _ASN1FIX_CLASS_H_ */
|
||||
|
|
|
@ -1,2 +1,15 @@
|
|||
#include "asn1fix_internal.h"
|
||||
#include "asn1fix_cws.h"
|
||||
|
||||
int
|
||||
asn1f_parse_class_with_syntax(arg_t *arg) {
|
||||
asn1p_expr_t *expr = arg->expr;
|
||||
|
||||
if(expr->expr_type != A1TC_CLASSDEF
|
||||
|| expr->with_syntax == NULL)
|
||||
return 0;
|
||||
|
||||
DEBUG("Class %s: checking WITH SYNTAX", expr->Identifier);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
#ifndef _ASN1FIX_CLASS_WITH_SYNTAX_H_
|
||||
#define _ASN1FIX_CLASS_WITH_SYNTAX_H_
|
||||
|
||||
/*
|
||||
* CLASS may contain the "WITH SYNTAX" clause, in which case we are
|
||||
* going to parse it.
|
||||
*/
|
||||
int asn1f_parse_class_with_syntax(arg_t *arg);
|
||||
|
||||
#endif /* _ASN1FIX_CLASS_WITH_SYNTAX_H_ */
|
||||
|
|
|
@ -61,6 +61,7 @@ typedef struct arg_s {
|
|||
#include "asn1fix_compat.h" /* Data compatibility */
|
||||
#include "asn1fix_constr.h" /* Constructed types */
|
||||
#include "asn1fix_class.h" /* CLASS support */
|
||||
#include "asn1fix_cws.h" /* CLASS WITH SYNTAX support */
|
||||
#include "asn1fix_param.h" /* Parametrization */
|
||||
#include "asn1fix_retrieve.h" /* Data retrieval */
|
||||
#include "asn1fix_enum.h" /* Process ENUMERATED */
|
||||
|
|
|
@ -18,10 +18,13 @@ asn1p_wsyntx_chunk_new() {
|
|||
void
|
||||
asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *wc) {
|
||||
if(wc) {
|
||||
if(wc->ref)
|
||||
asn1p_ref_free(wc->ref);
|
||||
if(wc->buf)
|
||||
free(wc->buf);
|
||||
switch(wc->type) {
|
||||
case WC_LITERAL: free(wc->content.token); break;
|
||||
case WC_REFERENCE: asn1p_ref_free(wc->content.ref); break;
|
||||
case WC_OPTIONALGROUP:
|
||||
asn1p_wsyntx_free(wc->content.syntax);
|
||||
break;
|
||||
}
|
||||
free(wc);
|
||||
}
|
||||
}
|
||||
|
@ -32,21 +35,17 @@ asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *wc) {
|
|||
|
||||
nc = asn1p_wsyntx_chunk_new();
|
||||
if(nc) {
|
||||
if(wc->buf) {
|
||||
nc->buf = malloc(wc->len + 1);
|
||||
if(nc->buf) {
|
||||
nc->len = wc->len;
|
||||
memcpy(nc->buf, wc->buf, wc->len);
|
||||
nc->buf[nc->len] = '\0';
|
||||
}
|
||||
}
|
||||
if(wc->ref) {
|
||||
nc->ref = asn1p_ref_clone(wc->ref);
|
||||
}
|
||||
|
||||
if(!nc->ref && !nc->buf) {
|
||||
asn1p_wsyntx_chunk_free(nc);
|
||||
return NULL;
|
||||
switch(wc->type) {
|
||||
case WC_LITERAL:
|
||||
nc->content.token = malloc(strlen(wc->content.token)+1);
|
||||
strcpy(nc->content.token, wc->content.token);
|
||||
break;
|
||||
case WC_REFERENCE:
|
||||
nc->content.ref = asn1p_ref_clone(wc->content.ref);
|
||||
break;
|
||||
case WC_OPTIONALGROUP:
|
||||
nc->content.syntax = asn1p_wsyntx_clone(wc->content.syntax);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,11 +102,15 @@ asn1p_wsyntx_chunk_fromref(asn1p_ref_t *ref, int do_copy) {
|
|||
|
||||
if(do_copy) {
|
||||
static asn1p_wsyntx_chunk_t tmp;
|
||||
tmp.ref = ref;
|
||||
tmp.type = WC_REFERENCE;
|
||||
tmp.content.ref = ref;
|
||||
wc = asn1p_wsyntx_chunk_clone(&tmp);
|
||||
} else {
|
||||
wc = asn1p_wsyntx_chunk_new();
|
||||
if(wc) wc->ref = ref;
|
||||
if(wc) {
|
||||
wc->type = WC_REFERENCE;
|
||||
wc->content.ref = ref;
|
||||
}
|
||||
}
|
||||
|
||||
return wc;
|
||||
|
@ -119,17 +122,31 @@ asn1p_wsyntx_chunk_frombuf(char *buf, int len, int do_copy) {
|
|||
|
||||
if(do_copy) {
|
||||
static asn1p_wsyntx_chunk_t tmp;
|
||||
tmp.buf = buf;
|
||||
tmp.len = len;
|
||||
tmp.type = WC_LITERAL;
|
||||
tmp.content.token = buf;
|
||||
wc = asn1p_wsyntx_chunk_clone(&tmp);
|
||||
} else {
|
||||
wc = asn1p_wsyntx_chunk_new();
|
||||
if(wc) {
|
||||
wc->buf = buf;
|
||||
wc->len = len;
|
||||
wc->type = WC_LITERAL;
|
||||
wc->content.token = buf;
|
||||
}
|
||||
}
|
||||
|
||||
return wc;
|
||||
}
|
||||
|
||||
|
||||
asn1p_wsyntx_chunk_t *
|
||||
asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax) {
|
||||
asn1p_wsyntx_chunk_t *wc;
|
||||
|
||||
wc = asn1p_wsyntx_chunk_new();
|
||||
if(wc) {
|
||||
wc->type = WC_OPTIONALGROUP;
|
||||
wc->content.syntax = syntax;
|
||||
}
|
||||
|
||||
return wc;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,15 +10,21 @@
|
|||
* WITH SYNTAX free-form chunks.
|
||||
*/
|
||||
typedef struct asn1p_wsyntx_chunk_s {
|
||||
enum {
|
||||
WC_LITERAL,
|
||||
WC_REFERENCE,
|
||||
WC_OPTIONALGROUP
|
||||
} type;
|
||||
/*
|
||||
* It could be the union, but the story is:
|
||||
* if ref is here, the ref is used.
|
||||
* Otherwise, buf/len is used.
|
||||
* WC_LITERAL -> {buf, len}
|
||||
* WC_REFERENCE -> {ref}
|
||||
* WC_OPTIONALGROUP -> {syntax}
|
||||
*/
|
||||
asn1p_ref_t *ref;
|
||||
|
||||
char *buf;
|
||||
int len;
|
||||
union {
|
||||
char *token;
|
||||
asn1p_ref_t *ref;
|
||||
struct asn1p_wsyntx_s *syntax;
|
||||
} content;
|
||||
|
||||
TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next;
|
||||
} asn1p_wsyntx_chunk_t;
|
||||
|
@ -47,7 +53,8 @@ asn1p_wsyntx_t *asn1p_wsyntx_clone(asn1p_wsyntx_t *);
|
|||
* -1: Failure to add component (refer to errno)
|
||||
*/
|
||||
asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromref(asn1p_ref_t *ref, int do_copy);
|
||||
asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_frombuf(char *buf, int len, int do_copy);
|
||||
asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_frombuf(char *buf, int len, int _copy);
|
||||
asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax);
|
||||
|
||||
|
||||
#endif /* ASN1_PARSER_CLASS_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -99,7 +99,7 @@ WSP [\t\r\v\f\n ]
|
|||
|
||||
--<[ \t]*ASN1C.RepresentAsPointer[ \t]*>-- asn1p_as_pointer = 1;
|
||||
|
||||
-- yy_push_state(dash_comment);
|
||||
<INITIAL,with_syntax>-- yy_push_state(dash_comment);
|
||||
<dash_comment,idash_comment>{
|
||||
|
||||
{NL} yy_pop_state();
|
||||
|
@ -109,7 +109,7 @@ WSP [\t\r\v\f\n ]
|
|||
[^\r\v\f\n-]+ /* Eat */
|
||||
}
|
||||
|
||||
<INITIAL,cpp_comment>"/*" yy_push_state(cpp_comment);
|
||||
<INITIAL,cpp_comment,with_syntax>"/*" yy_push_state(cpp_comment);
|
||||
<cpp_comment>{
|
||||
[^*/<] /* Eat */
|
||||
"*/" yy_pop_state();
|
||||
|
@ -391,12 +391,25 @@ WITH return TOK_WITH;
|
|||
|
||||
<with_syntax>{
|
||||
|
||||
[^&{} \t\r\v\f\n]+ {
|
||||
asn1p_lval.tv_opaque.buf = strdup(yytext);
|
||||
asn1p_lval.tv_opaque.len = yyleng;
|
||||
return TOK_opaque;
|
||||
[A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* {
|
||||
asn1p_lval.tv_str = strdup(yytext);
|
||||
return TOK_Literal;
|
||||
}
|
||||
|
||||
"," {
|
||||
asn1p_lval.tv_str = strdup(yytext);
|
||||
return TOK_Literal;
|
||||
}
|
||||
|
||||
"{" {
|
||||
yy_push_state(with_syntax);
|
||||
asn1p_lval.tv_str = strdup(yytext);
|
||||
return TOK_Literal;
|
||||
}
|
||||
|
||||
"[" return '[';
|
||||
"]" return ']';
|
||||
|
||||
{WSP}+ {
|
||||
asn1p_lval.tv_opaque.buf = strdup(yytext);
|
||||
asn1p_lval.tv_opaque.len = yyleng;
|
||||
|
@ -405,7 +418,12 @@ WITH return TOK_WITH;
|
|||
|
||||
"}" {
|
||||
yy_pop_state();
|
||||
return '}';
|
||||
if(YYSTATE == with_syntax) {
|
||||
asn1p_lval.tv_str = strdup(yytext);
|
||||
return TOK_Literal;
|
||||
} else {
|
||||
return '}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -45,92 +45,93 @@ typedef union {
|
|||
#define TOK_capitalreference 268
|
||||
#define TOK_typefieldreference 269
|
||||
#define TOK_valuefieldreference 270
|
||||
#define TOK_ABSENT 271
|
||||
#define TOK_ABSTRACT_SYNTAX 272
|
||||
#define TOK_ALL 273
|
||||
#define TOK_ANY 274
|
||||
#define TOK_APPLICATION 275
|
||||
#define TOK_AUTOMATIC 276
|
||||
#define TOK_BEGIN 277
|
||||
#define TOK_BIT 278
|
||||
#define TOK_BMPString 279
|
||||
#define TOK_BOOLEAN 280
|
||||
#define TOK_BY 281
|
||||
#define TOK_CHARACTER 282
|
||||
#define TOK_CHOICE 283
|
||||
#define TOK_CLASS 284
|
||||
#define TOK_COMPONENT 285
|
||||
#define TOK_COMPONENTS 286
|
||||
#define TOK_CONSTRAINED 287
|
||||
#define TOK_CONTAINING 288
|
||||
#define TOK_DEFAULT 289
|
||||
#define TOK_DEFINITIONS 290
|
||||
#define TOK_DEFINED 291
|
||||
#define TOK_EMBEDDED 292
|
||||
#define TOK_ENCODED 293
|
||||
#define TOK_ENCODING_CONTROL 294
|
||||
#define TOK_END 295
|
||||
#define TOK_ENUMERATED 296
|
||||
#define TOK_EXPLICIT 297
|
||||
#define TOK_EXPORTS 298
|
||||
#define TOK_EXTENSIBILITY 299
|
||||
#define TOK_EXTERNAL 300
|
||||
#define TOK_FALSE 301
|
||||
#define TOK_FROM 302
|
||||
#define TOK_GeneralizedTime 303
|
||||
#define TOK_GeneralString 304
|
||||
#define TOK_GraphicString 305
|
||||
#define TOK_IA5String 306
|
||||
#define TOK_IDENTIFIER 307
|
||||
#define TOK_IMPLICIT 308
|
||||
#define TOK_IMPLIED 309
|
||||
#define TOK_IMPORTS 310
|
||||
#define TOK_INCLUDES 311
|
||||
#define TOK_INSTANCE 312
|
||||
#define TOK_INSTRUCTIONS 313
|
||||
#define TOK_INTEGER 314
|
||||
#define TOK_ISO646String 315
|
||||
#define TOK_MAX 316
|
||||
#define TOK_MIN 317
|
||||
#define TOK_MINUS_INFINITY 318
|
||||
#define TOK_NULL 319
|
||||
#define TOK_NumericString 320
|
||||
#define TOK_OBJECT 321
|
||||
#define TOK_ObjectDescriptor 322
|
||||
#define TOK_OCTET 323
|
||||
#define TOK_OF 324
|
||||
#define TOK_OPTIONAL 325
|
||||
#define TOK_PATTERN 326
|
||||
#define TOK_PDV 327
|
||||
#define TOK_PLUS_INFINITY 328
|
||||
#define TOK_PRESENT 329
|
||||
#define TOK_PrintableString 330
|
||||
#define TOK_PRIVATE 331
|
||||
#define TOK_REAL 332
|
||||
#define TOK_RELATIVE_OID 333
|
||||
#define TOK_SEQUENCE 334
|
||||
#define TOK_SET 335
|
||||
#define TOK_SIZE 336
|
||||
#define TOK_STRING 337
|
||||
#define TOK_SYNTAX 338
|
||||
#define TOK_T61String 339
|
||||
#define TOK_TAGS 340
|
||||
#define TOK_TeletexString 341
|
||||
#define TOK_TRUE 342
|
||||
#define TOK_TYPE_IDENTIFIER 343
|
||||
#define TOK_UNIQUE 344
|
||||
#define TOK_UNIVERSAL 345
|
||||
#define TOK_UniversalString 346
|
||||
#define TOK_UTCTime 347
|
||||
#define TOK_UTF8String 348
|
||||
#define TOK_VideotexString 349
|
||||
#define TOK_VisibleString 350
|
||||
#define TOK_WITH 351
|
||||
#define TOK_EXCEPT 352
|
||||
#define TOK_INTERSECTION 353
|
||||
#define TOK_UNION 354
|
||||
#define TOK_TwoDots 355
|
||||
#define TOK_ThreeDots 356
|
||||
#define TOK_Literal 271
|
||||
#define TOK_ABSENT 272
|
||||
#define TOK_ABSTRACT_SYNTAX 273
|
||||
#define TOK_ALL 274
|
||||
#define TOK_ANY 275
|
||||
#define TOK_APPLICATION 276
|
||||
#define TOK_AUTOMATIC 277
|
||||
#define TOK_BEGIN 278
|
||||
#define TOK_BIT 279
|
||||
#define TOK_BMPString 280
|
||||
#define TOK_BOOLEAN 281
|
||||
#define TOK_BY 282
|
||||
#define TOK_CHARACTER 283
|
||||
#define TOK_CHOICE 284
|
||||
#define TOK_CLASS 285
|
||||
#define TOK_COMPONENT 286
|
||||
#define TOK_COMPONENTS 287
|
||||
#define TOK_CONSTRAINED 288
|
||||
#define TOK_CONTAINING 289
|
||||
#define TOK_DEFAULT 290
|
||||
#define TOK_DEFINITIONS 291
|
||||
#define TOK_DEFINED 292
|
||||
#define TOK_EMBEDDED 293
|
||||
#define TOK_ENCODED 294
|
||||
#define TOK_ENCODING_CONTROL 295
|
||||
#define TOK_END 296
|
||||
#define TOK_ENUMERATED 297
|
||||
#define TOK_EXPLICIT 298
|
||||
#define TOK_EXPORTS 299
|
||||
#define TOK_EXTENSIBILITY 300
|
||||
#define TOK_EXTERNAL 301
|
||||
#define TOK_FALSE 302
|
||||
#define TOK_FROM 303
|
||||
#define TOK_GeneralizedTime 304
|
||||
#define TOK_GeneralString 305
|
||||
#define TOK_GraphicString 306
|
||||
#define TOK_IA5String 307
|
||||
#define TOK_IDENTIFIER 308
|
||||
#define TOK_IMPLICIT 309
|
||||
#define TOK_IMPLIED 310
|
||||
#define TOK_IMPORTS 311
|
||||
#define TOK_INCLUDES 312
|
||||
#define TOK_INSTANCE 313
|
||||
#define TOK_INSTRUCTIONS 314
|
||||
#define TOK_INTEGER 315
|
||||
#define TOK_ISO646String 316
|
||||
#define TOK_MAX 317
|
||||
#define TOK_MIN 318
|
||||
#define TOK_MINUS_INFINITY 319
|
||||
#define TOK_NULL 320
|
||||
#define TOK_NumericString 321
|
||||
#define TOK_OBJECT 322
|
||||
#define TOK_ObjectDescriptor 323
|
||||
#define TOK_OCTET 324
|
||||
#define TOK_OF 325
|
||||
#define TOK_OPTIONAL 326
|
||||
#define TOK_PATTERN 327
|
||||
#define TOK_PDV 328
|
||||
#define TOK_PLUS_INFINITY 329
|
||||
#define TOK_PRESENT 330
|
||||
#define TOK_PrintableString 331
|
||||
#define TOK_PRIVATE 332
|
||||
#define TOK_REAL 333
|
||||
#define TOK_RELATIVE_OID 334
|
||||
#define TOK_SEQUENCE 335
|
||||
#define TOK_SET 336
|
||||
#define TOK_SIZE 337
|
||||
#define TOK_STRING 338
|
||||
#define TOK_SYNTAX 339
|
||||
#define TOK_T61String 340
|
||||
#define TOK_TAGS 341
|
||||
#define TOK_TeletexString 342
|
||||
#define TOK_TRUE 343
|
||||
#define TOK_TYPE_IDENTIFIER 344
|
||||
#define TOK_UNIQUE 345
|
||||
#define TOK_UNIVERSAL 346
|
||||
#define TOK_UniversalString 347
|
||||
#define TOK_UTCTime 348
|
||||
#define TOK_UTF8String 349
|
||||
#define TOK_VideotexString 350
|
||||
#define TOK_VisibleString 351
|
||||
#define TOK_WITH 352
|
||||
#define TOK_EXCEPT 353
|
||||
#define TOK_INTERSECTION 354
|
||||
#define TOK_UNION 355
|
||||
#define TOK_TwoDots 356
|
||||
#define TOK_ThreeDots 357
|
||||
|
||||
|
||||
extern YYSTYPE asn1p_lval;
|
||||
|
|
|
@ -120,6 +120,7 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
|
|||
%token <tv_str> TOK_capitalreference /* "CLASS1" */
|
||||
%token <tv_str> TOK_typefieldreference /* "&Pork" */
|
||||
%token <tv_str> TOK_valuefieldreference /* "&id" */
|
||||
%token <tv_str> TOK_Literal /* "BY" */
|
||||
|
||||
/*
|
||||
* Token types representing ASN.1 standard keywords.
|
||||
|
@ -307,8 +308,8 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
|
|||
%type <a_value> RestrictedCharacterStringValue
|
||||
%type <a_wsynt> optWithSyntax
|
||||
%type <a_wsynt> WithSyntax
|
||||
%type <a_wsynt> WithSyntaxFormat
|
||||
%type <a_wchunk> WithSyntaxFormatToken
|
||||
%type <a_wsynt> WithSyntaxList
|
||||
%type <a_wchunk> WithSyntaxToken
|
||||
%type <a_marker> optMarker Marker
|
||||
%type <a_int> optUnique
|
||||
%type <a_pres> optPresenceConstraint PresenceConstraint
|
||||
|
@ -1054,27 +1055,30 @@ optWithSyntax:
|
|||
WithSyntax:
|
||||
TOK_WITH TOK_SYNTAX '{'
|
||||
{ asn1p_lexer_hack_enable_with_syntax(); }
|
||||
WithSyntaxFormat
|
||||
WithSyntaxList
|
||||
'}' {
|
||||
$$ = $5;
|
||||
}
|
||||
;
|
||||
|
||||
WithSyntaxFormat:
|
||||
WithSyntaxFormatToken {
|
||||
WithSyntaxList:
|
||||
WithSyntaxToken {
|
||||
$$ = asn1p_wsyntx_new();
|
||||
TQ_ADD(&($$->chunks), $1, next);
|
||||
}
|
||||
| WithSyntaxFormat WithSyntaxFormatToken {
|
||||
| WithSyntaxList WithSyntaxToken {
|
||||
$$ = $1;
|
||||
TQ_ADD(&($$->chunks), $2, next);
|
||||
}
|
||||
;
|
||||
|
||||
WithSyntaxFormatToken:
|
||||
WithSyntaxToken:
|
||||
TOK_opaque {
|
||||
$$ = asn1p_wsyntx_chunk_frombuf($1.buf, $1.len, 0);
|
||||
}
|
||||
| TOK_Literal {
|
||||
$$ = asn1p_wsyntx_chunk_frombuf($1, strlen($1), 0);
|
||||
}
|
||||
| ClassFieldIdentifier {
|
||||
asn1p_ref_t *ref;
|
||||
int ret;
|
||||
|
@ -1084,6 +1088,9 @@ WithSyntaxFormatToken:
|
|||
checkmem(ret == 0);
|
||||
$$ = asn1p_wsyntx_chunk_fromref(ref, 0);
|
||||
}
|
||||
| '[' WithSyntaxList ']' {
|
||||
$$ = asn1p_wsyntx_chunk_fromsyntax($2);
|
||||
}
|
||||
;
|
||||
|
||||
ExtensionAndException:
|
||||
|
@ -2340,10 +2347,9 @@ _fixup_anonymous_identifier(asn1p_expr_t *expr) {
|
|||
expr->Identifier);
|
||||
}
|
||||
|
||||
extern char *asn1p_text;
|
||||
|
||||
int
|
||||
yyerror(const char *msg) {
|
||||
extern char *asn1p_text;
|
||||
fprintf(stderr,
|
||||
"ASN.1 grammar parse error "
|
||||
"near line %d (token \"%s\"): %s\n",
|
||||
|
@ -2351,4 +2357,3 @@ yyerror(const char *msg) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -412,15 +412,21 @@ static int
|
|||
asn1print_with_syntax(asn1p_wsyntx_t *wx, enum asn1print_flags flags) {
|
||||
if(wx) {
|
||||
asn1p_wsyntx_chunk_t *wc;
|
||||
printf(" WITH SYNTAX {");
|
||||
TQ_FOR(wc, &(wx->chunks), next) {
|
||||
if(wc->ref) {
|
||||
asn1print_ref(wc->ref, flags);
|
||||
} else {
|
||||
fwrite(wc->buf, 1, wc->len, stdout);
|
||||
}
|
||||
switch(wc->type) {
|
||||
case WC_LITERAL:
|
||||
printf("%s", wc->content.token);
|
||||
break;
|
||||
case WC_REFERENCE:
|
||||
asn1print_ref(wc->content.ref, flags);
|
||||
break;
|
||||
case WC_OPTIONALGROUP:
|
||||
printf("[");
|
||||
asn1print_with_syntax(wc->content.syntax,flags);
|
||||
printf("]");
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("}\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -651,8 +657,11 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
|
|||
}
|
||||
}
|
||||
|
||||
if(tc->with_syntax)
|
||||
if(tc->with_syntax) {
|
||||
printf(" WITH SYNTAX {");
|
||||
asn1print_with_syntax(tc->with_syntax, flags);
|
||||
printf("}\n");
|
||||
}
|
||||
|
||||
if(!SEQ_OF && tc->constraints) {
|
||||
printf(" ");
|
||||
|
|
Loading…
Reference in New Issue