[asterisk-commits] trunk r22571 - in /trunk/pbx/ael: ael.flex
ael_lex.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Apr 26 11:40:10 MST 2006
Author: rizzo
Date: Wed Apr 26 13:40:09 2006
New Revision: 22571
URL: http://svn.digium.com/view/asterisk?rev=22571&view=rev
Log:
whitespace-only change:
fix formatting and indentation of the flex file,
and regenerate the ael_lex.c
Modified:
trunk/pbx/ael/ael.flex
trunk/pbx/ael/ael_lex.c
Modified: trunk/pbx/ael/ael.flex
URL: http://svn.digium.com/view/asterisk/trunk/pbx/ael/ael.flex?rev=22571&r1=22570&r2=22571&view=diff
==============================================================================
--- trunk/pbx/ael/ael.flex (original)
+++ trunk/pbx/ael/ael.flex Wed Apr 26 13:40:09 2006
@@ -19,7 +19,7 @@
/*! \file
*
* \brief Flex scanner description of tokens used in AEL2 .
- *
+ *
*/#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -52,12 +52,11 @@
static void pbcwhere(char *text, int *line, int *col );
static int c_prevword(void);
-struct stackelement
-{
- char *fname;
- int lineno;
- int colno;
- YY_BUFFER_STATE bufstate;
+struct stackelement {
+ char *fname;
+ int lineno;
+ int colno;
+ YY_BUFFER_STATE bufstate;
};
struct stackelement include_stack[MAX_INCLUDE_DEPTH];
int include_stack_index = 0;
@@ -120,352 +119,384 @@
[ ]+ {/* nothing */ int wid = 8-(my_col%8); my_col+=wid;}
[-a-zA-Z0-9'"_/.\<\>\*\+!$#\[\]][-a-zA-Z0-9'"_/.!\*\+\<\>\{\}$#\[\]]* {
- yylloc->first_line = yylloc->last_line = my_lineno;yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col; /* set up the ptr */
- yylval->str = strdup(yytext);
- /* printf("\nGot WORD %s[%d][%d:%d]\n", yylval->str, my_lineno ,yylloc->first_column,yylloc->last_column ); */
- my_col+=yyleng;
- prev_word = yylval->str;
- return word;
- }
-
-<paren>[^()\[\]\{\}]*\) {yylloc->first_line = my_lineno; yylloc->first_column=my_col;
- if ( pbcpop(')') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno+l4, c4, yytext);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- prev_word = 0;
- return word;
- }
- parencount--;
- if ( parencount >= 0) {
- yymore();
- } else {
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=c4;
- yylval->str = strdup(yytext);
- *(yylval->str+strlen(yylval->str)-1)=0;
- /* printf("Got paren word %s\n", yylval->str); */
- unput(')');
- my_col=c4;
- my_lineno += l4;
- BEGIN(0);
- return word;
- }
- }
-
-<paren>[^()\[\]\{\}]*\( {yylloc->first_line = my_lineno; yylloc->first_column=my_col;
- parencount++; pbcpush('(');
- yymore();
- }
+ yylloc->first_line = yylloc->last_line = my_lineno;
+ yylloc->last_column=my_col+yyleng-1;
+ yylloc->first_column=my_col; /* set up the ptr */
+ my_col+=yyleng;
+ yylval->str = strdup(yytext);
+ /* printf("\nGot WORD %s[%d][%d:%d]\n", yylval->str, my_lineno ,yylloc->first_column,yylloc->last_column ); */
+ prev_word = yylval->str;
+ return word;
+ }
+
+<paren>[^()\[\]\{\}]*\) {
+ yylloc->first_line = my_lineno;
+ yylloc->first_column=my_col;
+ if ( pbcpop(')') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno+l4, c4, yytext);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ prev_word = 0;
+ return word;
+ }
+ parencount--;
+ if ( parencount >= 0) {
+ yymore();
+ } else {
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=c4;
+ yylval->str = strdup(yytext);
+ *(yylval->str+strlen(yylval->str)-1)=0;
+ /* printf("Got paren word %s\n", yylval->str); */
+ unput(')');
+ my_col=c4;
+ my_lineno += l4;
+ BEGIN(0);
+ return word;
+ }
+ }
+
+<paren>[^()\[\]\{\}]*\( {
+ yylloc->first_line = my_lineno; yylloc->first_column=my_col;
+ parencount++;
+ pbcpush('(');
+ yymore();
+ }
+
<paren>[^()\[\]\{\}]*\[ {yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); }
-<paren>[^()\[\]\{\}]*\] {yylloc->first_line = my_lineno;yylloc->first_column=my_col;
- if ( pbcpop(']') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
- yymore();
- }
+
+<paren>[^()\[\]\{\}]*\] {
+ yylloc->first_line = my_lineno;yylloc->first_column=my_col;
+ if ( pbcpop(']') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+ yymore();
+ }
+
<paren>[^()\[\]\{\}]*\{ {yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('{'); }
-<paren>[^()\[\]\{\}]*\} {yylloc->first_line = my_lineno;
- yylloc->first_column=my_col;
- if ( pbcpop('}') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
- yymore();
- }
-
-
-<argg>[^(),\{\}\[\]]*\) {/* printf("ARGG:%s\n",yytext); */
- int linecount = 0;
- int colcount = my_col;
- char *pt = yytext;
-
- yylloc->first_line = my_lineno;
- yylloc->first_column=my_col;
- if ( pbcpop(')') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
-
-
- while (*pt) {
- if (*pt == '\n') {
- linecount++;
- colcount=0;
- }
- pt++;
- colcount++;
- }
- yylloc->last_line = my_lineno+linecount;
- yylloc->last_column=colcount;
- parencount--;
- if( parencount >= 0){
- yymore();
- } else {
- yylval->str = strdup(yytext);
- if(yyleng > 1 )
- *(yylval->str+yyleng-1)=0;
- /* printf("Got argg word '%s'\n", yylval->str); */
- BEGIN(0);
- if ( !strcmp(yylval->str,")") ) {
- free(yylval->str);
- yylval->str = 0;
- my_col+=1;
- return RP;
- } else {
- unput(')');
- my_col=colcount;
- my_lineno+=linecount;
- return word;
- }
- }
- }
-<argg>[^(),\{\}\[\]]*\( { /* printf("ARGG:%s\n",yytext); */
- /* printf("GOT AN LP!!!\n"); */
- yylloc->first_line = my_lineno;
- yylloc->first_column=my_col;
- parencount++;
- pbcpush('(');
- yymore();
- }
-
-<argg>[^(),\{\}\[\]]*\, { /* printf("ARGG:%s\n",yytext); */
- if( parencount != 0) {
- /* printf("Folding in a comma!\n"); */
- yymore();
- } else {
- /* printf("got a comma!\n\n"); */
- int linecount = 0;
- int colcount = my_col;
- char *pt;
-
- pt = yytext;
- while (*pt) {
- if ( *pt == '\n' ) {
- linecount++;
- colcount=0;
- }
- pt++;
- colcount++;
- }
- yylloc->first_line = my_lineno;
- yylloc->last_line = my_lineno+linecount;
- yylloc->last_column=colcount;
- yylloc->first_column=my_col;
- if( !commaout ) {
- if( !strcmp(yytext,"," ) )
- {commaout = 0; my_col+=1; return COMMA;}
- yylval->str = strdup(yytext); /* printf("Got argg2 word %s\n", yylval->str); */
- unput(',');
- commaout = 1;
- if(yyleng > 1 )
- *(yylval->str+yyleng-1)=0;
- my_lineno+=linecount;
- my_col=colcount;
- return word;
- } else {
- commaout = 0;
- my_col+=1;
- return COMMA;
- }
- }
+
+<paren>[^()\[\]\{\}]*\} {
+ yylloc->first_line = my_lineno;
+ yylloc->first_column=my_col;
+ if ( pbcpop('}') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+ yymore();
+ }
+
+<argg>[^(),\{\}\[\]]*\) {
+ /* printf("ARGG:%s\n",yytext); */
+ int linecount = 0;
+ int colcount = my_col;
+ char *pt = yytext;
+
+ yylloc->first_line = my_lineno;
+ yylloc->first_column=my_col;
+ if ( pbcpop(')') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+
+
+ while (*pt) {
+ if (*pt == '\n') {
+ linecount++;
+ colcount=0;
+ }
+ pt++;
+ colcount++;
+ }
+ yylloc->last_line = my_lineno+linecount;
+ yylloc->last_column=colcount;
+ parencount--;
+ if( parencount >= 0){
+ yymore();
+ } else {
+ yylval->str = strdup(yytext);
+ if(yyleng > 1 )
+ *(yylval->str+yyleng-1)=0;
+ /* printf("Got argg word '%s'\n", yylval->str); */
+ BEGIN(0);
+ if ( !strcmp(yylval->str,")") ) {
+ free(yylval->str);
+ yylval->str = 0;
+ my_col+=1;
+ return RP;
+ } else {
+ unput(')');
+ my_col=colcount;
+ my_lineno+=linecount;
+ return word;
+ }
+ }
+ }
+
+<argg>[^(),\{\}\[\]]*\( {
+ /* printf("ARGG:%s\n",yytext); */
+ /* printf("GOT AN LP!!!\n"); */
+ yylloc->first_line = my_lineno;
+ yylloc->first_column=my_col;
+ parencount++;
+ pbcpush('(');
+ yymore();
+ }
+
+<argg>[^(),\{\}\[\]]*\, {
+ /* printf("ARGG:%s\n",yytext); */
+ if( parencount != 0) {
+ /* printf("Folding in a comma!\n"); */
+ yymore();
+ } else {
+ /* printf("got a comma!\n\n"); */
+ int linecount = 0;
+ int colcount = my_col;
+ char *pt;
+
+ pt = yytext;
+ while (*pt) {
+ if ( *pt == '\n' ) {
+ linecount++;
+ colcount=0;
}
-
-<argg>[^(),\{\}\[\]]*\{ {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; pbcpush('{'); yymore(); }
-<argg>[^(),\{\}\[\]]*\} {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
- if ( pbcpop('}') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=my_col+c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
- yymore();
+ pt++;
+ colcount++;
+ }
+ yylloc->first_line = my_lineno;
+ yylloc->last_line = my_lineno+linecount;
+ yylloc->last_column=colcount;
+ yylloc->first_column=my_col;
+ if( !commaout ) {
+ if( !strcmp(yytext,"," ) ) {
+ commaout = 0;
+ my_col+=1;
+ return COMMA;
}
+ yylval->str = strdup(yytext); /* printf("Got argg2 word %s\n", yylval->str); */
+ unput(',');
+ commaout = 1;
+ if(yyleng > 1 )
+ *(yylval->str+yyleng-1)=0;
+ my_lineno+=linecount;
+ my_col=colcount;
+ return word;
+ } else {
+ commaout = 0;
+ my_col+=1;
+ return COMMA;
+ }
+ }
+ }
+
+<argg>[^(),\{\}\[\]]*\{ {
+ /*printf("ARGG:%s\n",yytext);*/
+ yylloc->first_line = my_lineno;
+ yylloc->first_column=my_col;
+ pbcpush('{'); yymore();
+ }
+
+<argg>[^(),\{\}\[\]]*\} {
+ /*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
+ if ( pbcpop('}') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=my_col+c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+ yymore();
+ }
+
<argg>[^(),\{\}\[\]]*\[ {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); }
-<argg>[^(),\{\}\[\]]*\] {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
- if ( pbcpop(']') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
- yymore();
+
+<argg>[^(),\{\}\[\]]*\] {/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
+ if ( pbcpop(']') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+ yymore();
+ }
+
+<semic>[^;()\{\}\[\]]*\[ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); }
+
+<semic>[^;()\{\}\[\]]*\] {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
+ if ( pbcpop(']') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+ yymore();
+ }
+
+<semic>[^;()\{\}\[\]]*\{ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('{');}
+
+<semic>[^;()\{\}\[\]]*\} {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
+ if ( pbcpop('}') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=my_col+c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+ yymore();
+ }
+
+<semic>[^;()\{\}\[\]]*\( {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('(');}
+
+<semic>[^;()\{\}\[\]]*\) {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
+ if ( pbcpop(')') ) {
+ /* error */
+ int l4,c4;
+ pbcwhere(yytext, &l4, &c4);
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, my_col+c4);
+ BEGIN(0);
+ yylloc->last_line = my_lineno+l4;
+ yylloc->last_column=my_col+c4;
+ my_col=c4;
+ my_lineno += l4;
+ yylval->str = strdup(yytext);
+ return word;
+ }
+ yymore();
+ }
+
+<semic>[^;()\{\}\[\]]*; {
+ int linecount = 0;
+ int colcount = my_col;
+ char *pt = yytext;
+ while (*pt) {
+ if ( *pt == '\n' ) {
+ linecount++;
+ colcount=0;
+ }
+ pt++;
+ colcount++;
+ }
+ yylloc->first_line = my_lineno;
+ yylloc->last_line = my_lineno+linecount;
+ yylloc->last_column=colcount;
+ yylloc->first_column=my_col;
+ yylval->str = strdup(yytext);
+ if(yyleng > 1)
+ *(yylval->str+yyleng-1)=0;
+ /* printf("Got semic word %s\n", yylval->str); */
+ unput(';');
+ BEGIN(0);
+ my_col=colcount;
+ my_lineno += linecount;
+ return word;
+ }
+
+\#include[ \t]+\"[^\"]+\" {
+ FILE *in1;
+ char fnamebuf[1024],*p1,*p2;
+ if ( include_stack_index >= MAX_INCLUDE_DEPTH ) {
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Includes nested too deeply! Wow!!! How did you do that?\n", my_file, my_lineno, my_col);
+ } else {
+ p1 = strchr(yytext,'"');
+ p2 = strrchr(yytext,'"');
+ if ( (int)(p2-p1) > 1023 ) {
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Filename is incredibly way too long (%d chars!). Inclusion ignored!\n", my_file, my_lineno, my_col, yyleng - 10);
+ } else {
+ int i;
+ int found = 0;
+ strncpy(fnamebuf,p1,p2-p1);
+ fnamebuf[p2-p1] = 0;
+ for (i=0; i<include_stack_index; i++) {
+ if ( !strcmp(fnamebuf,include_stack[i].fname )) {
+ ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n",
+ my_file, my_lineno, my_col, fnamebuf);
+ found=1;
+ break;
+ }
}
-
-
-<semic>[^;()\{\}\[\]]*\[ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('['); }
-<semic>[^;()\{\}\[\]]*\] {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
- if ( pbcpop(']') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
- yymore();}
-<semic>[^;()\{\}\[\]]*\{ {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('{');}
-<semic>[^;()\{\}\[\]]*\} {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
- if ( pbcpop('}') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=my_col+c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
- yymore();}
-<semic>[^;()\{\}\[\]]*\( {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; yymore(); pbcpush('(');}
-<semic>[^;()\{\}\[\]]*\) {/*printf("SEMIC:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col;
- if ( pbcpop(')') ) {
- /* error */
- int l4,c4;
- pbcwhere(yytext, &l4, &c4);
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, my_col+c4);
- BEGIN(0);
- yylloc->last_line = my_lineno+l4;
- yylloc->last_column=my_col+c4;
- my_col=c4;
- my_lineno += l4;
- yylval->str = strdup(yytext);
- return word;
- }
- yymore();}
-<semic>[^;()\{\}\[\]]*; {
- int linecount = 0;
- int colcount = my_col;
- char *pt = yytext;
- while (*pt) {
- if ( *pt == '\n' ) {
- linecount++;
- colcount=0;
- }
- pt++;
- colcount++;
- }
- yylloc->first_line = my_lineno;
- yylloc->last_line = my_lineno+linecount;
- yylloc->last_column=colcount;
- yylloc->first_column=my_col;
- yylval->str = strdup(yytext);
- if(yyleng > 1)
- *(yylval->str+yyleng-1)=0;
- /* printf("Got semic word %s\n", yylval->str); */
- unput(';');
- BEGIN(0);
- my_col=colcount;
- my_lineno += linecount;
- return word;
- }
-
-\#include[ \t]+\"[^\"]+\" {
- FILE *in1;
- char fnamebuf[1024],*p1,*p2;
- if ( include_stack_index >= MAX_INCLUDE_DEPTH ) {
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Includes nested too deeply! Wow!!! How did you do that?\n", my_file, my_lineno, my_col);
- } else {
- p1 = strchr(yytext,'"');
- p2 = strrchr(yytext,'"');
- if ( (int)(p2-p1) > 1023 ) {
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Filename is incredibly way too long (%d chars!). Inclusion ignored!\n", my_file, my_lineno, my_col, yyleng - 10);
- } else {
- int i;
- int found = 0;
- strncpy(fnamebuf,p1,p2-p1);
- fnamebuf[p2-p1] = 0;
- for (i=0; i<include_stack_index; i++) {
- if ( !strcmp(fnamebuf,include_stack[i].fname )) {
- ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n",
- my_file, my_lineno, my_col, fnamebuf);
- found=1;
- break;
- }
- }
- if( !found )
- {
- *p2 = 0;
- /* relative vs. absolute */
- if ( *(p1+1) != '/' )
- {
- strcpy(fnamebuf,ast_config_AST_CONFIG_DIR);
- strcat(fnamebuf,"/");
- strcat(fnamebuf,p1+1);
- }
- else
- strcpy(fnamebuf,p1+1);
- in1 = fopen( fnamebuf, "r" );
- if ( ! in1 ) {
+ if ( !found ) {
+ *p2 = 0;
+ /* relative vs. absolute */
+ if ( *(p1+1) != '/' ) {
+ strcpy(fnamebuf,ast_config_AST_CONFIG_DIR);
+ strcat(fnamebuf,"/");
+ strcat(fnamebuf,p1+1);
+ } else
+ strcpy(fnamebuf,p1+1);
+ in1 = fopen( fnamebuf, "r" );
+ if ( ! in1 ) {
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n", my_file, my_lineno, my_col, fnamebuf);
- } else {
+ } else {
char *buffer;
- struct stat stats;
- stat(fnamebuf, &stats);
- buffer = (char*)malloc(stats.st_size+1);
- fread(buffer, 1, stats.st_size, in1);
+ struct stat stats;
+ stat(fnamebuf, &stats);
+ buffer = (char*)malloc(stats.st_size+1);
+ fread(buffer, 1, stats.st_size, in1);
buffer[stats.st_size] = 0;
ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf, (int)stats.st_size);
- fclose(in1);
+ fclose(in1);
include_stack[include_stack_index].fname = my_file;
my_file = strdup(fnamebuf);
@@ -473,30 +504,29 @@
include_stack[include_stack_index].colno = my_col+yyleng;
include_stack[include_stack_index++].bufstate = YY_CURRENT_BUFFER;
- yy_switch_to_buffer(ael_yy_scan_string (buffer ,yyscanner),yyscanner);
- free(buffer);
- my_lineno = 1;
- my_col = 1;
- BEGIN(INITIAL);
- }
- }
- }
- }
- }
-
-<<EOF>> {
- if ( --include_stack_index < 0 ) {
- yyterminate();
- } else {
- free(my_file);
- yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner );
- yy_switch_to_buffer(include_stack[include_stack_index].bufstate, yyscanner );
- my_lineno = include_stack[include_stack_index].lineno;
- my_col = include_stack[include_stack_index].colno;
- my_file = include_stack[include_stack_index].fname;
- }
- }
-
+ yy_switch_to_buffer(ael_yy_scan_string (buffer ,yyscanner),yyscanner);
+ free(buffer);
+ my_lineno = 1;
+ my_col = 1;
+ BEGIN(INITIAL);
+ }
+ }
+ }
+ }
+ }
+
+<<EOF>> {
+ if ( --include_stack_index < 0 ) {
+ yyterminate();
+ } else {
+ free(my_file);
+ yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner );
+ yy_switch_to_buffer(include_stack[include_stack_index].bufstate, yyscanner );
+ my_lineno = include_stack[include_stack_index].lineno;
+ my_col = include_stack[include_stack_index].colno;
+ my_file = include_stack[include_stack_index].fname;
+ }
+ }
%%
@@ -513,25 +543,24 @@
pbcpos--;
return 0;
}
- else
- return 1; /* error */
+ return 1; /* error */
}
static int c_prevword(void)
{
- char *c = prev_word;
+ char *c = prev_word;
int ret = 0;
while ( c && *c ) {
- switch (*c) {
- case '{': pbcpush('{');break;
- case '}': ret = pbcpop('}');break;
- case '[':pbcpush('[');break;
- case ']':ret = pbcpop(']');break;
- case '(':pbcpush('(');break;
- case ')':ret = pbcpop(')'); break;
- }
- if( ret )
- return 1;
+ switch (*c) {
+ case '{': pbcpush('{');break;
+ case '}': ret = pbcpop('}');break;
+ case '[':pbcpush('[');break;
+ case ']':ret = pbcpop(']');break;
+ case '(':pbcpush('(');break;
+ case ')':ret = pbcpop(')'); break;
+ }
+ if( ret )
+ return 1;
c++;
}
return 0;
@@ -540,18 +569,18 @@
static void pbcwhere(char *text, int *line, int *col )
{
int loc_line = 0;
- int loc_col = 0;
+ int loc_col = 0;
while ( *text ) {
- if ( *text == '\n' ) {
- loc_line++;
- loc_col = 1;
- } else {
- loc_col++;
- }
- text++;
- }
+ if ( *text == '\n' ) {
+ loc_line++;
+ loc_col = 1;
+ } else {
+ loc_col++;
+ }
+ text++;
+ }
*line = loc_line;
- *col = loc_col;
+ *col = loc_col;
}
void reset_parencount(yyscan_t yyscanner )
@@ -613,7 +642,7 @@
fread(buffer, 1, stats.st_size, fin);
buffer[stats.st_size]=0;
fclose(fin);
-
+
ael_yy_scan_string (buffer ,io->scanner);
ael_yyset_lineno(1 , io->scanner);
Modified: trunk/pbx/ael/ael_lex.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/ael/ael_lex.c?rev=22571&r1=22570&r2=22571&view=diff
==============================================================================
--- trunk/pbx/ael/ael_lex.c (original)
+++ trunk/pbx/ael/ael_lex.c Wed Apr 26 13:40:09 2006
@@ -654,7 +654,7 @@
/*! \file
*
* \brief Flex scanner description of tokens used in AEL2 .
- *
+ *
*/#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -687,19 +687,18 @@
static void pbcwhere(char *text, int *line, int *col );
static int c_prevword(void);
-struct stackelement
-{
- char *fname;
- int lineno;
- int colno;
- YY_BUFFER_STATE bufstate;
+struct stackelement {
+ char *fname;
+ int lineno;
+ int colno;
+ YY_BUFFER_STATE bufstate;
};
struct stackelement include_stack[MAX_INCLUDE_DEPTH];
int include_stack_index = 0;
/* %option yylineno I've tried hard, but haven't been able to use this */
-#line 703 "ael_lex.c"
+#line 702 "ael_lex.c"
#define INITIAL 0
#define paren 1
@@ -939,9 +938,9 @@
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 77 "ael.flex"
-
-#line 945 "ael_lex.c"
+#line 76 "ael.flex"
+
+#line 944 "ael_lex.c"
yylval = yylval_param;
@@ -1032,661 +1031,681 @@
case 1:
YY_RULE_SETUP
+#line 77 "ael.flex"
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return LC;}
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
#line 78 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return LC;}
- YY_BREAK
-case 2:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return RC;}
+ YY_BREAK
+case 3:
YY_RULE_SETUP
#line 79 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return RC;}
- YY_BREAK
-case 3:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return LP;}
+ YY_BREAK
+case 4:
YY_RULE_SETUP
#line 80 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return LP;}
- YY_BREAK
-case 4:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return RP;}
+ YY_BREAK
+case 5:
YY_RULE_SETUP
#line 81 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return RP;}
- YY_BREAK
-case 5:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return SEMI;}
+ YY_BREAK
+case 6:
YY_RULE_SETUP
#line 82 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return SEMI;}
- YY_BREAK
-case 6:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return EQ;}
+ YY_BREAK
+case 7:
YY_RULE_SETUP
#line 83 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return EQ;}
- YY_BREAK
-case 7:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return COMMA;}
+ YY_BREAK
+case 8:
YY_RULE_SETUP
#line 84 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return COMMA;}
- YY_BREAK
-case 8:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return COLON;}
+ YY_BREAK
+case 9:
YY_RULE_SETUP
#line 85 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return COLON;}
- YY_BREAK
-case 9:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return AMPER;}
+ YY_BREAK
+case 10:
YY_RULE_SETUP
#line 86 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return AMPER;}
- YY_BREAK
-case 10:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return BAR;}
+ YY_BREAK
+case 11:
YY_RULE_SETUP
#line 87 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return BAR;}
- YY_BREAK
-case 11:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return EXTENMARK;}
+ YY_BREAK
+case 12:
YY_RULE_SETUP
#line 88 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return EXTENMARK;}
- YY_BREAK
-case 12:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return AT;}
+ YY_BREAK
+case 13:
YY_RULE_SETUP
#line 89 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return AT;}
- YY_BREAK
-case 13:
+{/*comment*/}
+ YY_BREAK
+case 14:
YY_RULE_SETUP
#line 90 "ael.flex"
-{/*comment*/}
- YY_BREAK
-case 14:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_CONTEXT;}
+ YY_BREAK
+case 15:
YY_RULE_SETUP
#line 91 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_CONTEXT;}
- YY_BREAK
-case 15:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_ABSTRACT;}
+ YY_BREAK
+case 16:
YY_RULE_SETUP
#line 92 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_ABSTRACT;}
- YY_BREAK
-case 16:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_MACRO;};
+ YY_BREAK
+case 17:
YY_RULE_SETUP
#line 93 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_MACRO;};
- YY_BREAK
-case 17:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_GLOBALS;}
+ YY_BREAK
+case 18:
YY_RULE_SETUP
#line 94 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_GLOBALS;}
- YY_BREAK
-case 18:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_IGNOREPAT;}
+ YY_BREAK
+case 19:
YY_RULE_SETUP
#line 95 "ael.flex"
-{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_IGNOREPAT;}
- YY_BREAK
-case 19:
+{yylloc->first_line = yylloc->last_line = my_lineno; yylloc->last_column=my_col+yyleng-1; yylloc->first_column=my_col;my_col+=yyleng;return KW_SWITCH;}
+ YY_BREAK
+case 20:
YY_RULE_SETUP
#line 96 "ael.flex"
[... 1154 lines stripped ...]
More information about the asterisk-commits
mailing list