home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- *
- * S K I P _ S T M T . C
- * ---------------------
- *
- * Description:
- * Skips a C-statement block.
- *
- * Included functions:
- * skip_stmt - Does the job
- *
- * Revision:
- * Ver Date By Reason
- * --- ---- -- ------
- * 1.00 900625 Lars Berntzon Created
- *
- ******************************************************************************/
-
- #include "config.h"
-
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #ifdef STDLIB_H
- #include <stdlib.h>
- #endif
- #ifdef MALLOC_H
- #include <malloc.h>
- #endif
-
- #include "token.h"
- #include "comp.h"
-
- #define isnormal(ch) (isalnum(ch) || (ch) == '_')
-
- skip_stmt()
- {
- char token[TOKENSIZE];
- int nesting;
-
- if (GetTokNC(token) == NULL) {
- error("premature end of file for C-statement");
- return FAIL;
- }
-
- if (strcmp(token, "{") != 0) {
- error("expected '{' for C-statement");
- return FAIL;
- }
-
- for(nesting = 1; nesting != 0;) {
- if(GetTokNC(token) == NULL) {
- error("premature end of file for C-statement");
- return FAIL;
- }
-
- if (strcmp(token, "{") == 0) nesting++;
- else if (strcmp(token, "}") == 0) nesting--;
- }
-
- return OK;
- }
-