1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - tools - init2env 3 File: init.l 4 5 Copyright 2005-2008 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Date:: 2008-09-18#$ 14 $Rev: 8573 $ 15 $Author: okubata_ryoma $ 16 *---------------------------------------------------------------------------*/ 17 %{ 18 // Parser 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include <string.h> 22 #include "init.tab.h" 23 extern int line_count; 24 %} 25 26 %% 27 \[ return L_BRACKET; 28 \] return R_BRACKET; 29 \< return L_INEQUALITY; 30 \> return R_INEQUALITY; 31 \" return D_QUOTATION; 32 33 (U8|S8|U16|S16|U32|S32|U64|S64|BOOL) { 34 init_yylval.letter = (char *)strdup(yytext); 35 return TYPENUM; 36 } 37 38 (STRING) { 39 init_yylval.letter = (char *)strdup(yytext); 40 return TYPESTR; 41 } 42 43 (BINARY) { 44 init_yylval.letter = (char *)strdup(yytext); 45 return TYPEBIN; 46 } 47 48 [ \f\t]+ ; 49 50 [\r\n]+ { 51 line_count++; 52 } 53 54 [^ \f\n\r\t\[\]\"\<\>]+ { 55 init_yylval.letter = (char *)strdup(yytext); 56 return LETTER; 57 } 58 %% 59