public Closure closure() { Token start = start("{", "closure"); expectNotNull(); Program program = program(); Token end = end("}"); return new Closure(whole(start, end), program); }
protected Token end(String str) { Token t = expect(str); stack.removeLast(); return t; }
protected void expectNotNull() { Token t = next(); if (t == null) { throw new EOFError(tz.line, tz.column, "unexpected EOT", getMissing(), "0"); } push(t); }
Token start = start("[", "array"); Boolean isMap = null; List<Token> list = new ArrayList<>(); Token key = next(); if (key == null) throw new EOFError(tz.line, tz.column, "unexpected EOT", getMissing(), "]"); push(key); break; push(key); key = sequence(); push(key); key = array(); Token n = next(); if (n == null) throw new EOFError(tz.line, tz.column, "unexpected EOF while looking for array token", getMissing(), "]"); push(n); expect("="); Token val = next(); if (val == null)
Token t = next(); if (t == null) throw new EOFError(tz.line, tz.column, "unexpected EOT while looking for a statement after |", getMissing("pipe"), "0"); return new Program(whole(tokens, start), tokens); throw new EOFError(t.line, t.column, "unexpected token '" + t + "' while looking for a statement after |", getMissing("pipe"), "0"); push(t); return new Program(whole(tokens, start), tokens); push(t); ex = statement(); t = next(); if (t == null || Token.eq(";", t) || Token.eq("\n", t) || Token.eq("&", t) || Token.eq("&&", t) || Token.eq("||", t)) tokens.add(new Pipeline(whole(pipes, start), pipes)); pipes = null; return new Program(whole(tokens, start), tokens); tokens.add(new Pipeline(whole(pipes, start), pipes)); pipes = null; push(t);
while (program == null) { try { org.apache.felix.gogo.runtime.Parser parser = new org.apache.felix.gogo.runtime.Parser(repaired); program = parser.program(); statements = parser.statements(); } catch (EOFError e) {
public Closure(CommandSessionImpl session, Closure parent, CharSequence source) throws Exception { this.session = session; this.parent = parent; this.source = source; script = session.get("0"); // by convention, $0 is script name try { program = new Parser(source).program(); } catch (Exception e) { throw setLocation(e); } }
while (program == null) { try { org.apache.felix.gogo.runtime.Parser parser = new org.apache.felix.gogo.runtime.Parser(repaired); program = parser.program(); tokens = parser.tokens(); statements = parser.statements(); } catch (EOFError e) { repaired = repaired + " " + e.repair();
protected Token expect(String str) { Token start = next(); if (start == null) { throw new EOFError(tz.line, tz.column, "unexpected EOT looking for '" + str + "", getMissing(), str); } if (!Token.eq(str, start)) { throw new SyntaxError(start.line, start.column, "expected '" + str + "' but got '" + start.toString() + "'"); } return start; }
private String getMissing() { return getMissing(null); }
Token start = start("[", "array"); Boolean isMap = null; List<Token> list = new ArrayList<>(); Token key = next(); if (key == null) throw new EOFError(tz.line, tz.column, "unexpected EOT", getMissing(), "]"); push(key); break; push(key); key = sequence(); push(key); key = array(); Token n = next(); if (n == null) throw new EOFError(tz.line, tz.column, "unexpected EOF while looking for array token", getMissing(), "]"); push(n); expect("="); Token val = next(); if (val == null)
Token t = next(); if (t == null) throw new EOFError(tz.line, tz.column, "unexpected EOT while looking for a statement after |", getMissing("pipe"), "0"); return new Program(whole(tokens, start), tokens); throw new EOFError(t.line, t.column, "unexpected token '" + t + "' while looking for a statement after |", getMissing("pipe"), "0"); push(t); return new Program(whole(tokens, start), tokens); push(t); ex = statement(); t = next(); if (t == null || Token.eq(";", t) || Token.eq("\n", t) || Token.eq("&", t) || Token.eq("&&", t) || Token.eq("||", t)) tokens.add(new Pipeline(whole(pipes, start), pipes)); pipes = null; return new Program(whole(tokens, start), tokens); tokens.add(new Pipeline(whole(pipes, start), pipes)); pipes = null; push(t);
while (program == null) { try { org.apache.felix.gogo.runtime.Parser parser = new org.apache.felix.gogo.runtime.Parser(repaired); program = parser.program(); statements = parser.statements(); } catch (EOFError e) {
public Closure(CommandSessionImpl session, Closure parent, CharSequence source) throws Exception { this.session = session; this.parent = parent; this.source = source; this.script = session.get("0"); // by convention, $0 is script name if (source instanceof Program) { program = (Program) source; } else { try { this.program = new Parser(source).program(); } catch (Exception e) { throw setLocation(e); } } }
protected Token expect(String str) { Token start = next(); if (start == null) { throw new EOFError(tz.line, tz.column, "unexpected EOT looking for '" + str + "", getMissing(), str); } if (!Token.eq(str, start)) { throw new SyntaxError(start.line, start.column, "expected '" + str + "' but got '" + start.toString() + "'"); } return start; }