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

Last commit: Wed Jun 1 00:11:40 2022 +0200	Jan Dankert	New: DSL as a filter for number values
1 <?php 2 3 namespace dsl\ast; 4 5 class DslIf implements DslStatement 6 { 7 8 /** 9 * Expression for the condition 10 * @var DslExpression 11 */ 12 private $condition; 13 14 /** 15 * @var DslStatementList 16 */ 17 private $pos; 18 19 /** 20 * @var DslStatementList 21 */ 22 private $neg; 23 24 public function execute( & $context ) { 25 26 $conditionValue = $this->condition->execute( $context ); 27 28 if ( $conditionValue ) 29 return $this->pos->execute( $context ); 30 else 31 return $this->neg->execute( $context ); 32 } 33 34 public function __construct( $condition, $positive,$negative ) { 35 $this->condition = new DslExpression( $condition ); 36 $this->pos = new DslStatementList( $positive ); 37 $this->neg = new DslStatementList( $negative ); 38 } 39 40 public function parse($tokens) 41 { 42 } 43 }
Download modules/dsl/ast/DslIf.class.php
History Wed, 1 Jun 2022 00:11:40 +0200 Jan Dankert New: DSL as a filter for number values Sat, 28 May 2022 18:00:13 +0200 Jan Dankert New: DSL with a much better syntax parsing and support for assignments, conditions, ... Wed, 25 May 2022 22:47:17 +0200 Jan Dankert New: DSL (domain specific language) for code elements. The old way with PHP code ist not sandboxed and unsecure. This approach is a minimalistic, javascript-like, scripting engine. For now only simple function calls are possible, for example: alert("example");