protected Object parse(String text,Type type,Type arrayElementType,int flags){
  if (!inCDATA(flags)) {
    if (!ignoreBinding(flags)) {
      BindingExpression result=parseBindingExpression(text);
      if (result != null) {
        return result;
      }
 else {
        text=cleanupBindingEscapes(text);
      }
    }
    if (!ignoreAtFunction(flags)) {
      String atFunctionName=getAtFunctionName(text);
      if (atFunctionName != null) {
        return parseAtFunction(atFunctionName,text,type,arrayElementType,flags);
      }
 else {
        text=cleanupAtFunctionEscapes(text);
        flags=flags | TextParser.FlagIgnoreAtFunctionEscape;
      }
    }
  }
  if (isRichTextContent(flags)) {
    String parsedString=parseString(text,flags);
    if (type == typeTable.arrayType) {
      return array(Collections.singleton((Object)parsedString),arrayElementType);
    }
 else {
      return parsedString;
    }
  }
 else {
    return parseValue(text,type,arrayElementType,flags);
  }
}

protected Object parse ( String text , Type type , Type arrayElementType , int flags ) { if ( ! inCDATA ( flags ) ) { if ( ! ignoreBinding ( flags ) ) { BindingExpression result = parseBindingExpression ( text ) ; if ( result != null ) { return result ; } else { text = cleanupBindingEscapes ( text ) ; } } if ( ! ignoreAtFunction ( flags ) ) { String atFunctionName = getAtFunctionName ( text ) ; if ( atFunctionName != null ) { return parseAtFunction ( atFunctionName , text , type , arrayElementType , flags ) ; } else { text = cleanupAtFunctionEscapes ( text ) ; flags = flags | TextParser . FlagIgnoreAtFunctionEscape ; } } } if ( isRichTextContent ( flags ) ) { String parsedString = parseString ( text , flags ) ; if ( type == typeTable . arrayType ) { return array ( Collections . singleton ( ( Object ) parsedString ) , arrayElementType ) ; } else { return parsedString ; } } else { return parseValue ( text , type , arrayElementType , flags ) ; } }
type - directed text parsing . search order is : 1 . look for a binding expression , if applicable . 2 . then look for an embed . 3 . then look for a resource . 4 . if nothing is found above , attempt to deserialize a value of the specified type [ arrayelementtype ]
