~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to gnu/javax/swing/text/html/parser/support/Parser.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
934
934
    optional(WS);
935
935
 
936
936
    attributeReading: 
937
 
    while (getTokenAhead().kind == NUMTOKEN)
 
937
      while (getTokenAhead().kind == NUMTOKEN)
938
938
      {
939
939
        name = getNextToken();
940
940
        optional(WS);
949
949
 
950
950
            switch (next.kind)
951
951
              {
952
 
                case QUOT :
953
 
 
954
 
                  // read "quoted" attribute.
955
 
                  buffer.setLength(0);
956
 
                  readTillTokenE(QUOT);
957
 
                  attrValue = buffer.toString();
958
 
                  break;
959
 
 
960
 
                case AP :
961
 
 
962
 
                  // read 'quoted' attribute.
963
 
                  buffer.setLength(0);
964
 
                  readTillTokenE(AP);
965
 
                  attrValue = buffer.toString();
966
 
                  break;
967
 
 
968
 
                // read unquoted attribute.
969
 
                case NUMTOKEN :
970
 
                  value = next;
971
 
                  optional(WS);
972
 
 
973
 
                  // Check maybe the opening quote is missing.
974
 
                  next = getTokenAhead();
975
 
                  if (bQUOTING.get(next.kind))
976
 
                    {
977
 
                      hTag = next;
978
 
                      error("The value without opening quote is closed with '" +
979
 
                            next.getImage() + "'"
980
 
                           );
981
 
                    }
982
 
                  attrValue = value.getImage();
983
 
                  break;
984
 
 
985
 
                default :
986
 
                  break attributeReading;
 
952
              case QUOT:
 
953
 
 
954
                // read "quoted" attribute.
 
955
                buffer.setLength(0);
 
956
                readTillTokenE(QUOT);
 
957
                attrValue = buffer.toString();
 
958
                break;
 
959
 
 
960
              case AP:
 
961
 
 
962
                // read 'quoted' attribute.
 
963
                buffer.setLength(0);
 
964
                readTillTokenE(AP);
 
965
                attrValue = buffer.toString();
 
966
                break;
 
967
 
 
968
              // read unquoted attribute.
 
969
              case NUMTOKEN:
 
970
                value = next;
 
971
                optional(WS);
 
972
 
 
973
                // Check maybe the opening quote is missing.
 
974
                next = getTokenAhead();
 
975
                if (bQUOTING.get(next.kind))
 
976
                  {
 
977
                    hTag = next;
 
978
                    error("The value without opening quote is closed with '"
 
979
                          + next.getImage() + "'");
 
980
                    attrValue = value.getImage();
 
981
                  }
 
982
                else if (next.kind == SLASH)
 
983
                // The slash in this context is treated as the ordinary
 
984
                // character, not as a token. The slash may be part of
 
985
                // the unquoted URL.
 
986
                  {
 
987
                    StringBuffer image = new StringBuffer(value.getImage());
 
988
                    while (next.kind == NUMTOKEN || next.kind == SLASH)
 
989
                      {
 
990
                        image.append(getNextToken().getImage());
 
991
                        next = getTokenAhead();
 
992
                      }
 
993
                    attrValue = image.toString();
 
994
                  }
 
995
                else
 
996
                  attrValue = value.getImage();
 
997
                break;
 
998
 
 
999
              case SLASH:
 
1000
                value = next;
 
1001
                optional(WS);
 
1002
                
 
1003
                // Check maybe the opening quote is missing.
 
1004
                next = getTokenAhead();
 
1005
                if (bQUOTING.get(next.kind))
 
1006
                  {
 
1007
                    hTag = next;
 
1008
                    error("The value without opening quote is closed with '"
 
1009
                          + next.getImage() + "'");
 
1010
                    attrValue = value.getImage();
 
1011
                  }
 
1012
                else if (next.kind == NUMTOKEN || next.kind == SLASH)
 
1013
                // The slash in this context is treated as the ordinary
 
1014
                // character, not as a token. The slash may be part of
 
1015
                // the unquoted URL.
 
1016
                  {
 
1017
                    StringBuffer image = new StringBuffer(value.getImage());
 
1018
                    while (next.kind == NUMTOKEN || next.kind == SLASH)
 
1019
                      {
 
1020
                        image.append(getNextToken().getImage());
 
1021
                        next = getTokenAhead();
 
1022
                      }
 
1023
                    attrValue = image.toString();
 
1024
                  }
 
1025
                else
 
1026
                  attrValue = value.getImage();
 
1027
                break;
 
1028
              default:
 
1029
                break attributeReading;
987
1030
              }
988
1031
            attributes.addAttribute(name.getImage(), attrValue);
989
1032
            optional(WS);
990
1033
          }
991
 
        else // The '=' is missing: attribute without value.
 
1034
        else
 
1035
          // The '=' is missing: attribute without value.
992
1036
          {
993
1037
            noValueAttribute(element, name.getImage());
994
1038
          }
996
1040
  }
997
1041
 
998
1042
  /**
999
 
   * Return string, corresponding the given named entity.
1000
 
   * The name is passed with the preceeding &, but without
1001
 
   * the ending semicolon.
 
1043
   * Return string, corresponding the given named entity. The name is passed
 
1044
   * with the preceeding &, but without the ending semicolon.
1002
1045
   */
1003
1046
  protected String resolveNamedEntity(final String a_tag)
1004
1047
  {