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

src.org.python.core.Pragma Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
package org.python.core;

import org.python.antlr.ParseException;

public interface Pragma {
    void addTo(PragmaReceiver receiver);

    public abstract class PragmaModule {
        public final String name;

        protected PragmaModule(String name) {
            this.name = name;
        }

        public abstract Pragma getPragma(String name);

        public abstract Pragma getStarPragma();
    }

    public final class ForbiddenPragmaModule extends PragmaModule {
        private final String message;

        public ForbiddenPragmaModule(String name) {
            this(name, "pragma " + name + " is not allowed in this context.");
        }

        public ForbiddenPragmaModule(String name, String message) {
            super(name);
            this.message = message;
        }

        @Override
        public Pragma getPragma(String name) {
            throw new ParseException(message);
        }

        @Override
        public Pragma getStarPragma() {
            throw new ParseException(message);
        }

        public void addTo(PragmaReceiver receiver) {
            throw new ParseException(message);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy