Examples of Terminal


Examples of beaver.spec.Terminal

    {
      if (!(act instanceof Reduce))
        throw new IllegalArgumentException("shift-reduce expected, \"" + act + "\" found");
     
      Reduce reduce_act = (Reduce) act;
      Terminal reduce_prec_sym = reduce_act.rule.prec_sym;

      if (this.lookahead instanceof NonTerminal)
      {
        act.type = new Type.Conflict.ShiftReduce(this, reduce_act, act_state, lookahead.name +  " is a non-terminal");
        return false;
      }
      Terminal shift_prec_sym = (Terminal) this.lookahead;

      if (shift_prec_sym.prec > reduce_prec_sym.prec)
      {
        if (reduce_prec_sym.prec < 0)
        {
View Full Code Here

Examples of com.github.jknack.antlr4ide.lang.Terminal

    verify(mocks);
  }

  @Test
  public void terminalSource() {
    Terminal element = createMock(Terminal.class);
    expect(element.getLiteral()).andReturn("'hello'");

    Object[] mocks = {element };

    replay(mocks);
View Full Code Here

Examples of com.kitfox.svg.pathcmd.Terminal

                    cmd = new CubicSmooth(true, nextFloat(tokens), nextFloat(tokens),
                        nextFloat(tokens), nextFloat(tokens));
                    break;
                case 'Z':
                case 'z':
                    cmd = new Terminal();
                    break;
                default:
                    throw new RuntimeException("Invalid path element");
            }
View Full Code Here

Examples of com.zaranux.os.client.programs.Terminal

  };


  void defaultApps()
  {
    Terminal t = new Terminal();
    run(t);
    t.move(100, 100);

    Explorer e1 = new Explorer();
    run(e1);
    e1.move(400, 270);
   
View Full Code Here

Examples of diva.canvas.connector.Terminal

                            .getVisualObject(origHead);

                    // Swap the head and the tail if it will improve the
                    // layout, since LevelLayout only uses directed edges.
                    if (tailFigure instanceof Terminal) {
                        Terminal terminal = (Terminal) tailFigure;
                        Site site = terminal.getConnectSite();

                        if (site instanceof FixedNormalSite) {
                            double normal = site.getNormal();
                            int direction = CanvasUtilities
                                    .getDirection(normal);

                            if (direction == SwingUtilities.WEST) {
                                Object temp = origTail;
                                origTail = origHead;
                                origHead = temp;
                            }
                        }
                    } else if (headFigure instanceof Terminal) {
                        Terminal terminal = (Terminal) headFigure;
                        Site site = terminal.getConnectSite();

                        if (site instanceof FixedNormalSite) {
                            double normal = site.getNormal();
                            int direction = CanvasUtilities
                                    .getDirection(normal);
View Full Code Here

Examples of eas.math.fundamentalAlgorithms.graphBased.algorithms.type0grammars.Terminal

        g.addRule(new Rule(
                new Word(new Symbol[] {new Nonterminal(new StringBuffer("S"))}),
                new Word(new Symbol[] {
                        new Nonterminal(new StringBuffer("a")),
                        new Nonterminal(new StringBuffer("S")),
                        new Terminal(new StringBuffer("b"))})));

        g.addRule(new Rule(
                new Word(new Symbol[] {new Nonterminal(new StringBuffer("S"))}),
                new Word(new Symbol[] {
                        new Nonterminal(new StringBuffer("S")),
                        new Terminal(new StringBuffer("S"))})));

        g.addRule(new Rule(
                new Word(new Symbol[] {new Nonterminal(new StringBuffer("S"))}),
                new Word(new Symbol[] {new Terminal(new StringBuffer("a")), new Terminal(new StringBuffer("b"))})));

        CtxtFreeGrammar g2 = new CtxtFreeGrammar(g);
       
        try {
            ParseTree[] trees = ChartParser.parse(
View Full Code Here

Examples of eas.math.fundamentalAlgorithms.graphBased.algorithms.type0grammars.Terminal

                String symbol = targetTransition.getLabel();
               
                g.addRule(new Rule(
                        new Word(new Symbol[] {new Nonterminal(new StringBuffer(fromState))}),
                        new Word(new Symbol[] {
                                new Terminal(new StringBuffer(symbol)),
                                new Nonterminal(new StringBuffer(toState))})));
            }
           
            if (this.finalStates.contains(fromState)) {
                g.addRule(new Rule(
View Full Code Here

Examples of jline.Terminal

    }

    protected void printUsage(CommandSession session, Action action, Map<Option,Field> optionsMap, Map<Argument,Field> argsMap, PrintStream out)
    {
        Command command = action.getClass().getAnnotation(Command.class);
        Terminal term = session != null ? (Terminal) session.get(".jline.terminal") : null;
        List<Argument> arguments = new ArrayList<Argument>(argsMap.keySet());
        Collections.sort(arguments, new Comparator<Argument>() {
            public int compare(Argument o1, Argument o2) {
                return Integer.valueOf(o1.index()).compareTo(Integer.valueOf(o2.index()));
            }
        });
        Set<Option> options = new HashSet<Option>(optionsMap.keySet());
        options.add(HELP);
        boolean globalScope = NameScoping.isGlobalScope(session, command.scope());
        if (command != null && (command.description() != null || command.name() != null))
        {
            out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("DESCRIPTION").a(Ansi.Attribute.RESET));
            out.print("        ");
            if (command.name() != null) {
                if (globalScope) {
                    out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a(command.name()).a(Ansi.Attribute.RESET));
                } else {
                    out.println(Ansi.ansi().a(command.scope()).a(":").a(Ansi.Attribute.INTENSITY_BOLD).a(command.name()).a(Ansi.Attribute.RESET));
                }
                out.println();
            }
            out.print("\t");
            out.println(command.description());
            out.println();
        }
        StringBuffer syntax = new StringBuffer();
        if (command != null)
        {
            if (globalScope) {
                syntax.append(command.name());
            } else {
                syntax.append(String.format("%s:%s", command.scope(), command.name()));
            }
        }
        if (options.size() > 0)
        {
            syntax.append(" [options]");
        }
        if (arguments.size() > 0)
        {
            syntax.append(' ');
            for (Argument argument : arguments)
            {
                if (!argument.required())
                {
                    syntax.append(String.format("[%s] ", argument.name()));
                }
                else
                {
                    syntax.append(String.format("%s ", argument.name()));
                }
            }
        }

        out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("SYNTAX").a(Ansi.Attribute.RESET));
        out.print("        ");
        out.println(syntax.toString());
        out.println();
        if (arguments.size() > 0)
        {
            out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("ARGUMENTS").a(Ansi.Attribute.RESET));
            for (Argument argument : arguments)
            {
                out.print("        ");
                out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a(argument.name()).a(Ansi.Attribute.RESET));
                printFormatted("                ", argument.description(), term != null ? term.getWidth() : 80, out);
                if (!argument.required()) {
                    try {
                        argsMap.get(argument).setAccessible(true);
                        Object o = argsMap.get(argument).get(action);
                        if (o != null
                                && (!(o instanceof Boolean) || ((Boolean) o))
                                && (!(o instanceof Number) || ((Number) o).doubleValue() != 0.0)) {
                            out.print("                    (defaults to ");
                            out.print(o.toString());
                            out.println(")");
                        }
                    } catch (Throwable t) {
                        // Ignore
                    }
                }
            }
            out.println();
        }
        if (options.size() > 0)
        {
            out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("OPTIONS").a(Ansi.Attribute.RESET));
            for (Option option : options)
            {
                String opt = option.name();
                for (String alias : option.aliases())
                {
                    opt += ", " + alias;
                }
                out.print("        ");
                out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a(opt).a(Ansi.Attribute.RESET));
                printFormatted("                ", option.description(), term != null ? term.getWidth() : 80, out);
                try {
                    optionsMap.get(option).setAccessible(true);
                    Object o = optionsMap.get(option).get(action);
                    if (o != null
                            && (!(o instanceof Boolean) || ((Boolean) o))
                            && (!(o instanceof Number) || ((Number) o).doubleValue() != 0.0)) {
                        out.print("                (defaults to ");
                        out.print(o.toString());
                        out.println(")");
                    }
                } catch (Throwable t) {
                    // Ignore
                }
            }
            out.println();
        }
        if (command.detailedDescription().length() > 0) {
            out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("DETAILS").a(Ansi.Attribute.RESET));
            String desc = loadDescription(action.getClass(), command.detailedDescription());
            printFormatted("        ", desc, term != null ? term.getWidth() : 80, out);
        }
    }
View Full Code Here

Examples of jline.Terminal

            formatter.post(clause, builder);
        }
    }

    protected int getTermWidth() {
        Terminal term = (Terminal) session.get(".jline.terminal");
        return term != null ? term.getWidth() : 80;

    }
View Full Code Here

Examples of jline.Terminal

    }

    int maxWidth = 100;
    ConsoleReader reader = getConsoleReader();
    if (reader != null) {
      Terminal terminal = reader.getTerminal();
      maxWidth = terminal.getWidth() - 15;
      out.setLineLimit(terminal.getHeight() - 2);
    }
    long s = System.nanoTime();
    BlurResults blurResults = client.query(tablename, blurQuery);
    long e = System.nanoTime();
    long timeInNanos = e - s;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.