code: public int getVar(char[] array, int currentIndex, StringBuffer varName, StringBuffer velocityBlock,
          VelocityParserContext context) throws InvalidVelocityException
      {
          if (isVarEscaped(array, currentIndex)) {
              throw new InvalidVelocityException();
          }
  
          int i = currentIndex + 1;
  
          if (i == array.length) {
              throw new InvalidVelocityException();
          }
  
          if (array[i] == '!') {
              ++i;
          }
  
          if (i == array.length) {
              throw new InvalidVelocityException();
          }
  
          boolean fullSyntax = false;
          if (array[i] == '{') {
              ++i;
              fullSyntax = true;
          }
  
          if (i == array.length) {
              throw new InvalidVelocityException();
          }
  
          // get the variable name
          i = getVelocityIdentifier(array, i, varName, context);
  
          // get the method(s)
          i = followVar(array, i, fullSyntax, context);
  
          if (velocityBlock != null) {
              velocityBlock.append(array, currentIndex, i - currentIndex);
          }
  
          context.setType(VelocityBlock.VelocityType.VAR);
  
          return i;
      }
docs: Get any valid Velocity starting with a <code>$</code>.
  
  @param array the source to parse
  @param currentIndex the current index in the <code>array</code>
  @param varName the buffer where to append the name of the variable
  @param velocityBlock the buffer where to append matched velocity block
  @param context the parser context to put some informations
  @return the index in the <code>array</code> after the matched block
  @throws InvalidVelocityException not a valid velocity block