Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ $# -eq 0 ]
exit
fi

if [ -f pgql-lang/src/main/resources/pgql.spoofax-language ]
if [ -f pgql-lang/src/main/resources/sdf.tbl ]
then
echo "INFO: Using the parser that was previously built via 'bash install.sh'"
else
Expand All @@ -24,9 +24,11 @@ STAGE=false
if [[ "$1" =~ ^[0-9.]+$ ]]
then
echo "Deploying to release repo"
REPO="https://artifacthub-iad.oci.oraclecorp.com/graph-onprem-release-local"
else
echo "Deploying to staging repo"
STAGE=true
REPO="https://artifacthub-iad.oci.oraclecorp.com/graph-onprem-stage-local"
fi

VERSION_A="0.0.0-SNAPSHOT"
Expand All @@ -40,6 +42,21 @@ do
fi
done

mvn deploy:deploy-file \
-DgroupId=oracle.pg \
-DartifactId=pgql-lang-trans \
-Dversion=$VERSION_B \
-Dpackaging=jar \
-Dfile=pgql-lang/pgql-lang-trans.jar \
-Durl=$REPO \
-DrepositoryId=graph-onprem
mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \
-Dfile=pgql-lang/pgql-lang-trans.jar \
-DgroupId=oracle.pg \
-DartifactId=pgql-lang-trans \
-Dversion=$VERSION_B \
-Dpackaging=jar \
-DlocalRepositoryPath="$(pwd)/pgql-lang/repo/"
cd graph-query-ir/; mvn deploy; cd ../
cd pgql-lang/; mvn deploy; cd ../

Expand Down
72 changes: 72 additions & 0 deletions graph-query-ir/src/main/java/oracle/pgql/lang/ir/PgqlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -630,4 +630,76 @@ public static String printLiteral(OffsetTime val) {
public static String printLiteral(OffsetDateTime val) {
return "TIMESTAMP '" + val.toLocalDate() + " " + printTime(val.toLocalTime()) + val.getOffset() + "'";
}

public static String unescapeLegacyPgqlString(String input, boolean identifier) {
if (input == null) {
return null;
}

StringBuilder sb = new StringBuilder();
int length = input.length();

for (int i = 0; i < length; i++) {
char currentChar = input.charAt(i);

if (currentChar == '\\' && i + 1 < length) {
char nextChar = input.charAt(i + 1);
switch (nextChar) {
case 'n':
sb.append('\n');
i++;
break;
case 't':
sb.append('\t');
i++;
break;
case 'b':
sb.append('\b');
i++;
break;
case 'r':
sb.append('\r');
i++;
break;
case 'f':
sb.append('\f');
i++;
break;
case '\'':
sb.append('\'');
i++;
break;
case '\"':
sb.append('\"');
i++;
break;
case '\\':
sb.append('\\');
i++;
break;
default:
sb.append('\\').append(nextChar);
i++;
break;
}

} else if (identifier && currentChar == '\"' && i + 1 < length) {
char nextChar = input.charAt(i + 1);
if (nextChar == '\"') {
sb.append('\"');
i++;
}

} else if (!identifier && currentChar == '\'' && i + 1 < length) {
char nextChar = input.charAt(i + 1);
if (nextChar == '\'') {
sb.append('\'');
i++;
}
} else {
sb.append(currentChar);
}
}
return sb.toString();
}
}
8 changes: 6 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ cd graph-query-ir/; mvn clean install; cd ../

cd pgql-lang/
mkdir -p src/main/resources/
rm -f src/main/resources/*.spoofax-language # remove any spoofax binaries from previous builds
cp ../pgql-spoofax/target/pgqllang-0.0.0-SNAPSHOT.spoofax-language src/main/resources/pgql.spoofax-language
# copy parse table
cp ../pgql-spoofax/target/metaborg/sdf.tbl src/main/resources/sdf.tbl
# copy and install transformations
cp ../pgql-spoofax/target/metaborg/stratego.jar pgql-lang-trans.jar
mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file -Dfile=pgql-lang-trans.jar -DgroupId=oracle.pg -DartifactId=pgql-lang-trans -Dversion=0.0.0-SNAPSHOT -Dpackaging=jar -DlocalRepositoryPath="$(pwd)/repo/"
rm -rf ~/.m2/repository/oracle/pg/pgql-lang-trans/
mvn clean install
cd ../

Expand Down
2 changes: 2 additions & 0 deletions pgql-lang/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/.settings
/pgql-lang.iml
/src/main/resources/
/repo/
pgql-lang-trans.jar
202 changes: 147 additions & 55 deletions pgql-lang/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
<version>0.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>oracle.pg</groupId>
<artifactId>pgql-lang-trans</artifactId>
<version>0.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.metaborg</groupId>
<artifactId>org.metaborg.spoofax.core.uber</artifactId>
<version>2.5.18</version>
<version>${metaborg-version}</version>
<exclusions>
<exclusion>
<groupId>com.google.inject.extensions</groupId>
Expand All @@ -38,64 +43,64 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.9.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.virtlink.commons</groupId>
<artifactId>commons-configuration2-jackson</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs-client</artifactId>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</exclusion>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
<exclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
</exclusion>
<exclusion>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.0-jre</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -104,7 +109,93 @@
</dependency>
</dependencies>

<!-- If you rather depend on individual Spoofax libraries rather than the Uber jar:
<dependencies>
<dependency>
<groupId>oracle.pg</groupId>
<artifactId>graph-query-ir</artifactId>
<version>0.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>oracle.pg</groupId>
<artifactId>pgql-lang-trans</artifactId>
<version>0.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.metaborg</groupId>
<artifactId>org.spoofax.jsglr2</artifactId>
<version>${metaborg-version}</version>
<exclusions>
<exclusion>
<groupId>org.metaborg</groupId>
<artifactId>jsglr.shared</artifactId>
</exclusion>
<exclusion>
<groupId>org.metaborg</groupId>
<artifactId>sdf2table</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.metaborg</groupId>
<artifactId>org.metaborg.parsetable</artifactId>
<version>${metaborg-version}</version>
<exclusions>
<exclusion>
<groupId>org.metaborg</groupId>
<artifactId>jsglr.shared</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.metaborg</groupId>
<artifactId>org.strategoxt.strj</artifactId>
<version>${metaborg-version}</version>
<exclusions>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.metaborg</groupId>
<artifactId>org.spoofax.interpreter.library.index</artifactId>
</exclusion>
<exclusion>
<groupId>org.metaborg</groupId>
<artifactId>jsglr.shared</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>-->

<repositories>
<repository>
<id>Local Repository with Stratego code from PGQL</id>
<url>file://${basedir}/repo</url>
</repository>
<repository>
<id>metaborgRepo</id>
<url>https://artifacts.metaborg.org/content/repositories/releases/</url>
Expand All @@ -114,6 +205,7 @@
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<metaborg-version>2.5.22</metaborg-version>
</properties>

<build>
Expand Down
Loading