Fixed next.xsd and next.xml. Several Java classes were added

This commit is contained in:
Robert Vokac 2025-02-02 17:21:07 +01:00
parent 22ff4c7abe
commit 0bf0038112
Signed by: robertvokac
GPG Key ID: FB9CE8E20AADA55F
18 changed files with 306 additions and 123 deletions

263
next.xml
View File

@ -1,140 +1,175 @@
<property name="DrawBounds" access="public" returnType="TinyRect">
<?xml version = "1.0"?>
<property name="DrawBounds" access="public" returnType="TinyRect"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="next.xsd">
<getter>
<body>
<statements>
<variabledeclaration name="result" initialization="default(TinyRect)" />
<variabledeclaration name="screenWidth" initialization="graphics.GraphicsDevice.Viewport.Width" />
<variabledeclaration name="screenHeight" initialization="graphics.GraphicsDevice.Viewport.Height" />
<variabledeclaration name="result" initialization="default(TinyRect)"/>
<variabledeclaration name="screenWidth" initialization="graphics.GraphicsDevice.Viewport.Width"/>
<variabledeclaration name="screenHeight" initialization="graphics.GraphicsDevice.Viewport.Height"/>
<if>
<condition>
<binaryoperation operator="&amp;&amp;">
<binaryoperation operator="==">
<left>Env.PLATFORM</left>
<right>Platform.Android</right>
</binaryoperation>
<binaryoperation operator="&gt;">
<left>screenHeight</left>
<right>480</right>
</binaryoperation>
<left>
<binaryoperation operator="==">
<left>Env.PLATFORM</left>
<right>Platform.Android</right>
</binaryoperation>
</left>
<right>
<binaryoperation operator="&gt;">
<left>screenHeight</left>
<right>480</right>
</binaryoperation>
</right>
</binaryoperation>
</condition>
<body>
<assignment>
<left>screenWidth</left>
<right>
<binaryoperation operator="*">
<left>screenHeight</left>
<binaryoperation operator="/">
<left>640f</left>
<right>480f</right>
<statements>
<assignment>
<left>screenWidth</left>
<right>
<binaryoperation operator="*">
<left>screenHeight</left>
<right>
<binaryoperation operator="/">
<left>640f</left>
<right>480f</right>
</binaryoperation>
</right>
</binaryoperation>
</binaryoperation>
</right>
</assignment>
</right>
</assignment>
</statements>
</body>
</if>
<if>
<condition>
<binaryoperation operator="&amp;&amp;">
<binaryoperation operator="!=">
<left>screenWidth</left>
<right>0.0</right>
</binaryoperation>
<binaryoperation operator="!=">
<left>screenHeight</left>
<right>0.0</right>
</binaryoperation>
<left>
<binaryoperation operator="!=">
<left>screenWidth</left>
<right>0.0</right>
</binaryoperation>
</left>
<right>
<binaryoperation operator="!=">
<left>screenHeight</left>
<right>0.0</right>
</binaryoperation>
</right>
</binaryoperation>
</condition>
<body>
<variabledeclaration name="num3" />
<variabledeclaration name="num4" />
<variabledeclaration name="test" />
<assignment>
<left>test</left>
<right>
<ternaryoperator>
<condition>
<binaryoperation operator="=="><left>1</left><right>1</right></binaryoperation>
</condition>
<iftrue>1</iftrue>
<iffalse>2</iffalse>
</ternaryoperator>
</right>
</assignment>
<if>
<condition>
<binaryoperation operator="&lt;">
<binaryoperation operator="/">
<left>screenWidth</left>
<right>screenHeight</right>
</binaryoperation>
<right>1.3333333333333333</right>
</binaryoperation>
</condition>
<body>
<assignment>
<left>num3</left>
<right>640.0</right>
</assignment>
<assignment>
<left>num4</left>
<right>
<binaryoperation operator="*">
<left>640.0</left>
<binaryoperation operator="/">
<left>screenHeight</left>
<right>screenWidth</right>
<statements>
<variabledeclaration name="num3"/>
<variabledeclaration name="num4"/>
<variabledeclaration name="test"/>
<assignment>
<left>test</left>
<right>
<ternaryoperator>
<condition>
<binaryoperation operator="==">
<left>1</left>
<right>1</right>
</binaryoperation>
</binaryoperation>
</right>
</assignment>
</body>
</if>
<else>
<body>
<assignment>
<left>num3</left>
<right>
<binaryoperation operator="*">
<left>480.0</left>
</condition>
<iftrue>1</iftrue>
<iffalse>2</iffalse>
</ternaryoperator>
</right>
</assignment>
<if>
<condition>
<binaryoperation operator="&lt;">
<left>
<binaryoperation operator="/">
<left>screenWidth</left>
<right>screenHeight</right>
</binaryoperation>
</binaryoperation>
</right>
</assignment>
<assignment>
<left>num4</left>
<right>480.0</right>
</assignment>
</body>
</else>
<assignment>
<left>result.LeftX</left>
<right>0</right>
</assignment>
<assignment>
<left>result.RightX</left>
<right>
<typecast type="int">
<value>num3</value>
</typecast>
</right>
</assignment>
<assignment>
<left>result.TopY</left>
<right>0</right>
</assignment>
<assignment>
<left>result.BottomY</left>
<right>
<typecast type="int">
<value>num4</value>
</typecast>
</right>
</assignment>
</left>
<right>1.3333333333333333</right>
</binaryoperation>
</condition>
<body>
<statements>
<assignment>
<left>num3</left>
<right>640.0</right>
</assignment>
<assignment>
<left>num4</left>
<right>
<binaryoperation operator="*">
<left>640.0</left>
<right>
<binaryoperation operator="/">
<left>screenHeight</left>
<right>screenWidth</right>
</binaryoperation>
</right>
</binaryoperation>
</right>
</assignment>
</statements>
</body>
<else>
<body>
<statements>
<assignment>
<left>num3</left>
<right>
<binaryoperation operator="*">
<left>480.0</left>
<right>
<binaryoperation operator="/">
<left>screenWidth</left>
<right>screenHeight</right>
</binaryoperation>
</right>
</binaryoperation>
</right>
</assignment>
<assignment>
<left>num4</left>
<right>480.0</right>
</assignment>
</statements>
</body>
</else>
</if>
<assignment>
<left>result.LeftX</left>
<right>0</right>
</assignment>
<assignment>
<left>result.RightX</left>
<right>
<typecast type="int">
<value>num3</value>
</typecast>
</right>
</assignment>
<assignment>
<left>result.TopY</left>
<right>0</right>
</assignment>
<assignment>
<left>result.BottomY</left>
<right>
<typecast type="int">
<value>num4</value>
</typecast>
</right>
</assignment>
</statements>
</body>
</if>
<return>

