File dsl/DslToken.class.php

Last commit: Tue Jul 19 00:10:39 2022 +0200	Jan Dankert	Fetched from upstream.
1 <?php 2 namespace dsl; 3 4 class DslToken 5 { 6 7 8 const T_NONE = 0; 9 const T_STRING = 1; 10 const T_BRACKET_OPEN = 3; 11 const T_BRACKET_CLOSE = 4; 12 const T_BLOCK_BEGIN = 5; 13 const T_BLOCK_END = 6; 14 const T_TEXT = 7; 15 const T_NUMBER = 8; 16 const T_OPERATOR = 9; 17 const T_FUNCTION = 10; 18 const T_FOR = 11; 19 const T_IF = 12; 20 const T_ELSE = 13; 21 const T_LET = 14; 22 const T_RETURN = 15; 23 const T_DOT = 16; 24 const T_STATEMENT_END = 17; 25 const T_NEGATION = 18; 26 const T_COMMA = 19; 27 const T_NEW = 20; 28 const T_THROW = 21; 29 const T_TRUE = 22; 30 const T_FALSE = 23; 31 const T_NULL = 24; 32 33 public $lineNumber; 34 public $type; 35 public $value; 36 37 /** 38 * DslToken constructor. 39 * @param $lineNumber 40 * @param $type 41 * @param $value 42 */ 43 public function __construct($lineNumber, $type, $value) 44 { 45 $this->lineNumber = $lineNumber; 46 $this->type = $type; 47 $this->value = $value; 48 } 49 50 public function __toString() 51 { 52 return '#'.$this->lineNumber.':'.$this->type.':"'.$this->value.'"'; 53 } 54 55 56 /** 57 * @return bool 58 */ 59 public function isOperator( $value = null ) { 60 if ( ! $value ) 61 return $this->type == self::T_OPERATOR; 62 63 return $this->type == self::T_OPERATOR && $this->value == $value; 64 } 65 }
Download dsl/DslToken.class.php
History Tue, 19 Jul 2022 00:10:39 +0200 Jan Dankert Fetched from upstream. Sun, 26 Jun 2022 15:47:05 +0200 Jan Dankert Fetched from upstream. Tue, 7 Jun 2022 23:33:20 +0200 Jan Dankert Fetched from upstream: support for "throw". Mon, 6 Jun 2022 14:06:46 +0200 Jan Dankert First commit after fetching from upstream repo.