File modules/dsl/ast/DslSequence.class.php

Last commit: Sun May 29 16:56:40 2022 +0200	Jan Dankert	New: DSL with support for functions with return values, full arithmetic, object properties
1 <?php 2 3 namespace dsl\ast; 4 5 use dsl\DslRuntimeException; 6 7 class DslSequence implements DslStatement 8 { 9 public $left; 10 public $right; 11 12 13 /** 14 * DslSequence constructor. 15 * @param $left 16 * @param $right 17 */ 18 public function __construct($left, $right) 19 { 20 $this->left = $left; 21 $this->right = $right; 22 } 23 24 25 public function execute( & $context ) { 26 27 // Creating a sequence 28 $left = $this->left->execute( $context ); 29 $right = $this->right->execute( $context ); 30 31 // cast to array 32 if ( !is_array( $left ) ) $left = [$left ]; 33 if ( !is_array( $right) ) $right = [$right]; 34 35 return array_merge( $left,$right); 36 } 37 38 public function parse($tokens) 39 { 40 } 41 }
Download modules/dsl/ast/DslSequence.class.php
History Sun, 29 May 2022 16:56:40 +0200 Jan Dankert New: DSL with support for functions with return values, full arithmetic, object properties