All files / parser/nodes functionizedOperator.js

0% Statements 0/3
100% Branches 0/0
0% Functions 0/2
0% Lines 0/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36                                                                       
import Node from './node';
 
/**
 * Represents a functional operator
 * 
 * A functional operator is a shorthand for creating a lambda with a single op.
 * 
 * This node represents a functional operator and is created by specifiying the
 * operator type which must be part of the tokenizer and align with a specified
 * operator type. The type the functionalized operator is not needed as is
 * transformed into a lambda recursively and that can be type inferred.
 * 
 * @example
 * (==)
 */
 
export default class FunctionizedOperator extends Node {
    
    /**
     * Creates a FunctionizedOperator node
     * 
     * @param {Operator} operator the opreator to functionize
     * @param {Object} position a position from nearley
     */
    constructor (operator: any, position: Object) {
        super(position);
        
        /** @type {string} */
        this.operator = operator;
    }
    
    /** @override */
    get children() {
        return null;
    }
}