Examples of Token


Examples of ket.math.Token

    int i;
    boolean loop;
    public Presentation() {
      i = 0;
      loop = true;
      target = new Token(new Text("goal:"));
      argument = parse("integral(ln:x, x)");
      getSelection().getCurrent().getEquation().addBefore(new Equation(target));
      getSelection().getCurrent().getEquation().addBefore(new Equation(argument));
    }
View Full Code Here

Examples of lexer.Token

    final Type<Integer> integer = new Type<>("Integer");
    final Type<Double> decimal = new Type<>("Decimal");
    lexer.addRule("Integer", new Rule<Integer>("[0-9]+", integer, new Action<Integer>() {
      @Override
      public Token action(Matcher matcher, Lexer lexer, Type<Integer> type) {
        return new Token(new Integer(matcher.group()), type);
      }
    }));
    lexer.addRule("Decimal", new Rule<Double>("([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)", decimal, new Action<Double>() {
      @Override
      public Token action(Matcher matcher, Lexer lexer, Type<Double> type) {
        return new Token(new Double(matcher.group()), type);
      }
    }));
    lexer.addDescender("Parentheses", new Descender("(", ")", new Type<Token>("Parentheses"), null));
    lexer.addDescender("Brackets", new Descender("[", "]", new Type<Token>("Brackets"), null));
    lexer.ignore("\n");
View Full Code Here

Examples of lexico.Token

////    token  = lexico.getToken();
////    System.out.println("Token recebido: " + token.getTokenType() + " " + token.getIComplementaryInformation());
//    System.out.println("END");
//    System.exit(0);

    Token token = lexico.getToken();
    while(!token.getTokenType().equals(Constantes.TOKEN_FIM_DE_ARQUIVO) || !pilhaStatus.isEmpty()){
//      System.out.println("Token recebido: " + token.getTokenType() + " " + token.getIComplementaryInformation());
      if(token.getTokenType().equals(Constantes.TOKEN_FIM_DE_ARQUIVO)){
        //  Recebeu token de fim de arquivo mas ainda est� numa submaquina
        //  Desempilha a submaquina
        statusAtual = pilhaStatus.pop();
        //  Volta a m�quina anterior p/ o estado e estava
        statusAtual.getMaquina().setEstadoAtual(statusAtual.getEstado());
      }

      int tipoTransicao = statusAtual.getMaquina().opera(token);

      statusAtual.setEstado(statusAtual.getMaquina().getEstadoAtual());

      switch(tipoTransicao){
      case TRANSICAO_NORMAL:
        tokenAnterior = token;
        token = lexico.getToken();
        break;
      case TRANSICAO_EA:
        //  Empilha o status atual (m�quina + estado)
        pilhaStatus.push(new Status(statusAtual.getMaquina(),statusAtual.getEstado()));
        statusAtual.setMaquina(maquinaExpressao);
        maquinaExpressao.setEstadoAtual(Constantes.ESTADO_INICIAL);
        statusAtual.setEstado(Constantes.ESTADO_INICIAL);
        break;
      case TRANSICAO_CMD:
        //  Empilha o status atual (m�quina + estado)
        pilhaStatus.push(new Status(statusAtual.getMaquina(),statusAtual.getEstado()));
        statusAtual.setMaquina(maquinaComando);
        maquinaComando.setEstadoAtual(Constantes.ESTADO_INICIAL);
        statusAtual.setEstado(Constantes.ESTADO_INICIAL);
        break;
      case ESTADO_FINAL:
        //  Se for estado final verifica se a pilha cont�m subm�quinas empilhadas
        if(!pilhaStatus.isEmpty()){
          statusAtual = pilhaStatus.pop();
          //  Volta a m�quina anterior p/ o estado e estava
          statusAtual.getMaquina().setEstadoAtual(statusAtual.getEstado());
        }else{
          //  Se n�o possuir sub-m�quinas empilhadas e o token n�o for de fim de arquivo, � erro
          if(!token.getTokenType().equals(Constantes.TOKEN_FIM_DE_ARQUIVO)){
            throw new StateMachineException("Pr�ximo estado inexistente: Erro na transi��o: ");
          }
        }
        break;
      }
View Full Code Here

Examples of litil.lexer.Token

        return true;
    }

    public Expr expr(int rbp) {
        System.err.println(tab(depth) + "expr " + rbp);
        Token tk = lexer.pop();
        depth++;
        Expr left = nud(tk);
        depth--;
        while (dbg(rbp, lexer.peek(1)) && rbp < lbp(lexer.peek(1))) {
            tk = lexer.pop();
View Full Code Here

Examples of loop.Token

*/
public class SexprTokenizerTest {
  @Test
  public final void simpleSExpressions() {
    assertEquals(Arrays.asList(
        new Token("(", Token.Kind.LPAREN, 0, 0),
        new Token("+", Token.Kind.PLUS, 0, 0),
        new Token("1", Token.Kind.INTEGER, 0, 0),
        new Token("2", Token.Kind.INTEGER, 0, 0),
        new Token(")", Token.Kind.RPAREN, 0, 0)),
        new SexprTokenizer("(+ 1 2)").tokenize());

    assertEquals(Arrays.asList(
        new Token("(", Token.Kind.LPAREN, 0, 0),
        new Token("+", Token.Kind.PLUS, 0, 0),
        new Token("(", Token.Kind.LPAREN, 0, 0),
        new Token("1", Token.Kind.INTEGER, 0, 0),
        new Token(")", Token.Kind.RPAREN, 0, 0),
        new Token("2", Token.Kind.INTEGER, 0, 0),
        new Token(")", Token.Kind.RPAREN, 0, 0)),
        new SexprTokenizer("(+ (1) 2)").tokenize());
  }
View Full Code Here

Examples of lupos.gui.anotherSyntaxHighlighting.javacc.html.Token

    return new JAVACCParser(reader, new HTMLScanner(reader));
  }

  @Override
  public TOKEN getNextToken() {
    final Token token = this.parser.getNextToken();
    if(token==null){
      return null;
    } else {
      return new HTMLToken(token);
    }
View Full Code Here

Examples of lupos.gui.anotherSyntaxHighlighting.javacc.java.Token

    return new JAVACCParser(reader, new JavaScanner(reader));
  }

  @Override
  public TOKEN getNextToken() {
    final Token token = this.parser.getNextToken();
    if(token==null){
      return null;
    } else {
      return new JavaToken(token);
    }
View Full Code Here

Examples of lupos.rif.generated.parser.Token

    return new JAVACCParser(reader, new RIFParser(reader));
  }

  @Override
  public TOKEN getNextToken() {
    final Token token = this.parser.getNextToken();
    if(token==null){
      return null;
    } else {
      return new RIFToken(token);
    }
View Full Code Here

Examples of lupos.sparql1_1.Token

    return new JAVACCParser(reader, new SPARQLParser(reader));
  }

  @Override
  public TOKEN getNextToken() {
    final Token token = this.parser.getNextToken();
    if(token==null){
      return null;
    } else {
      return new SPARQLToken(token);
    }
View Full Code Here

Examples of mage.game.permanent.token.Token

    this.token = permanent.token.copy();
  }

  @Override
  public void reset(Game game) {
    Token copy = token.copy();
    copyFromToken(copy);
    super.reset(game);
  }
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.