Cross Reference: LispSymbolTokenizer.lex
xref
: /
opengrok-jel
/
src
/
org
/
opensolaris
/
opengrok
/
analysis
/
lisp
/
LispSymbolTokenizer.lex
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
3
N/A
/*
3
N/A
* CDDL HEADER START
3
N/A
*
3
N/A
* The contents of this file are subject to the terms of the
38
N/A
* Common Development and Distribution License (the "License").
3
N/A
* You may not use this file except in compliance with the License.
3
N/A
*
3
N/A
* See
LICENSE.txt
included in this distribution for the specific
3
N/A
* language governing permissions and limitations under the License.
3
N/A
*
3
N/A
* When distributing Covered Code, include this CDDL HEADER in each
3
N/A
* file and include the License file at
LICENSE.txt
.
3
N/A
* If applicable, add the following below this CDDL HEADER, with the
3
N/A
* fields enclosed by brackets "[]" replaced with your own identifying
3
N/A
* information: Portions Copyright [yyyy] [name of copyright owner]
3
N/A
*
3
N/A
* CDDL HEADER END
3
N/A
*/
3
N/A
3
N/A
/*
1056
N/A
* Copyright (c) 2006, 2010, Oracle
and
/
or
its affiliates. All rights reserved.
3
N/A
*/
3
N/A
3
N/A
/*
38
N/A
* Gets Lisp symbols - ignores comments, strings, keywords
3
N/A
*/
3
N/A
38
N/A
package
org
.
opensolaris
.
opengrok
.
analysis
.
lisp
;
928
N/A
import
java
.
io
.
IOException
;
928
N/A
import
java
.
io
.
Reader
;
816
N/A
import
org
.
opensolaris
.
opengrok
.
analysis
.
JFlexTokenizer
;
3
N/A
3
N/A
%%
3
N/A
%
public
38
N/A
%
class
LispSymbolTokenizer
816
N/A
%
extends
JFlexTokenizer
3
N/A
%
unicode
1425
N/A
%
init
{
1425
N/A
super
(
in
);
1425
N/A
%
init
}
928
N/A
%
type
boolean
928
N/A
%
eofval
{
928
N/A
return
false
;
928
N/A
%
eofval
}
1004
N/A
%
char
3
N/A
3
N/A
%{
928
N/A
private
int
nestedComment
;
3
N/A
%}
928
N/A
38
N/A
Identifier
= [\-\+\*\!\@\$\%\&\/\?\.\,\:\{\}\=a-
zA
-
Z0
-
9
_\<\>]+
3
N/A
38
N/A
%
state
STRING
COMMENT
SCOMMENT
3
N/A
3
N/A
%%
3
N/A
3
N/A
<
YYINITIAL
> {
3
N/A
{
Identifier
} {
String
id
=
yytext
();
816
N/A
if
(!
Consts
.
kwd
.
contains
(
id
.
toLowerCase
())) {
1004
N/A
setAttribs
(
id
,
yychar
,
yychar
+
yylength
());
928
N/A
return
true
; }
816
N/A
}
38
N/A
\
" { yybegin(STRING); }
38
N/A
"
;
" { yybegin(SCOMMENT); }
3
N/A
}
3
N/A
3
N/A
<STRING> {
38
N/A
\" { yybegin(YYINITIAL); }
38
N/A
\\\\ | \\\" {}
3
N/A
}
3
N/A
38
N/A
<YYINITIAL, COMMENT> {
38
N/A
"
#|
" { yybegin(COMMENT); ++nestedComment; }
3
N/A
}
3
N/A
3
N/A
<COMMENT> {
38
N/A
"
|#
" { if (--nestedComment == 0) { yybegin(YYINITIAL); } }
3
N/A
}
3
N/A
3
N/A
<SCOMMENT> {
38
N/A
\n { yybegin(YYINITIAL);}
3
N/A
}
3
N/A
38
N/A
<YYINITIAL, STRING, COMMENT, SCOMMENT> {
928
N/A
<<EOF>> { return false;}
38
N/A
.|\n {}
3
N/A
}