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