Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
MythicCraft
MEG MoLang Extension
Commits
555dc5dd
Commit
555dc5dd
authored
2 years ago
by
Ticxo
Browse files
Options
Download
Email Patches
Plain Diff
Directly move everything to this repo
parent
2ff9eb39
Changes
93
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
201 additions
and
22 deletions
+201
-22
src/main/java/com/bedrockk/molang/runtime/value/MoValue.java
src/main/java/com/bedrockk/molang/runtime/value/MoValue.java
+22
-0
src/main/java/com/bedrockk/molang/runtime/value/StringValue.java
...n/java/com/bedrockk/molang/runtime/value/StringValue.java
+20
-0
src/main/java/com/bedrockk/molang/utils/ExprUtils.java
src/main/java/com/bedrockk/molang/utils/ExprUtils.java
+28
-0
src/main/java/com/bedrockk/molang/utils/FileUtils.java
src/main/java/com/bedrockk/molang/utils/FileUtils.java
+28
-0
src/main/java/com/bedrockk/molang/visitor/ExprConnectingVisitor.java
...va/com/bedrockk/molang/visitor/ExprConnectingVisitor.java
+43
-0
src/main/java/com/bedrockk/molang/visitor/FindingVisitor.java
...main/java/com/bedrockk/molang/visitor/FindingVisitor.java
+29
-0
src/main/java/com/bedrockk/molang/visitor/FirstFindingVisitor.java
...java/com/bedrockk/molang/visitor/FirstFindingVisitor.java
+30
-0
src/main/java/com/ticxo/megml/MegML.java
src/main/java/com/ticxo/megml/MegML.java
+1
-1
target/classes/plugin.yml
target/classes/plugin.yml
+0
-7
target/maven-archiver/pom.properties
target/maven-archiver/pom.properties
+0
-5
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
...-compiler-plugin/compile/default-compile/createdFiles.lst
+0
-5
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
...en-compiler-plugin/compile/default-compile/inputFiles.lst
+0
-4
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
...ler-plugin/testCompile/default-testCompile/inputFiles.lst
+0
-0
No files found.
src/main/java/com/bedrockk/molang/runtime/value/MoValue.java
0 → 100644
View file @
555dc5dd
package
com.bedrockk.molang.runtime.value
;
public
interface
MoValue
{
static
MoValue
of
(
Object
value
)
{
if
(
value
instanceof
MoValue
)
{
return
(
MoValue
)
value
;
}
else
{
return
new
DoubleValue
(
value
);
}
}
Object
value
();
default
String
asString
()
{
return
this
.
toString
();
}
default
double
asDouble
()
{
return
1.0
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/bedrockk/molang/runtime/value/StringValue.java
0 → 100644
View file @
555dc5dd
package
com.bedrockk.molang.runtime.value
;
public
class
StringValue
implements
MoValue
{
private
final
String
value
;
public
StringValue
(
String
value
)
{
this
.
value
=
value
;
}
@Override
public
String
value
()
{
return
value
;
}
@Override
public
String
asString
()
{
return
value
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/bedrockk/molang/utils/ExprUtils.java
0 → 100644
View file @
555dc5dd
package
com.bedrockk.molang.utils
;
import
com.bedrockk.molang.Expression
;
public
final
class
ExprUtils
{
public
static
Expression
getExprAttribute
(
Expression
expression
,
String
attributeName
)
{
Object
parent
=
expression
.
getAttributes
().
get
(
attributeName
);
if
(
parent
instanceof
Expression
)
{
return
(
Expression
)
parent
;
}
return
null
;
}
public
static
Expression
parent
(
Expression
expression
)
{
return
getExprAttribute
(
expression
,
"parent"
);
}
public
static
Expression
next
(
Expression
expression
)
{
return
getExprAttribute
(
expression
,
"next"
);
}
public
static
Expression
previous
(
Expression
expression
)
{
return
getExprAttribute
(
expression
,
"previous"
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/bedrockk/molang/utils/FileUtils.java
0 → 100644
View file @
555dc5dd
package
com.bedrockk.molang.utils
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
public
class
FileUtils
{
public
static
String
readFile
(
InputStream
inputStream
)
throws
IOException
{
return
readFile
(
new
InputStreamReader
(
inputStream
,
StandardCharsets
.
UTF_8
));
}
private
static
String
readFile
(
Reader
reader
)
throws
IOException
{
try
(
BufferedReader
br
=
new
BufferedReader
(
reader
))
{
String
temp
=
br
.
readLine
();
StringBuilder
stringBuilder
=
new
StringBuilder
();
while
(
temp
!=
null
)
{
if
(
stringBuilder
.
length
()
!=
0
)
{
stringBuilder
.
append
(
"\n"
);
}
stringBuilder
.
append
(
temp
);
temp
=
br
.
readLine
();
}
return
stringBuilder
.
toString
();
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/bedrockk/molang/visitor/ExprConnectingVisitor.java
0 → 100644
View file @
555dc5dd
package
com.bedrockk.molang.visitor
;
import
com.bedrockk.molang.ExprVisitor
;
import
com.bedrockk.molang.Expression
;
import
lombok.RequiredArgsConstructor
;
import
java.util.LinkedList
;
import
java.util.List
;
@RequiredArgsConstructor
public
class
ExprConnectingVisitor
implements
ExprVisitor
{
private
final
LinkedList
<
Expression
>
stack
=
new
LinkedList
<>();
private
Expression
previous
;
@Override
public
void
beforeTraverse
(
List
<
Expression
>
expressions
)
{
stack
.
clear
();
previous
=
null
;
}
@Override
public
Object
onVisit
(
Expression
expression
)
{
if
(!
stack
.
isEmpty
())
{
expression
.
getAttributes
().
put
(
"parent"
,
stack
.
getLast
());
}
if
(
previous
!=
null
&&
expression
.
getAttributes
().
get
(
"parent"
)
==
previous
.
getAttributes
().
get
(
"parent"
))
{
expression
.
getAttributes
().
put
(
"previous"
,
previous
);
previous
.
getAttributes
().
put
(
"next"
,
expression
);
}
stack
.
add
(
expression
);
return
null
;
}
@Override
public
void
onLeave
(
Expression
expression
)
{
previous
=
expression
;
stack
.
pollLast
();
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/bedrockk/molang/visitor/FindingVisitor.java
0 → 100644
View file @
555dc5dd
package
com.bedrockk.molang.visitor
;
import
com.bedrockk.molang.ExprVisitor
;
import
com.bedrockk.molang.Expression
;
import
lombok.RequiredArgsConstructor
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.function.Predicate
;
@RequiredArgsConstructor
public
class
FindingVisitor
implements
ExprVisitor
{
private
final
Predicate
<
Expression
>
predicate
;
private
final
List
<
Expression
>
foundExpressions
=
new
ArrayList
<>();
@Override
public
Object
onVisit
(
Expression
expression
)
{
if
(
predicate
.
test
(
expression
))
{
foundExpressions
.
add
(
expression
);
}
return
null
;
}
public
List
<
Expression
>
getFoundExpressions
()
{
return
foundExpressions
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/bedrockk/molang/visitor/FirstFindingVisitor.java
0 → 100644
View file @
555dc5dd
package
com.bedrockk.molang.visitor
;
import
com.bedrockk.molang.ExprTraverser
;
import
com.bedrockk.molang.ExprVisitor
;
import
com.bedrockk.molang.Expression
;
import
lombok.RequiredArgsConstructor
;
import
java.util.function.Predicate
;
@RequiredArgsConstructor
public
class
FirstFindingVisitor
implements
ExprVisitor
{
private
final
Predicate
<
Expression
>
predicate
;
private
Expression
found
;
@Override
public
Object
onVisit
(
Expression
expression
)
{
if
(
predicate
.
test
(
expression
))
{
found
=
expression
;
return
ExprTraverser
.
ActionType
.
STOP_TRAVERSAL
;
}
return
null
;
}
public
Expression
getFound
()
{
return
found
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/ticxo/megml/MegML.java
View file @
555dc5dd
...
...
@@ -23,7 +23,7 @@ public class MegML extends JavaPlugin {
@Override
public
void
onDisable
()
{
manager
.
cancel
();
}
public
static
IKeyframeData
parse
(
String
data
)
{
...
...
This diff is collapsed.
Click to expand it.
target/classes/plugin.yml
deleted
100644 → 0
View file @
2ff9eb39
name
:
ModelEngine-MoLang
author
:
Ticxo
main
:
com.ticxo.megml.MegML
version
:
R1.0.0
api-version
:
1.16
depend
:
-
ModelEngine
\ No newline at end of file
This diff is collapsed.
Click to expand it.
target/maven-archiver/pom.properties
deleted
100644 → 0
View file @
2ff9eb39
#Generated by Maven
#Wed Dec 07 01:24:15 PST 2022
groupId
=
com.ticxo.megmolang
artifactId
=
Meg-Molang
version
=
R1.0.0
This diff is collapsed.
Click to expand it.
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
deleted
100644 → 0
View file @
2ff9eb39
com\ticxo\megml\MegML.class
com\ticxo\megml\ModelQuery.class
com\ticxo\megml\ModelQuery$1.class
com\ticxo\megml\QueryData.class
com\ticxo\megml\RuntimeManager.class
This diff is collapsed.
Click to expand it.
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
deleted
100644 → 0
View file @
2ff9eb39
C:\Users\shawn\IdeaProjects\MegMolang\src\main\java\com\ticxo\megml\RuntimeManager.java
C:\Users\shawn\IdeaProjects\MegMolang\src\main\java\com\ticxo\megml\QueryData.java
C:\Users\shawn\IdeaProjects\MegMolang\src\main\java\com\ticxo\megml\ModelQuery.java
C:\Users\shawn\IdeaProjects\MegMolang\src\main\java\com\ticxo\megml\MegML.java
This diff is collapsed.
Click to expand it.
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
deleted
100644 → 0
View file @
2ff9eb39
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment