Parse '[shortcode attr0="val0" attr1="val1"]
@param str The shortcode string.
@return The shortcode.
@throws ParseException on invalid shortcode.
492972
static Shortcode parseStart(final String str) throws ParseException {
      String exp = str.trim();

      if(exp.length() < 3) {
         throw new ParseException(String.format("Invalid shortcode ('%s')", str), 0);
      }

      if(exp.charAt(0) != '[') {
         throw new ParseException("Expecting '['", 0);
      }

      if(exp.charAt(exp.length() - 1) != ']') {
         throw new ParseException("Expecting ']'", exp.length() - 1);
      }

      exp = exp.substring(1, exp.length() - 1).trim();

      if(exp.length() == 0) {
         throw new ParseException(String.format("Invalid shortcode ('%s')", str), 0);
      }

      int attrStart = exp.indexOf(' ');
      if(attrStart < 0) {
         return new Shortcode(validateName(exp), ImmutableMap.of());
      } else {
         return new Shortcode(validateName(exp.substring(0, attrStart)), parseAttributes(exp.substring(attrStart).trim()));
      }
   }
228624
public static long parsePositiveLong(String str) {
        long value = 0;
        final int length = str.length();

        if (length == 0) {
            throw new NumberFormatException(str);
        }

        long multiplier = 1;
        for (int i = length - 1; i >= 0; --i) {
            char c = str.charAt(i);

            if (c < '0' || c > '9') {
                throw new NumberFormatException(str);
            }
            long digit = c - '0';
            value += digit * multiplier;
            multiplier *= 10;
        }
        return value;
    }
208910
public void parseHtmlData(PrintWriter out, String str)
    {
        int iCurrentParsePos = 0;
        int iCurrentOutputPos = 0;
        int iStartTag, iStartVelocity;
        while (true)
        { // Done
        	iStartTag = str.indexOf('<', iCurrentParsePos);
        	iStartVelocity = str.indexOf("${", iCurrentParsePos);
        	if ((iStartTag == -1) && (iStartVelocity == -1))
    			break;	// Done
        	String strTag, strParams, strData;
        	int iNextParam, iEndCloseTag;
    		if ((iStartVelocity == -1) || (iStartVelocity > iStartTag))
    		{	// xml format param
	            iCurrentParsePos = iStartTag + 1;
	            if (iCurrentParsePos == str.length())
	                break;
	            if (str.charAt(iStartTag + 1) == '/') // Don't process end tags
	                continue;
	            int iEndTag = str.indexOf(' ', iStartTag);
	            int iEndParam = str.indexOf('>', iStartTag);
	            if (iEndParam == -1)
	                break;      // poorly formed XML
	            int iNextVelocity = str.indexOf("${", iCurrentParsePos);
	            if (iNextVelocity != -1) if (iNextVelocity < iEndParam)
	                continue;   // This handles the case: <IMG=${image}>   (used internally)
	            iNextParam = str.indexOf('<', iCurrentParsePos);
	            if (iNextParam != -1) if (iNextParam < iEndParam)
	                continue;   // This handles the case: <IMG=<image/>>   (used internally)
	            if (iNextVelocity != -1) if (iNextVelocity < iNextParam)
	            	iNextParam = iNextVelocity;
	            iEndCloseTag = iEndParam;
	            if (str.charAt(iEndParam - 1) == '/')
	                iEndParam = iEndParam - 1;
	            if ((iEndTag == -1) || (iEndTag > iEndParam))
	                iEndTag = iEndParam;
	            strTag = str.substring(iStartTag + 1, iEndTag);
	            strParams = null;
	            if (iEndTag != iEndParam)
	                strParams = str.substring(iEndTag + 1, iEndParam);
	            strData = null;
	            int iStartCloseTag = -1;
	            
	            if (iCurrentOutputPos != iStartTag)
	                out.print(str.substring(iCurrentOutputPos, iStartTag));     // Print everything up to the start of the tag.
	            iCurrentOutputPos = iStartTag;
	            
	            if (str.charAt(iEndCloseTag) != '/')
	            {   // Find the end tag (if start tag doesn't end in '/')
	                iStartCloseTag = str.indexOf("</" + strTag + '>', iEndTag);
	                if (iStartCloseTag > iEndTag)
	                {
	                    iEndCloseTag = iStartCloseTag + strTag.length() + 2;
	                    strData = str.substring(iEndParam + 1, iStartCloseTag);
	                }
	            }
        	}
    		else
    		{	// Velocity format param
    			strParams = null;
    			strData = null;
    			
	            iCurrentParsePos = iStartTag + 2;	// ${
	            if (iCurrentParsePos == str.length())
	                break;
	            iEndCloseTag = str.indexOf('}', iStartTag);
	            if (iEndCloseTag == -1)
	                break;      // poorly formed Velocity tag
    			strTag = str.substring(iStartTag + 2, iEndCloseTag);

	            int iNextVelocity = str.indexOf("${", iCurrentParsePos);
	            iNextParam = str.indexOf('<', iCurrentParsePos);
	            if (iNextVelocity != -1) if (iNextVelocity < iNextParam)
	            	iNextParam = iNextVelocity;
    		}

            // Now, I have the tag, params, and data for this tag
            boolean bProcessed = this.parseHtmlTag(out, strTag, strParams, strData);
            
            if (!bProcessed)
            {
                out.print(str.substring(iCurrentOutputPos, iNextParam));     // It wasn't processed, so output it.
                iCurrentOutputPos = iNextParam;
            }
            else
                iCurrentOutputPos = iEndCloseTag + 1;
            iCurrentParsePos = iCurrentOutputPos;
        }
        iStartTag = str.length();
        if (iCurrentOutputPos != iStartTag)
            out.println(str.substring(iCurrentOutputPos, iStartTag));
    }
