Exemple #1
0
        static private ISentenceItem CreateSentenseItem(SymbolList symbols, ParserState state)
        {
            if (symbols == null || symbols.Count == 0)
            {
                throw new ArgumentNullException(nameof(symbols));
            }

            switch (state)
            {
            case ParserState.Letter:
                return(new Word(symbols));

            case ParserState.Separator:
                return(SpaceSeparator.GetSeparator());

            case ParserState.Punctuation:
            case ParserState.Other:
                return(new Punctuation(symbols.ToString()));

            case ParserState.EndSentense:
            case ParserState.None:
            default:
                throw new AggregateException($"State can't be \"{state}\"");
            }
        }
Exemple #2
0
 static ISentenceItem CreateSeparator(SymbolList symbols)
 {
     return(SpaceSeparator.GetSeparator());
 }