[svn] r7378: nemerle/trunk/ncc: parsing/Lexer.n
parsing/MainParser.n typing/TyVarEnv.n
VladD2
svnadmin at nemerle.org
Mon Feb 5 00:32:41 CET 2007
Log:
Improve error messages which reported if type reference not present or not wellformed.
Author: VladD2
Date: Mon Feb 5 00:32:39 2007
New Revision: 7378
Modified:
nemerle/trunk/ncc/parsing/Lexer.n
nemerle/trunk/ncc/parsing/MainParser.n
nemerle/trunk/ncc/typing/TyVarEnv.n
Modified: nemerle/trunk/ncc/parsing/Lexer.n
==============================================================================
--- nemerle/trunk/ncc/parsing/Lexer.n (original)
+++ nemerle/trunk/ncc/parsing/Lexer.n Mon Feb 5 00:32:39 2007
@@ -105,7 +105,8 @@
| Comment (value) => "/*" + value + "*/"
- | EndOfFile | EndOfGroup => ""
+ | EndOfFile => " /*EOF*/ "
+ | EndOfGroup => " /*EOG*/ "
| Semicolon => ";"
| Comma => ","
Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n (original)
+++ nemerle/trunk/ncc/parsing/MainParser.n Mon Feb 5 00:32:39 2007
@@ -613,20 +613,32 @@
def tyvars = parse_tyvars ();
def t_extends =
match (peek_token ()) {
- | Token.Operator (":") =>
+ | Token.Operator (":") as colonToc =>
+ def errTypeExpected(loc)
+ {
+ Message.Error (loc, "Type expected");
+ end_loc = loc;
+ }
+
shift ();
- match (maybe_parse_ellipsis ()) {
+ def tok = peek_token ();
+
+ // if type not present.
+ if (tok == null || tok is Token.BracesGroup || tok is Token.Keyword ("where")) {
+ errTypeExpected (colonToc.Location);
+ []
+ }
+ else match (maybe_parse_ellipsis ()) {
| Some (e) => [e]
| _ =>
// parse , separated sequence as one expression
def res = comma_separated_list (() => parse_expr (TokenStoppers.All));
- match (res.Find (_ is PExpr.Error))
+ match (res.Find (e => e is PExpr.Error || e is Member (_, null)))
{
- | Some(errTok) =>
- Message.Error (errTok.Location.FromStart (), "Type expected");
- end_loc = errTok.Location;
+ | Some (errTok) =>
push_back ();
- res.Filter (x => !(x is PExpr.Error))
+ errTypeExpected (errTok.Location);
+ res.Filter (e => !(e is PExpr.Error || e is Member (_, null)))
| _ => res
}
}
Modified: nemerle/trunk/ncc/typing/TyVarEnv.n
==============================================================================
--- nemerle/trunk/ncc/typing/TyVarEnv.n (original)
+++ nemerle/trunk/ncc/typing/TyVarEnv.n Mon Feb 5 00:32:39 2007
@@ -71,9 +71,10 @@
t : PExpr,
check_parms : bool) : MType
{
- def t = Bind (env, curtc, t,
+ def t = Util.locate(t.Location,
+ Bind (env, curtc, t,
allow_tyvars = false,
- check_parms = check_parms);
+ check_parms = check_parms));
t.Fix ()
}
@@ -323,7 +324,7 @@
Util.ice ("Type arguments list survived to typying.")
| x =>
- ReportError (messenger, $ "$x is not a legal type expression");
+ ReportError (messenger, $ "`$x' is not a legal type expression");
InternalType.Void
}
} and type_class (tyexpr) : TyVar {
More information about the svn
mailing list