/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/**
* for plain text tokenizers
*/
%%
%line
%switch
%char
%{
/**
* Buffer that holds all the text from the start of the current line, or, in
* the case of a match that spans multiple lines, from the start of the
* first line part of the matching region.
*/
int markedPos = 0;
int curLinePos = 0;
int matchStart = -1;
int markedLine = 0;
int rest = 0;
/**
* Set the writer that should receive all output
*
* @param out The new writer to write to
*/
yyline = 1;
}
/**
* Set the name of the file we are working on (needed if we would like to
* generate a list of hits instead of generating html)
*
* @param filename the name of the file
*/
}
/**
* Set the list we should create Hit objects for
*
* @param hits the hits we should add Hit objects
*/
}
}
/**
* Reinitialize the tokenizer with new contents.
*
* @param buf a char buffer with text to tokenize
* @param len the number of characters to use from the char buffer
* @param out where to write htmlized results
* @param url URI encoded URL prefix to use when generating links
* @param tags tag map to use. If {@code null} a new one gets created.
*/
{
}
/**
* Reinitialize the tokenizer with new contents.
*
* @param in source of the text to tokenize
* @param out where to write htmlized results
* @param url URI encoded URL prefix to use when generating links
* @param tags tag map to use. If {@code null} a new one gets created.
*/
{
wait = false;
dumpRest = false;
rest = 0;
markedPos = 0;
curLinePos = 0;
matchStart = -1;
markedLine = 0;
yyline = 1;
}
prevHi = false;
}
/** Current token could be part of a match. Hold on... */
if ( !wait) {
wait = true;
}
}
/** Not a match after all. */
wait = false;
if ( !dumpRest) {
markedLine = yyline;
}
matchStart = -1;
}
{
// should be similar to Context::getContext()
if (bold) {
}
switch (ch) {
case '\n':
++lineNo;
if (bold) {
}
if (prevHi) {
}
if (hi)
// TODO: closing tag - where?
if (bold) {
}
break;
case '<':
break;
case '>':
break;
case '&':
break;
default:
}
}
if (bold) {
}
return lineNo;
}
switch (ch) {
case '\n':
++lineNo;
if (prevHi) {
}
break;
case '<':
break;
case '>':
break;
case '&':
break;
default:
}
}
return lineNo;
}
}
}
wait = false;
if (matchStart == -1) {
}
if (curLinePos == markedPos) {
if (prevHi) {
}
}
}
// print first part of line without normal font
// use bold font for the match
markedLine, true);
} else {
}
// Remove everything up to the start of the current line in the
// buffered contents.
curLinePos = 0;
matchStart = -1;
dumpRest = true;
}
if (dumpRest) {
for (int i = 0;; i++ ) {
// Assume that this line has been truncated if we don't
// find a newline after looking at maxLooks characters,
// or if we reach the end of the buffer and the size of
// the buffer is Context.MAXFILEREAD (which means that
// the file has probably been truncated).
{
}
if (prevHi) {
}
} else {
if (prevHi) {
}
}
break;
}
}
}
}
} else {
}
}
}
}
%}
//WhiteSpace = [ \t\f\r]+|\n
Printable = [\@\$\%\^\&\-+=\?\.\:]
%%
return text;
}
\n {
if ( !wait) {
matchStart = -1;
}
if (dumpRest) {
if (prevHi) {
}
} else {
if (prevHi) {
}
}
dumpRest = false;
}
if ( !wait) {
// We have dumped the rest of the line, begun a new
// line, and we're not inside a possible match, so it's
// safe to forget the buffered contents.
markedPos = 0;
curLinePos = 0;
}
}