Skip to content

Commit 5992bfd

Browse files
committed
Fixing up comments and adding source code to debug output
1 parent dec3456 commit 5992bfd

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

src/AstRuntime.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
namespace JmesPath;
33

44
/**
5-
* Default JMESPath runtime environment that uses an external tree visitor to
6-
* interpret an AST.
5+
* Uses an external tree visitor to interpret an AST.
76
*/
87
class AstRuntime
98
{

src/CompilerRuntime.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
namespace JmesPath;
33

44
/**
5-
* JMESPath runtime environment that compiles JMESPath expressions to PHP
6-
* source code.
5+
* Compiles JMESPath expressions to PHP source code and executes it.
76
*
87
* JMESPath filenames are stored in the cache directory using the following
98
* logic to determine the filename:

src/Debugger.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ public function dumpAst($out, $expression)
6060

6161
public function dumpCompiledCode($out, $expression)
6262
{
63+
fwrite($out, "Code\n========\n\n");
6364
$dir = sys_get_temp_dir();
6465
$hash = md5($expression);
6566
$functionName = "jmespath_{$hash}";
6667
$filename = "{$dir}/{$functionName}.php";
68+
fwrite($out, "File: {$filename}\n\n");
6769
fprintf($out, file_get_contents($filename));
6870
}
6971

src/Env.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class Env
1818
private static $runtime;
1919

2020
/**
21-
* Returns data from the input array that matches a given JMESPath expression.
21+
* Returns data from the input array that matches a JMESPath expression.
2222
*
2323
* @param string $expression JMESPath expression to evaluate
2424
* @param mixed $data JSON-like data to search

src/FnDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ private function validate($args, $types = [])
460460
return true;
461461
}
462462

463-
/** @internal */
463+
/** @internal Pass function name validation off to runtime */
464464
public function __call($name, $args)
465465
{
466466
$name = str_replace('fn_', '', $name);

src/Lexer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function tokenize($input)
9696

9797
private function literal($value, $offset, $input)
9898
{
99+
// Handles true, false, null, numbers, quoted strings, "[", and "{"
99100
static $valid = '/(true|false|null)|(^[\["{])|(^\-?[0-9]*(\.[0-9]+)?([e|E][+|\-][0-9]+)?$)/';
100101
$value = str_replace('\\`', '`', ltrim(substr($value, 1, -1)));
101102

0 commit comments

Comments
 (0)