Changeset 907

Show
Ignore:
Timestamp:
11/09/07 19:25:07 (1 year ago)
Author:
asterite
Message:

Fixed ticket #25. Also fixed some bugs with parsing pragmas (#line).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/descent.core/src/descent/core/dom/CompilationUnitResolver.java

    r902 r907  
    3737public class CompilationUnitResolver extends descent.internal.compiler.Compiler { 
    3838     
    39     private final static boolean RESOLVE = false; 
     39    private final static boolean RESOLVE = true; 
    4040    private final static boolean SYSOUT = false; 
    4141     
  • trunk/descent.core/src/descent/internal/compiler/parser/Lexer.java

    r887 r907  
    50795079            int result = Character.codePointAt(input, p); 
    50805080            // increase p with the count of chars for the decoded codepoint.  
    5081             p = Character.offsetByCodePoints(input, 0, input.length, p, 1)
     5081            p = Character.offsetByCodePoints(input, 0, input.length, p, 1) - 1
    50825082            return result; 
    50835083        } catch (Exception e) { 
  • trunk/descent.core/src/descent/internal/compiler/parser/Parser.java

    r902 r907  
    69106910                // TODO improve performance 
    69116911                StringTokenizer st = new StringTokenizer(new String(token.sourceString).substring(1)); 
    6912                 if (st.countTokens() != 3) { 
     6912                int count = st.countTokens(); 
     6913                if (count <= 1 || count >= 4) { 
    69136914                    error(IProblem.InvalidPragmaSyntax, token); 
    69146915                    setMalformed(pragma); 
     
    69216922                        value = st.nextToken(); 
    69226923                        try { 
    6923                             int num = Integer.parseInt(value); 
    6924                             if (num <= 0) throw new NumberFormatException(); 
     6924                            if (!"__LINE__".equals(value)) { 
     6925                                int num = Integer.parseInt(value); 
     6926                                if (num < 0) throw new NumberFormatException(); 
     6927                            } 
    69256928                             
    6926                             value = st.nextToken(); 
    6927                             if (!"__FILE__".equals(value)) { 
    6928                                 if (value.length() < 2 || value.charAt(0) != '"' || value.charAt(value.length() - 1) != '"') { 
    6929                                     error(IProblem.InvalidPragmaSyntax, token); 
    6930                                     setMalformed(pragma); 
     6929                            if (st.hasMoreTokens()) { 
     6930                                value = st.nextToken(); 
     6931                                if (!"__FILE__".equals(value)) { 
     6932                                    if (value.length() < 2 || value.charAt(0) != '"' || value.charAt(value.length() - 1) != '"') { 
     6933                                        error(IProblem.InvalidPragmaSyntax, token); 
     6934                                        setMalformed(pragma); 
     6935                                    } 
    69316936                                } 
    69326937                            } 
  • trunk/descent.tests/descent/tests/dstress/DstressTestGeneratorBase.java

    r890 r907  
    15031503        failures.add("typeof_17_C.d"); 
    15041504         
     1505        // These ones deals with encoding, but Eclipse already do that 
     1506        // for us... just ignore them, they work 
     1507        failures.add("encoding_utf_16be_bom.d"); 
     1508        failures.add("encoding_utf_16le.d"); 
     1509        failures.add("encoding_utf_16le_bom.d"); 
     1510        failures.add("encoding_utf_32le.d"); 
     1511        failures.add("encoding_utf_32le_bom.d"); 
     1512        failures.add("encoding_utf_8.d"); 
     1513        failures.add("encoding_utf_8_bom.d"); 
     1514        for(int i = 0; i <= 7; i++) { 
     1515            failures.add("unicode_0" + i + ".d"); 
     1516        } 
     1517        failures.add("eol_comment_07.d"); 
     1518        failures.add("eol_comment_08.d"); 
     1519        failures.add("eol_comment_09.d"); 
     1520        failures.add("eol_01.d"); 
     1521        failures.add("eol_02.d"); 
     1522        failures.add("eol_03.d"); 
    15051523         
    15061524        // Although they are not failures, Descent dies because of 
  • trunk/descent.tests/descent/tests/mars/Bugs_Test.java

    r900 r907  
    325325    } 
    326326     
     327    public void testTicket25() { 
     328        String s; 
     329         
     330        s = "char[] s = \"°a\";"; 
     331        assertEquals(0, getCompilationUnit(s).problems.size()); 
     332         
     333        s = "char[] s = \"a°\";"; 
     334        assertEquals(0, getCompilationUnit(s).problems.size()); 
     335    } 
     336     
    327337    public void testTypeSArray1() { 
    328338        String s = "bool[2][4] b;";