public String unescape() { StringBuilder sb = new StringBuilder(); while (!eof()) { sb.append(next()); } return sb.toString(); }
public String unescape() { StringBuilder sb = new StringBuilder(); while (!eof()) { sb.append(next()); } return sb.toString(); }
int quote(char which) { while (!eof() && (peek() != which || escaped)) { next(); } return current++; }
int quote(char which) { while (!eof() && (peek() != which || escaped)) { next(); } return current++; }
public List<List<List<String>>> program() { program = new ArrayList<>(); ws(); if (!eof()) { program.add(pipeline()); while (peek() == ';' || peek() == '\n') { current++; List<List<String>> pipeline = pipeline(); program.add(pipeline); } } if (!eof()) { throw new RuntimeException("Program has trailing text: " + context(current)); } List<List<List<String>>> p = program; program = null; return p; }
public List<List<String>> pipeline() { statements = new ArrayList<>(); statements.add(statement()); while (peek() == '|') { current++; ws(); if (!eof()) { statements.add(statement()); } else { statements.add(new ArrayList<>()); break; } } List<List<String>> s = statements; statements = null; return s; }
public List<List<String>> pipeline() { statements = new ArrayList<>(); statements.add(statement()); while (peek() == '|') { current++; ws(); if (!eof()) { statements.add(statement()); } else { statements.add(new ArrayList<>()); break; } } List<List<String>> s = statements; statements = null; return s; }
public List<List<List<String>>> program() { program = new ArrayList<>(); ws(); if (!eof()) { program.add(pipeline()); while (peek() == ';' || peek() == '\n') { current++; List<List<String>> pipeline = pipeline(); program.add(pipeline); } } if (!eof()) { throw new RuntimeException("Program has trailing text: " + context(current)); } List<List<List<String>>> p = program; program = null; return p; }
private void comment() { while (!eof() && peek() != '\n' && peek() != '\r') { next(); } }
private void comment() { while (!eof() && peek() != '\n' && peek() != '\r') { next(); } }
public String messy() { start = current; char c = peek(); if (c > 0 && SPECIAL.indexOf(c) < 0) { current++; try { while (!eof()) { c = peek(); if (!escaped && (c == ';' || c == '|' || c == '\n' || isWhitespace(c))) { break; } next(); } return text.substring(start, current); } finally { start = -1; } } else { return value(); } }
public String messy() { start = current; char c = peek(); if (c > 0 && SPECIAL.indexOf(c) < 0) { current++; try { while (!eof()) { c = peek(); if (!escaped && (c == ';' || c == '|' || c == '\n' || isWhitespace(c))) { break; } next(); } return text.substring(start, current); } finally { start = -1; } } else { return value(); } }
public void ws() { // derek: BUGFIX: loop if comment at beginning of input //while (!eof() && isWhitespace(peek())) { while (!eof() && (!escaped && isWhitespace(peek()) || current == 0)) { if (current != 0 || !escaped && isWhitespace(peek())) { current++; } if (peek() == '/' && current < text.length() - 2 && text.charAt(current + 1) == '/') { comment(); } if (current == 0) { break; } } }
public void ws() { // derek: BUGFIX: loop if comment at beginning of input //while (!eof() && isWhitespace(peek())) { while (!eof() && (!escaped && isWhitespace(peek()) || current == 0)) { if (current != 0 || !escaped && isWhitespace(peek())) { current++; } if (peek() == '/' && current < text.length() - 2 && text.charAt(current + 1) == '/') { comment(); } if (current == 0) { break; } } }
CharSequence findVar() { int start = current; char c = peek(); if (c == '{') { next(); int end = find('}', '{'); return text.subSequence(start, end); } if (c == '(') { next(); int end = find(')', '('); return text.subSequence(start, end); } if (Character.isJavaIdentifierPart(c)) { while (c == '$') { c = next(); } while (!eof() && (Character.isJavaIdentifierPart(c) || c == '.') && c != '$') { next(); c = peek(); } return text.subSequence(start, current); } throw new IllegalArgumentException( "Reference to variable does not match syntax of a variable: " + context(start)); }
CharSequence findVar() { int start = current; char c = peek(); if (c == '{') { next(); int end = find('}', '{'); return text.subSequence(start, end); } if (c == '(') { next(); int end = find(')', '('); return text.subSequence(start, end); } if (Character.isJavaIdentifierPart(c)) { while (c == '$') { c = next(); } while (!eof() && (Character.isJavaIdentifierPart(c) || c == '.') && c != '$') { next(); c = peek(); } return text.subSequence(start, current); } throw new IllegalArgumentException( "Reference to variable does not match syntax of a variable: " + context(start)); }
if (eof()) { throw new RuntimeException("Eof found in the middle of a compound for '" + target + deeper + "', begins at " + context(start));
if (eof()) { throw new RuntimeException("Eof found in the middle of a compound for '" + target + deeper + "', begins at " + context(start));