Changeset 348
- Timestamp:
- 09/14/08 04:36:29 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
jasko.tim.lisp/src/jasko/tim/lisp/builder/LispBuilder.java
r347 r348 179 179 SwankInterface swank = LispPlugin.getDefault().getSwank(); 180 180 swank.sendCompileFile(file.getLocation().toString(), 181 new CompileListener(file ));181 new CompileListener(file,true)); 182 182 System.out.printf("Compiling %s\n", file.getLocation().toString()); 183 183 } catch (Exception e) { … … 218 218 boolean compiledByAsd = false; 219 219 String asdFile = ""; 220 boolean removeCompileMarkers = true; 220 221 221 public CompileListener(IFile file ) {222 public CompileListener(IFile file, boolean removeCompileMarkers) { 222 223 this.file = file; 223 224 offset = 0; … … 225 226 compiledByAsd = false; 226 227 asdFile = ""; 228 this.removeCompileMarkers = removeCompileMarkers; 227 229 } 228 230 … … 242 244 public void run() { 243 245 ArrayList<String> files = new ArrayList<String>(); 244 if ( file != null && length == 0 ){246 if ( file != null && length == 0 && removeCompileMarkers ){ 245 247 LispMarkers.deleteCompileMarkers(file); 246 248 } else if ( file != null && length > 0) { … … 319 321 } 320 322 if( nwarnings > 0 ){ 321 torepl += "wa nrings";323 torepl += "warnings"; 322 324 } 323 325 repl.appendText(torepl); … … 581 583 } 582 584 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 } 583 607 584 608 public static boolean checkLisp(IFile resource) { jasko.tim.lisp/src/jasko/tim/lisp/builder/LispMarkers.java
r304 r348 75 75 } 76 76 } 77 markers = file.findMarkers(LISP_COMPILE_MARKER, true, IResource.DEPTH_ZERO);78 77 } catch (CoreException e1) { 79 78 e1.printStackTrace(); jasko.tim.lisp/src/jasko/tim/lisp/editors/LispEditor.java
r331 r348 406 406 private void compileOnSave() { 407 407 IDocument doc = getDocument(); 408 if( LispBuilder.checkLisp(getIFile())){408 if( true /*LispBuilder.checkLisp(getIFile()) */){ 409 409 SwankInterface swank = LispPlugin.getDefault().getSwank(); 410 410 ArrayList<TopLevelItem> newForms = … … 424 424 } 425 425 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 } 427 429 } else { 428 430 compileForms(getFormsToCompile(pos, newForms, toDefine)); … … 462 464 try{ 463 465 sexp = doc.get(offset,n-offset); 464 LispBuilder.compileFilePart(getIFile(), sexp, offset); 466 if(LispBuilder.checkLisp(getIFile())){ 467 LispBuilder.compileFilePart(getIFile(), sexp, offset); 468 } 465 469 doc.removePositionCategory(CHANGED_POS_FOR_COMPILE); 466 470 doc.addPositionCategory(CHANGED_POS_FOR_COMPILE); … … 470 474 break; 471 475 } 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 } 473 479 } 474 480 } … … 648 654 for( String itm: toUndefine){ 649 655 String[] item = itm.split(","); 650 LispBuilder.CompileListener cl = new LispBuilder.CompileListener(this.getIFile() );656 LispBuilder.CompileListener cl = new LispBuilder.CompileListener(this.getIFile(),false); 651 657 if( item[0].equalsIgnoreCase("defun") ){ 652 658 LispPlugin.getDefault().getSwank().sendUndefine(item[1], item[2], cl);
