public static final VariableContext[] parse(String variable){
  char[] text=variable.toCharArray();
  List<VariableContext> contexts=new ArrayList<>();
  int i=addMember(text,0,contexts);
  while (i < text.length) {
    if (text[i] == '[') {
      if (text[++i] == '\'') {
        i=addStringIndex(text,i,contexts);
      }
 else {
        i=addIntIndex(text,i,contexts);
      }
      ++i;
    }
 else {
      i=addMember(text,i + 1,contexts);
    }
  }
  return contexts.toArray(new VariableContext[contexts.size()]);
}

public static final VariableContext [ ] parse ( String variable ) { char [ ] text = variable . toCharArray ( ) ; List < VariableContext > contexts = new ArrayList < > ( ) ; int i = addMember ( text , 0 , contexts ) ; while ( i < text . length ) { if ( text [ i ] == '[' ) { if ( text [ ++ i ] == '\'' ) { i = addStringIndex ( text , i , contexts ) ; } else { i = addIntIndex ( text , i , contexts ) ; } ++ i ; } else { i = addMember ( text , i + 1 , contexts ) ; } } return contexts . toArray ( new VariableContext [ contexts . size ( ) ] ) ; }
parses a normalized javascript variable . all strings in the variable should be single quoted , and no spaces ( except possibly within strings ) .
