Mistři v programování na #hovnokod

Visual Basic #556

'/**
' * Parser
' * @param String text
' * @param Scripting.Dictionary text
' */
private function Parse(text, data)
    dim RE, EM, MO, res, lastIndex, val
    res = ""
    Set RE = New RegExp
    RE.Pattern = "(\\?)\$(?:(\w+)|\{(\w+)\})"
    RE.IgnoreCase = False
    RE.Global = True
    Set EM = RE.Execute(text)
    if EM.Count > 0 then
        lastIndex = 1
        for each MO in EM
            if Mid(MO.Value,1,2) = "\$" then
                val = Mid(MO.Value,2)
            else
                if Mid(MO.Value,1,2) = "${" then 
                    val = Mid(Mid(MO.Value,1,Len(MO.Value)-1),3) 
                else 
                    val = Mid(MO.Value,2)
                end if
                val = data(val)
            end if
            res = res & Mid(text, lastIndex, MO.FirstIndex-lastIndex+1) & val
            lastIndex = MO.FirstIndex+MO.Length+1
        next
        res = res & Mid(text, lastIndex)
        Parse = res
    else
        Parse = text
    end if
end function

HovnoKod,