00001 %{
00002 /*
00003 * spl/spl_scanner.ll.
00004 *
00005 * Lexical analyzer for scene programming language parser.
00006 *
00007 * Copyright (c) 2002--2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [
00008 *
00009 * Uses reentrant C scanner (to allow for multiple scanners in one
00010 * application) and thus needs flex-2.5.11 or higher.
00011 *
00012 * This file may be distributed and/or modified under the terms of the
00013 * GNU General Public License version 2 as published by the Free Software
00014 * Foundation.
00015 *
00016 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00017 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018 *
00019 */
00020
00021 #include <lib/sconfig.h> /* MUST be first */
00022
00023 /* This also includes the tokens (grammar.hh). */
00024 #include "spl_scanner.h"
00025
00026 %}
00027
00028 /* Generate scanner file by using: */
00029 /* flex -s scanner.ll [works with flex >= 2.5.11] */
00030
00031 %pointer
00032 %option prefix="SPL_"
00033 %option outfile="spl_scanner.cc"
00034 %option noyywrap
00035 /*%option yylineno*/
00036 %option reentrant
00037 %option bison-bridge
00038 /* option bison-locations does NOT calculate locations; just passes
00039 * the structure to store the pos. Then, I don't need it. */
00040 /*%option bison-locations*/
00041 %option stack
00042
00043 /*IN_CMT -> C-style comment */
00044 /*IN_CPPCMT -> C++-style comment */
00045 /*IN_PP -> preprocessor */
00046 %x IN_CMT
00047 %x IN_CPPCMT
00048 %x IN_PP
00049
00050 identifier [[:alpha:]_][[:alnum:]_]*
00051 ninteger [[:digit:]]+
00052 xinteger (0?[[:digit:]]+)|(0x[[:xdigit:]]+)[lLuUsS]*
00053 _floatexp [eE][+-]?{ninteger}
00054 float ((({ninteger}\.)|([[:digit:]]*\.{ninteger})){_floatexp}?)|({ninteger}{_floatexp})
00055 string \"([^\"\n]|\\\")*\"
00056 /* unterminated string: */
00057 ut_string \"([^\"\n]|\\\")*
00058 char \'([^\'\n]|\\.|\\x[[:xdigit:]]+|0\[[:digit:]]+)\'
1.3.5