Package org.eclipse.orion.server.cf.manifest.v2

Examples of org.eclipse.orion.server.cf.manifest.v2.Token


    }

    void irSiguienteLinea() {
        boolean encontrado = false;
        while ((this.listaTokens.size() > posicion) && !encontrado) {
            if ((this.listaTokens.get(posicion).equals(new Token("TK_FIN_SENT", "$")))) {
                encontrado = true;
                leerSiguienteToken();
                break;
            }
            else {
                posicion++;
            }
        }
        if (!encontrado) {
            tokenActual = new Token("TK_SALIDA", finFichero);
        }
    }
View Full Code Here


            if (posicion != listaTokens.size() - 1) {
                leerSiguienteToken();
                return;
            }
            else {
                tokenActual = new Token("TK_SALIDA", finFichero);
                return;
            }
        }
        throw new InterpreterException("Esperaba " + "'" + devolverErrorMatch(v.getV().substring(3)) + "'" + ", encontrado " + "'" + devolverErrorMatch((String)tokenActual.getContenido()) + "'.");
    }
View Full Code Here

                    estado = 0;
                    break;
                }
            }//END switch.
        }//END while.
        listaTokens.add(new Token("TK_SALIDA", "$EOF$")); //Añado el fin de fichero
        for(Token tt: listaTokens){
            System.out.println(tt);
        }
        return listaTokens;
    }
View Full Code Here

    private void RetrocesoPuntero() {
        puntero--;
    }

    private Token DaToken(String lexema, String contenido) {
        Token t = new Token(lexema, contenido);
        listaTokens.add(t);
        return t;
    }
