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

javax0.jamal.prog.commands.Variable Maven / Gradle / Ivy

There is a newer version: 2.8.1
Show newest version
package javax0.jamal.prog.commands;

import javax0.jamal.api.BadSyntax;
import javax0.jamal.tools.MacroReader;

public class Variable extends Expression {
    private final String name;

    public Variable(final String name) {
        this.name = name;
    }

    @Override
    public String execute(final Context ctx) throws BadSyntax {
        ctx.step();
        return MacroReader.macro(ctx.getProcessor()).readValue(name)
                .orElseThrow(() -> new BadSyntax("Variable " + name + " is not defined"));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy