Skip to content

Commit

Permalink
Removed old parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
saj122 committed Feb 5, 2024
1 parent 19a6999 commit 9c2313b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5,842 deletions.
50 changes: 8 additions & 42 deletions Src/Core/API/Base/Factory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public sealed class Factory

private static readonly char[] Whitespaces = new char[] { ' ', '\t', '\n' };

private static bool USE_ANTLR = true;

public static Factory Instance
{
get { return instance; }
Expand Down Expand Up @@ -1368,16 +1366,8 @@ internal AST<Folder> AddProgram(AST<Folder> folder, AST<Program> program)
return Task.Factory.StartNew<ParseResult>(() =>
{
ParseResult pr;
if (USE_ANTLR)
{
var parser = new FormulaVisitor();
parser.ParseFile(name, null, default(Span), cancelToken, out pr);
}
else
{
var parser = new Parser(envParams);
parser.ParseFile(name, null, default(Span), cancelToken, out pr);
}
var parser = new FormulaVisitor();
parser.ParseFile(name, null, default(Span), cancelToken, out pr);
return pr;
});
Expand All @@ -1393,16 +1383,8 @@ internal AST<Folder> AddProgram(AST<Folder> folder, AST<Program> program)
return Task.Factory.StartNew<ParseResult>(() =>
{
ParseResult pr;
if (USE_ANTLR)
{
var parser = new FormulaVisitor();
parser.ParseText(name, programText, default(Span), cancelToken, out pr);
}
else
{
var parser = new Parser(envParams);
parser.ParseText(name, programText, default(Span), cancelToken, out pr);
}
var parser = new FormulaVisitor();
parser.ParseText(name, programText, default(Span), cancelToken, out pr);
return pr;
});
Expand All @@ -1418,16 +1400,8 @@ internal AST<Folder> AddProgram(AST<Folder> folder, AST<Program> program)
return Task.Factory.StartNew<ParseResult>(() =>
{
ParseResult pr;
if (USE_ANTLR)
{
var parser = new FormulaVisitor();
parser.ParseFile(name, referrer, location, cancelToken, out pr);
}
else
{
var parser = new Parser(envParams);
parser.ParseFile(name, referrer, location, cancelToken, out pr);
}
var parser = new FormulaVisitor();
parser.ParseFile(name, referrer, location, cancelToken, out pr);
return pr;
});
}
Expand All @@ -1437,16 +1411,8 @@ public AST<Node> ParseDataTerm(string text, out ImmutableCollection<Flag> flags,
Contract.Requires(text != null);
ParseResult pr;
AST<Node> result = null;
if (USE_ANTLR)
{
var parser = new FormulaVisitor();
result = parser.ParseFuncTerm(text, out pr);
}
else
{
var parser = new Parser(envParams);
result = parser.ParseFuncTerm(text, out pr);
}
var parser = new FormulaVisitor();
result = parser.ParseFuncTerm(text, out pr);

pr.Program.Root.GetNodeHash();
flags = pr.Flags;
Expand Down
Loading

0 comments on commit 9c2313b

Please sign in to comment.