Beispiel #1
0
        public void Parse(NodesFactory factory, IErrorSink <Span> errors,
                          IErrorRecovery recovery   = null,
                          LanguageFeatures features = LanguageFeatures.Basic,
                          Lexer.LexicalStates state = Lexer.LexicalStates.INITIAL)
        {
            var parser = new Parser();

            using (var source = new StringReader(SourceText.ToString()))
            {
                using (var provider = new AdditionalSyntaxProvider(
                           new PhpTokenProvider(
                               new Lexer(source, Encoding.UTF8, errors, features, 0, state),
                               this),
                           factory,
                           parser.CreateTypeRef))
                {
                    ast = parser.Parse(provider, factory, features, errors, recovery);
                }
            }
        }
Beispiel #2
0
 public AdditionalSyntaxProvider(PhpTokenProvider provider, NodesFactory nodes, Func <QualifiedNameRef, bool, TypeRef> typeRefFactory)
 {
     _provider       = provider ?? throw ExceptionUtilities.ArgumentNull();
     _nodes          = nodes ?? throw ExceptionUtilities.ArgumentNull();
     _typeRefFactory = typeRefFactory ?? throw ExceptionUtilities.ArgumentNull();
 }