コード例 #1
0
        public void Lexer_Should_Tokenize_Input(string input, PathToken[] expectedTokens)
        {
            var tokens = _pathLexer.Tokenize(input);

            tokens.Should().Equal(expectedTokens,
                                  (t, e) =>
                                  t.Type == e.Type &&
                                  t.Value == e.Value &&
                                  t.InputString == e.InputString &&
                                  t.StartIndex == e.StartIndex &&
                                  t.EndIndex == e.EndIndex);
        }
コード例 #2
0
        public IPathModel Build(string input)
        {
            if (_model != null)
            {
                return(_model);
            }
            var tokens = _lexer.Tokenize(input);

            try
            {
                _parser.Parse(tokens, new ACLTokenAdapter(this));
            } catch (InvalidOperationException exception)
            {
                throw new InvalidPathException(exception.Message, exception);
            }
            return(_model);
        }