Пример #1
0
        static public void Apply(ExcessCompiler compiler)
        {
            var lexical = compiler.Lexical();
            var syntax  = compiler.Syntax();

            lexical
            //methods
            .match()
            .token("method", named: "keyword")
            .identifier(named: "id")
            .enclosed('(', ')')
            .token('{')
            .then(lexical.transform()
                  .remove("keyword")
                  .then(Method, referenceToken: "id"))

            //properties
            .match()
            .token("property")
            .identifier(named: "id")
            .token("=")
            .then(Property)

            .match()
            .token("property", named: "keyword")
            .identifier(named: "id")
            .then(lexical.transform()
                  .remove("keyword")
                  .then(Property, referenceToken: "id"));

            syntax
            //constructor
            .match <MethodDeclarationSyntax>(method => method.ReturnType.IsMissing && method.Identifier.ToString() == "constructor")
            .then(Constructor);
        }
Пример #2
0
        public static void Apply(ExcessCompiler compiler)
        {
            var syntax = compiler.Syntax();

            syntax
            .extension("contract", ExtensionKind.Code, ProcessContract);
        }
Пример #3
0
        public static void Apply(ExcessCompiler compiler)
        {
            var syntax = compiler.Syntax();

            //code extension
            syntax
            .extension("asynch", ExtensionKind.Code, ProcessAsynch)
            .extension("synch", ExtensionKind.Code, ProcessSynch);
        }
Пример #4
0
        static public void Apply(ExcessCompiler compiler)
        {
            var lexical = compiler.Lexical();
            var syntax  = compiler.Syntax();

            lexical
            .match()
            .token("event", named: "ev")
            .identifier(named: "id")
            .enclosed('(', ')', contents: "args")
            .then(LexicalEventDeclaration);

            syntax
            .match <MethodDeclarationSyntax>(method => method.ReturnType.ToString() == "on")
            .then(EventHandler);
        }
Пример #5
0
        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);
            }
        }