View File

@ -3,7 +3,8 @@
<xs:element name="property">
<xs:complexType>
<xs:sequence>
<xs:element name="getter" type="getterType"/>
<xs:element name="getter" type="getterType" minOccurs="0"/>
<xs:element name="setter" type="setterType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="access" type="xs:string" use="required"/>
@ -11,12 +12,19 @@
</xs:complexType>
</xs:element>
<xs:complexType name="getterType">
<xs:sequence>
<xs:element name="body" type="bodyType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="setterType">
<xs:sequence>
<xs:element name="body" type="bodyType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="bodyType">
<xs:sequence>
<xs:element name="statements" type="statementsType"/>
@ -27,7 +35,6 @@
<xs:choice maxOccurs="unbounded">
<xs:element name="variabledeclaration" type="variableDeclarationType"/>
<xs:element name="if" type="ifType"/>
<xs:element name="else" type="elseType"/>
<xs:element name="assignment" type="assignmentType"/>
<xs:element name="return" type="returnType"/>
<xs:element name="ternaryoperator" type="ternaryOperatorType"/>
@ -43,6 +50,7 @@
<xs:sequence>
<xs:element name="condition" type="conditionType"/>
<xs:element name="body" type="bodyType"/>
<xs:element name="else" type="elseType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
@ -61,7 +69,7 @@
<xs:complexType name="assignmentType">
<xs:sequence>
<xs:element name="left" type="xs:string"/>
<xs:element name="right" type="rightType"/>
<xs:element name="right" type="expressionType"/>
</xs:sequence>
</xs:complexType>
@ -75,10 +83,26 @@
</xs:choice>
</xs:complexType>
<xs:complexType name="expressionType" mixed="true">
<xs:choice minOccurs="0">
<xs:element name="binaryoperation" type="binaryOperationType"/>
<xs:element name="typecast" type="typeCastType"/>
<xs:element name="ternaryoperator" type="ternaryOperatorType"/>
<xs:element name="value" type="xs:string"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="binaryOperandType" mixed="true">
<xs:choice minOccurs="0">
<xs:element name="expression" type="expressionType"/>
<xs:element name="binaryoperation" type="binaryOperationType"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="binaryOperationType">
<xs:sequence>
<xs:element name="left" type="xs:string"/>
<xs:element name="right" type="xs:string"/>
<xs:element name="left" type="binaryOperandType"/>
<xs:element name="right" type="binaryOperandType"/>
</xs:sequence>
<xs:attribute name="operator" type="xs:string" use="required"/>
</xs:complexType>
@ -90,11 +114,20 @@
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="ternaryOperatorType">
<xs:complexType name="ternaryBranchType" mixed="true">
<xs:choice minOccurs="0">
<xs:element name="binaryoperation" type="binaryOperationType"/>
<xs:element name="typecast" type="typeCastType"/>
<xs:element name="expression" type="xs:string"/>
<xs:element name="value" type="xs:string"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="ternaryOperatorType" mixed="true">
<xs:sequence>
<xs:element name="condition" type="xs:string"/>
<xs:element name="iftrue" type="rightType"/>
<xs:element name="iffalse" type="rightType"/>
<xs:element name="condition" type="conditionType"/>
<xs:element name="iftrue" type="ternaryBranchType"/>
<xs:element name="iffalse" type="ternaryBranchType"/>
</xs:sequence>
</xs:complexType>

