Title

_rm_parse_AeqB --
parses a list of the form A=B B=C D E F and returns list for the left
element and the right element where it is assume if a single element
is in the list that it imples D=D

Syntax

_rm_parse_AeqB
,
options
[
options
]

Required
list(ab-list) ab-listis a string with information
of the form a=b c repeated as often as needed. Where the
left element is called the label elmement and the right the source element.

Optional

sourcenames(names-for-right) names-for-right are
the names to assign to the elements on the right.

labelnames(names-for-left) names-for-left are
the names to assign to the elements on the left; these are the newly
labeled elements, such as PrY_1=b labels b as PrY_1.

<notes>

Description

_rm_parse_AeqB is a programmer's tool that parses a A=B list.

local list "a=1 b=2 3 4 c=99"
local srcok "1 2 3"
di "valid source names: `srcok'"

local lblok "a b d"
di "valid labels: `lblok'"

di "list is: `list'"
di "NOTE: labels: 1 2 3 4 are ok; 5 not"
di "NOTE: source: 1 2 3 are ok; 4 5 not"

_rm_parse_AeqB, list(`list') sourcenames(`srcok') labelnames(`lblok')

di "`s(label_names)' name to use as label"
di "`s(source_names)' name to use as source"
di "`s(label_valid)' string of 1 0's for valid and not"
di "`s(source_valid)' string of 1 0's for valid and not"
di "`s(error)' 0 ok; 1 unbalanced; 2 invalid label"

Saved results

_rm_parse_AeqB saves in s():

Macros:

s(label_names) Parsed labels for left of equal sign.

s(source_names) Parsed names for right of equal sign.

s(label_valid) If list of valid labels is given, this returns
a string of 1 and 0 with 1 indicting a valid name.

s(source_valid) If list of valid source names
is given, this returns
a string of 1 and 0 with 1 indicting a valid name.

s(error) 1 if the A=B list is invalid.

Also see

_rm for other _rm programming commands.