Changeset 8a9cc7e in tol


Ignore:
Timestamp:
Nov 9, 2011, 4:39:23 PM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
41e86a8
Parents:
5063abb
Message:

Refs #724

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@3823 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/bparser/fil.cpp

    r5063abb r8a9cc7e  
    605605BText BFilter::Transform(const BText& original) const
    606606{
    607     error_ = false;
    608     errorMsg_ = "";
    609     BText expression = original;
    610     BTextBlock block;
    611     GetBlocks(expression, block);
    612     expression = "";
    613     BText cleaned = "";
    614     for(BInt k = 0; k<block.Size(); k++) {
    615         BInt blockClass=ClassifyBlock(block[k].text.Buffer());
    616        
    617         if((blockClass==NormalBlock)) {
    618             cleaned += block[k].text + " ";
    619         }
    620 
    621         if(blockClass==QuotesBlock) {
    622             Clean(cleaned);
    623             CleanQuotes(block[k].text);
    624             expression += cleaned + " " + block[k].text + " ";
    625             cleaned = "";
    626         }
    627     }
    628 
    629     if(cleaned.HasName()) {
    630         Clean(cleaned);
    631         expression += cleaned;
    632     }
    633 
    634     while(expression.Length() && strchr(" \t\n;",expression.Last())) {
    635         expression.PutLength(expression.Length()-1);
    636     }
    637 
    638     if(error_) return errorMsg_;
    639     else return expression;
     607  error_ = false;
     608  errorMsg_ = "";
     609  BText expression = original;
     610  BTextBlock block;
     611  GetBlocks(expression, block);
     612  expression = "";
     613  BText cleaned = "";
     614  for(BInt k = 0; k<block.Size(); k++)
     615  {
     616    BInt blockClass=ClassifyBlock(block[k].text.Buffer());
     617    if((blockClass==NormalBlock))
     618    {
     619      cleaned += block[k].text + " ";
     620    }
     621    if(blockClass==QuotesBlock)
     622    {
     623      Clean(cleaned);
     624      CleanQuotes(block[k].text);
     625      expression += cleaned + " " + block[k].text + " ";
     626      cleaned = "";
     627    }
     628  }
     629  if(cleaned.HasName())
     630  {
     631    Clean(cleaned);
     632    expression += cleaned;
     633  }
     634
     635  while(expression.Length() && strchr(" \t\n;",expression.Last()))
     636  {
     637    expression.PutLength(expression.Length()-1);
     638  }
     639  if(error_) { return errorMsg_; }
     640  else
     641  {
     642    BText s20(expression,0,20);
     643    s20.Compact();
     644  //Std(BText("BFilter::Transform 1 : '")<<s20<<"'");
     645    if(s20.BeginWith("#Embed"))
     646    {
     647      expression = BText("Write ( \" \" ) ; ") << expression;
     648    };
     649    return expression;
     650  }
    640651}
    641652
Note: See TracChangeset for help on using the changeset viewer.