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

org.jruby.truffle.stdlib.readline.ReadlineNodesFactory Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package org.jruby.truffle.stdlib.readline;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.object.DynamicObject;
import java.util.Arrays;
import java.util.List;
import org.jruby.truffle.builtins.CoreMethodNode;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.BasicWordBreakCharactersNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.DeleteTextNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.GetScreenSizeNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.InsertTextNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.LineBufferNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.PointNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.ReadlineNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.RefreshLineNode;
import org.jruby.truffle.stdlib.readline.ReadlineNodes.SetBasicWordBreakCharactersNode;

@GeneratedBy(ReadlineNodes.class)
public final class ReadlineNodesFactory {

    public static List> getFactories() {
        return Arrays.asList(BasicWordBreakCharactersNodeFactory.getInstance(), SetBasicWordBreakCharactersNodeFactory.getInstance(), GetScreenSizeNodeFactory.getInstance(), ReadlineNodeFactory.getInstance(), PointNodeFactory.getInstance(), InsertTextNodeFactory.getInstance(), DeleteTextNodeFactory.getInstance(), LineBufferNodeFactory.getInstance(), RefreshLineNodeFactory.getInstance());
    }

    @GeneratedBy(BasicWordBreakCharactersNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class BasicWordBreakCharactersNodeFactory implements NodeFactory {

        private static BasicWordBreakCharactersNodeFactory basicWordBreakCharactersNodeFactoryInstance;

        private BasicWordBreakCharactersNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return BasicWordBreakCharactersNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode[].class));
        }

        @Override
        public BasicWordBreakCharactersNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
                return create((RubyNode[]) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (basicWordBreakCharactersNodeFactoryInstance == null) {
                basicWordBreakCharactersNodeFactoryInstance = new BasicWordBreakCharactersNodeFactory();
            }
            return basicWordBreakCharactersNodeFactoryInstance;
        }

        public static BasicWordBreakCharactersNode create(RubyNode[] arguments) {
            return new BasicWordBreakCharactersNodeGen(arguments);
        }

        @GeneratedBy(BasicWordBreakCharactersNode.class)
        public static final class BasicWordBreakCharactersNodeGen extends BasicWordBreakCharactersNode {

            @SuppressWarnings("unused")
            private BasicWordBreakCharactersNodeGen(RubyNode[] arguments) {
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                return this.basicWordBreakCharacters();
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

        }
    }
    @GeneratedBy(SetBasicWordBreakCharactersNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class SetBasicWordBreakCharactersNodeFactory implements NodeFactory {

        private static SetBasicWordBreakCharactersNodeFactory setBasicWordBreakCharactersNodeFactoryInstance;

        private SetBasicWordBreakCharactersNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return SetBasicWordBreakCharactersNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList(RubyNode.class);
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode.class));
        }

        @Override
        public SetBasicWordBreakCharactersNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode)) {
                return create((RubyNode) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (setBasicWordBreakCharactersNodeFactoryInstance == null) {
                setBasicWordBreakCharactersNodeFactoryInstance = new SetBasicWordBreakCharactersNodeFactory();
            }
            return setBasicWordBreakCharactersNodeFactoryInstance;
        }

        public static SetBasicWordBreakCharactersNode create(RubyNode characters) {
            return new SetBasicWordBreakCharactersNodeGen(characters);
        }

        @GeneratedBy(SetBasicWordBreakCharactersNode.class)
        public static final class SetBasicWordBreakCharactersNodeGen extends SetBasicWordBreakCharactersNode {

            @Child private RubyNode characters_;
            @CompilationFinal private boolean seenUnsupported0;

            private SetBasicWordBreakCharactersNodeGen(RubyNode characters) {
                this.characters_ = coerceCharactersToString(characters);
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                DynamicObject charactersValue_;
                try {
                    charactersValue_ = characters_.executeDynamicObject(frameValue);
                } catch (UnexpectedResultException ex) {
                    throw unsupported(ex.getResult());
                }
                return this.setBasicWordBreakCharacters(charactersValue_);
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

            private UnsupportedSpecializationException unsupported(Object charactersValue) {
                if (!seenUnsupported0) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    seenUnsupported0 = true;
                }
                return new UnsupportedSpecializationException(this, new Node[] {characters_}, charactersValue);
            }

        }
    }
    @GeneratedBy(GetScreenSizeNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class GetScreenSizeNodeFactory implements NodeFactory {

        private static GetScreenSizeNodeFactory getScreenSizeNodeFactoryInstance;

        private GetScreenSizeNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return GetScreenSizeNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode[].class));
        }

        @Override
        public GetScreenSizeNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
                return create((RubyNode[]) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (getScreenSizeNodeFactoryInstance == null) {
                getScreenSizeNodeFactoryInstance = new GetScreenSizeNodeFactory();
            }
            return getScreenSizeNodeFactoryInstance;
        }

        public static GetScreenSizeNode create(RubyNode[] arguments) {
            return new GetScreenSizeNodeGen(arguments);
        }

        @GeneratedBy(GetScreenSizeNode.class)
        public static final class GetScreenSizeNodeGen extends GetScreenSizeNode {

            @SuppressWarnings("unused")
            private GetScreenSizeNodeGen(RubyNode[] arguments) {
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                return this.getScreenSize();
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

        }
    }
    @GeneratedBy(ReadlineNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class ReadlineNodeFactory implements NodeFactory {

        private static ReadlineNodeFactory readlineNodeFactoryInstance;

        private ReadlineNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return ReadlineNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList(RubyNode.class, RubyNode.class);
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode.class, RubyNode.class));
        }

        @Override
        public ReadlineNode createNode(Object... arguments) {
            if (arguments.length == 2 && (arguments[0] == null || arguments[0] instanceof RubyNode) && (arguments[1] == null || arguments[1] instanceof RubyNode)) {
                return create((RubyNode) arguments[0], (RubyNode) arguments[1]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (readlineNodeFactoryInstance == null) {
                readlineNodeFactoryInstance = new ReadlineNodeFactory();
            }
            return readlineNodeFactoryInstance;
        }

        public static ReadlineNode create(RubyNode prompt, RubyNode addToHistory) {
            return new ReadlineNodeGen(prompt, addToHistory);
        }

        @GeneratedBy(ReadlineNode.class)
        public static final class ReadlineNodeGen extends ReadlineNode {

            @Child private RubyNode prompt_;
            @Child private RubyNode addToHistory_;
            @CompilationFinal private boolean seenUnsupported0;

            private ReadlineNodeGen(RubyNode prompt, RubyNode addToHistory) {
                this.prompt_ = coercePromptToJavaString(prompt);
                this.addToHistory_ = coerceToBoolean(addToHistory);
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                String promptValue_;
                try {
                    promptValue_ = expectString(prompt_.execute(frameValue));
                } catch (UnexpectedResultException ex) {
                    Object addToHistoryValue = addToHistory_.execute(frameValue);
                    throw unsupported(ex.getResult(), addToHistoryValue);
                }
                boolean addToHistoryValue_;
                try {
                    addToHistoryValue_ = addToHistory_.executeBoolean(frameValue);
                } catch (UnexpectedResultException ex) {
                    throw unsupported(promptValue_, ex.getResult());
                }
                return this.readline(promptValue_, addToHistoryValue_);
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

            private UnsupportedSpecializationException unsupported(Object promptValue, Object addToHistoryValue) {
                if (!seenUnsupported0) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    seenUnsupported0 = true;
                }
                return new UnsupportedSpecializationException(this, new Node[] {prompt_, addToHistory_}, promptValue, addToHistoryValue);
            }

            private static String expectString(Object value) throws UnexpectedResultException {
                if (value instanceof String) {
                    return (String) value;
                }
                throw new UnexpectedResultException(value);
            }

        }
    }
    @GeneratedBy(PointNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class PointNodeFactory implements NodeFactory {

        private static PointNodeFactory pointNodeFactoryInstance;

        private PointNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return PointNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode[].class));
        }

        @Override
        public PointNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
                return create((RubyNode[]) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (pointNodeFactoryInstance == null) {
                pointNodeFactoryInstance = new PointNodeFactory();
            }
            return pointNodeFactoryInstance;
        }

        public static PointNode create(RubyNode[] arguments) {
            return new PointNodeGen(arguments);
        }

        @GeneratedBy(PointNode.class)
        public static final class PointNodeGen extends PointNode {

            @SuppressWarnings("unused")
            private PointNodeGen(RubyNode[] arguments) {
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                return executeInteger(frameValue);
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                executeInteger(frameValue);
                return;
            }

            @Override
            public int executeInteger(VirtualFrame frameValue) {
                return this.point();
            }

        }
    }
    @GeneratedBy(InsertTextNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class InsertTextNodeFactory implements NodeFactory {

        private static InsertTextNodeFactory insertTextNodeFactoryInstance;

        private InsertTextNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return InsertTextNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList(RubyNode.class, RubyNode.class);
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode.class, RubyNode.class));
        }

        @Override
        public InsertTextNode createNode(Object... arguments) {
            if (arguments.length == 2 && (arguments[0] == null || arguments[0] instanceof RubyNode) && (arguments[1] == null || arguments[1] instanceof RubyNode)) {
                return create((RubyNode) arguments[0], (RubyNode) arguments[1]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (insertTextNodeFactoryInstance == null) {
                insertTextNodeFactoryInstance = new InsertTextNodeFactory();
            }
            return insertTextNodeFactoryInstance;
        }

        public static InsertTextNode create(RubyNode self, RubyNode text) {
            return new InsertTextNodeGen(self, text);
        }

        @GeneratedBy(InsertTextNode.class)
        public static final class InsertTextNodeGen extends InsertTextNode {

            @Child private RubyNode self_;
            @Child private RubyNode text_;
            @CompilationFinal private boolean seenUnsupported0;

            private InsertTextNodeGen(RubyNode self, RubyNode text) {
                this.self_ = self;
                this.text_ = coerceTextToString(text);
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                DynamicObject selfValue_;
                try {
                    selfValue_ = self_.executeDynamicObject(frameValue);
                } catch (UnexpectedResultException ex) {
                    Object textValue = text_.execute(frameValue);
                    throw unsupported(ex.getResult(), textValue);
                }
                String textValue_;
                try {
                    textValue_ = expectString(text_.execute(frameValue));
                } catch (UnexpectedResultException ex) {
                    throw unsupported(selfValue_, ex.getResult());
                }
                return this.insertText(selfValue_, textValue_);
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

            private UnsupportedSpecializationException unsupported(Object selfValue, Object textValue) {
                if (!seenUnsupported0) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    seenUnsupported0 = true;
                }
                return new UnsupportedSpecializationException(this, new Node[] {self_, text_}, selfValue, textValue);
            }

            private static String expectString(Object value) throws UnexpectedResultException {
                if (value instanceof String) {
                    return (String) value;
                }
                throw new UnexpectedResultException(value);
            }

        }
    }
    @GeneratedBy(DeleteTextNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class DeleteTextNodeFactory implements NodeFactory {

        private static DeleteTextNodeFactory deleteTextNodeFactoryInstance;

        private DeleteTextNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return DeleteTextNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList(RubyNode.class);
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode[].class));
        }

        @Override
        public DeleteTextNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
                return create((RubyNode[]) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (deleteTextNodeFactoryInstance == null) {
                deleteTextNodeFactoryInstance = new DeleteTextNodeFactory();
            }
            return deleteTextNodeFactoryInstance;
        }

        public static DeleteTextNode create(RubyNode[] arguments) {
            return new DeleteTextNodeGen(arguments);
        }

        @GeneratedBy(DeleteTextNode.class)
        public static final class DeleteTextNodeGen extends DeleteTextNode {

            @Child private RubyNode arguments0_;
            @CompilationFinal private boolean seenUnsupported0;

            private DeleteTextNodeGen(RubyNode[] arguments) {
                this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null;
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                DynamicObject arguments0Value_;
                try {
                    arguments0Value_ = arguments0_.executeDynamicObject(frameValue);
                } catch (UnexpectedResultException ex) {
                    throw unsupported(ex.getResult());
                }
                return this.deleteText(arguments0Value_);
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

            private UnsupportedSpecializationException unsupported(Object arguments0Value) {
                if (!seenUnsupported0) {
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    seenUnsupported0 = true;
                }
                return new UnsupportedSpecializationException(this, new Node[] {arguments0_}, arguments0Value);
            }

        }
    }
    @GeneratedBy(LineBufferNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class LineBufferNodeFactory implements NodeFactory {

        private static LineBufferNodeFactory lineBufferNodeFactoryInstance;

        private LineBufferNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return LineBufferNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode[].class));
        }

        @Override
        public LineBufferNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
                return create((RubyNode[]) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (lineBufferNodeFactoryInstance == null) {
                lineBufferNodeFactoryInstance = new LineBufferNodeFactory();
            }
            return lineBufferNodeFactoryInstance;
        }

        public static LineBufferNode create(RubyNode[] arguments) {
            return new LineBufferNodeGen(arguments);
        }

        @GeneratedBy(LineBufferNode.class)
        public static final class LineBufferNodeGen extends LineBufferNode {

            @SuppressWarnings("unused")
            private LineBufferNodeGen(RubyNode[] arguments) {
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                return this.lineBuffer();
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

        }
    }
    @GeneratedBy(RefreshLineNode.class)
    @SuppressWarnings({"unchecked", "rawtypes"})
    public static final class RefreshLineNodeFactory implements NodeFactory {

        private static RefreshLineNodeFactory refreshLineNodeFactoryInstance;

        private RefreshLineNodeFactory() {
        }

        @Override
        public Class getNodeClass() {
            return RefreshLineNode.class;
        }

        @Override
        public List getExecutionSignature() {
            return Arrays.asList();
        }

        @Override
        public List getNodeSignatures() {
            return Arrays.asList(Arrays.asList(RubyNode[].class));
        }

        @Override
        public RefreshLineNode createNode(Object... arguments) {
            if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof RubyNode[])) {
                return create((RubyNode[]) arguments[0]);
            } else {
                throw new IllegalArgumentException("Invalid create signature.");
            }
        }

        public static NodeFactory getInstance() {
            if (refreshLineNodeFactoryInstance == null) {
                refreshLineNodeFactoryInstance = new RefreshLineNodeFactory();
            }
            return refreshLineNodeFactoryInstance;
        }

        public static RefreshLineNode create(RubyNode[] arguments) {
            return new RefreshLineNodeGen(arguments);
        }

        @GeneratedBy(RefreshLineNode.class)
        public static final class RefreshLineNodeGen extends RefreshLineNode {

            @SuppressWarnings("unused")
            private RefreshLineNodeGen(RubyNode[] arguments) {
            }

            @Override
            public NodeCost getCost() {
                return NodeCost.MONOMORPHIC;
            }

            @Override
            public Object execute(VirtualFrame frameValue) {
                return this.refreshLine();
            }

            @Override
            public void executeVoid(VirtualFrame frameValue) {
                execute(frameValue);
                return;
            }

        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy