-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd0e428
commit e2039b4
Showing
28 changed files
with
237 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,22 +19,22 @@ jobs: | |
|
||
# Check out current repository | ||
- name: Fetch Sources | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
# Validate wrapper | ||
- name: Gradle Wrapper Validation | ||
uses: gradle/[email protected] | ||
|
||
# Set up Java environment for the next steps | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 17 | ||
|
||
# Setup Gradle | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2.8.0 | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
gradle-home-cache-cleanup: true | ||
|
||
|
@@ -76,22 +76,22 @@ jobs: | |
|
||
# Check out current repository | ||
- name: Fetch Sources | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
# Validate wrapper | ||
- name: Gradle Wrapper Validation | ||
uses: gradle/[email protected] | ||
|
||
# Set up Java environment for the next steps | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 17 | ||
|
||
# Setup Gradle | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2.8.0 | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
gradle-home-cache-cleanup: true | ||
|
||
|
@@ -116,18 +116,22 @@ jobs: | |
|
||
# Check out current repository | ||
- name: Fetch Sources | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
# Validate wrapper | ||
- name: Gradle Wrapper Validation | ||
uses: gradle/[email protected] | ||
|
||
# Set up Java environment for the next steps | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 17 | ||
|
||
# Setup Gradle | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2.8.0 | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
gradle-home-cache-cleanup: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugins { | ||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.6.0" | ||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" | ||
} | ||
|
||
rootProject.name = "kphpstorm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/main/kotlin/com/vk/kphpstorm/kphptags/parser/KphpDocTagJsonParser.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.vk.kphpstorm.kphptags.parser | ||
|
||
import com.jetbrains.php.lang.documentation.phpdoc.parser.tags.PhpDocParamTagParser | ||
import com.jetbrains.php.lang.documentation.phpdoc.parser.tags.PhpDocTagParser | ||
import com.jetbrains.php.lang.parser.PhpParserErrors | ||
import com.jetbrains.php.lang.parser.PhpPsiBuilder | ||
import com.vk.kphpstorm.exphptype.psi.TokensToExPhpTypePsiParsing | ||
import com.vk.kphpstorm.kphptags.psi.KphpDocJsonAttributePsiImpl | ||
import com.vk.kphpstorm.kphptags.psi.KphpDocJsonForEncoderPsiImpl | ||
import com.vk.kphpstorm.kphptags.psi.KphpDocTagJsonElementType | ||
|
||
class KphpDocTagJsonParser : PhpDocTagParser() { | ||
override fun getElementType() = KphpDocTagJsonElementType | ||
|
||
override fun parseContents(builder: PhpPsiBuilder): Boolean { | ||
val paramsTagParser = PhpDocParamTagParser() | ||
|
||
while (true) { | ||
val forMarker = builder.mark() | ||
var needForIdentifier = false | ||
if (builder.compare(DOC_IDENTIFIER) && builder.tokenText == "for") { | ||
builder.advanceLexer() | ||
|
||
if (TokensToExPhpTypePsiParsing.parseTypeExpression(builder)) { | ||
needForIdentifier = true | ||
} else { | ||
forMarker.drop() | ||
builder.error(PhpParserErrors.expected("JsonEncoder name")) | ||
break | ||
} | ||
} | ||
if (needForIdentifier) { | ||
forMarker.done(KphpDocJsonForEncoderPsiImpl.elementType) | ||
} else { | ||
forMarker.drop() | ||
} | ||
|
||
val attributeName: String? | ||
val marker = builder.mark() | ||
if (builder.compare(DOC_IDENTIFIER)) { | ||
attributeName = builder.tokenText | ||
builder.advanceLexer() | ||
} else { | ||
marker.drop() | ||
builder.error(PhpParserErrors.expected("Attribute name")) | ||
break | ||
} | ||
|
||
if (builder.compare(DOC_TEXT) && builder.tokenText!!.startsWith("=")) { | ||
var needNextIdentifier = true | ||
|
||
if (builder.tokenText == "=") { | ||
builder.compareAndEat(DOC_TEXT) | ||
} else { | ||
needNextIdentifier = false | ||
builder.advanceLexer() | ||
} | ||
|
||
if (needNextIdentifier) { | ||
if (attributeName == "fields") { | ||
while (true) { | ||
if (!builder.compareAndEat(DOC_COMMA) && !paramsTagParser.parseContents(builder)) { | ||
break | ||
} | ||
} | ||
} else { | ||
if (!builder.compare(DOC_IDENTIFIER) && !builder.compare(DOC_TEXT)) { | ||
marker.drop() | ||
builder.error(PhpParserErrors.expected("Attribute value")) | ||
break | ||
} | ||
|
||
builder.advanceLexer() | ||
} | ||
} | ||
} | ||
|
||
marker.done(KphpDocJsonAttributePsiImpl.elementType) | ||
return true | ||
|
||
} | ||
return true | ||
} | ||
} |
Oops, something went wrong.