Skip to content

Commit

Permalink
Merge branch 'master' into feature/property-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Apr 17, 2024
2 parents 858951a + f5cc405 commit deb3329
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: PHP ${{ matrix.php-versions }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.php-versions >= '8.3' }}
continue-on-error: ${{ matrix.php-versions >= '8.4' }}
strategy:
fail-fast: false
matrix:
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
os: [ubuntu-latest, windows-latest]

steps:
Expand All @@ -24,7 +24,7 @@ jobs:
run: git config --system core.autocrlf false; git config --system core.eol lf

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
Expand All @@ -40,7 +40,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
11 changes: 11 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ XP AST ChangeLog

## ?.?.? / ????-??-??

## 11.0.1 / 2024-03-24

* Fixed `%=` (modulo-assignment) operator - @thekid

## 11.0.0 / 2024-03-23

* Merged PR #51: Logical Operators and Assignment Expressions - @thekid
* Made this library compatible with XP 12, droppping support for all but
the latest PHP 7 version. Minimum PHP version required is now **7.4**!
(@thekid)

## 10.3.1 / 2024-01-06

* Added PHP 8.4 to the test matrix - @thekid
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ XP AST
[![Build status on GitHub](https://github.com/xp-framework/ast/workflows/Tests/badge.svg)](https://github.com/xp-framework/ast/actions)
[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)
[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)
[![Requires PHP 7.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_0plus.svg)](http://php.net/)
[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)
[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)
[![Latest Stable Version](https://poser.pugx.org/xp-framework/ast/version.png)](https://packagist.org/packages/xp-framework/ast)

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"description" : "AST for the XP Framework",
"keywords": ["module", "xp"],
"require" : {
"xp-framework/core": "^11.0 | ^10.0",
"php" : ">=7.0.0"
"xp-framework/core": "^12.0 | ^11.0 | ^10.0",
"php" : ">=7.4.0"
},
"require-dev" : {
"xp-framework/test": "^1.0"
"xp-framework/test": "^2.0 | ^1.0"
},
"autoload" : {
"files" : ["src/main/php/autoload.php"]
Expand Down
2 changes: 1 addition & 1 deletion src/main/php/lang/ast/Language.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function extensions() {
* @param ?lang.ast.Scope $scope
* @return lang.ast.Parse
*/
public function parse($tokens, Scope $scope= null) {
public function parse($tokens, ?Scope $scope= null) {
return new Parse($this, $tokens, $scope);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/php/lang/ast/Parse.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Parse {
* @param lang.ast.Tokens $tokens
* @param ?lang.ast.Scope $scope
*/
public function __construct($language, $tokens, Scope $scope= null) {
public function __construct($language, $tokens, ?Scope $scope= null) {
$this->language= $language;
$this->tokens= $tokens->iterator($language);
$this->file= $tokens->source;
Expand Down
2 changes: 1 addition & 1 deletion src/main/php/lang/ast/Scope.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Scope {
public $imports= [];
public $types= [];

public function __construct(self $parent= null) {
public function __construct(?self $parent= null) {
$this->parent= $parent;
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/php/lang/ast/Token.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class Token implements Value {
/**
* Creates a new node
*
* @param lang.ast.Symbol $symbol
* @param string $kind
* @param var $value
* @param int $line
* @param ?lang.ast.Symbol $symbol
* @param string $kind
* @param var $value
* @param int $line
*/
public function __construct(Symbol $symbol= null, $kind= null, $value= null, $line= -1) {
public function __construct(?Symbol $symbol= null, $kind= null, $value= null, $line= -1) {
$this->symbol= $symbol;
$this->kind= $kind;
$this->value= $value;
Expand Down
4 changes: 2 additions & 2 deletions src/main/php/lang/ast/Tokens.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Tokens {
'>' => ['>>=', '>=', '>>'],
'=' => ['===', '=>', '=='],
'!' => ['!==', '!='],
'&' => ['&&', '&='],
'|' => ['||', '|='],
'&' => ['&&=', '&&', '&='],
'|' => ['||=', '||', '|='],
'^' => ['^='],
'+' => ['+=', '++'],
'-' => ['-=', '--', '->'],
Expand Down
3 changes: 3 additions & 0 deletions src/main/php/lang/ast/syntax/PHP.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,14 @@ public function __construct() {
$this->assignment('-=');
$this->assignment('*=');
$this->assignment('/=');
$this->assignment('%=');
$this->assignment('.=');
$this->assignment('**=');
$this->assignment('>>=');
$this->assignment('<<=');
$this->assignment('??=');
$this->assignment('&&=');
$this->assignment('||=');

// This is ambiguous:
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function prefix($operator) {
);
}

#[Test, Values(['=', '+=', '-=', '*=', '/=', '.=', '**=', '&=', '|=', '^=', '>>=', '<<='])]
#[Test, Values(['=', '+=', '-=', '*=', '/=', '%=', '.=', '**=', '&=', '|=', '^=', '>>=', '<<=', '??=', '&&=', '||='])]
public function assignment($operator) {
$this->assertParsed(
[new Assignment(new Variable('a', self::LINE), $operator, new Variable('b', self::LINE), self::LINE)],
Expand Down

0 comments on commit deb3329

Please sign in to comment.