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/*
1067N/A * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A */
0N/A
0N/Apackage org.opensolaris.opengrok.analysis.plain;
850N/Aimport org.opensolaris.opengrok.analysis.JFlexXref;
850N/Aimport java.io.IOException;
850N/Aimport java.io.Writer;
850N/Aimport java.io.Reader;
1469N/Aimport org.opensolaris.opengrok.web.Util;
0N/A
0N/A%%
0N/A%public
0N/A%class PlainXref
850N/A%extends JFlexXref
0N/A%unicode
0N/A%ignorecase
0N/A%int
0N/A%{
1020N/A // TODO move this into an include file when bug #16053 is fixed
1020N/A @Override
1020N/A protected int getLineNumber() { return yyline; }
1020N/A @Override
1020N/A protected void setLineNumber(int x) { yyline = x; }
0N/A%}
0N/AURIChar = [\?\+\%\&\:\/\.\@\_\;\=\$\,\-\!\~\*\\]
1020N/AEOL = \r|\n|\r\n
0N/AFNameChar = [a-zA-Z0-9_\-\.]
0N/AFile = {FNameChar}+ "." ([a-zA-Z]+) {FNameChar}*
0N/APath = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*)+[a-zA-Z0-9]
0N/A%%
0N/A{File}|{Path}
974N/A {String s=yytext();
974N/A out.write("<a href=\"");out.write(urlPrefix);out.write("path=");
974N/A out.write(s);appendProject();out.write("\">");
974N/A out.write(s);out.write("</a>");}
0N/A
0N/A("http" | "https" | "ftp" ) "://" ({FNameChar}|{URIChar})+[a-zA-Z0-9/]
974N/A {String s=yytext();
974N/A out.write("<a href=\"");
1472N/A out.write(Util.uriEncodeURL(s));out.write("\">");
1469N/A out.write(Util.htmlize(s));out.write("</a>");}
0N/A
171N/A{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+
974N/A {
1122N/A writeEMailAddress(yytext());
974N/A }
0N/A
923N/A// Bug #13362: If there's a very long sequence that matches {FNameChar}+,
923N/A// parsing the file will take forever because of all the backtracking. With
923N/A// this rule, we avoid much of the backtracking and speed up the parsing
923N/A// (in some cases from hours to seconds!). This rule will not interfere with
923N/A// the rules above because JFlex always picks the longest match.
923N/A{FNameChar}+ { out.write(yytext()); }
923N/A
974N/A"&" {out.write( "&amp;");}
974N/A"<" {out.write( "&lt;");}
974N/A">" {out.write( "&gt;");}
1020N/A{EOL} {startNewLine(); }
974N/A[ !-~\t\f] {out.write(yycharat(0));}
974N/A. { writeUnicodeChar(yycharat(0)); }