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