\doxysection{\+\_\+jsgf\+\_\+scanner.\+l}
\label{__jsgf__scanner_8l_source}\index{src/libsphinxbase/lm/\_jsgf\_scanner.l@{src/libsphinxbase/lm/\_jsgf\_scanner.l}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*\ -\/*-\/\ mode:\ text\ -\/*-\/\ */}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*\ ====================================================================}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ Copyright\ (c)\ 2007\ Carnegie\ Mellon\ University.\ \ All\ rights}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ are\ met:}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ 1.\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.\ }}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ 2.\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ \ \ the\ documentation\ and/or\ other\ materials\ provided\ with\ the}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ \ \ distribution.}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ This\ work\ was\ supported\ in\ part\ by\ funding\ from\ the\ Defense\ Advanced\ }}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ Research\ Projects\ Agency\ and\ the\ National\ Science\ Foundation\ of\ the\ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ United\ States\ of\ America,\ and\ the\ CMU\ Sphinx\ Speech\ Consortium.}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ CARNEGIE\ MELLON\ UNIVERSITY\ \`{}\`{}AS\ IS''\ AND\ }}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *\ ANY\ EXPRESSED\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ }}
\DoxyCodeLine{00024\ \textcolor{comment}{\ *\ THE\ IMPLIED\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ A\ PARTICULAR}}
\DoxyCodeLine{00025\ \textcolor{comment}{\ *\ PURPOSE\ ARE\ DISCLAIMED.\ \ IN\ NO\ EVENT\ SHALL\ CARNEGIE\ MELLON\ UNIVERSITY}}
\DoxyCodeLine{00026\ \textcolor{comment}{\ *\ NOR\ ITS\ EMPLOYEES\ BE\ LIABLE\ FOR\ ANY\ DIRECT,\ INDIRECT,\ INCIDENTAL,}}
\DoxyCodeLine{00027\ \textcolor{comment}{\ *\ SPECIAL,\ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES\ (INCLUDING,\ BUT\ NOT\ }}
\DoxyCodeLine{00028\ \textcolor{comment}{\ *\ LIMITED\ TO,\ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;\ LOSS\ OF\ USE,\ }}
\DoxyCodeLine{00029\ \textcolor{comment}{\ *\ DATA,\ OR\ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND\ ON\ ANY\ }}
\DoxyCodeLine{00030\ \textcolor{comment}{\ *\ THEORY\ OF\ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT\ }}
\DoxyCodeLine{00031\ \textcolor{comment}{\ *\ (INCLUDING\ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ }}
\DoxyCodeLine{00032\ \textcolor{comment}{\ *\ OF\ THIS\ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00033\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00034\ \textcolor{comment}{\ *\ ====================================================================}}
\DoxyCodeLine{00035\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00036\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00037\ \textcolor{comment}{/*\ YOU\ MUST\ USE\ FLEX\ 2.5.33\ OR\ NEWER\ TO\ PROCESS\ THIS\ FILE!!!\ */}}
\DoxyCodeLine{00038\ \%\{}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\#include\ "{}jsgf\_internal.h"{}}}
\DoxyCodeLine{00041\ \textcolor{preprocessor}{\#include\ "{}jsgf\_parser.h"{}}}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \%\}}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \%option\ 8bit\ reentrant\ bison-\/bridge\ noyywrap\ yylineno}
\DoxyCodeLine{00046\ \%option\ header-\/file="{}jsgf\_scanner.h"{}}
\DoxyCodeLine{00047\ \%s\ COMMENT}
\DoxyCodeLine{00048\ \%s\ DECL}
\DoxyCodeLine{00049\ \%s\ DECLCOMMENT}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ ws\ \ \ \ \ \ \ [\ \(\backslash\)t\(\backslash\)r\(\backslash\)n]}
\DoxyCodeLine{00052\ rulename\ \(\backslash\)<[\string^<>]+\(\backslash\)>}
\DoxyCodeLine{00053\ tag\ \ \ \ \ \ \(\backslash\)\{(\(\backslash\)\(\backslash\).|[\string^\(\backslash\)\}]+)*\(\backslash\)\}}
\DoxyCodeLine{00054\ weight\ \ \ \(\backslash\)/[0-\/9]*(\(\backslash\).[0-\/9]+)?(e-\/)?[0-\/9]*\(\backslash\)/}
\DoxyCodeLine{00055\ token\ \ \ \ [\string^\ \(\backslash\)t\(\backslash\)r\(\backslash\)n=;|*+<>()\(\backslash\)[\(\backslash\)]\{\}*/]+}
\DoxyCodeLine{00056\ qstring\ \ \(\backslash\)"{}(\(\backslash\)\(\backslash\).|[\string^"{}]+)*\(\backslash\)"{}}
\DoxyCodeLine{00057\ bom\ \ \ \ \ \ [\(\backslash\)xEF][\(\backslash\)xBB][\(\backslash\)xBF]}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00059\ \%\%}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ \textcolor{stringliteral}{\{ws\}}\ ;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ ignore\ whitespace\ */}}
\DoxyCodeLine{00062\ \textcolor{stringliteral}{<INITIAL>\(\backslash\)/\(\backslash\)/.*\(\backslash\)n}\ ;\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ single-\/line\ comments\ */}}
\DoxyCodeLine{00063\ \textcolor{stringliteral}{<INITIAL>\(\backslash\)/\(\backslash\)*}\ \{\ BEGIN(COMMENT);\ \}\ \textcolor{comment}{/*\ C-\/style\ comments\ */}}
\DoxyCodeLine{00064\ \textcolor{stringliteral}{<COMMENT>\(\backslash\)*\(\backslash\)/}\ \{\ BEGIN(INITIAL);\ \}}
\DoxyCodeLine{00065\ \textcolor{stringliteral}{<COMMENT>.}\ ;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Ignore\ stuff\ in\ comment\ mode\ */}}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ \textcolor{stringliteral}{<DECL>\(\backslash\)/\(\backslash\)/.*\(\backslash\)n}\ ;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ single-\/line\ comments\ inside\ decl\ */}}
\DoxyCodeLine{00068\ \textcolor{stringliteral}{<DECL>\(\backslash\)/\(\backslash\)*}\ \{\ BEGIN(DECLCOMMENT);\ \}\ \textcolor{comment}{/*\ C-\/style\ comments\ inside\ decl\ */}}
\DoxyCodeLine{00069\ \textcolor{stringliteral}{<DECLCOMMENT>\(\backslash\)*\(\backslash\)/}\ \{\ BEGIN(DECL);\ \}}
\DoxyCodeLine{00070\ \textcolor{stringliteral}{<DECLCOMMENT>.}\ ;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Ignore\ stuff\ in\ comment\ mode\ */}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \textcolor{stringliteral}{<INITIAL>\{bom\}?\#JSGF}\ \{BEGIN(DECL);\ \textcolor{keywordflow}{return}\ HEADER;\}}
\DoxyCodeLine{00073\ \textcolor{stringliteral}{<INITIAL>grammar}\ \{BEGIN(DECL);\ \textcolor{keywordflow}{return}\ GRAMMAR;\}}
\DoxyCodeLine{00074\ \textcolor{stringliteral}{<INITIAL>import}\ \{BEGIN(DECL);\ \textcolor{keywordflow}{return}\ IMPORT;\}}
\DoxyCodeLine{00075\ \textcolor{stringliteral}{<INITIAL>public}\ \{BEGIN(DECL);\ \textcolor{keywordflow}{return}\ PUBLIC;\}}
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00077\ \textcolor{stringliteral}{<INITIAL>\{rulename\}}\ \{\ BEGIN(DECL);\ yylval-\/>name\ =\ strdup(yytext);\ \textcolor{keywordflow}{return}\ RULENAME;\ \}}
\DoxyCodeLine{00078\ \textcolor{stringliteral}{<DECL>\{rulename\}}\ \{\ yylval-\/>name\ =\ strdup(yytext);\ \textcolor{keywordflow}{return}\ RULENAME;\ \}}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \textcolor{stringliteral}{<DECL>\{tag\}}\ \ \ \ \ \ \{\ yylval-\/>name\ =\ strdup(yytext);\ \textcolor{keywordflow}{return}\ TAG;\ \}}
\DoxyCodeLine{00081\ \textcolor{stringliteral}{<DECL>\{token\}}\ \ \ \ \{\ yylval-\/>name\ =\ strdup(yytext);\ \textcolor{keywordflow}{return}\ TOKEN;\ \}}
\DoxyCodeLine{00082\ \textcolor{stringliteral}{<DECL>;}\ \ \ \ \ \ \ \ \ \ \{\ BEGIN(INITIAL);\ \textcolor{keywordflow}{return}\ yytext[0];\ \}}
\DoxyCodeLine{00083\ \textcolor{stringliteral}{<DECL>\{qstring\}}\ \ \{\ yylval-\/>name\ =\ strdup(yytext);\ \textcolor{keywordflow}{return}\ TOKEN;\ \}}
\DoxyCodeLine{00084\ \textcolor{stringliteral}{<DECL>\{weight\}}\ \ \ \{\ yylval-\/>weight\ =\ atof\_c(yytext+1);\ \textcolor{keywordflow}{return}\ WEIGHT;\ \}}
\DoxyCodeLine{00085\ \textcolor{stringliteral}{<DECL>.}\ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ yytext[0];\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Single-\/character\ tokens\ */}}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ \%\%}

\end{DoxyCode}
