EsperProcessor.java: remove inline comments in epl

This commit is contained in:
2018-10-30 17:48:40 -07:00
parent c9c10da4bc
commit 52bcf97c8f

View File

@ -93,16 +93,24 @@ public class EsperProcessor implements TickProcessor {
return str.matches("^\\s*$"); return str.matches("^\\s*$");
} }
/**
* Remove any inline epl comment from a given line.
*/
private static String removeInlineComment(String s) {
return s.replaceAll("--.*$", "");
}
/** /**
* Remove comment lines from the string. * Remove comment lines from the string.
*/ */
private static String filterComments(String str) { private static String filterComments(String str) {
return Arrays.stream(splitLines(str)) return Arrays.stream(splitLines(str))
.filter(s -> !isComment(s)) .filter(s -> !isComment(s))
.map(s -> removeInlineComment(s))
.collect(Collectors.joining("\n")); .collect(Collectors.joining("\n"));
} }
/** /**
* Given a string with (possibly) multiple statements, split and * Given a string with (possibly) multiple statements, split and
* add individually. * add individually.
*/ */