Package com.sun.xml.internal.messaging.saaj.packaging.mime.internet

Examples of com.sun.xml.internal.messaging.saaj.packaging.mime.internet.HeaderTokenizer$Token


    idsToRelease.addAll(lineIds);
    lineIds.clear();

    for (int i = 0, l = tokens.size(); i < l; i++) {
      Token token = tokens.get(i);
      TokenType type = token.getType();
      if (type == VARIABLE || type == VARIABLE2 || type == PROPERTY || type == DEF) {
        String value = token.getValue();
        if (value.length() > 2) {
          lineIds.add(value);
        }
      }
      // TODO: Process strings that look like ID.
View Full Code Here


//  @Override
  protected void processLine(int lineNumber, JsonArray<Token> tokens) {
    JsParsingContext context = new JsParsingContext();
    for (int i = 0; i < tokens.size(); i++) {
      Token token = tokens.get(i);
      if (isVariable(token.getType())) {
//        getResultScope().addToken(
//            lineNumber, 0, new CodeToken(token.getValue().trim(), token.getType()));
      }
      Token functionToken = context.getFunctionToken(token);
      if (functionToken != null) {
//        getResultScope().addToken(lineNumber, 0,
//            new CodeToken(functionToken.getValue().trim(), functionToken.getType(), true));
      }
      context.nextToken(token);
View Full Code Here

    int fakeTokenColumn = 0;

    // Last token in always newline, see DocumentParserWorker.
    final int l = tokens.size() - 1;
    for (int i = 0; i < l; i++) {
      Token token = tokens.get(i);
      assert token != null;

      // Ignore whitespaces
      if (WHITESPACE == token.getType()) {
        continue;
      }

      // Common precondition: context is not too short
      if (context.predPred == null) {
        context.push(token);
        continue;
      }

      PyToken predPred = context.predPred;
      PyToken pred = context.pred;

      // In case we get ":" or "(" it may be a function definition
      if (LITERAL_COLON.equals(token.getValue())
          || LITERAL_LEFT_PARANTHESIS.equals(token.getValue())) {
        if ((KEYWORD == predPred.getType()) && "def".equals(predPred.getContent())) {
//          getResultScope().addToken(lineNumber, fakeTokenColumn,
//              new CodeToken(pred.getContent(), pred.getType(), true));
        }
        fakeTokenColumn++;
        context.push(token);
        continue;
      }

      // When we get ", id," construction,
      // then do not reset accumulator (ids before first comma)
      if (LITERAL_COMMA.equals(token.getValue())) {
        if (LITERAL_COMMA.equals(predPred.getContent())) {
          if (VARIABLE == pred.getType()) {
            context.pushSavingAccumulator(token);
            continue;
          }
        }
        context.push(token);
        continue;
      }

      // When we got "id =" then register all remembered ids as variables
      if (LITERAL_EQUALS.equals(token.getValue())) {
        if (VARIABLE == context.pred.getType()) {
          context.accumulator.add(context.pred);
          while (!context.accumulator.isEmpty()) {
            PyToken nextVar = context.accumulator.pop();
//            getResultScope().addToken(lineNumber, fakeTokenColumn,
//                new CodeToken(nextVar.getContent(), nextVar.getType()));
            fakeTokenColumn++;
          }
        }
        context.push(token);
        continue;
      }

      // When we get "id1, id2" construction
      // then remember id1, because it is going to be pushed out of context.
      if (VARIABLE == token.getType()) {
        if (VARIABLE == context.predPred.getType()) {
          if (LITERAL_COMMA.equals(context.pred.getContent())) {
            context.pushAndAddToAccumulator(token);
            continue;
          }
View Full Code Here

    JsCodeScope scope = context.scope;

    int size = tokens.size();
    int index = 0;
    while (index < size) {
      Token token = tokens.get(index);
      index++;

      TokenType tokenType = token.getType();

      if (TokenType.WHITESPACE == tokenType
          || TokenType.NEWLINE == tokenType
          || TokenType.COMMENT == tokenType) {
        // TODO: Parse JsDocs.
        continue;
      }

      String tokenValue = token.getValue();

      switch (state) {
        case NONE:
          if (isFunctionKeyword(tokenType, tokenValue)) {
            state = State.FUNCTION;
View Full Code Here

    int indent = 0;
    int n = tokens.size();
    int i = 0;
    if (n > 0) {
      Token token = tokens.get(i);
      if (TokenType.WHITESPACE == token.getType()) {
        i++;
        indent = token.getValue().length();
      }
      if (n >= i + 3
          && TokenType.KEYWORD == tokens.get(i).getType()
          && TokenType.WHITESPACE == tokens.get(i + 1).getType()
          && TokenType.VARIABLE == tokens.get(i + 2).getType()) {
View Full Code Here

      tokens.add(JsonCollections.<Token>createArray());
    }
    JsonArray<Token> lineTokens;

    lineTokens = tokens.get(1);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<first"));

    lineTokens = tokens.get(2);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "first"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<second"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "second"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<third"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "third"));

    codeAnalyzer.onBeforeParse();
    for (int i = 1; i <= 2; i++) {
      codeAnalyzer.onParseLine(lines.get(i - 1), lines.get(i), tokens.get(i));
    }
View Full Code Here

      tokens.add(JsonCollections.<Token>createArray());
    }
    JsonArray<Token> lineTokens;

    lineTokens = tokens.get(1);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "first"));

    lineTokens = tokens.get(2);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "second"));

    lineTokens = tokens.get(3);
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, "third"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));

    codeAnalyzer.onBeforeParse();
    for (int i = 1; i <= 3; i++) {
      codeAnalyzer.onParseLine(lines.get(i - 1), lines.get(i), tokens.get(i));
    }
View Full Code Here

   * Tests attributes proposals.
   */
  public void testHtmlAttributes() {
    HtmlTagsAndAttributes htmlAttributes = HtmlTagsAndAttributes.getInstance();

    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));
    AutocompleteProposals proposals = findAutocompletions();

    assertEquals(htmlAttributes.searchAttributes("html", new SimpleStringBag(), "").size(),
        proposals.size());
    assertEquals("accesskey", proposals.get(0).getName());
