Package org.jnode.shell

Examples of org.jnode.shell.ShellSyntaxException


        } else if (ch == '(') {
            ci.nextCh();
            Primary res = evalExpression(ci);
            skipWhiteSpace(ci);
            if ((ch = ci.nextCh()) != ')') {
                throw new ShellSyntaxException("Unmatched \"(\" (left parenthesis) in arithmetic expression");
            }
            return res;
        } else {
            throw new ShellSyntaxException("Expected a number or variable name");
        }
    }
View Full Code Here


    private long evalName(String name) throws ShellSyntaxException {
        try {
            String value = context.variable(name);
            return value == null ? 0L : Long.parseLong(value);
        } catch (NumberFormatException ex) {
            throw new ShellSyntaxException(
                    "expression syntax error: '" + context.variable(name) + "' is not an integer");
        }
    }
View Full Code Here

        captureCompletions(token, expectedSet);
        int tt = token.getTokenType();
        if (((1L << tt) & expectedSet) == 0L) {
            if (mandatory) {
                if (tt == TOK_END_OF_STREAM) {
                    throw new ShellSyntaxException(
                            "EOF reached while looking for " + BjorneToken.formatExpectedSet(expectedSet));
                } else {
                    throw new ShellSyntaxException(
                            "expected " + BjorneToken.formatExpectedSet(expectedSet) + " but got " + token);
                }
            } else {
                return false;
            }
View Full Code Here

        BjorneToken token = tokens.peek();
        int tt = token.getTokenType();
        if (tt == TOK_END_OF_STREAM) {
            captureCompletions(token, expectedSet);
            if (needMore) {
                throw new ShellSyntaxException(
                        "EOF reached while looking for optional linebreak(s)");
            }
        } else if (tt == TOK_END_OF_LINE) {
            tokens.next();
            captureHereDocuments();
            while (true) {
                token = tokens.peek();
                tt = token.getTokenType();
                if (tt == TOK_END_OF_LINE) {
                    tokens.next();
                } else if (tt == TOK_END_OF_STREAM) {
                    captureCompletions(token, expectedSet);
                    if (needMore) {
                        throw new ShellSyntaxException(
                                "EOF reached while dealing with optional linebreak(s)");
                    } else {
                        break;
                    }
                } else {
View Full Code Here

            String marker = BjorneContext.dequote(rawMarker).toString();
            boolean trimTabs = redirection.getRedirectionType() == TOK_DLESSDASH;
            while (true) {
                String line = tokens.readRawLine();
                if (line == null) {
                    throw new ShellSyntaxException("EOF reached while looking for '" +
                            marker + "' to end a HERE document");
                }
                if (trimTabs) {
                    int len = line.length();
                    int i;
View Full Code Here

TOP

Related Classes of org.jnode.shell.ShellSyntaxException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.