Compare commits
5 Commits
v0.8.4-bet
...
v0.8.6-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
48bd1e2015
|
|||
|
304665904f
|
|||
|
56ae3a85a6
|
|||
|
0178cb2194
|
|||
|
a2cb5cd473
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -14,9 +14,11 @@
|
|||||||
|
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
!/.gitattributes
|
!/.gitattributes
|
||||||
!/build.js
|
|
||||||
!/LICENSE
|
!/LICENSE
|
||||||
!/README.md
|
!/README.md
|
||||||
!/settings.gradle
|
!/settings.gradle
|
||||||
!/build.gradle
|
!/build.gradle
|
||||||
!/gradle.properties
|
!/gradle.properties
|
||||||
|
!/gradle
|
||||||
|
!/gradle/wrapper
|
||||||
|
!/gradle/wrapper/gradle-wrapper.properties
|
||||||
31
build.gradle
31
build.gradle
@@ -1,37 +1,32 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'application'
|
id "application"
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = JavaVersion.VERSION_11
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(11)
|
||||||
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest.attributes["Main-class"] = project.main_class
|
||||||
attributes (
|
|
||||||
'Main-Class': project.main_class
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs = [ 'src/java' ]
|
main.java.srcDirs = [ "src/java" ]
|
||||||
main.resources.srcDirs = [ 'src/assets' ]
|
main.resources.srcDirs = [ "src/assets" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
filesMatching('metadata.json') {
|
filesMatching "metadata.json", {
|
||||||
expand (
|
expand(
|
||||||
'version': project.project_version,
|
version: project.project_version,
|
||||||
'name': project.project_name
|
name: project.project_name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
base.archivesName = project.project_name
|
||||||
mainClass = project.main_class
|
version = project.project_version
|
||||||
}
|
group = project.project_group
|
||||||
|
|
||||||
archivesBaseName = project.project_name
|
|
||||||
version = project.project_version
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
project_group = me.topchetoeu
|
||||||
project_name = jscript
|
project_name = jscript
|
||||||
project_version = 0.8.4-beta
|
project_version = 0.8.6-beta
|
||||||
main_class = me.topchetoeu.jscript.utils.JScriptRepl
|
main_class = me.topchetoeu.jscript.utils.JScriptRepl
|
||||||
|
|||||||
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = properties.project_name
|
||||||
|
|||||||
@@ -711,14 +711,14 @@ public class Values {
|
|||||||
res.append("{\n");
|
res.append("{\n");
|
||||||
|
|
||||||
for (var el : obj.values.entrySet()) {
|
for (var el : obj.values.entrySet()) {
|
||||||
for (int i = 0; i < tab + 1; i++) System.out.print(" ");
|
for (int i = 0; i < tab + 1; i++) res.append(" ");
|
||||||
res.append(toReadable(ctx, el.getKey(), passed, tab + 1));
|
res.append(toReadable(ctx, el.getKey(), passed, tab + 1));
|
||||||
res.append(": ");
|
res.append(": ");
|
||||||
res.append(toReadable(ctx, el.getValue(), passed, tab + 1));
|
res.append(toReadable(ctx, el.getValue(), passed, tab + 1));
|
||||||
res.append(",\n");
|
res.append(",\n");
|
||||||
}
|
}
|
||||||
for (var el : obj.properties.entrySet()) {
|
for (var el : obj.properties.entrySet()) {
|
||||||
for (int i = 0; i < tab + 1; i++) System.out.print(" ");
|
for (int i = 0; i < tab + 1; i++) res.append(" ");
|
||||||
res.append(toReadable(ctx, el.getKey(), passed, tab + 1));
|
res.append(toReadable(ctx, el.getKey(), passed, tab + 1));
|
||||||
res.append(": [prop],\n");
|
res.append(": [prop],\n");
|
||||||
}
|
}
|
||||||
|
|||||||
36
src/java/me/topchetoeu/jscript/lib/ConsoleLib.java
Normal file
36
src/java/me/topchetoeu/jscript/lib/ConsoleLib.java
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package me.topchetoeu.jscript.lib;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import me.topchetoeu.jscript.core.engine.values.Values;
|
||||||
|
import me.topchetoeu.jscript.utils.filesystem.FilesystemException;
|
||||||
|
import me.topchetoeu.jscript.utils.filesystem.FilesystemException.FSCode;
|
||||||
|
import me.topchetoeu.jscript.utils.interop.Arguments;
|
||||||
|
import me.topchetoeu.jscript.utils.interop.Expose;
|
||||||
|
import me.topchetoeu.jscript.utils.interop.WrapperName;
|
||||||
|
|
||||||
|
@WrapperName("Console")
|
||||||
|
public class ConsoleLib {
|
||||||
|
private final OutputStream stream;
|
||||||
|
|
||||||
|
@Expose
|
||||||
|
public void __log(Arguments args) {
|
||||||
|
try {
|
||||||
|
var first = true;
|
||||||
|
for (var el : args.args) {
|
||||||
|
if (!first) stream.write(" ".getBytes());
|
||||||
|
first = false;
|
||||||
|
stream.write(Values.toReadable(args.ctx, el).getBytes());
|
||||||
|
}
|
||||||
|
stream.write((byte)'\n');
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
throw new FilesystemException("stdout", FSCode.NO_PERMISSIONS_RW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConsoleLib(OutputStream stream) {
|
||||||
|
this.stream = stream;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package me.topchetoeu.jscript.lib;
|
package me.topchetoeu.jscript.lib;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import me.topchetoeu.jscript.common.Reading;
|
|
||||||
import me.topchetoeu.jscript.core.engine.Context;
|
import me.topchetoeu.jscript.core.engine.Context;
|
||||||
import me.topchetoeu.jscript.core.engine.Environment;
|
import me.topchetoeu.jscript.core.engine.Environment;
|
||||||
import me.topchetoeu.jscript.core.engine.scope.GlobalScope;
|
import me.topchetoeu.jscript.core.engine.scope.GlobalScope;
|
||||||
@@ -34,27 +32,6 @@ public class Internals {
|
|||||||
else throw EngineException.ofError("Modules are not supported.");
|
else throw EngineException.ofError("Modules are not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Expose(target = ExposeTarget.STATIC)
|
|
||||||
public static Object __log(Arguments args) {
|
|
||||||
for (var arg : args.args) {
|
|
||||||
Values.printValue(args.ctx, arg);
|
|
||||||
System.out.print(" ");
|
|
||||||
}
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
return args.get(0);
|
|
||||||
}
|
|
||||||
@Expose(target = ExposeTarget.STATIC)
|
|
||||||
public static String __readline() {
|
|
||||||
try {
|
|
||||||
return Reading.readline();
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Expose(target = ExposeTarget.STATIC)
|
@Expose(target = ExposeTarget.STATIC)
|
||||||
public static Thread __setTimeout(Arguments args) {
|
public static Thread __setTimeout(Arguments args) {
|
||||||
var func = args.convert(0, FunctionValue.class);
|
var func = args.convert(0, FunctionValue.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user