Beispiel #1
0
        private void OutputFragmentSimple(TextToken token)
        {
            foreach (TokenRun tokenRun in token.Runs)
            {
                if (tokenRun.IsTextRun)
                {
                    RunTextType textType = tokenRun.TextType;
                    if (textType <= RunTextType.NewLine)
                    {
                        if (textType == RunTextType.Unknown)
                        {
                            goto IL_B3;
                        }
                        if (textType != RunTextType.Space)
                        {
                            if (textType != RunTextType.NewLine)
                            {
                                continue;
                            }
                            base.AddLineBreak(1);
                            continue;
                        }
                    }
                    else if (textType <= RunTextType.UnusualWhitespace)
                    {
                        if (textType == RunTextType.Tabulation)
                        {
                            base.AddTabulation(tokenRun.Length);
                            continue;
                        }
                        if (textType != RunTextType.UnusualWhitespace)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (textType == RunTextType.Nbsp)
                        {
                            base.AddNbsp(tokenRun.Length);
                            continue;
                        }
                        if (textType != RunTextType.NonSpace)
                        {
                            continue;
                        }
                        goto IL_B3;
                    }
                    base.AddSpace(tokenRun.Length);
                    continue;
IL_B3:
                    base.AddNonSpaceText(tokenRun.RawBuffer, tokenRun.RawOffset, tokenRun.RawLength);
                }
                else if (tokenRun.IsSpecial)
                {
                    uint kind = tokenRun.Kind;
                }
            }
        }
Beispiel #2
0
        private void OutputFragmentSimple(TextToken token)
        {
            foreach (var run in token.Runs)
            {
                if (run.IsTextRun)
                {
                    switch (run.TextType)
                    {
                    case RunTextType.NewLine:

                        output.OutputNewLine();
                        break;

                    case RunTextType.Space:
                    case RunTextType.UnusualWhitespace:

                        output.OutputSpace(run.Length);
                        break;

                    case RunTextType.Tabulation:

                        output.OutputTabulation(run.Length);
                        break;

                    case RunTextType.Nbsp:

                        if (treatNbspAsBreakable)
                        {
                            output.OutputSpace(run.Length);
                        }
                        else
                        {
                            output.OutputNbsp(run.Length);
                        }
                        break;

                    case RunTextType.NonSpace:

                        // InternalDebug.Assert(run.IsNormal);
                        output.OutputNonspace(run.RawBuffer, run.RawOffset, run.RawLength, TextMapping.Unicode);
                        break;

                    default:

                        InternalDebug.Assert(false, "unexpected run text type");
                        break;
                    }
                }
                else if (run.IsSpecial && run.Kind == (uint)TextRunKind.QuotingLevel)
                {
                    output.SetQuotingLevel((ushort)run.Value);
                }
            }
        }
Beispiel #3
0
 // Token: 0x060019CE RID: 6606 RVA: 0x000CCA74 File Offset: 0x000CAC74
 private void OutputFragmentSimple(TextToken token)
 {
     foreach (TokenRun tokenRun in token.Runs)
     {
         if (tokenRun.IsTextRun)
         {
             RunTextType textType = tokenRun.TextType;
             if (textType <= RunTextType.Tabulation)
             {
                 if (textType != RunTextType.Space)
                 {
                     if (textType == RunTextType.NewLine)
                     {
                         this.output.OutputNewLine();
                         continue;
                     }
                     if (textType != RunTextType.Tabulation)
                     {
                         continue;
                     }
                     this.output.OutputTabulation(tokenRun.Length);
                     continue;
                 }
             }
             else if (textType != RunTextType.UnusualWhitespace)
             {
                 if (textType != RunTextType.Nbsp)
                 {
                     if (textType != RunTextType.NonSpace)
                     {
                         continue;
                     }
                     this.output.OutputNonspace(tokenRun.RawBuffer, tokenRun.RawOffset, tokenRun.RawLength, TextMapping.Unicode);
                     continue;
                 }
                 else
                 {
                     if (this.treatNbspAsBreakable)
                     {
                         this.output.OutputSpace(tokenRun.Length);
                         continue;
                     }
                     this.output.OutputNbsp(tokenRun.Length);
                     continue;
                 }
             }
             this.output.OutputSpace(tokenRun.Length);
         }
         else if (tokenRun.IsSpecial && tokenRun.Kind == 167772160U)
         {
             this.output.SetQuotingLevel((int)((ushort)tokenRun.Value));
         }
     }
 }
Beispiel #4
0
        void IDisposable.Dispose()
        {
            if (input != null /*&& this.input is IDisposable*/)
            {
                ((IDisposable)input).Dispose();
            }

            input        = null;
            parseBuffer  = null;
            token        = null;
            tokenBuilder = null;

            GC.SuppressFinalize(this);
        }
Beispiel #5
0
        private void OutputFragmentSimple(TextToken token)
        {
            foreach (var run in token.Runs)
            {
                if (run.IsTextRun)
                {
                    switch (run.TextType)
                    {
                    case RunTextType.NewLine:

                        AddLineBreak(1);
                        break;

                    case RunTextType.Space:
                    case RunTextType.UnusualWhitespace:

                        AddSpace(run.Length);
                        break;

                    case RunTextType.Tabulation:

                        AddTabulation(run.Length);
                        break;

                    case RunTextType.Nbsp:

                        AddNbsp(run.Length);
                        break;

                    case RunTextType.NonSpace:
                    case RunTextType.Unknown:

                        // InternalDebug.Assert(run.IsNormal);
                        AddNonSpaceText(run.RawBuffer, run.RawOffset, run.RawLength /*, TextMapping.Unicode*/);
                        break;

                    default:

                        InternalDebug.Assert(false, "unexpected run text type");
                        break;
                    }
                }
                else if (run.IsSpecial && run.Kind == (uint)TextRunKind.QuotingLevel)
                {
                    // consider: set QuotingLevelDelta property
                }
            }
        }
Beispiel #6
0
        public TextParser(
            ConverterInput input,
            bool unwrapFlowed,
            bool unwrapDelSp,
            int maxRuns,
            bool testBoundaryConditions)
        {
            this.input = input;

            tokenBuilder = new TextTokenBuilder(null, maxRuns, testBoundaryConditions);

            token = tokenBuilder.Token;

            this.unwrapFlowed = unwrapFlowed;
            unwrapDelSpace    = unwrapDelSp;
        }
 public TextTokenBuilder(TextToken token, char[] buffer, int maxRuns, bool testBoundaryConditions) : base(token, buffer, maxRuns, testBoundaryConditions)
 {
 }