Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
b3b00 committed Oct 11, 2024
1 parent f2591eb commit ec0a5a9
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 72 deletions.
19 changes: 0 additions & 19 deletions src/sly/lexer/attributes/ModesAttribute.cs

This file was deleted.

19 changes: 2 additions & 17 deletions src/sly/parser/generator/EBNFParserBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,10 @@ protected override ISyntaxParser<IN, OUT> BuildSyntaxParser(ParserConfiguration<
string rootRule)
{
ISyntaxParser<IN, OUT> parser = null;
switch (parserType)
if (parserType == ParserType.EBNF_LL_RECURSIVE_DESCENT)
{
case ParserType.LL_RECURSIVE_DESCENT:
{
parser = new RecursiveDescentSyntaxParser<IN, OUT>(conf, rootRule, I18N);
break;
}
case ParserType.EBNF_LL_RECURSIVE_DESCENT:
{
parser = new EBNFRecursiveDescentSyntaxParser<IN, OUT>(conf, rootRule, I18N);
break;
}
default:
{
parser = null;
break;
}
parser = new EBNFRecursiveDescentSyntaxParser<IN, OUT>(conf, rootRule, I18N);
}

return parser;
}

Expand Down
5 changes: 1 addition & 4 deletions src/sly/parser/generator/ParserBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

namespace sly.parser.generator
{
public delegate BuildResult<Parser<IN, OUT>> ParserChecker<IN, OUT>(BuildResult<Parser<IN, OUT>> result,
NonTerminal<IN> nonterminal) where IN : struct;

/// <summary>
/// this class provides API to build parser
/// </summary>
Expand Down Expand Up @@ -280,7 +277,7 @@ private Rule<IN> BuildNonTerminal(Tuple<string, string> ntAndRule)

private BuildResult<Parser<IN, OUT>> CheckParser(BuildResult<Parser<IN, OUT>> result)
{
var checkers = new List<ParserChecker<IN, OUT>>
var checkers = new List<Func<BuildResult<Parser<IN, OUT>>,NonTerminal<IN>,BuildResult<Parser<IN, OUT>>>>
{
CheckUnreachable,
CheckNotFound,
Expand Down
2 changes: 1 addition & 1 deletion src/sly/parser/generator/visitor/mermaid/IMermaid.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace sly.parser.generator.visitor.dotgraph
namespace sly.parser.generator.visitor.mermaid
{
public interface IMermaid
{
Expand Down
3 changes: 2 additions & 1 deletion src/sly/parser/generator/visitor/mermaid/MermaidNode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Text;
using sly.parser.generator.visitor.dotgraph;

namespace sly.parser.generator.visitor.dotgraph {
namespace sly.parser.generator.visitor.mermaid {

public enum MermaidNodeShape
{
Expand Down
10 changes: 5 additions & 5 deletions src/sly/parser/syntax/grammar/TerminalClause.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public string Dump()
}


[ExcludeFromCodeCoverage]
public bool Equals(IClause<T> clause)
{
if (clause is TerminalClause<T> other)
Expand All @@ -82,6 +83,8 @@ public bool Equals(IClause<T> clause)

return false;
}

[ExcludeFromCodeCoverage]
protected bool Equals(TerminalClause<T> other)
{
if (IsExplicitToken)
Expand Down Expand Up @@ -110,11 +113,8 @@ public IndentTerminalClause(IndentationType expectedIndentation, bool discard) :
ExpectedIndentation = expectedIndentation;
Discarded = discard;
}

public override bool MayBeEmpty()
{
return false;
}

public override bool MayBeEmpty() => false;

public override bool Check(Token<T> nextToken)
{
Expand Down
25 changes: 0 additions & 25 deletions src/sly/parser/syntax/tree/EmptyNode.cs

This file was deleted.

0 comments on commit ec0a5a9

Please sign in to comment.