diff --git a/src/main/php/lang/ast/Tokens.class.php b/src/main/php/lang/ast/Tokens.class.php index 179b4c7..bc4303a 100755 --- a/src/main/php/lang/ast/Tokens.class.php +++ b/src/main/php/lang/ast/Tokens.class.php @@ -10,7 +10,7 @@ * @test lang.ast.unittest.TokensTest */ class Tokens { - const DELIMITERS = " \r\n\t'\$\"=,;.:?!(){}[]#+-*/|&^@%~<>"; + const DELIMITERS = " \r\n\t'\$\"`=,;.:?!(){}[]#+-*/|&^@%~<>"; const OPERATORS = [ '<' => ['<=>', '<<=', '<=', '<<', '<>', '' => ['>>=', '>=', '>>'], @@ -101,7 +101,7 @@ public function iterator($language) { $line++; } else if ("\r" === $token || "\t" === $token || ' ' === $token) { // Skip over whitespace - } else if ("'" === $token || '"' === $token) { + } else if ("'" === $token || '"' === $token || '`' === $token) { $string= $token; $end= '\\'.$token; do { diff --git a/src/test/php/lang/ast/unittest/parse/LiteralsTest.class.php b/src/test/php/lang/ast/unittest/parse/LiteralsTest.class.php index 3fd0891..1eb9273 100755 --- a/src/test/php/lang/ast/unittest/parse/LiteralsTest.class.php +++ b/src/test/php/lang/ast/unittest/parse/LiteralsTest.class.php @@ -50,6 +50,11 @@ public function non_empty_string() { $this->assertParsed([new Literal('"Test"', self::LINE)], '"Test";'); } + #[Test] + public function exec_statement() { + $this->assertParsed([new Literal('`ls -al`', self::LINE)], '`ls -al`;'); + } + #[Test, Values(['[];', ['array();']])] public function empty_array($declaration) { $this->assertParsed([new ArrayLiteral([], self::LINE)], $declaration);