private ParsingEvent ParseBlockSequenceEntry(bool isFirst)
        {
            if (isFirst)
            {
                GetCurrentToken();
                Skip();
            }
            if (GetCurrentToken() is BlockEntry)
            {
                Mark end = GetCurrentToken().End;
                Skip();
                if (!(GetCurrentToken() is BlockEntry) && !(GetCurrentToken() is BlockEnd))
                {
                    states.Push(ParserState.BlockSequenceEntry);
                    return(ParseNode(true, false));
                }
                state = ParserState.BlockSequenceEntry;
                return(ProcessEmptyScalar(end));
            }
            if (GetCurrentToken() is BlockEnd)
            {
                state = states.Pop();
                ParsingEvent result = new SequenceEnd(GetCurrentToken().Start, GetCurrentToken().End);
                Skip();
                return(result);
            }
            Token token = GetCurrentToken();

            throw new SemanticErrorException(token.Start, token.End, "While parsing a block collection, did not find expected '-' indicator.");
        }
Example #2
0
        YamlSequence(SequenceStart sequenceStart, SequenceEnd sequenceEnd, List <YamlElement> contents, YamlNodeTracker tracker)
        {
            Tracker = tracker;

            this._sequenceStart = sequenceStart;

            if (Tracker != null)
            {
                Tracker.OnSequenceStartChanged(this, null, sequenceStart);
            }

            this._sequenceEnd = sequenceEnd;

            if (Tracker == null)
            {
                _contents = contents;
            }
            else
            {
                _contents = new List <YamlElement>();
                foreach (var item in contents)
                {
                    Add(item);
                }
            }
        }
Example #3
0
        private ParsingEvent ParseBlockSequenceEntry(bool isFirst)
        {
            if (isFirst)
            {
                this.GetCurrentToken();
                this.Skip();
            }
            if (this.GetCurrentToken() is BlockEntry)
            {
                Mark end = this.GetCurrentToken().End;
                this.Skip();
                if (!(this.GetCurrentToken() is BlockEntry) && !(this.GetCurrentToken() is BlockEnd))
                {
                    this.states.Push(ParserState.BlockSequenceEntry);
                    return(this.ParseNode(true, false));
                }
                this.state = ParserState.BlockSequenceEntry;
                return(ProcessEmptyScalar(end));
            }
            if (!(this.GetCurrentToken() is BlockEnd))
            {
                Token currentToken = this.GetCurrentToken();
                throw new SemanticErrorException(currentToken.Start, currentToken.End, "While parsing a block collection, did not find expected '-' indicator.");
            }
            this.state = this.states.Pop();
            ParsingEvent event2 = new SequenceEnd(this.GetCurrentToken().Start, this.GetCurrentToken().End);

            this.Skip();
            return(event2);
        }
Example #4
0
 void InitSubSequences()
 {
     nextSequenceIntro       = 0;
     nextSequenceMission     = 0;
     nextSequenceOrbit       = 0;
     nextSequenceInteraction = 0;
     nextSequenceCognitive   = 0;
     nextSequenceHole        = 0;
     nextSequenceCube        = 0;
     nextSequenceEnd         = 0;
 }
Example #5
0
        YamlSequence(SequenceStart sequenceStart, SequenceEnd sequenceEnd, List <YamlElement> contents, YamlNodeTracker tracker)
        {
            if (tracker == null)
            {
                _contents = contents;
            }
            else
            {
                _contents = new List <YamlElement>();

                Tracker = tracker;

                foreach (var item in contents)
                {
                    Add(item);
                }
            }

            SequenceStart = sequenceStart;

            this._sequenceEnd = sequenceEnd;
        }
        private ParsingEvent ParseFlowSequenceEntry(bool isFirst)
        {
            if (isFirst)
            {
                GetCurrentToken();
                Skip();
            }
            ParsingEvent result;

            if (!(GetCurrentToken() is FlowSequenceEnd))
            {
                if (!isFirst)
                {
                    if (!(GetCurrentToken() is FlowEntry))
                    {
                        Token token = GetCurrentToken();
                        throw new SemanticErrorException(token.Start, token.End, "While parsing a flow sequence, did not find expected ',' or ']'.");
                    }
                    Skip();
                }
                if (GetCurrentToken() is Key)
                {
                    state  = ParserState.FlowSequenceEntryMappingKey;
                    result = new MappingStart(null, null, true, MappingStyle.Flow);
                    Skip();
                    return(result);
                }
                if (!(GetCurrentToken() is FlowSequenceEnd))
                {
                    states.Push(ParserState.FlowSequenceEntry);
                    return(ParseNode(false, false));
                }
            }
            state  = states.Pop();
            result = new SequenceEnd(GetCurrentToken().Start, GetCurrentToken().End);
            Skip();
            return(result);
        }
