"Fossies" - the Fresh Open Source Software Archive

Member "erltools/pub/parser/toksearc.cc" (15 May 2006, 13688 Bytes) of package /linux/misc/old/erltools-4.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "toksearc.cc" see the Fossies "Dox" file reference documentation.

    1 
    2 #line 28 "toksearc.ch"
    3 /*************************************************************************/
    4 #line 28 "toksearc.ch"
    5 /*                                                                       */
    6 #line 28 "toksearc.ch"
    7 /*        Produced by Metachop version 2.0  -    1989-1995               */
    8 #line 28 "toksearc.ch"
    9 /*     Tree      Meta     Chopper      developped    by                  */
   10 #line 28 "toksearc.ch"
   11 /*                  Eric Lavillonniere                                   */
   12 #line 28 "toksearc.ch"
   13 /*                                                                       */
   14 #line 28 "toksearc.ch"
   15 /*************************************************************************/
   16 #line 28 "toksearc.ch"
   17 #line 28 "toksearc.ch"
   18 #include "token.h"
   19 #line 28 "toksearc.ch"
   20 #define decomp decomp_metalang
   21 #line 28 "toksearc.ch"
   22 #line 28 "toksearc.ch"
   23 #ifndef for_elem
   24 #line 28 "toksearc.ch"
   25 #line 28 "toksearc.ch"
   26 #define for_elem _for_elem
   27 #line 28 "toksearc.ch"
   28 #endif
   29 #ifdef INCONNU
   30 #line 28 "toksearc.ch"
   31 #line 28 "toksearc.ch"
   32 PTREE   for_elem ;
   33 #line 28 "toksearc.ch"
   34 #line 28 "toksearc.ch"
   35 #endif
   36 #include "metalang.h"
   37 
   38 extern PPTREE   treeToken ;
   39 static PTREE    listLex = (PTREE)0 ;
   40 #line 28 "toksearc.ch"
   41 static int  nbLex = 1 ;
   42 
   43 #line 47 "toksearc.ch"
   44 #line 47 "toksearc.ch"
   45 int LexNumber ( PTREE tree )
   46 #line 47 "toksearc.ch"
   47 {
   48 #line 47 "toksearc.ch"
   49     register PPTREE _inter ;
   50 #line 47 "toksearc.ch"
   51 #line 47 "toksearc.ch"
   52 #line 47 "toksearc.ch"
   53     int _nextVal ;
   54 #line 47 "toksearc.ch"
   55 #line 50 "toksearc.ch"
   56     PTREE   lexNumb ;
   57 #line 50 "toksearc.ch"
   58 #line 50 "toksearc.ch"
   59 #line 51 "toksearc.ch"
   60     char    string [10];
   61 #line 51 "toksearc.ch"
   62 #line 53 "toksearc.ch"
   63     if ( (lexNumb=ListFind(listLex, tree)) ) {
   64 #line 53 "toksearc.ch"
   65 #line 57 "toksearc.ch"
   66                                                     ((_inter = (PPTREE)lexNumb,1) && 
   67 #line 57 "toksearc.ch"
   68                                                         ((lexNumb=SonTree(_inter,2)),1) &&
   69 #line 57 "toksearc.ch"
   70                                                         1);
   71 #line 57 "toksearc.ch"
   72                                                     ;
   73 #line 57 "toksearc.ch"
   74 #line 58 "toksearc.ch"
   75                                                     return atoi(Value(lexNumb));
   76 #line 58 "toksearc.ch"
   77 #line 59 "toksearc.ch"
   78 #line 59 "toksearc.ch"
   79 #line 59 "toksearc.ch"
   80                                                  } else 
   81 #line 59 "toksearc.ch"
   82     {
   83 #line 59 "toksearc.ch"
   84 #line 62 "toksearc.ch"
   85         sprintf(string, "%d", nbLex);
   86 #line 62 "toksearc.ch"
   87 #line 63 "toksearc.ch"
   88         {
   89 #line 63 "toksearc.ch"
   90             PPTREE _ptTree0= (PPTREE) 0,_ptRes0= (PPTREE) 0;
   91 #line 63 "toksearc.ch"
   92             _ptRes0 = MakeTree(LIST, 2);
   93 #line 63 "toksearc.ch"
   94             {
   95 #line 63 "toksearc.ch"
   96                 PPTREE _ptTree1= (PPTREE) 0,_ptRes1= (PPTREE) 0;
   97 #line 63 "toksearc.ch"
   98                 _ptRes1 = MakeTree(LIST, 2);
   99 #line 63 "toksearc.ch"
  100                 _ptTree1 = StoreRef(MakeString(Value(tree)));
  101 #line 63 "toksearc.ch"
  102                 ReplaceTree(_ptRes1, 1, _ptTree1);
  103 #line 63 "toksearc.ch"
  104                 _ptTree1 = StoreRef(MakeString(string));
  105 #line 63 "toksearc.ch"
  106                 ReplaceTree(_ptRes1, 2, _ptTree1);
  107 #line 63 "toksearc.ch"
  108                 _ptTree0 = _ptRes1;
  109 #line 63 "toksearc.ch"
  110             }
  111 #line 63 "toksearc.ch"
  112             ReplaceTree(_ptRes0, 1, _ptTree0);
  113 #line 63 "toksearc.ch"
  114             ReplaceTree(_ptRes0, 2, listLex);
  115 #line 63 "toksearc.ch"
  116             listLex = _ptRes0;
  117 #line 63 "toksearc.ch"
  118         }
  119 #line 63 "toksearc.ch"
  120 #line 63 "toksearc.ch"
  121 #line 66 "toksearc.ch"
  122         return nbLex++ ;
  123 #line 66 "toksearc.ch"
  124 #line 67 "toksearc.ch"
  125 #line 67 "toksearc.ch"
  126 #line 67 "toksearc.ch"
  127     }
  128 #line 67 "toksearc.ch"
  129 #line 68 "toksearc.ch"
  130 #line 68 "toksearc.ch"
  131 #line 68 "toksearc.ch"
  132 }
  133 #line 68 "toksearc.ch"
  134 
  135 #line 72 "toksearc.ch"
  136 #line 72 "toksearc.ch"
  137 void SearchLexToken ( PTREE tree )
  138 #line 72 "toksearc.ch"
  139 {
  140 #line 72 "toksearc.ch"
  141 #line 72 "toksearc.ch"
  142     int _nextVal ;
  143 #line 72 "toksearc.ch"
  144 #line 76 "toksearc.ch"
  145     PTREE   ptTree = (PTREE)0 ;
  146 #line 76 "toksearc.ch"
  147 #line 76 "toksearc.ch"
  148 #line 77 "toksearc.ch"
  149     PTREE   lexNumb ;
  150 #line 77 "toksearc.ch"
  151 #line 77 "toksearc.ch"
  152 #line 76 "toksearc.ch"
  153     (ptTree=tree);
  154 #line 76 "toksearc.ch"
  155 #line 76 "toksearc.ch"
  156 #line 80 "toksearc.ch"
  157     FreeDescriptList();
  158 #line 80 "toksearc.ch"
  159 #line 81 "toksearc.ch"
  160     while ( ptTree ) {
  161 #line 81 "toksearc.ch"
  162 #line 82 "toksearc.ch"
  163                         if ( ptTree && numbertree(SonTree(ptTree, 1)) == LEXDEFINE_metalang ) {
  164 #line 82 "toksearc.ch"
  165 #line 83 "toksearc.ch"
  166 SearchToken(sontree(ptTree, 1), LexNumber(ptTree));
  167 #line 83 "toksearc.ch"
  168 #line 84 "toksearc.ch"
  169 #line 84 "toksearc.ch"
  170 #line 84 "toksearc.ch"
  171                                                                                                     }
  172 #line 84 "toksearc.ch"
  173 #line 85 "toksearc.ch"
  174                         (ptTree=sontree(ptTree, 2));
  175 #line 85 "toksearc.ch"
  176 #line 85 "toksearc.ch"
  177 #line 86 "toksearc.ch"
  178 #line 86 "toksearc.ch"
  179 #line 86 "toksearc.ch"
  180                       }
  181 #line 86 "toksearc.ch"
  182 #line 87 "toksearc.ch"
  183 #line 87 "toksearc.ch"
  184 #line 87 "toksearc.ch"
  185 }
  186 #line 87 "toksearc.ch"
  187 
  188 #line 89 "toksearc.ch"
  189 
  190 #line 89 "toksearc.ch"
  191 void SearchToken ( PTREE tree, int numb )
  192 #line 89 "toksearc.ch"
  193 {
  194 #line 89 "toksearc.ch"
  195     register PPTREE _inter ;
  196 #line 89 "toksearc.ch"
  197 #line 89 "toksearc.ch"
  198 #line 89 "toksearc.ch"
  199     int _nextVal ;
  200 #line 89 "toksearc.ch"
  201 #line 94 "toksearc.ch"
  202     PTREE   val, list ;
  203 #line 94 "toksearc.ch"
  204 #line 94 "toksearc.ch"
  205 #line 95 "toksearc.ch"
  206     char    *theValue ;
  207 #line 95 "toksearc.ch"
  208 #line 96 "toksearc.ch"
  209     int i ;
  210 #line 96 "toksearc.ch"
  211 #line 99 "toksearc.ch"
  212     {
  213 #line 99 "toksearc.ch"
  214 #line 99 "toksearc.ch"
  215         ItPtree _iterator1 (tree, (PPTREE) 0) ;
  216 #line 99 "toksearc.ch"
  217 #line 99 "toksearc.ch"
  218         PPTREE  _for_elem ;
  219 #line 99 "toksearc.ch"
  220 #line 99 "toksearc.ch"
  221         _iterator1.AllSearch(1);
  222 #line 99 "toksearc.ch"
  223 #line 99 "toksearc.ch"
  224         while ( _for_elem = _iterator1++ ) {
  225 #line 99 "toksearc.ch"
  226 #line 99 "toksearc.ch"
  227             {
  228 #line 99 "toksearc.ch"
  229 #line 100 "toksearc.ch"
  230                 switch ( NumberTree(for_elem) ) {
  231 #line 100 "toksearc.ch"
  232 #line 102 "toksearc.ch"
  233                     case metalang::RETURN : 
  234 #line 102 "toksearc.ch"
  235 #line 102 "toksearc.ch"
  236                         (val=SonTree(for_elem, 1));
  237 #line 102 "toksearc.ch"
  238 #line 102 "toksearc.ch"
  239 #line 102 "toksearc.ch"
  240                     _Case8 : 
  241 #line 102 "toksearc.ch"
  242 #line 102 "toksearc.ch"
  243                         ;
  244 #line 102 "toksearc.ch"
  245 #line 102 "toksearc.ch"
  246                     INSERT_VAL : 
  247 #line 102 "toksearc.ch"
  248 #line 103 "toksearc.ch"
  249                         switch ( NumberTree(val) ) {
  250 #line 103 "toksearc.ch"
  251 #line 105 "toksearc.ch"
  252                             case metalang::TOKEN : 
  253 #line 105 "toksearc.ch"
  254 #line 105 "toksearc.ch"
  255                             _Case12 : 
  256 #line 105 "toksearc.ch"
  257 #line 105 "toksearc.ch"
  258                                 ;
  259 #line 105 "toksearc.ch"
  260 #line 105 "toksearc.ch"
  261                                 theValue = AddKey(BrainyValue(val));
  262 #line 105 "toksearc.ch"
  263 #line 106 "toksearc.ch"
  264                                 i = AddConst(theValue);
  265 #line 106 "toksearc.ch"
  266 #line 107 "toksearc.ch"
  267                                 InsertDescript(i, theValue, numb, sontree(tree, 1));
  268 #line 107 "toksearc.ch"
  269 #line 108 "toksearc.ch"
  270                                 break ;
  271 #line 108 "toksearc.ch"
  272 #line 110 "toksearc.ch"
  273                             case metalang::EXCLA : 
  274 #line 110 "toksearc.ch"
  275 #line 110 "toksearc.ch"
  276                             _Case13 : 
  277 #line 110 "toksearc.ch"
  278 #line 110 "toksearc.ch"
  279                                 ;
  280 #line 110 "toksearc.ch"
  281 #line 110 "toksearc.ch"
  282                                 i = AddConst(SymboName(BrainyValue(val), 0));
  283 #line 110 "toksearc.ch"
  284 #line 111 "toksearc.ch"
  285                                 InsertDescript(i, SymboName(BrainyValue(val), 0), numb, sontree(tree, 1));
  286 #line 111 "toksearc.ch"
  287 #line 113 "toksearc.ch"
  288                                 break ;
  289 #line 113 "toksearc.ch"
  290 #line 115 "toksearc.ch"
  291                             case metalang::STRING : 
  292 #line 115 "toksearc.ch"
  293 #line 115 "toksearc.ch"
  294                             _Case14 : 
  295 #line 115 "toksearc.ch"
  296 #line 115 "toksearc.ch"
  297                                 ;
  298 #line 115 "toksearc.ch"
  299 #line 115 "toksearc.ch"
  300                                 treeToken = AddToken(BrainyValue(val), SymboName(BrainyValue(val), 0), treeToken);
  301 #line 115 "toksearc.ch"
  302 #line 118 "toksearc.ch"
  303                                 i = AddConst(SymboName(BrainyValue(val), 0));
  304 #line 118 "toksearc.ch"
  305 #line 119 "toksearc.ch"
  306                                 InsertDescript(i, SymboName(BrainyValue(val), 0), numb, sontree(tree, 1));
  307 #line 119 "toksearc.ch"
  308 #line 121 "toksearc.ch"
  309                                 break ;
  310 #line 121 "toksearc.ch"
  311 #line 123 "toksearc.ch"
  312                             case metalang::FUNC : 
  313 #line 123 "toksearc.ch"
  314 #line 123 "toksearc.ch"
  315                                 (list=SonTree(val, 2));
  316 #line 123 "toksearc.ch"
  317 #line 123 "toksearc.ch"
  318 #line 123 "toksearc.ch"
  319                             _Case15 : 
  320 #line 123 "toksearc.ch"
  321 #line 123 "toksearc.ch"
  322                                 ;
  323 #line 123 "toksearc.ch"
  324 #line 123 "toksearc.ch"
  325                                 {
  326 #line 123 "toksearc.ch"
  327 #line 124 "toksearc.ch"
  328                                     if ( !strcmp(BrainyValue(val), "SortKeyWord") || !strcmp(BrainyValue(val), "UpSortKeyWord") ) 
  329 #line 124 "toksearc.ch"
  330 #line 126 "toksearc.ch"
  331                                         InsertDescript(0, "KeyWord", numb, sontree(tree, 1));
  332 #line 126 "toksearc.ch"
  333 #line 131 "toksearc.ch"
  334                                     ((_inter = (PPTREE)list,1) && 
  335 #line 131 "toksearc.ch"
  336                                         ((val=SonTree(_inter,1)),1) &&
  337 #line 131 "toksearc.ch"
  338                                         1);
  339 #line 131 "toksearc.ch"
  340                                     ;
  341 #line 131 "toksearc.ch"
  342 #line 136 "toksearc.ch"
  343                                     if ( ((_inter = (PPTREE)val,1) && 
  344 #line 136 "toksearc.ch"
  345                                             (NumberTree(_inter) == metalang::IDENT) &&
  346 #line 136 "toksearc.ch"
  347                                             1) ) {
  348 #line 136 "toksearc.ch"
  349 #line 137 "toksearc.ch"
  350                                                     InsertDescript(AddConst(BrainyValue(val)), BrainyValue(val), numb, sontree(tree, 1));
  351 #line 137 "toksearc.ch"
  352 #line 139 "toksearc.ch"
  353 #line 139 "toksearc.ch"
  354 #line 139 "toksearc.ch"
  355                                                  } else 
  356 #line 139 "toksearc.ch"
  357 #line 140 "toksearc.ch"
  358                                         goto INSERT_VAL ;
  359 #line 140 "toksearc.ch"
  360 #line 140 "toksearc.ch"
  361 #line 141 "toksearc.ch"
  362 #line 141 "toksearc.ch"
  363 #line 141 "toksearc.ch"
  364                                 }
  365 #line 141 "toksearc.ch"
  366                         }
  367 #line 141 "toksearc.ch"
  368 #line 141 "toksearc.ch"
  369 #line 143 "toksearc.ch"
  370                         goto for_continue1 ;
  371 #line 143 "toksearc.ch"
  372 #line 144 "toksearc.ch"
  373                         break ;
  374 #line 144 "toksearc.ch"
  375 #line 146 "toksearc.ch"
  376                     case metalang::STORE_COMMENT_LINE : 
  377 #line 146 "toksearc.ch"
  378 #line 146 "toksearc.ch"
  379                     _Case9 : 
  380 #line 146 "toksearc.ch"
  381 #line 146 "toksearc.ch"
  382                         ;
  383 #line 146 "toksearc.ch"
  384 #line 146 "toksearc.ch"
  385                         InsertDescript( -1, "Comment", numb, sontree(tree, 1));
  386 #line 146 "toksearc.ch"
  387 #line 147 "toksearc.ch"
  388                         break ;
  389 #line 147 "toksearc.ch"
  390 #line 149 "toksearc.ch"
  391                     case metalang::RECOGNIZE_STRING : 
  392 #line 149 "toksearc.ch"
  393 #line 149 "toksearc.ch"
  394                     _Case10 : 
  395 #line 149 "toksearc.ch"
  396 #line 149 "toksearc.ch"
  397                         ;
  398 #line 149 "toksearc.ch"
  399 #line 149 "toksearc.ch"
  400                         InsertDescript( -2, "String", numb, sontree(tree, 1));
  401 #line 149 "toksearc.ch"
  402 #line 150 "toksearc.ch"
  403                         break ;
  404 #line 150 "toksearc.ch"
  405 #line 151 "toksearc.ch"
  406                     default : 
  407 #line 151 "toksearc.ch"
  408 #line 151 "toksearc.ch"
  409                     _Case11 : 
  410 #line 151 "toksearc.ch"
  411 #line 151 "toksearc.ch"
  412                         ;
  413 #line 151 "toksearc.ch"
  414 #line 151 "toksearc.ch"
  415                         break ;
  416 #line 151 "toksearc.ch"
  417                 }
  418 #line 151 "toksearc.ch"
  419 #line 151 "toksearc.ch"
  420 #line 153 "toksearc.ch"
  421 #line 153 "toksearc.ch"
  422 #line 153 "toksearc.ch"
  423             }
  424 #line 153 "toksearc.ch"
  425 #line 153 "toksearc.ch"
  426             _iterator1.Current(_for_elem);
  427 #line 153 "toksearc.ch"
  428 #line 153 "toksearc.ch"
  429             continue ;
  430 #line 153 "toksearc.ch"
  431 #line 153 "toksearc.ch"
  432         for_continue1 : 
  433 #line 153 "toksearc.ch"
  434 #line 153 "toksearc.ch"
  435             _iterator1.Current(_for_elem);
  436 #line 153 "toksearc.ch"
  437 #line 153 "toksearc.ch"
  438             _iterator1.SkipSon(1);
  439 #line 153 "toksearc.ch"
  440 #line 153 "toksearc.ch"
  441             continue ;
  442 #line 153 "toksearc.ch"
  443 #line 153 "toksearc.ch"
  444         for_break1 : 
  445 #line 153 "toksearc.ch"
  446 #line 153 "toksearc.ch"
  447             break ;
  448 #line 153 "toksearc.ch"
  449 #line 153 "toksearc.ch"
  450 #line 153 "toksearc.ch"
  451 #line 153 "toksearc.ch"
  452         }
  453 #line 153 "toksearc.ch"
  454 #line 153 "toksearc.ch"
  455 #line 153 "toksearc.ch"
  456 #line 153 "toksearc.ch"
  457     }
  458 #line 153 "toksearc.ch"
  459 #line 154 "toksearc.ch"
  460 #line 154 "toksearc.ch"
  461 #line 154 "toksearc.ch"
  462 }
  463 #line 154 "toksearc.ch"
  464 
  465 #line 154 "toksearc.ch"
  466 /*Well done my boy */ 
  467