Skip to content

Commit

Permalink
Merge branch 'master' into feature/docs-site-styling
Browse files Browse the repository at this point in the history
  • Loading branch information
AyhamAl-Ali authored Jul 2, 2021
2 parents c92851c + d8b1d52 commit a9201b4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.time.LocalTime
plugins {
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'com.github.hierynomus.license' version '0.16.1'
id 'maven-publish'
id 'java'
}

Expand Down Expand Up @@ -68,6 +69,7 @@ task relocateShadowJar(type: ConfigureShadowRelocation) {

task sourceJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = "sources"
}

tasks.withType(ShadowJar) {
Expand Down Expand Up @@ -104,6 +106,18 @@ processResources {
]
}

publishing {
publications {
maven(MavenPublication) {
groupId "com.github.SkriptLang"
artifactId "Skript"
version project.version
artifact sourceJar
artifact tasks.jar
}
}
}

license {
header file('licenseheader.txt')
exclude('**/Metrics.java') // Not under GPLv3
Expand Down
5 changes: 5 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
before_install:
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk update
- sdk install java 16.0.1-open
- sdk use java 16.0.1-open
10 changes: 9 additions & 1 deletion src/main/java/ch/njol/skript/lang/SkriptParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,17 @@ private static <T> Variable<T> parseVariable(final String expr, final Class<? ex
if (varPattern.matcher(expr).matches()) {
String variableName = "" + expr.substring(expr.indexOf('{') + 1, expr.lastIndexOf('}'));
boolean inExpression = false;
int variableDepth = 0;
for (char c : variableName.toCharArray()) {
if (c == '%')
if (c == '%' && variableDepth == 0)
inExpression = !inExpression;
if (inExpression) {
if (c == '{') {
variableDepth++;
} else if (c == '}')
variableDepth--;
}

if (!inExpression && (c == '{' || c == '}'))
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on load:
suppress conflict warnings

test "nested variable parsing":
delete {_a}
delete {_a%{b}%}
delete {_a%{b%{c}%}%}
delete {_a%{b%{c%{d}%}%}%}
delete {_a%{b%{c%{d%{e}%}%}%}%}
delete {_a%{b%{c} + {d}%} + {e%{f} + {g}%}%}

0 comments on commit a9201b4

Please sign in to comment.