dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnet/cscc/csharp cs_grammar.y, 1.66, 1.67 cs_scann


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnet/cscc/csharp cs_grammar.y, 1.66, 1.67 cs_scanner.l, 1.13, 1.14
Date: Sun, 26 Oct 2003 05:59:55 +0000

Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv20694/cscc/csharp

Modified Files:
        cs_grammar.y cs_scanner.l 
Log Message:


Add new keywords and syntax for the C# 2.0 features anonymous
methods, partial types, and iterators (semantics is not done yet).


Index: cs_scanner.l
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_scanner.l,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** cs_scanner.l        26 Oct 2003 02:47:45 -0000      1.13
--- cs_scanner.l        26 Oct 2003 05:59:53 -0000      1.14
***************
*** 1050,1053 ****
--- 1050,1054 ----
  "override"                            { RETURNTOK(OVERRIDE); }
  "params"                              { RETURNTOK(PARAMS); }
+ "partial"                             { RETURNTOK(PARTIAL); }
  "private"                             { RETURNTOK(PRIVATE); }
  "protected"                           { RETURNTOK(PROTECTED); }
***************
*** 1085,1088 ****
--- 1086,1090 ----
  "where"                                       { RETURNTOK(WHERE); }
  "while"                                       { RETURNTOK(WHILE); }
+ "yield"                                       { RETURNTOK(YIELD); }
  
  {IDALPHA}({DIGIT}|{IDALPHA})*         {

Index: cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** cs_grammar.y        26 Oct 2003 02:47:45 -0000      1.66
--- cs_grammar.y        26 Oct 2003 05:59:53 -0000      1.67
***************
*** 3,7 ****
   * cs_grammar.y - Input file for yacc that defines the syntax of C#.
   *
!  * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
   *
   * This program is free software; you can redistribute it and/or modify
--- 3,7 ----
   * cs_grammar.y - Input file for yacc that defines the syntax of C#.
   *
!  * Copyright (C) 2001, 2002, 2003  Southern Storm Software, Pty Ltd.
   *
   * This program is free software; you can redistribute it and/or modify
***************
*** 734,737 ****
--- 734,738 ----
  
        } target;
+       int                                     partial;
  }
  
***************
*** 804,807 ****
--- 805,809 ----
  %token OVERRIDE                               "`override'"
  %token PARAMS                         "`params'"
+ %token PARTIAL                                "`partial'"
  %token PRIVATE                                "`private'"
  %token PROTECTED                      "`protected'"
***************
*** 839,842 ****
--- 841,845 ----
  %token WHERE                          "`where'"
  %token WHILE                          "`while'"
+ %token YIELD                          "`yield'"
  
  /*
***************
*** 877,880 ****
--- 880,884 ----
  %type <count>         DimensionSeparators DimensionSeparatorList
  %type <mask>          OptModifiers Modifiers Modifier
+ %type <partial>               OptPartial
  
  %type <node>          Identifier QualifiedIdentifier BuiltinType
***************
*** 900,903 ****
--- 904,908 ----
  %type <node>          ObjectCreationExpression OptArgumentList ArgumentList
  %type <node>          Argument PrefixedUnaryExpression GenericReference
+ %type <node>          AnonymousMethod
  
  %type <node>          Statement EmbeddedStatement Block OptStatementList
***************
*** 914,917 ****
--- 919,923 ----
  %type <node>          FixedPointerDeclarators FixedPointerDeclarator
  %type <node>          InnerEmbeddedStatement InnerExpressionStatement
+ %type <node>          YieldStatement
  
  %type <node>          ConstantDeclaration ConstantDeclarators 
ConstantDeclarator
***************
*** 965,969 ****
  %type <target>                AttributeTarget
  
! %expect 31
  
  %start CompilationUnit
--- 971,975 ----
  %type <target>                AttributeTarget
  
! %expect 33
  
  %start CompilationUnit
***************
*** 1106,1109 ****
--- 1112,1117 ----
        | REMOVE                                { $$ = ILInternString("remove", 
6).string; }
        | WHERE                                 { $$ = ILInternString("where", 
5).string; }
+       | PARTIAL                               { $$ = 
ILInternString("partial", 7).string; }
+       | YIELD                                 { $$ = ILInternString("yield", 
5).string; }
        ;
  
***************
*** 1485,1488 ****
--- 1493,1497 ----
        | REFVALUE '(' Expression ',' Type ')'  { MakeBinary(RefValue, $3, $5); 
}
        | MODULE                        { $$ = ILQualIdentSimple("<Module>"); }
+       | DELEGATE AnonymousMethod                              { $$ = $2; }
        ;
  
***************
*** 2002,2005 ****
--- 2011,2015 ----
        | FixedStatement                                { $$ = $1; }
        | UNSAFE Block                                  { MakeUnary(Unsafe, 
$2); }
+       | YieldStatement                                { $$ = $1; }
        | error ';'             {
                                /*
***************
*** 2480,2483 ****
--- 2490,2504 ----
        ;
  
+ YieldStatement
+       : YIELD RETURN Expression ';'           {
+                               $$ = ILNode_Empty_create();
+                               CCError(_("`yield return' is not yet 
supported"));
+                       }
+       | YIELD BREAK ';'               {
+                               $$ = ILNode_Empty_create();
+                               CCError(_("`yield break' is not yet 
supported"));
+                       }
+       ;
+ 
  /*
   * Attributes.
***************
*** 2651,2655 ****
  
  ClassDeclaration
!       : OptAttributes OptModifiers CLASS Identifier TypeFormals
                        ClassBase Constraints {
                                /* Enter a new nesting level */
