Ejemplo n.º 1
0
static PT_CharRanges SDFCharRangesToPtCharRanges(SDF_CharRanges sdfCharRanges)
{
  PT_CharRanges result = PT_makeCharRangesEmpty();


  if (SDF_isCharRangesDefault(sdfCharRanges)) {
    SDF_CharRange sdfCharRange = SDF_getCharRangesCharRange(sdfCharRanges);
    PT_CharRange ptCharRange = SDFCharRangeToPtCharRange(sdfCharRange);
    result = PT_makeCharRangesMany(ptCharRange, result);
  }
  else if (SDF_isCharRangesConc(sdfCharRanges)) {
    SDF_CharRanges sdfLeft = SDF_getCharRangesLeft(sdfCharRanges);
    SDF_CharRanges sdfRight = SDF_getCharRangesRight(sdfCharRanges);
    PT_CharRanges ptLeft = SDFCharRangesToPtCharRanges(sdfLeft);
    PT_CharRanges ptRight = SDFCharRangesToPtCharRanges(sdfRight);
    return PT_concatCharRanges(ptLeft, ptRight);
  }
  else {
    ATerror("SDFCharRangesToPtCharRanges: unable to convert %s\n",
	    PT_yieldTreeToString((PT_Tree) sdfCharRanges, ATfalse));
    result = NULL;
  }

  return result;
}
Ejemplo n.º 2
0
PT_Symbol makeSymbolAllChars()
{
  PT_CharRanges ranges = PT_makeCharRangesList(
                           PT_makeCharRangeRange(0,255),
                           PT_makeCharRangesEmpty());
  return PT_makeSymbolIterStar(
           PT_makeSymbolCharClass(ranges));
}  
Ejemplo n.º 3
0
static PT_CharRanges SDFCharClassToPtCharRanges(SDF_CharClass sdfCharClass)
{
  PT_CharRanges result;

  if (SDF_isCharClassSimpleCharclass(sdfCharClass)) {
    SDF_OptCharRanges sdfOCR = SDF_getCharClassOptCharRanges(sdfCharClass);

    if (SDF_isOptCharRangesAbsent(sdfOCR)) {
      result = PT_makeCharRangesEmpty();
    }
    else {
      SDF_CharRanges sdfCharRanges = SDF_getOptCharRangesCharRanges(sdfOCR);
      result = SDFCharRangesToPtCharRanges(sdfCharRanges);
    } 
  }
  else {
    ATerror("SDFCharClassToPtCharRanges: unable to convert characterclass: %s\n",
	    PT_yieldTreeToString((PT_Tree) sdfCharClass, ATfalse));
    result = NULL;
  }
  
  return result;
}