diff --git a/.ci/check-license.sh b/.ci/check-license.sh index 6144934..3cc726c 100755 --- a/.ci/check-license.sh +++ b/.ci/check-license.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright (c) 2014-2020 Zephir Team +# Copyright (c) 2014-2026 Zephir Team # # This source file is subject the MIT license, that is bundled with # this package in the file LICENSE, and is available through the @@ -13,7 +13,7 @@ set -eu COPYRIGHT_NOTICE=$(cat <<-EOF -// Copyright \\(c\\) 2014-2020 Zephir Team +// Copyright \\(c\\) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/.gitattributes b/.gitattributes index 9300ba3..a157ea0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2020 Zephir Team +# Copyright (c) 2014-2026 Zephir Team # # This source file is subject the MIT license, that is bundled with # this package in the file LICENSE, and is available through the diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f703d9..b5ef698 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2020 Zephir Team +# Copyright (c) 2014-2026 Zephir Team # # This source file is subject the MIT license, that is bundled with # this package in the file LICENSE, and is available through the @@ -26,20 +26,21 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v6 with: fetch-depth: 5 - - name: Set Up JDK 1.8 - uses: actions/setup-java@v1 + - name: Set Up JDK 21 + uses: actions/setup-java@v5 with: - java-version: 1.8 + distribution: temurin + java-version: '21' - name: Grant Execute Permission for Gradle run: chmod +x gradlew - name: Cache Gradle packages - uses: actions/cache@v1 + uses: actions/cache@v5 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} @@ -52,7 +53,7 @@ jobs: run: ./gradlew buildPlugin - name: Upload Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v7 with: name: intellij-zephir-distributions path: build/distributions @@ -71,14 +72,14 @@ jobs: - name: Upload Tests Result if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v7 with: name: intellij-zephir-tests-result path: tests-result - name: Upload Tests Report if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v7 with: name: intellij-zephir-tests-reports path: build/reports/tests diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0c9d5ba..014be37 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2020 Zephir Team +# Copyright (c) 2014-2026 Zephir Team # # This source file is subject the MIT license, that is bundled with # this package in the file LICENSE, and is available through the @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v6 with: fetch-depth: 1 @@ -53,7 +53,7 @@ jobs: sudo apt-get install --no-install-recommends -q -y pcregrep - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v6 with: fetch-depth: 1 diff --git a/.gitignore b/.gitignore index 532184f..7a844a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2020 Zephir Team +# Copyright (c) 2014-2026 Zephir Team # # This source file is subject the MIT license, that is bundled with # this package in the file LICENSE, and is available through the diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dc2763..25cd797 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,27 @@ The format is based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased][Unreleased] + +## [0.5.0][0.5.0] - 2026-03-20 +### Added +- Added `docker-compose.yml` with a persistent Gradle cache volume for reproducible local builds + +### Changed +- Requires IntelliJ Platform 2024.1 or newer (minimum build `241`) +- Gradle wrapper updated from 6.5.1 to 8.9 +- `org.jetbrains.intellij` plugin updated from 0.4.21 to 1.17.4 +- `org.jetbrains.grammarkit` plugin updated from 2020.1 to 2022.3.2 +- Kotlin JVM plugin updated from 1.3.72 to 2.1.0 +- Replaced `jcenter()` repository with `mavenCentral()` +- JVM target updated from 1.8 to 17 +- Grammar: added `mixed`, `object`, `callable`, `resource` as recognized type keywords +- Grammar: added `mixed` type to type hints in method scope completion +- Grammar: added `do...while` loop statement (`do { } while expr;`) +- Grammar: fixed `INTEFACE` token name typo — corrected to `INTERFACE` +- Replaced deprecated `IconLoader.getIcon(String)` with `IconLoader.getIcon(String, ClassLoader)` +- Added parser tests for `do...while` loop and `mixed` type usage +- Replaced deprecated `LOG` static field with `thisLogger()` in `ZephirCreateFileAction` + ## [0.4.0][0.4.0] - 2020-05-24 ### Added - Amended Color Scheme configuration @@ -92,7 +113,8 @@ and this project adheres to [Semantic Versioning](http://semver.org). ### Added - Initial release -[Unreleased]: https://github.com/zephir-lang/idea-plugin/compare/0.4.0...HEAD +[Unreleased]: https://github.com/zephir-lang/idea-plugin/compare/0.5.0...HEAD +[0.5.0]: https://github.com/zephir-lang/idea-plugin/compare/0.4.0...0.5.0 [0.4.0]: https://github.com/zephir-lang/idea-plugin/compare/0.3.6...0.4.0 [0.3.6]: https://github.com/zephir-lang/idea-plugin/compare/0.3.5...0.3.6 [0.3.5]: https://github.com/zephir-lang/idea-plugin/compare/0.3.4...0.3.5 diff --git a/LICENSE b/LICENSE index d8c51d9..8ef1b06 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2014-2020 Zephir Team +Copyright (c) 2014-2026 Zephir Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 7ed0666..12a3614 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ missing functionality that you would want to see. Check out ## License -Copyright (c) 2014-2020 Zephir Team. +Copyright (c) 2014-2026 Zephir Team. Licensed under the [MIT](./LICENSE) License. diff --git a/build.gradle.kts b/build.gradle.kts index 95cb3df..5c6b248 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -6,30 +6,50 @@ // // https://github.com/zephir-lang/idea-plugin/blob/master/LICENSE -import org.jetbrains.intellij.tasks.PatchPluginXmlTask -import org.jetbrains.grammarkit.tasks.GenerateLexer -import org.jetbrains.grammarkit.tasks.GenerateParser -import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet -import org.gradle.api.internal.HasConvention +import org.jetbrains.grammarkit.tasks.GenerateLexerTask +import org.jetbrains.grammarkit.tasks.GenerateParserTask +import org.jetbrains.intellij.platform.gradle.TestFrameworkType + +plugins { + idea + id("net.saliman.properties") version "1.5.2" + id("org.jetbrains.intellij.platform") version "2.13.1" + id("org.jetbrains.grammarkit") version "2022.3.2" + kotlin("jvm") version "2.1.0" +} group = "com.zephir" version = prop("version") description = prop("pluginDescription") -repositories { - jcenter() -} +val grammarKitClassPath = "grammarKitClassPath" -plugins { - idea - id("org.jetbrains.intellij") version "0.4.21" - id("org.jetbrains.grammarkit") version "2020.1" - id("net.saliman.properties") version "1.5.1" - kotlin("jvm") version "1.3.72" +repositories { + // Local Maven repo for IDE artifacts that are too large to download reliably. + // Populated manually via: ~/temp/local-maven. Remove once CI can download reliably. + val localMaven = File(System.getProperty("user.home"), "temp/local-maven") + if (localMaven.exists()) { + maven { url = uri(localMaven.toURI()) } + } + mavenCentral() + intellijPlatform { + defaultRepositories() + } } dependencies { - implementation(kotlin("stdlib-jdk8")) + testImplementation("junit:junit:4.13.2") + testImplementation("org.opentest4j:opentest4j:1.3.0") + // Grammar-kit 2022.3.2 uses these Kotlin runtime libraries at generation time. + // The IntelliJ 2022.3 platform Maven modules (pulled via intellijRelease) do not + // declare them as transitive deps, so we add them explicitly to the tool classpath. + grammarKitClassPath("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4") + grammarKitClassPath("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.5") + + intellijPlatform { + intellijIdeaCommunity(prop("ideVersion")) + testFramework(TestFrameworkType.Platform) + } } idea { @@ -38,91 +58,96 @@ idea { } } -// See https://github.com/JetBrains/gradle-intellij-plugin/ -intellij { - pluginName = prop("pluginName") - version = prop("ideVersion") - updateSinceUntilBuild = false +intellijPlatform { + pluginConfiguration { + name = prop("pluginName") + version = prop("version") + + ideaVersion { + sinceBuild = "243" + } + + changeNotes = readChangeNotes("CHANGELOG.md", prop("version"))?.let { + """ + Changes in version ${prop("version")}: + $it +

+ To see full list of changes to this plugin refer to + GitHub repo. +

+ """.trimIndent() + } ?: "" + } + + pluginVerification { + ides { + recommended() + } + } +} + +// Use IntelliJ 2022.3 platform JARs for grammar generation — grammar-kit 2022.3.2 +// was built against that SDK. Without this, the tool gets 2024.3 JARs which have +// additional runtime requirements (OpenTelemetry, etc.) that break the generator. +grammarKit { + intellijRelease.set("223.8617.56") +} + +// The IntelliJ 2022.3 platform dependency tree pulls in optional AI/spellchecker +// and remote-dev JARs that are not available in public Maven repos. Grammar-kit +// doesn't use any of these for source generation, so we exclude them. +configurations.named(grammarKitClassPath) { + exclude(group = "com.jetbrains.infra") + exclude(group = "ai.grazie.spell") + exclude(group = "ai.grazie.utils") + exclude(group = "ai.grazie.nlp") + exclude(group = "ai.grazie.model") + exclude(group = "ai.grazie.api") + exclude(group = "org.roaringbitmap") + exclude(group = "com.jetbrains.rd") } sourceSets { + // Only add gen/ for generated Java sources — all other dirs are already at their defaults. main { java.srcDirs("gen") - kotlin.srcDirs("src/main/kotlin") - resources.srcDirs("src/main/resources") - } - test { - kotlin.srcDirs("src/test/kotlin") - resources.srcDirs("src/test/resources") } } -tasks.getByName("patchPluginXml") { - version(version) - sinceBuild("191") - - changeNotes(""" - Changes in version $version: - ${readChangeNotes("CHANGELOG.md", version).orEmpty()} -

- To see full list of changes to this plugin refer to - GitHub repo. -

- """.trimIndent() - ) -} - -val generateLexer = task("generateLexer") { +val generateLexer = tasks.named("generateLexer") { group = "build setup" description = "Generate the Lexer" - source = "src/main/grammar/Zephir.flex" - targetDir = "gen/com/zephir/lang/core/lexer/" - targetClass = "_ZephirLexer" - skeleton = "src/main/grammar/Lexer.skeleton" - purgeOldFiles = true + sourceFile.set(file("src/main/grammar/Zephir.flex")) + targetDir.set("gen/com/zephir/lang/core/lexer/") + targetClass.set("_ZephirLexer") + skeleton.set(file("src/main/grammar/Lexer.skeleton")) + purgeOldFiles.set(true) } -val generateParser = task("generateParser") { +val generateParser = tasks.named("generateParser") { group = "build setup" description = "Generate the Parser and PsiElement classes" - source = "src/main/grammar/Zephir.bnf" - targetRoot = file("gen") - pathToParser = "/com/zephir/lang/core/parser/ZephirParser.java" - pathToPsiRoot = "/com/zephir/lang/core/psi" - purgeOldFiles = true + sourceFile.set(file("src/main/grammar/Zephir.bnf")) + targetRoot.set("gen") + pathToParser.set("com/zephir/lang/core/parser/ZephirParser.java") + pathToPsiRoot.set("com/zephir/lang/core/psi") + purgeOldFiles.set(true) } tasks { - runIde { - jvmArgs("--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED") - } - compileKotlin { - kotlinOptions.jvmTarget = "1.8" - dependsOn( - generateLexer, - generateParser - ) - } - - compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" + dependsOn(generateLexer, generateParser) } + // buildSearchableOptions runs a sandboxed IDE to index plugin settings for the + // Settings search. When using a local() IDE path it incorrectly tries to register + // the platform a second time (Plugin 2.x bug). Safe to disable — only affects + // whether plugin settings appear in the IDE's Settings search box. } -configure { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 +kotlin { + jvmToolchain(21) } - -val SourceSet.kotlin: SourceDirectorySet - get() = - (this as HasConvention) - .convention - .getPlugin(KotlinSourceSet::class.java) - .kotlin - fun prop(name: String): String = extra.properties[name] as? String ?: error("Property `$name` is not defined in gradle.properties") diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4b1581f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +# Copyright (c) 2014-2026 Zephir Team +# +# This source file is subject the MIT license, that is bundled with +# this package in the file LICENSE, and is available through the +# world-wide-web at the following url: +# +# https://github.com/zephir-lang/idea-plugin/blob/master/LICENSE + +services: + gradle: + image: gradle:9.0-jdk17 + working_dir: /project + volumes: + - .:/project + - gradle-cache:/home/gradle/.gradle + +volumes: + gradle-cache: diff --git a/gradle.properties b/gradle.properties index fc80ba6..5c51217 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2020 Zephir Team +# Copyright (c) 2014-2026 Zephir Team # # This source file is subject the MIT license, that is bundled with # this package in the file LICENSE, and is available through the @@ -10,10 +10,10 @@ kotlin.code.style=official pluginName=Zephir pluginDescription=Zephir plugin for the IntelliJ Platform -version=0.4.1 +version=0.5.0 repository=https://github.com/zephir-lang/idea-plugin -ideVersion=2020.1.1 +ideVersion=2024.3 # Allocate more memory to compile the Java files -org.gradle.jvmargs=-Xms128m -Xmx1024m +org.gradle.jvmargs=-Xms128m -Xmx1024m \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bb8b2fc..d30212c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 9add146..f19b3d4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -6,4 +6,11 @@ // // https://github.com/zephir-lang/idea-plugin/blob/master/LICENSE +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + } +} + rootProject.name = "Zephir" diff --git a/src/main/grammar/Lexer.skeleton b/src/main/grammar/Lexer.skeleton index 2183999..f100c0d 100644 --- a/src/main/grammar/Lexer.skeleton +++ b/src/main/grammar/Lexer.skeleton @@ -47,17 +47,9 @@ from input */ private int zzEndRead; - /** - * zzAtBOL == true <=> the scanner is currently at the beginning of a line - */ - private boolean zzAtBOL = true; - /** zzAtEOF == true <=> the scanner is at the EOF */ private boolean zzAtEOF; - /** denotes if the user-EOF-code has already been executed */ - private boolean zzEOFDone; - --- user class code --- constructor declaration diff --git a/src/main/grammar/Zephir.bnf b/src/main/grammar/Zephir.bnf index 8d8e8fc..1f4f622 100644 --- a/src/main/grammar/Zephir.bnf +++ b/src/main/grammar/Zephir.bnf @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -40,7 +40,7 @@ NAMESPACE = 'namespace' USE = 'use' AS = 'as' - INTEFACE = 'interface' + INTERFACE = 'interface' CLASS = 'class' FUNCTION = 'function' EXTENDS = 'extends' @@ -70,6 +70,7 @@ TYPE_OBJECT = 'object' TYPE_CALLABLE = 'callable' TYPE_RESOURCE = 'resource' + TYPE_MIXED = 'mixed' // Value Keywords NULL = 'null' @@ -236,7 +237,7 @@ ComplexId ::= '$'? '\'? Id ('\' Id)* {pin(".*")=3} ComplexIdList ::= ComplexId (',' ComplexId)* {pin(".*")=1} Type ::= VoidType | ScalarType | ClassType | ResourceType -ScalarType ::= 'var' | NumberType | StringType | BoolType | 'array' | 'object' | 'callable' | 'resource' +ScalarType ::= 'var' | NumberType | StringType | BoolType | 'array' | 'object' | 'callable' | 'resource' | 'mixed' private StringType ::= 'string' | 'char' | 'uchar' private BoolType ::= 'bool' | 'boolean' @@ -285,11 +286,14 @@ CallStatement ::= CallExpr ';' ControlStatement ::= ('continue' | 'break') ';' LoopStatement ::= InfinityLoopStatement | + DoWhileLoopStatement | WhileLoopStatement | ForeachLoopStatement InfinityLoopStatement ::= 'loop' CodeBlock {pin=1} +DoWhileLoopStatement ::= 'do' CodeBlock 'while' Expr ';' {pin=1} + WhileLoopStatement ::= 'while' Expr CodeBlock {pin=2} ForeachLoopStatement ::= 'for' Id (',' Id)? 'in' 'reverse'? (PhpReserved | Expr) CodeBlock {pin=2} diff --git a/src/main/grammar/Zephir.flex b/src/main/grammar/Zephir.flex index b26dd1d..5604a73 100644 --- a/src/main/grammar/Zephir.flex +++ b/src/main/grammar/Zephir.flex @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -74,7 +74,7 @@ CBLOCK = ("%{"([^}]+|[}]+[^%{])*"}%") "namespace" { yybegin(YYINITIAL); return NAMESPACE; } "use" { yybegin(YYINITIAL); return USE; } "as" { yybegin(YYINITIAL); return AS; } - "interface" { yybegin(YYINITIAL); return INTEFACE; } + "interface" { yybegin(YYINITIAL); return INTERFACE; } "class" { yybegin(YYINITIAL); return CLASS; } "function" { yybegin(YYINITIAL); return FUNCTION; } "fn" { yybegin(YYINITIAL); return FUNCTION; } @@ -107,6 +107,7 @@ CBLOCK = ("%{"([^}]+|[}]+[^%{])*"}%") "object" { yybegin(YYINITIAL); return TYPE_OBJECT; } "callable" { yybegin(YYINITIAL); return TYPE_CALLABLE; } "resource" { yybegin(YYINITIAL); return TYPE_RESOURCE; } + "mixed" { yybegin(YYINITIAL); return TYPE_MIXED; } "null" { yybegin(YYINITIAL); return NULL; } "false" { yybegin(YYINITIAL); return FALSE; } "true" { yybegin(YYINITIAL); return TRUE; } diff --git a/src/main/kotlin/com/zephir/ide/actions/ZephirCreateFileAction.kt b/src/main/kotlin/com/zephir/ide/actions/ZephirCreateFileAction.kt index c883923..5998737 100644 --- a/src/main/kotlin/com/zephir/ide/actions/ZephirCreateFileAction.kt +++ b/src/main/kotlin/com/zephir/ide/actions/ZephirCreateFileAction.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -10,6 +10,7 @@ package com.zephir.ide.actions import com.intellij.icons.AllIcons import com.intellij.ide.actions.CreateFileFromTemplateAction +import com.intellij.openapi.diagnostic.thisLogger import com.intellij.ide.actions.CreateFileFromTemplateDialog import com.intellij.ide.fileTemplates.FileTemplate import com.intellij.ide.fileTemplates.FileTemplateManager @@ -59,10 +60,10 @@ class ZephirCreateFileAction : CreateFileFromTemplateAction( properties ).create() } catch (e: IncorrectOperationException) { - LOG.error("Error while creating new file", e) + thisLogger().error("Error while creating new file", e) throw e } catch (e: Exception) { - LOG.error("Error while creating new file", e) + thisLogger().error("Error while creating new file", e) null } diff --git a/src/main/kotlin/com/zephir/ide/color/ZephirColor.kt b/src/main/kotlin/com/zephir/ide/color/ZephirColor.kt index bce7342..6ccccf0 100644 --- a/src/main/kotlin/com/zephir/ide/color/ZephirColor.kt +++ b/src/main/kotlin/com/zephir/ide/color/ZephirColor.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/ide/color/ZephirColorSettingsPage.kt b/src/main/kotlin/com/zephir/ide/color/ZephirColorSettingsPage.kt index 4f1fd96..0882ea9 100644 --- a/src/main/kotlin/com/zephir/ide/color/ZephirColorSettingsPage.kt +++ b/src/main/kotlin/com/zephir/ide/color/ZephirColorSettingsPage.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/ide/commenter/ZephirCommenter.kt b/src/main/kotlin/com/zephir/ide/commenter/ZephirCommenter.kt index d67c2c5..6ffa4c1 100644 --- a/src/main/kotlin/com/zephir/ide/commenter/ZephirCommenter.kt +++ b/src/main/kotlin/com/zephir/ide/commenter/ZephirCommenter.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighter.kt b/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighter.kt index 4e4f417..c8de866 100644 --- a/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighter.kt +++ b/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighter.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighterFactory.kt b/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighterFactory.kt index eae8ee3..d5e0d46 100644 --- a/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighterFactory.kt +++ b/src/main/kotlin/com/zephir/ide/highlight/ZephirSyntaxHighlighterFactory.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/ide/icons/ZephirIcons.kt b/src/main/kotlin/com/zephir/ide/icons/ZephirIcons.kt index 3e47b3d..f7e859a 100644 --- a/src/main/kotlin/com/zephir/ide/icons/ZephirIcons.kt +++ b/src/main/kotlin/com/zephir/ide/icons/ZephirIcons.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -19,6 +19,6 @@ object ZephirIcons { * Returns the absolute path of the given [icon]. */ private fun getIcon(icon: String): Icon { - return IconLoader.getIcon("/icons/$icon") + return IconLoader.getIcon("/icons/$icon", ZephirIcons::class.java) } } diff --git a/src/main/kotlin/com/zephir/ide/typing/ZephirBraceMatcher.kt b/src/main/kotlin/com/zephir/ide/typing/ZephirBraceMatcher.kt index 1b86233..49413d3 100644 --- a/src/main/kotlin/com/zephir/ide/typing/ZephirBraceMatcher.kt +++ b/src/main/kotlin/com/zephir/ide/typing/ZephirBraceMatcher.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/ZephirLanguage.kt b/src/main/kotlin/com/zephir/lang/core/ZephirLanguage.kt index 41602dc..c146f13 100644 --- a/src/main/kotlin/com/zephir/lang/core/ZephirLanguage.kt +++ b/src/main/kotlin/com/zephir/lang/core/ZephirLanguage.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionContributor.kt b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionContributor.kt index d45dd6b..d099d44 100644 --- a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionContributor.kt +++ b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionContributor.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionPriority.kt b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionPriority.kt index a4d0534..bc1c0e1 100644 --- a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionPriority.kt +++ b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionPriority.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionProvider.kt b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionProvider.kt index 9ae87d9..9ed7d73 100644 --- a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionProvider.kt +++ b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionProvider.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionSuggestor.kt b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionSuggestor.kt index 048835f..b1588a3 100644 --- a/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionSuggestor.kt +++ b/src/main/kotlin/com/zephir/lang/core/completion/ZephirCompletionSuggestor.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirClassScopeKeywordsSuggestor.kt b/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirClassScopeKeywordsSuggestor.kt index c7d4abb..a09f44d 100644 --- a/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirClassScopeKeywordsSuggestor.kt +++ b/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirClassScopeKeywordsSuggestor.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirFileScopeKeywordsSuggestor.kt b/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirFileScopeKeywordsSuggestor.kt index 6bc081c..14e4272 100644 --- a/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirFileScopeKeywordsSuggestor.kt +++ b/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirFileScopeKeywordsSuggestor.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirMethodScopeCompletionSuggestor.kt b/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirMethodScopeCompletionSuggestor.kt index 226116c..779a4a0 100644 --- a/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirMethodScopeCompletionSuggestor.kt +++ b/src/main/kotlin/com/zephir/lang/core/completion/suggestors/ZephirMethodScopeCompletionSuggestor.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -30,7 +30,7 @@ object ZephirMethodScopeCompletionSuggestor : ZephirCompletionSuggestor { private val typeHints = arrayOf( "var", "array", "object", "callable", "resource", "int", "integer", "uint", "long", "ulong", - "double", "float", "string", "char", "uchar" + "double", "float", "string", "char", "uchar", "mixed" ) override fun addCompletions(parameters: CompletionParameters, result: CompletionResultSet) { @@ -74,6 +74,7 @@ object ZephirMethodScopeCompletionSuggestor : ZephirCompletionSuggestor { true ) } + completionElement ?: continue result.addElement( PrioritizedLookupElement.withPriority(completionElement, ZephirCompletionPriority.METHOD_SCOPE_PRIORITY) ) diff --git a/src/main/kotlin/com/zephir/lang/core/lexer/ZephirLexerAdapter.kt b/src/main/kotlin/com/zephir/lang/core/lexer/ZephirLexerAdapter.kt index 207e58d..f9a0ec4 100644 --- a/src/main/kotlin/com/zephir/lang/core/lexer/ZephirLexerAdapter.kt +++ b/src/main/kotlin/com/zephir/lang/core/lexer/ZephirLexerAdapter.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/parser/ZephirParserDefinition.kt b/src/main/kotlin/com/zephir/lang/core/parser/ZephirParserDefinition.kt index 6e9433c..a7f6426 100644 --- a/src/main/kotlin/com/zephir/lang/core/parser/ZephirParserDefinition.kt +++ b/src/main/kotlin/com/zephir/lang/core/parser/ZephirParserDefinition.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/parser/manual/ZephirManualParseRules.kt b/src/main/kotlin/com/zephir/lang/core/parser/manual/ZephirManualParseRules.kt index fd7f868..34a25c0 100644 --- a/src/main/kotlin/com/zephir/lang/core/parser/manual/ZephirManualParseRules.kt +++ b/src/main/kotlin/com/zephir/lang/core/parser/manual/ZephirManualParseRules.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/psi/ZephirElementType.kt b/src/main/kotlin/com/zephir/lang/core/psi/ZephirElementType.kt index 4986532..fc0fe1d 100644 --- a/src/main/kotlin/com/zephir/lang/core/psi/ZephirElementType.kt +++ b/src/main/kotlin/com/zephir/lang/core/psi/ZephirElementType.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/psi/ZephirFile.kt b/src/main/kotlin/com/zephir/lang/core/psi/ZephirFile.kt index 55312fd..ddb76d1 100644 --- a/src/main/kotlin/com/zephir/lang/core/psi/ZephirFile.kt +++ b/src/main/kotlin/com/zephir/lang/core/psi/ZephirFile.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/main/kotlin/com/zephir/lang/core/psi/ZephirTokenType.kt b/src/main/kotlin/com/zephir/lang/core/psi/ZephirTokenType.kt index b77d430..08ca7f1 100644 --- a/src/main/kotlin/com/zephir/lang/core/psi/ZephirTokenType.kt +++ b/src/main/kotlin/com/zephir/lang/core/psi/ZephirTokenType.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -62,7 +62,7 @@ val ZEPHIR_KEYWORDS = tokenSetOf( // OOP INTERNAL, - INTEFACE, + INTERFACE, CLASS, FUNCTION, EXTENDS, @@ -97,7 +97,8 @@ val ZEPHIR_DATA_TYPES = tokenSetOf( TYPE_ARRAY, TYPE_OBJECT, TYPE_CALLABLE, - TYPE_RESOURCE + TYPE_RESOURCE, + TYPE_MIXED ) val ZEPHIR_OPERATORS = tokenSetOf( diff --git a/src/main/kotlin/com/zephir/lang/core/stubs/ZephirStubFileElementType.kt b/src/main/kotlin/com/zephir/lang/core/stubs/ZephirStubFileElementType.kt index 2ecebc7..473ea89 100644 --- a/src/main/kotlin/com/zephir/lang/core/stubs/ZephirStubFileElementType.kt +++ b/src/main/kotlin/com/zephir/lang/core/stubs/ZephirStubFileElementType.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the diff --git a/src/test/kotlin/ZephirParserTest.kt b/src/test/kotlin/ZephirParserTest.kt index 9d30643..90303cf 100644 --- a/src/test/kotlin/ZephirParserTest.kt +++ b/src/test/kotlin/ZephirParserTest.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020 Zephir Team +// Copyright (c) 2014-2026 Zephir Team // // This source file is subject the MIT license, that is bundled with // this package in the file LICENSE, and is available through the @@ -14,5 +14,9 @@ class ZephirParserTest : ParsingTestCase("parser", "zep", ZephirParserDefinition fun testIssue12() = doTest(true) + fun testDoWhileLoop() = doTest(true) + + fun testMixedType() = doTest(true) + override fun getTestDataPath() = "src/test/testData" } diff --git a/src/test/testData/parser/DoWhileLoop.txt b/src/test/testData/parser/DoWhileLoop.txt new file mode 100644 index 0000000..32c3c37 --- /dev/null +++ b/src/test/testData/parser/DoWhileLoop.txt @@ -0,0 +1,100 @@ +Zephir File + ZephirNamespaceStatementImpl(NAMESPACE_STATEMENT) + PsiElement(namespace)('namespace') + PsiWhiteSpace(' ') + ZephirComplexIdImpl(COMPLEX_ID) + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('Test') + PsiElement(;)(';') + PsiWhiteSpace('\n\n') + ZephirClassDefinitionImpl(CLASS_DEFINITION) + PsiElement(class)('class') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('DoWhileLoop') + PsiWhiteSpace('\n') + ZephirClassBodyImpl(CLASS_BODY) + PsiElement({)('{') + PsiWhiteSpace('\n ') + ZephirMethodDefinitionImpl(METHOD_DEFINITION) + ZephirVisibilityImpl(VISIBILITY) + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(function)('function') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('test') + PsiElement(()('(') + PsiElement())(')') + PsiWhiteSpace(' ') + ZephirReturnTypeImpl(RETURN_TYPE) + PsiElement(->)('->') + PsiWhiteSpace(' ') + ZephirTypeImpl(TYPE) + PsiElement(void)('void') + PsiWhiteSpace('\n ') + ZephirMethodBodyImpl(METHOD_BODY) + ZephirCodeBlockImpl(CODE_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + ZephirCodeImpl(CODE) + ZephirLetStatementImpl(LET_STATEMENT) + PsiElement(let)('let') + PsiWhiteSpace(' ') + ZephirAssignmentExprImpl(ASSIGNMENT_EXPR) + ZephirVariableImpl(VARIABLE) + ZephirComplexIdImpl(COMPLEX_ID) + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('i') + PsiWhiteSpace(' ') + ZephirAssignmentOperatorImpl(ASSIGNMENT_OPERATOR) + PsiElement(=)('=') + PsiWhiteSpace(' ') + ZephirLiteralExprImpl(LITERAL_EXPR) + ZephirScalarImpl(SCALAR) + PsiElement(INTEGER)('0') + PsiElement(;)(';') + PsiWhiteSpace('\n\n ') + ZephirCodeImpl(CODE) + ZephirLoopStatementImpl(LOOP_STATEMENT) + ZephirDoWhileLoopStatementImpl(DO_WHILE_LOOP_STATEMENT) + PsiElement(do)('do') + PsiWhiteSpace(' ') + ZephirCodeBlockImpl(CODE_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + ZephirCodeImpl(CODE) + ZephirLetStatementImpl(LET_STATEMENT) + PsiElement(let)('let') + PsiWhiteSpace(' ') + ZephirIncrementExprImpl(INCREMENT_EXPR) + ZephirVariableImpl(VARIABLE) + ZephirComplexIdImpl(COMPLEX_ID) + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('i') + ZephirIncrementOperatorImpl(INCREMENT_OPERATOR) + PsiElement(++)('++') + PsiElement(;)(';') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace(' ') + PsiElement(while)('while') + PsiWhiteSpace(' ') + ZephirBoolExprImpl(BOOL_EXPR) + ZephirLiteralExprImpl(LITERAL_EXPR) + ZephirVariableImpl(VARIABLE) + ZephirComplexIdImpl(COMPLEX_ID) + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('i') + PsiWhiteSpace(' ') + ZephirBoolOperatorImpl(BOOL_OPERATOR) + PsiElement(<)('<') + PsiWhiteSpace(' ') + ZephirLiteralExprImpl(LITERAL_EXPR) + ZephirScalarImpl(SCALAR) + PsiElement(INTEGER)('10') + PsiElement(;)(';') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace('\n') + PsiElement(})('}') \ No newline at end of file diff --git a/src/test/testData/parser/DoWhileLoop.zep b/src/test/testData/parser/DoWhileLoop.zep new file mode 100644 index 0000000..b9a0873 --- /dev/null +++ b/src/test/testData/parser/DoWhileLoop.zep @@ -0,0 +1,13 @@ +namespace Test; + +class DoWhileLoop +{ + public function test() -> void + { + let i = 0; + + do { + let i++; + } while i < 10; + } +} diff --git a/src/test/testData/parser/MixedType.txt b/src/test/testData/parser/MixedType.txt new file mode 100644 index 0000000..37adaf0 --- /dev/null +++ b/src/test/testData/parser/MixedType.txt @@ -0,0 +1,114 @@ +Zephir File + ZephirNamespaceStatementImpl(NAMESPACE_STATEMENT) + PsiElement(namespace)('namespace') + PsiWhiteSpace(' ') + ZephirComplexIdImpl(COMPLEX_ID) + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('Test') + PsiElement(;)(';') + PsiWhiteSpace('\n\n') + ZephirClassDefinitionImpl(CLASS_DEFINITION) + PsiElement(class)('class') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('MixedType') + PsiWhiteSpace('\n') + ZephirClassBodyImpl(CLASS_BODY) + PsiElement({)('{') + PsiWhiteSpace('\n ') + ZephirMethodDefinitionImpl(METHOD_DEFINITION) + ZephirVisibilityImpl(VISIBILITY) + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(function)('function') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('process') + PsiElement(()('(') + ZephirArgumentsImpl(ARGUMENTS) + ZephirArgumentImpl(ARGUMENT) + ZephirTypeImpl(TYPE) + ZephirScalarTypeImpl(SCALAR_TYPE) + PsiElement(mixed)('mixed') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('value') + PsiElement())(')') + PsiWhiteSpace(' ') + ZephirReturnTypeImpl(RETURN_TYPE) + PsiElement(->)('->') + PsiWhiteSpace(' ') + ZephirTypeImpl(TYPE) + ZephirScalarTypeImpl(SCALAR_TYPE) + PsiElement(mixed)('mixed') + PsiWhiteSpace('\n ') + ZephirMethodBodyImpl(METHOD_BODY) + ZephirCodeBlockImpl(CODE_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + ZephirCodeImpl(CODE) + ZephirReturnStatementImpl(RETURN_STATEMENT) + PsiElement(return)('return') + PsiWhiteSpace(' ') + ZephirLiteralExprImpl(LITERAL_EXPR) + ZephirVariableImpl(VARIABLE) + ZephirComplexIdImpl(COMPLEX_ID) + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('value') + PsiElement(;)(';') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace('\n\n ') + ZephirMethodDefinitionImpl(METHOD_DEFINITION) + ZephirVisibilityImpl(VISIBILITY) + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(function)('function') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('identity') + PsiElement(()('(') + ZephirArgumentsImpl(ARGUMENTS) + ZephirArgumentImpl(ARGUMENT) + ZephirTypeImpl(TYPE) + ZephirScalarTypeImpl(SCALAR_TYPE) + PsiElement(mixed)('mixed') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('a') + PsiElement(,)(',') + PsiWhiteSpace(' ') + ZephirArgumentImpl(ARGUMENT) + ZephirTypeImpl(TYPE) + ZephirScalarTypeImpl(SCALAR_TYPE) + PsiElement(mixed)('mixed') + PsiWhiteSpace(' ') + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('b') + PsiElement())(')') + PsiWhiteSpace(' ') + ZephirReturnTypeImpl(RETURN_TYPE) + PsiElement(->)('->') + PsiWhiteSpace(' ') + ZephirTypeImpl(TYPE) + ZephirScalarTypeImpl(SCALAR_TYPE) + PsiElement(mixed)('mixed') + PsiWhiteSpace('\n ') + ZephirMethodBodyImpl(METHOD_BODY) + ZephirCodeBlockImpl(CODE_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + ZephirCodeImpl(CODE) + ZephirReturnStatementImpl(RETURN_STATEMENT) + PsiElement(return)('return') + PsiWhiteSpace(' ') + ZephirLiteralExprImpl(LITERAL_EXPR) + ZephirVariableImpl(VARIABLE) + ZephirComplexIdImpl(COMPLEX_ID) + ZephirIdImpl(ID) + PsiElement(IDENTIFIER)('a') + PsiElement(;)(';') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace('\n') + PsiElement(})('}') \ No newline at end of file diff --git a/src/test/testData/parser/MixedType.zep b/src/test/testData/parser/MixedType.zep new file mode 100644 index 0000000..b45611b --- /dev/null +++ b/src/test/testData/parser/MixedType.zep @@ -0,0 +1,14 @@ +namespace Test; + +class MixedType +{ + public function process(mixed value) -> mixed + { + return value; + } + + public function identity(mixed a, mixed b) -> mixed + { + return a; + } +}