Esempio n. 1
0
    /*!
     * \brief Parse a string
     * \param str The string to parse
     * \return Return the tree corresponding to the expression or null if the parsing fail.
     */
    public TreeNode <PromoterNodeData> Parse(string str)
    {
        clear();
        PromoterLexer lex = new PromoterLexer();
        LinkedList <PromoterLexer.Token> tokenList = lex.lex(str);
//     lex.PPTokenList(tokenList);
        TreeNode <PromoterNodeData> tree = ParseFormula(tokenList);

        if (tokenList.First().token == PromoterLexer.eToken.END)
        {
            return(tree);
        }
        Debug.Log("Parsing Error for expression " + str);
        return(null);
    }
Esempio n. 2
0
 /*!
 \brief Parse a string
 \param str The string to parse
 \return Return the tree corresponding to the expression or null if the parsing fail.
   */
 public TreeNode<PromoterNodeData> Parse(string str)
 {
     clear();
     PromoterLexer lex = new PromoterLexer();
     LinkedList<PromoterLexer.Token> tokenList = lex.lex(str);
     //     lex.PPTokenList(tokenList);
     TreeNode<PromoterNodeData> tree = ParseFormula(tokenList);
     if (tokenList.First().token == PromoterLexer.eToken.END)
       return tree;
     Debug.Log("Parsing Error for expression " + str);
     return null;
 }