public ParsedLineImpl(Program program, Token line, int cursor, List<Token> tokens) { this.program = program; this.source = line.toString(); this.cursor = cursor - line.start(); this.tokens = new ArrayList<>();
Token token; while ((token = tokenizer.next()) != null) { args.add(token.toString());
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; }
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; }
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; }
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; }
InputStream doc = new InputStream() final byte[] bytes = hereDoc.toString().getBytes(); int index = 0; boolean nl = true;
InputStream doc = new InputStream() final byte[] bytes = hereDoc.toString().getBytes(); int index = 0; boolean nl = true;
String cmdName = session.resolveCommand(statement.tokens().get(0).toString()); String[] parts = cmdName.split(":"); Command cmd = parts.length == 2 ? session.getRegistry().getCommand(parts[0], parts[1]) : null;
String cmdName = session.resolveCommand(statement.tokens().get(0).toString()); String[] parts = cmdName.split(":"); Command cmd = parts.length == 2 ? session.getRegistry().getCommand(parts[0], parts[1]) : null;
} else if (token.charAt(0) == '\'' || token.charAt(0) == '"') { type = Type.String; } else if (token.toString().matches("^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$")) { type = Type.Number; } else if (token.charAt(0) == '$') { type = Type.Variable; } else if (((Set<?>) session.get(CommandSessionImpl.CONSTANTS)).contains(token.toString()) || Token.eq(token, "null") || Token.eq(token, "false") || Token.eq(token, "true")) { type = Type.Constant; Object v = session.get(Shell.resolve(session, token.toString())); type = (v instanceof Function) ? Type.Function : Type.BadFunction;
throw new EOFError(sLine, sCol, "unexpected eof found in here-doc", "heredoc", "\n" + token.toString() + "\n");
throw new EOFError(sLine, sCol, "unexpected eof found in here-doc", "heredoc", "\n" + token.toString() + "\n");