コード例 #1
0
        protected void error(string errs)  //void ptoken_reader::error(const perrmsg &errs)
        {
            string s           = "";
            string trail       = "                 from ";
            string trail_first = "In file included from ";
            string e           = new plib.pfmt("{0}:{1}:0: error: {2}\n")
                                 .op(m_source_location.back().file_name(), m_source_location.back().line(), errs);

            m_source_location.pop_back();
            while (!m_source_location.empty())
            {
                if (m_source_location.size() == 1)
                {
                    trail = trail_first;
                }
                s = new plib.pfmt("{0}{1}:{2}:0\n{3}").op(trail, m_source_location.back().file_name(), m_source_location.back().line(), s);
                m_source_location.pop_back();
            }

            verror("\n" + s + e + " " + m_line + "\n");
        }
コード例 #2
0
        void error(string err)
        {
            string s           = "";
            string trail       = "                 from ";
            string trail_first = "In file included from ";
            string e           = new plib.pfmt("{0}:{1}:0: error: {2}\n")
                                 .op(m_stack.back().m_name, m_stack.back().m_lineno, err);

            m_stack.pop_back();
            while (!m_stack.empty())
            {
                if (m_stack.size() == 1)
                {
                    trail = trail_first;
                }
                s = new plib.pfmt("{0}{1}:{2}:0\n{3}").op(trail, m_stack.back().m_name, m_stack.back().m_lineno, s);
                m_stack.pop_back();
            }

            throw new pexception("\n" + s + e + " " + m_line + "\n");
        }