Exemplo n.º 1
0
    void is_regex_contents2_lc()
    {
        var match = RegexUtil.Get1stMatch(G.REGEXCONT2, m_line);

        if (!string.IsNullOrEmpty(match))
        {
            //1 正規表現部分の取得
            var regex = RegexUtil.Get1stMatch(@"\$\/.+\/->#", match); // $/正規表現/->#
            regex = regex.Substring(2);
            regex = regex.Substring(0, regex.Length - 4);

            //マクロ名の取得
            var macroname = RegexUtil.Get1stMatch(@"#.+\$$", match);  // #macro$
            macroname = macroname.TrimEnd('$');

            var macrobuf = G.getMacroValueFunc(macroname);
            if (string.IsNullOrEmpty(macrobuf))
            {
                throw new SystemException("Macro is not defined. : " + macroname);
            }
            var c = create_regex_contents(regex, macrobuf);

            var tmplines = StringUtil.ReplaceWordsInLine(m_line, match, c);
            m_resultlist.AddRange(tmplines);
            m_bContinue = true;
        }
    }
Exemplo n.º 2
0
    void do_macro()
    {
        var matchstr  = m_mw.GetMatchStr();
        var text      = string.Empty;
        var macroname = m_mw.GetMacroname();

        if (string.IsNullOrEmpty(macroname))
        {
            text = "(error: macroname is null)";
        }
        else
        {
            text = G.getMacroValueFunc(macroname);

            if (string.IsNullOrEmpty(text))
            {
                text = string.Format("(error: no value for {0} )", macroname);
            }
            else
            {
                text = psggConverterLib.MacroWork.Convert(text, 0, m_mw.GetArgValueList());
            }
        }
        var tmplines = StringUtil.ReplaceWordsInLine(m_line, matchstr, text);

        m_resultlines.AddRange(tmplines);
    }