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

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

[dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_grammar.y cscc/cs...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_grammar.y cscc/cs...
Date: Sat, 17 Mar 2007 16:10:14 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      07/03/17 16:10:14

Modified files:
        .              : ChangeLog 
        cscc/csharp    : cs_grammar.y cs_scanner.l 

Log message:
        2007-03-17  Klaus Treichel  <address@hidden>
        
                * cscc/csharp/cs_grammar.cs: Add the new 2.0 operators for Null 
Coalescing
                and qualified alias members. Add support for the default value 
function.
                Replace the token for the default label with the new one from 
the scanner.
                Add operator precedence to fix some shift/reduce conflicts in 
the grammar.
        
                * cscc/chsarp/cs_scanner.l: Add the new 2.0 operators for Null 
Coalescing
                and qualified aliases. Add a new token for the default label to 
work around
                a shift/reduce conflict in the grammar that caused that the 
default label
                was never recognized with the new default value instruction.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3436&r2=1.3437
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_grammar.y?cvsroot=dotgnu-pnet&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_scanner.l?cvsroot=dotgnu-pnet&r1=1.15&r2=1.16

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3436
retrieving revision 1.3437
diff -u -b -r1.3436 -r1.3437
--- ChangeLog   16 Mar 2007 17:38:54 -0000      1.3436
+++ ChangeLog   17 Mar 2007 16:10:14 -0000      1.3437
@@ -1,3 +1,15 @@
+2007-03-17  Klaus Treichel  <address@hidden>
+
+       * cscc/csharp/cs_grammar.cs: Add the new 2.0 operators for Null 
Coalescing
+       and qualified alias members. Add support for the default value function.
+       Replace the token for the default label with the new one from the 
scanner.
+       Add operator precedence to fix some shift/reduce conflicts in the 
grammar.
+
+       * cscc/chsarp/cs_scanner.l: Add the new 2.0 operators for Null 
Coalescing
+       and qualified aliases. Add a new token for the default label to work 
around
+       a shift/reduce conflict in the grammar that caused that the default 
label
+       was never recognized with the new default value instruction.
+
 2007-03-16  Klaus Treichel  <address@hidden>
 
        * dumpasm/dump_const.c: Write FP values as hex values if there is no 

Index: cscc/csharp/cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- cscc/csharp/cs_grammar.y    16 Mar 2007 17:23:56 -0000      1.76
+++ cscc/csharp/cs_grammar.y    17 Mar 2007 16:10:14 -0000      1.77
@@ -759,6 +759,22 @@
 }
 
 /*
+ * simple operator precedence.
+ */
+%right '=' MUL_ASSIGN_OP DIV_ASSIGN_OP MOD_ASSIGN_OP ADD_ASSIGN_OP 
SUB_ASSIGN_OP LEFT_ASSIGN_OP RIGHT_ASSIGN_OP AND_ASSIGN_OP XOR_ASSIGN_OP 
OR_ASSIGN_OP
+%left OR_OP
+%left AND_OP
+%left '|'
+%left '&'
+%left EQ_OP NE_OP
+%left '<' '>' LE_OP GE_OP AS IS
+%left LEFT_OP RIGHT_OP
+%left '+' '-'
+%left '*' '/' '%'
+%left UN_PLUS UN_MINUS '!' '~' UN_PRE_INC UN_PRE_DEC CAST ADDRESS_OF
+%left '.' UN_POST_INC UN_POST_DEC TYPEOF CHECKED UNCHECKED NEW PTR_OP 
+
+/*
  * Primitive lexical tokens.
  */
 %token INTEGER_CONSTANT                "an integer value"
@@ -768,6 +784,7 @@
 %token FLOAT_CONSTANT          "a floating point value"
 %token DECIMAL_CONSTANT                "a decimal value"
 %token DOC_COMMENT                     "a documentation comment"
