git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug in font name setting
[swftools.git]
/
src
/
parser.lex
diff --git
a/src/parser.lex
b/src/parser.lex
index
7da8d5e
..
e03175a
100644
(file)
--- a/
src/parser.lex
+++ b/
src/parser.lex
@@
-1,7
+1,9
@@
%{
#include <string.h>
%{
#include <string.h>
-#include "q.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include "../lib/q.h"
#include "parser.h"
//RVALUE {NUMBER}|{PERCENT}|{NAME}|\"{STRING}\"|{DIM}
#include "parser.h"
//RVALUE {NUMBER}|{PERCENT}|{NAME}|\"{STRING}\"|{DIM}
@@
-86,8
+88,8
@@
static void store(enum type_t type, int line, int column, char*text, int length)
}
prefix = 0;
break;
}
prefix = 0;
break;
- case LABEL:
- string_set2(&tmp, text, length-1);
+ case RAWDATA:
+ string_set2(&tmp, text+1/*:*/, length-5/*.end*/);
token.text = (char*)mem_putstring(&strings, tmp);
break;
case COMMAND:
token.text = (char*)mem_putstring(&strings, tmp);
break;
case COMMAND:
@@
-118,6
+120,8
@@
static void store(enum type_t type, int line, int column, char*text, int length)
#define MAX_INCLUDE_DEPTH 16
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
#define MAX_INCLUDE_DEPTH 16
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+int line_stack[MAX_INCLUDE_DEPTH];
+int column_stack[MAX_INCLUDE_DEPTH];
int include_stack_ptr = 0;
void handleInclude(char*text, int len)
int include_stack_ptr = 0;
void handleInclude(char*text, int len)
@@
-137,7
+141,10
@@
void handleInclude(char*text, int len)
fprintf( stderr, "Includes nested too deeply" );
exit( 1 );
}
fprintf( stderr, "Includes nested too deeply" );
exit( 1 );
}
- include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
+ include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
+ line_stack[include_stack_ptr] = line;
+ column_stack[include_stack_ptr] = column;
+ include_stack_ptr++;
yyin = fopen(text, "rb");
if (!yyin) {
fprintf(stderr, "Couldn't open %s\n", text);
yyin = fopen(text, "rb");
if (!yyin) {
fprintf(stderr, "Couldn't open %s\n", text);
@@
-156,8
+163,8
@@
void handleInclude(char*text, int len)
%x BINARY
NAME [a-zA-Z_./](-*[a-zA-Z0-9_./])*
%x BINARY
NAME [a-zA-Z_./](-*[a-zA-Z0-9_./])*
-TWIP ([0-9]+(\.([0-9]([05])?)?)?)
-NUMBER [0-9]+(\.[0-9]*)?
+TWIP (-?[0-9]+(\.([0-9]([05])?)?)?)
+NUMBER -?[0-9]+(\.[0-9]*)?
PERCENT {NUMBER}%
STRING (\\.|[^\\"\n])*
S [ \n\r\t]
PERCENT {NUMBER}%
STRING (\\.|[^\\"\n])*
S [ \n\r\t]
@@
-182,7
+189,7
@@
RVALUE \"{STRING}\"|([^ \n\r\t]+)
}
\.include{S}.*\n {handleInclude(yytext, yyleng);}
\.{NAME} {s(COMMAND);c();}
}
\.include{S}.*\n {handleInclude(yytext, yyleng);}
\.{NAME} {s(COMMAND);c();}
-{NAME}{S}*: {s(LABEL);c();}
+:([^.]|\.[^e]|\.e[^n]|\.en[^d]|[ \n\r\t])*\.end {s(RAWDATA);c();}
{NAME} {s(IDENTIFIER);c();}
"[" {c();BEGIN(BINARY);}
{S} {c();}
{NAME} {s(IDENTIFIER);c();}
"[" {c();BEGIN(BINARY);}
{S} {c();}
@@
-208,6
+215,8
@@
RVALUE \"{STRING}\"|([^ \n\r\t]+)
yy_delete_buffer( YY_CURRENT_BUFFER );
yy_switch_to_buffer(
include_stack[include_stack_ptr] );
yy_delete_buffer( YY_CURRENT_BUFFER );
yy_switch_to_buffer(
include_stack[include_stack_ptr] );
+ column = column_stack[include_stack_ptr];
+ line = line_stack[include_stack_ptr];
}
}
}
}