diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-10-25 19:50:34 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:43:32 +0100 |
commit | 12215fadf8c0122ff9da58ebaab49fde5247d378 (patch) | |
tree | 85fb87bd0fb757fb433eab95c3ebcbcee23ec876 /source4/heimdal/lib/asn1/parse.y | |
parent | cfd09eed406704e51f40010dc0de664809def4cc (diff) | |
download | samba-12215fadf8c0122ff9da58ebaab49fde5247d378.tar.gz samba-12215fadf8c0122ff9da58ebaab49fde5247d378.tar.bz2 samba-12215fadf8c0122ff9da58ebaab49fde5247d378.zip |
r25732: import updated parse.y files from lorikeet-heimdal
I wonder why they're not updated as the parse.[ch]
are generated from the new versions already...
metze
(This used to be commit 9735715a0f2c8ea0c6ff5ba5adde6b6a6fb43aed)
Diffstat (limited to 'source4/heimdal/lib/asn1/parse.y')
-rw-r--r-- | source4/heimdal/lib/asn1/parse.y | 74 |
1 files changed, 56 insertions, 18 deletions
diff --git a/source4/heimdal/lib/asn1/parse.y b/source4/heimdal/lib/asn1/parse.y index 029cef9f0f..772f2b1bc1 100644 --- a/source4/heimdal/lib/asn1/parse.y +++ b/source4/heimdal/lib/asn1/parse.y @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2007 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: parse.y,v 1.29 2006/12/28 17:15:02 lha Exp $ */ +/* $Id: parse.y 21597 2007-07-16 18:48:58Z lha $ */ %{ #ifdef HAVE_CONFIG_H @@ -45,7 +45,7 @@ #include "gen_locl.h" #include "der.h" -RCSID("$Id: parse.y,v 1.29 2006/12/28 17:15:02 lha Exp $"); +RCSID("$Id: parse.y 21597 2007-07-16 18:48:58Z lha $"); static Type *new_type (Typetype t); static struct constraint_spec *new_constraint_spec(enum ctype); @@ -65,7 +65,7 @@ struct string_list { %union { int constant; struct value *value; - struct range range; + struct range *range; char *name; Type *type; Member *member; @@ -214,7 +214,7 @@ struct string_list { %type <members> NamedNumberList %type <objid> objid objid_list objid_element objid_opt -%type <range> range +%type <range> range size %type <sl> referencenames @@ -224,11 +224,13 @@ struct string_list { %type <constraint_spec> ContentsConstraint %type <constraint_spec> UserDefinedConstraint + + %start ModuleDefinition %% -ModuleDefinition: IDENTIFIER kw_DEFINITIONS TagDefault ExtensionDefault +ModuleDefinition: IDENTIFIER objid_opt kw_DEFINITIONS TagDefault ExtensionDefault EEQUAL kw_BEGIN ModuleBody kw_END { checkundefined(); @@ -337,14 +339,41 @@ BooleanType : kw_BOOLEAN range : '(' Value RANGE Value ')' { - if($2->type != integervalue || - $4->type != integervalue) - error_message("Non-integer value used in range"); - $$.min = $2->u.integervalue; - $$.max = $4->u.integervalue; + if($2->type != integervalue) + error_message("Non-integer used in first part of range"); + if($2->type != integervalue) + error_message("Non-integer in second part of range"); + $$ = ecalloc(1, sizeof(*$$)); + $$->min = $2->u.integervalue; + $$->max = $4->u.integervalue; + } + | '(' Value RANGE kw_MAX ')' + { + if($2->type != integervalue) + error_message("Non-integer in first part of range"); + $$ = ecalloc(1, sizeof(*$$)); + $$->min = $2->u.integervalue; + $$->max = $2->u.integervalue - 1; + } + | '(' kw_MIN RANGE Value ')' + { + if($4->type != integervalue) + error_message("Non-integer in second part of range"); + $$ = ecalloc(1, sizeof(*$$)); + $$->min = $4->u.integervalue + 2; + $$->max = $4->u.integervalue; + } + | '(' Value ')' + { + if($2->type != integervalue) + error_message("Non-integer used in limit"); + $$ = ecalloc(1, sizeof(*$$)); + $$->min = $2->u.integervalue; + $$->max = $2->u.integervalue; } ; + IntegerType : kw_INTEGER { $$ = new_tag(ASN1_C_UNIV, UT_Integer, @@ -353,8 +382,7 @@ IntegerType : kw_INTEGER | kw_INTEGER range { $$ = new_type(TInteger); - $$->range = emalloc(sizeof(*$$->range)); - *($$->range) = $2; + $$->range = $2; $$ = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, $$); } | kw_INTEGER '{' NamedNumberList '}' @@ -425,10 +453,12 @@ ObjectIdentifierType: kw_OBJECT kw_IDENTIFIER TE_EXPLICIT, new_type(TOID)); } ; -OctetStringType : kw_OCTET kw_STRING +OctetStringType : kw_OCTET kw_STRING size { - $$ = new_tag(ASN1_C_UNIV, UT_OctetString, - TE_EXPLICIT, new_type(TOctetString)); + Type *t = new_type(TOctetString); + t->range = $3; + $$ = new_tag(ASN1_C_UNIV, UT_OctetString, + TE_EXPLICIT, t); } ; @@ -439,6 +469,13 @@ NullType : kw_NULL } ; +size : + { $$ = NULL; } + | kw_SIZE range + { $$ = $2; } + ; + + SequenceType : kw_SEQUENCE '{' /* ComponentTypeLists */ ComponentTypeList '}' { $$ = new_type(TSequence); @@ -453,10 +490,11 @@ SequenceType : kw_SEQUENCE '{' /* ComponentTypeLists */ ComponentTypeList '}' } ; -SequenceOfType : kw_SEQUENCE kw_OF Type +SequenceOfType : kw_SEQUENCE size kw_OF Type { $$ = new_type(TSequenceOf); - $$->subtype = $3; + $$->range = $2; + $$->subtype = $4; $$ = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, $$); } ; |