update documentation

This commit is contained in:
Leon van Kammen 2023-04-07 13:41:57 +02:00
parent 4d9d1a6951
commit a01fb08e5d
2 changed files with 6 additions and 6 deletions

View file

@ -4,7 +4,7 @@
> version 1.0.0 > version 1.0.0
date: 2023-04-07T13:38:59+0200<br> date: 2023-04-07T13:41:47+0200<br>
[![Actions Status](https://github.com/coderofsalvation/xrfragment/workflows/test/badge.svg)](https://github.com/coderofsalvation/xrfragment/actions) [![Actions Status](https://github.com/coderofsalvation/xrfragment/workflows/test/badge.svg)](https://github.com/coderofsalvation/xrfragment/actions)
# XRFragment Grammar # XRFragment Grammar
@ -60,8 +60,8 @@ the gist of it:
1. check if param exist 1. check if param exist
1. each key has a regex to validate its value-type (see regexes) 1. each key has a regex to validate its value-type (see regexes)
1. extract the type 1. extract the type
1. use `|` on stringvalues, to split multiple/fallback values 1. use `|` on stringvalues, to split multiple values
1. for each multiple/fallback value, guess the type 1. for each multiple value, guess the type
1. `,` assumes 1D/2D/3D vector-values like x[,y[,z]] 1. `,` assumes 1D/2D/3D vector-values like x[,y[,z]]
1. parseFloat(..) and parseInt(..) is applied to vector/float and int values 1. parseFloat(..) and parseInt(..) is applied to vector/float and int values
1. anything else will be treated as string-value 1. anything else will be treated as string-value

View file

@ -32,13 +32,13 @@ class Parser {
if( Frag.get(key).match(value) ){ // 1. each key has a regex to validate its value-type (see regexes) if( Frag.get(key).match(value) ){ // 1. each key has a regex to validate its value-type (see regexes)
var v:Value = new Value(); var v:Value = new Value();
guessType(v, value); // 1. extract the type guessType(v, value); // 1. extract the type
// process multiple/fallback values // process multiple values
if( value.split("|").length > 1 ){ // 1. use `|` on stringvalues, to split multiple/fallback values if( value.split("|").length > 1 ){ // 1. use `|` on stringvalues, to split multiple values
v.args = new Array<Value>(); v.args = new Array<Value>();
var args:Array<String> = value.split("|"); var args:Array<String> = value.split("|");
for( i in 0...args.length){ for( i in 0...args.length){
var x:Value = new Value(); var x:Value = new Value();
guessType(x, args[i]); // 1. for each multiple/fallback value, guess the type guessType(x, args[i]); // 1. for each multiple value, guess the type
v.args.push( x ); v.args.push( x );
} }
} }