コード例 #1
0
ファイル: Interpreter.cs プロジェクト: mahanteshck/antlrcs
        /** Write out an expression result that uses expression options.
         *  E.g., <names; separator=", ">
         */
        protected virtual int WriteObjectWithOptions(ITemplateWriter @out, TemplateFrame frame, object o, object[] options)
        {
            int start = @out.Index; // track char we're about to Write
            // precompute all option values (Render all the way to strings)
            string[] optionStrings = null;
            if (options != null)
            {
                optionStrings = new string[options.Length];
                for (int i = 0; i < Compiler.TemplateCompiler.NUM_OPTIONS; i++)
                {
                    optionStrings[i] = ToString(frame, options[i]);
                }
            }

            if (options != null && options[(int)RenderOption.Anchor] != null)
            {
                @out.PushAnchorPoint();
            }

            int n = WriteObject(@out, frame, o, optionStrings);

            if (options != null && options[(int)RenderOption.Anchor] != null)
            {
                @out.PopAnchorPoint();
            }

            if (_debug)
            {
                Interval templateLocation = frame.Template.impl.sourceMap[frame.InstructionPointer];
                EvalExprEvent e = new EvalExprEvent(frame, Interval.FromBounds(start, @out.Index), templateLocation);
                TrackDebugEvent(frame, e);
            }

            return n;
        }
コード例 #2
0
ファイル: Interpreter.cs プロジェクト: mahanteshck/antlrcs
        /** Write out an expression result that doesn't use expression options.
         *  E.g., &lt;name&gt;
         */
        protected virtual int WriteObjectNoOptions(ITemplateWriter @out, TemplateFrame frame, object o)
        {
            int start = @out.Index; // track char we're about to Write
            int n = WriteObject(@out, frame, o, null);
            if (_debug)
            {
                Interval templateLocation = frame.Template.impl.sourceMap[frame.InstructionPointer];
                EvalExprEvent e = new EvalExprEvent(frame, Interval.FromBounds(start, @out.Index), templateLocation);
                TrackDebugEvent(frame, e);
            }

            return n;
        }