Changeset 348

Show
Ignore:
Timestamp:
09/14/08 04:36:29 (4 months ago)
Author:
sergey.kol..@gmail.com
Message:

Sergey Kolos:

  • Fixed bug: when compiling on save of a one changed expression all compile markers in the file are removed.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • jasko.tim.lisp/src/jasko/tim/lisp/builder/LispBuilder.java

    r347 r348  
    179179                                SwankInterface swank = LispPlugin.getDefault().getSwank(); 
    180180                                swank.sendCompileFile(file.getLocation().toString(),  
    181                                                 new CompileListener(file)); 
     181                                                new CompileListener(file,true)); 
    182182                                System.out.printf("Compiling %s\n", file.getLocation().toString()); 
    183183                        } catch (Exception e) { 
     
    218218                boolean compiledByAsd = false; 
    219219                String asdFile = ""; 
     220                boolean removeCompileMarkers = true; 
    220221                 
    221                 public CompileListener(IFile file) { 
     222                public CompileListener(IFile file, boolean removeCompileMarkers) { 
    222223                        this.file = file; 
    223224                        offset = 0; 
     
    225226                        compiledByAsd = false; 
    226227                        asdFile = ""; 
     228                        this.removeCompileMarkers = removeCompileMarkers; 
    227229                } 
    228230                 
     
    242244                public void run() { 
    243245                        ArrayList<String> files = new ArrayList<String>(); 
    244                         if ( file != null && length == 0){ 
     246                        if ( file != null && length == 0 && removeCompileMarkers ){ 
    245247                                LispMarkers.deleteCompileMarkers(file); 
    246248                        } else if ( file != null && length > 0) { 
     
    319321                                        } 
    320322                                        if( nwarnings > 0 ){ 
    321                                                 torepl += "wanrings"; 
     323                                                torepl += "warnings"; 
    322324                                        } 
    323325                                        repl.appendText(torepl); 
     
    581583        } 
    582584 
     585        public static boolean checkLisp(IFile resource, int offset, int length) { 
     586                if( !(resource.getName().endsWith(".lisp") || resource.getName().endsWith(".el") 
     587                                                || resource.getName().endsWith(".cl"))) { 
     588                        return false; 
     589                } else { 
     590                         
     591                        try { 
     592                                IFile file = (IFile) resource; 
     593                                LispMarkers.deleteCompileMarkers(file, offset, length);                                                          
     594                                System.out.println("*builder*"); 
     595                                boolean paren = checkParenBalancing(file); 
     596                                LispNode code = LispParser.parse(file); 
     597                                boolean pack = checkPackageDependence(code,file); 
     598                                boolean commas = checkCommas(code,file); 
     599                                checkMultipleDefuncs(code,file); 
     600                                return (paren && pack && commas); 
     601                        } catch (Exception e) { 
     602                                e.printStackTrace(); 
     603                                return false; 
     604                        } 
     605                } 
     606        } 
    583607         
    584608        public static boolean checkLisp(IFile resource) { 
  • jasko.tim.lisp/src/jasko/tim/lisp/builder/LispMarkers.java

    r304 r348  
    7575                                } 
    7676                        } 
    77                         markers = file.findMarkers(LISP_COMPILE_MARKER, true, IResource.DEPTH_ZERO); 
    7877                } catch (CoreException e1) { 
    7978                        e1.printStackTrace(); 
  • jasko.tim.lisp/src/jasko/tim/lisp/editors/LispEditor.java

    r331 r348  
    406406        private void compileOnSave() { 
    407407                IDocument doc = getDocument(); 
    408                 if( LispBuilder.checkLisp(getIFile()) ){ 
     408                if( true /*LispBuilder.checkLisp(getIFile()) */){ 
    409409                        SwankInterface swank = LispPlugin.getDefault().getSwank();  
    410410                        ArrayList<TopLevelItem> newForms =  
     
    424424                        } 
    425425                        if( pos == null || pos.length == 0 ){ //compile whole file 
    426                                 LispBuilder.compileFile(getIFile(),false); 
     426                                if(LispBuilder.checkLisp(getIFile())){ 
     427                                        LispBuilder.compileFile(getIFile(),false);                                       
     428                                } 
    427429                        } else {  
    428430                                compileForms(getFormsToCompile(pos, newForms, toDefine)); 
     
    462464                                        try{ 
    463465                                                sexp = doc.get(offset,n-offset); 
    464                                                 LispBuilder.compileFilePart(getIFile(), sexp, offset); 
     466                                                if(LispBuilder.checkLisp(getIFile())){ 
     467                                                        LispBuilder.compileFilePart(getIFile(), sexp, offset); 
     468                                                } 
    465469                                                doc.removePositionCategory(CHANGED_POS_FOR_COMPILE); 
    466470                                                doc.addPositionCategory(CHANGED_POS_FOR_COMPILE); 
     
    470474                                        break; 
    471475                                } else if ( sexp != null && sexp != "" ){ 
    472                                         LispBuilder.compileFilePart(getIFile(), sexp, offset);                                                                   
     476                                        if(LispBuilder.checkLisp(getIFile(), offset, sexp.length())){ 
     477                                                LispBuilder.compileFilePart(getIFile(), sexp, offset);                                           
     478                                        } 
    473479                                } 
    474480                        } 
     
    648654                for( String itm: toUndefine){ 
    649655                        String[] item = itm.split(","); 
    650                         LispBuilder.CompileListener cl = new LispBuilder.CompileListener(this.getIFile()); 
     656                        LispBuilder.CompileListener cl = new LispBuilder.CompileListener(this.getIFile(),false); 
    651657                        if( item[0].equalsIgnoreCase("defun") ){ 
    652658                                LispPlugin.getDefault().getSwank().sendUndefine(item[1], item[2], cl);