Package org.naturalcli

Examples of org.naturalcli.InvalidTokenException


     * @see org.naturalcli.tokens.Token#validateTokenAfter(org.naturalcli.tokens.Token)
     */
    @Override
    protected void validateFollowing(Token t) throws InvalidTokenException {
        if (t != null)
            throw new InvalidTokenException("Variable arguments token only allowed at the end.");
        super.validateFollowing(t);
    }
View Full Code Here


     */
    @Override
    protected void validatePreceding(Token t) throws InvalidTokenException {  
        ParameterToken pt = (ParameterToken) t;
        if (pt == null || !t.isMandatory())
            throw new InvalidTokenException("Variable arguments have to follow a mandatory parameter.");       
        super.validatePreceding(t);
    }
View Full Code Here

     */
    @Override
    protected void validatePreceding(Token t) throws InvalidTokenException {
        ParameterToken pt = (ParameterToken) t;
        if (pt.isOptional() && pt.parameter_type.equalsIgnoreCase(this.getParameterType()))
          throw new InvalidTokenException("An optional parameter cannot be followed by a parameter of the same type.");
        super.validatePreceding(t);
    }
View Full Code Here

    public void setText(String text) throws InvalidTokenException {
        this.text = text;
        // Determine if it is optional
        optional = Pattern.matches("^\\[.*\\]$", text);
        if (Pattern.matches("^\\[.*$", text))
            throw new InvalidTokenException("Bad optional token: missing ']' char at end.");
        if (Pattern.matches("^.*\\]$", text))
            throw new InvalidTokenException("Bad optional token: missing '[' char at begin.");
        // Fill text_without_optional
        if (this.isOptional())
            text_without_optional = text.substring(1, text.length()-2);
        else
            text_without_optional = text;
View Full Code Here

       String error;
       if (def.matches(text))
           return new ParameterToken(text);
       error = def.incompatibleMessage(text);
       if (error != null)
           throw new InvalidTokenException(error);
       return null;
   }
View Full Code Here

TOP

Related Classes of org.naturalcli.InvalidTokenException

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.