]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
add some comments to the code
authorLuigi Rizzo <rizzo@icir.org>
Thu, 27 Apr 2006 17:00:09 +0000 (17:00 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Thu, 27 Apr 2006 17:00:09 +0000 (17:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22869 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx/ael/ael.flex
pbx/ael/ael_lex.c

index e56b1b7381c80640e6827f28857430a4d2f60350..faead9bb2c720b1e383f883743c84c9a0f2e4105 100644 (file)
@@ -34,8 +34,8 @@ static int pbcpos = 0;
 
 static int parencount = 0;
 static int commaout = 0;
-static int my_lineno = 1;
-static int my_col = 0;
+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;
 #define MAX_INCLUDE_DEPTH 50
@@ -56,10 +56,17 @@ struct stackelement {
 static struct stackelement  include_stack[MAX_INCLUDE_DEPTH];
 static int include_stack_index = 0;
 
+/*
+ * if we use the @n feature of bison, we must supply the start/end
+ * location of tokens in the structure pointed by yylloc.
+ * Simple tokens are just assumed to be on the same line, so
+ * the line number is constant, and the column is incremented
+ * by the length of the token.
+ */
 #define        STORE_POS do {                                                  \
                yylloc->first_line = yylloc->last_line = my_lineno;     \
-               yylloc->last_column=my_col+yyleng-1;                    \
                yylloc->first_column=my_col;                            \
+               yylloc->last_column=my_col+yyleng-1;                    \
                my_col+=yyleng;                                         \
        } while (0)
 %}
@@ -129,8 +136,6 @@ includes    { STORE_POS; return KW_INCLUDES;}
 [-a-zA-Z0-9'"_/.\<\>\*\+!$#\[\]][-a-zA-Z0-9'"_/.!\*\+\<\>\{\}$#\[\]]*  {
                STORE_POS;
                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;
        }
index b537d5f15a96371d95829262ee06bf577609242e..f87c0cdfeed5f4669be4f1deb285dd9e48ea05e9 100644 (file)
@@ -663,8 +663,8 @@ static int pbcpos = 0;
 
 static int parencount = 0;
 static int commaout = 0;
-static int my_lineno = 1;
-static int my_col = 0;
+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;
 #define MAX_INCLUDE_DEPTH 50
@@ -685,15 +685,22 @@ struct stackelement {
 static struct stackelement  include_stack[MAX_INCLUDE_DEPTH];
 static int include_stack_index = 0;
 
+/*
+ * if we use the @n feature of bison, we must supply the start/end
+ * location of tokens in the structure pointed by yylloc.
+ * Simple tokens are just assumed to be on the same line, so
+ * the line number is constant, and the column is incremented
+ * by the length of the token.
+ */
 #define        STORE_POS do {                                                  \
                yylloc->first_line = yylloc->last_line = my_lineno;     \
-               yylloc->last_column=my_col+yyleng-1;                    \
                yylloc->first_column=my_col;                            \
+               yylloc->last_column=my_col+yyleng-1;                    \
                my_col+=yyleng;                                         \
        } while (0)
 
 /* %option yylineno I've tried hard, but haven't been able to use this */
-#line 697 "ael_lex.c"
+#line 704 "ael_lex.c"
 
 #define INITIAL 0
 #define paren 1
@@ -933,10 +940,10 @@ YY_DECL
        register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 83 "ael.flex"
+#line 90 "ael.flex"
 
 
-#line 940 "ael_lex.c"
+#line 947 "ael_lex.c"
 
     yylval = yylval_param;
 
@@ -1027,223 +1034,221 @@ do_action:    /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 85 "ael.flex"
+#line 92 "ael.flex"
 { STORE_POS; return LC;}
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 86 "ael.flex"
+#line 93 "ael.flex"
 { STORE_POS; return RC;}
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 87 "ael.flex"
+#line 94 "ael.flex"
 { STORE_POS; return LP;}
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 88 "ael.flex"
+#line 95 "ael.flex"
 { STORE_POS; return RP;}
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 89 "ael.flex"
+#line 96 "ael.flex"
 { STORE_POS; return SEMI;}
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 90 "ael.flex"
+#line 97 "ael.flex"
 { STORE_POS; return EQ;}
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 91 "ael.flex"
+#line 98 "ael.flex"
 { STORE_POS; return COMMA;}
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 92 "ael.flex"
+#line 99 "ael.flex"
 { STORE_POS; return COLON;}
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 93 "ael.flex"
+#line 100 "ael.flex"
 { STORE_POS; return AMPER;}
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 94 "ael.flex"
+#line 101 "ael.flex"
 { STORE_POS; return BAR;}
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 95 "ael.flex"
+#line 102 "ael.flex"
 { STORE_POS; return EXTENMARK;}
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 96 "ael.flex"
+#line 103 "ael.flex"
 { STORE_POS; return AT;}
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 97 "ael.flex"
+#line 104 "ael.flex"
 {/*comment*/}
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 98 "ael.flex"
+#line 105 "ael.flex"
 { STORE_POS; return KW_CONTEXT;}
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 99 "ael.flex"
+#line 106 "ael.flex"
 { STORE_POS; return KW_ABSTRACT;}
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 100 "ael.flex"
+#line 107 "ael.flex"
 { STORE_POS; return KW_MACRO;};
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 101 "ael.flex"
+#line 108 "ael.flex"
 { STORE_POS; return KW_GLOBALS;}
        YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 102 "ael.flex"
+#line 109 "ael.flex"
 { STORE_POS; return KW_IGNOREPAT;}
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 103 "ael.flex"
+#line 110 "ael.flex"
 { STORE_POS; return KW_SWITCH;}
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 104 "ael.flex"
+#line 111 "ael.flex"
 { STORE_POS; return KW_IF;}
        YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 105 "ael.flex"
+#line 112 "ael.flex"
 { STORE_POS; return KW_IFTIME;}
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 106 "ael.flex"
+#line 113 "ael.flex"
 { STORE_POS; return KW_RANDOM;}
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 107 "ael.flex"
+#line 114 "ael.flex"
 { STORE_POS; return KW_REGEXTEN;}
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 108 "ael.flex"
+#line 115 "ael.flex"
 { STORE_POS; return KW_HINT;}
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 109 "ael.flex"
+#line 116 "ael.flex"
 { STORE_POS; return KW_ELSE;}
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 110 "ael.flex"
+#line 117 "ael.flex"
 { STORE_POS; return KW_GOTO;}
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 111 "ael.flex"
+#line 118 "ael.flex"
 { STORE_POS; return KW_JUMP;}
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 112 "ael.flex"
+#line 119 "ael.flex"
 { STORE_POS; return KW_RETURN;}
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 113 "ael.flex"
+#line 120 "ael.flex"
 { STORE_POS; return KW_BREAK;}
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 114 "ael.flex"
+#line 121 "ael.flex"
 { STORE_POS; return KW_CONTINUE;}
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 115 "ael.flex"
+#line 122 "ael.flex"
 { STORE_POS; return KW_FOR;}
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 116 "ael.flex"
+#line 123 "ael.flex"
 { STORE_POS; return KW_WHILE;}
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 117 "ael.flex"
+#line 124 "ael.flex"
 { STORE_POS; return KW_CASE;}
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 118 "ael.flex"
+#line 125 "ael.flex"
 { STORE_POS; return KW_DEFAULT;}
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 119 "ael.flex"
+#line 126 "ael.flex"
 { STORE_POS; return KW_PATTERN;}
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 120 "ael.flex"
+#line 127 "ael.flex"
 { STORE_POS; return KW_CATCH;}
        YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 121 "ael.flex"
+#line 128 "ael.flex"
 { STORE_POS; return KW_SWITCHES;}
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 122 "ael.flex"
+#line 129 "ael.flex"
 { STORE_POS; return KW_ESWITCHES;}
        YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 123 "ael.flex"
+#line 130 "ael.flex"
 { STORE_POS; return KW_INCLUDES;}
        YY_BREAK
 case 40:
 /* rule 40 can match eol */
 YY_RULE_SETUP
-#line 125 "ael.flex"
+#line 132 "ael.flex"
 { my_lineno++; my_col = 0; }
        YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 126 "ael.flex"
+#line 133 "ael.flex"
 { my_col += yyleng; }
        YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 127 "ael.flex"
+#line 134 "ael.flex"
 { my_col += 8-(my_col%8); }
        YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 129 "ael.flex"
+#line 136 "ael.flex"
 {
                STORE_POS;
                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;
        }
@@ -1251,7 +1256,7 @@ YY_RULE_SETUP
 case 44:
 /* rule 44 can match eol */
 YY_RULE_SETUP
-#line 141 "ael.flex"
+#line 146 "ael.flex"
 {
                yylloc->first_line = my_lineno;
                yylloc->first_column=my_col;
@@ -1284,7 +1289,7 @@ YY_RULE_SETUP
 case 45:
 /* rule 45 can match eol */
 YY_RULE_SETUP
-#line 170 "ael.flex"
+#line 175 "ael.flex"
 {
                char c = yytext[yyleng-1];
                yylloc->first_line = my_lineno;
@@ -1298,7 +1303,7 @@ YY_RULE_SETUP
 case 46:
 /* rule 46 can match eol */
 YY_RULE_SETUP
-#line 180 "ael.flex"
+#line 185 "ael.flex"
 {
                char c = yytext[yyleng-1];
                yylloc->first_line = my_lineno;
@@ -1319,7 +1324,7 @@ YY_RULE_SETUP
 case 47:
 /* rule 47 can match eol */
 YY_RULE_SETUP
-#line 197 "ael.flex"
+#line 202 "ael.flex"
 {
                char c = yytext[yyleng-1];
                /* printf("ARGG:%s\n",yytext); */
@@ -1335,7 +1340,7 @@ YY_RULE_SETUP
 case 48:
 /* rule 48 can match eol */
 YY_RULE_SETUP
-#line 209 "ael.flex"
+#line 214 "ael.flex"
 {
                /* printf("ARGG:%s\n",yytext); */
                yylloc->first_line = my_lineno;
@@ -1377,7 +1382,7 @@ YY_RULE_SETUP
 case 49:
 /* rule 49 can match eol */
 YY_RULE_SETUP
-#line 247 "ael.flex"
+#line 252 "ael.flex"
 {
                /* printf("ARGG:%s\n",yytext); */
                if( parencount != 0) {
@@ -1414,7 +1419,7 @@ YY_RULE_SETUP
 case 50:
 /* rule 50 can match eol */
 YY_RULE_SETUP
-#line 280 "ael.flex"
+#line 285 "ael.flex"
 {
                char c = yytext[yyleng-1];
                /*printf("ARGG:%s\n",yytext);*/
@@ -1435,7 +1440,7 @@ YY_RULE_SETUP
 case 51:
 /* rule 51 can match eol */
 YY_RULE_SETUP
-#line 299 "ael.flex"
+#line 304 "ael.flex"
 {
                char c = yytext[yyleng-1];
                /*printf("SEMIC:%s\n",yytext);*/
@@ -1448,7 +1453,7 @@ YY_RULE_SETUP
 case 52:
 /* rule 52 can match eol */
 YY_RULE_SETUP
-#line 308 "ael.flex"
+#line 313 "ael.flex"
 {
                char c = yytext[yyleng-1];
                /*printf("SEMIC:%s\n",yytext);*/
@@ -1469,7 +1474,7 @@ YY_RULE_SETUP
 case 53:
 /* rule 53 can match eol */
 YY_RULE_SETUP
-#line 325 "ael.flex"
+#line 330 "ael.flex"
 {
                yylloc->first_line = my_lineno;
                yylloc->first_column=my_col;
@@ -1488,7 +1493,7 @@ YY_RULE_SETUP
 case 54:
 /* rule 54 can match eol */
 YY_RULE_SETUP
-#line 340 "ael.flex"
+#line 345 "ael.flex"
 {
                FILE *in1;
                char fnamebuf[1024],*p1,*p2;
@@ -1555,7 +1560,7 @@ case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(paren):
 case YY_STATE_EOF(semic):
 case YY_STATE_EOF(argg):
-#line 402 "ael.flex"
+#line 407 "ael.flex"
 {
                if ( --include_stack_index < 0 ) {
                        yyterminate();
@@ -1571,10 +1576,10 @@ case YY_STATE_EOF(argg):
        YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 415 "ael.flex"
+#line 420 "ael.flex"
 ECHO;
        YY_BREAK
-#line 1578 "ael_lex.c"
+#line 1583 "ael_lex.c"
 
        case YY_END_OF_BUFFER:
                {
@@ -2704,7 +2709,7 @@ void ael_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 415 "ael.flex"
+#line 420 "ael.flex"