Example #1
0
 private Diagnostic AsDiagnostic(TypeCobol.Compiler.Diagnostics.Diagnostic d)
 {
     var diagnostic = new Diagnostic();
     diagnostic.Range.Start.Character = d.ColumnStart;
     diagnostic.Range.End.Character = d.ColumnEnd;
     diagnostic.Severity = (int)d.Info.Severity;
     diagnostic.Code = d.Info.Code.ToString();
     diagnostic.Source = d.Info.Document.Id.ToString();
     diagnostic.Message = d.Message;
     return diagnostic;
 }
Example #2
0
        internal string ToJSON(int a, TypeCobol.Compiler.CodeElements.CodeElement e)
        {
            var b = new StringBuilder("\n").Append(i(a)).Append("{");
            newline(b, a+1, "");
            kv(b, "Type", "\"" + e.Type + "\"");
            newline(b, a+1, ",");
            b.Append("\"ConsumedTokens\": [");
            bool first = true;
            foreach (var t in e.ConsumedTokens)
            {
                if (first) {
                    newline(b, a+3, "");
                    first = false;
                } else newline(b, a+3, ",");
                b.Append(ToJSON(a+3, t));
            }
            newline(b, a+1, "");
            b.Append("]");

            newline(b, a+1, ",");

            b.Append("\"Diagnostics\": [");
            first = true;
            foreach (var d in e.Diagnostics)
            {
                if (first) {
                    newline(b, a+3, "");
                    first = false;
                } else newline(b, a+3, ",");
                b.Append(ToJSON(a+3, d));
            }
            newline(b, a + 1, "");
            b.Append("]");
            newline(b, a, "");
            return b.Append("}").ToString();
        }
Example #3
0
 private bool hasErrors(TypeCobol.Compiler.Parser.ProgramClassDocument document)
 {
     return document != null && document.Diagnostics != null && document.Diagnostics.Count() > 0;
 }
Example #4
0
 private bool hasErrors(TypeCobol.Compiler.Parser.CodeElementsDocument document)
 {
     return document != null && document.ParserDiagnostics != null && document.ParserDiagnostics.Count() > 0;
 }