--- 2672,2676 ----
  
  ClassDeclaration
!       : OptAttributes OptModifiers OptPartial CLASS Identifier TypeFormals
                        ClassBase Constraints {
                                /* Enter a new nesting level */
***************
*** 2657,2668 ****
  
                                /* Push the identifier onto the class name 
stack */
!                               ClassNamePush($4);
                        }
                        ClassBody OptSemiColon  {
!                               ILNode *classBody = ($9).body;
  
                                /* Validate the modifiers */
                                ILUInt32 attrs =
!                                       CSModifiersToTypeAttrs($4, $2, 
(NestingLevel > 1));
  
                                /* Exit the current nesting level */
--- 2678,2689 ----
  
                                /* Push the identifier onto the class name 
stack */
!                               ClassNamePush($5);
                        }
                        ClassBody OptSemiColon  {
!                               ILNode *classBody = ($10).body;
  
                                /* Validate the modifiers */
                                ILUInt32 attrs =
!                                       CSModifiersToTypeAttrs($5, $2, 
(NestingLevel > 1));
  
                                /* Exit the current nesting level */
***************
*** 2698,2709 ****
                                                        ($1,                    
                /* OptAttributes */
                                                         attrs,                 
                /* OptModifiers */
!                                                        ILQualIdentName($4, 
0),/* Identifier */
                                                         CurrNamespace.string,  
/* Namespace */
                                                         (ILNode 
*)CurrNamespaceNode,
!                                                        $5,                    
                /* TypeFormals */
!                                                        $6,                    
                /* ClassBase */
                                                         classBody,
!                                                        ($9).staticCtors);
!                               CloneLine($$, $4);
  
                                /* Pop the class name stack */
--- 2719,2730 ----
                                                        ($1,                    
                /* OptAttributes */
                                                         attrs,                 
                /* OptModifiers */
!                                                        ILQualIdentName($5, 
0),/* Identifier */
                                                         CurrNamespace.string,  
/* Namespace */
                                                         (ILNode 
*)CurrNamespaceNode,
!                                                        $6,                    
                /* TypeFormals */
!                                                        $7,                    
                /* ClassBase */
                                                         classBody,
!                                                        ($10).staticCtors);
!                               CloneLine($$, $5);
  
                                /* Pop the class name stack */
***************
*** 2856,2859 ****
--- 2877,2888 ----
        ;
  
+ OptPartial
+       : /* empty */                           { $$ = 0; }
+       | PARTIAL                                       {
+                               $$ = 1;
+                               CCError(_("partial types are not yet 
supported"));
+                       }
+       ;
+ 
  /*
   * Constants.
***************
*** 3518,3522 ****
  
  StructDeclaration
!       : OptAttributes OptModifiers STRUCT Identifier TypeFormals
                        StructInterfaces Constraints {
                                /* Enter a new nesting level */
--- 3547,3551 ----
  
  StructDeclaration
!       : OptAttributes OptModifiers OptPartial STRUCT Identifier TypeFormals
                        StructInterfaces Constraints {
                                /* Enter a new nesting level */
***************
*** 3524,3528 ****
  
                                /* Push the identifier onto the class name 
stack */
!                               ClassNamePush($4);
                        }
                        StructBody OptSemiColon {
--- 3553,3557 ----
  
                                /* Push the identifier onto the class name 
stack */
!                               ClassNamePush($5);
                        }
                        StructBody OptSemiColon {
***************
*** 3531,3535 ****
  
                                /* Validate the modifiers */
!                               attrs = CSModifiersToTypeAttrs($4, $2, 
(NestingLevel > 1));
  
                                /* Add extra attributes that structs need */
--- 3560,3564 ----
  
                                /* Validate the modifiers */
!                               attrs = CSModifiersToTypeAttrs($5, $2, 
(NestingLevel > 1));
  
                                /* Add extra attributes that structs need */
***************
*** 3543,3549 ****
                                /* Make sure that we have "ValueType" in the 
base list */
                                baseList = MakeSystemType("ValueType");
!                               if($6 != 0)
                                {
!                                       baseList = ILNode_ArgList_create($6, 
baseList);
                                }
  
--- 3572,3578 ----
                                /* Make sure that we have "ValueType" in the 
base list */
                                baseList = MakeSystemType("ValueType");
!                               if($7 != 0)
                                {
!                                       baseList = ILNode_ArgList_create($7, 
baseList);
                                }
  
***************
*** 3553,3564 ****
                                                        ($1,                    
                /* OptAttributes */
                                                         attrs,                 
                /* OptModifiers */
!                                                        ILQualIdentName($4, 
0),/* Identifier */
                                                         CurrNamespace.string,  
/* Namespace */
                                                         (ILNode 
*)CurrNamespaceNode,
!                                                        $5,                    
                /* TypeFormals */
                                                         baseList,              
                /* ClassBase */
!                                                        ($9).body,             
                /* StructBody */
!                                                        ($9).staticCtors);     
        /* StaticCtors */
!                               CloneLine($$, $4);
  
                                /* Pop the class name stack */
--- 3582,3593 ----
                                                        ($1,                    
                /* OptAttributes */
                                                         attrs,                 
                /* OptModifiers */
!                                                        ILQualIdentName($5, 
0),/* Identifier */
                                                         CurrNamespace.string,  
/* Namespace */
                                                         (ILNode 
*)CurrNamespaceNode,
!                                                        $6,                    
                /* TypeFormals */
                                                         baseList,              
                /* ClassBase */
!                                                        ($10).body,            
                /* StructBody */
!                                                        ($10).staticCtors);    
        /* StaticCtors */
!                               CloneLine($$, $5);
  
                                /* Pop the class name stack */
***************
*** 3592,3596 ****
  
  InterfaceDeclaration
!       : OptAttributes OptModifiers INTERFACE Identifier TypeFormals
                        InterfaceBase Constraints {
                                /* Increase the nesting level */
--- 3621,3625 ----
  
  InterfaceDeclaration
!       : OptAttributes OptModifiers OptPartial INTERFACE Identifier TypeFormals
                        InterfaceBase Constraints {
                                /* Increase the nesting level */
***************
*** 3598,3607 ****
  
                                /* Push the identifier onto the class name 
stack */
!                               ClassNamePush($4);
                        }
                        InterfaceBody OptSemiColon      {
                                /* Validate the modifiers */
                                ILUInt32 attrs =
!                                       CSModifiersToTypeAttrs($4, $2, 
(NestingLevel > 1));
  
                                /* Add extra attributes that interfaces need */
--- 3627,3636 ----
  
                                /* Push the identifier onto the class name 
stack */
!                               ClassNamePush($5);
                        }
                        InterfaceBody OptSemiColon      {
                                /* Validate the modifiers */
                                ILUInt32 attrs =
!                                       CSModifiersToTypeAttrs($5, $2, 
(NestingLevel > 1));
  
                                /* Add extra attributes that interfaces need */
***************
*** 3617,3628 ****
                                                        ($1,                    
                /* OptAttributes */
                                                         attrs,                 
                /* OptModifiers */
!                                                        ILQualIdentName($4, 
0),/* Identifier */
                                                         CurrNamespace.string,  
/* Namespace */
                                                         (ILNode 
*)CurrNamespaceNode,
!                                                        $5,                    
                /* TypeFormals */
!                                                        $6,                    
                /* ClassBase */
!                                                        $9,                    
                /* InterfaceBody */
                                                         0);                    
                /* StaticCtors */
!                               CloneLine($$, $4);
  
                                /* Pop the class name stack */
--- 3646,3657 ----
                                                        ($1,                    
                /* OptAttributes */
                                                         attrs,                 
                /* OptModifiers */
!                                                        ILQualIdentName($5, 
0),/* Identifier */
                                                         CurrNamespace.string,  
/* Namespace */
                                                         (ILNode 
*)CurrNamespaceNode,
!                                                        $6,                    
                /* TypeFormals */
!                                                        $7,                    
                /* ClassBase */
!                                                        $10,                   
                /* InterfaceBody */
                                                         0);                    
                /* StaticCtors */
!                               CloneLine($$, $5);
  
                                /* Pop the class name stack */
***************
*** 3941,3944 ****
--- 3970,3988 ----
                                /* We have declarations at the top-most level 
of the file */
                                HaveDecls = 1;
+                       }
+       ;
+ 
+ /*
+  * Anonymous method declarations.
+  */
+ 
+ AnonymousMethod
+       : Block                 {
+                               $$ = ILNode_Null_create();
+                               CCError(_("anonymous methods are not yet 
supported"));
+                       }
+       | '(' OptFormalParameterList ')' Block  {
+                               $$ = ILNode_Null_create();
+                               CCError(_("anonymous methods are not yet 
supported"));
                        }
        ;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]