Hello, World! Guide¶
This guide will teach you the very basics of evaluating RSML via a programming language.
This guide assumes you're familiar with your language of choice and already setup RSML for it.
The actual RSML¶
To keep things simple, we will store our RSML as a string
.
"Hello, World!"
will be triggered no matter what, as our Regex expression matches anything that has more than 1 character, which is the case of all MSBuild RIDs.
Setting up the parser¶
- This line creates a
RSParser
with theofficial-25
standard.
If you wish to use a different language standard, you can freely do so in C#. In Python, it's slightly trickier as you can only pick from official-25
and roadlike
.
Evaluating¶
- This line creates a
RSParser
with theofficial-25
standard. - The output will be
null
if there are no matches.
- You don't have an actual parser in RSML for Python.
- This will use the
official-25
language standard.
Note that, for Python, there is a whole new class, called the CLI Executable, which points to an existing executable of RSML's CLI on disk.
For C#, evaluation is simpler and more customizable, too.
Getting Output¶
Finally, we can output the result... as long as it isn't null
, of course.
- This line creates a
RSParser
with theofficial-25
standard. - The output will be
null
if there are no matches. - This situation will never be true, considering our RSML string contains a wildcard situation (
.+
) to avoid no-match behaviors.
- You don't have an actual parser in RSML for Python.
- This will use the
official-25
language standard. - Default error messages start with
[ERROR]
, while default warning messages start with[WARNING]
. No-match behavior is considered a non-critical error by the CLI, which means it's treated as a warning. - This situation will never be true, considering our RSML string contains a wildcard situation (
.+
) to avoid no-match behaviors.
Use of any
¶
Right now, we are using .+
as our wildcard match, but that is not readable to someone who doesn't know that much Regex. Thankfully, both the C# and Python APIs support the expansion of any. Basically, when the word any
is encountered in the position of a possible match, it is "expanded" (replaced by) to the Regex expression .+
, so you don't have to write it manually.
The only change we'll need to do is the following one:
Conclusion¶
You have finished this guy and evaluated your very first RSML string. Congrats!
RSML is extremely powerful when you want dynamic logic path resolution based on the OS and CPU architecture. Note that it does not benefit you in any way to use RSML as if it were an if
/else
based on the host.
It is supposed to be embedded and for it to decide on certain aspects that should only be set if the host has certain characteristics.