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