+%token DEFAULT_LABEL           "the default label token"
 
 /*
  * Keywords.
@@ -889,6 +906,8 @@
 %token OR_ASSIGN_OP                    "`|='"
 %token PTR_OP                          "`->'"
 %token GENERIC_LT                      "`<'"
+%token NULL_COALESCING_OP      "`??'"
+%token QUALIFIED_ALIAS_OP      "`::'"
 
 /*
  * Define the yylval types of the various non-terminals.
@@ -940,7 +959,7 @@
 %type <node>           UsingStatement ResourceAcquisition FixedStatement
 %type <node>           FixedPointerDeclarators FixedPointerDeclarator
 %type <node>           InnerEmbeddedStatement InnerExpressionStatement
-%type <node>           YieldStatement
+%type <node>           YieldStatement DefaultValueExpression
 
 %type <node>           ConstantDeclaration ConstantDeclarators 
ConstantDeclarator
 %type <node>           FieldDeclaration FieldDeclarators FieldDeclarator
@@ -993,7 +1012,7 @@
 %type <catchinfo>      CatchNameInfo
 %type <target>         AttributeTarget
 
-%expect 35
+%expect 28
 
 %start CompilationUnit
 %%
@@ -1548,6 +1567,7 @@
        | BuiltinType '.' DEFAULT                       {
                                $$ = ILNode_DefaultConstructor_create($1, 0, 0);
                        }
+       | DefaultValueExpression                        { $$ = $1; }
        ;
 
 LiteralExpression
@@ -1603,6 +1623,12 @@
                        }
        ;
 
+DefaultValueExpression
+       : DEFAULT '(' Type ')'                          {
+                               $$ = ILNode_DefaultConstructor_create($3, 0, 0);
+                       }
+       ;
+
 InvocationExpression
        : PrimaryExpression '(' OptArgumentList ')'             { 
                                /* Check for "__arglist", which is handled 
specially */
@@ -1718,7 +1744,7 @@
 
 PrefixedUnaryExpression
        : UnaryExpression                               { $$ = $1; }
-       | '+' PrefixedUnaryExpression   { MakeUnary(UnaryPlus, $2); }
+       | '+' PrefixedUnaryExpression   { MakeUnary(UnaryPlus, $2); } %prec 
UN_PLUS
        | '-' PrefixedUnaryExpression                   {
                                /* We create negate nodes carefully so that 
integer
                                   and float constants can be negated in-place 
*/
@@ -1742,11 +1768,11 @@
                                {
                                        MakeUnary(Neg, $2);
                                }
-                       }
+                       }  %prec UN_MINUS
        | INC_OP PrefixedUnaryExpression        { MakeUnary(PreInc, $2); }
        | DEC_OP PrefixedUnaryExpression        { MakeUnary(PreDec, $2); }
        | '*' PrefixedUnaryExpression           { MakeBinary(Deref, $2, 0); }
-       | '&' PrefixedUnaryExpression           { MakeUnary(AddressOf, $2); }
+       | '&' PrefixedUnaryExpression           { MakeUnary(AddressOf, $2); } 
%prec ADDRESS_OF
        ;
 
 MultiplicativeExpression
@@ -2284,7 +2310,7 @@
 
 SwitchLabel
        : CASE ConstantExpression ':'   { MakeUnary(CaseLabel, $2); }
-       | DEFAULT ':'                                   { 
MakeSimple(DefaultLabel); }
+       | DEFAULT_LABEL                                 { 
MakeSimple(DefaultLabel); }
        ;
 
 IterationStatement

Index: cscc/csharp/cs_scanner.l
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_scanner.l,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- cscc/csharp/cs_scanner.l    23 Dec 2003 21:26:29 -0000      1.15
+++ cscc/csharp/cs_scanner.l    17 Mar 2007 16:10:14 -0000      1.16
@@ -994,6 +994,10 @@
 "^="                                   { RETURNTOK(XOR_ASSIGN_OP); }
 "|="                                   { RETURNTOK(OR_ASSIGN_OP); }
 "->"                                   { RETURNTOK(PTR_OP); }
+"??"                                   { RETURNTOK(NULL_COALESCING_OP); }
+"::"                                   { RETURNTOK(QUALIFIED_ALIAS_OP); }
+
+"default"{WHITE}*":"   { RETURNTOK(DEFAULT_LABEL); }
 
 "abstract"                             { RETURNTOK(ABSTRACT); }
 "add"                                  { RETURNTOK(ADD); }




reply via email to

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