ad_page_contract_split_argspec_flag_parameters (private)

 ad_page_contract_split_argspec_flag_parameters flag_parameters

Defined in packages/acs-tcl/tcl/tcl-documentation-procs.tcl

Splits the flag parameters from an argespec into a list of values. Flag parameters are a list of values expressed as <value>[|<value> ...]

Parameters:
flag_parameters (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_page_contract_argspec_parsing ad_page_contract_argspec_parsing (test acs-tcl) ad_page_contract_split_argspec_flag_parameters ad_page_contract_split_argspec_flag_parameters test_ad_page_contract_argspec_parsing->ad_page_contract_split_argspec_flag_parameters ad_page_contract ad_page_contract (public) ad_page_contract->ad_page_contract_split_argspec_flag_parameters

Testcases:
ad_page_contract_argspec_parsing
Source code:
    # First, unescape the parenthesys
    regsub -all {\\\(} $flag_parameters {(} flag_parameters
    regsub -all {\\\)} $flag_parameters {)} flag_parameters

    set parameters [list]
    while {[string length $flag_parameters] > 0} {
        set flag_parameter ""

        # First, keep appending to the string as long as we find
        # escaped occurrences of the pipe character.
        while { [set quoted_sep_i [string first {\|} $flag_parameters]] >= 0 } {
            append flag_parameter [string range $flag_parameters 0 ${quoted_sep_i}-1]|
            set flag_parameters [string range $flag_parameters ${quoted_sep_i}+2 end]
        }

        # Now that all escaped occurrences are over, find the first
        # unescaped one.
        set pi [string first | $flag_parameters]
        if {$pi == -1} {
            # There was none, the entire remainder of the string is
            # our parameter and we are done.
            append flag_parameter $flag_parameters
            set flag_parameters ""
        } else {
            # Our parameter is all of the remaining string up to the
            # pipe character. We will keep parsing further.
            append flag_parameter [string range $flag_parameters 0 ${pi}-1]
            set flag_parameters [string range $flag_parameters ${pi}+1 end]
        }
        lappend parameters $flag_parameter
    }

    return $parameters
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: