All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.style-spec.expression.expression.js Maven / Gradle / Ivy

The newest version!
// @flow

import type {Type} from './types';
import type ParsingContext from './parsing_context';
import type EvaluationContext from './evaluation_context';

type SerializedExpression = Array | string | number | boolean | null;

export interface Expression {
    +type: Type;

    evaluate(ctx: EvaluationContext): any;

    eachChild(fn: Expression => void): void;

    /**
     * Statically analyze the expression, attempting to enumerate possible outputs. Returns
     * false if the complete set of outputs is statically undecidable, otherwise true.
     */
    outputDefined(): boolean;

    serialize(): SerializedExpression;
}

export type ExpressionParser = (args: $ReadOnlyArray, context: ParsingContext) => ?Expression;
export type ExpressionRegistration = Class & { +parse: ExpressionParser };
export type ExpressionRegistry = {[_: string]: ExpressionRegistration};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy