コード例 #1
0
        /// <summary>
        /// Loads an entry from a binary stream.
        /// </summary>
        public static EntryToken Load(BinaryReader reader, GrammarEngine engine)
        {
            int    id      = reader.ReadInt32();
            string srcWord = reader.ReadString();

            return(new EntryToken(engine.GetEntry(id), srcWord));
        }
コード例 #2
0
        internal WordProjection(GrammarEngine engine, IntPtr hList, int idx)
        {
            _engine = engine;
            _hList  = hList;
            _idx    = idx;

            Entry = _engine.GetEntry(GrammarApi.sol_GetIEntry(_hList, _idx));
        }
コード例 #3
0
        public SyntaxTreeNode(GrammarEngine gren, IntPtr hNode)
        {
            _gren  = gren;
            _hNode = hNode;

            Entry      = gren.GetEntry(GrammarApi.sol_GetNodeIEntry(_gren.GetEngineHandle(), _hNode));
            SourceWord = GetNodeContents(_hNode);

            int nleaf = GrammarApi.sol_CountLeafs(_hNode);

            Leafs = new SyntaxTreeNode[nleaf];
            for (int i = 0; i < nleaf; ++i)
            {
                Leafs[i] = new SyntaxTreeNode(_gren, GrammarApi.sol_GetLeaf(_hNode, i));
            }
        }