View Full Code Here

    SimpleStringBag excluded = new SimpleStringBag();
    assertEquals(1, htmlAttributes.searchAttributes("html", excluded, sampleAttribute).size());
    excluded.add(sampleAttribute);

    JsonArray<Token> tokens1 = JsonCollections.createArray();
    tokens1.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    tokens1.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));
    String line1 = tokensToText(tokens1);
    parsedLines.put(line1, tokens1);

    JsonArray<Token> tokens2 = JsonCollections.createArray();
    tokens2.add(new Token(CodeMirror2.HTML, TokenType.ATTRIBUTE, sampleAttribute));
    tokens2.add(new Token(CodeMirror2.HTML, TokenType.TAG, ">"));
    String line2 = tokensToText(tokens2);
    parsedLines.put(line2, tokens2);

    String text = line1 + "\n" + line2 + "\n";
    helper.setup(path, text, 0, line1.length(), false);
View Full Code Here

  /**
   * Tests that {@link HtmlAutocompleter#getModeForColumn} gets the mode from
   * the anchor set prior to the given column.
   */
  public void testGetModeForColumn() {
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.TAG, "<html"));
    lineTokens.add(new Token(CodeMirror2.HTML, TokenType.WHITESPACE, " "));

    prepareAutocompleter();

    Document document = helper.editor.getDocument();
    AnchorManager anchorManager = document.getAnchorManager();
View Full Code Here

TOP

Related Classes of com.sun.xml.internal.messaging.saaj.packaging.mime.internet.HeaderTokenizer$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.