Commit bf2f2949 authored by Sergio Costas's avatar Sergio Costas

Now the 'asm' and '__asm__' statements are recognized fine

parent 86c7bc0f
......@@ -48,6 +48,7 @@ int current_line = 1;
char *current_file = NULL;
char do_verbose = 0;
void find_close_parentheses(void);
%}
......@@ -101,10 +102,12 @@ char do_verbose = 0;
"__prog__" { count(); }
"__restrict" { count(); }
"__inline" { count(); }
"__attribute__"{WS}*"((".*"))" { count(); }
"__asm__"{WS}*"(".*")" { count(); }
"__asm__"{WS}+"volatile"{WS}*"(".*")" { count(); }
"__asm__"{WS}+"__volatile__"{WS}*"(".*")" { count(); }
"__attribute__"{WS}*"(" { find_close_parentheses(); count(); }
"__asm__"{WS}*"(" { find_close_parentheses(); count(); }
"__asm__"{WS}+"volatile"{WS}*"(" { find_close_parentheses(); count(); }
"__asm__"{WS}+"__volatile__"{WS}*"(" { find_close_parentheses(); count(); }
"asm"{WS}+"volatile"{WS}*"(" { find_close_parentheses(); count(); }
"asm"{WS}*"(" { find_close_parentheses(); count(); }
"__crust_t__" { return prepare_leaf(0,0.0,CRUST_T); }
"__crust_borrow__" { return prepare_leaf(0,0.0,CRUST_BORROW); }
"__crust_recycle__" { return prepare_leaf(0,0.0,CRUST_RECYCLE); }
......@@ -421,6 +424,45 @@ int prepare_leaf(unsigned long long int v1, double v2, int current_token) {
return current_token;
}
void find_close_parentheses(void) {
char c;
int counter = 1;
bool inside_quotes = false;
while ((counter != 0) && ((c = input()) != 0)) {
if (c == '\'') {
c = input();
if (c == '\\') {
c = input();
}
c = input();
continue;
}
if (inside_quotes) {
if (c == '\\') {
input();
continue;
}
if (c == '"') {
inside_quotes = false;
}
continue;
}
if (c == '"') {
inside_quotes = true;
}
if (c == '(') {
counter++;
continue;
}
if (c == ')') {
counter--;
continue;
}
}
}
void comment(void) {
char c, prev = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment