[svn-commits] trunk r22988 - in /trunk/pbx/ael: ael.flex ael_lex.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Apr 27 13:08:43 MST 2006


Author: rizzo
Date: Thu Apr 27 15:08:42 2006
New Revision: 22988

URL: http://svn.digium.com/view/asterisk?rev=22988&view=rev
Log:
document variable and options used.


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=22988&r1=22987&r2=22988&view=diff
==============================================================================
--- trunk/pbx/ael/ael.flex (original)
+++ trunk/pbx/ael/ael.flex Thu Apr 27 15:08:42 2006
@@ -29,30 +29,51 @@
 #include "ael/ael.tab.h"
 #include "asterisk/ael_structs.h"
 
+/*
+ * A stack to keep track of matching brackets ( [ { } ] )
+ */
 static char pbcstack[400];	/* XXX missing size checks */
 static int pbcpos = 0;
 
 static int parencount = 0;
 static int commaout = 0;
+
+/*
+ * current line, column and filename, updated as we read the input.
+ */
 static int my_lineno = 1;	/* current line in the source */
 static int my_col = 0;		/* current column in the source */
-char *my_file = 0;	/* used also in the bison code */
-char *prev_word;
+char *my_file = 0;		/* used also in the bison code */
+char *prev_word;		/* XXX document it */
+
 #define MAX_INCLUDE_DEPTH 50
 
+/*
+ * flex is not too smart, and generates global functions
+ * without prototypes so the compiler may complain.
+ * To avoid that, we declare the prototypes here,
+ * even though these functions are not used.
+ */
 int ael_yyget_column  (yyscan_t yyscanner);
 void ael_yyset_column (int  column_no , yyscan_t yyscanner);
+
 int ael_yyparse (struct parse_io *);
 static void pbcpush(char x);
 static int pbcpop(char x);
 static void pbcwhere(const char *text, int *line, int *col );
 
+/*
+ * A stack to process include files.
+ * As we switch into the new file we need to store the previous
+ * state to restore it later.
+ */
 struct stackelement {
 	char *fname;
 	int lineno;
 	int colno;
 	YY_BUFFER_STATE bufstate;
 };
+
 static struct stackelement  include_stack[MAX_INCLUDE_DEPTH];
 static int include_stack_index = 0;
 
@@ -82,15 +103,28 @@
 	} while (0)
 %}
 
+/* %x describes the contexts we have: paren, semic and argg, plus INITIAL */
 %x paren semic argg
+
+/* prefix used for various globally-visible functions and variables.
+ * This renames also yywrap, but since we do not use it, we just
+ * add option noyywrap to remove it.
+ */
 %option prefix="ael_yy"
+%option noyywrap
+
+/* option batch gives a bit more performance if we are using it in
+ * a non-interactive mode. We probably don't care much.
+ */
 %option batch
+
+/* filename to be used instead of lex.yy.c */
 %option outfile="ael_lex.c"
+
 %option reentrant
 %option bison-bridge
 %option bison-locations
 /* %option yylineno I've tried hard, but haven't been able to use this */
-%option noyywrap
 
 NOPARENS	[^()\[\]\{\}]*
 

Modified: trunk/pbx/ael/ael_lex.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/ael/ael_lex.c?rev=22988&r1=22987&r2=22988&view=diff
==============================================================================
--- trunk/pbx/ael/ael_lex.c (original)
+++ trunk/pbx/ael/ael_lex.c Thu Apr 27 15:08:42 2006
@@ -658,30 +658,51 @@
 #include "ael/ael.tab.h"
 #include "asterisk/ael_structs.h"
 
+/*
+ * A stack to keep track of matching brackets ( [ { } ] )
+ */
 static char pbcstack[400];	/* XXX missing size checks */
 static int pbcpos = 0;
 
 static int parencount = 0;
 static int commaout = 0;
+
+/*
+ * current line, column and filename, updated as we read the input.
+ */
 static int my_lineno = 1;	/* current line in the source */
 static int my_col = 0;		/* current column in the source */
-char *my_file = 0;	/* used also in the bison code */
-char *prev_word;
+char *my_file = 0;		/* used also in the bison code */
+char *prev_word;		/* XXX document it */
+
 #define MAX_INCLUDE_DEPTH 50
 
+/*
+ * flex is not too smart, and generates global functions
+ * without prototypes so the compiler may complain.
+ * To avoid that, we declare the prototypes here,
+ * even though these functions are not used.
+ */
 int ael_yyget_column  (yyscan_t yyscanner);
 void ael_yyset_column (int  column_no , yyscan_t yyscanner);
+
 int ael_yyparse (struct parse_io *);
 static void pbcpush(char x);
 static int pbcpop(char x);
 static void pbcwhere(const char *text, int *line, int *col );
 
+/*
+ * A stack to process include files.
+ * As we switch into the new file we need to store the previous
+ * state to restore it later.
+ */
 struct stackelement {
 	char *fname;
 	int lineno;
 	int colno;
 	YY_BUFFER_STATE bufstate;
 };
+
 static struct stackelement  include_stack[MAX_INCLUDE_DEPTH];
 static int include_stack_index = 0;
 
@@ -709,9 +730,18 @@
 		yylloc->last_line = my_lineno;		\
 		yylloc->last_column = my_col;		\
 	} while (0)
-
+/* %x describes the contexts we have: paren, semic and argg, plus INITIAL */
+
+/* prefix used for various globally-visible functions and variables.
+ * This renames also ael_yywrap, but since we do not use it, we just
+ * add option noyywrap to remove it.
+ */
+/* option batch gives a bit more performance if we are using it in
+ * a non-interactive mode. We probably don't care much.
+ */
+/* filename to be used instead of lex.yy.c */
 /* %option yylineno I've tried hard, but haven't been able to use this */
-#line 715 "ael_lex.c"
+#line 745 "ael_lex.c"
 
 #define INITIAL 0
 #define paren 1
@@ -951,10 +981,10 @@
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 101 "ael.flex"
-
-
-#line 958 "ael_lex.c"
+#line 135 "ael.flex"
+
+
+#line 988 "ael_lex.c"
 
     yylval = yylval_param;
 
@@ -1045,218 +1075,218 @@
 
 case 1:
 YY_RULE_SETUP
-#line 103 "ael.flex"
+#line 137 "ael.flex"
 { STORE_POS; return LC;}
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 104 "ael.flex"
+#line 138 "ael.flex"
 { STORE_POS; return RC;}
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 105 "ael.flex"
+#line 139 "ael.flex"
 { STORE_POS; return LP;}
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 106 "ael.flex"
+#line 140 "ael.flex"
 { STORE_POS; return RP;}
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 107 "ael.flex"
+#line 141 "ael.flex"
 { STORE_POS; return SEMI;}
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 108 "ael.flex"
+#line 142 "ael.flex"
 { STORE_POS; return EQ;}
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 109 "ael.flex"
+#line 143 "ael.flex"
 { STORE_POS; return COMMA;}
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 110 "ael.flex"
+#line 144 "ael.flex"
 { STORE_POS; return COLON;}
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 111 "ael.flex"
+#line 145 "ael.flex"
 { STORE_POS; return AMPER;}
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 112 "ael.flex"
+#line 146 "ael.flex"
 { STORE_POS; return BAR;}
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 113 "ael.flex"
+#line 147 "ael.flex"
 { STORE_POS; return EXTENMARK;}
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 114 "ael.flex"
+#line 148 "ael.flex"
 { STORE_POS; return AT;}
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 115 "ael.flex"
+#line 149 "ael.flex"
 {/*comment*/}
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 116 "ael.flex"
+#line 150 "ael.flex"
 { STORE_POS; return KW_CONTEXT;}
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 117 "ael.flex"
+#line 151 "ael.flex"
 { STORE_POS; return KW_ABSTRACT;}
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 118 "ael.flex"
+#line 152 "ael.flex"
 { STORE_POS; return KW_MACRO;};
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 119 "ael.flex"
+#line 153 "ael.flex"
 { STORE_POS; return KW_GLOBALS;}
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 120 "ael.flex"
+#line 154 "ael.flex"
 { STORE_POS; return KW_IGNOREPAT;}
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 121 "ael.flex"
+#line 155 "ael.flex"
 { STORE_POS; return KW_SWITCH;}
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 122 "ael.flex"
+#line 156 "ael.flex"
 { STORE_POS; return KW_IF;}
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 123 "ael.flex"
+#line 157 "ael.flex"
 { STORE_POS; return KW_IFTIME;}
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 124 "ael.flex"
+#line 158 "ael.flex"
 { STORE_POS; return KW_RANDOM;}
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 125 "ael.flex"
+#line 159 "ael.flex"
 { STORE_POS; return KW_REGEXTEN;}
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 126 "ael.flex"
+#line 160 "ael.flex"
 { STORE_POS; return KW_HINT;}
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 127 "ael.flex"
+#line 161 "ael.flex"
 { STORE_POS; return KW_ELSE;}
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 128 "ael.flex"
+#line 162 "ael.flex"
 { STORE_POS; return KW_GOTO;}
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 129 "ael.flex"
+#line 163 "ael.flex"
 { STORE_POS; return KW_JUMP;}
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 130 "ael.flex"
+#line 164 "ael.flex"
 { STORE_POS; return KW_RETURN;}
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 131 "ael.flex"
+#line 165 "ael.flex"
 { STORE_POS; return KW_BREAK;}
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 132 "ael.flex"
+#line 166 "ael.flex"
 { STORE_POS; return KW_CONTINUE;}
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 133 "ael.flex"
+#line 167 "ael.flex"
 { STORE_POS; return KW_FOR;}
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 134 "ael.flex"
+#line 168 "ael.flex"
 { STORE_POS; return KW_WHILE;}
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 135 "ael.flex"
+#line 169 "ael.flex"
 { STORE_POS; return KW_CASE;}
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 136 "ael.flex"
+#line 170 "ael.flex"
 { STORE_POS; return KW_DEFAULT;}
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 137 "ael.flex"
+#line 171 "ael.flex"
 { STORE_POS; return KW_PATTERN;}
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 138 "ael.flex"
+#line 172 "ael.flex"
 { STORE_POS; return KW_CATCH;}
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 139 "ael.flex"
+#line 173 "ael.flex"
 { STORE_POS; return KW_SWITCHES;}
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 140 "ael.flex"
+#line 174 "ael.flex"
 { STORE_POS; return KW_ESWITCHES;}
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 141 "ael.flex"
+#line 175 "ael.flex"
 { STORE_POS; return KW_INCLUDES;}
 	YY_BREAK
 case 40:
 /* rule 40 can match eol */
 YY_RULE_SETUP
