Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match parsing fails #1098

Closed
feamsr00 opened this issue Jan 17, 2023 · 4 comments
Closed

Match parsing fails #1098

feamsr00 opened this issue Jan 17, 2023 · 4 comments

Comments

@feamsr00
Copy link

Hi There!

I'm exploring the port of an application to peachpie, but I'm seeing a lot of syntax error oddities, even though this supports PHP 8?

Example

		$ret = match ($number)
		{
			'10', #here
			'20'	=> 'another value'
		};

(3,8): error PHP2014: Syntax error: unexpected token ','

I believe I'm using the latest PP (whats the fastest way to double check the version?)

@jakubmisek
Copy link
Member

Hi,

The version would be specified in your project file, and you'd see it as the first thing on the commandline when the build starts.

The unexpected "," looks like a bug though

@feamsr00
Copy link
Author

Just to confirm this is a valid bug. A follow up on the version question. I'm seeing a few old version numbers and I just installed PP fresh on this machine this week.

This is the output of dotnet new -i Peachpie.Templates::*

>dotnet new -i Peachpie.Templates::*

Welcome to .NET 7.0!
---------------------
SDK Version: 7.0.102

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Warning: use of 'dotnet new --install' is deprecated. Use 'dotnet new install' instead.
For more information, run:
   dotnet new install -h

The following template packages will be installed:
   Peachpie.Templates::*

Success: Peachpie.Templates::1.0.17 installed the following templates:
Template Name               Short Name  Language  Tags
--------------------------  ----------  --------  ----------------------
ASP.NET Core Empty          web         PHP       Web/Empty
Class library               classlib    PHP       Common/Library
Console Application         console     PHP       Common/Console
PHP Blazor WebAssembly App  blazorwasm  PHP       Web/Blazor/WebAssembly
PHP WebAssembly App         phpwasm     PHP       Web/Blazor/WebAssembly


>

The generated .msbuildproj has <Project Sdk="Peachpie.NET.Sdk/1.0.6"> as its first line.

dotnet run isn't informative:

C:\dev\projects\science\pp>dotnet run
C:\exec\ScoopApps\apps\dotnet-sdk\current\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framewor
k 'net5.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support p
olicy. [C:\dev\projects\science\pp\pp.msbuildproj]
C:\exec\ScoopApps\apps\dotnet-sdk\current\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framewor
k 'net5.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support p
olicy. [C:\dev\projects\science\pp\pp.msbuildproj]
C:\exec\ScoopApps\apps\dotnet-sdk\current\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framewor
k 'net5.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support p
olicy. [C:\dev\projects\science\pp\pp.msbuildproj]
C:\dev\projects\science\pp\matchtest.php(23,8): error PHP2014: Syntax error: unexpected token ',' [C:\dev\projects\science\pp\pp.
msbuildproj]

The build failed. Fix the build errors and run again.

1.0.6 and 1.0.17 are both well behind 1.1.3. Whats the best way to check the version of the PeachPie compiler?

@jakubmisek
Copy link
Member

the version is 1.0.6, not sure why it installed an older version - I'll try that ..

Anyways, there is output with your version upon running dotnet build

@jakubmisek
Copy link
Member

match syntax error fixed; new release will be prepared soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants