Package org.jnode.shell.syntax

Examples of org.jnode.shell.syntax.CommandSyntaxException


    @Override
    protected String doAccept(Token value, int flags) throws CommandSyntaxException {
        String tok = value.text;
        if (!BjorneToken.isName(tok)) {
            throw new CommandSyntaxException("invalid name ('" + tok + "')");
        }
        return tok;
    }
View Full Code Here


    protected String doAccept(Token value, int flags) throws CommandSyntaxException {
        String tok = value.text;
        int pos = tok.indexOf('=');
        String name = (pos == -1) ? tok : tok.substring(0, pos);
        if (!BjorneToken.isName(name)) {
            throw new CommandSyntaxException("invalid alias name ('" + name + "')");
        }
        return tok;
    }
View Full Code Here

    @Override
    protected String doAccept(Token value, int flags) throws CommandSyntaxException {
        String name = value.text;
        if (!BjorneToken.isName(name)) {
            throw new CommandSyntaxException("invalid name ('" + name + "')");
        }
        return name;
    }
View Full Code Here

    protected String doAccept(Token value, int flags) throws CommandSyntaxException {
        String tok = value.text;
        int pos = tok.indexOf('=');
        String name = (pos == -1) ? tok : tok.substring(0, pos);
        if (!BjorneToken.isName(name)) {
            throw new CommandSyntaxException("invalid name ('" + name + "')");
        }
        return tok;
    }
View Full Code Here

    @Override
    protected Boolean doAccept(Token value, int flags) throws CommandSyntaxException {
        String tok = value.text;
        if (tok.length() != 2 || tok.charAt(1) != flagCh ||
                (tok.charAt(0) != '-' && tok.charAt(0) != '+')) {
            throw new CommandSyntaxException("this does not match the '-'" + flagCh + " flag");
        }
        return Boolean.valueOf(tok.charAt(0) == '+');
    }
View Full Code Here

        protected String doAccept(String category) throws CommandSyntaxException {
            Set<String> availCategories = TestManager.getInstance().getCategories();
            if (availCategories.contains(category)) {
                return category;
            } else {
                throw new CommandSyntaxException("not a recognized JUnit test category");
            }
        }   
View Full Code Here

    protected IBMPartitionTypes doAccept(Token value, int flags) throws CommandSyntaxException {
        try {
            int code = Integer.parseInt(value.text, 16);
            return IBMPartitionTypes.valueOf(code);
        } catch (NumberFormatException ex) {
            throw new CommandSyntaxException("not a valid hexadecimal number");
        } catch (IllegalArgumentException ex) {
            throw new CommandSyntaxException(ex.getMessage());
        }
    }
View Full Code Here

    @Override
    protected String doAccept(Token value, int flags) throws CommandSyntaxException {
        int index = value.text.indexOf(':');
        if (index == -1) {
            throw new CommandSyntaxException("missing ':'");
        } else if (index == 0) {
            throw new CommandSyntaxException("no hostname before ':'");
        } else if (index == value.text.length() - 1) {
            throw new CommandSyntaxException("no directory after ':'");
        } else {
            return value.text;
        }
    }
View Full Code Here

            String[] parts = str.split("\\+");
            int modifiers = 0;
            for (int i = 0; i < parts.length - 1; i++) {
                Integer m = MODIFIER_NAME_MAP.get(constCase(parts[i]));
                if (m == null) {
                    throw new CommandSyntaxException(String.format(ex_unknown_mod, parts[i]));
                }
                modifiers |= m;
            }
            Integer vk = VK_NAME_MAP.get(constCase(parts[parts.length - 1]));
            if (vk == null) {
                throw new CommandSyntaxException(String.format(ex_unknown_vkey, parts[parts.length - 1]));
            }
            return new VirtualKey(vk, modifiers);
        }
View Full Code Here

            }
            if (str.startsWith("0x") || str.startsWith("0X")) {
                int ch = Integer.parseInt(str.substring(2), 16);
                return (char) ch;
            }
            throw new CommandSyntaxException(ex_inv_char);
        }
View Full Code Here

TOP

Related Classes of org.jnode.shell.syntax.CommandSyntaxException

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.