[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.45,1.46 cs_s
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.45,1.46 cs_scanner.l,1.8,1.9 |
Date: |
Tue, 18 Feb 2003 00:25:12 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv8588/cscc/csharp
Modified Files:
cs_grammar.y cs_scanner.l
Log Message:
Add support for Generic IL to "image", "ilasm", and "ildasm"; some
syntax extensions for Generic C#, but no semantic analysis (yet).
Index: cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** cs_grammar.y 12 Dec 2002 17:04:44 -0000 1.45
--- cs_grammar.y 18 Feb 2003 05:25:07 -0000 1.46
***************
*** 787,790 ****
--- 787,791 ----
%token VOID "`void'"
%token VOLATILE "`volatile'"
+ %token WHERE "`where'"
%token WHILE "`while'"
***************
*** 827,830 ****
--- 828,832 ----
%type <node> Identifier QualifiedIdentifier BuiltinType
+ %type <node> QualifiedIdentifierPart
%type <node> Type NonExpressionType LocalVariableType
***************
*** 911,915 ****
%type <target> AttributeTarget
! %expect 17
%start CompilationUnit
--- 913,917 ----
%type <target> AttributeTarget
! %expect 21
%start CompilationUnit
***************
*** 1046,1051 ****
QualifiedIdentifier
: Identifier { $$ =
$1; }
! | QualifiedIdentifier '.' Identifier { MakeBinary(QualIdent, $1,
$3); }
;
--- 1048,1060 ----
QualifiedIdentifier
+ : QualifiedIdentifierPart
{ $$ = $1; }
+ | QualifiedIdentifier '.' QualifiedIdentifierPart {
+ MakeBinary(QualIdent, $1, $3);
+ }
+ ;
+
+ QualifiedIdentifierPart
: Identifier { $$ =
$1; }
! | Identifier '<' TypeActuals '>' { $$ = $1; /* TODO */ }
;
***************
*** 1230,1233 ****
--- 1239,1246 ----
MakeUnary(PtrType, $1);
}
+ | Type '<' TypeActuals '>' {
+ /* TODO: generic type references */
+ $$ = $1;
+ }
;
***************
*** 1243,1246 ****
--- 1256,1268 ----
MakeUnary(PtrType, $1);
}
+ | NonExpressionType '<' TypeActuals '>' {
+ /* TODO: generic type references */
+ $$ = $1;
+ }
+ ;
+
+ TypeActuals
+ : Type { /* TODO */ }
+ | TypeActuals ',' Type { /* TODO */ }
;
***************
*** 1320,1323 ****
--- 1342,1348 ----
*/
+ /* TODO: Identifier '<' TypeActuals '>' for generic type references.
+ A bit problematic at the moment due to reduce/reduce issues */
+
PrimaryExpression
: LiteralExpression { $$ = $1; }
***************
*** 2499,2503 ****
ClassDeclaration
! : OptAttributes OptModifiers CLASS Identifier ClassBase {
/* Enter a new nesting level */
++NestingLevel;
--- 2524,2529 ----
ClassDeclaration
! : OptAttributes OptModifiers CLASS Identifier TypeFormals
! ClassBase Constraints {
/* Enter a new nesting level */
++NestingLevel;
***************
*** 2507,2511 ****
}
ClassBody OptSemiColon {
! ILNode *classBody = ($7).body;
/* Validate the modifiers */
--- 2533,2537 ----
}
ClassBody OptSemiColon {
! ILNode *classBody = ($9).body;
/* Validate the modifiers */
***************
*** 2548,2554 ****
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
! $5,
/* ClassBase */
classBody,
! ($7).staticCtors);
CloneLine($$, $4);
--- 2574,2580 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
! $6,
/* ClassBase */
classBody,
! ($9).staticCtors);
CloneLine($$, $4);
***************
*** 2561,2564 ****
--- 2587,2617 ----
;
+ /* TODO: general parameter formal parameter list */
+ TypeFormals
+ : /* empty */
+ | '<' TypeFormalList '>'
+ ;
+
+ TypeFormalList
+ : Identifier { /* TODO */ }
+ | TypeFormalList ',' Identifier { /* TODO */ }
+ ;
+
+ /* TODO: generic parameter constraints */
+ Constraints
+ : /* empty */
+ | WHERE ConstraintList
+ ;
+
+ ConstraintList
+ : Constraint
+ | ConstraintList ',' Constraint
+ ;
+
+ Constraint
+ : Identifier ':' Type { /* TODO */ }
+ | Identifier ':' NEW '(' ')' { /* TODO */ }
+ ;
+
ModuleDeclaration
: MODULE {
***************
*** 3297,3301 ****
StructDeclaration
! : OptAttributes OptModifiers STRUCT Identifier StructInterfaces {
/* Enter a new nesting level */
++NestingLevel;
--- 3350,3355 ----
StructDeclaration
! : OptAttributes OptModifiers STRUCT Identifier TypeFormals
! StructInterfaces Constraints {
/* Enter a new nesting level */
++NestingLevel;
***************
*** 3321,3327 ****
/* Make sure that we have "ValueType" in the
base list */
baseList = MakeSystemType("ValueType");
! if($5 != 0)
{
! baseList = ILNode_ArgList_create($5,
baseList);
}
--- 3375,3381 ----
/* Make sure that we have "ValueType" in the
base list */
baseList = MakeSystemType("ValueType");
! if($6 != 0)
{
! baseList = ILNode_ArgList_create($6,
baseList);
}
***************
*** 3335,3340 ****
(ILNode
*)CurrNamespaceNode,
baseList,
/* ClassBase */
! ($7).body,
/* StructBody */
! ($7).staticCtors);
/* StaticCtors */
CloneLine($$, $4);
--- 3389,3394 ----
(ILNode
*)CurrNamespaceNode,
baseList,
/* ClassBase */
! ($9).body,
/* StructBody */
! ($9).staticCtors);
/* StaticCtors */
CloneLine($$, $4);
***************
*** 3369,3373 ****
InterfaceDeclaration
! : OptAttributes OptModifiers INTERFACE Identifier InterfaceBase {
/* Increase the nesting level */
++NestingLevel;
--- 3423,3428 ----
InterfaceDeclaration
! : OptAttributes OptModifiers INTERFACE Identifier TypeFormals
! InterfaceBase Constraints {
/* Increase the nesting level */
++NestingLevel;
***************
*** 3396,3401 ****
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
! $5,
/* ClassBase */
! $7,
/* InterfaceBody */
0);
/* StaticCtors */
CloneLine($$, $4);
--- 3451,3456 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
! $6,
/* ClassBase */
! $9,
/* InterfaceBody */
0);
/* StaticCtors */
CloneLine($$, $4);
***************
*** 3683,3687 ****
DelegateDeclaration
! : OptAttributes OptModifiers DELEGATE Type Identifier
'(' OptFormalParameterList ')' ';' {
ILNode *baseList;
--- 3738,3742 ----
DelegateDeclaration
! : OptAttributes OptModifiers DELEGATE Type Identifier TypeFormals
'(' OptFormalParameterList ')' ';' {
ILNode *baseList;
***************
*** 3699,3703 ****
bodyList = ILNode_List_create();
ILNode_List_Add(bodyList,
!
ILNode_DelegateMemberDeclaration_create($4, $7));
/* Create the class definition */
--- 3754,3758 ----
bodyList = ILNode_List_create();
ILNode_List_Add(bodyList,
!
ILNode_DelegateMemberDeclaration_create($4, $8));
/* Create the class definition */
Index: cs_scanner.l
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_scanner.l,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** cs_scanner.l 15 Feb 2003 02:51:58 -0000 1.8
--- cs_scanner.l 18 Feb 2003 05:25:07 -0000 1.9
***************
*** 1068,1071 ****
--- 1068,1072 ----
"void" { RETURNTOK(VOID); }
"volatile" { RETURNTOK(VOLATILE); }
+ "where" { RETURNTOK(WHERE); }
"while" { RETURNTOK(WHILE); }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.45,1.46 cs_scanner.l,1.8,1.9,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet/dumpasm dump_flags.c,1.6,1.7 dump_type.c,1.8,1.9
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnet/ildasm ildasm_class.c,1.12,1.13 ildasm_method.c,1.14,1.15
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet/dumpasm dump_flags.c,1.6,1.7 dump_type.c,1.8,1.9
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnet/ildasm ildasm_class.c,1.12,1.13 ildasm_method.c,1.14,1.15
- Index(es):