Changeset 14b6448 in git


Ignore:
Timestamp:
Dec 12, 2000, 12:06:00 PM (22 years ago)
Author:
Anne Frühbis-Krüger <anne@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
Children:
a3abdbc6c5cd89db3e2c383b2b8babb0c3bbedbf
Parents:
de7793b9aaa39c2f00b6e30ee4ad5c82915497aa
Message:
*anne: added category=... and LIB("...") to libparse.l


git-svn-id: file:///usr/local/Singular/svn/trunk@4867 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/libparse.l

    rde7793 r14b6448  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: libparse.l,v 1.42 2000-09-18 09:19:11 obachman Exp $ */
     5/* $Id: libparse.l,v 1.43 2000-12-12 11:06:00 anne Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    2727#define YY_SKIP_YYWRAP
    2828
    29 typedef enum { LP_NONE, LP_INFO, LP_VERSION} lib_cmds;
     29typedef enum { LP_NONE, LP_INFO, LP_CATEGORY, LP_VERSION} lib_cmds;
    3030
    3131int libread(FILE* f, char* buf, int max_size);
     
    5858int texinfo_out = 0;
    5959int found_info=0,
     60    found_cat=0,
    6061    found_version=0,
    6162    found_oldhelp = 0,
     
    243244%x help
    244245%x libcmd
     246%x libcmd2
    245247%x pdef
    246248%x phead
     
    254256%x comment
    255257%x info
     258%x category
    256259%x version
    257260
     
    263266         yyless(4); old_state = YYSTATE; BEGIN(info);
    264267       }
    265 
     268(category+{eqnl}+{quote}+{strings}+{quote}) {
     269         yyless(8); old_state = YYSTATE; BEGIN(category);
     270       }
    266271(version+{eqnl}+{quote}+{strings}+{quote}) {
    267272             found_version++;
     
    392397           }
    393398
     399LIB[ \t]*"(\"" { quote++; brace2++;
     400             BEGIN(libcmd2);
     401           }
     402
    394403<header>({comment}+{tos}+{dolar}+Id:+{string}+[^\n]*)|({comment}+{tos}+{dolar}+Header:+{string}+[^\n]*) {
    395404             make_version(yytext, 0);
     
    412421             yymore();
    413422           }
    414 <header>(info+{eqnl}+{quote})|(version+{eqnl}+{quote}) {
     423<header>(info+{eqnl}+{quote})|(version+{eqnl}+{quote})|(category+{eqnl}+{quote}) {
    415424             yyless(0);
    416425             *lib_style = NEW_LIBSTYLE;
     
    422431             BEGIN(libcmd);
    423432           }
     433<header>^LIB[ \t]+"(\""   { quote++; brace2++;
     434             BEGIN(libcmd2);
     435           }
    424436<header>\n { yylplineno++; }
    425437<header>.  {
     
    441453             BEGIN(INITIAL);
    442454           }
    443 <help>(info+{eqnl}+{quote})|(version+{eqnl}+{quote}) {
     455<help>(info+{eqnl}+{quote})|(version+{eqnl}+{quote})|(category+{eqnl}+{quote}) {
    444456             yyless(0);
    445457             *lib_style = NEW_LIBSTYLE;
     
    456468             BEGIN(libcmd);
    457469           }
     470<help>^LIB[ \t]+"(\""     { quote++; brace2++;
     471             BEGIN(libcmd2);
     472           }
    458473
    459474<help>\n { yylplineno++; }
     
    472487
    473488<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--;
    474502             yytext[yyleng-1] = '\0';
    475503             #ifndef STANDALONE_PARSER
     
    707735<info>.  { }
    708736
     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
    709747<string>"\""             { quote--;
    710748                           #ifdef HAVE_NAMESPACES
     
    858896{
    859897#ifdef STANDALONE_PARSER
    860   if (texinfo_out && last_cmd == LP_INFO)
     898  if (texinfo_out && (last_cmd == LP_INFO || last_cmd == LP_CATEGORY))
    861899  {
    862900    long current_location = ftell(yylpin), i = string_start, quote = 0;
    863901    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    }
    865910    fseek (yylpin, i, SEEK_SET);
    866911    while (i< current_location)
Note: See TracChangeset for help on using the changeset viewer.