Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Pratap M <ravi@mono-cvs.ximian.com>2002-06-25 23:23:48 +0400
committerRavi Pratap M <ravi@mono-cvs.ximian.com>2002-06-25 23:23:48 +0400
commit36175eaadb52778cb8a57e64bf1f961b9405bee5 (patch)
tree55ce2a90d713474a1f0aed728891c765badf824a
parentc8264f5263f5b59a54b34b45d7861d84f48f4056 (diff)
Apply patch from Andrew
svn path=/trunk/mcs/; revision=5453
-rw-r--r--mcs/mbas/mb-parser.jay940
-rwxr-xr-xmcs/mcs/ChangeLog26
-rwxr-xr-xmcs/mcs/cs-parser.jay10
-rwxr-xr-xmcs/mcs/driver.cs310
-rw-r--r--mcs/mcs/genericparser.cs26
-rw-r--r--mcs/mcs/mb-parser.jay956
-rwxr-xr-xmcs/mcs/namespace.cs4
-rw-r--r--mcs/mcs/report.cs28
-rwxr-xr-xmcs/tests/ChangeLog11
-rwxr-xr-xmcs/tests/makefile83
10 files changed, 1192 insertions, 1202 deletions
diff --git a/mcs/mbas/mb-parser.jay b/mcs/mbas/mb-parser.jay
index d49c7713b78..fa71506b70e 100644
--- a/mcs/mbas/mb-parser.jay
+++ b/mcs/mbas/mb-parser.jay
@@ -1,313 +1,313 @@
-%{
-//
-// Mono.MonoBASIC.Parser.cs (from .jay): The Parser for the MonoBASIC compiler
-//
-// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
-//
-// Licensed under the terms of the GNU GPL
-//
-// Copyright (C) 2001 A Rafael D Teixeira
-//
-// TODO:
-// Nearly everything
-//
-
-namespace Mono.MonoBASIC
-{
- using System.Text;
- using System;
- using System.Collections;
- using Mono.Languages;
- using Mono.CSharp;
-
- /// <summary>
- /// The MonoBASIC Parser
- /// </summary>
- public class Parser : GenericParser
- {
-
-/*
- /// <summary>
- /// Current block is used to add statements as we find
- /// them.
- /// </summary>
- Block current_block;
-
- /// <summary>
- /// Current interface is used by the various declaration
- /// productions in the interface declaration to "add"
- /// the interfaces as we find them.
- /// </summary>
- Interface current_interface;
-
- /// <summary>
- /// This is used by the unary_expression code to resolve
- /// a name against a parameter.
- /// </summary>
- Parameters current_local_parameters;
-
- /// <summary>
- /// Using during property parsing to describe the implicit
- /// value parameter that is passed to the "set" accessor
- /// method
- /// </summary>
- Parameter [] implicit_value_parameters;
-
-*/
- bool UseExtendedSyntax; // for ".mbs" files
-
- public override string[] extensions()
- {
- string [] list = { ".vb", ".mbs" };
- return list;
- }
-
-%}
-
-%token EOF
-%token NONE /* This token is never returned by our lexer */
-%token ERROR // This is used not by the parser, but by the tokenizer.
- // do not remove.
-
-/*
- *These are the MonoBASIC keywords
- */
-%token ADDHANDLER
-%token ADDRESSOF
-%token ALIAS
-%token AND
-%token ANDALSO
-%token ANSI
-%token AS
-%token ASSEMBLY
-%token AUTO
-%token BOOLEAN
-%token BYREF
-%token BYTE
-%token BYVAL
-%token CALL
-%token CASE
-%token CATCH
-%token CBOOL
-%token CBYTE
-%token CCHAR
-%token CDATE
-%token CDEC
-%token CDBL
-%token CHAR
-%token CINT
-%token CLASS
-%token CLNG
-%token COBJ
-//%token COMPARE
-%token CONST
-%token CSHORT
-%token CSNG
-%token CSTR
-%token CTYPE
-%token DATE
-%token DECIMAL
-%token DECLARE
-%token DEFAULT
-%token DELEGATE
-%token DESCRIPTION // MonoBASIC extension
-%token DIM
-%token DO
-%token DOUBLE
-%token EACH
-%token ELSE
-%token ELSEIF
-%token END
-%token ENUM
-%token EOL
-%token ERASE
-%token ERROR
-%token EVENT
-%token EXIT
-//%token EXPLICIT
-%token FALSE
-%token FINALLY
-%token FOR
-%token FRIEND
-%token FUNCTION
-%token GET
-%token GETTYPE
-%token GOTO
-%token HANDLES
-%token IF
-%token IMPLEMENTS
-%token IMPORTS
-%token IN
-%token INHERITS
-%token INTEGER
-%token INTERFACE
-%token IS
-%token LET
-%token LIB
-%token LIKE
-%token LONG
-%token LOOP
-%token ME
-%token MOD
-%token MODULE
-%token MUSTINHERIT
-%token MUSTOVERRIDE
-%token MYBASE
-%token MYCLASS
-%token NAMESPACE
-%token NEW
-%token NEXT
-%token NOT
-%token NOTHING
-%token NOTINHERITABLE
-%token NOTOVERRIDABLE
-%token OBJECT
-%token ON
-%token OPTION
-%token OPTIONAL
-%token OR
-%token ORELSE
-%token OVERLOADS
-%token OVERRIDABLE
-%token OVERRIDES
-%token PARAMETER // MonoBASIC extension
-%token PARAM_ARRAY
-%token PRESERVE
-%token PRIVATE
-%token PROPERTY
-%token PROTECTED
-%token PUBLIC
-%token RAISEEVENT
-%token READONLY
-%token REDIM
-%token REM
-%token REMOVEHANDLER
-%token RESUME
-%token RETURN
-%token SELECT
-%token SET
-%token SHADOWS
-%token SHARED
-%token SHORT
-%token SINGLE
-%token SIZEOF
-%token STATIC
-%token STEP
-%token STOP
-%token STRING
-%token STRUCTURE
-%token SUB
-%token SUMMARY // MonoBASIC extension
-%token SYNCLOCK
-%token THEN
-%token THROW
-%token TO
-%token TRUE
-%token TRY
-%token TYPEOF
-%token UNICODE
-%token UNTIL
-%token VARIANT
-%token WHEN
-%token WHILE
-%token WITH
-%token WITHEVENTS
-%token WRITEONLY
-%token XOR
-
-/* MonoBASIC single character operators/punctuation. */
-%token OPEN_BRACKET "["
-%token CLOSE_BRACKET "]"
-%token OPEN_PARENS "("
-%token CLOSE_PARENS ")"
-%token DOT "."
-%token COMMA ","
-%token COLON ":"
-
-%token PLUS "+"
-%token MINUS "-"
-%token ASSIGN "="
-%token OP_LT "<"
-%token OP_GT ">"
-%token STAR "*"
-%token PERCENT "%"
-%token DIV "/"
-%token OP_EXP "^"
-%token INTERR "?"
-%token OP_IDIV "\\"
-%token OP_CONCAT "&"
-
-/* MonoBASIC multi-character operators. */
-%token OP_LE "<="
-%token OP_GE ">="
-%token OP_EQ "=="
-%token OP_NE "<>"
-%token OP_AND //"and"
-%token OP_OR //"or"
-%token OP_XOR //"xor"
-%token OP_MODULUS //"mod"
-%token OP_MULT_ASSIGN "*="
-%token OP_DIV_ASSIGN "/="
-%token OP_IDIV_ASSIGN "\\="
-%token OP_ADD_ASSIGN "+="
-%token OP_SUB_ASSIGN "-="
-%token OP_CONCAT_ASSIGN "&="
-%token OP_EXP_ASSIGN "^="
-
-/* Numbers */
-%token LITERAL_INTEGER "int literal"
-%token LITERAL_SINGLE "float literal"
-%token LITERAL_DOUBLE "double literal"
-%token LITERAL_DECIMAL "decimal literal"
-%token LITERAL_CHARACTER "character literal"
-%token LITERAL_STRING "string literal"
-
-%token IDENTIFIER
-
-/* Add precedence rules to solve dangling else s/r conflict */
-%nonassoc LOWPREC
-%nonassoc IF
-%nonassoc ELSE
-%right ASSIGN
-%left OP_OR
-%left OP_AND
-%left BITWISE_OR
-%left BITWISE_AND
-%left OP_SHIFT_LEFT OP_SHIFT_RIGHT
-%left PLUS MINUS
-%left STAR DIV PERCENT
-%right BITWISE_NOT CARRET UMINUS
-%nonassoc OP_INC OP_DEC
-%left OPEN_PARENS
-%left OPEN_BRACKET OPEN_BRACE
-%left DOT
-%nonassoc HIGHPREC
-
-%start compilation_unit
-%%
-
-compilation_unit
- : opt_imports_directives
- opt_attributes
- opt_declarations
- EOF
- {
- $$ = $3;
- }
- ;
-
-opt_declarations
- : /* empty */
- | declarations
- ;
-
-declarations
- : declaration
- | declarations declaration
- ;
-
-declaration
- : namespace_declaration
+%{
+//
+// Mono.MonoBASIC.Parser.cs (from .jay): The Parser for the MonoBASIC compiler
+//
+// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// Copyright (C) 2001 A Rafael D Teixeira
+//
+// TODO:
+// Nearly everything
+//
+
+namespace Mono.MonoBASIC
+{
+ using System.Text;
+ using System;
+ using System.Collections;
+ using Mono.Languages;
+ using Mono.CSharp;
+
+ /// <summary>
+ /// The MonoBASIC Parser
+ /// </summary>
+ public class Parser : GenericParser
+ {
+
+/*
+ /// <summary>
+ /// Current block is used to add statements as we find
+ /// them.
+ /// </summary>
+ Block current_block;
+
+ /// <summary>
+ /// Current interface is used by the various declaration
+ /// productions in the interface declaration to "add"
+ /// the interfaces as we find them.
+ /// </summary>
+ Interface current_interface;
+
+ /// <summary>
+ /// This is used by the unary_expression code to resolve
+ /// a name against a parameter.
+ /// </summary>
+ Parameters current_local_parameters;
+
+ /// <summary>
+ /// Using during property parsing to describe the implicit
+ /// value parameter that is passed to the "set" accessor
+ /// method
+ /// </summary>
+ Parameter [] implicit_value_parameters;
+
+*/
+ bool UseExtendedSyntax; // for ".mbs" files
+
+ public override string[] extensions()
+ {
+ string [] list = { ".vb", ".mbs" };
+ return list;
+ }
+
+%}
+
+%token EOF
+%token NONE /* This token is never returned by our lexer */
+%token ERROR // This is used not by the parser, but by the tokenizer.
+ // do not remove.
+
+/*
+ *These are the MonoBASIC keywords
+ */
+%token ADDHANDLER
+%token ADDRESSOF
+%token ALIAS
+%token AND
+%token ANDALSO
+%token ANSI
+%token AS
+%token ASSEMBLY
+%token AUTO
+%token BOOLEAN
+%token BYREF
+%token BYTE
+%token BYVAL
+%token CALL
+%token CASE
+%token CATCH
+%token CBOOL
+%token CBYTE
+%token CCHAR
+%token CDATE
+%token CDEC
+%token CDBL
+%token CHAR
+%token CINT
+%token CLASS
+%token CLNG
+%token COBJ
+//%token COMPARE
+%token CONST
+%token CSHORT
+%token CSNG
+%token CSTR
+%token CTYPE
+%token DATE
+%token DECIMAL
+%token DECLARE
+%token DEFAULT
+%token DELEGATE
+%token DESCRIPTION // MonoBASIC extension
+%token DIM
+%token DO
+%token DOUBLE
+%token EACH
+%token ELSE
+%token ELSEIF
+%token END
+%token ENUM
+%token EOL
+%token ERASE
+%token ERROR
+%token EVENT
+%token EXIT
+//%token EXPLICIT
+%token FALSE
+%token FINALLY
+%token FOR
+%token FRIEND
+%token FUNCTION
+%token GET
+%token GETTYPE
+%token GOTO
+%token HANDLES
+%token IF
+%token IMPLEMENTS
+%token IMPORTS
+%token IN
+%token INHERITS
+%token INTEGER
+%token INTERFACE
+%token IS
+%token LET
+%token LIB
+%token LIKE
+%token LONG
+%token LOOP
+%token ME
+%token MOD
+%token MODULE
+%token MUSTINHERIT
+%token MUSTOVERRIDE
+%token MYBASE
+%token MYCLASS
+%token NAMESPACE
+%token NEW
+%token NEXT
+%token NOT
+%token NOTHING
+%token NOTINHERITABLE
+%token NOTOVERRIDABLE
+%token OBJECT
+%token ON
+%token OPTION
+%token OPTIONAL
+%token OR
+%token ORELSE
+%token OVERLOADS
+%token OVERRIDABLE
+%token OVERRIDES
+%token PARAMETER // MonoBASIC extension
+%token PARAM_ARRAY
+%token PRESERVE
+%token PRIVATE
+%token PROPERTY
+%token PROTECTED
+%token PUBLIC
+%token RAISEEVENT
+%token READONLY
+%token REDIM
+%token REM
+%token REMOVEHANDLER
+%token RESUME
+%token RETURN
+%token SELECT
+%token SET
+%token SHADOWS
+%token SHARED
+%token SHORT
+%token SINGLE
+%token SIZEOF
+%token STATIC
+%token STEP
+%token STOP
+%token STRING
+%token STRUCTURE
+%token SUB
+%token SUMMARY // MonoBASIC extension
+%token SYNCLOCK
+%token THEN
+%token THROW
+%token TO
+%token TRUE
+%token TRY
+%token TYPEOF
+%token UNICODE
+%token UNTIL
+%token VARIANT
+%token WHEN
+%token WHILE
+%token WITH
+%token WITHEVENTS
+%token WRITEONLY
+%token XOR
+
+/* MonoBASIC single character operators/punctuation. */
+%token OPEN_BRACKET "["
+%token CLOSE_BRACKET "]"
+%token OPEN_PARENS "("
+%token CLOSE_PARENS ")"
+%token DOT "."
+%token COMMA ","
+%token COLON ":"
+
+%token PLUS "+"
+%token MINUS "-"
+%token ASSIGN "="
+%token OP_LT "<"
+%token OP_GT ">"
+%token STAR "*"
+%token PERCENT "%"
+%token DIV "/"
+%token OP_EXP "^"
+%token INTERR "?"
+%token OP_IDIV "\\"
+%token OP_CONCAT "&"
+
+/* MonoBASIC multi-character operators. */
+%token OP_LE "<="
+%token OP_GE ">="
+%token OP_EQ "=="
+%token OP_NE "<>"
+%token OP_AND //"and"
+%token OP_OR //"or"
+%token OP_XOR //"xor"
+%token OP_MODULUS //"mod"
+%token OP_MULT_ASSIGN "*="
+%token OP_DIV_ASSIGN "/="
+%token OP_IDIV_ASSIGN "\\="
+%token OP_ADD_ASSIGN "+="
+%token OP_SUB_ASSIGN "-="
+%token OP_CONCAT_ASSIGN "&="
+%token OP_EXP_ASSIGN "^="
+
+/* Numbers */
+%token LITERAL_INTEGER "int literal"
+%token LITERAL_SINGLE "float literal"
+%token LITERAL_DOUBLE "double literal"
+%token LITERAL_DECIMAL "decimal literal"
+%token LITERAL_CHARACTER "character literal"
+%token LITERAL_STRING "string literal"
+
+%token IDENTIFIER
+
+/* Add precedence rules to solve dangling else s/r conflict */
+%nonassoc LOWPREC
+%nonassoc IF
+%nonassoc ELSE
+%right ASSIGN
+%left OP_OR
+%left OP_AND
+%left BITWISE_OR
+%left BITWISE_AND
+%left OP_SHIFT_LEFT OP_SHIFT_RIGHT
+%left PLUS MINUS
+%left STAR DIV PERCENT
+%right BITWISE_NOT CARRET UMINUS
+%nonassoc OP_INC OP_DEC
+%left OPEN_PARENS
+%left OPEN_BRACKET OPEN_BRACE
+%left DOT
+%nonassoc HIGHPREC
+
+%start compilation_unit
+%%
+
+compilation_unit
+ : opt_imports_directives
+ opt_attributes
+ opt_declarations
+ EOF
+ {
+ $$ = $3;
+ }
+ ;
+
+opt_declarations
+ : /* empty */
+ | declarations
+ ;
+
+declarations
+ : declaration
+ | declarations declaration
+ ;
+
+declaration
+ : namespace_declaration
| type_declaration
{
string name = "";
@@ -330,85 +330,85 @@ declaration
"Namespace elements cannot be explicitly " +
"declared private or protected in '" + name + "'");
}
- }
- ;
-
-qualified_identifier
- : IDENTIFIER
- | qualified_identifier DOT IDENTIFIER
- {
- $$ = (($1).ToString ()) + "." + ($3.ToString ());
- }
- ;
-opt_imports_directives
- : /* empty */
- | imports_directives
- ;
-
-imports_directives
- : imports_directive
- | imports_directives imports_directive
- ;
-
-imports_directive
- : /* imports_alias_directive
- | */ imports_namespace_directive
- ;
-
-imports_namespace_directive
- : IMPORTS qualified_identifier EOL
- {
- current_namespace.Using ((string) $2);
- }
- ;
-
-opt_attributes
- : /* empty */
- ;
-
-namespace_declaration
- : NAMESPACE qualified_identifier EOL
- {
+ }
+ ;
+
+qualified_identifier
+ : IDENTIFIER
+ | qualified_identifier DOT IDENTIFIER
+ {
+ $$ = (($1).ToString ()) + "." + ($3.ToString ());
+ }
+ ;
+opt_imports_directives
+ : /* empty */
+ | imports_directives
+ ;
+
+imports_directives
+ : imports_directive
+ | imports_directives imports_directive
+ ;
+
+imports_directive
+ : /* imports_alias_directive
+ | */ imports_namespace_directive
+ ;
+
+imports_namespace_directive
+ : IMPORTS qualified_identifier EOL
+ {
+ current_namespace.Using ((string) $2);
+ }
+ ;
+
+opt_attributes
+ : /* empty */
+ ;
+
+namespace_declaration
+ : NAMESPACE qualified_identifier EOL
+ {
current_namespace = RootContext.Tree.RecordNamespace(current_namespace, name, (string)$2);
- }
- opt_imports_directives
- opt_declarations
- END NAMESPACE EOL
- {
- current_namespace = current_namespace.Parent;
- }
- ;
-
-type_declaration
- : class_declaration
- | module_declaration
+ }
+ opt_imports_directives
+ opt_declarations
+ END NAMESPACE EOL
+ {
+ current_namespace = current_namespace.Parent;
+ }
+ ;
+
+type_declaration
+ : class_declaration
+ | module_declaration
// | struct_declaration
// | interface_declaration
// | enum_declaration
// | delegate_declaration
- ;
-
-class_declaration
- : /* opt_attributes opt_modifiers */
- CLASS IDENTIFIER /* opt_class_interfaces */ EOL
- {
- }
- opt_class_member_declarations
- END CLASS EOL
- {
- }
- ;
-
-opt_module_modifiers
- : /* empty */ { $$ = (int) 0; }
- | PUBLIC { $$ = Modifiers.PUBLIC; }
- | FRIEND { $$ = Modifiers.INTERNAL; }
- ;
-
-module_declaration
- : opt_attributes opt_module_modifiers
- MODULE IDENTIFIER EOL
- {
+ ;
+
+class_declaration
+ : /* opt_attributes opt_modifiers */
+ CLASS IDENTIFIER /* opt_class_interfaces */ EOL
+ {
+ }
+ opt_class_member_declarations
+ END CLASS EOL
+ {
+ }
+ ;
+
+opt_module_modifiers
+ : /* empty */ { $$ = (int) 0; }
+ | PUBLIC { $$ = Modifiers.PUBLIC; }
+ | FRIEND { $$ = Modifiers.INTERNAL; }
+ ;
+
+module_declaration
+ : opt_attributes opt_module_modifiers
+ MODULE IDENTIFIER EOL
+ {
Module new_module;
string name;
@@ -421,97 +421,93 @@ module_declaration
current_container = new_module;
current_container.Namespace = current_namespace;
RootContext.Tree.RecordDecl(name, new_module);
- }
- opt_class_member_declarations
- END MODULE EOL
- {
+ }
+ opt_class_member_declarations
+ END MODULE EOL
+ {
Module new_module = (Module)current_container;
current_container = current_container.Parent;
CheckDef (current_container.AddClass(new_module), new_module.Name, new_module.Location);
$$ = new_module;
- }
- ;
-
-opt_class_member_declarations
- : /* empty */
- | class_member_declarations
- ;
-
-class_member_declarations
- : class_member_declaration
- | class_member_declarations class_member_declaration
- ;
-
-class_member_declaration
- : /* type_declaration
- | */ sub_declaration
- ;
-
-sub_declaration
- : SUB qualified_identifier OPEN_PARENS opt_formal_parameters CLOSE_PARENS EOL
- opt_statements
- END SUB EOL
- ;
-
-opt_statements
- : /* empty */
- | qualified_identifier OPEN_PARENS opt_actual_parameters CLOSE_PARENS EOL
- ;
-
-opt_formal_parameters
- : /* empty */
- | qualified_identifier AS qualified_identifier
- ;
-
-opt_actual_parameters
- : /* empty */
- | qualified_identifier
- | LITERAL_STRING
- ;
-
-%%
-
-
-Tokenizer lexer;
-
-public Tokenizer Lexer {
- get {
- return lexer;
- }
-}
-
-public override int parse ()
-{
- current_namespace = new Namespace (null, "");
- current_container = RootContext.Tree.Types;
- current_container.Namespace = current_namespace;
-
- UseExtendedSyntax = name.EndsWith(".mbs");
-
- lexer = new Tokenizer (input, name, defines);
- StringBuilder value = new StringBuilder ();
-
- global_errors = 0;
- try
- {
- if (yacc_verbose_flag)
- yyparse (lexer, new yydebug.yyDebugSimple ());
- else
- yyparse (lexer);
- }
- catch (Exception e)
- {
- Console.WriteLine (lexer.location + " : Parsing error ");
- Console.WriteLine (e);
- global_errors++;
- }
-
- return global_errors;
-}
-
-/* end end end */
-}
-
-
+ }
+ ;
+
+opt_class_member_declarations
+ : /* empty */
+ | class_member_declarations
+ ;
+
+class_member_declarations
+ : class_member_declaration
+ | class_member_declarations class_member_declaration
+ ;
+
+class_member_declaration
+ : /* type_declaration
+ | */ sub_declaration
+ ;
+
+sub_declaration
+ : SUB qualified_identifier OPEN_PARENS opt_formal_parameters CLOSE_PARENS EOL
+ opt_statements
+ END SUB EOL
+ ;
+
+opt_statements
+ : /* empty */
+ | qualified_identifier OPEN_PARENS opt_actual_parameters CLOSE_PARENS EOL
+ ;
+
+opt_formal_parameters
+ : /* empty */
+ | qualified_identifier AS qualified_identifier
+ ;
+
+opt_actual_parameters
+ : /* empty */
+ | qualified_identifier
+ | LITERAL_STRING
+ ;
+
+%%
+
+
+Tokenizer lexer;
+
+public Tokenizer Lexer {
+ get {
+ return lexer;
+ }
+}
+
+public override void parse ()
+{
+ current_namespace = new Namespace (null, "");
+ current_container = RootContext.Tree.Types;
+ current_container.Namespace = current_namespace;
+
+ UseExtendedSyntax = name.EndsWith(".mbs");
+
+ lexer = new Tokenizer (input, name, defines);
+ StringBuilder value = new StringBuilder ();
+
+ try
+ {
+ if (yacc_verbose_flag)
+ yyparse (lexer, new yydebug.yyDebugSimple ());
+ else
+ yyparse (lexer);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine (lexer.location + " : Parsing error ");
+ Console.WriteLine (e);
+ }
+}
+
+/* end end end */
+}
+
+
diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog
index 1dde47a94c4..a55afa33d4a 100755
--- a/mcs/mcs/ChangeLog
+++ b/mcs/mcs/ChangeLog
@@ -1,3 +1,29 @@
+2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
+
+ * driver.cs: Made error handling more consistent. Errors now
+ tracked by Report class, so many methods which used to return int
+ now return void. Main() now prints success/failure and
+ errors/warnings message.
+
+ Renamed '--probe' compiler argument to '--expect-error'. Removed
+ the magic number return values (123 and 124). Now, if the
+ expected error occurs, the compiler exits with success (exit value
+ 0). If the compilation completes without seeing that particular
+ error, the compiler exits with failure (exit value 1). The
+ makefile in mcs/errors has been changed to handle the new behaviour.
+
+ * report.cs: Made 'expected error' number a property and renamed
+ it from 'Probe' to 'ExpectedError'.
+
+ * genericparser.cs: Removed error handling support, since it is
+ now all done by Report class.
+
+ * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
+ class, so parse() no longer returns an int.
+
+ * namespace.cs: Use Report.Error instead of GenericParser.error
+
+
2002-06-22 Miguel de Icaza <miguel@ximian.com>
* class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index b151ed91041..ec40bd8c38b 100755
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -3933,28 +3933,20 @@ public CSharpParser (string name, System.IO.Stream input, ArrayList defines)
lexer = new Tokenizer (input, name, defines);
}
-public override int parse ()
+public override void parse ()
{
- global_errors = 0;
try {
if (yacc_verbose_flag)
yyparse (lexer, new yydebug.yyDebugSimple ());
else
yyparse (lexer);
} catch (Exception e){
- // Console.WriteLine ("Fatal error: " + name);
- // Console.WriteLine (lexer.location);
-
- //
// Please do not remove this, it is used during debugging
// of the grammar
//
Console.WriteLine (lexer.location + " : Parsing error ");
Console.WriteLine (e);
- global_errors++;
}
-
- return global_errors;
}
/* end end end */
diff --git a/mcs/mcs/driver.cs b/mcs/mcs/driver.cs
index 875e7553d70..272094935de 100755
--- a/mcs/mcs/driver.cs
+++ b/mcs/mcs/driver.cs
@@ -49,8 +49,6 @@ namespace Mono.CSharp
// Whether we want to only run the tokenizer
static bool tokenize = false;
- static int error_count = 0;
-
static string first_source;
static Target target = Target.Exe;
@@ -95,16 +93,15 @@ namespace Mono.CSharp
(int) span.TotalSeconds, span.Milliseconds, msg);
}
- static int tokenize_file (string input_file)
+ static void tokenize_file (string input_file)
{
Stream input;
try {
input = File.OpenRead (input_file);
-
} catch {
Report.Error (2001, "Source file '" + input_file + "' could not be opened");
- return 1;
+ return;
}
using (input){
@@ -120,72 +117,66 @@ namespace Mono.CSharp
Console.WriteLine ("Tokenized: " + tokens + " found " + errors + " errors");
}
- return 0;
+ return;
}
-
- static int parse (string input_file)
+
+ // MonoTODO("Change error code for aborted compilation to something reasonable")]
+ static void parse (string input_file)
{
CSharpParser parser;
Stream input;
- int errors;
try {
input = File.OpenRead (input_file);
} catch {
Report.Error (2001, "Source file '" + input_file + "' could not be opened");
- return 1;
+ return;
}
parser = new CSharpParser (input_file, input, defines);
parser.yacc_verbose = yacc_verbose;
try {
- errors = parser.parse ();
+ parser.parse ();
} catch (Exception ex) {
- Console.WriteLine (ex);
- Console.WriteLine ("Compilation aborted");
- return 1;
+ Report.Error(666, "Compilation aborted: " + ex);
} finally {
input.Close ();
}
-
- return errors;
}
- static void Usage (bool is_error)
+ static void Usage ()
{
Console.WriteLine (
"Mono C# compiler, (C) 2001 Ximian, Inc.\n" +
"mcs [options] source-files\n" +
- " --about About the Mono C# compiler\n" +
- " --checked Set default context to checked\n" +
- " --define SYM Defines the symbol SYM\n" +
- " --debug Generate debugging information\n" +
- " -g Generate debugging information\n" +
- " --debug-args X Specify additional arguments for the\n" +
- " symbol writer.\n" +
- " --fatal Makes errors fatal\n" +
- " -L PATH Adds PATH to the assembly link path\n" +
- " --noconfig Disables implicit references to assemblies\n" +
- " --nostdlib Does not load core libraries\n" +
- " --nowarn XXX Ignores warning number XXX\n" +
- " -o FNAME Specifies output file\n" +
- " -g, --debug Write symbolic debugging information to FILE-debug.s\n" +
- " --parse Only parses the source file\n" +
- " --probe X Probes for the source to generate code X on line L\n" +
- " --recurse SPEC Recursively compiles the files in SPEC ([dir]/file)\n" +
- " --resource FILE Addds FILE as a resource\n" +
- " --stacktrace Shows stack trace at error location\n" +
- " --target KIND Specifies the target (KIND is one of: exe, winexe, " +
- "library, module)\n" +
- " --timestamp Displays time stamps of various compiler events\n" +
- " --unsafe Allows unsafe code\n" +
- " --werror Treat warnings as errors\n" +
- " --wlevel LEVEL Sets warning level (the highest is 4, the default)\n" +
- " -r References an assembly\n" +
- " -v Verbose parsing (for debugging the parser)\n" +
- " @file Read response file for more options");
- if (is_error)
- error_count++;
+ " --about About the Mono C# compiler\n" +
+ " --checked Set default context to checked\n" +
+ " --define SYM Defines the symbol SYM\n" +
+ " --debug Generate debugging information\n" +
+ " -g Generate debugging information\n" +
+ " --debug-args X Specify additional arguments for the\n" +
+ " symbol writer.\n" +
+ " --fatal Makes errors fatal\n" +
+ " -L PATH Adds PATH to the assembly link path\n" +
+ " --noconfig Disables implicit references to assemblies\n" +
+ " --nostdlib Does not load core libraries\n" +
+ " --nowarn XXX Ignores warning number XXX\n" +
+ " -o FNAME Specifies output file\n" +
+ " -g, --debug Write symbolic debugging information to FILE-debug.s\n" +
+ " --parse Only parses the source file\n" +
+ " --expect-error X Expect that error X will be encountered\n" +
+ " --recurse SPEC Recursively compiles the files in SPEC ([dir]/file)\n" +
+ " --resource FILE Addds FILE as a resource\n" +
+ " --stacktrace Shows stack trace at error location\n" +
+ " --target KIND Specifies the target (KIND is one of: exe, winexe, " +
+ "library, module)\n" +
+ " --timestamp Displays time stamps of various compiler events\n" +
+ " --unsafe Allows unsafe code\n" +
+ " --werror Treat warnings as errors\n" +
+ " --wlevel LEVEL Sets warning level (the highest is 4, the default)\n" +
+ " -r References an assembly\n" +
+ " -v Verbose parsing (for debugging the parser)\n" +
+ " @file Read response file for more options");
}
static void About ()
@@ -200,27 +191,25 @@ namespace Mono.CSharp
"The compiler was written by Miguel de Icaza and Ravi Pratap");
}
- static void error (string msg)
- {
- Console.WriteLine ("Error: " + msg);
- }
-
- static void notice (string msg)
- {
- Console.WriteLine (msg);
- }
-
public static int Main (string[] args)
{
- //args = new string [1];
- //args [0] = "@list";
+ bool ok = MainDriver (args);
- MainDriver (args);
-
- return (error_count + Report.Errors) != 0 ? 1 : 0;
+ if (ok && Report.Errors == 0) {
+ Console.Write("Compilation succeeded");
+ if (Report.Warnings > 0) {
+ Console.Write(" - {0} warning(s)", Report.Warnings);
+ }
+ Console.WriteLine();
+ return 0;
+ } else {
+ Console.WriteLine("Compilation failed: {0} error(s), {1} warnings",
+ Report.Errors, Report.Warnings);
+ return 1;
+ }
}
- static public int LoadAssembly (string assembly, bool soft)
+ static public void LoadAssembly (string assembly, bool soft)
{
Assembly a;
string total_log = "";
@@ -228,12 +217,13 @@ namespace Mono.CSharp
try {
char[] path_chars = { '/', '\\', '.' };
- if (assembly.IndexOfAny (path_chars) != -1)
+ if (assembly.IndexOfAny (path_chars) != -1) {
a = Assembly.LoadFrom (assembly);
- else
+ } else {
a = Assembly.Load (assembly);
+ }
TypeManager.AddAssembly (a);
- return 0;
+
} catch (FileNotFoundException){
foreach (string dir in link_paths){
string full_path = dir + "/" + assembly + ".dll";
@@ -241,47 +231,37 @@ namespace Mono.CSharp
try {
a = Assembly.LoadFrom (full_path);
TypeManager.AddAssembly (a);
- return 0;
+ return;
} catch (FileNotFoundException ff) {
total_log += ff.FusionLog;
continue;
}
}
- if (soft)
- return 0;
+ if (!soft) {
+ Report.Error (6, "Cannot find assembly `" + assembly + "'" );
+ Console.WriteLine ("Log: \n" + total_log);
+ }
} catch (BadImageFormatException f) {
- error ("// Bad file format while loading assembly");
- error ("Log: " + f.FusionLog);
- return 1;
+ Report.Error(6, "Cannot load assembly (bad file format)" + f.FusionLog);
} catch (FileLoadException f){
- error ("File Load Exception: " + assembly);
- error ("Log: " + f.FusionLog);
- return 1;
+ Report.Error(6, "Cannot load assembly " + f.FusionLog);
} catch (ArgumentNullException){
- error ("// Argument Null exception ");
- return 1;
+ Report.Error(6, "Cannot load assembly (null argument)");
}
-
- Report.Error (6, "Can not find assembly `" + assembly + "'" );
- Console.WriteLine ("Log: \n" + total_log);
-
- return 0;
}
/// <summary>
/// Loads all assemblies referenced on the command line
/// </summary>
- static public int LoadReferences ()
+ static public void LoadReferences ()
{
- int errors = 0;
-
foreach (string r in references)
- errors += LoadAssembly (r, false);
+ LoadAssembly (r, false);
foreach (string r in soft_references)
- errors += LoadAssembly (r, true);
+ LoadAssembly (r, true);
- return errors;
+ return;
}
static void SetupDefaultDefines ()
@@ -364,7 +344,7 @@ namespace Mono.CSharp
pattern = spec;
}
- static int ProcessFile (string f)
+ static void ProcessFile (string f)
{
if (first_source == null)
first_source = f;
@@ -377,21 +357,21 @@ namespace Mono.CSharp
} else
source_files.Add (f, f);
- if (tokenize)
+ if (tokenize) {
tokenize_file (f);
- else
- return parse (f);
- return 0;
+ } else {
+ parse (f);
+ }
}
- static int CompileFiles (string spec, bool recurse)
+ static void CompileFiles (string spec, bool recurse)
{
string path, pattern;
- int errors = 0;
SplitPathAndPattern (spec, out path, out pattern);
if (pattern.IndexOf ("*") == -1){
- return ProcessFile (spec);
+ ProcessFile (spec);
+ return;
}
string [] files = null;
@@ -399,16 +379,17 @@ namespace Mono.CSharp
files = Directory.GetFiles (path, pattern);
} catch (System.IO.DirectoryNotFoundException) {
Report.Error (2001, "Source file `" + spec + "' could not be found");
- return 1;
+ return;
} catch (System.IO.IOException){
Report.Error (2001, "Source file `" + spec + "' could not be found");
- return 1;
+ return;
+ }
+ foreach (string f in files) {
+ ProcessFile (f);
}
- foreach (string f in files)
- errors += ProcessFile (f);
if (!recurse)
- return errors;
+ return;
string [] dirs = null;
@@ -421,11 +402,8 @@ namespace Mono.CSharp
// Don't include path in this string, as each
// directory entry already does
- errors += CompileFiles (d + "/" + pattern, true);
+ CompileFiles (d + "/" + pattern, true);
}
-
-
- return errors;
}
static void DefineDefaultConfig ()
@@ -476,9 +454,10 @@ namespace Mono.CSharp
/// TODO: Mostly structured to debug the compiler
/// now, needs to be turned into a real driver soon.
/// </remarks>
- static void MainDriver (string [] args)
+ // [MonoTODO("Change error code for unknown argument to something reasonable")]
+ static bool MainDriver (string [] args)
{
- int errors = 0, i;
+ int i;
string output_file = null;
bool parsing_options = true;
@@ -520,7 +499,7 @@ namespace Mono.CSharp
if (extra_args == null){
Report.Error (2011, "Unable to open response file: " +
response_file);
- return;
+ return false;
}
new_args = new string [extra_args.Length + argc];
@@ -551,8 +530,8 @@ namespace Mono.CSharp
case "--main": case "-m":
if ((i + 1) >= argc){
- Usage (true);
- return;
+ Usage ();
+ return false;
}
RootContext.MainClass = args [++i];
continue;
@@ -563,24 +542,24 @@ namespace Mono.CSharp
case "/?": case "/h": case "/help":
case "--help":
- Usage (false);
- return;
+ Usage ();
+ return false;
case "--define":
if ((i + 1) >= argc){
- Usage (true);
- return;
+ Usage ();
+ return false;
}
defines.Add (args [++i]);
continue;
- case "--probe": {
+ case "--expect-error": {
int code = 0;
try {
code = Int32.Parse (
args [++i], NumberStyles.AllowLeadingSign);
- Report.SetProbe (code);
+ Report.ExpectedError = code;
} catch {
Report.Error (-14, "Invalid number specified");
}
@@ -595,8 +574,8 @@ namespace Mono.CSharp
case "-o":
case "--output":
if ((i + 1) >= argc){
- Usage (true);
- return;
+ Usage ();
+ return false;
}
output_file = args [++i];
string bname = CodeGen.Basename (output_file);
@@ -614,9 +593,9 @@ namespace Mono.CSharp
case "--resource":
if ((i + 1) >= argc){
- Usage (true);
+ Usage ();
Console.WriteLine("Missing argument to --resource");
- return;
+ return false;
}
if (resources == null)
resources = new ArrayList ();
@@ -626,8 +605,8 @@ namespace Mono.CSharp
case "--target":
if ((i + 1) >= argc){
- Usage (true);
- return;
+ Usage ();
+ return false;
}
string type = args [++i];
@@ -650,15 +629,15 @@ namespace Mono.CSharp
target_ext = ".dll";
break;
default:
- Usage (true);
- return;
+ Usage ();
+ return false;
}
continue;
case "-r":
if ((i + 1) >= argc){
- Usage (true);
- return;
+ Usage ();
+ return false;
}
references.Add (args [++i]);
@@ -666,8 +645,8 @@ namespace Mono.CSharp
case "-L":
if ((i + 1) >= argc){
- Usage (true);
- return;
+ Usage ();
+ return false;
}
link_paths.Add (args [++i]);
continue;
@@ -686,16 +665,16 @@ namespace Mono.CSharp
case "--nowarn":
if ((i + 1) >= argc){
- Usage (true);
- return;
+ Usage ();
+ return false;
}
int warn;
try {
warn = Int32.Parse (args [++i]);
} catch {
- Usage (true);
- return;
+ Usage ();
+ return false;
}
Report.SetIgnoreWarning (warn);
continue;
@@ -705,8 +684,7 @@ namespace Mono.CSharp
Report.Error (
1900,
"--wlevel requires an value from 0 to 4");
- error_count++;
- return;
+ return false;
}
int level;
@@ -716,26 +694,25 @@ namespace Mono.CSharp
Report.Error (
1900,
"--wlevel requires an value from 0 to 4");
- return;
+ return false;
}
if (level < 0 || level > 4){
Report.Error (1900, "Warning level must be 0 to 4");
- return;
+ return false;
} else
RootContext.WarningLevel = level;
continue;
case "--about":
About ();
- return;
+ return true;
case "--recurse":
if ((i + 1) >= argc){
Console.WriteLine ("--recurse requires an argument");
- error_count++;
- return;
+ return false;
}
- errors += CompileFiles (args [++i], true);
+ CompileFiles (args [++i], true);
continue;
case "--timestamp":
@@ -751,8 +728,7 @@ namespace Mono.CSharp
case "--debug-args":
if ((i + 1) >= argc){
Console.WriteLine ("--debug-args requires an argument");
- error_count++;
- return;
+ return false;
}
char[] sep = { ',' };
debug_arglist.AddRange (args [++i].Split (sep));
@@ -763,28 +739,27 @@ namespace Mono.CSharp
continue;
default:
- Console.WriteLine ("Unknown option: " + arg);
- errors++;
+ Report.Warning(666, "Unknown option: " + arg);
continue;
}
}
- errors += CompileFiles (arg, false);
+ CompileFiles (arg, false);
}
if (tokenize)
- return;
+ return true;
if (first_source == null){
Report.Error (2008, "No files to compile were specified");
- return;
+ return false;
}
if (Report.Errors > 0)
- return;
+ return false;
if (parse_only)
- return;
+ return true;
//
// Load Core Library for default compilation
@@ -795,9 +770,8 @@ namespace Mono.CSharp
if (load_default_config)
DefineDefaultConfig ();
- if (errors > 0){
- error ("Parsing failed");
- return;
+ if (Report.Errors > 0){
+ return false;
}
//
@@ -805,17 +779,15 @@ namespace Mono.CSharp
//
if (timestamps)
ShowTime ("Loading references");
- errors += LoadReferences ();
+ LoadReferences ();
+
if (timestamps)
ShowTime (" References loaded");
- if (errors > 0){
- error ("Could not load one or more assemblies");
- return;
+ if (Report.Errors > 0){
+ return false;
}
- error_count = errors;
-
//
// Quick hack
//
@@ -844,7 +816,7 @@ namespace Mono.CSharp
if (!RootContext.StdLib){
RootContext.ResolveCore ();
if (Report.Errors > 0)
- return;
+ return false;
}
TypeManager.InitCoreTypes ();
@@ -866,8 +838,7 @@ namespace Mono.CSharp
TypeManager.InitCodeHelpers ();
if (Report.Errors > 0){
- error ("Compilation failed");
- return;
+ return false;
}
//
@@ -880,8 +851,7 @@ namespace Mono.CSharp
ShowTime (" done");
if (Report.Errors > 0){
- error ("Compilation failed");
- return;
+ return false;
}
if (timestamps)
@@ -904,7 +874,7 @@ namespace Mono.CSharp
if (ep == null){
Report.Error (5001, "Program " + output_file +
" does not have an entry point defined");
- return;
+ return false;
}
CodeGen.AssemblyBuilder.SetEntryPoint (ep, k);
@@ -928,13 +898,13 @@ namespace Mono.CSharp
ShowTime ("Saved symbols");
}
- if (Report.Errors > 0){
- error ("Compilation failed");
- return;
- } else if (Report.ProbeCode != 0){
- error ("Failed to report code " + Report.ProbeCode);
- Environment.Exit (124);
+ if (Report.ExpectedError != 0){
+ Console.WriteLine("Failed to report expected error " + Report.ExpectedError);
+ Environment.Exit (1);
+ return false;
}
+
+ return (Report.Errors == 0);
}
}
diff --git a/mcs/mcs/genericparser.cs b/mcs/mcs/genericparser.cs
index 71f70c9db5e..522987d6f30 100644
--- a/mcs/mcs/genericparser.cs
+++ b/mcs/mcs/genericparser.cs
@@ -19,15 +19,13 @@ namespace Mono.Languages
/// </summary>
public abstract class GenericParser
{
- static protected int global_errors;
-
// Name of the file we are parsing
public string name;
// Input stream to parse from.
public System.IO.Stream input;
- public abstract int parse ();
+ public abstract void parse ();
public virtual string[] extensions()
{
@@ -35,28 +33,6 @@ namespace Mono.Languages
return list;
}
- /// <summary>
- /// Emits error messages and increments a global count of them
- /// </summary>
- /// <param name="code"></param>
- /// <param name="desc"></param>
- static public void error (int code, string desc)
- {
- Console.WriteLine ("Error "+code+": "+ desc);
- global_errors++;
- }
-
- // Emits error messages with location info.
- // FIXME : Ideally, all error reporting should happen
- // with Report.Error but how do you get at that non-static
- // method everywhere you need it ?
- static public void error (int code, Mono.CSharp.Location l, string text)
- {
- Console.WriteLine (l.Name + "(" + l.Row + "," +
- "): Error CS" + code + ": " + text);
- global_errors++;
- }
-
public GenericParser()
{
//
diff --git a/mcs/mcs/mb-parser.jay b/mcs/mcs/mb-parser.jay
index ebfb758b5bc..1ac5fb23622 100644
--- a/mcs/mcs/mb-parser.jay
+++ b/mcs/mcs/mb-parser.jay
@@ -1,480 +1,476 @@
-%{
-//
-// MonoBASIC.Parser.cs (from .jay): The Parser for the MonoBASIC compiler
-//
-// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
-//
-// Licensed under the terms of the GNU GPL
-//
-// Copyright (C) 2001 A Rafael D Teixeira
-//
-// TODO:
-// Nearly everything
-//
-
-namespace Mono.Languages.MonoBASIC
-{
- using System.Text;
- using System;
- using System.Collections;
-
- using CIR;
- using Mono.Languages;
- using Mono.Languages.MonoBASIC; // To get the tokenizer
-
- /// <summary>
- /// The MonoBASIC Parser
- /// </summary>
- public class Parser : GenericParser {
- Namespace current_namespace;
- TypeContainer current_container;
-
-/*
- /// <summary>
- /// Current block is used to add statements as we find
- /// them.
- /// </summary>
- Block current_block;
-
- /// <summary>
- /// Current interface is used by the various declaration
- /// productions in the interface declaration to "add"
- /// the interfaces as we find them.
- /// </summary>
- Interface current_interface;
-
- /// <summary>
- /// This is used by the unary_expression code to resolve
- /// a name against a parameter.
- /// </summary>
- Parameters current_local_parameters;
-
- /// <summary>
- /// Using during property parsing to describe the implicit
- /// value parameter that is passed to the "set" accessor
- /// method
- /// </summary>
- Parameter [] implicit_value_parameters;
-
-*/
- /// <summary>
- /// Used to record all types defined
- /// </summary>
- Tree tree;
-
- bool UseExtendedSyntax; // for ".mbs" files
-
- public override string[] GetExtensions()
- {
- string [] list = { ".vb", ".mbs" };
- return list;
- }
-
-%}
-
-%token EOF
-%token NONE /* This token is never returned by our lexer */
-%token ERROR // This is used not by the parser, but by the tokenizer.
- // do not remove.
-
-/*
- *These are the MonoBASIC keywords
- */
-%token ADDHANDLER
-%token ADDRESSOF
-%token ALIAS
-%token AND
-%token ANDALSO
-%token ANSI
-%token AS
-%token ASSEMBLY
-%token AUTO
-%token BOOLEAN
-%token BYREF
-%token BYTE
-%token BYVAL
-%token CALL
-%token CASE
-%token CATCH
-%token CBOOL
-%token CBYTE
-%token CCHAR
-%token CDATE
-%token CDEC
-%token CDBL
-%token CHAR
-%token CINT
-%token CLASS
-%token CLNG
-%token COBJ
-//%token COMPARE
-%token CONST
-%token CSHORT
-%token CSNG
-%token CSTR
-%token CTYPE
-%token DATE
-%token DECIMAL
-%token DECLARE
-%token DEFAULT
-%token DELEGATE
-%token DIM
-%token DO
-%token DOUBLE
-%token EACH
-%token ELSE
-%token ELSEIF
-%token END
-%token ENUM
-%token EOL
-%token ERASE
-%token ERROR
-%token EVENT
-%token EXIT
-//%token EXPLICIT
-%token FALSE
-%token FINALLY
-%token FOR
-%token FRIEND
-%token FUNCTION
-%token GET
-%token GETTYPE
-%token GOTO
-%token HANDLES
-%token IF
-%token IMPLEMENTS
-%token IMPORTS
-%token IN
-%token INHERITS
-%token INTEGER
-%token INTERFACE
-%token IS
-%token LET
-%token LIB
-%token LIKE
-%token LONG
-%token LOOP
-%token ME
-%token MOD
-%token MODULE
-%token MUSTINHERIT
-%token MUSTOVERRIDE
-%token MYBASE
-%token MYCLASS
-%token NAMESPACE
-%token NEW
-%token NEXT
-%token NOT
-%token NOTHING
-%token NOTINHERITABLE
-%token NOTOVERRIDABLE
-%token OBJECT
-%token ON
-%token OPTION
-%token OPTIONAL
-%token OR
-%token ORELSE
-%token OVERLOADS
-%token OVERRIDABLE
-%token OVERRIDES
-%token PARAM_ARRAY
-%token PRESERVE
-%token PRIVATE
-%token PROPERTY
-%token PROTECTED
-%token PUBLIC
-%token RAISEEVENT
-%token READONLY
-%token REDIM
-%token REM
-%token REMOVEHANDLER
-%token RESUME
-%token RETURN
-%token SELECT
-%token SET
-%token SHADOWS
-%token SHARED
-%token SHORT
-%token SINGLE
-%token SIZEOF
-%token STATIC
-%token STEP
-%token STOP
-%token STRING
-%token STRUCTURE
-%token SUB
-%token SYNCLOCK
-%token THEN
-%token THROW
-%token TO
-%token TRUE
-%token TRY
-%token TYPEOF
-%token UNICODE
-%token UNTIL
-%token VARIANT
-%token WHEN
-%token WHILE
-%token WITH
-%token WITHEVENTS
-%token WRITEONLY
-%token XOR
-
-/* MonoBASIC single character operators/punctuation. */
-%token OPEN_BRACKET "["
-%token CLOSE_BRACKET "]"
-%token OPEN_PARENS "("
-%token CLOSE_PARENS ")"
-%token DOT "."
-%token COMMA ","
-%token COLON ":"
-
-%token PLUS "+"
-%token MINUS "-"
-%token ASSIGN "="
-%token OP_LT "<"
-%token OP_GT ">"
-%token STAR "*"
-%token PERCENT "%"
-%token DIV "/"
-%token OP_EXP "^"
-%token INTERR "?"
-%token OP_IDIV "\\"
-%token OP_CONCAT "&"
-
-/* MonoBASIC multi-character operators. */
-%token OP_LE "<="
-%token OP_GE ">="
-%token OP_EQ "=="
-%token OP_NE "<>"
-%token OP_AND //"and"
-%token OP_OR //"or"
-%token OP_XOR //"xor"
-%token OP_MODULUS //"mod"
-%token OP_MULT_ASSIGN "*="
-%token OP_DIV_ASSIGN "/="
-%token OP_IDIV_ASSIGN "\\="
-%token OP_ADD_ASSIGN "+="
-%token OP_SUB_ASSIGN "-="
-%token OP_CONCAT_ASSIGN "&="
-%token OP_EXP_ASSIGN "^="
-
-/* Numbers */
-%token LITERAL_INTEGER "int literal"
-%token LITERAL_SINGLE "float literal"
-%token LITERAL_DOUBLE "double literal"
-%token LITERAL_DECIMAL "decimal literal"
-%token LITERAL_CHARACTER "character literal"
-%token LITERAL_STRING "string literal"
-
-%token IDENTIFIER
-
-/* Add precedence rules to solve dangling else s/r conflict */
-%nonassoc LOWPREC
-%nonassoc IF
-%nonassoc ELSE
-%right ASSIGN
-%left OP_OR
-%left OP_AND
-%left BITWISE_OR
-%left BITWISE_AND
-%left OP_SHIFT_LEFT OP_SHIFT_RIGHT
-%left PLUS MINUS
-%left STAR DIV PERCENT
-%right BITWISE_NOT CARRET UMINUS
-%nonassoc OP_INC OP_DEC
-%left OPEN_PARENS
-%left OPEN_BRACKET OPEN_BRACE
-%left DOT
-%nonassoc HIGHPREC
-
-%start compilation_unit
-%%
-
-compilation_unit
- : opt_imports_directives
- /* opt_attributes */
- opt_namespace_member_declarations
- EOF
- {
- $$ = $3;
- }
- ;
-
-qualified_identifier
- : IDENTIFIER
- | qualified_identifier DOT IDENTIFIER
- {
- $$ = (($1).ToString ()) + "." + ($3.ToString ());
- }
- ;
-
-opt_imports_directives
- : /* empty */
- | imports_directives
- ;
-
-imports_directives
- : imports_directive
- | imports_directives imports_directive
- ;
-
-imports_directive
- : /* imports_alias_directive
- | */ imports_namespace_directive
- ;
-
-imports_namespace_directive
- : IMPORTS namespace_name EOL
- {
- current_namespace.Using ((string) $2);
- }
- ;
-
-opt_attributes
- : /* empty */
- ;
-
-namespace_declaration
- : NAMESPACE qualified_identifier EOL
- {
- current_namespace = new Namespace (current_namespace, (string) $2);
- }
- opt_imports_directives
- opt_namespace_member_declarations
- END NAMESPACE EOL
- {
- current_namespace = current_namespace.Parent;
- }
- ;
-
-namespace_name
- : qualified_identifier
- ;
-
-
-
-opt_namespace_member_declarations
- : /* empty */
- | namespace_member_declarations
- ;
-
-namespace_member_declarations
- : namespace_member_declaration
- | namespace_member_declarations namespace_member_declaration
- ;
-
-namespace_member_declaration
- : namespace_declaration
- | type_declaration
- {
- int mod_flags = 0;
- string name = "";
-
- if ($1 is Class){
- Class c = (Class) $1;
- mod_flags = c.ModFlags;
- name = c.Name;
- } else if ($1 is Struct){
- Struct s = (Struct) $1;
- mod_flags = s.ModFlags;
- name = s.Name;
- } else
- break;
-
- }
- ;
-
-
-type_declaration
- : class_declaration
- ;
-
-
-class_declaration
- : /* opt_attributes opt_modifiers */
- CLASS IDENTIFIER /* opt_class_interfaces */ EOL
- {
- }
- opt_class_member_declarations
- END CLASS EOL
- {
- }
- ;
-
-opt_class_member_declarations
- : /* empty */
- | class_member_declarations
- ;
-
-class_member_declarations
- : class_member_declaration
- | class_member_declarations class_member_declaration
- ;
-
-class_member_declaration
- : type_declaration
- | sub_declaration
- ;
-
-sub_declaration
- : SUB qualified_identifier OPEN_PARENS opt_formal_parameters CLOSE_PARENS EOL
- opt_statements
- END SUB EOL
- ;
-
-opt_statements
- : /* empty */
- | qualified_identifier OPEN_PARENS opt_actual_parameters CLOSE_PARENS EOL
- ;
-
-opt_formal_parameters
- : /* empty */
- | qualified_identifier AS qualified_identifier
- ;
-
-opt_actual_parameters
- : /* empty */
- | qualified_identifier
- | LITERAL_STRING
- ;
-
-%%
-
-
-Tokenizer lexer;
-
-public override int parse ()
-{
- current_namespace = new Namespace (null, "");
- this.tree = rc.Tree;
- current_container = tree.Types;
- current_container.Namespace = current_namespace;
-
- UseExtendedSyntax = name.EndsWith(".mbs");
-
- lexer = new Tokenizer (input, name);
- StringBuilder value = new StringBuilder ();
-
- global_errors = 0;
- try
- {
- if (yacc_verbose_flag)
- yyparse (lexer, new yydebug.yyDebugSimple ());
- else
- yyparse (lexer);
- }
- catch (Exception e)
- {
- Console.WriteLine (lexer.location + " : Parsing error ");
- Console.WriteLine (e);
- global_errors++;
- }
-
- return global_errors;
-}
-
-/* end end end */
-}
-
-
+%{
+//
+// MonoBASIC.Parser.cs (from .jay): The Parser for the MonoBASIC compiler
+//
+// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// Copyright (C) 2001 A Rafael D Teixeira
+//
+// TODO:
+// Nearly everything
+//
+
+namespace Mono.Languages.MonoBASIC
+{
+ using System.Text;
+ using System;
+ using System.Collections;
+
+ using CIR;
+ using Mono.Languages;
+ using Mono.Languages.MonoBASIC; // To get the tokenizer
+
+ /// <summary>
+ /// The MonoBASIC Parser
+ /// </summary>
+ public class Parser : GenericParser {
+ Namespace current_namespace;
+ TypeContainer current_container;
+
+/*
+ /// <summary>
+ /// Current block is used to add statements as we find
+ /// them.
+ /// </summary>
+ Block current_block;
+
+ /// <summary>
+ /// Current interface is used by the various declaration
+ /// productions in the interface declaration to "add"
+ /// the interfaces as we find them.
+ /// </summary>
+ Interface current_interface;
+
+ /// <summary>
+ /// This is used by the unary_expression code to resolve
+ /// a name against a parameter.
+ /// </summary>
+ Parameters current_local_parameters;
+
+ /// <summary>
+ /// Using during property parsing to describe the implicit
+ /// value parameter that is passed to the "set" accessor
+ /// method
+ /// </summary>
+ Parameter [] implicit_value_parameters;
+
+*/
+ /// <summary>
+ /// Used to record all types defined
+ /// </summary>
+ Tree tree;
+
+ bool UseExtendedSyntax; // for ".mbs" files
+
+ public override string[] GetExtensions()
+ {
+ string [] list = { ".vb", ".mbs" };
+ return list;
+ }
+
+%}
+
+%token EOF
+%token NONE /* This token is never returned by our lexer */
+%token ERROR // This is used not by the parser, but by the tokenizer.
+ // do not remove.
+
+/*
+ *These are the MonoBASIC keywords
+ */
+%token ADDHANDLER
+%token ADDRESSOF
+%token ALIAS
+%token AND
+%token ANDALSO
+%token ANSI
+%token AS
+%token ASSEMBLY
+%token AUTO
+%token BOOLEAN
+%token BYREF
+%token BYTE
+%token BYVAL
+%token CALL
+%token CASE
+%token CATCH
+%token CBOOL
+%token CBYTE
+%token CCHAR
+%token CDATE
+%token CDEC
+%token CDBL
+%token CHAR
+%token CINT
+%token CLASS
+%token CLNG
+%token COBJ
+//%token COMPARE
+%token CONST
+%token CSHORT
+%token CSNG
+%token CSTR
+%token CTYPE
+%token DATE
+%token DECIMAL
+%token DECLARE
+%token DEFAULT
+%token DELEGATE
+%token DIM
+%token DO
+%token DOUBLE
+%token EACH
+%token ELSE
+%token ELSEIF
+%token END
+%token ENUM
+%token EOL
+%token ERASE
+%token ERROR
+%token EVENT
+%token EXIT
+//%token EXPLICIT
+%token FALSE
+%token FINALLY
+%token FOR
+%token FRIEND
+%token FUNCTION
+%token GET
+%token GETTYPE
+%token GOTO
+%token HANDLES
+%token IF
+%token IMPLEMENTS
+%token IMPORTS
+%token IN
+%token INHERITS
+%token INTEGER
+%token INTERFACE
+%token IS
+%token LET
+%token LIB
+%token LIKE
+%token LONG
+%token LOOP
+%token ME
+%token MOD
+%token MODULE
+%token MUSTINHERIT
+%token MUSTOVERRIDE
+%token MYBASE
+%token MYCLASS
+%token NAMESPACE
+%token NEW
+%token NEXT
+%token NOT
+%token NOTHING
+%token NOTINHERITABLE
+%token NOTOVERRIDABLE
+%token OBJECT
+%token ON
+%token OPTION
+%token OPTIONAL
+%token OR
+%token ORELSE
+%token OVERLOADS
+%token OVERRIDABLE
+%token OVERRIDES
+%token PARAM_ARRAY
+%token PRESERVE
+%token PRIVATE
+%token PROPERTY
+%token PROTECTED
+%token PUBLIC
+%token RAISEEVENT
+%token READONLY
+%token REDIM
+%token REM
+%token REMOVEHANDLER
+%token RESUME
+%token RETURN
+%token SELECT
+%token SET
+%token SHADOWS
+%token SHARED
+%token SHORT
+%token SINGLE
+%token SIZEOF
+%token STATIC
+%token STEP
+%token STOP
+%token STRING
+%token STRUCTURE
+%token SUB
+%token SYNCLOCK
+%token THEN
+%token THROW
+%token TO
+%token TRUE
+%token TRY
+%token TYPEOF
+%token UNICODE
+%token UNTIL
+%token VARIANT
+%token WHEN
+%token WHILE
+%token WITH
+%token WITHEVENTS
+%token WRITEONLY
+%token XOR
+
+/* MonoBASIC single character operators/punctuation. */
+%token OPEN_BRACKET "["
+%token CLOSE_BRACKET "]"
+%token OPEN_PARENS "("
+%token CLOSE_PARENS ")"
+%token DOT "."
+%token COMMA ","
+%token COLON ":"
+
+%token PLUS "+"
+%token MINUS "-"
+%token ASSIGN "="
+%token OP_LT "<"
+%token OP_GT ">"
+%token STAR "*"
+%token PERCENT "%"
+%token DIV "/"
+%token OP_EXP "^"
+%token INTERR "?"
+%token OP_IDIV "\\"
+%token OP_CONCAT "&"
+
+/* MonoBASIC multi-character operators. */
+%token OP_LE "<="
+%token OP_GE ">="
+%token OP_EQ "=="
+%token OP_NE "<>"
+%token OP_AND //"and"
+%token OP_OR //"or"
+%token OP_XOR //"xor"
+%token OP_MODULUS //"mod"
+%token OP_MULT_ASSIGN "*="
+%token OP_DIV_ASSIGN "/="
+%token OP_IDIV_ASSIGN "\\="
+%token OP_ADD_ASSIGN "+="
+%token OP_SUB_ASSIGN "-="
+%token OP_CONCAT_ASSIGN "&="
+%token OP_EXP_ASSIGN "^="
+
+/* Numbers */
+%token LITERAL_INTEGER "int literal"
+%token LITERAL_SINGLE "float literal"
+%token LITERAL_DOUBLE "double literal"
+%token LITERAL_DECIMAL "decimal literal"
+%token LITERAL_CHARACTER "character literal"
+%token LITERAL_STRING "string literal"
+
+%token IDENTIFIER
+
+/* Add precedence rules to solve dangling else s/r conflict */
+%nonassoc LOWPREC
+%nonassoc IF
+%nonassoc ELSE
+%right ASSIGN
+%left OP_OR
+%left OP_AND
+%left BITWISE_OR
+%left BITWISE_AND
+%left OP_SHIFT_LEFT OP_SHIFT_RIGHT
+%left PLUS MINUS
+%left STAR DIV PERCENT
+%right BITWISE_NOT CARRET UMINUS
+%nonassoc OP_INC OP_DEC
+%left OPEN_PARENS
+%left OPEN_BRACKET OPEN_BRACE
+%left DOT
+%nonassoc HIGHPREC
+
+%start compilation_unit
+%%
+
+compilation_unit
+ : opt_imports_directives
+ /* opt_attributes */
+ opt_namespace_member_declarations
+ EOF
+ {
+ $$ = $3;
+ }
+ ;
+
+qualified_identifier
+ : IDENTIFIER
+ | qualified_identifier DOT IDENTIFIER
+ {
+ $$ = (($1).ToString ()) + "." + ($3.ToString ());
+ }
+ ;
+
+opt_imports_directives
+ : /* empty */
+ | imports_directives
+ ;
+
+imports_directives
+ : imports_directive
+ | imports_directives imports_directive
+ ;
+
+imports_directive
+ : /* imports_alias_directive
+ | */ imports_namespace_directive
+ ;
+
+imports_namespace_directive
+ : IMPORTS namespace_name EOL
+ {
+ current_namespace.Using ((string) $2);
+ }
+ ;
+
+opt_attributes
+ : /* empty */
+ ;
+
+namespace_declaration
+ : NAMESPACE qualified_identifier EOL
+ {
+ current_namespace = new Namespace (current_namespace, (string) $2);
+ }
+ opt_imports_directives
+ opt_namespace_member_declarations
+ END NAMESPACE EOL
+ {
+ current_namespace = current_namespace.Parent;
+ }
+ ;
+
+namespace_name
+ : qualified_identifier
+ ;
+
+
+
+opt_namespace_member_declarations
+ : /* empty */
+ | namespace_member_declarations
+ ;
+
+namespace_member_declarations
+ : namespace_member_declaration
+ | namespace_member_declarations namespace_member_declaration
+ ;
+
+namespace_member_declaration
+ : namespace_declaration
+ | type_declaration
+ {
+ int mod_flags = 0;
+ string name = "";
+
+ if ($1 is Class){
+ Class c = (Class) $1;
+ mod_flags = c.ModFlags;
+ name = c.Name;
+ } else if ($1 is Struct){
+ Struct s = (Struct) $1;
+ mod_flags = s.ModFlags;
+ name = s.Name;
+ } else
+ break;
+
+ }
+ ;
+
+
+type_declaration
+ : class_declaration
+ ;
+
+
+class_declaration
+ : /* opt_attributes opt_modifiers */
+ CLASS IDENTIFIER /* opt_class_interfaces */ EOL
+ {
+ }
+ opt_class_member_declarations
+ END CLASS EOL
+ {
+ }
+ ;
+
+opt_class_member_declarations
+ : /* empty */
+ | class_member_declarations
+ ;
+
+class_member_declarations
+ : class_member_declaration
+ | class_member_declarations class_member_declaration
+ ;
+
+class_member_declaration
+ : type_declaration
+ | sub_declaration
+ ;
+
+sub_declaration
+ : SUB qualified_identifier OPEN_PARENS opt_formal_parameters CLOSE_PARENS EOL
+ opt_statements
+ END SUB EOL
+ ;
+
+opt_statements
+ : /* empty */
+ | qualified_identifier OPEN_PARENS opt_actual_parameters CLOSE_PARENS EOL
+ ;
+
+opt_formal_parameters
+ : /* empty */
+ | qualified_identifier AS qualified_identifier
+ ;
+
+opt_actual_parameters
+ : /* empty */
+ | qualified_identifier
+ | LITERAL_STRING
+ ;
+
+%%
+
+
+Tokenizer lexer;
+
+public override void parse ()
+{
+ current_namespace = new Namespace (null, "");
+ this.tree = rc.Tree;
+ current_container = tree.Types;
+ current_container.Namespace = current_namespace;
+
+ UseExtendedSyntax = name.EndsWith(".mbs");
+
+ lexer = new Tokenizer (input, name);
+ StringBuilder value = new StringBuilder ();
+
+ try
+ {
+ if (yacc_verbose_flag)
+ yyparse (lexer, new yydebug.yyDebugSimple ());
+ else
+ yyparse (lexer);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine (lexer.location + " : Parsing error ");
+ Console.WriteLine (e);
+ }
+}
+
+/* end end end */
+}
+
+
diff --git a/mcs/mcs/namespace.cs b/mcs/mcs/namespace.cs
index d310d9a4c80..215a07e6270 100755
--- a/mcs/mcs/namespace.cs
+++ b/mcs/mcs/namespace.cs
@@ -73,7 +73,7 @@ namespace Mono.CSharp {
public void Using (string ns)
{
if (decl_found){
- GenericParser.error (1529, "A using clause must precede all other namespace elements");
+ Report.Error (1529, "A using clause must precede all other namespace elements");
return;
}
@@ -127,7 +127,7 @@ namespace Mono.CSharp {
if (de.Value == null){
string name = (string) de.Key;
- GenericParser.error (234, "The type or namespace `" +
+ Report.Error (234, "The type or namespace `" +
name + "' does not exist in the " +
"class or namespace `" + name + "'");
}
diff --git a/mcs/mcs/report.cs b/mcs/mcs/report.cs
index 0ffc2dfc188..73a41fcdf2b 100644
--- a/mcs/mcs/report.cs
+++ b/mcs/mcs/report.cs
@@ -45,12 +45,12 @@ namespace Mono.CSharp {
static public bool Stacktrace;
//
- // If the error code is reported on the given line,
- // then the process exits with a unique error code.
+ // If the 'expected' error code is reported then the
+ // compilation succeeds.
//
// Used for the test suite to excercise the error codes
//
- static int probe_error = 0;
+ static int expected_error = 0;
//
// Keeps track of the warnings that we are ignoring
@@ -59,11 +59,11 @@ namespace Mono.CSharp {
static void Check (int code)
{
- if (code == probe_error){
+ if (code == expected_error){
if (Fatal)
throw new Exception ();
- Environment.Exit (123);
+ Environment.Exit (0);
}
}
@@ -147,16 +147,14 @@ namespace Mono.CSharp {
warning_ignore_table [code] = true;
}
- static public void SetProbe (int code)
- {
- probe_error = code;
- }
-
- static public int ProbeCode {
- get {
- return probe_error;
- }
- }
+ static public int ExpectedError {
+ set {
+ expected_error = value;
+ }
+ get {
+ return expected_error;
+ }
+ }
}
public class Message {
diff --git a/mcs/tests/ChangeLog b/mcs/tests/ChangeLog
index 0de5ff165ea..2cda7167c38 100755
--- a/mcs/tests/ChangeLog
+++ b/mcs/tests/ChangeLog
@@ -1,3 +1,14 @@
+2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
+
+ * makefile: The following tests fail under linux and have been
+ moved to TEST_NOPASS: 40, 45, 52, 53, 91, 106, 107, 122, 132, 133
+
+ Windows-specific tests have been extracted, and are now run by the
+ test-windows rule (it'll be run under linux but fail)
+
+ The output format has been made less noisy, and is basically the
+ same as the tests in mcs/errors - like "Running test-1 ... OK".
+
2002-06-13 Ravi Pratap <ravi@ximian.com>
* test-131.cs : Add to test enum member attribute application.
diff --git a/mcs/tests/makefile b/mcs/tests/makefile
index 57669edfd45..d722b4546bc 100755
--- a/mcs/tests/makefile
+++ b/mcs/tests/makefile
@@ -7,69 +7,93 @@ TEST_SOURCES = \
test-1 test-2 test-3 test-4 test-5 test-6 test-7 test-8 test-9 test-10 \
test-11 test-12 test-13 test-14 test-15 test-16 test-17 test-18 test-19 test-20 \
test-21 test-22 test-23 test-24 test-25 test-26 test-27 test-28 test-30 \
- test-31 test-32 test-33 test-34 test-35 test-36 test-37 test-39 test-40 \
- test-41 test-42 test-43 test-44 test-45 test-46 test-47 test-48 test-49 test-50 \
- test-51 test-52 test-53 test-54 test-55 test-56 test-57 test-59 test-60 \
- test-61 test-62 test-63 test-64 test-65 test-66 test-67 test-68 test-69 test-70 \
+ test-31 test-32 test-33 test-34 test-35 test-36 test-37 test-39 \
+ test-41 test-42 test-43 test-44 test-46 test-47 test-48 test-49 \
+ test-51 test-54 test-55 test-56 test-57 test-59 test-60 \
+ test-61 test-62 test-63 test-64 test-65 test-66 test-68 test-69 test-70 \
test-71 test-72 test-73 test-74 test-75 test-76 test-77 test-78 test-79 test-80 \
test-81 test-82 test-83 test-84 test-85 test-86 test-87 test-88 test-89 test-90 \
- test-91 test-92 test-93 test-94 test-95 test-96 test-97 test-98 test-99 test-100\
- test-101 test-102 test-103 test-104 test-105 test-106 test-107 test-108 test-109 test-110\
+ test-92 test-93 test-94 test-95 test-96 test-97 test-98 test-99 test-100\
+ test-101 test-102 test-103 test-104 test-105 test-108 test-109 test-110\
test-111 test-112 test-113 test-114 test-115 test-116 test-117 test-118 test-119 \
- test-121 test-122 test-123 test-125 test-126 test-127 test-128 test-129 test-130 \
- test-131 test-132 test-133 test-134 test-135
+ test-121 test-123 test-125 test-126 test-127 test-128 test-129 test-130 \
+ test-131 test-134 test-135
UNSAFE_SOURCES = \
unsafe-1 unsafe-2 unsafe-3
-TEST_NOPASS = \
- test-29 test-38 \
- test-120
+WINDOWS_SOURCES = \
+ test-50 test-67
+# A test is a 'no pass' if it fails on either windows or linux
# Test 120 does not pass because the MS.NET runtime is buggy.
+TEST_NOPASS = \
+ test-29 test-38 test-40 test-45 test-52 test-53 test-91 test-106 test-107 \
+ test-120 test-122 test-132 test-133
+
+all: test-compiler test-unsafe test-windows
-all: test-compiler test-unsafe
+# Compile with mono, run with MS jit
test-compiler:
- -rm *.exe
+ @rm -f *.exe; \
for i in $(TEST_SOURCES); do \
+ echo -n "Running $$i ... "; \
if $(MCS) $$i.cs > /dev/null; then \
- if ./$$i.exe; then \
- echo $$i: ok; \
+ if ./$$i.exe > /dev/null; then \
+ echo OK; \
else \
- echo test $$i failed; exit; \
+ echo FAILED; exit 1; \
fi; \
else \
- echo compiler failed on $$i; exit; \
+ echo FAILED TO COMPILE; exit 1; \
fi \
done
+# Compile with mono, run with MS jit
test-unsafe:
- for i in $(UNSAFE_SOURCES); do \
+ @for i in $(UNSAFE_SOURCES); do \
+ echo -n "Running (unsafe) $$i ... "; \
if $(MCS) --unsafe $$i.cs > /dev/null; then \
- if ./$$i.exe; then \
- echo $$i: ok; \
+ if ./$$i.exe > /dev/null; then \
+ echo OK; \
else \
- echo test $$i failed; exit; \
+ echo FAILED; exit 1; \
fi; \
else \
- echo compiler failed on $$i; exit; \
+ echo FAILED WHILE COMPILING; exit 1; \
fi \
done
+# Compiled (previously) with mono, run with mono jit
test-jit:
- for i in $(TEST_SOURCES:.cs=.exe); do \
- if mono ./$$i.exe; then \
- echo $$i: ok; \
+ @for i in $(TEST_SOURCES:.cs=.exe); do \
+ echo -n "Running jit $$i ... "; \
+ if mono ./$$i.exe > /dev/null; then \
+ echo OK; \
else \
- echo test $$i failed; exit; \
+ echo FAILED; exit 1; \
fi \
done
-
+# Compiled with mono, run with MS jit
+test-windows:
+ @echo Running windows-only tests - these will fail on linux; \
+ for i in $(WINDOWS_SOURCES); do \
+ echo -n "Running $$i ... "; \
+ if $(MCS) $$i.cs > /dev/null; then \
+ if ./$$i.exe > /dev/null; then \
+ echo OK; \
+ else \
+ echo FAILED; exit 1; \
+ fi; \
+ else \
+ echo FAILED TO COMPILE; exit 1; \
+ fi \
+ done
verify:
- for i in $(TEST_SOURCES); do \
+ @for i in $(TEST_SOURCES); do \
if $(MCS) -o mcs-gen-code.exe $$i.cs > /dev/null; then \
if $(CSC) /out:csc-gen-code.exe $$i.cs > /dev/null; then \
if $(VERIFY) mcs-gen-code.exe csc-gen-code.exe > /dev/null; then \
@@ -79,7 +103,8 @@ verify:
fi; \
fi \
fi \
- done
+ done; \
+ echo Verification passed
casts.cs: gen-cast-test.cs