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