Changeset c3776f in git for modules/modgen


Ignore:
Timestamp:
Feb 14, 2000, 10:47:10 PM (24 years ago)
Author:
Kai Krüger <krueger@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
e56e690882b68d43ad8fdea3b2fb6491b114bb09
Parents:
6f9fc9da63f8977922660d8b028df13336cec5b4
Message:
       * scanner.l:
         - fixed linenumbering (example section)
         - extended command within C-definition
         - Added recognition of 'static', and '#'


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

Legend:

Unmodified
Added
Removed
  • modules/modgen/scanner.l

    r6f9fc9 rc3776f  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: scanner.l,v 1.5 2000-01-27 12:40:55 krueger Exp $ */
     5/* $Id: scanner.l,v 1.6 2000-02-14 21:47:10 krueger Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    125125%x SECT3
    126126%x PROCDECL
     127%x EXAMPLE
    127128
    128129%x pdef
     
    259260                  return PROCDECLTOK;
    260261                }
    261         example+{WSNL}+"{" {
     262        example {
    262263                  printf(">>>EXAMPLE\n");
    263                   brace1 = 1; /* { */
     264                  brace1 = 0; /* { */
    264265                  brace2 = 0; /* ( */
    265266                  brace3 = 0; /* [ */
    266                   push_state(YYSTATE, CODEBLOCK2, "CODEBLOCK2");
     267                  push_state(YYSTATE, EXAMPLE, "EXAMPLE");
    267268                  return EXAMPLETOK;
    268269                }
     270        static  { return STATICTOK; }
     271        {NAME}  {
     272                   int i,tok;
     273#if DEBUG > 1
     274                   printf("(%d) VAR: %s\n", yylineno, yytext);
     275#endif
     276                   i = IsCmd(yytext, tok);
     277#if DEBUG > 1
     278                   printf("Res=%d, %d => %s\n", i, tok,
     279                          i ? "VARTYPETOK" : "NAME");
     280#endif
     281                   if(i) {
     282                     lvalp->tp.name = strdup(yytext);
     283                     lvalp->tp.typ = tok;
     284                     push_state(YYSTATE, PROCDECL, "PROCDECL");
     285                     return VARTYPETOK;
     286                   }
     287                   else {
     288                     //do_return++;
     289                     lvalp->name = strdup(yytext);
     290                     push_state(YYSTATE, PROCDECL, "PROCDECL");
     291                     return NAME;
     292                   }
     293                 }
    269294        .       { printf("<<<'%s' ", yytext); }
    270 
    271        }
     295       }
     296
     297<EXAMPLE>{
     298        {NL}    { yylineno++; }
     299        {WS}    /* ignore */
     300        "{"     { brace1++;
     301                  switch_state(YYSTATE, CODEBLOCK2, "CODEBLOCK2");
     302                  return '{';
     303                }
     304        .       { printf("ERROR <<<'%s' ", yytext); }
     305}
    272306
    273307<SECT3>{
     
    321355         ")"     { return ')'; }
    322356         ","     { return ','; }
     357         "#"     { return '#'; }
    323358         "="     { return '='; }
    324359         ";"     { return ';'; }
     
    365400<PROCCMDBLOCK>{
    366401       {col}  { pop_state(); return ';'; }
    367         "("     { return '('; }
    368         ")"     { return ')'; }
    369        {WS}    /* ignore */
     402        "("   { return '('; }
     403        ")"   { return ')'; }
     404        ","   { return ','; }
     405       {WS}   /* ignore */
    370406       {NAME} { lvalp->name = strdup(yytext); return NAME; }
     407       {NL}   { yylineno++; }
     408       "::"   { return MCOLONCOLON; }
    371409       .      { printf("PCB: '%s'\n", yytext); }
    372410       }
Note: See TracChangeset for help on using the changeset viewer.