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