Cross Reference: CSharpXref.lex
xref
: /
opengrok-jel
/
src
/
org
/
opensolaris
/
opengrok
/
analysis
/
csharp
/
CSharpXref.lex
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1275
N/A
/*
1275
N/A
* CDDL HEADER START
1275
N/A
*
1275
N/A
* The contents of this file are subject to the terms of the
1275
N/A
* Common Development and Distribution License (the "License").
1275
N/A
* You may not use this file except in compliance with the License.
1275
N/A
*
1275
N/A
* See
LICENSE.txt
included in this distribution for the specific
1275
N/A
* language governing permissions and limitations under the License.
1275
N/A
*
1275
N/A
* When distributing Covered Code, include this CDDL HEADER in each
1275
N/A
* file and include the License file at
LICENSE.txt
.
1275
N/A
* If applicable, add the following below this CDDL HEADER, with the
1275
N/A
* fields enclosed by brackets "[]" replaced with your own identifying
1275
N/A
* information: Portions Copyright [yyyy] [name of copyright owner]
1275
N/A
*
1275
N/A
* CDDL HEADER END
1275
N/A
*/
1275
N/A
1275
N/A
/*
1275
N/A
* Cross reference a C# file
1275
N/A
* @author Christoph Hofmann - ChristophHofmann AT gmx dot de
1275
N/A
*/
1275
N/A
1275
N/A
package
org
.
opensolaris
.
opengrok
.
analysis
.
csharp
;
1275
N/A
import
org
.
opensolaris
.
opengrok
.
analysis
.
JFlexXref
;
1275
N/A
import
java
.
io
.
IOException
;
1275
N/A
import
java
.
io
.
Writer
;
1275
N/A
import
java
.
io
.
Reader
;
1275
N/A
import
org
.
opensolaris
.
opengrok
.
web
.
Util
;
1275
N/A
1275
N/A
%%
1275
N/A
%
public
1275
N/A
%
class
CSharpXref
1275
N/A
%
extends
JFlexXref
1275
N/A
%
unicode
1275
N/A
%
ignorecase
1275
N/A
%
int
1275
N/A
%{
1275
N/A
/* Must match WhiteSpace regex */
1275
N/A
private
final
static
String
WHITE_SPACE
=
"[ \t\f\r]+"
;
1275
N/A
1275
N/A
// TODO move this into an include file when bug #16053 is fixed
1275
N/A
@
Override
1275
N/A
protected
int
getLineNumber
() {
return
yyline
; }
1275
N/A
@
Override
1275
N/A
protected
void
setLineNumber
(
int
x) {
yyline
= x; }
1275
N/A
%}
1275
N/A
1275
N/A
/* Must match WHITE_SPACE constant */
1275
N/A
WhiteSpace
= [ \t\f\r]+
1275
N/A
EOL
= \r|\n|\r\n|\
u2028
|\
u2029
|\
u000B
|\
u000C
|\
u0085
1275
N/A
Identifier
= [a-
zA
-
Z_
] [a-
zA
-
Z0
-
9
_]+
1275
N/A
1275
N/A
URIChar
= [\?\+\%\&\:\/\.\@\_\;\=\$\,\-\!\~\*\\]
1275
N/A
FNameChar
= [a-
zA
-
Z0
-
9
_\-\.]
1275
N/A
File
= [a-
zA
-Z]{
FNameChar
}*
"."
([
chts
]|
"cs"
)
1275
N/A
Path
=
"/"
? [a-
zA
-Z]{
FNameChar
}* (
"/"
[a-
zA
-Z]{
FNameChar
}*[a-
zA
-
Z0
-
9
])+
1275
N/A
1275
N/A
Number
= (0[
xX
][0-
9
a-
fA
-F]+|[0-
9
]+\.[0-
9
]+|[0-
9
]+)(([
eE
][+-]?[0-
9
]+)?[
ufdlUFDL
]*)?
1275
N/A
1275
N/A
//ClassName = ({Identifier} ".")* {Identifier}
1275
N/A
//ParamName = {Identifier} | "<" {Identifier} ">"
1275
N/A
1275
N/A
%
state
STRING
COMMENT
SCOMMENT
QSTRING
VSTRING
1275
N/A
1275
N/A
%%
1275
N/A
<
YYINITIAL
>{
1275
N/A
1275
N/A
{
Identifier
} {
1275
N/A
String
id
=
yytext
();
1469
N/A
writeSymbol
(
id
,
Consts
.
kwd
,
yyline
-
1
,
false
);
1275
N/A
}
1275
N/A
1275
N/A
"<"
({
File
}|{
Path
})
">"
{
1275
N/A
out
.
write
(
"<"
);
1275
N/A
String
path
=
yytext
();
1275
N/A
path
=
path
.
substring
(
1
,
path
.
length
() -
1
);
1275
N/A
out
.
write
(
"<a href=\""
+
urlPrefix
+
"path="
);
1275
N/A
out
.
write
(
path
);
1275
N/A
appendProject
();
1275
N/A
out
.
write
(
"\">"
);
1275
N/A
out
.
write
(
path
);
1275
N/A
out
.
write
(
"</a>"
);
1275
N/A
out
.
write
(
">"
);
1275
N/A
}
1275
N/A
1281
N/A
/*{Hier}
1281
N/A
{ out.write(Util.breadcrumbPath(urlPrefix+"defs=",yytext(),'.'));}
1275
N/A
*/
1275
N/A
{
Number
} {
out
.
write
(
"<span class=\"n\">"
);
out
.
write
(
yytext
());
out
.
write
(
"</span>"
); }
1275
N/A
1370
N/A
\
" { yybegin(STRING);out.write("
<
span
class
=\
"s\">\""
);
spans
.
push
(
"s"
); }
1370
N/A
\
' { yybegin(QSTRING);out.write("<span class=\"s\">\'"); spans.push("s"); }
1370
N/A
"/*" { yybegin(COMMENT);out.write("<span class=\"c\">/*"); spans.push("c"); }
1370
N/A
"//" { yybegin(SCOMMENT);out.write("<span class=\"c\">//"); spans.push("c"); }
1275
N/A
}
1275
N/A
1275
N/A
<STRING> {
1275
N/A
\" {WhiteSpace} \" { out.write(yytext());}
1370
N/A
\" { yybegin(YYINITIAL); out.write("\"</span>"); spans.pop(); }
1275
N/A
\\\\ { out.write("\\\\"); }
1275
N/A
\\\" { out.write("\\\""); }
1275
N/A
}
1275
N/A
1275
N/A
<QSTRING> {
1275
N/A
"\\\\" { out.write("\\\\"); }
1275
N/A
"\\\'" { out.write("\\\'"); }
1275
N/A
\' {WhiteSpace} \' { out.write(yytext()); }
1370
N/A
\' { yybegin(YYINITIAL); out.write("'
</
span
>
"); spans.pop(); }
1275
N/A
}
1275
N/A
1275
N/A
<VSTRING> {
1275
N/A
\" {WhiteSpace} \" { out.write(yytext());}
1275
N/A
"
\
"\""
{
out
.
write
(
"\"\""
); }
1370
N/A
\
" { yybegin(YYINITIAL); out.write("
\
"</span>"
);
spans
.
pop
(); }
1275
N/A
\\ {
out
.
write
(
"\\"
); }
1275
N/A
}
1275
N/A
1275
N/A
<
COMMENT
> {
1370
N/A
"*/"
{
yybegin
(
YYINITIAL
);
out
.
write
(
"*/</span>"
);
spans
.
pop
(); }
1275
N/A
}
1275
N/A
1275
N/A
<
SCOMMENT
> {
1275
N/A
{
WhiteSpace
}*{
EOL
} {
1370
N/A
yybegin
(
YYINITIAL
);
out
.
write
(
"</span>"
);
spans
.
pop
();
1275
N/A
startNewLine
();
1275
N/A
}
1275
N/A
}
1275
N/A
1275
N/A
<
YYINITIAL
,
STRING
,
COMMENT
,
SCOMMENT
,
QSTRING
,
VSTRING
> {
1275
N/A
"&"
{
out
.
write
(
"&"
);}
1275
N/A
"<"
{
out
.
write
(
"<"
);}
1275
N/A
">"
{
out
.
write
(
">"
);}
1275
N/A
{
WhiteSpace
}*{
EOL
} {
startNewLine
(); }
1275
N/A
{
WhiteSpace
} {
out
.
write
(
yytext
()); }
1275
N/A
[!-~] {
out
.
write
(
yycharat
(0)); }
1275
N/A
. {
writeUnicodeChar
(
yycharat
(0)); }
1275
N/A
}
1275
N/A
1275
N/A
<
STRING
,
COMMENT
,
SCOMMENT
,
QSTRING
,
VSTRING
> {
1275
N/A
{
Path
}
1281
N/A
{
out
.
write
(
Util
.
breadcrumbPath
(
urlPrefix
+
"path="
,
yytext
(),
'/'
));}
1275
N/A
1275
N/A
{
File
}
1275
N/A
{
1275
N/A
String
path
=
yytext
();
1275
N/A
out
.
write
(
"<a href=\""
+
urlPrefix
+
"path="
);
1275
N/A
out
.
write
(
path
);
1275
N/A
appendProject
();
1275
N/A
out
.
write
(
"\">"
);
1275
N/A
out
.
write
(
path
);
1275
N/A
out
.
write
(
"</a>"
);}
1275
N/A
1275
N/A
(
"http"
|
"https"
|
"ftp"
)
"://"
({
FNameChar
}|{
URIChar
})+[a-
zA
-
Z0
-
9
/]
1275
N/A
{
1275
N/A
String
url
=
yytext
();
1275
N/A
out
.
write
(
"<a href=\""
);
1472
N/A
out
.
write
(
Util
.
uriEncodeURL
(
url
));
out
.
write
(
"\">"
);
1469
N/A
out
.
write
(
Util
.
htmlize
(
url
));
out
.
write
(
"</a>"
);}
1275
N/A
1275
N/A
{
FNameChar
}+
"@"
{
FNameChar
}+
"."
{
FNameChar
}+
1275
N/A
{
1275
N/A
writeEMailAddress
(
yytext
());
1275
N/A
}
1275
N/A
}