summaryrefslogtreecommitdiff
path: root/src/Parser/Parser.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Parser/Parser.php')
-rw-r--r--src/Parser/Parser.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/Parser/Parser.php b/src/Parser/Parser.php
index 1ce092c..a3a6839 100644
--- a/src/Parser/Parser.php
+++ b/src/Parser/Parser.php
@@ -294,6 +294,11 @@ class Parser
$this->advance(1);
}
+ else if ($currentToken->type == TokenType::PipePlaceholder) {
+ $currentExpression = new IdentifierNode($currentToken);
+ $this->advance(1);
+ }
+
else if ($currentToken->literal == "(") {
if ($this->getNextToken(2)->literal == ":") {
$currentExpression = $this->parseFunctionDefinition();
@@ -559,9 +564,9 @@ class Parser
$this->advance(1);
}
- /*else if ($currentToken->type == TokenType::Identifier) {
+ else if ($currentToken->type == TokenType::Identifier) {
$body[] = $this->parseFunctionCall();
- }*/
+ }
else {
$error = sprintf("Unexpected %s at %d:%d" . PHP_EOL, $currentToken->value, $currentToken->line, $currentToken->column);
@@ -833,6 +838,11 @@ class NumberNode extends Node
public Token $token,
public int|float $value,
) {}
+
+ public function getValue(): int|float
+ {
+ return $this->value;
+ }
}
class StringNode extends Node
@@ -840,6 +850,11 @@ class StringNode extends Node
public function __construct(
public Token $token,
) {}
+
+ public function getValue(): string
+ {
+ return $this->token->value;
+ }
}
class BoolNode extends Node
@@ -847,6 +862,11 @@ class BoolNode extends Node
public function __construct(
public Token $token,
) {}
+
+ public function getValue(): bool
+ {
+ return filter_var($this->token->value, FILTER_VALIDATE_BOOLEAN);
+ }
}
class CommentNode extends Node