void read(Tokeniser t, CharacterReader r) {
      if (r.matchesLetter()) {
        String name = r.consumeLetterSequence();
        t.tagPending.appendTagName(name.toLowerCase());
        t.dataBuffer.append(name);
        return;
      }

      if (t.isAppropriateEndTagToken() && !r.isEmpty()) {
        char c = r.consume();
        switch (c) {
          case '\t':
          case '\n':
          case '\r':
          case '\f':
          case ' ':
            t.transition(BeforeAttributeName);
            break;
          case '/':
            t.transition(SelfClosingStartTag);
            break;
          case '>':
            t.emitTagPending();
            t.transition(Data);
            break;
          default:
            t.dataBuffer.append(c);
            anythingElse(t, r);
            break;
        }
      } else {
        anythingElse(t, r);
      }
    }
    void read(Tokeniser t, CharacterReader r) {
      if (r.isEmpty()) {
        t.eofError(this);
        t.transition(Data);
        return;
      }

      char c = r.consume();
      switch (c) {
        case '-':
          t.emit(c);
          break;
        case '<':
          t.transition(ScriptDataEscapedLessthanSign);
          break;
        case '>':
          t.emit(c);
          t.transition(ScriptData);
          break;
        case nullChar:
          t.error(this);
          t.emit(replacementChar);
          t.transition(ScriptDataEscaped);
          break;
        default:
          t.emit(c);
          t.transition(ScriptDataEscaped);
      }
    }
    void read(Tokeniser t, CharacterReader r) {
      if (r.isEmpty()) {
        t.eofError(this);
        t.transition(Data);
        return;
      }

      switch (r.current()) {
        case '-':
          t.emit('-');
          t.advanceTransition(ScriptDataEscapedDash);
          break;
        case '<':
          t.advanceTransition(ScriptDataEscapedLessthanSign);
          break;
        case nullChar:
          t.error(this);
          r.advance();
          t.emit(replacementChar);
          break;
        default:
          String data = r.consumeToAny('-', '<', nullChar);
          t.emit(data);
      }
    }
 void read(Tokeniser t, CharacterReader r) {
   if (r.isEmpty()) {
     t.eofError(this);
     t.emit("</");
     t.transition(Data);
   } else if (r.matchesLetter()) {
     t.createTagPending(false);
     t.transition(TagName);
   } else if (r.matches('>')) {
     t.error(this);
     t.advanceTransition(Data);
   } else {
     t.error(this);
     t.advanceTransition(BogusComment);
   }
 }
Ejemplo n.º 5
0
 void read(Tokeniser t, CharacterReader r) {
   if (r.isEmpty()) {
     t.eofError(this);
     t.doctypePending.forceQuirks = true;
     t.emitDoctypePending();
     t.transition(Data);
     return;
   }
   if (r.matches('>')) {
     t.emitDoctypePending();
     t.advanceTransition(Data);
   } else if (r.matchConsumeIgnoreCase("PUBLIC")) {
     t.transition(AfterDoctypePublicKeyword);
   } else if (r.matchConsumeIgnoreCase("SYSTEM")) {
     t.transition(AfterDoctypeSystemKeyword);
   } else {
     t.error(this);
     t.doctypePending.forceQuirks = true;
     t.advanceTransition(BogusDoctype);
   }
 }