Ejemplo n.º 1
0
    public override void ClassDefinition(string bas)
    {
        string line, name;
        int    n = m_lexer.yytext.Length;

        line = m_lexer.yytext;
        int num = EmitClassDefin(m_lexer.m_buf, ref m_lexer.m_pch, m_lexer.m_buf.Length, null, bas, out bas, out name, false);

        m_lexer.Advance();
        m_lexer.yytext = name;
        CSymbol s = new CSymbol(this);

        s.m_yynum   = num;
        s           = s.Resolve();
        s.m_defined = true;
        s.m_emitted = true;
        if (line[1] == 'n')
        {
            s.m_symtype = CSymbol.SymType.nodesymbol;
            if (m_symbols.symbols.Contains(bas))
            {
                s.m_refSymbol = (CSymbol)m_symbols.symbols[bas];
            }
            else
            {
                m_symbols.erh.Error(new CSToolsFatalException(44, s, "Unknown base type " + bas + ": reorder declarations?"));
            }
        }
    }
Ejemplo n.º 2
0
        public SymbolType(SymbolsGen yyp, string name, bool defined)
        {
            Lexer lexer  = yyp.m_lexer;
            int   length = name.IndexOf("+");
            int   num    = 0;

            if (length > 0)
            {
                num = int.Parse(name.Substring(length + 1));
                if (num > yyp.LastSymbol)
                {
                    yyp.LastSymbol = num;
                }
                name = name.Substring(0, length);
            }
            lexer.yytext = name;
            CSymbol csymbol1 = new CSymbol(yyp);

            if (num > 0)
            {
                csymbol1.m_yynum = num;
            }
            CSymbol csymbol2 = csymbol1.Resolve();

            if (defined)
            {
                csymbol2.m_defined = true;
            }
            this.m_name = name;
            this.m_next = yyp.stypes;
            yyp.stypes  = this;
        }