Ejemplo n.º 1
0
        //--- Constructors ---
        public DekiScriptLiteral Process(DekiScriptOutputBuffer buffer, int marker, bool safe)
        {
            ParseBuffer(buffer, marker, null, safe);

            // update buffer
            buffer.Reset(marker);

            // return computed value as literal
            DekiScriptLiteral result;

            switch (_state)
            {
            case State.EMPTY:
                result = DekiScriptNil.Value;
                break;

            case State.VALUE:
                result = (DekiScriptLiteral)_value;
                break;

            case State.COMPOSITE:
                result = DekiScriptExpression.Constant(((StringBuilder)_value).ToString());
                break;

            case State.XML:
                result = new DekiScriptXml(new XDoc(_document));
                break;

            case State.HTML:
                foreach (var body in from body in _bodies orderby body.Key select body)
                {
                    _html.InsertBefore(body.Value, _tail);
                }
                if (_head != null)
                {
                    RemoveDuplicateElements(_head);
                }
                if (_tail != null)
                {
                    RemoveDuplicateElements(_tail);
                }
                goto case State.XML;

            default:
                throw new ShouldNeverHappenException();
            }
            Clear();
            return(result);
        }
 public DekiScriptExpression Visit(DekiScriptXml expr, DekiScriptExpressionEvaluationState state)
 {
     return(expr);
 }
Ejemplo n.º 3
0
        //--- Constructors ---
        public DekiScriptLiteral Process(DekiScriptOutputBuffer buffer, int marker, bool safe) {
            ParseBuffer(buffer, marker, null, safe);

            // update buffer
            buffer.Reset(marker);

            // return computed value as literal
            DekiScriptLiteral result;
            switch(_state) {
            case State.EMPTY:
                result = DekiScriptNil.Value;
                break;
            case State.VALUE:
                result = (DekiScriptLiteral)_value;
                break;
            case State.COMPOSITE:
                result = DekiScriptExpression.Constant(((StringBuilder)_value).ToString());
                break;
            case State.XML:
                result = new DekiScriptXml(new XDoc(_document));
                break;
            case State.HTML:
                foreach(var body in from body in _bodies orderby body.Key select body) {
                    _html.InsertBefore(body.Value, _tail);
                }
                if(_head != null) {
                    RemoveDuplicateElements(_head);
                }
                if(_tail != null) {
                    RemoveDuplicateElements(_tail);
                }
                goto case State.XML;
            default:
                throw new ShouldNeverHappenException();
            }
            Clear();
            return result;
        }
 public DekiScriptOutputBuffer.Range Visit(DekiScriptXml expr, DekiScriptExpressionEvaluationState state)
 {
     return(state.Push(expr));
 }
 public DekiScriptExpression Visit(DekiScriptXml expr, DekiScriptOptimizerState state)
 {
     return(expr);
 }
 public DekiScriptLiteral Visit(DekiScriptXml expr, DekiScriptEnv env)
 {
     return(expr);
 }