ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * CDDL HEADER START
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * The contents of this file are subject to the terms of the
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * Common Development and Distribution License (the "License").
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * You may not use this file except in compliance with the License.
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * See LICENSE.txt included in this distribution for the specific
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * language governing permissions and limitations under the License.
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * When distributing Covered Code, include this CDDL HEADER in each
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * file and include the License file at LICENSE.txt.
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * If applicable, add the following below this CDDL HEADER, with the
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * fields enclosed by brackets "[]" replaced with your own identifying
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * information: Portions Copyright [yyyy] [name of copyright owner]
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * CDDL HEADER END
4eda2f9f481542c575493b4d80a9297b6d43a032Knut Anders Hatlen * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco * Cross reference a Javascript file
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Koscopackage org.opensolaris.opengrok.analysis.javascript;
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Koscoimport org.opensolaris.opengrok.analysis.JFlexXref;
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco /* Must match WhiteSpace regex */
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco private final static String WHITE_SPACE = "[ \t\f\r]+";
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco // TODO move this into an include file when bug #16053 is fixed
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco protected int getLineNumber() { return yyline; }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco protected void setLineNumber(int x) { yyline = x; }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco/* Must match WHITE_SPACE constant */
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos KoscoURIChar = [\?\+\%\&\:\/\.\@\_\;\=\$\,\-\!\~\*\\]
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos KoscoFile = [a-zA-Z]{FNameChar}* "." ("js"|"properties"|"props"|"xml"|"conf"|"txt"|"htm"|"html"|"ini"|"diff"|"patch")
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos KoscoPath = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*[a-zA-Z0-9])+
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos KoscoNumber = (0[xX][0-9a-fA-F]+|[0-9]+\.[0-9]+|[0-9]+)(([eE][+-]?[0-9]+)?[ufdlUFDL]*)?
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco { out.write(Util.breadcrumbPath(urlPrefix+"defs=",yytext(),'.'));}
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco{Number} { out.write("<span class=\"n\">"); out.write(yytext()); out.write("</span>"); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \" { yybegin(STRING);out.write("<span class=\"s\">\"");}
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \' { yybegin(QSTRING);out.write("<span class=\"s\">\'");}
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco "/*" { yybegin(COMMENT);out.write("<span class=\"c\">/*");}
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco "//" { yybegin(SCOMMENT);out.write("<span class=\"c\">//");}
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \" {WhiteSpace} \" { out.write(yytext());}
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \" { yybegin(YYINITIAL); out.write("\"</span>"); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \\\\ { out.write("\\\\"); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \\\" { out.write("\\\""); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco "\\\\" { out.write("\\\\"); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco "\\\'" { out.write("\\\'"); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \' {WhiteSpace} \' { out.write(yytext()); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco \' { yybegin(YYINITIAL); out.write("'</span>"); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco"*/" { yybegin(YYINITIAL); out.write("*/</span>"); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco {WhiteSpace}*{EOL} {
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco startNewLine();
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco<YYINITIAL, STRING, COMMENT, SCOMMENT, QSTRING> {
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco{WhiteSpace}*{EOL} { startNewLine(); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco {WhiteSpace} { out.write(yytext()); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco [!-~] { out.write(yycharat(0)); }
474ac6921d21d2e44cf9c1e91f17d6bcbb15c9e8Lubos Kosco [^\n] { writeUnicodeChar(yycharat(0)); }
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco<STRING, COMMENT, SCOMMENT, STRING, QSTRING> {
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco { out.write(Util.breadcrumbPath(urlPrefix+"path=",yytext(),'/'));}
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco String path = yytext();
ecc9697029dc3bde02537b914756f7c49eb7cd1eLubos Kosco("http" | "https" | "ftp" ) "://" ({FNameChar}|{URIChar})+[a-zA-Z0-9/]