-#line 143 "ael.flex"
+#line 177 "ael.flex"
 { my_lineno++; my_col = 0; }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 144 "ael.flex"
+#line 178 "ael.flex"
 { my_col += yyleng; }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 145 "ael.flex"
+#line 179 "ael.flex"
 { my_col += 8-(my_col%8); }
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 147 "ael.flex"
+#line 181 "ael.flex"
 {
 		STORE_POS;
 		yylval->str = strdup(yytext);
@@ -1267,7 +1297,7 @@
 case 44:
 /* rule 44 can match eol */
 YY_RULE_SETUP
-#line 157 "ael.flex"
+#line 191 "ael.flex"
 {
 		STORE_START;
 		if ( pbcpop(')') ) {	/* error */
@@ -1295,7 +1325,7 @@
 case 45:
 /* rule 45 can match eol */
 YY_RULE_SETUP
-#line 181 "ael.flex"
+#line 215 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		STORE_START;
@@ -1308,7 +1338,7 @@
 case 46:
 /* rule 46 can match eol */
 YY_RULE_SETUP
-#line 190 "ael.flex"
+#line 224 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		STORE_START;
@@ -1326,7 +1356,7 @@
 case 47:
 /* rule 47 can match eol */
 YY_RULE_SETUP
-#line 204 "ael.flex"
+#line 238 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		STORE_START;
@@ -1339,7 +1369,7 @@
 case 48:
 /* rule 48 can match eol */
 YY_RULE_SETUP
-#line 213 "ael.flex"
+#line 247 "ael.flex"
 {
 		STORE_START;
 		if ( pbcpop(')') ) { /* error */
@@ -1374,7 +1404,7 @@
 case 49:
 /* rule 49 can match eol */
 YY_RULE_SETUP
-#line 244 "ael.flex"
+#line 278 "ael.flex"
 {
 		if( parencount != 0) {
 			/* printf("Folding in a comma!\n"); */
@@ -1406,7 +1436,7 @@
 case 50:
 /* rule 50 can match eol */
 YY_RULE_SETUP
-#line 272 "ael.flex"
+#line 306 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		STORE_START;
@@ -1423,7 +1453,7 @@
 case 51:
 /* rule 51 can match eol */
 YY_RULE_SETUP
-#line 287 "ael.flex"
+#line 321 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		STORE_START;
@@ -1434,7 +1464,7 @@
 case 52:
 /* rule 52 can match eol */
 YY_RULE_SETUP
-#line 294 "ael.flex"
+#line 328 "ael.flex"
 {
 		char c = yytext[yyleng-1];
 		STORE_START;
@@ -1451,7 +1481,7 @@
 case 53:
 /* rule 53 can match eol */
 YY_RULE_SETUP
-#line 307 "ael.flex"
+#line 341 "ael.flex"
 {
 		STORE_START;
 		STORE_END;
@@ -1466,7 +1496,7 @@
 case 54:
 /* rule 54 can match eol */
 YY_RULE_SETUP
-#line 318 "ael.flex"
+#line 352 "ael.flex"
 {
 		FILE *in1;
 		char fnamebuf[1024],*p1,*p2;
@@ -1533,7 +1563,7 @@
 case YY_STATE_EOF(paren):
 case YY_STATE_EOF(semic):
 case YY_STATE_EOF(argg):
-#line 380 "ael.flex"
+#line 414 "ael.flex"
 {
 		if ( --include_stack_index < 0 ) {
 			yyterminate();
@@ -1549,10 +1579,10 @@
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 393 "ael.flex"
+#line 427 "ael.flex"
 ECHO;
 	YY_BREAK
-#line 1556 "ael_lex.c"
+#line 1586 "ael_lex.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -2682,7 +2712,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 393 "ael.flex"
+#line 427 "ael.flex"
 
 
 



More information about the svn-commits mailing list