<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Parser</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>Recent changes to Parser</description><atom:link href="https://sourceforge.net/p/gimli/wiki/Parser/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 18 Sep 2023 12:40:27 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/gimli/wiki/Parser/feed" rel="self" type="application/rss+xml"/><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -3,7 +3,7 @@
 This is the file structure and in which order to incorporate them:
 * _gml-parser.js_ -&amp;gt; you can use this parser standalone for your own independent projects.
   * _gml-standard-parsers.js_ -&amp;gt; you can use this with gml-parser.js for your own independent GIML-interpreter or game using e.g. Unity or RPGMaker (both supporting JavaScript).
-    * _gml-interpreter.js_ -&amp;gt; this actual interpreter which runs on [ben0bi.dlinkddns.com](http://ben0bi.dlinkddns.com)
+    * _gml-interpreter.js_ -&amp;gt; this actual interpreter which runs on [https://benis-bastelschuppen.github.io/GIMLI](https://benis-bastelschuppen.github.io/GIMLI)

 The main functionality of the parser is to load in additional files (defined in your main file and also in that additional files*) and execute your main function after all the files were loaded. While loading, all registered parsers will parse "the shit" out of your files.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:27 -0000</pubDate><guid>https://sourceforge.net1230614cc803e92372f50ad57e7760f2373fcc98</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v10
+++ v11
@@ -2,10 +2,8 @@

 This is the file structure and in which order to incorporate them:
 * _gml-parser.js_ -&amp;gt; you can use this parser standalone for your own independent projects.
-  * _gml-standard-parser.js_ -&amp;gt; you can use this with gml-parser.js for your own independent GIML-interpreter or game using e.g. Unity or RPGMaker (both supporting JavaScript).
+  * _gml-standard-parsers.js_ -&amp;gt; you can use this with gml-parser.js for your own independent GIML-interpreter or game using e.g. Unity or RPGMaker (both supporting JavaScript).
     * _gml-interpreter.js_ -&amp;gt; this actual interpreter which runs on [ben0bi.dlinkddns.com](http://ben0bi.dlinkddns.com)
-
-_Parser is currently in development on another project. Please be patient._

 The main functionality of the parser is to load in additional files (defined in your main file and also in that additional files*) and execute your main function after all the files were loaded. While loading, all registered parsers will parse "the shit" out of your files.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:27 -0000</pubDate><guid>https://sourceforge.neta0a403b0f37a54bda2f4956e28b7bf884b0ef3aa</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v9
+++ v10
@@ -65,14 +65,14 @@
    });
 &lt;/pre&gt;

&lt;p&gt;-You can also define "items" of array members with their own parseGML function. Value2 would be such an item. It would be added like this:&lt;br/&gt;
+You can also define "items" of array members with their own parseGML function. Using Value2 like above would need you to make a new file for each value2. Rather use arrays with "items" (of value2-s). It would be added like this:&lt;/p&gt;
&lt;pre&gt; var item = function()
 {
-   ...
+   ..
    this.parseGML(json, rootPath)
-   {...}
+   {..}
 }

 var myParser = function()
@@ -80,11 +80,11 @@
   this.itemArray = [];
   this.parseGML = function(json, rootPath)
   {
-    ...
+    ..
     // here, ARRAY is an array with some items which have their own values.
     if(__defined(json["ARRAY"]))
     {
-      for(var i=0;i&amp;lt;json["array"].length;i++) +="" for(var="" i="0;i" &amp;amp;lt;="" json["array"].length;i++)="" {="" var="" itm="new" item();="" itm.parsegml(json["array"][i]);="" &amp;lt;="" pre=""&amp;gt;

&amp;lt;/json["array"].length;i++)&amp;gt;&lt;/pre&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:25 -0000</pubDate><guid>https://sourceforge.net1ccd3cc8a6b0bf2a853df9c39b8ebfbf00563893</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v8
+++ v9
@@ -2,7 +2,7 @@

 This is the file structure and in which order to incorporate them:
 * _gml-parser.js_ -&amp;gt; you can use this parser standalone for your own independent projects.
-  * _gml-standard-parser.js_ -&amp;gt; you can use this with gml-parser.jse for your own independent GIML-interpreter or game.
+  * _gml-standard-parser.js_ -&amp;gt; you can use this with gml-parser.js for your own independent GIML-interpreter or game using e.g. Unity or RPGMaker (both supporting JavaScript).
     * _gml-interpreter.js_ -&amp;gt; this actual interpreter which runs on [ben0bi.dlinkddns.com](http://ben0bi.dlinkddns.com)

 _Parser is currently in development on another project. Please be patient._
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:25 -0000</pubDate><guid>https://sourceforge.netcc84ae2f3aa3f38f807f282a97326abd96ec9ed1</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -1,9 +1,9 @@
 As of v0.7.0, the parser and the interpreter are separated.

 This is the file structure and in which order to incorporate them:
-* gml-parser.js -&amp;gt; you can use this standalone for your own independent projects.
-  * gml-standard-parser.js -&amp;gt; you can use this with gml-parser.jse for your own independent GIML-interpreter or game.
-    * gml-interpreter.js -&amp;gt; this actual interpreter which runs on [ben0bi.dlinkddns.com](http://ben0bi.dlinkddns.com)
+* _gml-parser.js_ -&amp;gt; you can use this parser standalone for your own independent projects.
+  * _gml-standard-parser.js_ -&amp;gt; you can use this with gml-parser.jse for your own independent GIML-interpreter or game.
+    * _gml-interpreter.js_ -&amp;gt; this actual interpreter which runs on [ben0bi.dlinkddns.com](http://ben0bi.dlinkddns.com)

 _Parser is currently in development on another project. Please be patient._

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:25 -0000</pubDate><guid>https://sourceforge.net6eb99e92cf7ba5bac9d5785468ba1a939a011e2a</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -1,4 +1,9 @@
 As of v0.7.0, the parser and the interpreter are separated.
+
+This is the file structure and in which order to incorporate them:
+* gml-parser.js -&amp;gt; you can use this standalone for your own independent projects.
+  * gml-standard-parser.js -&amp;gt; you can use this with gml-parser.jse for your own independent GIML-interpreter or game.
+    * gml-interpreter.js -&amp;gt; this actual interpreter which runs on [ben0bi.dlinkddns.com](http://ben0bi.dlinkddns.com)

 _Parser is currently in development on another project. Please be patient._

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:25 -0000</pubDate><guid>https://sourceforge.net2f44c2e494a7575d04e206a4771bb17e4ab652a3</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -1,12 +1,16 @@
 As of v0.7.0, the parser and the interpreter are separated.
+
+_Parser is currently in development on another project. Please be patient._

 The main functionality of the parser is to load in additional files (defined in your main file and also in that additional files*) and execute your main function after all the files were loaded. While loading, all registered parsers will parse "the shit" out of your files.

 _*like: index.gml loads floor.gml and floor.gml loads bedroom.gml and kitchen.gml. bedroom.gml also loads secondbathroom.gml...etc._

-As mentioned, the parser structure can hold your own individual parsers. For that, you need to create a class and add the function _parseGML(json, rootPath)_ to it. Then you register your parser in the _GMLParser_ module and load your files.
+As mentioned, the parser structure can hold your own individual parsers. For that, you need to create a class and add the functions _parseGML(json, rootPath)_ and _clear()_ to it. Then you register your parser in the _GMLParser_ module and load your files.

 You can add all the standard GML-parsers: ROOMS, ITEMS, SOUNDS and PANELS. They are NOT added automatically so you can define your own data structures.
+
+You can use the given rootPath for parsing relative paths out of the json and converting them to absolute paths.

 You will get your data out of the parser you write. That means, you parse the json data into variables which you define in your parser.

@@ -55,3 +59,33 @@
        var value1 = GMLParser.getParser("MYPARSER").value1;
    });
 &lt;/pre&gt;
&lt;p&gt;+&lt;br/&gt;
+You can also define "items" of array members with their own parseGML function. Value2 would be such an item. It would be added like this:&lt;br/&gt;
+&lt;br/&gt;
+&lt;/p&gt;&lt;pre&gt;&lt;br/&gt;
+var item = function()&lt;br/&gt;
+{&lt;br/&gt;
+   ...&lt;br/&gt;
+   this.parseGML(json, rootPath)&lt;br/&gt;
+   {...}&lt;br/&gt;
+}&lt;br/&gt;
+&lt;br/&gt;
+var myParser = function()&lt;br/&gt;
+{&lt;br/&gt;
+  this.itemArray = [];&lt;br/&gt;
+  this.parseGML = function(json, rootPath)&lt;br/&gt;
+  {&lt;br/&gt;
+    ...&lt;br/&gt;
+    // here, ARRAY is an array with some items which have their own values.&lt;br/&gt;
+    if(__defined(json&lt;span&gt;["ARRAY"]&lt;/span&gt;))&lt;br/&gt;
+    {&lt;br/&gt;
+      for(var i=0;i&amp;lt;json&lt;span&gt;["ARRAY"]&lt;/span&gt;.length;i++)&lt;br/&gt;
+      {&lt;br/&gt;
+         var itm= new item();&lt;br/&gt;
+         itm.parseGML(json&lt;span&gt;["ARRAY"]&lt;/span&gt;&lt;span&gt;[i]&lt;/span&gt;);&lt;br/&gt;
+         this.itemArray.push(itm);&lt;br/&gt;
+      }&lt;br/&gt;
+    }&lt;br/&gt;
+  }&lt;br/&gt;
+}&lt;br/&gt;
+&lt;/pre&gt;&lt;br/&gt;
&lt;p&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:25 -0000</pubDate><guid>https://sourceforge.net395ab4f4f20346c584c9513529afe821e39f713a</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -2,7 +2,7 @@

 The main functionality of the parser is to load in additional files (defined in your main file and also in that additional files*) and execute your main function after all the files were loaded. While loading, all registered parsers will parse "the shit" out of your files.

-&lt;small&gt;*like: index.gml loads floor.gml and floor.gml loads bedroom.gml and kitchen.gml. bedroom.gml also loads secondbathroom.gml...etc.&lt;/small&gt;
+_*like: index.gml loads floor.gml and floor.gml loads bedroom.gml and kitchen.gml. bedroom.gml also loads secondbathroom.gml...etc._

 As mentioned, the parser structure can hold your own individual parsers. For that, you need to create a class and add the function _parseGML(json, rootPath)_ to it. Then you register your parser in the _GMLParser_ module and load your files.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:25 -0000</pubDate><guid>https://sourceforge.net6336c045546dcc26ff79449b844df58e8e2c51df</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -1,6 +1,8 @@
 As of v0.7.0, the parser and the interpreter are separated.

-The main functionality of the parser is to load in additional files and execute your main function after all the files were loaded. While loading, all registered parsers will parse "the shit" out of your files.
+The main functionality of the parser is to load in additional files (defined in your main file and also in that additional files*) and execute your main function after all the files were loaded. While loading, all registered parsers will parse "the shit" out of your files.
+
+&lt;small&gt;*like: index.gml loads floor.gml and floor.gml loads bedroom.gml and kitchen.gml. bedroom.gml also loads secondbathroom.gml...etc.&lt;/small&gt;

 As mentioned, the parser structure can hold your own individual parsers. For that, you need to create a class and add the function _parseGML(json, rootPath)_ to it. Then you register your parser in the _GMLParser_ module and load your files.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:24 -0000</pubDate><guid>https://sourceforge.nete00673f5e9bed8a589321b7476bb5722cad67f92</guid></item><item><title>Parser modified by Benedict Jäggi</title><link>https://sourceforge.net/p/gimli/wiki/Parser/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -7,6 +7,8 @@
 You can add all the standard GML-parsers: ROOMS, ITEMS, SOUNDS and PANELS. They are NOT added automatically so you can define your own data structures.

 You will get your data out of the parser you write. That means, you parse the json data into variables which you define in your parser.
+
+Remember that all the json variable names will be converted to UPPERCASE letters!

 Here is an example:

@@ -22,12 +24,19 @@
       // example:
       if(__defined(json['VALUE1']) // check if the value is defined.
          this.value1 = json['VALUE1'];
+      if(__defined(json['VALUE2'])
+         this.value2.push(json['VALUE2']);
    }
 }
 &lt;/pre&gt;

&lt;p&gt;Ok. This is our own parser which gets the &lt;em&gt;value1&lt;/em&gt; out of the global structure.&lt;br/&gt;
 You need to go into your structures "by yourself". You ever get the whole file structure to the parser.&lt;br/&gt;
+&lt;br/&gt;
+Value1 will be overwritten with each file that defines a &lt;em&gt;value1&lt;/em&gt;.&lt;br/&gt;
+Value2 will be collected with each file that defines a &lt;em&gt;value2&lt;/em&gt;.&lt;br/&gt;
+After the parser has loaded and parsed all files, there is just one &lt;em&gt;value1&lt;/em&gt; with the value given in the last loaded file.&lt;br/&gt;
+But there may be more than one &lt;em&gt;value2&lt;/em&gt; because they were collected in an array. Just to note.  &lt;/p&gt;
&lt;p&gt;Now we load a GML file and get the &lt;em&gt;value1&lt;/em&gt; for example purposes.&lt;/p&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benedict Jäggi</dc:creator><pubDate>Mon, 18 Sep 2023 12:40:24 -0000</pubDate><guid>https://sourceforge.net0f4e3a775448914087a02e586f0af14dd966ecc9</guid></item></channel></rss>