Skip to content

Commit c7aaa0c

Browse files
committed
eep
1 parent ce2830f commit c7aaa0c

File tree

2 files changed

+113
-5
lines changed

2 files changed

+113
-5
lines changed

source/yutautil/ImprovedFileHandling.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ class ImprovedFileHandling {
1717
public static function openFile(title:String, ?filters:Array<FileFilter>, ?preserve_cwd:Bool=true):String {
1818
if (filters != null) {
1919
for (filter in filters) {
20-
filter.desc = filter.desc != null ? filter.desc : filter.ext + " File";
20+
filter.desc = filter.desc != null ? filter.desc : filter.ext.toUpperCase() + " File";
2121
}
2222
}
2323
return FilePopup.open(title, filters, preserve_cwd);
2424
}
2525

2626
public static function saveFile(title:String, ?filter:FileFilter, ?preserve_cwd:Bool=true):String {
2727
if (filter != null) {
28-
filter.desc = filter.desc != null ? filter.desc : "${filter.ext} File";
28+
filter.desc = filter.desc != null ? filter.desc : '${filter.ext.toUpperCase()} File';
2929
}
3030
return FilePopup.save(title, filter, preserve_cwd);
3131
}
@@ -39,7 +39,7 @@ class ImprovedFileHandling {
3939
public static function loadFile(title:String, ?filters:Array<FileFilter>, readType:ReadType, ?operation:Dynamic->Dynamic, ?preserve_cwd:Bool=true):Dynamic {
4040
if (filters != null) {
4141
for (filter in filters) {
42-
filter.desc = filter.desc != null ? filter.desc : "${filter.ext} File";
42+
filter.desc = filter.desc != null ? filter.desc : '${filter.ext.toUpperCase()} File';
4343
}
4444
}
4545
var filePath = openFile(title, filters, preserve_cwd);
@@ -53,7 +53,7 @@ class ImprovedFileHandling {
5353

5454
public static function saveOperation(title:String, ?filter:FileFilter, writeType:ReadType, data:Dynamic, ?preserve_cwd:Bool=true):Bool {
5555
if (filter != null) {
56-
filter.desc = filter.desc != null ? filter.desc : "${filter.ext} File";
56+
filter.desc = filter.desc != null ? filter.desc : '${filter.ext.toUpperCase()} File';
5757
}
5858
var filePath = saveFile(title, filter, preserve_cwd);
5959
if (filePath != null || filePath != "") {

source/yutautil/YScript.hx

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typedef YInterface = {
4141
isInternal:Bool,
4242
},
4343
};
44-
typedef YClass = {
44+
typedef YBaseClass = {
4545
name: String,
4646
fields: Array<YVar>,
4747
methods: Array<YFunction>,
@@ -55,6 +55,25 @@ typedef YClass = {
5555
constructors: Array<YFunction>,
5656
destructors: Array<YFunction>,
5757
};
58+
59+
typedef YTypedClass<T> = {
60+
name: String,
61+
fields: Array<YVar>,
62+
methods: Array<YFunction>,
63+
type:Dynamic,
64+
access:{
65+
isPublic:Bool,
66+
isPrivate:Bool,
67+
isInternal:Bool,
68+
},
69+
extending: Array<YClass>,
70+
implementing: Array<YInterface>,
71+
constructors: Array<YFunction>,
72+
destructors: Array<YFunction>,
73+
};
74+
75+
typedef YClass<T> = flixel.util.typeLimit.OneOfTwo<YBaseClass, YTypedClass<T>>;
76+
5877
typedef YFunction = {
5978
name: String,
6079
returnType:Dynamic,
@@ -184,9 +203,98 @@ typedef YHaskellCall = {
184203
};
185204

186205

206+
class YScriptError extends haxe.Exception {
207+
public function new(message:String) {
208+
super(message, null, null);
209+
}
210+
}
187211

212+
class YscriptException extends haxe.Exception {
213+
public function new(message:String) {
214+
super(message, null, null);
215+
}
216+
}
217+
218+
class YScriptParseError extends haxe.Exception {
219+
public function new(message:String) {
220+
super(message, null, null);
221+
}
222+
}
223+
224+
class YScriptRuntimeError extends haxe.Exception {
225+
public function new(message:String) {
226+
super(message, null, null);
227+
}
228+
}
229+
230+
class YScriptTypeError extends haxe.Exception {
231+
public function new(message:String) {
232+
super(message, null, null);
233+
}
234+
}
235+
236+
class YScriptSyntaxError extends haxe.Exception {
237+
public function new(message:String) {
238+
super(message, null, null);
239+
}
240+
}
241+
242+
class YScriptSemanticError extends haxe.Exception {
243+
public function new(message:String) {
244+
super(message, null, null);
245+
}
246+
}
247+
248+
typedef YSyntaxAST = Array<Dynamic>;
249+
250+
class YScriptSyntaxTree {
251+
252+
var tree:YSyntaxAST;
253+
var currentNode:Dynamic;
254+
var currentIndex:Int;
255+
var currentLine:Int;
256+
var currentColumn:Int;
257+
258+
259+
public function new() {
260+
tree = [];
261+
currentNode = null;
262+
currentIndex = 0;
263+
currentLine = 0;
264+
currentColumn = 0;
265+
}
266+
267+
public function addNode(node:Dynamic):Void {
268+
tree.push(node);
269+
currentNode = node;
270+
currentIndex++;
271+
}
272+
public function getNode(index:Int):Dynamic {
273+
if (index < 0 || index >= tree.length) throw "Index out of bounds: " + index;
274+
return tree[index];
275+
}
276+
public function getCurrentNode():Dynamic {
277+
return currentNode;
278+
}
279+
public function getCurrentIndex():Int {
280+
return currentIndex;
281+
}
282+
283+
// More builders.
284+
public function buildFunction(name:String, parameters:Array<YVar>, body:YSyntaxAST):YSyntaxAST {
285+
var funcNode = { type: "function", name: name, parameters: parameters, body: body };
286+
addNode(funcNode);
287+
return [funcNode];
288+
}
289+
290+
291+
292+
}
188293

294+
// A Scripting Language which has a lot of control over the game, and is used to create mods for the game.
295+
// It also has native control over types, and can be used to create new types, and modify existing ones.
189296

297+
// It is planned to also have compatibility with Lua, and Haxe, and be able to run Lua scripts, and Haxe scripts, as well as be able to run C++ code and C code directly in the future.
190298
class YScript {
191299
private var keywords:Map<String, String>;
192300

0 commit comments

Comments
 (0)