Changing the regex for stripping multi-line comments because on Windows the old one was overflowing the stack. (Switched from a non-greedy to a greedy regexp.)

This commit is contained in:
David A. Mellis 2008-03-15 17:49:14 +00:00
parent df4eb665b0
commit db7a06aaf2
1 changed files with 3 additions and 3 deletions

View File

@ -99,7 +99,7 @@ public class PdePreprocessor {
// whitespace // whitespace
"\\s+" + "|" + "\\s+" + "|" +
// multi-line comment // multi-line comment
"(/\\*(?:.|\\n)*?\\*/)" + "|" + "(/\\*[^*]*(?:\\*(?!/)[^*]*)*\\*/)" + "|" +
// single-line comment // single-line comment
"(//.*?$)" + "|" + "(//.*?$)" + "|" +
// pre-processor directive // pre-processor directive
@ -134,7 +134,7 @@ public class PdePreprocessor {
// double-quoted string // double-quoted string
"(\"(?:[^\"\\\\]|\\\\.)*\")" + "|" + "(\"(?:[^\"\\\\]|\\\\.)*\")" + "|" +
// multi-line comment // multi-line comment
"(/\\*(?:.|\\n)*?\\*/)" + "|" + "(/\\*[^*]*(?:\\*(?!/)[^*]*)*\\*/)" + "|" +
// single-line comment // single-line comment
"(//.*?$)" + "|" + "(//.*?$)" + "|" +
// pre-processor directive // pre-processor directive
@ -183,7 +183,7 @@ public class PdePreprocessor {
return buffer.toString(); return buffer.toString();
} }
private List prototypes(String in) throws MalformedPatternException { public List prototypes(String in) throws MalformedPatternException {
in = collapseBraces(strip(in)); in = collapseBraces(strip(in));
PatternMatcherInput input = new PatternMatcherInput(in); PatternMatcherInput input = new PatternMatcherInput(in);