Changeset 14b6448 in git
- Timestamp:
- Dec 12, 2000, 12:06:00 PM (22 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
- Children:
- a3abdbc6c5cd89db3e2c383b2b8babb0c3bbedbf
- Parents:
- de7793b9aaa39c2f00b6e30ee4ad5c82915497aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/libparse.l
rde7793 r14b6448 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 /* $Id: libparse.l,v 1.4 2 2000-09-18 09:19:11 obachmanExp $ */5 /* $Id: libparse.l,v 1.43 2000-12-12 11:06:00 anne Exp $ */ 6 6 #include <stdio.h> 7 7 #include <string.h> … … 27 27 #define YY_SKIP_YYWRAP 28 28 29 typedef enum { LP_NONE, LP_INFO, LP_ VERSION} lib_cmds;29 typedef enum { LP_NONE, LP_INFO, LP_CATEGORY, LP_VERSION} lib_cmds; 30 30 31 31 int libread(FILE* f, char* buf, int max_size); … … 58 58 int texinfo_out = 0; 59 59 int found_info=0, 60 found_cat=0, 60 61 found_version=0, 61 62 found_oldhelp = 0, … … 243 244 %x help 244 245 %x libcmd 246 %x libcmd2 245 247 %x pdef 246 248 %x phead … … 254 256 %x comment 255 257 %x info 258 %x category 256 259 %x version 257 260 … … 263 266 yyless(4); old_state = YYSTATE; BEGIN(info); 264 267 } 265 268 (category+{eqnl}+{quote}+{strings}+{quote}) { 269 yyless(8); old_state = YYSTATE; BEGIN(category); 270 } 266 271 (version+{eqnl}+{quote}+{strings}+{quote}) { 267 272 found_version++; … … 392 397 } 393 398 399 LIB[ \t]*"(\"" { quote++; brace2++; 400 BEGIN(libcmd2); 401 } 402 394 403 <header>({comment}+{tos}+{dolar}+Id:+{string}+[^\n]*)|({comment}+{tos}+{dolar}+Header:+{string}+[^\n]*) { 395 404 make_version(yytext, 0); … … 412 421 yymore(); 413 422 } 414 <header>(info+{eqnl}+{quote})|(version+{eqnl}+{quote}) {423 <header>(info+{eqnl}+{quote})|(version+{eqnl}+{quote})|(category+{eqnl}+{quote}) { 415 424 yyless(0); 416 425 *lib_style = NEW_LIBSTYLE; … … 422 431 BEGIN(libcmd); 423 432 } 433 <header>^LIB[ \t]+"(\"" { quote++; brace2++; 434 BEGIN(libcmd2); 435 } 424 436 <header>\n { yylplineno++; } 425 437 <header>. { … … 441 453 BEGIN(INITIAL); 442 454 } 443 <help>(info+{eqnl}+{quote})|(version+{eqnl}+{quote}) {455 <help>(info+{eqnl}+{quote})|(version+{eqnl}+{quote})|(category+{eqnl}+{quote}) { 444 456 yyless(0); 445 457 *lib_style = NEW_LIBSTYLE; … … 456 468 BEGIN(libcmd); 457 469 } 470 <help>^LIB[ \t]+"(\"" { quote++; brace2++; 471 BEGIN(libcmd2); 472 } 458 473 459 474 <help>\n { yylplineno++; } … … 472 487 473 488 <libcmd>{string}"\"" { quote--; 489 yytext[yyleng-1] = '\0'; 490 #ifndef STANDALONE_PARSER 491 if ( mode == LOAD_LIB ) 492 { 493 library_stack->push(newlib, yytext); 494 } 495 #endif /* STANDALONE_PARSER */ 496 #if YYLPDEBUG 497 if(lpverbose>1) printf("LIB:'%s'\n", yytext); 498 #endif 499 BEGIN(INITIAL); 500 } 501 <libcmd2>{string}"\")" { quote--; brace2--; 474 502 yytext[yyleng-1] = '\0'; 475 503 #ifndef STANDALONE_PARSER … … 707 735 <info>. { } 708 736 737 <category>{quote} { 738 quote++; BEGIN(string); 739 found_cat++; 740 string_start = current_pos(yyleng); 741 *lib_style = NEW_LIBSTYLE; 742 last_cmd = LP_CATEGORY; 743 } 744 <category>\n { yylplineno++; } 745 <category>. { } 746 709 747 <string>"\"" { quote--; 710 748 #ifdef HAVE_NAMESPACES … … 858 896 { 859 897 #ifdef STANDALONE_PARSER 860 if (texinfo_out && last_cmd == LP_INFO)898 if (texinfo_out && (last_cmd == LP_INFO || last_cmd == LP_CATEGORY)) 861 899 { 862 900 long current_location = ftell(yylpin), i = string_start, quote = 0; 863 901 char c; 864 printf("$info = <<EOT;\n"); 902 if (last_cmd == LP_INFO) 903 { 904 printf("$info = <<EOT;\n"); 905 } 906 else 907 { 908 printf("$category = <<EOT;\n"); 909 } 865 910 fseek (yylpin, i, SEEK_SET); 866 911 while (i< current_location)
Note: See TracChangeset
for help on using the changeset viewer.