Пример #1
0
 public GrammarRule(GrammarFn prefix, GrammarFn infix, SignatureFn method, Precedence precedence, string function)
 {
     Prefix = prefix;
     Infix = infix;
     Method = method;
     Precedence = precedence;
     Function = function;
 }
Пример #2
0
 public GrammarRule(GrammarFn prefix, GrammarFn infix, SignatureFn method, Precedence precedence, string name)
 {
     Prefix = prefix;
     Infix = infix;
     Method = method;
     Precedence = precedence;
     Name = name;
 }
Пример #3
0
 public GrammarRule(GrammarFn prefix, GrammarFn infix, SignatureFn method, Precedence precedence, string name)
 {
     this.prefix = prefix;
     this.infix = infix;
     this.method = method;
     this.precedence = precedence;
     this.name = name;
 }
Пример #4
0
        // Compiles a method definition inside a class body. Returns the symbol in the
        // method table for the new method.
        private int Method(ClassCompiler classCompiler, bool isConstructor, SignatureFn signatureFn)
        {
            // Build the method signature.
            Signature signature = new Signature();
            SignatureFromToken(signature);

            classCompiler.MethodName = signature.Name;
            classCompiler.MethodLength = signature.Length;

            Compiler methodCompiler = new Compiler(_parser, this, false);

            // Compile the method signature.
            signatureFn(methodCompiler, signature);

            // Include the full signature in debug messages in stack traces.

            Consume(TokenType.LeftBrace, "Expect '{' to begin method body.");
            methodCompiler.FinishBody(isConstructor);

            methodCompiler.EndCompiler();

            return SignatureSymbol(signature);
        }