diff --git a/doc/RFC.md b/doc/RFC.md index 306f6a3..3753c33 100644 --- a/doc/RFC.md +++ b/doc/RFC.md @@ -4,7 +4,7 @@ > version 1.0.0 -date: 2023-04-02T21:22:10+0200
+date: 2023-04-02T21:37:32+0200
[![Actions Status](https://github.com/coderofsalvation/xrfragment/workflows/test/badge.svg)](https://github.com/coderofsalvation/xrfragment/actions) # `://foo.com/my3d.asset#pos=1,0,0&prio=-5` diff --git a/doc/generate.awk b/doc/generate.awk index cdf936a..179ef9a 100644 --- a/doc/generate.awk +++ b/doc/generate.awk @@ -8,6 +8,9 @@ # # var foo; // comment with 2 leading spaces is markdown too $(date) # +# easily refactorable to hash-based languages (py/bash/perl/lua e.g.) +# by changing the regexes +# /\$\(/ { cmd=$0; gsub(/^.*\$\(/,"",cmd); gsub(/\).*/,"",cmd); diff --git a/src/xrfragment/Parser.hx b/src/xrfragment/Parser.hx index 19ad59b..6b145f4 100644 --- a/src/xrfragment/Parser.hx +++ b/src/xrfragment/Parser.hx @@ -53,14 +53,14 @@ class Parser { @:keep public static function guessType(v:Value, str:String):Void { v.string = str; - if( str.split(",").length > 1){ /// 1. `,` assumes 1D/2D/3D vector-values like x[,y[,z]] - var xyz:Array = str.split(","); /// 1. parseFloat(..) and parseInt(..) is applied to vector/float and int values - if( xyz.length > 0 ) v.x = Std.parseFloat(xyz[0]); /// 1. anything else will be treated as string-value - if( xyz.length > 1 ) v.y = Std.parseFloat(xyz[1]); /// 1. incompatible value-types will be dropped / not used - if( xyz.length > 2 ) v.y = Std.parseFloat(xyz[2]); /// - } /// > the xrfragment specification should stay simple enough - /// > for anyone to write a parser using either regexes or grammar/lexers - if( Type.isColor.match(str) ) v.color = str; /// > therefore expressions/comprehensions are not supported (max wildcard/comparison operators for queries e.g.) + if( str.split(",").length > 1){ // 1. `,` assumes 1D/2D/3D vector-values like x[,y[,z]] + var xyz:Array = str.split(","); // 1. parseFloat(..) and parseInt(..) is applied to vector/float and int values + if( xyz.length > 0 ) v.x = Std.parseFloat(xyz[0]); // 1. anything else will be treated as string-value + if( xyz.length > 1 ) v.y = Std.parseFloat(xyz[1]); // 1. incompatible value-types will be dropped / not used + if( xyz.length > 2 ) v.y = Std.parseFloat(xyz[2]); // + } // > the xrfragment specification should stay simple enough + // > for anyone to write a parser using either regexes or grammar/lexers + if( Type.isColor.match(str) ) v.color = str; // > therefore expressions/comprehensions are not supported (max wildcard/comparison operators for queries e.g.) if( Type.isFloat.match(str) ) v.float = Std.parseFloat(str); if( Type.isInt.match(str) ) v.int = Std.parseInt(str); }