/** * Get comment single line comment (starting with <code>##</code>). * * @param array the source to parse * @param currentIndex the current index in the <code>array</code> * @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 */ public int getSimpleComment(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context) { int i = currentIndex + 2; while (i < array.length && array[i - 1] != '\n') { ++i; } if (velocityBlock != null) { velocityBlock.append(array, currentIndex, i - currentIndex); } context.setType(VelocityBlock.VelocityType.COMMENT); return i; }
/** * Get comment single line comment (starting with <code>##</code>). * * @param array the source to parse * @param currentIndex the current index in the <code>array</code> * @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 */ public int getSimpleComment(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context) { int i = currentIndex + 2; while (i < array.length && array[i - 1] != '\n') { ++i; } if (velocityBlock != null) { velocityBlock.append(array, currentIndex, i - currentIndex); } context.setType(VelocityBlock.VelocityType.COMMENT); return i; }
/** * Get multilines comment (between <code>#*</code> and <code>*#</code>). * * @param array the source to parse * @param currentIndex the current index in the <code>array</code> * @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 */ public int getMultilinesComment(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context) { int i = currentIndex + 2; while (i < array.length && (array[i - 1] != '#' || array[i - 2] != '*')) { ++i; } if (velocityBlock != null) { velocityBlock.append(array, currentIndex, i - currentIndex); } context.setType(VelocityBlock.VelocityType.COMMENT); return i; }
/** * Get multilines comment (between <code>#*</code> and <code>*#</code>). * * @param array the source to parse * @param currentIndex the current index in the <code>array</code> * @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 */ public int getMultilinesComment(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context) { int i = currentIndex + 2; while (i < array.length && (array[i - 1] != '#' || array[i - 2] != '*')) { ++i; } if (velocityBlock != null) { velocityBlock.append(array, currentIndex, i - currentIndex); } context.setType(VelocityBlock.VelocityType.COMMENT); return i; }
context.setType(VelocityBlock.VelocityType.VAR);
context.setType(VelocityBlock.VelocityType.VAR);