コード例 #1
0
 protected void require_token(ptokenizer_token_t tok, ptokenizer_token_id_t token_num)
 {
     if (!tok.is_(token_num))
     {
         error(MF_EXPECTED_TOKEN_1_GOT_2(token_num.name(), tok.str()));
     }
 }
コード例 #2
0
        //PCOPYASSIGNMOVE(ptokenizer, delete)

        //virtual ~ptokenizer() = default;

        //using token_type = detail::token_type;
        //using token_id_t = detail::token_id_t;
        //using token_t = detail::token_t;
        //using token_store = detail::token_store;

        // tokenizer stuff follows ...

        public ptokenizer_token_id_t register_token(string token)
        {
            ptokenizer_token_id_t ret = new ptokenizer_token_id_t(m_tokens.size(), token);

            m_tokens.emplace(token, ret);
            return(ret);
        }
コード例 #3
0
 public ptokenizer comment(string start, string end, string line)
 {
     m_tok_comment_start = register_token(start);
     m_tok_comment_end   = register_token(end);
     m_tok_line_comment  = register_token(line);
     return(this);
 }
コード例 #4
0
        public parser_t(nlparse_t setup)
            : base()
        {
            m_setup     = setup;
            m_cur_local = null;


            m_tokenizer.identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-$@")
            .number_chars(".0123456789", "0123456789eE-.")     //FIXME: processing of numbers
            .whitespace("" + " " + (char)9 + (char)10 + (char)13)
            .comment("/*", "*/", "//");
            m_tok_paren_left  = m_tokenizer.register_token("(");
            m_tok_paren_right = m_tokenizer.register_token(")");
            m_tok_comma       = m_tokenizer.register_token(",");

            m_tok_static             = m_tokenizer.register_token("static");
            m_tok_ALIAS              = m_tokenizer.register_token("ALIAS");
            m_tok_DIPPINS            = m_tokenizer.register_token("DIPPINS");
            m_tok_NET_C              = m_tokenizer.register_token("NET_C");
            m_tok_FRONTIER           = m_tokenizer.register_token("OPTIMIZE_FRONTIER");
            m_tok_PARAM              = m_tokenizer.register_token("PARAM");
            m_tok_DEFPARAM           = m_tokenizer.register_token("DEFPARAM");
            m_tok_HINT               = m_tokenizer.register_token("HINT");
            m_tok_NET_MODEL          = m_tokenizer.register_token("NET_MODEL");
            m_tok_NET_REGISTER_DEV   = m_tokenizer.register_token("NET_REGISTER_DEV");
            m_tok_INCLUDE            = m_tokenizer.register_token("INCLUDE");
            m_tok_LOCAL_SOURCE       = m_tokenizer.register_token("LOCAL_SOURCE");
            m_tok_LOCAL_LIB_ENTRY    = m_tokenizer.register_token("LOCAL_LIB_ENTRY");
            m_tok_EXTERNAL_LIB_ENTRY = m_tokenizer.register_token("EXTERNAL_LIB_ENTRY");
            m_tok_SUBMODEL           = m_tokenizer.register_token("SUBMODEL");
            m_tok_NETLIST_START      = m_tokenizer.register_token("NETLIST_START");
            m_tok_NETLIST_END        = m_tokenizer.register_token("NETLIST_END");
            m_tok_NETLIST_EXTERNAL   = m_tokenizer.register_token("NETLIST_EXTERNAL");
            m_tok_EXTERNAL_SOURCE    = m_tokenizer.register_token("EXTERNAL_SOURCE");
            m_tok_TRUTHTABLE_START   = m_tokenizer.register_token("TRUTHTABLE_START");
            m_tok_TRUTHTABLE_END     = m_tokenizer.register_token("TRUTHTABLE_END");
            m_tok_TRUTHTABLE_ENTRY   = m_tokenizer.register_token("TRUTHTABLE_ENTRY");
            m_tok_TT_HEAD            = m_tokenizer.register_token("TT_HEAD");
            m_tok_TT_LINE            = m_tokenizer.register_token("TT_LINE");
            m_tok_TT_FAMILY          = m_tokenizer.register_token("TT_FAMILY");

            m_tokenizer.register_token("RES_R");
            m_tokenizer.register_token("RES_K");
            m_tokenizer.register_token("RES_M");
            m_tokenizer.register_token("CAP_U");
            m_tokenizer.register_token("CAP_N");
            m_tokenizer.register_token("CAP_P");
        }
コード例 #5
0
        //double get_number_double();
        //long get_number_long();


        protected void require_token(ptokenizer_token_id_t token_num)
        {
            require_token(get_token(), token_num);
        }