Commit 0e90aa04 authored by Lev Walkin's avatar Lev Walkin
Browse files

parsing-level support for [[ extension brackets ]]

parent 46755ce2
......@@ -214,6 +214,18 @@ asn1p_expr_add(asn1p_expr_t *to, asn1p_expr_t *what) {
what->parent_expr = to;
}
/*
* Add inner expressions as members of another.
*/
void
asn1p_expr_add_many(asn1p_expr_t *to, asn1p_expr_t *from_what) {
asn1p_expr_t *expr;
TQ_FOR(expr, &(from_what->members), next) {
expr->parent_expr = to;
}
TQ_CONCAT(&(to->members), &(from_what->members), next);
}
/*
* Destruct the types collection structure.
......
......@@ -278,6 +278,7 @@ asn1p_expr_t *asn1p_expr_clone_with_resolver(asn1p_expr_t *,
asn1p_expr_t *(*resolver)(asn1p_expr_t *to_resolve, void *resolver_arg),
void *resolver_arg);
void asn1p_expr_add(asn1p_expr_t *to, asn1p_expr_t *what);
void asn1p_expr_add_many(asn1p_expr_t *to, asn1p_expr_t *from_what);
void asn1p_expr_free(asn1p_expr_t *expr);
#define TAG2STRING_BUFFER_SIZE 64 /* buf should be at least this big */
......
This diff is collapsed.
......@@ -510,6 +510,9 @@ WITH return TOK_WITH;
}
"[[" return TOK_VBracketLeft;
"]]" return TOK_VBracketRight;
[(){},;:|!.&@\[\]^] return yytext[0];
[^A-Za-z0-9:=,{}<.@()[]'\"|&^*;!-] {
......
......@@ -45,6 +45,14 @@
(head)->tq_tail = &TQ_NEXT((__el), field); \
} while(0)
#define TQ_CONCAT(head1, head2, field) do { \
if(TQ_FIRST(head2)) { \
*(head1)->tq_tail = (head2)->tq_head; \
(head1)->tq_tail = (head2)->tq_tail; \
TQ_INIT(head2); \
} \
} while(0)
/*
* Remove the first element and return it.
*/
......
This diff is collapsed.
/* A Bison parser, made from asn1p_y.y, by GNU bison 1.75. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -15,16 +17,21 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
#ifndef BISON_ASN_P_Y_H
# define BISON_ASN_P_Y_H
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
......@@ -33,220 +40,226 @@
know about them. */
enum yytokentype {
TOK_PPEQ = 258,
TOK_whitespace = 259,
TOK_opaque = 260,
TOK_bstring = 261,
TOK_cstring = 262,
TOK_hstring = 263,
TOK_identifier = 264,
TOK_number = 265,
TOK_number_negative = 266,
TOK_realnumber = 267,
TOK_tuple = 268,
TOK_quadruple = 269,
TOK_typereference = 270,
TOK_capitalreference = 271,
TOK_typefieldreference = 272,
TOK_valuefieldreference = 273,
TOK_Literal = 274,
TOK_ABSENT = 275,
TOK_ABSTRACT_SYNTAX = 276,
TOK_ALL = 277,
TOK_ANY = 278,
TOK_APPLICATION = 279,
TOK_AUTOMATIC = 280,
TOK_BEGIN = 281,
TOK_BIT = 282,
TOK_BMPString = 283,
TOK_BOOLEAN = 284,
TOK_BY = 285,
TOK_CHARACTER = 286,
TOK_CHOICE = 287,
TOK_CLASS = 288,
TOK_COMPONENT = 289,
TOK_COMPONENTS = 290,
TOK_CONSTRAINED = 291,
TOK_CONTAINING = 292,
TOK_DEFAULT = 293,
TOK_DEFINITIONS = 294,
TOK_DEFINED = 295,
TOK_EMBEDDED = 296,
TOK_ENCODED = 297,
TOK_ENCODING_CONTROL = 298,
TOK_END = 299,
TOK_ENUMERATED = 300,
TOK_EXPLICIT = 301,
TOK_EXPORTS = 302,
TOK_EXTENSIBILITY = 303,
TOK_EXTERNAL = 304,
TOK_FALSE = 305,
TOK_FROM = 306,
TOK_GeneralizedTime = 307,
TOK_GeneralString = 308,
TOK_GraphicString = 309,
TOK_IA5String = 310,
TOK_IDENTIFIER = 311,
TOK_IMPLICIT = 312,
TOK_IMPLIED = 313,
TOK_IMPORTS = 314,
TOK_INCLUDES = 315,
TOK_INSTANCE = 316,
TOK_INSTRUCTIONS = 317,
TOK_INTEGER = 318,
TOK_ISO646String = 319,
TOK_MAX = 320,
TOK_MIN = 321,
TOK_MINUS_INFINITY = 322,
TOK_NULL = 323,
TOK_NumericString = 324,
TOK_OBJECT = 325,
TOK_ObjectDescriptor = 326,
TOK_OCTET = 327,
TOK_OF = 328,
TOK_OPTIONAL = 329,
TOK_PATTERN = 330,
TOK_PDV = 331,
TOK_PLUS_INFINITY = 332,
TOK_PRESENT = 333,
TOK_PrintableString = 334,
TOK_PRIVATE = 335,
TOK_REAL = 336,
TOK_RELATIVE_OID = 337,
TOK_SEQUENCE = 338,
TOK_SET = 339,
TOK_SIZE = 340,
TOK_STRING = 341,
TOK_SYNTAX = 342,
TOK_T61String = 343,
TOK_TAGS = 344,
TOK_TeletexString = 345,
TOK_TRUE = 346,
TOK_TYPE_IDENTIFIER = 347,
TOK_UNIQUE = 348,
TOK_UNIVERSAL = 349,
TOK_UniversalString = 350,
TOK_UTCTime = 351,
TOK_UTF8String = 352,
TOK_VideotexString = 353,
TOK_VisibleString = 354,
TOK_WITH = 355,
TOK_EXCEPT = 356,
TOK_INTERSECTION = 357,
TOK_UNION = 358,
TOK_TwoDots = 359,
TOK_ThreeDots = 360
TOK_VBracketLeft = 259,
TOK_VBracketRight = 260,
TOK_whitespace = 261,
TOK_opaque = 262,
TOK_bstring = 263,
TOK_cstring = 264,
TOK_hstring = 265,
TOK_identifier = 266,
TOK_number = 267,
TOK_number_negative = 268,
TOK_realnumber = 269,
TOK_tuple = 270,
TOK_quadruple = 271,
TOK_typereference = 272,
TOK_capitalreference = 273,
TOK_typefieldreference = 274,
TOK_valuefieldreference = 275,
TOK_Literal = 276,
TOK_ABSENT = 277,
TOK_ABSTRACT_SYNTAX = 278,
TOK_ALL = 279,
TOK_ANY = 280,
TOK_APPLICATION = 281,
TOK_AUTOMATIC = 282,
TOK_BEGIN = 283,
TOK_BIT = 284,
TOK_BMPString = 285,
TOK_BOOLEAN = 286,
TOK_BY = 287,
TOK_CHARACTER = 288,
TOK_CHOICE = 289,
TOK_CLASS = 290,
TOK_COMPONENT = 291,
TOK_COMPONENTS = 292,
TOK_CONSTRAINED = 293,
TOK_CONTAINING = 294,
TOK_DEFAULT = 295,
TOK_DEFINITIONS = 296,
TOK_DEFINED = 297,
TOK_EMBEDDED = 298,
TOK_ENCODED = 299,
TOK_ENCODING_CONTROL = 300,
TOK_END = 301,
TOK_ENUMERATED = 302,
TOK_EXPLICIT = 303,
TOK_EXPORTS = 304,
TOK_EXTENSIBILITY = 305,
TOK_EXTERNAL = 306,
TOK_FALSE = 307,
TOK_FROM = 308,
TOK_GeneralizedTime = 309,
TOK_GeneralString = 310,
TOK_GraphicString = 311,
TOK_IA5String = 312,
TOK_IDENTIFIER = 313,
TOK_IMPLICIT = 314,
TOK_IMPLIED = 315,
TOK_IMPORTS = 316,
TOK_INCLUDES = 317,
TOK_INSTANCE = 318,
TOK_INSTRUCTIONS = 319,
TOK_INTEGER = 320,
TOK_ISO646String = 321,
TOK_MAX = 322,
TOK_MIN = 323,
TOK_MINUS_INFINITY = 324,
TOK_NULL = 325,
TOK_NumericString = 326,
TOK_OBJECT = 327,
TOK_ObjectDescriptor = 328,
TOK_OCTET = 329,
TOK_OF = 330,
TOK_OPTIONAL = 331,
TOK_PATTERN = 332,
TOK_PDV = 333,
TOK_PLUS_INFINITY = 334,
TOK_PRESENT = 335,
TOK_PrintableString = 336,
TOK_PRIVATE = 337,
TOK_REAL = 338,
TOK_RELATIVE_OID = 339,
TOK_SEQUENCE = 340,
TOK_SET = 341,
TOK_SIZE = 342,
TOK_STRING = 343,
TOK_SYNTAX = 344,
TOK_T61String = 345,
TOK_TAGS = 346,
TOK_TeletexString = 347,
TOK_TRUE = 348,
TOK_TYPE_IDENTIFIER = 349,
TOK_UNIQUE = 350,
TOK_UNIVERSAL = 351,
TOK_UniversalString = 352,
TOK_UTCTime = 353,
TOK_UTF8String = 354,
TOK_VideotexString = 355,
TOK_VisibleString = 356,
TOK_WITH = 357,
TOK_EXCEPT = 358,
TOK_INTERSECTION = 359,
TOK_UNION = 360,
TOK_TwoDots = 361,
TOK_ThreeDots = 362
};
#endif
/* Tokens. */
#define TOK_PPEQ 258
#define TOK_whitespace 259
#define TOK_opaque 260
#define TOK_bstring 261
#define TOK_cstring 262
#define TOK_hstring 263
#define TOK_identifier 264
#define TOK_number 265
#define TOK_number_negative 266
#define TOK_realnumber 267
#define TOK_tuple 268
#define TOK_quadruple 269
#define TOK_typereference 270
#define TOK_capitalreference 271
#define TOK_typefieldreference 272
#define TOK_valuefieldreference 273
#define TOK_Literal 274
#define TOK_ABSENT 275
#define TOK_ABSTRACT_SYNTAX 276
#define TOK_ALL 277
#define TOK_ANY 278
#define TOK_APPLICATION 279
#define TOK_AUTOMATIC 280
#define TOK_BEGIN 281
#define TOK_BIT 282
#define TOK_BMPString 283
#define TOK_BOOLEAN 284
#define TOK_BY 285
#define TOK_CHARACTER 286
#define TOK_CHOICE 287
#define TOK_CLASS 288
#define TOK_COMPONENT 289
#define TOK_COMPONENTS 290
#define TOK_CONSTRAINED 291
#define TOK_CONTAINING 292
#define TOK_DEFAULT 293
#define TOK_DEFINITIONS 294
#define TOK_DEFINED 295
#define TOK_EMBEDDED 296
#define TOK_ENCODED 297
#define TOK_ENCODING_CONTROL 298
#define TOK_END 299
#define TOK_ENUMERATED 300
#define TOK_EXPLICIT 301
#define TOK_EXPORTS 302
#define TOK_EXTENSIBILITY 303
#define TOK_EXTERNAL 304
#define TOK_FALSE 305
#define TOK_FROM 306
#define TOK_GeneralizedTime 307
#define TOK_GeneralString 308
#define TOK_GraphicString 309
#define TOK_IA5String 310
#define TOK_IDENTIFIER 311
#define TOK_IMPLICIT 312
#define TOK_IMPLIED 313
#define TOK_IMPORTS 314
#define TOK_INCLUDES 315
#define TOK_INSTANCE 316
#define TOK_INSTRUCTIONS 317
#define TOK_INTEGER 318
#define TOK_ISO646String 319
#define TOK_MAX 320
#define TOK_MIN 321
#define TOK_MINUS_INFINITY 322
#define TOK_NULL 323
#define TOK_NumericString 324
#define TOK_OBJECT 325
#define TOK_ObjectDescriptor 326
#define TOK_OCTET 327
#define TOK_OF 328
#define TOK_OPTIONAL 329
#define TOK_PATTERN 330
#define TOK_PDV 331
#define TOK_PLUS_INFINITY 332
#define TOK_PRESENT 333
#define TOK_PrintableString 334
#define TOK_PRIVATE 335
#define TOK_REAL 336
#define TOK_RELATIVE_OID 337
#define TOK_SEQUENCE 338
#define TOK_SET 339
#define TOK_SIZE 340
#define TOK_STRING 341
#define TOK_SYNTAX 342
#define TOK_T61String 343
#define TOK_TAGS 344
#define TOK_TeletexString 345
#define TOK_TRUE 346
#define TOK_TYPE_IDENTIFIER 347
#define TOK_UNIQUE 348
#define TOK_UNIVERSAL 349
#define TOK_UniversalString 350
#define TOK_UTCTime 351
#define TOK_UTF8String 352
#define TOK_VideotexString 353
#define TOK_VisibleString 354
#define TOK_WITH 355
#define TOK_EXCEPT 356
#define TOK_INTERSECTION 357
#define TOK_UNION 358
#define TOK_TwoDots 359
#define TOK_ThreeDots 360
#define TOK_VBracketLeft 259
#define TOK_VBracketRight 260
#define TOK_whitespace 261
#define TOK_opaque 262
#define TOK_bstring 263
#define TOK_cstring 264
#define TOK_hstring 265
#define TOK_identifier 266
#define TOK_number 267
#define TOK_number_negative 268
#define TOK_realnumber 269
#define TOK_tuple 270
#define TOK_quadruple 271
#define TOK_typereference 272
#define TOK_capitalreference 273
#define TOK_typefieldreference 274
#define TOK_valuefieldreference 275
#define TOK_Literal 276
#define TOK_ABSENT 277
#define TOK_ABSTRACT_SYNTAX 278
#define TOK_ALL 279
#define TOK_ANY 280
#define TOK_APPLICATION 281
#define TOK_AUTOMATIC 282
#define TOK_BEGIN 283
#define TOK_BIT 284
#define TOK_BMPString 285
#define TOK_BOOLEAN 286
#define TOK_BY 287
#define TOK_CHARACTER 288
#define TOK_CHOICE 289
#define TOK_CLASS 290
#define TOK_COMPONENT 291
#define TOK_COMPONENTS 292
#define TOK_CONSTRAINED 293
#define TOK_CONTAINING 294
#define TOK_DEFAULT 295
#define TOK_DEFINITIONS 296
#define TOK_DEFINED 297
#define TOK_EMBEDDED 298
#define TOK_ENCODED 299
#define TOK_ENCODING_CONTROL 300
#define TOK_END 301
#define TOK_ENUMERATED 302
#define TOK_EXPLICIT 303
#define TOK_EXPORTS 304
#define TOK_EXTENSIBILITY 305
#define TOK_EXTERNAL 306
#define TOK_FALSE 307
#define TOK_FROM 308
#define TOK_GeneralizedTime 309
#define TOK_GeneralString 310
#define TOK_GraphicString 311
#define TOK_IA5String 312
#define TOK_IDENTIFIER 313
#define TOK_IMPLICIT 314
#define TOK_IMPLIED 315
#define TOK_IMPORTS 316
#define TOK_INCLUDES 317
#define TOK_INSTANCE 318
#define TOK_INSTRUCTIONS 319
#define TOK_INTEGER 320
#define TOK_ISO646String 321
#define TOK_MAX 322
#define TOK_MIN 323
#define TOK_MINUS_INFINITY 324
#define TOK_NULL 325
#define TOK_NumericString 326
#define TOK_OBJECT 327
#define TOK_ObjectDescriptor 328
#define TOK_OCTET 329
#define TOK_OF 330
#define TOK_OPTIONAL 331
#define TOK_PATTERN 332
#define TOK_PDV 333
#define TOK_PLUS_INFINITY 334
#define TOK_PRESENT 335
#define TOK_PrintableString 336
#define TOK_PRIVATE 337
#define TOK_REAL 338
#define TOK_RELATIVE_OID 339
#define TOK_SEQUENCE 340
#define TOK_SET 341
#define TOK_SIZE 342
#define TOK_STRING 343
#define TOK_SYNTAX 344
#define TOK_T61String 345
#define TOK_TAGS 346
#define TOK_TeletexString 347
#define TOK_TRUE 348
#define TOK_TYPE_IDENTIFIER 349
#define TOK_UNIQUE 350
#define TOK_UNIVERSAL 351
#define TOK_UniversalString 352
#define TOK_UTCTime 353
#define TOK_UTF8String 354
#define TOK_VideotexString 355
#define TOK_VisibleString 356
#define TOK_WITH 357
#define TOK_EXCEPT 358
#define TOK_INTERSECTION 359
#define TOK_UNION 360
#define TOK_TwoDots 361
#define TOK_ThreeDots 362
#ifndef YYSTYPE
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 88 "asn1p_y.y"
typedef union {
{
asn1p_t *a_grammar;
asn1p_module_flags_e a_module_flags;
asn1p_module_t *a_module;
......@@ -279,14 +292,14 @@ typedef union {
char *name;
struct asn1p_type_tag_s tag;
} tv_nametag;
} yystype;
/* Line 1281 of /usr/local/share/bison/yacc.c. */
#line 285 "asn1p_y.h"
# define YYSTYPE yystype
}
/* Line 1529 of yacc.c. */
#line 298 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE asn1p_lval;
#endif /* not BISON_ASN_P_Y_H */
......@@ -124,6 +124,7 @@ static asn1p_module_t *currentModule;
* Token types returned by scanner.
*/
%token TOK_PPEQ /* "::=", Pseudo Pascal EQuality */
%token TOK_VBracketLeft TOK_VBracketRight /* "[[", "]]" */
%token <tv_opaque> TOK_whitespace /* A span of whitespace */
%token <tv_opaque> TOK_opaque /* opaque data (driven from .y) */
%token <tv_str> TOK_bstring
......@@ -970,6 +971,10 @@ ComponentTypeLists:
$$ = $1;
asn1p_expr_add($$, $3);
}
| ComponentTypeLists ',' TOK_VBracketLeft ComponentTypeLists TOK_VBracketRight {
$$ = $1;
asn1p_expr_add_many($$, $4);
}
;
ComponentType:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment