OSDN Git Service

アウトライン解析処理を修正
[coboled/CobolEditor.git] / src / coboled / editors / CobolParser.java
index e582b7a..759c2f2 100644 (file)
@@ -18,18 +18,8 @@ public class CobolParser {
                        String line = null;
                        while ((line = reader.readLine()) != null) {
 
-                               // A領域に記述がない場合は次の行へ
-                               Pattern pattern0 = Pattern.compile("^.{6}\\s\\s{5}",
-                                               Pattern.CASE_INSENSITIVE);
-                               Matcher matcher0 = pattern0.matcher(line);
-                               boolean match0 = matcher0.matches();
-                               if (match0) {
-                                       offset = offset + line.length() + 1;
-                                       continue;
-                               }
-
                                // 部の記述があった場合
-                               Pattern pattern = Pattern.compile("^.{6}\\s(.*?DIVISION)\\.",
+                               Pattern pattern = Pattern.compile("^.{6}\\s(\\s{0,3}[^\\s].*?DIVISION)\\.",
                                                Pattern.CASE_INSENSITIVE);
                                Matcher matcher = pattern.matcher(line);
                                boolean match = matcher.matches();
@@ -44,7 +34,7 @@ public class CobolParser {
                                }
 
                                // 節の記述があった場合
-                               Pattern pattern2 = Pattern.compile("^.{6}\\s(.*?SECTION)\\.",
+                               Pattern pattern2 = Pattern.compile("^.{6}\\s(\\s{0,3}[^\\s].*?SECTION)\\.",
                                                Pattern.CASE_INSENSITIVE);
                                Matcher matcher2 = pattern2.matcher(line);
                                boolean match2 = matcher2.matches();
@@ -60,7 +50,7 @@ public class CobolParser {
                                }
 
                                // その他
-                               Pattern pattern3 = Pattern.compile("^.{6}\\s(.*)",
+                               Pattern pattern3 = Pattern.compile("^.{6}\\s(\\s{0,3}[^\\s].*)",
                                                Pattern.CASE_INSENSITIVE);
                                Matcher matcher3 = pattern3.matcher(line);
                                boolean match3 = matcher3.matches();