more distinction

This commit is contained in:
Lev Walkin 2006-03-16 05:11:14 +00:00
parent 9d542d2232
commit 57074f10d3
9 changed files with 866 additions and 840 deletions

View File

@ -264,11 +264,13 @@ ASN_MODULE_SOURCES+=BOOLEAN.c
ASN_MODULE_HEADERS+=ENUMERATED.h
ASN_MODULE_SOURCES+=ENUMERATED.c
ASN_MODULE_HEADERS+=INTEGER.h
ASN_MODULE_HEADERS+=NativeEnumerated.h
ASN_MODULE_HEADERS+=GeneralizedTime.h
ASN_MODULE_SOURCES+=GeneralizedTime.c
ASN_MODULE_HEADERS+=IA5String.h
ASN_MODULE_SOURCES+=IA5String.c
ASN_MODULE_SOURCES+=INTEGER.c
ASN_MODULE_SOURCES+=NativeEnumerated.c
ASN_MODULE_HEADERS+=NativeInteger.h
ASN_MODULE_SOURCES+=NativeInteger.c
ASN_MODULE_HEADERS+=NumericString.h
@ -328,6 +330,10 @@ ASN_MODULE_HEADERS+=xer_decoder.h
ASN_MODULE_SOURCES+=xer_decoder.c
ASN_MODULE_HEADERS+=xer_encoder.h
ASN_MODULE_SOURCES+=xer_encoder.c
ASN_MODULE_HEADERS+=per_support.h
ASN_MODULE_SOURCES+=per_support.c
ASN_MODULE_HEADERS+=per_decoder.h
ASN_MODULE_SOURCES+=per_decoder.c
lib_LTLIBRARIES=libsomething.la

View File

