mime::addr_specification (private)

 mime::addr_specification token

Defined in packages/acs-tcl/tcl/tcllib-doc-procs.tcl

Parse the next address specification using the internal MIME parser state and lookahead. Invalid address syntax can raise an error. This version-dependent helper is not a public API.

Parameters:
token (required)
Internal address-parser token.
Returns:
1 if another address was parsed, or 0 at the end of the list.

Partial Call Graph (max 5 caller/called nodes):
mime::addr_group mime::addr_group (private) mime::addr_specification mime::addr_specification mime::addr_group->mime::addr_specification mime::addr_next mime::addr_next (private) mime::addr_next->mime::addr_specification mime::addr_domain mime::addr_domain (private) mime::addr_specification->mime::addr_domain mime::addr_end mime::addr_end (private) mime::addr_specification->mime::addr_end mime::addr_phrase mime::addr_phrase (private) mime::addr_specification->mime::addr_phrase mime::addr_routeaddr mime::addr_routeaddr (private) mime::addr_specification->mime::addr_routeaddr mime::parselexeme mime::parselexeme (private) mime::addr_specification->mime::parselexeme

Testcases:
No testcase defined.
Source code:
    # FRINK: nocheck
    variable $token
    upvar 0 $token state

    set lookahead $state(input)
    switch -- [parselexeme $token] {
        LX_ATOM
            -
        LX_QSTRING {
            set state(phrase) $state(buffer)
        }

        LX_SEMICOLON {
            if {[incr state(glevel) -1] < 0} {
                return -code 7 "extraneous semi-colon"
            }

            catch {unset state(comment)}
            return [addr_specification $token]
        }

        LX_COMMA {
            catch {unset state(comment)}
            return [addr_specification $token]
        }

        LX_END {
            return 0
        }

        LX_LBRACKET {
            return [addr_routeaddr $token]
        }

        LX_ATSIGN {
            set state(input) $lookahead
            return [addr_routeaddr $token 0]
        }

        default {
            return -code 7  [format "unexpected character at beginning (found %s)"  $state(buffer)]
        }
    }

    switch -- [parselexeme $token] {
        LX_ATOM
            -
        LX_QSTRING {
            append state(phrase) " " $state(buffer)

            return [addr_phrase $token]
        }

        LX_LBRACKET {
            return [addr_routeaddr $token]
        }

        LX_COLON {
            return [addr_group $token]
        }

        LX_DOT {
            set state(local) "$state(phrase)$state(buffer)"
            unset state(phrase)
            mime::addr_routeaddr $token 0
            mime::addr_end $token
        }

        LX_ATSIGN {
            set state(memberP) $state(glevel)
            set state(local) $state(phrase)
            unset state(phrase)
            mime::addr_domain $token
            mime::addr_end $token
        }

        LX_SEMICOLON
            -
        LX_COMMA
            -
        LX_END {
            set state(memberP) $state(glevel)
            if {($state(lastC) eq "LX_SEMICOLON")  && ([incr state(glevel) -1] < 0)} {
                #TODO: this path is not covered by tests
                return -code 7 "extraneous semi-colon"
            }

            set state(local) $state(phrase)
            unset state(phrase)
        }

        default {
            return -code 7 [
                format "expecting mailbox (found %s)" $state(buffer)]
        }
    }

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