|
|
@@ -106,6 +106,18 @@ public class SimpleStreamer {
|
|
|
return new String(content, begin, position - begin);
|
|
|
}
|
|
|
|
|
|
+ public boolean expect(String value) {
|
|
|
+ int n = value.length();
|
|
|
+ if(position+ n > content.length) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(value.equals(peek(n))) {
|
|
|
+ skip(n);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
private Matcher matcher(Pattern regex) {
|
|
|
return regex.matcher(StringUtils.wrap(content, position, content.length));
|
|
|
}
|