Skip to content

Commit

Permalink
v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pml-lang committed Feb 23, 2023
1 parent d7d7d7c commit a056733
Show file tree
Hide file tree
Showing 308 changed files with 4,551 additions and 4,348 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
4.0.0
19 changes: 14 additions & 5 deletions buildSrc/src/main/groovy/dev.pmlc.java-common-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repositories {
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
}

java {
Expand All @@ -18,12 +18,21 @@ java {

test {
useJUnitPlatform()
// jvmArgs += "--enable-preview"
}

version = '3.1.0'
version = '4.0.0'

/*
tasks.withType(JavaCompile) {
options.compilerArgs += [ '-Xlint:deprecation', '-Xlint:unchecked' ]
// options.compilerArgs += '-Xlint:preview'
// options.compilerArgs += '--enable-preview'
options.compilerArgs += '-Xlint:deprecation'
// options.compilerArgs += '-Xlint:unchecked'
}
*/

/*
tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
}
*/

Binary file removed dependencies/pdml-commands-0.15.0.jar
Binary file not shown.
Binary file added dependencies/pdml-commands-0.27.0.jar
Binary file not shown.
Binary file removed dependencies/pdml-core-0.15.0.jar
Binary file not shown.
Binary file added dependencies/pdml-data-0.27.0.jar
Binary file not shown.
Binary file removed dependencies/pdml-ext-0.15.0.jar
Binary file not shown.
Binary file added dependencies/pdml-ext-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-ext-scripting-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-ext-shared-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-ext-types-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-ext-utils-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-parser-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-reader-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-shared-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-utils-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-writer-0.27.0.jar
Binary file not shown.
Binary file added dependencies/pdml-xml-0.27.0.jar
Binary file not shown.
Binary file not shown.
Binary file removed dependencies/pp-commands-0.11.0.jar
Binary file not shown.
Binary file added dependencies/pp-commands-0.21.0.jar
Binary file not shown.
Binary file removed dependencies/pp-datatype-0.11.0.jar
Binary file not shown.
Binary file added dependencies/pp-datatype-0.21.0.jar
Binary file not shown.
Binary file removed dependencies/pp-parameters-0.11.0.jar
Binary file not shown.
Binary file added dependencies/pp-parameters-0.21.0.jar
Binary file not shown.
Binary file not shown.
Binary file removed dependencies/pp-text-0.11.0.jar
Binary file not shown.
Binary file added dependencies/pp-text-0.21.0.jar
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 7 additions & 5 deletions pmlc-commands/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ dependencies {
implementation fileTree ( dir: '../dependencies' )

// PML
implementation project ( ':pmlc-core' )
implementation project ( ':pmlc-ext' )
implementation project ( ':pmlc-data' )
implementation project ( ':pmlc-converter' )
implementation project ( ':pmlc-utils' )

// Picocli
implementation 'info.picocli:picocli:4.6.3'
Expand All @@ -21,12 +22,13 @@ dependencies {
// https://github.com/remkop/picocli/tree/main/picocli-codegen
annotationProcessor 'info.picocli:picocli-codegen:4.6.3'

implementation group: 'org.graalvm.js', name: 'js', version: '22.2.0'
implementation group: 'org.graalvm.js', name: 'js', version: '22.3.1'
}

application {
mainClass = 'dev.pmlc.commands.Start'
applicationDefaultJvmArgs = ['-ea'] // enable assertions
// applicationDefaultJvmArgs = ['-ea'] // enable assertions
applicationDefaultJvmArgs += [ '-ea', '--enable-preview' ]
}

// OS script file name to start the application
Expand Down Expand Up @@ -93,7 +95,7 @@ static void createNativeImageReflectionConfig ( Path nativeImageDir ) {
Path.of ( "C:/aa/work/PP/dev/pp-libs/pp-scripting" ), "dev/pp/scripting/bindings/core", writer, false );

writeReflectionConfig (
Path.of ( "C:/aa/work/PDML/dev/pdml-java-impl/pdml-ext" ), "dev/pdml/ext/extensions/scripting/bindings", writer, true );
Path.of ( "C:/aa/work/PDML/dev/full-pdml-impl/pdml-ext-scripting" ), "dev/pdml/extscripting/bindings", writer, true );

writer.write ( "]\n" );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package dev.pmlc.commands;

import dev.pmlc.ext.utilities.CommandsReferenceManualCreator;
import dev.pmlc.utils.referencemanual.CommandsReferenceManualCreator;
import dev.pp.basics.annotations.NotNull;
import dev.pp.basics.annotations.Nullable;
import dev.pp.commands.command.FormalCommand;
import dev.pp.parameters.parameter.Parameters;

import java.util.Map;
import dev.pp.commands.command.CommandSpec;
import dev.pp.parameters.parameters.Parameters;

public class CreateCommandsReferenceManualCommand {

public static final @NotNull FormalCommand<Void> COMMAND = FormalCommand.builder (
public static final @NotNull CommandSpec<Void,Void> COMMAND = CommandSpec.<Void,Void>builder (
"create_commands_reference_manual", CreateCommandsReferenceManualCommand::execute )
.alternativeName ( "ccrm" )
.documentation (
Expand All @@ -22,9 +20,9 @@ public class CreateCommandsReferenceManualCommand {
"pmlc create_commands_manual" )
.build();

public static Void execute ( @Nullable Parameters parameters ) throws Exception {
public static Void execute ( @Nullable Parameters<?> parameters ) throws Exception {

new CommandsReferenceManualCreator ().createManual ( PMLCommands.COMMANDS );
new CommandsReferenceManualCreator().createManual ( PMLCommands.COMMANDS );

return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package dev.pmlc.commands;

import dev.pmlc.ext.utilities.referencemanual.NodesReferenceManualCreator;
import dev.pmlc.utils.referencemanual.NodesReferenceManualCreator;
import dev.pp.basics.annotations.NotNull;
import dev.pp.basics.annotations.Nullable;
import dev.pp.commands.command.FormalCommand;
import dev.pp.parameters.parameter.Parameters;

import java.util.Map;
import dev.pp.commands.command.CommandSpec;
import dev.pp.parameters.parameters.Parameters;

public class CreateNodesReferenceManualCommand {

/*
public static final @NotNull FormalParameter<Path> OUTPUT_DIRECTORY_PARAMETER = new FormalParameter.Builder<> (
public static final @NotNull ParameterSpec<Path> OUTPUT_DIRECTORY_PARAMETER = new ParameterSpec.Builder<> (
"output_directory", CommonDataTypes.DIRECTORY_PATH )
.alternativeName ( "od" )
.documentation ( "Output Directory",
Expand All @@ -22,7 +20,7 @@ public class CreateNodesReferenceManualCommand {
"ref_manual/HTML/" )
.build();
public static final @NotNull FormalParameter<Path> TEMP_DIRECTORY_PARAMETER = new FormalParameter.Builder<> (
public static final @NotNull ParameterSpec<Path> TEMP_DIRECTORY_PARAMETER = new ParameterSpec.Builder<> (
"temp_directory", CommonDataTypes.DIRECTORY_PATH )
.alternativeName ( "td" )
.defaultValue ( OSDirectories.TEMPORARY_FILES_DIRECTORY )
Expand All @@ -37,7 +35,7 @@ public class CreateNodesReferenceManualCommand {
.build();
*/

public static final @NotNull FormalCommand<Void> COMMAND = FormalCommand.builder (
public static final @NotNull CommandSpec<Void,Void> COMMAND = CommandSpec.<Void,Void>builder (
"create_nodes_reference_manual", CreateNodesReferenceManualCommand::execute )
.alternativeName ( "cnrm" )
.documentation (
Expand All @@ -51,7 +49,7 @@ public class CreateNodesReferenceManualCommand {
// .addInputParameter ( TEMP_DIRECTORY_PARAMETER )
.build();

public static Void execute ( @Nullable Parameters parameters ) throws Exception {
public static Void execute ( @Nullable Parameters<?> parameters ) throws Exception {

/*
assert parameters != null;
Expand All @@ -61,7 +59,7 @@ public static Void execute ( @Nullable Parameters parameters ) throws Exception
new ReferenceManualCreator().createReferenceManual ( outputDirectory, tempDirectory );
*/
new NodesReferenceManualCreator().createManual ();
new NodesReferenceManualCreator ().createManual ();

return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
package dev.pmlc.commands;

import dev.pdml.core.PDMLConstants;
import dev.pmlc.core.data.formalnode.FormalNodeRegistry;
import dev.pmlc.core.data.formalnode.FormalPMLNode;
import dev.pmlc.ext.PMLCVersion;
import dev.pdml.shared.constants.CorePdmlConstants;
import dev.pmlc.data.PmlcVersion;
import dev.pmlc.data.nodespec.NodeSpecRegistry;
import dev.pmlc.data.nodespec.PMLNodeSpec;
import dev.pp.basics.annotations.NotNull;
import dev.pp.basics.annotations.Nullable;
import dev.pp.basics.utilities.SimpleLogger;
import dev.pp.basics.utilities.file.TextFileIO;
import dev.pp.commands.command.FormalCommand;
import dev.pp.commands.command.CommandSpec;
import dev.pp.datatype.CommonDataTypes;
import dev.pp.parameters.formalParameter.FormalParameter;
import dev.pp.parameters.formalParameter.FormalParameters;
import dev.pp.parameters.parameter.Parameters;
import dev.pp.parameters.parameters.Parameters;
import dev.pp.parameters.parameterspec.ParameterSpec;
import dev.pp.parameters.parameterspecs.ParameterSpecs;
import dev.pp.text.utilities.json.JSONWriter;

import java.io.IOException;
import java.io.Writer;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;

public class ExportTagsCommand {
public class ExportMetaDataCommand {

public static final @NotNull FormalParameter<Path> OUTPUT_FILE_PARAMETER = new FormalParameter.Builder<> (
public static final @NotNull ParameterSpec<Path> OUTPUT_FILE_PARAMETER = new ParameterSpec.Builder<> (
"output_file", CommonDataTypes.FILE_PATH )
.alternativeName ( "of" )
.defaultValue ( Path.of ( "pml_tags.json" ) )
.documentation ( "JSON Output File Path",
.defaultValue ( Path.of ( "PML_meta_data.json" ) )
.documentation ( "Output File Path",
"""
The absolute or relative path of the JSON file to be created.
The absolute or relative path of the file to be created.
If the path is relative, it is relative to the current working directory.
The default value is file 'pml_tags.json' created in the current working directory.
The default value is file 'PML_meta_data.json' created in the current working directory.
If the file exists already it will be overwritten.""",
"--output_file pml/tags.json" )
"--output_file pml/nodes.json" )
.build();

public static final @NotNull FormalCommand<Void> COMMAND = FormalCommand.builder (
"export_tags", ExportTagsCommand::execute )
.alternativeName ( "et" )
public static final @NotNull CommandSpec<Path,Void> COMMAND = CommandSpec.<Path,Void>builder (
"export_meta_data", ExportMetaDataCommand::execute )
.alternativeName ( "md" )
.documentation (
"Export PML Nodes And Attributes Data to a JSON File",
"Export PML Meta Data to a JSON File",
"""
This command creates a JSON file describing PML nodes and attributes.
The JSON file can be used by editor plugins and tools to get structured data about PML nodes and attributes.""",
"pmlc export_tags" )
This command creates a JSON file containing PML meta data (nodes, attributes, etc).
The JSON file can be used by editor plugins and tools to query structured data about PML.""",
"pmlc export_meta_data" )
.addInputParameter ( OUTPUT_FILE_PARAMETER )
.build();

public static Void execute ( @Nullable Parameters parameters ) throws IOException {
public static Void execute ( @Nullable Parameters<?> parameters ) throws IOException {

assert parameters != null;

@NotNull Path outputFile = parameters.getNonNull ( OUTPUT_FILE_PARAMETER );
@NotNull Path outputFile = parameters.nonNullCastedValue ( OUTPUT_FILE_PARAMETER );
write ( outputFile );

return null;
Expand All @@ -72,14 +71,14 @@ public static void write ( @NotNull Writer basicWriter ) throws IOException {
JSONWriter writer = new JSONWriter ( basicWriter );

writer.writeDocumentStartLine()
.writeObjectStartLine ( "pml_tags" )
.writeStringAttributeLine ( "pml_version", PMLCVersion.VERSION, false )
.writeStringAttributeLine ( "pml_release_date", PMLCVersion.DATE_PUBLISHED, false )
.writeArrayStartLine ( "tags" );
List<FormalPMLNode<?,?>> nodes = FormalNodeRegistry.getListSortedByName();
.writeObjectStartLine ( "pml_meta" )
.writeStringAttributeLine ( "pml_version", PmlcVersion.VERSION, false )
.writeStringAttributeLine ( "pml_release_date", PmlcVersion.DATE_PUBLISHED, false )
.writeArrayStartLine ( "nodes" );
List<PMLNodeSpec<?,?>> nodes = NodeSpecRegistry.getListSortedByName();
int size = nodes.size();
for ( int i = 0; i < size; i++ ) {
FormalPMLNode<?,?> node = nodes.get ( i );
PMLNodeSpec<?,?> node = nodes.get ( i );
writeNode ( node, i == size - 1, writer );
}
writer.writeArrayEndLine ( true )
Expand All @@ -88,11 +87,11 @@ public static void write ( @NotNull Writer basicWriter ) throws IOException {
}

private static void writeNode (
@NotNull FormalPMLNode<?,?> node,
@NotNull PMLNodeSpec<?,?> node,
boolean isLastNode,
@NotNull JSONWriter writer ) throws IOException {

String name = node.getNameAsString();
String name = node.qualifiedName();
boolean isInlineNode = node.isInlineNode();

writer.writeObjectStartLine()
Expand All @@ -109,47 +108,47 @@ private static void writeNode (
.writeBooleanAttributeLine ( "is_inline_type", isInlineNode, false )
.writeBooleanAttributeLine ( "is_raw_text_block", node.isRawTextNode(), false )
.writeBooleanAttributeLine ( "child_nodes_allowed", node.isBlockChildNodesAllowed() || node.isInlineChildNodesAllowed(), false )
.writeStringAttributeLine ( "opening_tag", PDMLConstants.NODE_START + name, false )
.writeStringAttributeLine ( "opening_tag", CorePdmlConstants.NODE_START + name, false )
.writeStringAttributeLine ( "latest_doc_url", "https://www.pml-lang.dev/docs/reference_manual/index.html#node_" + name, true );

writer.writeObjectEndLine ( isLastNode );
}

private static void writeNodeAttributes (
@NotNull FormalPMLNode<?,?> node,
@NotNull PMLNodeSpec<?,?> node,
@NotNull JSONWriter writer ) throws IOException {

@Nullable FormalParameters attributes = node.getAttributes();
@Nullable ParameterSpecs<?> attributes = node.getAttributeSpecs();
if ( attributes == null ) {
writer.writeNullAttributeLine ( "attributes", false );
} else {
writer.writeArrayStartLine ( "attributes" );
List<FormalParameter<?>> list = attributes.getAllSortedByName();
List<? extends ParameterSpec<?>> list = attributes.listSortedByName();
int size = list.size();
for ( int i = 0; i < size; i++ ) {
FormalParameter<?> attribute = list.get ( i );
ParameterSpec<?> attribute = list.get ( i );
writeAttribute ( attribute, i == size - 1, writer );
}
writer.writeArrayEndLine ( false );
}
}

private static void writeAttribute (
@NotNull FormalParameter<?> attribute,
@NotNull ParameterSpec<?> attribute,
boolean isLastNode,
@NotNull JSONWriter writer ) throws IOException {

writer.writeObjectStartLine()

.writeStringAttributeLine ( "id", attribute.getName(), false )
.writeStringAttributeLine ( "type", attribute.getTypeName(), false )
.writeStringAttributeLine ( "type", attribute.typeName (), false )
.writeBooleanAttributeLine ( "required", attribute.isRequired(), false )
.writeStringAttributeLine ( "default_value", attribute.getDefaultValueAsString(), false )
.writeStringAttributeLine ( "default_value", attribute.defaultValueAsString (), false )
.writeNumberAttributeLine ( "position", attribute.getPositionalParameterIndex(), false )

.writeStringAttributeLine ( "title", attribute.getDocumentationTitle(), false )
.writeStringAttributeLine ( "description", attribute.getDocumentationDescription(), false )
.writeStringAttributeLine ( "examples", attribute.getDocumentationExamples(), true )
.writeStringAttributeLine ( "title", attribute.documentationTitle (), false )
.writeStringAttributeLine ( "description", attribute.documentationDescription (), false )
.writeStringAttributeLine ( "examples", attribute.documentationExamples (), true )

.writeObjectEndLine ( isLastNode );
}
Expand Down
Loading

0 comments on commit a056733

Please sign in to comment.