Package net.mindengine.galen.parser

Examples of net.mindengine.galen.parser.SyntaxException


        return name;
    }

    private boolean startsWithIndentation(String line) {
        if (line.startsWith("\t")) {
            throw new SyntaxException(UNKNOWN_LINE, "Incorrect indentation. Should not use tabs. Use spaces");
        }
       
        int indentationLevel = getIndentationFrom(line).length();
        if (indentationLevel > 8 ) {
            throw new SyntaxException(UNKNOWN_LINE, "Incorrect indentation. Use from 1 to 8 spaces for indentation");
        }
        else if (indentationLevel == 0) {
            currentIndentationLevel = 0;
            return false;
        }
        else {
            if (currentIndentationLevel > 0) {
                if (currentIndentationLevel != indentationLevel) {
                    throw new SyntaxException(UNKNOWN_LINE, "Incorrect indentation. You should use same indentation within one spec");
                }
            }
            else {
                currentIndentationLevel = indentationLevel;
            }
View Full Code Here


    private void doConditionalBlock(String firstWord, String theRest) {
      if (firstWord.equals("if")) {
         
          //Checking that it is not already doing a conditional block
          if (state instanceof StateDoingConditionalBlocks) {
              throw new SyntaxException(UNKNOWN_LINE, "Cannot use conditional block inside another condition");
          }
          previousState = state;
          boolean inverted = theRest.equals("not");
            state = new StateDoingConditionalBlocks(properties, inverted, contextPath, pageSpecReader);
        }
      else {
          if (!(state instanceof StateDoingConditionalBlocks)) {
                throw new SyntaxException(UNKNOWN_LINE, "Cannot use '" + firstWord + "' statement outside conditional block.");
            }
          StateDoingConditionalBlocks stateConditionalBlock = (StateDoingConditionalBlocks) state;
         
          if (firstWord.equals("or")) {
              boolean inverted = theRest.equals("not");
              stateConditionalBlock.startNewStatement(inverted);
          }
          else {
              if (!theRest.isEmpty()) {
                  throw new SyntaxException(UNKNOWN_LINE, "'" + firstWord + "' statement should not take any arguments");
              }
              if (firstWord.equals("do")) {
                  stateConditionalBlock.startBody();
              }
              else if (firstWord.equals("otherwise")) {
View Full Code Here

            }
           
            startParameterization(parameterization.toArray(new String[]{}));
        }
        catch (Exception ex) {
            throw new SyntaxException(UNKNOWN_LINE, "Incorrect parameterization syntax", ex);
        }
       
    }
View Full Code Here

TOP

Related Classes of net.mindengine.galen.parser.SyntaxException

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.