diff --git a/src/sly/lexer/attributes/ModesAttribute.cs b/src/sly/lexer/attributes/ModesAttribute.cs deleted file mode 100644 index d464010d..00000000 --- a/src/sly/lexer/attributes/ModesAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace sly.lexer -{ - [AttributeUsage(AttributeTargets.Enum)] - public class ModesAttribute : Attribute - { - - public IList Modes { get; } - - public ModesAttribute(params string[] modes) - { - Modes = modes.ToList(); - } - - } -} \ No newline at end of file diff --git a/src/sly/parser/generator/EBNFParserBuilder.cs b/src/sly/parser/generator/EBNFParserBuilder.cs index 88dde194..5de6e0a5 100644 --- a/src/sly/parser/generator/EBNFParserBuilder.cs +++ b/src/sly/parser/generator/EBNFParserBuilder.cs @@ -111,25 +111,10 @@ protected override ISyntaxParser BuildSyntaxParser(ParserConfiguration< string rootRule) { ISyntaxParser parser = null; - switch (parserType) + if (parserType == ParserType.EBNF_LL_RECURSIVE_DESCENT) { - case ParserType.LL_RECURSIVE_DESCENT: - { - parser = new RecursiveDescentSyntaxParser(conf, rootRule, I18N); - break; - } - case ParserType.EBNF_LL_RECURSIVE_DESCENT: - { - parser = new EBNFRecursiveDescentSyntaxParser(conf, rootRule, I18N); - break; - } - default: - { - parser = null; - break; - } + parser = new EBNFRecursiveDescentSyntaxParser(conf, rootRule, I18N); } - return parser; } diff --git a/src/sly/parser/generator/ParserBuilder.cs b/src/sly/parser/generator/ParserBuilder.cs index 62ebb377..832d13f8 100644 --- a/src/sly/parser/generator/ParserBuilder.cs +++ b/src/sly/parser/generator/ParserBuilder.cs @@ -14,9 +14,6 @@ namespace sly.parser.generator { - public delegate BuildResult> ParserChecker(BuildResult> result, - NonTerminal nonterminal) where IN : struct; - /// /// this class provides API to build parser /// @@ -280,7 +277,7 @@ private Rule BuildNonTerminal(Tuple ntAndRule) private BuildResult> CheckParser(BuildResult> result) { - var checkers = new List> + var checkers = new List>,NonTerminal,BuildResult>>> { CheckUnreachable, CheckNotFound, diff --git a/src/sly/parser/generator/visitor/mermaid/IMermaid.cs b/src/sly/parser/generator/visitor/mermaid/IMermaid.cs index 1624c462..21f43dbe 100644 --- a/src/sly/parser/generator/visitor/mermaid/IMermaid.cs +++ b/src/sly/parser/generator/visitor/mermaid/IMermaid.cs @@ -1,4 +1,4 @@ -namespace sly.parser.generator.visitor.dotgraph +namespace sly.parser.generator.visitor.mermaid { public interface IMermaid { diff --git a/src/sly/parser/generator/visitor/mermaid/MermaidNode.cs b/src/sly/parser/generator/visitor/mermaid/MermaidNode.cs index c0b687d4..6bca14ea 100644 --- a/src/sly/parser/generator/visitor/mermaid/MermaidNode.cs +++ b/src/sly/parser/generator/visitor/mermaid/MermaidNode.cs @@ -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 { diff --git a/src/sly/parser/syntax/grammar/TerminalClause.cs b/src/sly/parser/syntax/grammar/TerminalClause.cs index 4b7ab9de..5b3d8162 100644 --- a/src/sly/parser/syntax/grammar/TerminalClause.cs +++ b/src/sly/parser/syntax/grammar/TerminalClause.cs @@ -73,6 +73,7 @@ public string Dump() } + [ExcludeFromCodeCoverage] public bool Equals(IClause clause) { if (clause is TerminalClause other) @@ -82,6 +83,8 @@ public bool Equals(IClause clause) return false; } + + [ExcludeFromCodeCoverage] protected bool Equals(TerminalClause other) { if (IsExplicitToken) @@ -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 nextToken) { diff --git a/src/sly/parser/syntax/tree/EmptyNode.cs b/src/sly/parser/syntax/tree/EmptyNode.cs deleted file mode 100644 index 0f03eefa..00000000 --- a/src/sly/parser/syntax/tree/EmptyNode.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace sly.parser.syntax.tree; - -public class EmptyNode : ISyntaxNode where IN : struct -{ - public bool IsEpsilon => true; - public bool Discarded => false; - public string Name => "epsilon"; - - - public bool HasByPassNodes - { - get { return false; } - set { } - } - - public string Dump(string tab) - { - return "epsilon"; - } - - public string ToJson(int index = 0) - { - return $@"""{index}.{Name} : {{}}"; - } -} \ No newline at end of file