View Full Code Here

   *         11 mars 07<br>
   * @param args
   */
  @SuppressWarnings("boxing")
  public static void main(String[] args) {
    Token token1 = null;
    Token token2 = null;
    byte[] userId = "Dominique_Dominique".getBytes();
    byte[] tempEncrypt = null;
    byte[] tempDecrypt = null;
    byte[] msgToCrypt = null;
    byte[] tempEncodedBase64 = null;
    byte[] tempDecodedBase64 = null;
    byte[] tempBytes = null;
    byte[] myBytes = new byte[15];
    Date creationDate = new Date();
    ASN1Sequence sequenceASN1 = null;
    ASN1InputStream inASN1 = null;
    SymmetricKeyCipher symmetricKeyCipher = null;
    int i = 0;
    int myInt = 30;

    /*
     * Sample : Creating a ASN1 structure, Encrypt and decrypt it with
     * symmetric key algorithm (check equality before and after), Encode and
     * decode it in Base64 (check equality before and after).
     */
    System.out.println("---[Bouncy Castle Sample]---");
    try {
      /* ASN1 Sample */
      myBytes[0] = 1;
      myBytes[1] = 2;
      myBytes[2] = 4;
      myBytes[8] = -3;
      System.out.println("[ASN1 Sample]");
      System.out
          .println("**Sample 1 : Conctructor with direct java object**");
      token1 = new Token(userId, myBytes, myInt, creationDate);
      inASN1 = new ASN1InputStream(token1.getEncoded());
      System.out.println("DumpAsString on Java Object");
      System.out.println(ASN1Dump.dumpAsString(token1));
      System.out.println("DumpAsString on Object from ASN1InputStream");
      System.out.println(ASN1Dump.dumpAsString(inASN1.readObject()));
      // -
      System.out.println("**Sample 2 : Conctructor with ASN1 sequence**");
      sequenceASN1 = ASN1Sequence.getInstance(token1.toASN1Object());
      token2 = new Token(sequenceASN1);
      inASN1 = new ASN1InputStream(token2.getEncoded());
      System.out.println("DumpAsString on Java Object");
      System.out.println(ASN1Dump.dumpAsString(token2));
      System.out.println("DumpAsString on Object from ASN1InputStream");
      System.out.println(ASN1Dump.dumpAsString(inASN1.readObject()));
      System.out.println("--");
      System.out.println("------");
      System.out.println("--\n");
      /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
      /* Cipher Sample */
      System.out.println("[Cipher Sample]");
      symmetricKeyCipher = new SymmetricKeyCipher();
      token1 = new Token(userId, myBytes, myInt, creationDate);
      msgToCrypt = token1.getEncoded();
      System.out.println("Token As String before encryption : ");
      System.out.println(ASN1Dump.dumpAsString(token1));
      System.out.println("**Sample 1 : Encryption**");
      System.out.println("Original bytes : ");
      System.out.print("[");
      for (i = 0; i < msgToCrypt.length; i++) {
        System.out.print(msgToCrypt[i]);
        System.out.print(";");
      }
      System.out.println("]");
      tempEncrypt = symmetricKeyCipher.encrypt(msgToCrypt);
      System.out.println("Encrypted bytes : ");
      System.out.print("[");
      for (i = 0; i < tempEncrypt.length; i++) {
        System.out.print(tempEncrypt[i]);
        System.out.print(";");
      }
      System.out.println("]");
      System.out.println("Encrypted bytes in HEX :");
      System.out.println(new String(Hex.encode(tempEncrypt)));
      System.out.println("**Sample 2 : Decryption**");
      tempDecrypt = symmetricKeyCipher.decrypt(tempEncrypt);
      System.out.println("Decrypted bytes : ");
      System.out.print("[");
      for (i = 0; i < tempDecrypt.length; i++) {
        System.out.print(tempDecrypt[i]);
        System.out.print(";");
      }
      System.out.println("]\n");
      System.out.println("Token As String after decryption : ");
      sequenceASN1 = ASN1Sequence.getInstance(ASN1Object
          .fromByteArray(tempDecrypt));
      token2 = new Token(sequenceASN1);
      System.out.println(ASN1Dump.dumpAsString(token2));
      if (ASN1Dump.dumpAsString(token1).equals(
          ASN1Dump.dumpAsString(token2))) {
        System.out
            .println("OK - Token is equal before and after encryption/decryption !");
      } else {
        System.err
            .println("KO - Token isn't equal before and after encryption/decryption !");
      }
      System.out.println("\n--");
      System.out.println("------");
      System.out.println("--\n");
      /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
      /* Base64 Sample */
      System.out.println("[Base64 Sample]");
      tempBytes = token2.getEncoded();
      System.out.println("Original bytes : ");
      System.out.print("[");
      for (i = 0; i < tempBytes.length; i++) {
        System.out.print(tempBytes[i]);
        System.out.print(";");
      }
      System.out.println("]");
      tempEncodedBase64 = Base64.encode(tempBytes);
      System.out.println("Base 64 encoded bytes : ");
      System.out.print("[");
      for (i = 0; i < tempEncodedBase64.length; i++) {
        System.out.print(tempEncodedBase64[i]);
        System.out.print(";");
      }
      System.out.println("]");
      tempDecodedBase64 = Base64.decode(tempEncodedBase64);
      System.out.println("Base 64 decoded bytes : ");
      System.out.print("[");
      for (i = 0; i < tempDecodedBase64.length; i++) {
        System.out.print(tempDecodedBase64[i]);
        System.out.print(";");
      }
      System.out.println("]");
      System.out.println("Token As String after decoding : ");
      sequenceASN1 = ASN1Sequence.getInstance(ASN1Object
          .fromByteArray(tempDecodedBase64));
      token2 = new Token(sequenceASN1);
      System.out.println(ASN1Dump.dumpAsString(token2));
      System.out.println("\n--");
      System.out.println("------");
      System.out.println("--\n");
      /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
      /* DER Objects Access */
      System.out.printf("USER ID          : {%s}\n", new String(token2
          .getUserId().getOctets()));
      System.out.printf("DER APP SPEC[%s] : {", token2.getDerAppSpec()
          .getContents().length);
      for (byte b : token2.getDerAppSpec().getContents()) {
        System.out.printf(" %s ", b);
      }
      System.out.println("}");
      System.out.printf("DER INTEGER      : {%s}\n", token2
          .getDerInteger().getValue());
      System.out.printf("CREATION DATE    : {%s}\n", token2
          .getCreationDate().getDate());
      System.out.println("\n\n");
      System.out.println(".:ALL IS OK:.");
    } catch (Exception exp) {
      exp.printStackTrace();
View Full Code Here

    boolean inAttribute = false;
    boolean inAnchorTag = false;
    boolean inHrefAttribute = false;
    int tokenEndColumn = 0;
    for (int i = 0, l = tokens.size() - 1; i < l; i++) {
      Token token = tokens.get(i);
      TokenType type = token.getType();
      String value = token.getValue();
      int tokenStartColumn = tokenEndColumn;
      tokenEndColumn += value.length()// Exclusive.
      if (type == TokenType.TAG) {
        if (">".equals(value) || "/>".equals(value)) {
          inAttribute = false;
View Full Code Here

        && "a".equalsIgnoreCase(parserState.getState().getContext().getTagName())) {
      inAnchorTag = true;
    }
    int tokenEndColumn = 0;
    for (int i = 0, l = tokens.size() - 1; i < l; i++) {
      Token token = tokens.get(i);
      TokenType type = token.getType();
      String value = token.getValue();
      int tokenStartColumn = tokenEndColumn;
      tokenEndColumn += value.length();
      if (type == TokenType.TAG) {
        if (">".equals(value) || "/>".equals(value)) {
          inAnchorTag = false;
View Full Code Here

    @Override
    public CompletionContext<State> buildContext(
        SelectionModel selection, DocumentParser parser) {
      JsonArray<Token> tokens = JsonCollections.createArray();
      State state = TestUtils.createMockState();
      tokens.add(new Token(null, NULL, ""));
      ParseResult<State> parseResult = new ParseResult<State>(tokens, state) {};
      return buildContext(
          new ParseUtils.ExtendedParseResult<State>(parseResult, ParseUtils.Context.IN_CODE));
    }
View Full Code Here

    Document document = Document.createFromString(text);
    Line line = document.getFirstLine();
    TaggableLine previousLine;

    JsonArray<Token> tokens1 = JsonCollections.createArray();
    tokens1.add(new Token(mode, TokenType.KEYWORD, "function"));
    tokens1.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens1.add(new Token(mode, TokenType.VARIABLE, "a"));
    tokens1.add(new Token(mode, TokenType.NULL, "("));
    tokens1.add(new Token(mode, TokenType.VARIABLE, "b"));
    tokens1.add(new Token(mode, TokenType.NULL, ","));
    tokens1.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens1.add(new Token(mode, TokenType.VARIABLE, "c"));
    tokens1.add(new Token(mode, TokenType.NULL, ")"));
    tokens1.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens1.add(new Token(mode, TokenType.NULL, "{"));
    tokens1.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsonArray<Token> tokens2 = JsonCollections.createArray();
    tokens2.add(new Token(mode, TokenType.WHITESPACE, "  "));
    tokens2.add(new Token(mode, TokenType.VARIABLE, "d"));
    tokens2.add(new Token(mode, TokenType.NULL, "."));
    tokens2.add(new Token(mode, TokenType.VARIABLE, "prototype"));
    tokens2.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens2.add(new Token(mode, TokenType.NULL, "="));
    tokens2.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens2.add(new Token(mode, TokenType.KEYWORD, "function"));
    tokens2.add(new Token(mode, TokenType.NULL, "("));
    tokens2.add(new Token(mode, TokenType.NULL, ")"));
    tokens2.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens2.add(new Token(mode, TokenType.NULL, "{"));
    tokens2.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsonArray<Token> tokens3 = JsonCollections.createArray();
    tokens3.add(new Token(mode, TokenType.WHITESPACE, "  "));
    tokens3.add(new Token(mode, TokenType.NULL, "}"));
    tokens3.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsonArray<Token> tokens4 = JsonCollections.createArray();
    tokens4.add(new Token(mode, TokenType.NULL, "}"));
    tokens4.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsonArray<Token> tokens5 = JsonCollections.createArray();
    tokens5.add(new Token(mode, TokenType.KEYWORD, "var"));
    tokens5.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens5.add(new Token(mode, TokenType.DEF, "e"));
    tokens5.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens5.add(new Token(mode, TokenType.NULL, "="));
    tokens5.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens5.add(new Token(mode, TokenType.NULL, "{"));
    tokens5.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsonArray<Token> tokens6 = JsonCollections.createArray();
    tokens6.add(new Token(mode, TokenType.WHITESPACE, "  "));
    tokens6.add(new Token(mode, TokenType.PROPERTY, "f"));
    tokens6.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens6.add(new Token(mode, TokenType.NULL, ":"));
    tokens6.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens6.add(new Token(mode, TokenType.KEYWORD, "function"));
    tokens6.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens6.add(new Token(mode, TokenType.NULL, "("));
    tokens6.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens6.add(new Token(mode, TokenType.NULL, ")"));
    tokens6.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens6.add(new Token(mode, TokenType.NULL, "{"));
    tokens6.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsonArray<Token> tokens7 = JsonCollections.createArray();
    tokens7.add(new Token(mode, TokenType.WHITESPACE, "  "));
    tokens7.add(new Token(mode, TokenType.VARIABLE, "callMyFunctionWithCallback"));
    tokens7.add(new Token(mode, TokenType.NULL, "("));
    tokens7.add(new Token(mode, TokenType.KEYWORD, "function"));
    tokens7.add(new Token(mode, TokenType.NULL, "("));
    tokens7.add(new Token(mode, TokenType.COMMENT, "/* Knock-knock! */"));
    tokens7.add(new Token(mode, TokenType.NULL, ")"));
    tokens7.add(new Token(mode, TokenType.WHITESPACE, " "));
    tokens7.add(new Token(mode, TokenType.NULL, "{"));
    tokens7.add(new Token(mode, TokenType.NEWLINE, "\n"));

    JsIndexUpdater indexUpdater = new JsIndexUpdater();
    indexUpdater.onBeforeParse();

    previousLine = TaggableLineUtil.getPreviousLine(line);
View Full Code Here

        value = result.getGroup(4);
        type = WHITESPACE;
      } else {
        throw new IllegalArgumentException("Can't parse: " + result.getGroup(1));
      }
      tokens.add(new Token("test", type, value));
      text = text.substring(value.length());
    }
    ParseResult<State> parseResult = new ParseResult<State>(tokens, TestUtils.createMockState());
    return new ParseUtils.ExtendedParseResult<State>(parseResult, ParseUtils.Context.IN_CODE);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.orion.server.cf.manifest.v2.Token

Copyright © 2018 www.massapicom. 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.