interp_parse.c (39441) | interp_parse.c (42465) |
---|---|
1/* 2 * Redistribution and use in source and binary forms, with or without 3 * modification, are permitted provided that the following conditions 4 * are met: 5 * 1. Redistributions of source code must retain the above copyright 6 * notice, this list of conditions and the following disclaimer. 7 * 2. Redistributions in binary form must reproduce the above copyright 8 * notice, this list of conditions and the following disclaimer in the 9 * documentation and/or other materials provided with the distribution. 10 * 11 * Jordan K. Hubbard 12 * 29 August 1998 13 * | 1/* 2 * Redistribution and use in source and binary forms, with or without 3 * modification, are permitted provided that the following conditions 4 * are met: 5 * 1. Redistributions of source code must retain the above copyright 6 * notice, this list of conditions and the following disclaimer. 7 * 2. Redistributions in binary form must reproduce the above copyright 8 * notice, this list of conditions and the following disclaimer in the 9 * documentation and/or other materials provided with the distribution. 10 * 11 * Jordan K. Hubbard 12 * 29 August 1998 13 * |
14 * $Id: interp_parse.c,v 1.3 1998/09/04 02:43:26 msmith Exp $ | 14 * $Id: interp_parse.c,v 1.4 1998/09/17 23:52:02 msmith Exp $ |
15 * 16 * The meat of the simple parser. 17 */ 18 19#include <stand.h> 20#include <string.h> 21 22/* Forward decls */ --- 72 unchanged lines hidden (view full) --- 95 state = STR; 96 buf = (char *)malloc(PARSE_BUFSIZE); 97 token = 0; 98 99 /* And awaaaaaaaaay we go! */ 100 while (*p) { 101 switch (state) { 102 case STR: | 15 * 16 * The meat of the simple parser. 17 */ 18 19#include <stand.h> 20#include <string.h> 21 22/* Forward decls */ --- 72 unchanged lines hidden (view full) --- 95 state = STR; 96 buf = (char *)malloc(PARSE_BUFSIZE); 97 token = 0; 98 99 /* And awaaaaaaaaay we go! */ 100 while (*p) { 101 switch (state) { 102 case STR: |
103 if (isquote(*p)) { | 103 if ((*p == '\\') && p[1]) { 104 p++; 105 PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); 106 buf[i] = *p++; 107 } else if (isquote(*p)) { |
104 quote = quote ? 0 : *p; 105 ++p; 106 } 107 else if (isspace(*p) && !quote) { 108 state = WHITE; 109 if (i) { 110 buf[i] = '\0'; 111 PARSE_FAIL(insert(&ac, buf)); --- 89 unchanged lines hidden --- | 108 quote = quote ? 0 : *p; 109 ++p; 110 } 111 else if (isspace(*p) && !quote) { 112 state = WHITE; 113 if (i) { 114 buf[i] = '\0'; 115 PARSE_FAIL(insert(&ac, buf)); --- 89 unchanged lines hidden --- |