Beispiel #1
0
        private Argument[] GetArguments(ISyntaxPart part)
        {
            var list = new LinkedList <Argument>();

            list.AddLast(
                new Argument(
                    "lexer",
                    new Domain.Type("Lexer", this.ClassInfo.Namespace)));

            if (part is DynamicToken)
            {
                list.AddLast(
                    new Argument(
                        "stopSignals",
                        new Domain.Type("string[]", "System")));
            }

            return(list.ToArray());
        }
Beispiel #2
0
        private string MakeTryParseCall(ISyntaxPart fromPart, ISyntaxPart calledPart, string outName)
        {
            var args = new LinkedList <string>();

            args.AddLast("lexer");

            if (calledPart is DynamicToken)
            {
                if (fromPart is Stream s)
                {
                    args.AddLast(this.MakeStringArrayInit(s.StopTokens.Select(x => x.Text)));
                }

                else
                {
                    args.AddLast("new string[] { }");
                }
            }

            args.AddLast($"out var {outName}");

            return($"this.TryParse{calledPart.GetType().Name}({string.Join(", ", args.Select(x => x))})");
        }
 public TokenListTemplate(IClassInfoProvider classInfo, ISyntaxPart syntaxPart)
 {
     this.ClassInfo  = classInfo;
     this.SyntaxPart = syntaxPart;
 }
Beispiel #4
0
 public SyntaxDefinitionClassInfoProvider(ISyntaxPart part)
 {
     this.part = part;
     this.Name = part.GetType().Name;
 }
Beispiel #5
0
 public SyntaxNodeTemplate(IClassInfoProvider classInfo, ISyntaxPart syntaxPart)
 {
     this.ClassInfo  = classInfo;
     this.SyntaxPart = syntaxPart;
 }
 public ContentInterfaceTemplate(IClassInfoProvider classInfo, ISyntaxPart syntaxPart)
 {
     this.ClassInfo  = classInfo;
     this.SyntaxPart = syntaxPart;
 }