@ -19,7 +19,9 @@ void
asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *wc) {
if(wc) {
switch(wc->type) {
case WC_LITERAL: free(wc->content.token); break;
case WC_LITERAL:
case WC_WHITESPACE:
free(wc->content.token); break;
case WC_REFERENCE: asn1p_ref_free(wc->content.ref); break;
case WC_OPTIONALGROUP:
asn1p_wsyntx_free(wc->content.syntax);
@ -35,8 +37,10 @@ asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *wc) {
nc = asn1p_wsyntx_chunk_new();
if(nc) {
nc->type = wc->type;
switch(wc->type) {
case WC_LITERAL:
case WC_WHITESPACE:
nc->content.token = malloc(strlen(wc->content.token)+1);
strcpy(nc->content.token, wc->content.token);
break;

View File

@ -12,11 +12,13 @@
typedef struct asn1p_wsyntx_chunk_s {
enum {
WC_LITERAL,
WC_WHITESPACE,
WC_REFERENCE,
WC_OPTIONALGROUP
} type;
/*
* WC_LITERAL -> {buf, len}
* WC_LITERAL -> {token}
* WC_WHITESPACE -> {token}
* WC_REFERENCE -> {ref}
* WC_OPTIONALGROUP -> {syntax}
*/

View File

@ -2946,7 +2946,7 @@ YY_RULE_SETUP
{
asn1p_lval.tv_opaque.buf = strdup(yytext);
asn1p_lval.tv_opaque.len = yyleng;
return TOK_opaque;
return TOK_whitespace;
}
YY_BREAK
case 130:

View File

@ -413,7 +413,7 @@ WITH return TOK_WITH;
{WSP}+ {
asn1p_lval.tv_opaque.buf = strdup(yytext);
asn1p_lval.tv_opaque.len = yyleng;
return TOK_opaque;
return TOK_whitespace;
}
"}" {

File diff suppressed because it is too large Load Diff

View File

@ -32,106 +32,107 @@ typedef union {
} tv_nametag;
} YYSTYPE;
#define TOK_PPEQ 257
#define TOK_opaque 258
#define TOK_bstring 259
#define TOK_cstring 260
#define TOK_hstring 261
#define TOK_identifier 262
#define TOK_number 263
#define TOK_tuple 264
#define TOK_quadruple 265
#define TOK_number_negative 266
#define TOK_typereference 267
#define TOK_capitalreference 268
#define TOK_typefieldreference 269
#define TOK_valuefieldreference 270
#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
#define TOK_whitespace 258
#define TOK_opaque 259
#define TOK_bstring 260
#define TOK_cstring 261
#define TOK_hstring 262
#define TOK_identifier 263
#define TOK_number 264
#define TOK_tuple 265
#define TOK_quadruple 266
#define TOK_number_negative 267
#define TOK_typereference 268
#define TOK_capitalreference 269
#define TOK_typefieldreference 270
#define TOK_valuefieldreference 271
#define TOK_Literal 272
#define TOK_ABSENT 273
#define TOK_ABSTRACT_SYNTAX 274
#define TOK_ALL 275
#define TOK_ANY 276
#define TOK_APPLICATION 277
#define TOK_AUTOMATIC 278
#define TOK_BEGIN 279
#define TOK_BIT 280
#define TOK_BMPString 281
#define TOK_BOOLEAN 282
#define TOK_BY 283
#define TOK_CHARACTER 284
#define TOK_CHOICE 285
#define TOK_CLASS 286
#define TOK_COMPONENT 287
#define TOK_COMPONENTS 288
#define TOK_CONSTRAINED 289
#define TOK_CONTAINING 290
#define TOK_DEFAULT 291
#define TOK_DEFINITIONS 292
#define TOK_DEFINED 293
#define TOK_EMBEDDED 294
#define TOK_ENCODED 295
#define TOK_ENCODING_CONTROL 296
#define TOK_END 297
#define TOK_ENUMERATED 298
#define TOK_EXPLICIT 299
#define TOK_EXPORTS 300
#define TOK_EXTENSIBILITY 301
#define TOK_EXTERNAL 302
#define TOK_FALSE 303
#define TOK_FROM 304
#define TOK_GeneralizedTime 305
#define TOK_GeneralString 306
#define TOK_GraphicString 307
#define TOK_IA5String 308
#define TOK_IDENTIFIER 309
#define TOK_IMPLICIT 310
#define TOK_IMPLIED 311
#define TOK_IMPORTS 312
#define TOK_INCLUDES 313
#define TOK_INSTANCE 314
#define TOK_INSTRUCTIONS 315
#define TOK_INTEGER 316
#define TOK_ISO646String 317
#define TOK_MAX 318
#define TOK_MIN 319
#define TOK_MINUS_INFINITY 320
#define TOK_NULL 321
#define TOK_NumericString 322
#define TOK_OBJECT 323
#define TOK_ObjectDescriptor 324
#define TOK_OCTET 325
#define TOK_OF 326
#define TOK_OPTIONAL 327
#define TOK_PATTERN 328
#define TOK_PDV 329
#define TOK_PLUS_INFINITY 330
#define TOK_PRESENT 331
#define TOK_PrintableString 332
#define TOK_PRIVATE 333
#define TOK_REAL 334
#define TOK_RELATIVE_OID 335
#define TOK_SEQUENCE 336
#define TOK_SET 337
#define TOK_SIZE 338
#define TOK_STRING 339
#define TOK_SYNTAX 340
#define TOK_T61String 341
#define TOK_TAGS 342
#define TOK_TeletexString 343
#define TOK_TRUE 344
#define TOK_TYPE_IDENTIFIER 345
#define TOK_UNIQUE 346
#define TOK_UNIVERSAL 347
#define TOK_UniversalString 348
#define TOK_UTCTime 349
#define TOK_UTF8String 350
#define TOK_VideotexString 351
#define TOK_VisibleString 352
#define TOK_WITH 353
#define TOK_EXCEPT 354
#define TOK_INTERSECTION 355
#define TOK_UNION 356
#define TOK_TwoDots 357
#define TOK_ThreeDots 358
extern YYSTYPE asn1p_lval;

View File

@ -107,6 +107,7 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
* Token types returned by scanner.
*/
%token TOK_PPEQ /* "::=", Pseudo Pascal EQuality */
%token <tv_opaque> TOK_whitespace /* A span of whitespace */
%token <tv_opaque> TOK_opaque /* opaque data (driven from .y) */
%token <tv_str> TOK_bstring
%token <tv_opaque> TOK_cstring
@ -1073,8 +1074,9 @@ WithSyntaxList:
;
WithSyntaxToken:
TOK_opaque {
TOK_whitespace {
$$ = asn1p_wsyntx_chunk_frombuf($1.buf, $1.len, 0);
$$->type = WC_WHITESPACE;
}
| TOK_Literal {
$$ = asn1p_wsyntx_chunk_frombuf($1, strlen($1), 0);

View File

@ -415,6 +415,7 @@ asn1print_with_syntax(asn1p_wsyntx_t *wx, enum asn1print_flags flags) {
TQ_FOR(wc, &(wx->chunks), next) {
switch(wc->type) {
case WC_LITERAL:
case WC_WHITESPACE:
printf("%s", wc->content.token);
break;
case WC_REFERENCE: