/* Copyright (c) 1990 The Regents of the University of California. */ /* All rights reserved. */
/* This code is derived from software contributed to Berkeley by */ /* Vern Paxson. */
/* The United States Government has rights in this work pursuant */ /* to contract no. DE-AC03-76SF00098 between the United States */ /* Department of Energy and the University of California. */
/* This file is part of flex */
/* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */
/* 1. Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* 2. Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */
/* Neither the name of the University nor the names of its contributors */ /* may be used to endorse or promote products derived from this software */ /* without specific prior written permission. */
/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */
#include"flexdef.h"
/* ccl2ecl - convert character classes to set of equivalence classes */
void ccl2ecl ()
{ int i, ich, newlen, cclp, ccls, cclmec;
for (i = 1; i <= lastccl; ++i) { /* We loop through each character class, and for each character *intheclass,addthecharacter'sequivalenceclasstothe *new"character"classwearecreating.Thuswhenweareall *done,characterclasseswillreallyconsistofcollections *ofequivalenceclasses
*/
newlen = 0;
cclp = cclmap[i];
for (ccls = 0; ccls < ccllen[i]; ++ccls) {
ich = ccltbl[cclp + ccls];
cclmec = ecgroup[ich];
/* cre8ecs - associate equivalence class numbers with class members * *fwdistheforwardlinked-listofequivalenceclassmembers.bck *isthebackwardlinked-list,andnumisthenumberofclassmembers. * *Returnedisthenumberofclasses.
*/
int cre8ecs (fwd, bck, num) int fwd[], bck[], num;
{ int i, j, numcl;
numcl = 0;
/* Create equivalence class numbers. From now on, ABS( bck(x) ) *istheequivalenceclassnumberforobjectx.Ifbck(x) *ispositive,thenxistherepresentativeofitsequivalence *class.
*/ for (i = 1; i <= num; ++i) if (bck[i] == NIL) {
bck[i] = ++numcl; for (j = fwd[i]; j != NIL; j = fwd[j])
bck[j] = -numcl;
}
return numcl;
}
/* mkeccl - update equivalence classes based on character class xtions * *synopsis *Charccls[]; *intlenccl,fwd[llsiz],bck[llsiz],llsiz,NUL_mapping; *voidmkeccl(Charccls[],intlenccl,intfwd[llsiz],intbck[llsiz], *intllsiz,intNUL_mapping); * *cclscontainstheelementsofthecharacterclass,lencclisthe *numberofelementsintheccl,fwdistheforwardlink-listofequivalent *characters,bckisthebackwardlink-list,andllsizsizeofthelink-list. * *NUL_mappingisthevaluewhichNUL(0)shouldbemappedto.
*/
void mkeccl (ccls, lenccl, fwd, bck, llsiz, NUL_mapping) Char ccls[]; int lenccl, fwd[], bck[], llsiz, NUL_mapping;
{ int cclp, oldec, newec; int cclm, i, j; staticunsignedchar cclflags[CSIZE]; /* initialized to all '\0' */
/* Note that it doesn't matter whether or not the character class is *negated.Thesameresultswillbeobtainedineithercase.
*/
cclp = 0;
while (cclp < lenccl) {
cclm = ccls[cclp];
if (NUL_mapping && cclm == 0)
cclm = NUL_mapping;
oldec = bck[cclm];
newec = cclm;
j = cclp + 1;
for (i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i]) { /* look for the symbol in the character class */ for (; j < lenccl; ++j) { int ccl_char;
if (ccl_char == i && !cclflags[j]) { /* We found an old companion of cclm *intheccl.Linkitintothenew *equivalenceclassandflagitas *havingbeenprocessed.
*/
bck[i] = newec;
fwd[newec] = i;
newec = i; /* Set flag so we don't reprocess. */
cclflags[j] = 1;
/* Get next equivalence class member. */ /* continue 2 */ goto next_pt;
}
}
/* Symbol isn't in character class. Put it in the old *equivalenceclass.
*/
/* mkechar - create equivalence class for single character */
void mkechar (tch, fwd, bck) int tch, fwd[], bck[];
{ /* If until now the character has been a proper subset of *anequivalenceclass,breakitawaytocreateanewec
*/
if (fwd[tch] != NIL)
bck[fwd[tch]] = bck[tch];
if (bck[tch] != NIL)
fwd[bck[tch]] = fwd[tch];
fwd[tch] = NIL;
bck[tch] = NIL;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.