public static void Apply(ExcessCompiler compiler, Scope scope = null) { scope?.AddKeywords("injector"); compiler.extension("injector", ParseDependencyInjector); compiler.Environment() .dependency("Excess.Runtime") .dependency("Ninject"); }
public static void Apply(ExcessCompiler compiler, Scope scope = null) { scope?.AddKeywords("sql"); compiler.Lexical() .extension("sql", ExtensionKind.Code, ParseDapper); compiler.Environment() .dependency("Excess.Runtime") .dependency("Dapper") .dependency<IDbConnection>("System.Data") .dependency("System.Collections.Generic") .dependency("System.Linq"); }
static public void Apply(ExcessCompiler compiler) { var lexical = compiler.Lexical(); lexical .match() .token("inject", named: "keyword") .enclosed('{', '}', end: "lastBrace") .then(lexical.transform() .replace("keyword", "__injectFunction __inject = _ => ") .insert(";", after: "lastBrace") .then(ProcessInjection)); compiler.Environment() .dependency <__Scope>("Excess.Runtime"); }
public static void Apply(ExcessCompiler compiler) { compiler.Environment() .dependency <JObject>("Newtonsoft.Json.Linq"); compiler.Lexical() .grammar <JsonGrammar, ParserRuleContext>("json", ExtensionKind.Code) .transform <JSONParser.ExpressionContext>(AntlrExpression.Parse) .transform <JSONParser.JsonContext>(Main) .transform <JSONParser.ObjectContext>(JObject) .transform <JSONParser.ArrayContext>(JArray) .transform <JSONParser.PairContext>(JPair) .transform <JSONParser.ValueContext>(JValue) .then(Transform); ; }
public static void Apply(ExcessCompiler compiler) { Functions.Apply(compiler); Members.Apply(compiler); Events.Apply(compiler); TypeDef.Apply(compiler); Arrays.Apply(compiler); Match.Apply(compiler); //base libs compiler.Environment() .dependency(new string[] { "System", "System.Collections.Generic", "System.Linq" }); }
public static void Apply(ExcessCompiler compiler, Scope scope) { var options = scope?.get <ServerExtensionOptions>() ?? new ServerExtensionOptions(); var keywords = scope?.get("keywords") as List <string>; keywords?.Add("service"); compiler.Syntax() .extension("server", ExtensionKind.Type, CompileServer); var lexical = compiler.Lexical(); lexical.match() .token("service", named: "keyword") .identifier(named: "ref") .then(lexical.transform() .replace("keyword", "class ") .then(CompileService)); compiler.Environment() .dependency("Middleware"); if (options.GenerateJsServices) { throw new NotImplementedException(); //var compilation = compiler.Compilation(); //if (compilation != null) // compilation // .match<ClassDeclarationSyntax>(isConcurrentClass) // .then(jsConcurrentClass) // .match<ClassDeclarationSyntax>(isConcurrentObject) // .then(jsConcurrentObject); } }
public static void Apply(ExcessCompiler compiler, Scope scope, CompilationAnalysis compilation = null) { var options = scope?.get <ServerExtensionOptions>() ?? new ServerExtensionOptions(); var keywords = scope?.get("keywords") as List <string>; keywords?.Add("service"); //compiler.Syntax() // .extension("server", ExtensionKind.Type, CompileServer); var lexical = compiler.Lexical(); lexical.match() .token("service", named: "keyword") .identifier(named: "ref") .then(lexical.transform() .replace("keyword", "class ") .then(CompileService)); compiler.Environment() .dependency("System.Configuration") .dependency("System.Security.Principal") .dependency("Microsoft.Owin") .dependency("Excess.Server.Middleware") ; compiler.Lexical() .indented <ServerModel, ServerInstance>("server", ExtensionKind.Type, InitApp) .match <ServerModel, ServerInstance, ServerLocation>(new[] { "@{Url}", "on port {Port}", "@{Url} port {Port}", "@{Url}, port {Port}" }, then: SetServerLocation) .match <ServerModel, ServerInstance, ConfigModel>("using {Threads} threads", then: SetConfiguration) .match <ServerModel, ServerInstance, ConfigModel>("identity @{Identity}", then: SetConfiguration) .match <ServerModel, ServerInstance, HostingModel>("hosting {ClassName}", then: (server, hosting) => server.HostedClasses.Add(hosting.ClassName)) .match <ServerModel, ServerInstance, StaticFilesModel>(new[] { "static files @{Directory}", "static files {Directory}", }, then: (server, staticFiles) => server.StaticFiles = staticFiles.Directory) .match <ServerModel, ServerInstance, ServerInstance>("new instance", then: AddInstance, children: child => child.match_parent()) .match <ServerModel, ServerInstance, SQLLocation>(new[] { "sql @{ConnectionString}", "sql with {ConnectionInstantiator} @{ConnectionString}", "sql on connection {ConnectionId}", "sql with {ConnectionInstantiator} on connection {ConnectionId}", }, then: (server, sql) => server.SetSqlLocation(sql)) .then() .transform <ServerInstance>(LinkServerInstance); }