Example #7
0
        private ParsingEvent ParseFlowSequenceEntry(bool isFirst)
        {
            ParsingEvent event2;

            if (isFirst)
            {
                this.GetCurrentToken();
                this.Skip();
            }
            if (!(this.GetCurrentToken() is FlowSequenceEnd))
            {
                if (!isFirst)
                {
                    if (!(this.GetCurrentToken() is FlowEntry))
                    {
                        Token currentToken = this.GetCurrentToken();
                        throw new SemanticErrorException(currentToken.Start, currentToken.End, "While parsing a flow sequence, did not find expected ',' or ']'.");
                    }
                    this.Skip();
                }
                if (this.GetCurrentToken() is Key)
                {
                    this.state = ParserState.FlowSequenceEntryMappingKey;
                    event2     = new MappingStart(null, null, true, MappingStyle.Flow);
                    this.Skip();
                    return(event2);
                }
                if (!(this.GetCurrentToken() is FlowSequenceEnd))
                {
                    this.states.Push(ParserState.FlowSequenceEntry);
                    return(this.ParseNode(false, false));
                }
            }
            this.state = this.states.Pop();
            event2     = new SequenceEnd(this.GetCurrentToken().Start, this.GetCurrentToken().End);
            this.Skip();
            return(event2);
        }
Example #8
0
        public void Progress(double seconds)
        {
            var tickTimeDelta = 1.0 / ((60.0 / (Tempo * tempoFactor)) / Sequence.Resolution);

            progressTick += (seconds * tickTimeDelta);

            if (Math.Abs(progressTick) < double.Epsilon)
            {
                return;
            }

            var processTick = (long)progressTick;

            progressTick -= processTick;

            var startTick = tick;
            var endTick   = startTick + processTick;

            OutputEvents(SelectEvents(startTick, endTick).ToList());

            tick += processTick;

            if (tick < endOfTick)
            {
                return;
            }

            if (Looping)
            {
                Tick = loopBeginTick;
            }
            else
            {
                SequenceEnd?.Invoke(this, new EventArgs());
            }
        }
Example #9
0
 void IParsingEventVisitor.Visit(SequenceEnd e)
 {
     clonedEvent = new SequenceEnd(e.Start, e.End);
 }
Example #10
0
 public void Visit(SequenceEnd e)
 {
     _branches.Pop();
     _currentPath.Pop();
 }
 public void Visit(SequenceEnd e)
 {
     _emitter.Emit(e);
     _branches.Pop();
     _currentPath.Pop();
 }
Example #12
0
 protected virtual void OnSequenceStop(ICommand cmd)
 {
     SequenceEnd?.Invoke(cmd);
 }
Example #13
0
        private void Update()
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            var oldTick = 0L;

            while (!reqEnd)
            {
                Thread.Sleep(interval);

                if (reqEnd)
                {
                    break;
                }

                lock (syncObject)
                {
                    if (reqRewind)
                    {
                        oldTick   = 0L;
                        reqRewind = false;
                        stopwatch.Restart();
                        continue;
                    }

                    var nowTick = stopwatch.ElapsedTicks;
                    progressTick += (nowTick - oldTick) * tickTime;

                    if (Math.Abs(progressTick) < double.Epsilon)
                    {
                        continue;
                    }

                    var processTick = (long)progressTick;
                    progressTick -= processTick;

                    var startTick = tick;
                    var endTick   = startTick + processTick;

                    OutputEvents(SelectEvents(startTick, endTick).ToList());

                    oldTick = nowTick;
                    tick   += processTick;

                    if (tick < endOfTick)
                    {
                        continue;
                    }

                    if (Looping)
                    {
                        Tick = loopBeginTick;
                    }
                    else
                    {
                        SequenceEnd?.Invoke(this, new EventArgs());
                    }
                }
            }

            tick = -(long)(Sequence.Resolution * 1.0);

            stopwatch.Stop();
        }
Example #14
0
 public YamlSequence()
 {
     _sequenceStart = new SequenceStart();
     _sequenceEnd   = new SequenceEnd();
     _contents      = new List <YamlElement>();
 }