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

            nextStates.Add(parsingState);
        }