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