コード例 #1
0
 private static LazyList<UChar> ParseAnnotation(IEnumerator<UChar> inputStream)
 {
     var content = new UStringBuilder(64);
     while (inputStream.MoveNext())
     {
         var c = inputStream.Current;
         if (c == SpecialCharacters.AnnotationCloseBracket)
         {
            string replaced;
             if (ExternalCharacterDictionary.DoesMatch(content.ToString(), out replaced))
             {
                 content.Clear();
                 return Seq(new UString(replaced).ToArray(), () => ParseNormal(inputStream));
             }
             else
             {
                 content.Clear();
                 return Seq(new UChar[] { UnreplacedPlaceholder }, () => ParseNormal(inputStream));
             }
         }
         else
         {
             content.Append(c);
         }
     }
     content.Clear();
     return Seq(content.ToUString().ToArray());
 }
コード例 #2
0
        private static LazyList <UChar> ParseAnnotation(IEnumerator <UChar> inputStream)
        {
            var content = new UStringBuilder(64);

            while (inputStream.MoveNext())
            {
                var c = inputStream.Current;
                if (c == SpecialCharacters.AnnotationCloseBracket)
                {
                    string replaced;
                    if (ExternalCharacterDictionary.DoesMatch(content.ToString(), out replaced))
                    {
                        content.Clear();
                        return(Seq(new UString(replaced).ToArray(), () => ParseNormal(inputStream)));
                    }
                    else
                    {
                        content.Clear();
                        return(Seq(new UChar[] { UnreplacedPlaceholder }, () => ParseNormal(inputStream)));
                    }
                }
                else
                {
                    content.Append(c);
                }
            }
            content.Clear();
            return(Seq(content.ToUString().ToArray()));
        }
コード例 #3
0
 public static String ExtractWord(int n, String s, ACharArray wordDelims)
 {
     using (var sb = new UStringBuilder())
     {
         var i = WordPosition(n, s, wordDelims);
         if (i == -1)
         {
             return(sb.ToString());
         }
         /* find the end of the current word */
         while (i < s.Length && !(wordDelims.Contains(s[i])))
         {
             /* add the I'th character to result */
             sb.Append(s[i]);
             i++;
         }
         return(sb.ToString());
     }
 }
コード例 #4
0
ファイル: FormattedTextBuffer.cs プロジェクト: karak/Geovanni
        public void Ruby(int start, int end, UString rubyText)
        {
            if (start >= end)
            {
                Console.WriteLine("WARNING: ルビの親文字が空です({0}文字目/{1})", start + 1, _textBuffer.ToString());
                return;
            }

            Upsert(start, MetaInfo.RUBY_START, rubyText);
            Upsert(end, MetaInfo.RUBY_END);
        }