private ASTAnyNode RunModel(string input) { Parser parser = new Parser(new Scanner(new CharSourceTokenizer(input))); ASTModel model = parser.Model; return(model); }
private ASTAnyNode Run(string input) { input = Defaults.DefUsing + input; Parser parser = new Parser(new Scanner(new CharSourceTokenizer(input))); ASTModel model = parser.Model; return(model); }
public Parser(IScanner scanner, List<string> referencedAssemblies) { this.Scanner = scanner; this.ReferencedAssemblies = referencedAssemblies; this.MetadataRetriever = new MetadataRetriever(referencedAssemblies); this.UsedNamespaces = new List<string>(); this.UsedTypes = new List<string>(); this.Model = this.Parse(); }
public void Model() { ASTModel node = new ASTModel(); node.Verbs.Add(new ASTVerb()); node.Verbs.Add(new ASTVerb()); string result = node.Serialize(); Console.WriteLine(result); }
public CodeCompileUnit VisitAll(ASTModel model) { //return (CodeTypeDeclaration) model.Accept(this); CodeCompileUnit theAssembly = new CodeCompileUnit(); // theAssembly.ReferencedAssemblies.AddRange(this.metadataRetriever.AsssemblyPaths.ToArray()); theAssembly.Namespaces.Add(theNamespace); return(theAssembly); }
public CodeObject Visit(ASTModel model) { // Verbs foreach (var verb in model.Verbs) { // Add comment this.theConstructor.Statements.Add(new CodeCommentStatement(String.Empty)); this.theConstructor.Statements.Add(new CodeCommentStatement(verb.ToString())); this.theConstructor.Statements.Add((CodeStatement)verb.Accept(this)); this.verbNo++; } return(this.theClass); }
public CompileUnitConstructor(ASTModel astModel, MetadataRetriever metadataRetriever) { CodeDomGenerationVisitor visitor = new CodeDomGenerationVisitor(metadataRetriever); CodeTypeDeclaration modelClass = visitor.VisitAll_(astModel); CodeNamespace theNamespace = new CodeNamespace(); theNamespace.Name = CompileUnitConstructor.TheNamespaceName; theNamespace.Types.Add(modelClass); theNamespace.Types.Add(RunnableClassGenerator.ConstructRunnableClass(modelClass.Name)); this.CompileUnit = new CodeCompileUnit(); this.CompileUnit.Namespaces.Add(theNamespace); }
// <model> ::= <leadingtrivia> <directives> <verbs> <EOF> private ASTModel ExpectModel() { ASTModel model = new ASTModel(); this.ExpectLeadingTrivia(); this.ExpectDirectives(); IList<ASTVerb> verbs = this.ExpectVerbs(); foreach (var verb in verbs) { model.Verbs.Add(verb); } this.Expect(TokenType.EOF); return model; }
public CodeTypeDeclaration VisitAll_(ASTModel model) { return((CodeTypeDeclaration)model.Accept(this)); }