Ignore:
Timestamp:
Aug 12, 2014, 7:40:22 AM (5 years ago)
Author:
cameron
Message:

Delete old pablos_printer files, use printer_pablos instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pbix_compiler.cpp

    r3974 r3994  
    66
    77#include "pbix_compiler.h"
     8#include "printer_pablos.h"
    89
    910Pbix_Compiler::Pbix_Compiler(std::map<std::string, std::string> name_map)
     
    102103    {
    103104        std::string gs_retVal = symgen.gensym("marker");
    104 
    105         if (name->getType() == Name::FixedLength)
    106         {
    107             cg_state.stmtsl.push_back(new Assign(gs_retVal, new Advance(new And(new Var(cg_state.newsym), new CharClass(name->getName())))));
    108         }
    109         else if (name->getType() == Name::UnicodeCategory)
    110         {
    111             cg_state.stmtsl.push_back(new Assign(gs_retVal, new Advance(new And(new Var(cg_state.newsym), new Call(name->getName())))));
    112         }
    113         else //Name::Unicode
    114         {
    115             cg_state.stmtsl.push_back(new Assign(gs_retVal, new Advance(new And(new CharClass(name->getName()), new ScanThru(new Var(cg_state.newsym), new CharClass(m_name_map.find("internal.nonfinal")->second))))));
    116         }
     105        PabloE* markerExpr = new Var(cg_state.newsym);
     106        if (name->getType() != Name::FixedLength) {
     107            // Move the markers forward through any nonfinal UTF-8 bytes to the final position of each character.
     108            markerExpr = new ScanThru(markerExpr, new CharClass(m_name_map.find("internal.nonfinal")->second));
     109        }       
     110        PabloE* ccExpr;
     111        if (name->getType() == Name::UnicodeCategory)
     112        {
     113            ccExpr = new Call(name->getName());
     114        }
     115        else
     116        {
     117            ccExpr = new CharClass(name->getName());
     118        }
     119        if (name->isNegated()) {
     120            ccExpr = new Not(new Or(ccExpr, new CharClass(m_name_map.find("LineFeed")->second)));
     121        }
     122        cg_state.stmtsl.push_back(new Assign(gs_retVal, new Advance(new And(ccExpr, markerExpr))));
    117123        cg_state.newsym = gs_retVal;
    118124
    119         //cout << "\n" << "(" << StatementPrinter::PrintStmts(cg_state) << ")" << "\n" << endl;
     125        std::cout << "\n" << "(" << StatementPrinter::PrintStmts(cg_state) << ")" << "\n" << std::endl;
    120126    }
    121127    else if (Start* start = dynamic_cast<Start*>(re))
     
    170176            std::string gs_retVal = symgen.gensym("marker");
    171177
     178std::cout << "MatchStar pattern found!" << std::endl;
     179            PabloE* ccExpr;
     180            if (name->getType() == Name::UnicodeCategory)
     181            {
     182std::cout << "MatchStar pattern External!" << std::endl;
     183                ccExpr = new Call(name->getName());
     184            }
     185            else
     186            {
     187std::cout << "MatchStar pattern internal!" << std::endl;
     188                ccExpr = new CharClass(name->getName());
     189            }
     190
     191            if (name->isNegated()) {
     192std::cout << "MatchStar pattern Negated!" << std::endl;               
     193                ccExpr = new Not(new Or(ccExpr, new CharClass(m_name_map.find("LineFeed")->second)));
     194            }
    172195            if (rep_name->getType() == Name::FixedLength)
    173196            {
    174                 cg_state.stmtsl.push_back(new Assign(gs_retVal, new MatchStar(new Var(cg_state.newsym), new CharClass(rep_name->getName()))));
     197                cg_state.stmtsl.push_back(new Assign(gs_retVal, new MatchStar(new Var(cg_state.newsym), ccExpr)));
    175198            }
    176199            else //Name::Unicode and Name::UnicodeCategory
    177200            {
     201std::cout << "MatchStar pattern Unicode!" << std::endl;               
    178202                cg_state.stmtsl.push_back(new Assign(gs_retVal,
    179203                    new And(new MatchStar(new Var(cg_state.newsym), new Or(new CharClass(m_name_map.find("internal.nonfinal")->second),
    180                     new CharClass(rep_name->getName()))), new CharClass(m_name_map.find("internal.initial")->second))));
     204                    ccExpr)), new CharClass(m_name_map.find("internal.initial")->second))));
    181205            }
    182206
Note: See TracChangeset for help on using the changeset viewer.