-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
74 lines (63 loc) · 2.07 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using Antlr4.Runtime;
using advpl_parser.grammar;
using advpl_parser.util;
using advpl_parser;
using Newtonsoft.Json;
using System.Threading.Tasks;
using System.IO;
using advpl_parser.documentation;
class Program
{
private static int Main(string[] argv)
{
//DocumentationUtils.getInstance().getFunctionInDb();
(new Program()).Run(argv);
return 0;
}
public void Run(string[] args)
{
try
{
RunParser();
}
catch (Exception ex)
{
Console.WriteLine("ERROR: " + ex);
}
}
private void RunParser()
{
AdvplLanguageServer server = new AdvplLanguageServer();
server.Start(Console.OpenStandardInput(), Console.OpenStandardOutput()).Wait();
//Start(Console.OpenStandardInput(), Console.OpenStandardOutput()).Wait();
/*if (advplParser.NumberOfSyntaxErrors == 0)
{
System.Console.WriteLine("OK");
}
else
{
System.Console.WriteLine("AdvplParser Error.");
foreach (AdvplErroInfo info in errorListener.Errors)
{
System.Console.WriteLine(info.ToString());
}
//string json = JsonConvert.SerializeObject(obj);
}*/
}
public async Task Start(Stream inputStream, Stream outputStream)
{
/*NoCaseANTLRFileStream input= new NoCaseANTLRFileStream(source);
AdvplLexer lexer = new AdvplLexer(input);
CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
AdvplParser advplParser = new AdvplParser(commonTokenStream);
advplParser.RemoveErrorListeners();
AdvplErrorListener errorListener = new AdvplErrorListener();
advplParser.AddErrorListener(errorListener);
ParserRuleContext tree = advplParser.program();
AdvplCompileInfo info = new AdvplCompileInfo();
info.Errors = errorListener.Errors;
string json = JsonConvert.SerializeObject(info);
System.Console.WriteLine(json);*/
}
}