0N/A/*
0N/A * CDDL HEADER START
0N/A *
0N/A * The contents of this file are subject to the terms of the
0N/A * Common Development and Distribution License (the "License").
0N/A * You may not use this file except in compliance with the License.
0N/A *
0N/A * See LICENSE.txt included in this distribution for the specific
0N/A * language governing permissions and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL HEADER in each
0N/A * file and include the License file at LICENSE.txt.
0N/A * If applicable, add the following below this CDDL HEADER, with the
0N/A * fields enclosed by brackets "[]" replaced with your own identifying
0N/A * information: Portions Copyright [yyyy] [name of copyright owner]
0N/A *
0N/A * CDDL HEADER END
0N/A */
0N/A
0N/A/*
1059N/A * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A */
0N/A
0N/Apackage org.opensolaris.opengrok.search.context;
0N/A
0N/Aimport org.opensolaris.opengrok.search.Hit;
0N/Aimport java.io.*;
0N/Aimport java.util.*;
0N/A%%
0N/A
0N/A%public
0N/A%class HistoryLineTokenizer
33N/A%unicode
0N/A%function next
0N/A%type String
0N/A%ignorecase
1065N/A%char
0N/A
0N/A%{
14N/A public static final HashSet<String> stopset = new HashSet<String>();
0N/A static {
0N/A stopset.add( "a");
0N/Astopset.add( "an");
0N/Astopset.add( "and");
0N/Astopset.add( "are");
0N/Astopset.add( "as");
0N/Astopset.add( "at");
0N/Astopset.add( "be");
0N/Astopset.add( "but");
0N/Astopset.add( "by");
0N/Astopset.add( "for");
0N/Astopset.add( "if");
0N/Astopset.add( "in");
0N/Astopset.add( "into");
0N/Astopset.add( "is");
0N/Astopset.add( "it");
0N/Astopset.add( "no");
0N/Astopset.add( "not");
0N/Astopset.add( "of");
0N/Astopset.add( "on");
0N/Astopset.add( "or");
0N/Astopset.add( "s");
0N/Astopset.add( "such");
0N/Astopset.add( "t");
0N/Astopset.add( "that");
0N/Astopset.add( "the");
0N/Astopset.add( "their");
0N/Astopset.add( "then");
0N/Astopset.add( "there");
0N/Astopset.add( "these");
0N/Astopset.add( "they");
0N/Astopset.add( "this");
0N/Astopset.add( "to");
0N/Astopset.add( "was");
0N/Astopset.add( "will");
0N/Astopset.add( "with");
0N/Astopset.add( "/");
0N/Astopset.add( "\\");
0N/Astopset.add(":");
0N/Astopset.add(".");
0N/Astopset.add("0.0");
0N/Astopset.add( "1.0");
0N/A }
0N/A
1065N/A public void reInit(String str) {
1065N/A yyreset(new StringReader(str));
0N/A }
0N/A
1065N/A /** Return the position of the first character in the current token. */
1065N/A int getMatchStart() {
1065N/A return yychar;
0N/A }
0N/A
1065N/A /** Return the position of the first character after the current token. */
1065N/A int getMatchEnd() {
1065N/A return yychar + yylength();
0N/A }
0N/A%}
0N/A
0N/AIdentifier = [a-zA-Z_] [a-zA-Z0-9_]*
0N/ANumber = [0-9]+|[0-9]+\.[0-9]+| "0[xX]" [0-9a-fA-F]+
0N/APrintable = [\@\$\%\^\&\-+=\?\.\:]
0N/A
0N/A%%
0N/A
0N/A
1138N/A{Identifier}|{Number}|{Printable} {String m = yytext();
974N/A if(stopset.contains(m)) { } else { return(m);}}
0N/A<<EOF>> { return null;}
974N/A.|\n {}