Exemplo n.º 1
0
        private IList <CharPos> Extract(IBraceExtractor extractor, string input, int start, int state)
        {
            extractor.Reset();
            ITextChars chars = new StringChars(input, start);

            return(extractor.Extract(chars).ToList());
        }
        public static TBL_WORD Get_TBL_WORD_SORTED(string str)
        {
            str = str.ToUpper().Trim();
            var car  = StringChars.Get_StringChars_Sorted(str);
            var temp = (from x in TOOLS.db.TBL_WORDS
                        orderby x.LENGTH descending
                        where x.LENGTH == str.Length && x.SORTED_CHAR.CHARS == car
                        select x).FirstOrDefault();

            return(temp);
        }
Exemplo n.º 3
0
    public static int Main()
    {
        StringChars sc = new StringChars();
        TestLibrary.TestFramework.BeginTestCase("StringChars");

        if (sc.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }        
    }
Exemplo n.º 4
0
    public static int Main()
    {
        StringChars sc = new StringChars();

        TestLibrary.TestFramework.BeginTestCase("StringChars");

        if (sc.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }
Exemplo n.º 5
0
        protected IList <CharPos> Extract(IBraceScanner extractor, string input, int start, int state, bool reset = true)
        {
            if (reset)
            {
                extractor.Reset(0);
            }
            ITextChars      chars = new StringChars(input, start);
            IList <CharPos> list  = new List <CharPos>();
            CharPos         cp    = CharPos.Empty;

            while (!chars.AtEnd)
            {
                if (extractor.Extract(chars, ref cp))
                {
                    list.Add(cp);
                }
            }
            return(list);
        }
Exemplo n.º 6
0
        private IList <CharPos> Extract(IBraceExtractor extractor, string input, int start, int state)
        {
            extractor.Reset();

            input = input.Substring(start);

            String[]       lines  = input.Split('\r', '\n');
            List <CharPos> result = new List <CharPos>();

            foreach (String line in lines)
            {
                ITextChars chars = new StringChars(line);
                while (!chars.EndOfLine)
                {
                    result.AddRange(extractor.Extract(chars));
                }
            }
            return(result);
        }
        public static TBL_WORD Add_TBL_WORD(string str)
        {
            TBL_WORD word = new TBL_WORD();

            word.WORD   = str;
            word.LENGTH = str.Length;

            string car = StringChars.Get_StringChars(str);

            var ucar = TOOLS_INSERT.Add_TBL_CHAR(car);

            word.UNSORTED_CHAR = ucar;

            var scar = StringChars.Get_StringChars_Sorted(str);

            word.SORTED_CHAR = TOOLS_INSERT.Add_TBL_CHAR(scar);

            TOOLS.db.TBL_WORDS.Add(word);
            TOOLS.db.SaveChanges();

            return(word);
        }
Exemplo n.º 8
0
        protected IList <CharPos> ExtractWithLines(IBraceScanner extractor, string input, int start, int state)
        {
            extractor.Reset(0);

            input = input.Substring(start);

            String[]       lines  = input.Split('\r', '\n');
            List <CharPos> result = new List <CharPos>();

            foreach (String line in lines)
            {
                ITextChars chars = new StringChars(line);
                CharPos    cp    = CharPos.Empty;
                while (!chars.AtEnd)
                {
                    if (extractor.Extract(chars, ref cp))
                    {
                        result.Add(cp);
                    }
                }
            }
            return(result);
        }