818581
public static int[] parse(String s) {
		ArrayList<Integer> n = new ArrayList<Integer>();
		int val = 0;
		boolean hasChar = false;
		int i;
		for (i = 0; i < s.length(); ++i) {
			char c = s.charAt(i);
			if (c >= '0' && c <= '9') {
				val = val * 10 + (c - '0');
				hasChar = true;
				continue;
			}
			if (c == '.') {
				n.add(Integer.valueOf(val));
				val = 0;
				hasChar = false;
				continue;
			}
			if (hasChar)
				n.add(Integer.valueOf(val));
			break;
		}
		if (i == s.length()) n.add(Integer.valueOf(val));
		int[] numbers = new int[n.size()];
		for (i = 0; i < n.size(); ++i)
			numbers[i] = n.get(i).intValue();
		return numbers;
	}
1122680
public static String decodeString(String str) {
		try {
			return new String(Base64.decode(str));
		} catch (IOException io) {
			throw new RuntimeException(io.getMessage(), io.getCause());
		}
	}
1080193
private static List<String> split(String str) {
        List<String> result = new ArrayList<String>();
        int genericCount = 0;
        int startPos = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == ',' && genericCount == 0) {
                result.add(str.substring(startPos, i).trim());
                startPos = i + 1;
            } else if (str.charAt(i) == '<') {
                genericCount++;
            } else if (str.charAt(i) == '>') {
                genericCount--;
            }
        }
        result.add(str.substring(startPos).trim());
        return result;
    }
1132325
public void parse(String str) {
		if (buffer.length() > 0) {
			str = buffer.toString().concat(str);
			buffer = new StringBuilder();
		}
		Reader reader = new StringReader(str);
		try {
			try {
				parse(reader);
			} finally {
				reader.close();
			}
		} catch (IOException ex) {
			/* ignore */
		}
	}
