From a7bc7485b1a4d7e1b1a12ff593ca4ccb1d59e466 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Sat, 23 Feb 2008 01:51:37 +0000 Subject: configure.ac: Add checks for Flex/Yacc/Bison and other furry animals, for the new goom 2k4 based plugin Original commit message from CVS: 2008-02-23 Bastien Nocera * configure.ac: Add checks for Flex/Yacc/Bison and other furry animals, for the new goom 2k4 based plugin * gst/goom/*: Update to use goom 2k4, uses liboil to detect CPU optimisations (not working yet), move the old plugin to... * gst/goom2k1/*: ... here, in case somebody is sick enough Fixes #515073 --- gst/goom/goomsl_lex.l | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 gst/goom/goomsl_lex.l (limited to 'gst/goom/goomsl_lex.l') diff --git a/gst/goom/goomsl_lex.l b/gst/goom/goomsl_lex.l new file mode 100644 index 00000000..3079c022 --- /dev/null +++ b/gst/goom/goomsl_lex.l @@ -0,0 +1,94 @@ +%{ + +#include +#include +#include +#include "goomsl.h" +#include "goomsl_private.h" +#include "goomsl_yacc.h" +void yyerror(char *); +void yyparse(void); + +GoomSL *currentGoomSL; +static int string_size; +static char string[1024]; +%} + +DIGIT [0-9] +XDIGIT [0-9a-f] +ID [a-zA-Z_@&][a-zA-Z0-9_\.]* + +%S C_COMMENT +%S LINE_COMMENT +%S STRING + +%% + +^[ \t]*\n { ++currentGoomSL->num_lines; /* Ignore empty lines */ } +^[ \t]*"//"[^\n]*\n { ++currentGoomSL->num_lines; /* Ignore empty lines */ } + +\n { ++currentGoomSL->num_lines; yylval.charValue=*yytext; BEGIN INITIAL; return '\n'; } +\n { ++currentGoomSL->num_lines; yylval.charValue=*yytext; return '\n'; } + +"*/" { BEGIN INITIAL; } +\n { ++currentGoomSL->num_lines; } +. { /* eat up comment */ } + +"#RST_LINE#" { currentGoomSL->num_lines = 0; } +"#FILE ".*"#" { currentGoomSL->num_lines = 0; printf("%s\n", yytext); } +"#"[^\n]* { /* ignore preprocessor lines */ } + +"/*" { BEGIN C_COMMENT; } +"//" { BEGIN LINE_COMMENT; } +\" { BEGIN STRING; string_size=0; } + +"\\n" { string[string_size++] = '\n'; } +"\\\"" { string[string_size++] = '\"'; } +\" { /* fin de la chaine: on cree le pointeur qui va bien */ + unsigned int tmp; + BEGIN INITIAL; + string[string_size]=0; + tmp = gsl_malloc(currentGoomSL, string_size+1); + strcpy((char*)currentGoomSL->ptrArray[tmp],string); + sprintf(yylval.strValue, "0x%08x", tmp); + return LTYPE_PTR; + } +. { string[string_size++] = *yytext; } + +"float" { return FLOAT_TK; } +"int" { return INT_TK; } +"boolean" { return INT_TK; } +"ptr" { return PTR_TK; } +"string" { return PTR_TK; } +"declare" { return DECLARE; } +"external" { return EXTERNAL; } +"struct" { return STRUCT; } +"not" { return NOT; } +"while" { return WHILE; } +"do" { return DO; } +"for" { return FOR; } +"in" { return IN; } +"true" { strncpy(yylval.strValue, "1", 2047); return LTYPE_INTEGER; } +"false" { strncpy(yylval.strValue, "0", 2047); return LTYPE_INTEGER; } +{ID} { strncpy(yylval.strValue, yytext, 2047); return LTYPE_VAR; } +{DIGIT}+ { strncpy(yylval.strValue, yytext, 2047); return LTYPE_INTEGER; } +\'.\' { sprintf(yylval.strValue, "%d", (int)yytext[1]); return LTYPE_INTEGER; } +"0x"{XDIGIT}+ { strncpy(yylval.strValue, yytext, 2047); return LTYPE_INTEGER; } +{DIGIT}+"."{DIGIT}* { strncpy(yylval.strValue, yytext, 2047); return LTYPE_FLOAT; } +{DIGIT}+"%" { sprintf(yylval.strValue, "%3.2f", atof(yytext)/100.0f); return LTYPE_FLOAT; } +"+=" { return PLUS_EQ; } +"*=" { return MUL_EQ; } +"-=" { return SUB_EQ; } +"/=" { return DIV_EQ; } +"<=" { return LOW_EQ; } +">=" { return SUP_EQ; } +"!=" { return NOT_EQ; } +"<>" { return NOT_EQ; } +[ \t]+ /* eat up whitespace */ +. { yylval.charValue = *yytext; return *yytext; } + +%% + + +int yywrap(void) { return 1; yyunput(0,0); } + -- cgit