Example #1
0
 public function testConstruct()
 {
     $token = new Token(Token::T_ECHO, "echo", 1);
     $this->assertSame(Token::T_ECHO, $token->getType());
     $this->assertSame("echo", $token->getcontent());
     $this->assertSame(1, $token->getLine());
     $this->assertSame("T_ECHO", $token->getName());
 }
Example #2
0
 /**
  * Parses a number
  *
  * @param Boolean $positive Whether this value is positive
  * @param \vc\Tokens\Token $token The token to examine
  * @return \vc\Data\Value
  */
 private function parseNumber($positive, \vc\Tokens\Token $token)
 {
     $content = $token->getContent();
     if (!$positive) {
         $content = "-" . $content;
     }
     return new \vc\Data\Value($content, $token->getType() == Token::T_LNUMBER ? "int" : "float");
 }