line 547 of weave.web @x else if (c=='\'' || c=='"') @@;/*spider*/ @y else if (c=='`') @@;/*spider*/ @z line 608 of weave.web @x @ \cee\ strings and character constants, delimited by double and single quotes, respectively, can contain newlines or instances of their own delimiters if they are protected by a backslash. We follow this convention, but do not allow the string to be longer than |longest_name|. @= {/*spider*/ ASCII delim = c; /* what started the string */ id_first = mod_text+1; id_loc = mod_text; if (delim=='`' && *(loc-2)==at_sign) { /* make string begin with |"@@`"| */ *++id_loc=at_sign; *++id_loc=at_sign; } /* this is hack for ascii constant */ @# /* if it's not a single-character literal, it's a tick mark or an |at_sign| */ if ((delim=='\'' || delim == '`') && (loc+1>=limit || (*loc != '\\' && *loc!=at_sign && loc[1]!='\'') || (*loc=='\\' && (loc+2>=limit||loc[2]!='\'')) || (*loc==at_sign && (loc+2>=limit||loc[1]!=at_sign||loc[2]!='\'')) ) ) goto mistake; *++id_loc=delim; if (delim=='`') delim='\''; /* for |ascii_constant|s */ while (1) { if (loc>=limit) { if(*(limit-1)!='\\') { err_print("! String didn't end"); loc=limit; break; @.String didn't end@> } if(get_line()==0) { err_print("! Input ended in middle of string"); loc=buffer; break; @.Input ended in middle of string@> } } if ((c=*loc++)==delim) { if (++id_loc<=mod_text_end) *id_loc=c; break; } if (c=='\\') if (loc>=limit) continue; else if (++id_loc<=mod_text_end) { *id_loc = '\\'; c=*loc++; } if (++id_loc<=mod_text_end) *id_loc=c; } if (id_loc>=mod_text_end) { printf("\n! String too long: "); @.String too long@> ASCII_write(mod_text+1,25); printf("..."); mark_error; } id_loc++; return(string); } @y @ \cee\ strings are delimited by backquotes and must be restricted to one line. A backquote in strings must be doubled and we allow no string to be longer than |longest_name|. @= {/*spider*/ ASCII delim = c; /* what started the string */ @# id_first = mod_text+1; id_loc = mod_text; *++id_loc=delim; while (1) { if (loc>=limit) { err_print("! String didn't end"); loc=limit; @.String didn't end@> if (get_line()==0) { err_print("! Input ended in middle of string"); loc=buffer; @.Input ended in middle of string@> } break; } if ((c=*loc++)==delim) { if (++id_loc<=mod_text_end) *id_loc=c; if (*loc==delim) loc++; else break; } if (++id_loc<=mod_text_end) *id_loc=c; } if (id_loc>=mod_text_end) { printf("\n! String too long: "); @.String too long@> ASCII_write(mod_text+1,25); printf("..."); mark_error; } id_loc++; return(string); } @z