View File

@ -0,0 +1,5 @@
package com.openeggbert.next.ast;
public enum Access {
PUBLIC, PROTECTED, PRIVATE, PACKAGE;
}

View File

@ -0,0 +1,9 @@
package com.openeggbert.next.ast;
import lombok.Data;
@Data
public class Assignment extends Statement {
private String left;
private Expression right;
}

View File

@ -0,0 +1,4 @@
package com.openeggbert.next.ast;
public class BinaryOperation extends Expression{
}

View File

@ -0,0 +1,11 @@
package com.openeggbert.next.ast;
import lombok.Data;
import java.util.List;
@Data
public class Body {
private List<Statement> statements;
}

View File

@ -0,0 +1,11 @@
package com.openeggbert.next.ast;
import lombok.Data;
import java.util.List;
@Data
public class Else {
private Body body;
}

View File

@ -0,0 +1,4 @@
package com.openeggbert.next.ast;
public class Expression {
}

View File

@ -0,0 +1,9 @@
package com.openeggbert.next.ast;
import lombok.Data;
@Data
public class Getter {
private Body body;
}

View File

@ -0,0 +1,9 @@
package com.openeggbert.next.ast;
import java.util.concurrent.locks.Condition;
public class If extends Statement {
private Condition condition;
private Body body;
private Else elseBranch;
}

View File

@ -0,0 +1,5 @@
package com.openeggbert.next.ast;
public enum PrimitiveType {
INT, LONG, FLOAT, DOUBLE, STRING
}

View File

@ -0,0 +1,13 @@
package com.openeggbert.next.ast;
import lombok.Data;
@Data
public class Property {
private String name;
private Access access;
private String returnType;
private Getter getter;
private Setter setter;
}

View File

@ -0,0 +1,9 @@
package com.openeggbert.next.ast;
import lombok.Data;
@Data
public class Setter {
private Body body;
}

View File

@ -0,0 +1,4 @@
package com.openeggbert.next.ast;
public class Statement {
}

View File

@ -0,0 +1,4 @@
package com.openeggbert.next.ast;
public class TernaryOperator extends Expression{
}

View File

@ -0,0 +1,4 @@
package com.openeggbert.next.ast;
public class TypeCast extends Expression{
}

View File

@ -0,0 +1,5 @@
package com.openeggbert.next.ast;
public class Value extends Expression{
private String string;
}

View File

@ -0,0 +1,9 @@
package com.openeggbert.next.ast;
import lombok.Data;
@Data
public class VariableDeclaration extends Statement {
private String name;
private String initialization;
}