changeset 1020 | 36fb9443b6ea |
parent 1016 | 91bef6704b44 |
child 1031 | ce026aee03e0 |
1019:1e3cefbbdee2 | 1020:36fb9443b6ea |
---|---|
1170 } |
1170 } |
1171 |
1171 |
1172 |
1172 |
1173 /* body_state -> (il_state | st_state | sfc_state) */ |
1173 /* body_state -> (il_state | st_state | sfc_state) */ |
1174 <body_state>{ |
1174 <body_state>{ |
1175 {st_whitespace} {/* In body state we do not process any tokens, |
|
1176 * we simply store them for later processing! |
|
1177 * NOTE: all whitespace in the begining |
|
1178 * of body_state must be removed so we can |
|
1179 * detect ':=' in the beginning of TRANSACTION |
|
1180 * conditions preceded by whitespace. |
|
1181 * => only add to bodystate_buffer when not in beginning. |
|
1182 */ |
|
1183 if (!isempty_bodystate_buffer()) |
|
1184 append_bodystate_buffer(yytext); |
|
1185 } |
|
1175 /* 'INITIAL_STEP' always used in beginning of SFCs !! */ |
1186 /* 'INITIAL_STEP' always used in beginning of SFCs !! */ |
1176 INITIAL_STEP { if (isempty_bodystate_buffer()) {unput_text(0); BEGIN(sfc_state);} |
1187 INITIAL_STEP { if (isempty_bodystate_buffer()) {unput_text(0); BEGIN(sfc_state);} |
1177 else {append_bodystate_buffer(yytext);} |
1188 else {append_bodystate_buffer(yytext);} |
1178 } |
1189 } |
1179 |
1190 |
1232 /* NOTE: pragmas are handled right at the beginning... */ |
1243 /* NOTE: pragmas are handled right at the beginning... */ |
1233 |
1244 |
1234 /* The whitespace */ |
1245 /* The whitespace */ |
1235 <INITIAL,header_state,config_state,vardecl_list_state,vardecl_state,st_state,sfc_state,task_init_state,sfc_qualifier_state>{st_whitespace} /* Eat any whitespace */ |
1246 <INITIAL,header_state,config_state,vardecl_list_state,vardecl_state,st_state,sfc_state,task_init_state,sfc_qualifier_state>{st_whitespace} /* Eat any whitespace */ |
1236 <il_state>{il_whitespace} /* Eat any whitespace */ |
1247 <il_state>{il_whitespace} /* Eat any whitespace */ |
1237 <body_state>{st_whitespace} append_bodystate_buffer(yytext); /* in body state we do not process any tokens, we simply store them for later processing! */ |
1248 /* NOTE: Due to the need of having the following rule have higher priority, |
1249 * the following rule was moved to an earlier position in this file. |
|
1250 <body_state>{st_whitespace} {...} |
|
1251 */ |
|
1238 |
1252 |
1239 /* The comments */ |
1253 /* The comments */ |
1240 <get_pou_name_state,ignore_pou_state,body_state,vardecl_list_state>{comment_beg} yy_push_state(comment_state); |
1254 <get_pou_name_state,ignore_pou_state,body_state,vardecl_list_state>{comment_beg} yy_push_state(comment_state); |
1241 {comment_beg} yy_push_state(comment_state); |
1255 {comment_beg} yy_push_state(comment_state); |
1242 <comment_state>{ |
1256 <comment_state>{ |
2070 /* The buffer used by the body_state state */ |
2084 /* The buffer used by the body_state state */ |
2071 char *bodystate_buffer = NULL; |
2085 char *bodystate_buffer = NULL; |
2072 |
2086 |
2073 /* append text to bodystate_buffer */ |
2087 /* append text to bodystate_buffer */ |
2074 void append_bodystate_buffer(const char *text) { |
2088 void append_bodystate_buffer(const char *text) { |
2075 //printf("<<<append_bodystate_buffer>>> %d <%s><%s>\n", bodystate_buffer, (NULL != bodystate_buffer)?bodystate_buffer:"NULL", text); |
2089 //printf("<<<append_bodystate_buffer>>> %d <%s><%s>\n", bodystate_buffer, text, (NULL != bodystate_buffer)?bodystate_buffer:"NULL"); |
2076 long int old_len = 0; |
2090 long int old_len = 0; |
2077 if (NULL != bodystate_buffer) old_len = strlen(bodystate_buffer); |
2091 if (NULL != bodystate_buffer) old_len = strlen(bodystate_buffer); |
2078 bodystate_buffer = (char *)realloc(bodystate_buffer, old_len + strlen(text) + 1); |
2092 bodystate_buffer = (char *)realloc(bodystate_buffer, old_len + strlen(text) + 1); |
2079 if (NULL == bodystate_buffer) ERROR; |
2093 if (NULL == bodystate_buffer) ERROR; |
2080 strcpy(bodystate_buffer + old_len, text); |
2094 strcpy(bodystate_buffer + old_len, text); |