TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Parser Class Reference
Inheritance diagram for Parser:
ParserInterface

Public Member Functions

 __construct (GranularityInterface $granularity)
 
 getGranularity ()
 
 setGranularity (GranularityInterface $granularity)
 
 getOpcodes ()
 
 setOpcodes (OpcodesInterface $opcodes)
 
 parse ($from_text, $to_text)
 

Protected Member Functions

 process ($from_text, $to_text)
 
 diff ($from_text, $to_text, $delimiters)
 
 charDiff ($from_text, $to_text)
 
 extractFragments ($text, $delimiters)
 

Protected Attributes

 $granularity
 
 $opcodes
 
 $from_text
 
 $from_offset = 0
 
 $last_edit
 
 $stackpointer = 0
 
 $edits = array()
 

Detailed Description

Generates a set of instructions to convert one string to another.

Definition at line 31 of file Parser.php.

Constructor & Destructor Documentation

__construct ( GranularityInterface  $granularity)

Creates an instance.

Parameters
cogpowered\FineDiff\Granularity\GranularityInterface

Implements ParserInterface.

Definition at line 71 of file Parser.php.

References Parser\$granularity.

Member Function Documentation

charDiff (   $from_text,
  $to_text 
)
protected

Same as Parser::diff but tuned for character level granularity.

Parameters
string$from_text
string$to_text
Returns
array

Definition at line 346 of file Parser.php.

References Parser\$from_text.

Referenced by Parser\diff().

diff (   $from_text,
  $to_text,
  $delimiters 
)
protected

Core parsing function.

Parameters
string$from_text
string$to_text
string$delimitersDelimiter to use for this parse.
Returns
array

Definition at line 187 of file Parser.php.

References Parser\$from_text, Parser\charDiff(), and Parser\extractFragments().

Referenced by Parser\process().

extractFragments (   $text,
  $delimiters 
)
protected

Efficiently fragment the text into an array according to specified delimiters.

No delimiters means fragment into single character. The array indices are the offset of the fragments into the input string. A sentinel empty fragment is always added at the end. Careful: No check is performed as to the validity of the delimiters.

Parameters
string$text
string$delimiters
array

Definition at line 446 of file Parser.php.

Referenced by Parser\diff().

getGranularity ( )

Granularity the parser is working with.Default is cogpowered.

See Also
cogpowered
cogpowered
cogpowered
cogpowered
Returns
cogpowered

Implements ParserInterface.

Definition at line 82 of file Parser.php.

References Parser\$granularity.

getOpcodes ( )

Get the opcodes object that is used to store all the opcodes.

Returns
cogpowered

Implements ParserInterface.

Definition at line 98 of file Parser.php.

References Parser\$opcodes.

parse (   $from_text,
  $to_text 
)

Generates the opcodes needed to transform one string to another.

Parameters
string$from_text
string$to_text
Exceptions
cogpowered\FineDiff\Exceptions\GranularityCountException
Returns
cogpowered

Implements ParserInterface.

Definition at line 114 of file Parser.php.

References Parser\$from_text, Parser\$opcodes, and Parser\process().

process (   $from_text,
  $to_text 
)
protected

Actually kicks off the processing. Recursive function.

Parameters
string$from_text
string$to_text
Returns
void

Definition at line 143 of file Parser.php.

References Parser\$from_text, Parser\diff(), and elseif.

Referenced by Parser\parse().

setGranularity ( GranularityInterface  $granularity)

Set the granularity that the parser is working with.

See Also
cogpowered
cogpowered
cogpowered
cogpowered
Parameters
cogpowered\FineDiff\Granularity\GranularityInterface
Returns
void

Implements ParserInterface.

Definition at line 90 of file Parser.php.

References Parser\$granularity.

setOpcodes ( OpcodesInterface  $opcodes)

Set the opcodes object used to store all the opcodes for this parse.

Parameters
cogpowered\FineDiff\Parser\OpcodesInterface$opcodes,.
Returns
void

Implements ParserInterface.

Definition at line 106 of file Parser.php.

References Parser\$opcodes.

Member Data Documentation

$edits = array()
protected

Definition at line 66 of file Parser.php.

$from_offset = 0
protected

Definition at line 51 of file Parser.php.

$from_text
protected

Definition at line 46 of file Parser.php.

Referenced by Parser\charDiff(), Parser\diff(), Parser\parse(), and Parser\process().

$granularity
protected

Definition at line 36 of file Parser.php.

Referenced by Parser\__construct(), Parser\getGranularity(), and Parser\setGranularity().

$last_edit
protected

Definition at line 56 of file Parser.php.

$opcodes
protected

Definition at line 41 of file Parser.php.

Referenced by Parser\getOpcodes(), Parser\parse(), and Parser\setOpcodes().

$stackpointer = 0
protected

Definition at line 61 of file Parser.php.