Esempio n. 1
0
 public static string GetNamespace(this SyntaxNodeModel model, List <SyntaxNodeModel> models)
 {
     return(model.GetParent(models).Match(
                parent => $"Nord.Compiler.Generated.Ast.{parent.GetName().Pluralize()}",
                () => "Nord.Compiler.Generated.Ast"
                ));
 }
Esempio n. 2
0
        public static SyntaxNodeModel GetBase(this SyntaxNodeModel model, List <SyntaxNodeModel> models)
        {
            var rootOption = model.GetRootParent(models);

            return(rootOption.Match(
                       root => root,
                       () => model
                       ));
        }
Esempio n. 3
0
        public static Option <SyntaxNodeModel> GetRootParent(this SyntaxNodeModel model, List <SyntaxNodeModel> models)
        {
            var parent = model.GetParent(models);
            var root   = parent.Map(p => p.GetRootParent(models).ValueUnsafe());

            return(root.Match(
                       r => r,
                       () => parent
                       ));
        }
Esempio n. 4
0
 public static string GetClassName(this SyntaxNodeModel model)
 {
     return($"Syntax{model.Name.Pascalize()}");
 }
Esempio n. 5
0
 public static string GetName(this SyntaxNodeModel model)
 {
     return(model.Name);
 }
Esempio n. 6
0
 public static Option <SyntaxNodeModel> GetParent(this SyntaxNodeModel model, List <SyntaxNodeModel> models)
 {
     return(model.Parent.Map(p => models.FirstOrDefault(m => m.Name == p)));
 }