/*
(non-Javadoc)
@see org.overture.ide.core.ast.IVdmElement#isParseCorrect()
333302
public synchronized boolean isParseCorrect()
	{
		boolean isParseCorrect = true;
		for (IVdmSourceUnit source : vdmSourceUnits)
		{
			if (source.hasParseErrors())
			{
				isParseCorrect = false;
				break;
			}
		}
		return isParseCorrect;
	}
1206638
public TypeBindException newTypeBindExceptionOnParse(final Cell cell, final Object cellValue) {

        final String message = MessageBuilder.create("cell.typeBind.failParse")
                .var("property", field.getNameWithClass())
                .var("cellAddress", POIUtils.formatCellAddress(cell))
                .var("cellValue", cellValue.toString())
                .varWithClass("type", field.getType())
                .format();

        final TypeBindException bindException = new TypeBindException(message, field.getType(), cellValue);

        return bindException;

    }
60575
@Override
    public void parse(InputSource is, HandlerBase hb)
        throws SAXException, IOException
    {
        if (hb != null) {
            /* Ok: let's ONLY set if there are no explicit sets... not
             * extremely clear, but JDK tries to set them always so
             * let's at least do damage control.
             */
            if (mContentHandler == null) {
                setDocumentHandler(hb);
            }
            if (mEntityResolver == null) {
                setEntityResolver(hb);
            }
            if (mErrorHandler == null) {
                setErrorHandler(hb);
            }
            if (mDTDHandler == null) {
                setDTDHandler(hb);
            }
        }
        parse(is);
    }
833820
public static boolean canParseColor(final String colorString) {
        try {
            return ColorParser.toColor(colorString) != null;
        } catch (Exception exc) {
            return false;
        }
    }
599116
private void checkRelaxed(String errorMessage) {
		if (!relaxed) {
			throw new KriptonRuntimeException(errorMessage, true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
		}
		if (error == null) {
			error = "Error: " + errorMessage;
		}
	}
1133335
public static void parseFile(final IVdmSourceUnit source)
			throws CoreException, IOException
	{
		try
		{
			ISourceParser parser = SourceParserManager.getInstance()
					.getSourceParser(source.getProject());
			Assert.isNotNull(parser, "No parser for file : "
					+ source.toString() + " in project "
					+ source.getProject().toString());
			parser.parse(source);
		} catch (Exception e)
		{
			if (VdmCore.DEBUG)
			{
//				System.err.println("Error in parseFile");
				VdmCore.log("SourceParseManager-Error in parseFile", e);
			}
		}
	}
68982
private boolean paramAppend(StringBuilder sb, String name, String value, ParameterParser parser) {
        boolean isEdited = false;
        
        if (name != null) {
            sb.append(name);
            isEdited = true;
        }
        
        if (value != null) {
            sb.append(parser.getDefaultKeyValueSeparator());
            sb.append(value);
            isEdited = true;
        }
        
        return isEdited;
    }
1051006
public static boolean isCaseParseIssue( IParseIssue parseIssue )
  {
    boolean caseIssue = parseIssue.getMessageKey() == Res.MSG_VAR_CASE_MISMATCH ||
                        parseIssue.getMessageKey() == Res.MSG_PROPERTY_CASE_MISMATCH ||
                        parseIssue.getMessageKey() == Res.MSG_TYPE_CASE_MISMATCH ||
                        parseIssue.getMessageKey() == Res.MSG_FUNCTION_CASE_MISMATCH;

    IParsedElement sourceOfIssue = parseIssue.getSource();
    boolean fixableElement = sourceOfIssue instanceof IIdentifierExpression ||
                             sourceOfIssue instanceof IBeanMethodCallExpression ||
                             sourceOfIssue instanceof ITypeLiteralExpression ||
                             sourceOfIssue instanceof ISynthesizedMemberAccessExpression ||
                             sourceOfIssue instanceof IFieldAccessExpression;

    return caseIssue && fixableElement;
  }
924685
private static boolean isValidBrace(String url) {
        if (null == url || url.trim().length() == 0) {
            return false;
        }

        boolean isInsideVariable = false;
        StringTokenizer tokenizer = new StringTokenizer(url, "{}", true);
        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            if (token.equals("{")) {
                // { is not allowed inside of a variable specification
                if (isInsideVariable) {
                    return false;
                }
                isInsideVariable = true;
            } else if (token.equals("}")) {
                // } must be preceded by {;
                if (!isInsideVariable) {
                    return false;
                }
                isInsideVariable = false;
            }
        }
        return true;
    }
