@@ -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+
5877typedef 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.
190298class YScript {
191299 private var keywords : Map <String , String >;
192300
0 commit comments