Skip to content

Commit

Permalink
split function
Browse files Browse the repository at this point in the history
  • Loading branch information
TRPB committed Mar 12, 2018
1 parent 34813d7 commit b0adb60
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Parser/Tokenizer/Literals.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ private function isLiteral($n, $str) {

private function processLiterals($tokens, $name, $str) {
if (is_numeric($name)) $tokens->add(['type' => Tokenizer::NUMERIC, 'value' => $name]);
else if ($name == 'true') $tokens->add(['type' => Tokenizer::BOOL, 'value' => true]);
else if ($name == 'false') $tokens->add(['type' => Tokenizer::BOOL, 'value' => false]);
else if ($name == 'in') $tokens->add(['type' => Tokenizer::IN, 'value' => 'in']);
else if (method_exists($this, $name)) $this->$name($tokens);
else $tokens->add(['type' => Tokenizer::NAME, 'value' => $name, 'line' => $str->lineNo()]);
}

private function true($tokens) {
$tokens->add(['type' => Tokenizer::BOOL, 'value' => true]);
}

private function false($tokens) {
$tokens->add(['type' => Tokenizer::BOOL, 'value' => false]);
}

private function in($tokens) {
$tokens->add(['type' => Tokenizer::IN, 'value' => 'in']);
}
}

0 comments on commit b0adb60

Please sign in to comment.