class Parser extends ParserBase

Properties

protected array $config from  ParserBase
protected Parser $parser from  ParserBase
protected bool $hasDoubleQuote
protected bool $hasSingleQuote
protected string $text

Methods

__construct(Parser $parser, array $config)

Constructor

void
setUp()

Plugin's setup

void
parse(string $text, array $matches)

No description

Tag
addTag(int $tagPos, int $tagLen, string $chr, int $prio = 0)

Add a fancy replacement tag

void
parseDashesAndEllipses()

Parse dashes and ellipses

void
parseDoubleQuotePairs()

Parse pairs of double quotes

void
parseFractions()

Parse vulgar fractions

void
parseGuillemets()

Parse guillemets-style quotation marks

void
parseNotEqualSign()

Parse the not equal sign

void
parseQuotePairs(string $regexp, string $leftQuote, string $rightQuote)

Parse pairs of quotes

void
parseSingleQuotePairs()

Parse pairs of single quotes

void
parseSingleQuotes()

Parse single quotes in general

void
parseSymbolsAfterDigits()

Parse symbols found after digits

void
parseSymbolsInParentheses()

Parse symbols found in parentheses such as (c)

Details

in ParserBase at line 30
final __construct(Parser $parser, array $config)

Constructor

Parameters

Parser $parser
array $config

in ParserBase at line 43
protected void setUp()

Plugin's setup

Return Value

void

at line 32
void parse(string $text, array $matches)

No description

Parameters

string $text
array $matches

If the config array has a "regexp" key, the corresponding matches are passed as second parameter. Otherwise, an empty array is passed

Return Value

void

at line 75
protected Tag addTag(int $tagPos, int $tagLen, string $chr, int $prio = 0)

Add a fancy replacement tag

Parameters

int $tagPos

Position of the tag in the text

int $tagLen

Length of text consumed by the tag

string $chr

Replacement character

int $prio

Tag's priority

Return Value

Tag

at line 90
protected void parseDashesAndEllipses()

Parse dashes and ellipses

Does en dash –, em dash — and ellipsis …

Return Value

void

at line 117
protected void parseDoubleQuotePairs()

Parse pairs of double quotes

Does quote pairs “” -- must be done separately to handle nesting

Return Value

void

at line 134
protected void parseFractions()

Parse vulgar fractions

Return Value

void

at line 176
protected void parseGuillemets()

Parse guillemets-style quotation marks

Return Value

void

at line 201
protected void parseNotEqualSign()

Parse the not equal sign

Supports != and =/=

Return Value

void

at line 224
protected void parseQuotePairs(string $regexp, string $leftQuote, string $rightQuote)

Parse pairs of quotes

Parameters

string $regexp

Regexp used to identify quote pairs

string $leftQuote

Fancy replacement for left quote

string $rightQuote

Fancy replacement for right quote

Return Value

void

at line 245
protected void parseSingleQuotePairs()

Parse pairs of single quotes

Does quote pairs ‘’ must be done separately to handle nesting

Return Value

void

at line 264
protected void parseSingleQuotes()

Parse single quotes in general

Does apostrophes ’ after a letter or at the beginning of a word or a couple of digits

Return Value

void

at line 290
protected void parseSymbolsAfterDigits()

Parse symbols found after digits

Does symbols found after a digit:

  • apostrophe ’ if it's followed by an "s" as in 80's
  • prime ′ and double prime ″
  • multiply sign × if it's followed by an optional space and another digit

Return Value

void

at line 335
protected void parseSymbolsInParentheses()

Parse symbols found in parentheses such as (c)

Does symbols ©, ® and ™

Return Value

void