[WIP] - parse comments improvement

This commit is contained in:
Eduardo Gulias Davis
2014-07-03 01:00:20 +02:00
parent f7402dd8dc
commit 2312070f3a
2 changed files with 11 additions and 15 deletions
+11 -6
View File
@@ -39,14 +39,9 @@ abstract class Parser
*/
protected function parseComments()
{
$this->isUnclosedComment();
$this->warnings[] = EmailValidator::CFWS_COMMENT;
while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) {
try {
$this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS);
} catch (\RuntimeException $e) {
throw new \InvalidArgumentException('ERR_UNCLOSEDCOMMENT');
}
$this->warnEscaping();
$this->lexer->moveNext();
}
@@ -61,6 +56,16 @@ abstract class Parser
}
}
protected function isUnclosedComment()
{
try {
$this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS);
return true;
} catch (\RuntimeException $e) {
throw new \InvalidArgumentException('ERR_UNCLOSEDCOMMENT');
}
}
protected function parseFWS()
{
$previous = $this->lexer->getPrevious();
@@ -290,13 +290,4 @@ class DomainPart extends Parser
}
}
protected function isUnclosedComment()
{
try {
$this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS);
return true;
} catch (\RuntimeException $e) {
throw new \InvalidArgumentException('ERR_UNCLOSEDCOMMENT');
}
}
}