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