Example #1
0
        static public void Apply(ExcessCompiler compiler)
        {
            var lexical   = compiler.Lexical();
            var semantics = compiler.Semantics();

            lexical
            .match()     //lambda
            .any('(', '=', ',')
            .token("function", named: "fn")
            .enclosed('(', ')')
            .token('{', named: "brace")
            .then(compiler.Lexical().transform()
                  .remove("fn")
                  .insert("=>", before: "brace"))
            .match()
            .token("function", named: "fn")         //declarations
            .identifier(named: "id")
            .enclosed('(', ')')
            .token('{')
            .then(lexical.transform()
                  .remove("fn")
                  .then(ProcessMemberFunction, referenceToken: "id"));
            semantics
            .error("CS0246", FunctionType);
        }
Example #2
0
        static public void Apply(ExcessCompiler compiler)
        {
            var lexical   = compiler.Lexical();
            var semantics = compiler.Semantics();

            lexical
            .match()
            .token("typedef")
            .identifier(named: "id")
            .token("=")
            .until(';', named: "definition")
            .then(TypedefAssignment)
            .match()
            .token("typedef", named: "keyword")
            .until(';', named: "definition")
            .then(compiler.Lexical().transform()
                  .remove("keyword")
                  .then(Typedef));

            semantics
            .error("CS0246", FixMissingType);
        }