Package net.mindengine.galen.parser

Examples of net.mindengine.galen.parser.SyntaxException


    private Object getField(Object object, String fieldName) {
        try {
            Method getterMethod = object.getClass().getMethod(getterForField(fieldName));
            return getterMethod.invoke(object);
        } catch (Exception e) {
            throw new SyntaxException(UNKNOWN_LINE, format("Cannot read field: \"%s\"", fieldName));
        }
    }
View Full Code Here


            else locatorType = word;
           
           
            String value = reader.getTheRest().trim();
            if (value.isEmpty()) {
                throw new SyntaxException(UNKNOWN_LINE, format("Locator for object \"%s\" is not defined correctly", objectName));
            }
            addObjectToSpec(objectName, locatorType, corrections, value);
        }
        catch (SyntaxException e) {
            throw e;
        }
        catch (Exception e) {
            throw new SyntaxException(UNKNOWN_LINE, "Object \"" + objectName + "\" has incorrect locator", e);
        }
    }
View Full Code Here

        }
    }

    private void addMultiObject(String objectName, Locator locator) {
        if (StringUtils.countMatches(objectName, "*") > 1) {
            throw new SyntaxException(UNKNOWN_LINE, "Incorrect object name: " + objectName);
        }
        else {
           
            if (pageSpecReader.getBrowser() != null) {
                pageSpec.updateMultiObject(pageSpecReader.getBrowser().getPage(), objectName, locator);
View Full Code Here

    }

    private String expectCorrectionsOrId(StringCharReader reader, String objectName) {
        String word = new ExpectWord().stopOnTheseSymbols('(').read(reader).trim();
        if (word.isEmpty()) {
            throw new SyntaxException(UNKNOWN_LINE, format("Missing locator for object \"%s\"", objectName));
        }
        return word;
    }
View Full Code Here

    }

    private String expectWord(StringCharReader reader, String errorMessage) {
        String word = new ExpectWord().read(reader).trim();
        if (word.isEmpty()) {
            throw new SyntaxException(UNKNOWN_LINE, errorMessage);
        }
        return word;
    }
View Full Code Here

        currentSectionState.process(line, place);
    }

    public void startNewStatement(boolean inverted) {
        if (state != STATE.STATEMENT) {
            throw new SyntaxException("Wrong place for this statement");
        }
       
        ConditionalBlockStatement currentStatement = new ConditionalBlockStatement();
        currentStatement.setInverted(inverted);
        conditionalBlock.getStatements().add(currentStatement);
View Full Code Here

        currentStatement.setObjects(currentSection.getObjects());
    }

    public void startBody() {
        if (state != STATE.STATEMENT) {
            throw new SyntaxException("Wrong place for this statement");
        }
       
        PageSection currentSection = new PageSection();
        currentSectionState = new StateDoingSection(getProperties(), currentSection, getContextPath(), getPageSpecReader());
       
View Full Code Here

        state = STATE.BODY;
    }

    public void startOtherwise() {
        if (state != STATE.BODY) {
            throw new SyntaxException("Wrong place for this statement");
        }
       
        PageSection currentSection = new PageSection();
        currentSectionState = new StateDoingSection(getProperties(), currentSection, contextPath, getPageSpecReader());
        state = STATE.BODY;
View Full Code Here

        conditionalBlock.setOtherwiseObjects(currentSection.getObjects());
    }

    public ConditionalBlock build() {
        if (state == STATE.STATEMENT) {
            throw new SyntaxException("There is no body defined for this conditional block");
        }
        return conditionalBlock;
    }
View Full Code Here

    }

   
    private void processSpecForSimpleObject(String line) {
        if (currentObjectSpecs == null) {
            throw new SyntaxException(UNKNOWN_LINE,"There is no object defined in section");
        }
        else {
            try {
                currentObjectSpecs.getSpecs().add(readSpec(line.trim(), getContextPath(), place));
            }
            catch (SyntaxException exception) {
                throw exception;
            }
            catch (Exception exception) {
                throw new SyntaxException(UNKNOWN_LINE, "Incorrect spec for object \"" + currentObjectSpecs.getObjectName() + "\"", exception);
            }
        }
    }
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.