File dsl/ast/DslInitialisation.class.php

Last commit: Mon Jun 6 14:06:46 2022 +0200	Jan Dankert	First commit after fetching from upstream repo.
1 <?php 2 3 namespace dsl\ast; 4 5 use dsl\DslRuntimeException; 6 use dsl\DslToken; 7 8 class DslInitialisation implements DslStatement 9 { 10 private $name; 11 private $value; 12 13 public function __construct( $name, $parameters ) 14 { 15 $this->name = $name; 16 $this->value = new DslExpression( $parameters ); 17 } 18 19 public function execute( & $context ) { 20 if ( array_key_exists( $this->name, $context ) ) 21 throw new DslRuntimeException('variable '.$this->name.' is already initialised'); 22 23 $context[ $this->name ] = $this->value->execute( $context ); 24 //echo "new var: ".$this->name.':'.$context[$this->name]; 25 26 } 27 28 public function parse($tokens) 29 { 30 // TODO: Implement parse() method. 31 } 32 }
Download dsl/ast/DslInitialisation.class.php
History Mon, 6 Jun 2022 14:06:46 +0200 Jan Dankert First commit after fetching from upstream repo.