~ubuntu-branches/ubuntu/trusty/styx/trusty

« back to all changes in this revision

Viewing changes to libstyx/prs_gen.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederik Schüler
  • Date: 2007-07-01 23:06:53 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070701230653-8tcr3ow0d49alwj2
Tags: 1.7.5-1
* New upstream version.
* Bump standard to 2.7.2, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
461
461
  { int nti = OT_GET(int,NTEQUIV(ntclass),i), j;
462
462
    for( j =  FIRSTNTPROD(NTSYMBOL(nti)); j <= LASTNTPROD(NTSYMBOL(nti)); ++j )
463
463
    { KFGPROD* prod = &PrsGen->ProdTab[j];
 
464
/*
 
465
printf("%s.%s.%s\n",PrsGen->Kfg->SNames[NTSYMBOL(ntclass)],PrsGen->Kfg->SNames[prod->id],prod->pname);
 
466
*/
464
467
      if( nilProd(prod->pname) || consProd(prod->pname) ) isList = True;
465
468
      else
466
469
        if( ! ignProd(prod->pname) ) isOther = True;
958
961
    int idx = PRODUCTION(curr) - 1, pos = POSITION(curr) - 1;
959
962
 
960
963
    if( pos != PrsGen->MaxSymCnt )
961
 
    {
 
964
    { INT dmy = 0;
962
965
      Nach = GET_KLIST(PrsGen->GoToKern,PrsGen->ProdTab[idx].symbols[pos]);
963
 
      INSS_INTLE(nextProdElement(PrsGen,curr),Nach);
 
966
      dmy = INSS_INTLE(nextProdElement(PrsGen,curr),Nach);
964
967
    }
965
968
  }
966
969
  for( i=0; i < NONTERMCNT; ++i )
970
973
      for( j = FIRSTNTPROD(NTSYMBOL(i)); j <= LASTNTPROD(NTSYMBOL(i)); ++j )
971
974
      {
972
975
        if( PrsGen->ProdTab[j].symcnt )
973
 
        {
 
976
        { INT dmy = 0;
974
977
          Nach = GET_KLIST(PrsGen->GoToKern,PrsGen->ProdTab[j].symbols[0]);
975
 
          INSS_INTLE(nextProdElement(PrsGen,KERNELEMENT(j,1)),Nach);
 
978
          dmy = INSS_INTLE(nextProdElement(PrsGen,KERNELEMENT(j,1)),Nach);
976
979
        }
977
980
      }
978
981
    }
995
998
 
996
999
          if( ! pos || element != CURR_INTLE(curr->kern) )
997
1000
          { BS_Set lahead = BS_create(TERMCNT);
998
 
 
 
1001
            INT dmy = 0;
999
1002
            if( ! pos )
1000
1003
            {
1001
 
              INST_INTLE(element,curr->kern); INS_LOOK(lahead,curr->looks);
 
1004
              dmy = INST_INTLE(element,curr->kern); INS_LOOK(lahead,curr->looks);
1002
1005
            }
1003
1006
            else
1004
1007
            {
1005
 
              INSC_INTLE(element,curr->kern); INSN_LOOK(lahead,curr->looks,pos);
 
1008
              dmy = INSC_INTLE(element,curr->kern); INSN_LOOK(lahead,curr->looks,pos);
1006
1009
            }
1007
1010
          }
1008
1011
        }
1018
1021
  for( i=0; i < PrsGen->Kfg->StartCnt; ++i )
1019
1022
  { INT element = KERNELEMENT(PrsGen->ProdCnt-PrsGen->Kfg->StartCnt+i,1);
1020
1023
    BS_Set lahead = BS_create(TERMCNT);
 
1024
    INT dmy = 0;
1021
1025
 
1022
1026
    newState.symbol = -1;
1023
1027
    newState.looks  = NEW_LOOKTAB;
1025
1029
    INS_LOOK(lahead, newState.looks);
1026
1030
    newState.kern   = NEW_INTLIST;
1027
1031
    newState.states = NEW_INTLIST;
1028
 
    INST_INTLE(element, newState.kern);
 
1032
    dmy = INST_INTLE(element, newState.kern);
1029
1033
    INS_STATE(&newState,PrsGen->StateTab);
1030
1034
  }
1031
1035
}
1038
1042
  {
1039
1043
    if( OL_EQUAL(GET_STATE(PrsGen->StateTab,i)->kern,newKLst) )
1040
1044
    { INT pos = FND_INTLE(i,curr->states);
1041
 
 
1042
 
      if( ! pos ) INST_INTLE(i,curr->states);
 
1045
      INT dmy = 0;
 
1046
      if( ! pos ) dmy = INST_INTLE(i,curr->states);
1043
1047
      else
1044
1048
      {
1045
 
        if( i != CURR_INTLE(curr->states) ) INSC_INTLE(i,curr->states);
 
1049
        if( i != CURR_INTLE(curr->states) ) 
 
1050
          dmy = INSC_INTLE(i,curr->states);
1046
1051
      }
1047
1052
      return( True );
1048
1053
    }
1065
1070
      {
1066
1071
        if( ! existsFollowState(PrsGen,curr,GET_KLIST(PrsGen->GoToKern,j)) )
1067
1072
        { INT StateId, k;
 
1073
          INT dmy = 0;
1068
1074
 
1069
1075
          newState.symbol = j;
1070
1076
          newState.looks  = NEW_LOOKTAB;
1079
1085
          }
1080
1086
          INS_STATE(&newState,PrsGen->StateTab);
1081
1087
          StateId = OT_CNT(PrsGen->StateTab) - 1;
1082
 
          INST_INTLE(StateId,curr->states);
 
1088
          dmy = INST_INTLE(StateId,curr->states);
1083
1089
          if( isNonTerm(PrsGen,j) ) 
1084
1090
            INS_INTTE((int)StateId,PrsGen->NonTermTab[NTIDX(j)].states);
1085
1091
        }
1905
1911
int PLR_addST(PLR_Cfg Cfg, string SpecTk)
1906
1912
/* marks 'SpecTk' as special comment token */
1907
1913
{ INT tk, tki; int kind;
 
1914
  INT dmy = 0;
1908
1915
 
1909
1916
  BUG_NULL(Cfg); BUG_NULL(SpecTk);
1910
1917
  BUG_VNEQ(PLR_C_IMP(Cfg)->TkIdx,(OT_Tab)NULL);
1920
1927
  }
1921
1928
  assert0(!CFG_KEY(kind),"illegal comment type");
1922
1929
  kind = CFG_TERM_TO_COM(kind);
1923
 
  UPD_INTTE(kind,PLR_C_IMP(Cfg)->TokKind,tk);
 
1930
  dmy = UPD_INTTE(kind,PLR_C_IMP(Cfg)->TokKind,tk);
1924
1931
  return tk;
1925
1932
}
1926
1933
 
2071
2078
    printNtClasses(&PrsGen);
2072
2079
  }
2073
2080
  else countConflicts(&PrsGen);
 
2081
  ((PARSETAB*)PTab)->Conflicts = PrsGen.conflictCnt;
2074
2082
  if( PrsGen.conflictCnt )
2075
2083
  {
2076
2084
    sprintf(buf,"%d conflicts. Use -diagnose !\n",PrsGen.conflictCnt);