Login   Register  
PHP Classes
elePHPant
Icontem

File: src/eMacros/Package/RegexPackage.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Emmanuel Antico  >  eMacros  >  src/eMacros/Package/RegexPackage.php  >  Download  
File: src/eMacros/Package/RegexPackage.php
Role: Class source
Content type: text/plain
Description: Class source
Class: eMacros
PHP LISP language interpreter
Author: By
Last change:
Date: 2014-01-13 05:17
Size: 1,117 bytes
 

Contents

Class file image Download
<?php
namespace eMacros\Package;

use 
eMacros\Runtime\PHPFunction;
use 
eMacros\Runtime\Regex\RegexReplace;
use 
eMacros\Runtime\Regex\RegexReplaceCallback;
use 
eMacros\Runtime\Regex\RegexMatch;
use 
eMacros\Runtime\Regex\RegexMatchAll;

class 
RegexPackage extends Package {
    public function 
__construct() {
        
parent::__construct('Regex');
        
        
//functions
        
$this['grep'] = new PHPFunction('preg_grep');
        
$this['quote'] = new PHPFunction('preg_quote');
        
$this['split'] = new PHPFunction('preg_split');
        
        
//macros
        
$this['match'] = new RegexMatch();
        
$this['match-all'] = new RegexMatchAll();
        
$this['replace'] = new RegexReplace();
        
$this['replace-callback'] = new RegexReplaceCallback();
        
        
//predefined contants
        
$this['OFFSET_CAPTURE']       = PREG_OFFSET_CAPTURE;
        
$this['GREP_INVERT']          = PREG_GREP_INVERT;
        
$this['PATTERN_ORDER']        = PREG_PATTERN_ORDER;
        
$this['SET_ORDER']            = PREG_SET_ORDER;
        
$this['SPLIT_NO_EMPTY']       = PREG_SPLIT_NO_EMPTY;
        
$this['SPLIT_DELIM_CAPTURE']  = PREG_SPLIT_DELIM_CAPTURE;
        
$this['SPLIT_OFFSET_CAPTURE'] = PREG_SPLIT_OFFSET_CAPTURE;
    }
}
?>