883878
private static String intPart(String str) {
        return str.indexOf(JAVA_DECIMAL_POINT) > 0 ? str.substring(0,
                str.indexOf(JAVA_DECIMAL_POINT)) : str;
    }
489600
private static String decode(final String str, final int firstPercent) {
        StringBuilder builder = new StringBuilder();
        builder.append(str.substring(0, firstPercent));

        appendDecoded(builder, str, firstPercent);

        for (int i = firstPercent + 3; i < str.length(); ++i) {
            if (str.charAt(i) == '%') {
                appendDecoded(builder, str, i);
                i += 2;
            } else {
                builder.append(str.charAt(i));
            }
        }

        return builder.toString();
    }
1026951
@Nullable
  public static Short parseShortObj (@Nullable final String sStr)
  {
    return parseShortObj (sStr, DEFAULT_RADIX, null);
  }
582561
public static Object deserialize(String str) throws IOException, ClassNotFoundException, CoderException {
	ByteArrayInputStream bais = new ByteArrayInputStream(Base64Coder.decode(str));
	return deserialize(bais);
    }
554218
private int parseSpecialPosition(int i, StringBuilder str) throws ParseException {
        int j = readWords(i + 1, rawBuilder);
        if(j > i && rules.charAt(j) == 0x5d && rawBuilder.length() != 0) {  // words end with ]
            ++j;
            String raw = rawBuilder.toString();
            str.setLength(0);
            for(int pos = 0; pos < positions.length; ++pos) {
                if(raw.equals(positions[pos])) {
                    str.append(POS_LEAD).append((char)(POS_BASE + pos));
                    return j;
                }
            }
            if(raw.equals("top")) {
                str.append(POS_LEAD).append((char)(POS_BASE + Position.LAST_REGULAR.ordinal()));
                return j;
            }
            if(raw.equals("variable top")) {
                str.append(POS_LEAD).append((char)(POS_BASE + Position.LAST_VARIABLE.ordinal()));
                return j;
            }
        }
        setParseError("not a valid special reset position");
        return i;
    }
1098138
function parseString(str) {
  var obj = {};
  var pairs = str.split('&');
  var pair;
  var pos;

  for (var i = 0, len = pairs.length; i < len; ++i) {
    pair = pairs[i];
    pos = pair.indexOf('=');
    if (pos == -1) {
      obj[decodeURIComponent(pair)] = '';
    } else {
      obj[decodeURIComponent(pair.slice(0, pos))] =
        decodeURIComponent(pair.slice(pos + 1));
    }
  }

  return obj;
}
1216039
private static Map<String, String> parseAttributes(String attrString) throws ParseException {

      AttributeString str = new AttributeString(attrString);
      Map<String, String> attributes = Maps.newLinkedHashMapWithExpectedSize(4); //Preserve order...
      AttrState state = AttrState.NAME;
      String currName = "";
      String currString = "";
      int currPos = 0;
      while((currString = str.nextString()) != null) {
         switch(state) {
            case NAME:
               if(str.ch == '=') {
                  currName = currString;
                  state = AttrState.VALUE;
               } else {
                  attributes.put(String.format("$%d", currPos++), currString);
               }
               break;
            case VALUE:
               attributes.put(currName.toLowerCase(), currString);
               state = AttrState.NAME;
               break;
         }
      }
      return attributes;
   }
775919
static public JSONArray parse(String str) throws IOException {
        StringReader strReader = new StringReader(str);
        return parse(strReader);
    }
1315418
protected String getKey(String str) {
        int index = str.indexOf('=');
        String key = null;
        if (index > 0) {
            key = str.substring(0, index).trim();
            if (key.charAt(key.length() - 1) == ':') {
                key = key.substring(0, key.length() - 1).trim();
            }
        }
        return key;
    }
149853
protected Number parseInteger(String string) throws ParseException {
		try {
			return Long.valueOf(string);
		} catch (NumberFormatException e) {
			fail(INTEGER);
			return null;
		}
	}