예제 #1
0
 public void PushEof()
 {
     while (_currentParsingState != null)
     {
         _currentParsingState = _currentParsingState.PushEof();
     }
 }
        private static void TestLinkedStates(ParsingResult [] returnResults, int transitionIndex)
        {
            ParsingState  target        = new ParsingState();
            ParsingResult finalResult   = ParsingResult.Match;
            IParsingState expectedState = target;

            for (int i = 0; i < returnResults.Length; i++)
            {
                ParsingResult        result    = returnResults[i];
                ParsingStateTestImpl nextState = new ParsingStateTestImpl(result);
                target.AddNextState(nextState);
                if (i == transitionIndex)
                {
                    finalResult = result;
                    if (finalResult != ParsingResult.Miss)
                    {
                        expectedState = nextState;
                    }
                    else
                    {
                        expectedState = target;
                    }
                }
            }

            ParsingContextTestImpl context = new ParsingContextTestImpl();

            context.CurrentState = target;
            char randomChar = (char)(new Random().Next(char.MinValue, char.MaxValue));

            Assert.AreEqual(target.ProcessCharacter(context, randomChar), finalResult);
            Assert.AreEqual <IParsingState>(expectedState, context.CurrentState);
        }
 public void AddNextState(IParsingState nextState)
 {
     this.nextState = nextState;
 }
예제 #4
0
 public void TransitionTo(IParsingState nextState)
 {
     this.currentState = nextState;
 }
 public void SetErrorState(IParsingState errorState)
 {
 }
 public void AddNextState(IParsingState nextState)
 {
 }
예제 #7
0
 public void ResetParsingState()
 {
     this.currentParsingState = initialParsingState;
     this.currentText.Length = 0;
 }
 public void SetErrorState(IParsingState errorState)
 {
     this.errorState = errorState;
 }
        public void AddNextState(IParsingState parsingState)
        {
            ArgumentVerifier.CheckObjectArgument(parsingState, "parsingState");

            nextStates.Add(parsingState);
        }
예제 #10
0
 private ParsingState(IParsingState parentState, ISemanticContext semanticContext)
 {
     _semanticContext = semanticContext;
     _parentState     = parentState;
     Indent           = -1;
 }
예제 #11
0
 public void PushLine(int lineNumber, int indent, string keyword, string key, IEnumerable <AhlAttribute> attributes)
 {
     _currentParsingState = _currentParsingState.PushLine(lineNumber, indent, keyword, key, attributes);
 }
예제 #12
0
 public ParsingContext(ISemanticContext semanticContext)
 {
     _currentParsingState = new ParsingState(semanticContext);
 }
예제 #13
0
 public void AddNextState(IParsingState nextState)
 {
 }
 public void SetErrorState(IParsingState errorState)
 {
     this.errorState = errorState;
 }
 public void SetErrorState(IParsingState errorState)
 {
 }
 public void AddNextState(IParsingState nextState)
 {
     this.nextState = nextState;
 }
 public void TransitionTo(IParsingState nextState)
 {
     this.currentState = nextState;
 }
예제 #18
0
 public void ResetParsingState()
 {
     this.currentParsingState = initialParsingState;
     this.currentText.Length  = 0;
 }
예제 #19
0
        public void AddNextState(IParsingState parsingState)
        {
            ArgumentVerifier.CheckObjectArgument(parsingState, "parsingState");

            nextStates.Add(parsingState);
        }