12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

146 TOKEN PARSER ANNOYANCE-FILTER §173<br />

unsigned int getTokenLengthMin (void) const<br />

{<br />

return td ⃗ getLengthMin ( );<br />

}<br />

unsigned int getTokenLengthMax (void) const<br />

{<br />

return td ⃗ getLengthMax ( );<br />

}<br />

void reportParserDiagnostic(const string s) const<br />

{<br />

assert(source ≠ Λ);<br />

source ⃗ reportParserDiagnostic(s);<br />

}<br />

void reset (void)<br />

{<br />

if (inHTML) {<br />

reportParserDiagnostic("␣tag␣unterminated␣at␣end␣of␣message.");<br />

}<br />

if (inHTMLcomment ) {<br />

reportParserDiagnostic("HTML␣comment␣unterminated␣at␣end␣of␣message.");<br />

}<br />

inHTML = inHTMLcomment = false ;<br />

clearMessageQueue ( );<br />

phraseQueue .clear ( );<br />

pendingPhrases .clear ( );<br />

}<br />

bool nextToken (dictionaryWord &d);<br />

void assembleAllPhrases (dictionaryWord &d);<br />

〈 Message queue utilities 182 〉;<br />

bool isNewMessage (void) const<br />

{<br />

return atEnd ∨ (source ⃗ isNewMessage ( ));<br />

}<br />

private:<br />

void nextLine (void)<br />

{<br />

while (true ) {<br />

if (¬(source ⃗ nextLine (cl ))) {<br />

atEnd = true ;<br />

cl = "";<br />

break;<br />

}<br />

if (saveMessage ) {<br />

messageQueue .push back (cl );<br />

}<br />

if (source ⃗ isNewMessage ( )) {<br />

reset ( );<br />

}<br />

break;<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!