Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3991

Show
Ignore:
Timestamp:
10/08/08 12:07:45 (1 month ago)
Author:
Jim Panic
Message:

Fixed some more bugs and finally added file & line information to error messages.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/tango.test/tango/test/dtcc/Adapter.d

    r3990 r3991  
    6363            } 
    6464        } 
     65 
     66        return cast(TestMethod!(T))null; 
    6567    } 
    6668} 
  • branches/tango.test/tango/test/dtcc/Lexer.d

    r3985 r3991  
    107107        } 
    108108        catch (Exception e) { 
    109             Stdout.formatln("{}", e); 
     109            Stdout.formatln("{}", (new UnexpectedCharacter(e.toString)).toString(fileName, linesCountForIndex(currentIndex))); 
     110            throw new Exception("Aborting
"); 
    110111        } 
    111112    } 
  • branches/tango.test/tango/test/dtcc/LexerFunctions.d

    r3985 r3991  
    3434Indices consumeWord(T) (T[] source, uint startIndex)  
    3535    in { assert(isValidIdentifierStart(source[startIndex]),  
    36                 "Unexpected character \"" ~ source[startIndex..startIndex + 1] ~ "\", expected a ValidIdentifierStart character."); } 
     36                "Unexpected character '" ~ source[startIndex..startIndex + 1] ~ "'."); } 
    3737body 
    3838{ 
     
    8282 
    8383    if (indices["endName"] == source.length) 
    84         throw new UnexpectedCharacter("Unexpected end of file (consumeSecondClassAnnotation)"); 
     84        Fiber.yieldAndThrow(new UnexpectedCharacter("Unexpected end of file (consumeSecondClassAnnotation)")); 
    8585 
    8686    /* TODO: validate that there are no whitespace characters between name  
     
    9191 
    9292    if (indices["endArgument"] == source.length) 
    93         throw new UnexpectedCharacter("Unexpected end of file (consumeSecondClassAnnotation)"); 
     93        Fiber.yieldAndThrow(new UnexpectedCharacter("Unexpected end of file (consumeSecondClassAnnotation)")); 
    9494 
    9595    indices["endAnnotation"] = indices["endArgument"] + 1; 
     
    305305 
    306306            if (source[endIndex] == '+' && source[endIndex + 1] == '/') break; 
    307             if (source[endIndex] != '/') continue; 
    308             else { 
     307            if (source[endIndex] == '/') { 
    309308                switch (source[endIndex + 1]) { 
    310309                case '+': endIndex = consumeNestedComment(endIndex); continue; 
     
    312311                case '/': endIndex = consumeOneLineComment(endIndex); continue; 
    313312                } 
    314             } 
     313            } else continue; 
    315314        } 
    316315 
     
    392391            else throw(new UnexpectedCharacter("Unexpected character ')'")); 
    393392 
    394         case '/': if ("+*/".contains(c)) indices["endDCodeBlock"] = consumeComments!(T)(source, indices["endDCodeBlock"])["endComment"]; continue; 
     393        case '/':  
     394            if ("+*/".contains(source[indices["endDCodeBlock"] + 1])) { 
     395                indices["endDCodeBlock"] = consumeComments!(T)(source, indices["endDCodeBlock"])["endComment"];  
     396            } 
     397            continue; 
    395398 
    396399        case '\'': 
  • branches/tango.test/tango/test/dtcc/Util.d

    r3985 r3991  
    4545***************************************************************************/ 
    4646 
    47 class UnexpectedCharacter { 
    48     char[]  message; 
    49  
    50     public this (char[] _message) { 
    51         message = _message; 
     47class UnexpectedCharacter: Exception { 
     48    public this (char[] msg) { 
     49        super(msg); 
    5250    } 
    5351 
    5452    public char[] toString (char[] fileName, uint line) { 
    55         return Format.convert("{}({}): {}", fileName, line, message); 
     53        return Format.convert("{}({}): {}", fileName, line, msg); 
    5654    } 
    5755}