518186
public boolean exactOrError(String match,TextProvider textProvider) 
    {
        if (!exact(match,textProvider,false))
        {
            throw new ParserException("Expected "+match,textProvider);
        }
        return true;
    }
666433
public static void parse(final Readable readable, final VcfParseListener listener) throws IOException {
        VcfParser.parse(readable, listener);
    }
141440
private void parseLastConsonant() {
		if (!validViSyll)
			return;
		if (iCurPos > strSyllable.length())
			strLastConsonant = ZERO;
		String strCon = strSyllable.substring(iCurPos, strSyllable.length());

		if (strCon.length() > 3) {
			validViSyll = false;
			return;
		}

		Iterator iter = alLastConsonants.iterator();
		while (iter.hasNext()) {
			String tempLastCon = (String) iter.next();
			if (strCon.equals(tempLastCon)) {
				strLastConsonant = tempLastCon;
				iCurPos += strLastConsonant.length();
				return;
			}
		}
		strLastConsonant = ZERO;
		if (iCurPos >= strSyllable.length())
			validViSyll = true;
		else validViSyll = false;
		
		return;
	}
504504
public final TypeParser.type_return type() throws RecognitionException {
        TypeParser.type_return retval = new TypeParser.type_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        TypeParser.typeExpression_return typeExpression1 = null;



        try {
            // org/javaruntype/type/parser/Type.g:101:5: ( typeExpression )
            // org/javaruntype/type/parser/Type.g:101:7: typeExpression
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_typeExpression_in_type160);
            typeExpression1=typeExpression();

            state._fsp--;

            adaptor.addChild(root_0, typeExpression1.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }

            catch (RecognitionException e) {
            	throw e;
            }
        finally {
        }
        return retval;
    }
1163431
public void parse(String methodDescriptor) {
		int parenthesisCloseIndex = methodDescriptor.indexOf(')');
		if (parenthesisCloseIndex > -1) {
			parseParameters(methodDescriptor, parenthesisCloseIndex);
			parseReturnValue(methodDescriptor, parenthesisCloseIndex);
		}
	}
668077
@Override
    <T> T parseRemaining(Class<T> declaredType) throws Exception {
        // the array and version has already been read
        overrideBasePackage = declaredType.getPackage().getName() + ".";
        // ref count + class map
        parseClassDescriptions();

        // parse
        Object parsed = parseObject(declaredType, null, null, null, true);
        return declaredType.cast(parsed);
    }
386530
@Override
  public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
    if (StringUtils.isEmpty(pvalue)) {
      return true;
    }
    return charsetEncoder.canEncode(pvalue);
  }
353837
private void checkTokenOrderIsCorrect(ESqlToken tokenTobeAdded) {

        switch (tokenTobeAdded) {

        case COLUMN:
            if (mPreviousToken != ESqlToken.CONDITION && mPreviousToken != ESqlToken.NOTHING) {
                throw new D6RuntimeException("AND or OR method is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case OPERATOR:
            if (mPreviousToken != ESqlToken.COLUMN) {
                throw new D6RuntimeException("VALUE is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case VALUE:
            if (mPreviousToken != ESqlToken.OPERATOR) {
                throw new D6RuntimeException("COLUMN or PROPERTY method is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case CONDITION:
            if (mPreviousToken != ESqlToken.VALUE && mPreviousToken != ESqlToken.WHERE) {
                throw new D6RuntimeException("VALUE is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;

        case WHERE:
            if (mPreviousToken != ESqlToken.CONDITION && mPreviousToken != ESqlToken.NOTHING) {
                throw new D6RuntimeException("CONDITION is required at here." + " '" + mSgSQL.toString() + "'<==error occurred around here.");
            }
            break;
        default:
        }

        mPreviousToken = tokenTobeAdded;
    }