From: <ox-...@us...> - 2003-04-22 22:33:57
|
Update of /cvsroot/sheets/sheets In directory sc8-pr-cvs1:/tmp/cvs-serv16956 Modified Files: .sheetsrc Sheets.sheets Log Message: Added support for multi-line compile command parsing (if you have any existing regular expressions in your .sheetsrc file, make sure that you fix them) Added a new default javac regexp that properly handles multi-line results (no more partial results) Index: .sheetsrc =================================================================== RCS file: /cvsroot/sheets/sheets/.sheetsrc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** .sheetsrc 21 Apr 2003 19:17:19 -0000 1.11 --- .sheetsrc 22 Apr 2003 22:33:47 -0000 1.12 *************** *** 3,18 **** ########################################## ! set compile-command "ant.bat compile" ! set recompile-command "ant.bat clean" # Use these instead for *nix systems ! #set compile-command "./ant compile" ! #set recompile-command "./ant clean" #set windows-task-bar-height 0 #set screen-insets 0 108 0 0 ! set web-browser "explorer.exe" # Use this instead for *nix systems: ! #set web-browser "mozilla" set sheets-documentation-url "doc/reference.html" set java-documentation-url["java.*"] "http://java.sun.com/j2se/1.4/docs/api" --- 3,18 ---- ########################################## ! #set compile-command "ant.bat compile" ! #set recompile-command "ant.bat clean" # Use these instead for *nix systems ! set compile-command "ant compile" ! set recompile-command "ant clean" #set windows-task-bar-height 0 #set screen-insets 0 108 0 0 ! #set web-browser "explorer.exe" # Use this instead for *nix systems: ! set web-browser "mozilla" set sheets-documentation-url "doc/reference.html" set java-documentation-url["java.*"] "http://java.sun.com/j2se/1.4/docs/api" Index: Sheets.sheets =================================================================== RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Sheets.sheets 21 Apr 2003 20:27:18 -0000 1.40 --- Sheets.sheets 22 Apr 2003 22:33:47 -0000 1.41 *************** *** 8648,8652 **** showVerboseDialogs = getBoolean(stream); } else if (name.equals("error-pattern")) { ! errorPatterns.addElement(Pattern.compile(getString(stream))); } else if (name.equals("language-expert")) { LanguageExpert.initializeExpert(getString(stream)); --- 8648,8652 ---- showVerboseDialogs = getBoolean(stream); } else if (name.equals("error-pattern")) { ! errorPatterns.addElement(Pattern.compile(getString(stream), Pattern.MULTILINE)); } else if (name.equals("language-expert")) { LanguageExpert.initializeExpert(getString(stream)); *************** *** 8881,8891 **** // fileLine is the line # relative to the start of the file (not fragment). private static boolean CompileDialog.addError ! (Sheet sheet, ExportRecord record, String file, Matcher matcher) { - int line = Integer.parseInt(matcher.group(2)); FragmentAndLine location = record.fragmentAt(line); if (location == null) return false; ((LineViewFragment)location.fragment) ! .addError("CompilerError", matcher.group(3), location.line - 1, -1); int index = sheet.getContents().getFragments().indexOf(location.fragment); if (index == -1) { --- 8881,8890 ---- // fileLine is the line # relative to the start of the file (not fragment). private static boolean CompileDialog.addError ! (Sheet sheet, ExportRecord record, String file, int line, String message) { FragmentAndLine location = record.fragmentAt(line); if (location == null) return false; ((LineViewFragment)location.fragment) ! .addError("CompilerError", message, location.line - 1, -1); int index = sheet.getContents().getFragments().indexOf(location.fragment); if (index == -1) { *************** *** 8903,8909 **** // Return value is null if no errors are found. private static Sheet CompileDialog.parseErrors(String outString) { - // Out former regexp library seemed to get confused when given big inputs - // so we cut it's food into tiny bite-sized chunks -- this should be revisited. - String[] lines = StringSplitter.splitLines(outString); if (errorSheet == null) { errorSheet = new Sheet(State.getObjectDatabase(), "Compilation errors", null, null); --- 8902,8905 ---- *************** *** 8912,8932 **** } StringBuffer unparsedText = new StringBuffer(); ! for (int i = 0; i < lines.length; i++) { ! String line = lines[i]; ! boolean errorParsed = false; ! for (int j = 0; j < Profile.errorPatterns.size(); j++) { ! Pattern pat = (Pattern)Profile.errorPatterns.elementAt(j); ! Matcher matcher = pat.matcher(line); ! if (matcher.matches()) { ! String file = matcher.group(1); ! ExportRecord record = ExportRecord.forName(file); ! if (record != null && addError(errorSheet, record, file, matcher)) { ! errorParsed = true; ! break; // stop trying to match error msg against regexps ! } } } ! if (!errorParsed) ! unparsedText.append(line + "\\n"); } if (errorSheet.numFragments() == 0) --- 8908,8929 ---- } StringBuffer unparsedText = new StringBuffer(); ! for (int j = 0; j < Profile.errorPatterns.size(); j++) { ! unparsedText.setLength(0); ! Pattern pat = (Pattern)Profile.errorPatterns.elementAt(j); ! Matcher matcher = pat.matcher(outString); ! while (matcher.find()) { ! String file = matcher.group(1); ! ExportRecord record = ExportRecord.forName(file); ! int line = Integer.parseInt(matcher.group(2)); ! String unparsedEntry = ""; ! if (record == null || !addError(errorSheet, record, file, line, matcher.group(3))) { ! // pushes the match into unparsed text because no error could be generated ! unparsedEntry = matcher.group(); } + matcher.appendReplacement(unparsedText, unparsedEntry); } ! matcher.appendTail(unparsedText); ! // recursively parse the text ! outString = unparsedText.toString(); } if (errorSheet.numFragments() == 0) *************** *** 10416,10425 **** errorPatterns = new Vector(); - // JVC error format - errorPatterns.addElement(Pattern.compile("(?: \\\\[javac\\\\])?([A-Za-z]?:?[-a-zA-Z0-9.$_/\\\\\\\\]+)\\\\(([0-9]+),[0-9]+\\\\) :(.*)")); // JAVAC error format ! errorPatterns.addElement(Pattern.compile("(?: \\\\[javac\\\\])?([A-Za-z]?:?[-a-zA-Z0-9.$_/\\\\\\\\]+):([0-9]+): (.*)")); // JIKE's error format ! errorPatterns.addElement(Pattern.compile("(?: \\\\[javac\\\\])?([A-Za-z]?:?[-a-zA-Z0-9_$./\\\\\\\\]+):([0-9]+):[0-9]+:[0-9]+:[0-9]+: (.*)")); LanguageExpert.initializeExpert("org.browsecode.sheets.SheetExpert"); --- 10413,10420 ---- errorPatterns = new Vector(); // JAVAC error format ! errorPatterns.addElement(Pattern.compile("^(?: \\\\[javac\\\\])?([A-Za-z]?:?[-a-zA-Z0-9.$_/\\\\\\\\]+):([0-9]+): ((?:.|\\\\n)*?)\\\\n.*\\\\n *\\\\^$", Pattern.MULTILINE)); // JIKE's error format ! errorPatterns.addElement(Pattern.compile("^(?: \\\\[javac\\\\])?([A-Za-z]?:?[-a-zA-Z0-9_$./\\\\\\\\]+):([0-9]+):[0-9]+:[0-9]+:[0-9]+: (.*)$", Pattern.MULTILINE)); LanguageExpert.initializeExpert("org.browsecode.sheets.SheetExpert"); |