Beispiel #1
0
        /// <summary>
        /// Creates a new Vocabulary object from the specified dictionary collection.
        /// </summary>
        /// <param name="dics"></param>
        public Vocabulary(IEnumerable<Dictionary> dics)
        {
            _wordLists = new Dictionary<string, Dictionary>();

            if (dics == null) return;

            foreach (var list in dics)
            {
                _wordLists[list.Name] = list;
            }
        }
Beispiel #2
0
        public ChannelStack(Limit<int> sizeLimit)
        {
            _sizeLimit = sizeLimit;
            _main = new Channel("main", ChannelVisibility.Public);

            _stack = new List<Channel> { _main };
            _stackSize = 1;

            _channels = new Dictionary<string, Channel>
            {
                { "main", _main }
            };
        }
        static Interpreter()
        {
            TagFuncs = new Dictionary<string, TagDef>();

            TagFuncs["rep"] = TagFuncs["r"] = new TagDef(Repeat, TagArgType.Result);
            TagFuncs["num"] = TagFuncs["n"] = new TagDef(Number, TagArgType.Result, TagArgType.Result);
            TagFuncs["sep"] = TagFuncs["s"] = new TagDef(Separator, TagArgType.Tokens);
            TagFuncs["before"] = new TagDef(Before, TagArgType.Tokens);
            TagFuncs["after"] = new TagDef(After, TagArgType.Tokens);
            TagFuncs["chance"] = new TagDef(Chance, TagArgType.Result);
            TagFuncs["sync"] = new TagDef(Sync, TagArgType.Result, TagArgType.Result);
            TagFuncs["desync"] = new TagDef(Desync);
            TagFuncs["pin"] = new TagDef(Pin, TagArgType.Result);
            TagFuncs["unpin"] = new TagDef(Unpin, TagArgType.Result);
            TagFuncs["step"] = new TagDef(Step, TagArgType.Result);
            TagFuncs["reset"] = new TagDef(Reset, TagArgType.Result);
            TagFuncs["first"] = new TagDef(First, TagArgType.Tokens);
            TagFuncs["last"] = new TagDef(Last, TagArgType.Tokens);
            TagFuncs["middle"] = new TagDef(Middle, TagArgType.Tokens);
            TagFuncs["notfirst"] = new TagDef(NotFirst, TagArgType.Tokens);
            TagFuncs["notlast"] = new TagDef(NotLast, TagArgType.Tokens);
            TagFuncs["notmiddle"] = new TagDef(NotMiddle, TagArgType.Tokens);
            TagFuncs["odd"] = new TagDef(Odd, TagArgType.Tokens);
            TagFuncs["even"] = new TagDef(Even, TagArgType.Tokens);
            TagFuncs["nth"] = new TagDef(Nth, TagArgType.Result, TagArgType.Result, TagArgType.Tokens);
            TagFuncs["repnum"] = TagFuncs["rn"] = new TagDef(RepNum);
            TagFuncs["repindex"] = TagFuncs["ri"] = new TagDef(RepIndex);
            TagFuncs["repcount"] = TagFuncs["rc"] = new TagDef(RepCount);
            TagFuncs["alt"] = new TagDef(Alt, TagArgType.Tokens, TagArgType.Tokens);
            TagFuncs["match"] = new TagDef(ReplaceMatch);
            TagFuncs["group"] = new TagDef(ReplaceGroup, TagArgType.Result);
            TagFuncs["arg"] = new TagDef(Arg, TagArgType.Result);
            TagFuncs["numfmt"] = new TagDef(NumFmt, TagArgType.Result);
            TagFuncs["caps"] = new TagDef(Caps, TagArgType.Result);
            TagFuncs["capsinfer"] = new TagDef(CapsInfer, TagArgType.Result);
            TagFuncs["out"] = new TagDef(Out, TagArgType.Result, TagArgType.Result);
            TagFuncs["close"] = new TagDef(Close, TagArgType.Result);
        }
Beispiel #4
0
 public VarStore()
 {
     _vars = new Dictionary<string, double>();
 }
Beispiel #5
0
 /// <summary>
 /// Adds a new Dictionary object to the collection.
 /// </summary>
 /// <param name="dictionary"></param>
 public void AddDictionary(Dictionary dictionary)
 {
     _wordLists[dictionary.Name] = dictionary;
 }
Beispiel #6
0
 public SubStore()
 {
     _table = new Dictionary<Tuple<string, int>, Subroutine>();
 }