Skip to content

Commit

Permalink
2004-01-26 Miguel de Icaza <miguel@ximian.com>
Browse files Browse the repository at this point in the history
	* cs-tokenizer.cs: Handle #line hidden from PDC bits.

2004-01-25  Miguel de Icaza  <miguel@ximian.com>

	* cs-parser.jay: Remove YIELD token, instead use the new grammar
	changes that treat `yield' specially when present before `break'
	or `return' tokens.

	* cs-tokenizer.cs: yield is no longer a keyword.

svn path=/trunk/mcs/; revision=22625
  • Loading branch information
migueldeicaza committed Jan 31, 2004
1 parent 9518577 commit 1f2bd46
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 31 deletions.
12 changes: 12 additions & 0 deletions mcs/mcs/ChangeLog
@@ -1,3 +1,15 @@
2004-01-26 Miguel de Icaza <miguel@ximian.com>

* cs-tokenizer.cs: Handle #line hidden from PDC bits.

2004-01-25 Miguel de Icaza <miguel@ximian.com>

* cs-parser.jay: Remove YIELD token, instead use the new grammar
changes that treat `yield' specially when present before `break'
or `return' tokens.

* cs-tokenizer.cs: yield is no longer a keyword.

2004-01-23 Marek Safar <marek.safar@seznam.cz>

* cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
Expand Down
3 changes: 3 additions & 0 deletions mcs/mcs/Makefile
Expand Up @@ -89,6 +89,9 @@ mcs2.exe: mcs.exe
mcs3.exe: mcs2.exe
$(TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:$@ $(all_sources)

wc:
wc -l $(all_sources)

ctest:
-rm mcs2.exe mcs3.exe
make btest USE_MCS_FLAGS=
Expand Down
15 changes: 5 additions & 10 deletions mcs/mcs/TODO
@@ -1,13 +1,13 @@
Anonymous methods
-----------------


Iterators
---------
* `yield' is no longer a keyword, it only has special
meaning before a return or break keywords.

* Study side effects with assign
* Study TemporaryStorage/LocalStorage -> Merge/rename

* Reset should throw not implemented now.

Instance idea
-------------

Expand Down Expand Up @@ -55,12 +55,7 @@ Anonymous Methods
* Before Emit, create proxy classes with proper depth.
* Emit.

Return Type:
During Resolve, track all the return types.
Allow for ec.ReturnType to be null, indicating `Pending Return Evaluation'


Open question:
Open question:
Create a toplevel block for anonymous methods?

EmitContext.ResolveTypeTree
Expand Down
31 changes: 18 additions & 13 deletions mcs/mcs/cs-parser.jay
Expand Up @@ -182,9 +182,6 @@ namespace Mono.CSharp
%token VOLATILE
%token WHILE

/* v2 tokens */
%token YIELD

/* C# keywords which are not really keywords */
%token GET "get"
%token SET "set"
Expand Down Expand Up @@ -3530,8 +3527,17 @@ throw_statement
;

yield_statement
: YIELD RETURN expression SEMICOLON
: IDENTIFIER RETURN expression SEMICOLON
{
string s = (string) $1;
if (s != "yield"){
Report.Error (1003, lexer.Location, "; expected");
$$ = null;
}
if (RootContext.V2){
Report.Error (-222, lexer.Location, "yield statement only available in C# 2.0 mode");
$$ = null;
}
if (iterator_container == null){
Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
$$ = null;
Expand All @@ -3540,18 +3546,17 @@ yield_statement
$$ = new Yield ((Expression) $3, lexer.Location);
}
}
| YIELD expression SEMICOLON
| IDENTIFIER BREAK SEMICOLON
{
if (iterator_container == null){
Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
string s = (string) $1;
if (s != "yield"){
Report.Error (1003, lexer.Location, "; expected");
$$ = null;
}
if (!RootContext.V2){
Report.Error (-222, lexer.Location, "yield statement only available in C# 2.0 mode");
$$ = null;
} else {
iterator_container.SetYields ();
$$ = new Yield ((Expression) $2, lexer.Location);
}
}
| YIELD BREAK SEMICOLON
{
if (iterator_container == null){
Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
$$ = null;
Expand Down
10 changes: 5 additions & 5 deletions mcs/mcs/cs-tokenizer.cs
Expand Up @@ -289,11 +289,6 @@ static void InitTokens ()
AddKeyword ("void", Token.VOID);
AddKeyword ("volatile", Token.VOLATILE);
AddKeyword ("while", Token.WHILE);

if (RootContext.V2){
AddKeyword ("__yield", Token.YIELD);
AddKeyword ("yield", Token.YIELD);
}
}

//
Expand Down Expand Up @@ -1165,6 +1160,11 @@ bool PreProcessLine (string arg)
ref_name = file_name;
Location.Push (ref_name);
return true;
} else if (arg == "hidden"){
//
// We ignore #line hidden
//
return true;
}

try {
Expand Down
4 changes: 2 additions & 2 deletions mcs/mcs/expression.cs
Expand Up @@ -4,8 +4,8 @@
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// (C) 2001 Ximian, Inc.
//
// (C) 2001, 2002, 2003 Ximian, Inc.
// (C) 2003, 2004 Novell, Inc.
//
#define USE_OLD

Expand Down
2 changes: 1 addition & 1 deletion mcs/mcs/parameter.cs
Expand Up @@ -35,7 +35,7 @@ public enum Modifier : byte {
public readonly Modifier ModFlags;
public Attributes OptAttributes;
public readonly string Name;
public Type parameter_type;
Type parameter_type;

public Parameter (Expression type, string name, Modifier mod, Attributes attrs)
{
Expand Down

0 comments on commit 1f2bd46

Please sign in to comment.