Author: metze
Date: 2007-10-25 19:50:34 +0000 (Thu, 25 Oct 2007)
New Revision: 25732

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25732

Log:
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

Modified:
   branches/SAMBA_4_0/source/heimdal/lib/asn1/parse.y
   branches/SAMBA_4_0/source/heimdal/lib/com_err/parse.y


Changeset:
Modified: branches/SAMBA_4_0/source/heimdal/lib/asn1/parse.y
===================================================================
--- branches/SAMBA_4_0/source/heimdal/lib/asn1/parse.y  2007-10-25 11:26:02 UTC 
(rev 25731)
+++ branches/SAMBA_4_0/source/heimdal/lib/asn1/parse.y  2007-10-25 19:50:34 UTC 
(rev 25732)
@@ -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 @@
 %union {
     int constant;
     struct value *value;
-    struct range range;
+    struct range *range;
     char *name;
     Type *type;
     Member *member;
@@ -214,7 +214,7 @@
 %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 @@
 %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 @@
 
 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 @@
                | 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 @@
                                     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 @@
                }
                ;
 
+size           :
+               { $$ = NULL; }
+               | kw_SIZE range
+               { $$ = $2; }
+               ;
+
+
 SequenceType   : kw_SEQUENCE '{' /* ComponentTypeLists */ ComponentTypeList '}'
                {
                  $$ = new_type(TSequence);
@@ -453,10 +490,11 @@
                }
                ;
 
-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, $$);
                }
                ;

Modified: branches/SAMBA_4_0/source/heimdal/lib/com_err/parse.y
===================================================================
--- branches/SAMBA_4_0/source/heimdal/lib/com_err/parse.y       2007-10-25 
11:26:02 UTC (rev 25731)
+++ branches/SAMBA_4_0/source/heimdal/lib/com_err/parse.y       2007-10-25 
19:50:34 UTC (rev 25732)
@@ -35,7 +35,7 @@
 #include "compile_et.h"
 #include "lex.h"
 
-RCSID("$Id: parse.y,v 1.15 2005/06/16 19:21:42 lha Exp $");
+RCSID("$Id: parse.y 15426 2005-06-16 19:21:42Z lha $");
 
 void yyerror (char *s);
 static long name2number(const char *str);

Reply via email to