Esempio n. 1
0
            private static (DslSyntax Value, string Error) LoadDslSyntax(IDslSyntaxProvider dslSyntaxProvider)
            {
                var dslSyntax = dslSyntaxProvider.Load();

                string error = null;

                if (dslSyntax.Version == null)
                {
                    error = $"Cannot detect the application's DSL syntax version (Rhetos {dslSyntax.RhetosVersion})." +
                            $" Currently installed Rhetos Language Services supports DSL version {DslSyntax.CurrentVersion}.";
                }
                else if (dslSyntax.Version > DslSyntax.CurrentVersion)
                {
                    error = $"Please install the latest version of Rhetos Language Services." +
                            $" The project uses a newer version of the DSL syntax: DSL version {dslSyntax.Version}, Rhetos {dslSyntax.RhetosVersion}." +
                            $" Currently installed Rhetos Language Services supports DSL version {DslSyntax.CurrentVersion} or lower.";
                }

                return(dslSyntax, error);
            }
Esempio n. 2
0
            public Context(IDslSyntaxProvider dslSyntaxProvider)
            {
                DslSyntaxProvider         = dslSyntaxProvider;
                CreatedTime               = DateTime.Now;
                DslSyntaxLastModifiedTime = dslSyntaxProvider.GetLastModifiedTime();

                var(dslSyntax, dslSyntaxError) = LoadDslSyntax(dslSyntaxProvider);
                if (dslSyntaxError == null)
                {
                    DslSyntax        = dslSyntax;
                    DslDocumentation = dslSyntaxProvider.LoadDocumentation();
                    Keywords         = ExtractKeywords(dslSyntax);
                }
                else
                {
                    InitializationError = new CodeAnalysisError {
                        Message = dslSyntaxError
                    };
                    DslDocumentation = new DslDocumentation {
                        Concepts = new Dictionary <string, ConceptDocumentation>()
                    };
                    Keywords = new Dictionary <string, ConceptType[]>();
                }
            }