src/share/classes/com/sun/tools/javac/parser/Scanner.java

changeset 752
03177f49411d
parent 695
3c9b64e55c5d
child 816
7c537f4298fb
     1.1 --- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Wed Nov 17 15:07:43 2010 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Nov 18 16:13:11 2010 -0800
     1.3 @@ -66,10 +66,6 @@
     1.4       */
     1.5      private boolean allowUnderscoresInLiterals;
     1.6  
     1.7 -    /** Allow exotic identifiers.
     1.8 -     */
     1.9 -    private boolean allowExoticIdentifiers;
    1.10 -
    1.11      /** The source language setting.
    1.12       */
    1.13      private Source source;
    1.14 @@ -143,7 +139,6 @@
    1.15          allowBinaryLiterals = source.allowBinaryLiterals();
    1.16          allowHexFloats = source.allowHexFloats();
    1.17          allowUnderscoresInLiterals = source.allowBinaryLiterals();
    1.18 -        allowExoticIdentifiers = source.allowExoticIdentifiers();  // for invokedynamic
    1.19      }
    1.20  
    1.21      private static final boolean hexFloatsWork = hexFloatsWork();
    1.22 @@ -295,7 +290,7 @@
    1.23  
    1.24      /** Read next character in character or string literal and copy into sbuf.
    1.25       */
    1.26 -    private void scanLitChar(boolean forBytecodeName) {
    1.27 +    private void scanLitChar() {
    1.28          if (ch == '\\') {
    1.29              if (buf[bp+1] == '\\' && unicodeConversionBp != bp) {
    1.30                  bp++;
    1.31 @@ -335,18 +330,6 @@
    1.32                      putChar('\"'); scanChar(); break;
    1.33                  case '\\':
    1.34                      putChar('\\'); scanChar(); break;
    1.35 -                case '|': case ',': case '?': case '%':
    1.36 -                case '^': case '_': case '{': case '}':
    1.37 -                case '!': case '-': case '=':
    1.38 -                    if (forBytecodeName) {
    1.39 -                        // Accept escape sequences for dangerous bytecode chars.
    1.40 -                        // This is illegal in normal Java string or character literals.
    1.41 -                        // Note that the escape sequence itself is passed through.
    1.42 -                        putChar('\\'); putChar(ch); scanChar();
    1.43 -                    } else {
    1.44 -                        lexError(bp, "illegal.esc.char");
    1.45 -                    }
    1.46 -                    break;
    1.47                  default:
    1.48                      lexError(bp, "illegal.esc.char");
    1.49                  }
    1.50 @@ -355,24 +338,6 @@
    1.51              putChar(ch); scanChar();
    1.52          }
    1.53      }
    1.54 -    private void scanLitChar() {
    1.55 -        scanLitChar(false);
    1.56 -    }
    1.57 -
    1.58 -    /** Read next character in an exotic name #"foo"
    1.59 -     */
    1.60 -    private void scanBytecodeNameChar() {
    1.61 -        switch (ch) {
    1.62 -        // reject any "dangerous" char which is illegal somewhere in the JVM spec
    1.63 -        // cf. http://blogs.sun.com/jrose/entry/symbolic_freedom_in_the_vm
    1.64 -        case '/': case '.': case ';':  // illegal everywhere
    1.65 -        case '<': case '>':  // illegal in methods, dangerous in classes
    1.66 -        case '[':  // illegal in classes
    1.67 -            lexError(bp, "illegal.bytecode.ident.char", String.valueOf((int)ch));
    1.68 -            break;
    1.69 -        }
    1.70 -        scanLitChar(true);
    1.71 -    }
    1.72  
    1.73      private void scanDigits(int digitRadix) {
    1.74          char saveCh;
    1.75 @@ -970,30 +935,6 @@
    1.76                          lexError(pos, "unclosed.str.lit");
    1.77                      }
    1.78                      return;
    1.79 -                case '#':
    1.80 -                    scanChar();
    1.81 -                    if (ch == '\"') {
    1.82 -                        if (!allowExoticIdentifiers) {
    1.83 -                            lexError("unsupported.exotic.id", source.name);
    1.84 -                            allowExoticIdentifiers = true;
    1.85 -                        }
    1.86 -                        scanChar();
    1.87 -                        if (ch == '\"')
    1.88 -                            lexError(pos, "empty.bytecode.ident");
    1.89 -                        while (ch != '\"' && ch != CR && ch != LF && bp < buflen) {
    1.90 -                            scanBytecodeNameChar();
    1.91 -                        }
    1.92 -                        if (ch == '\"') {
    1.93 -                            name = names.fromChars(sbuf, 0, sp);
    1.94 -                            token = IDENTIFIER;  // even if #"int" or #"do"
    1.95 -                            scanChar();
    1.96 -                        } else {
    1.97 -                            lexError(pos, "unclosed.bytecode.ident");
    1.98 -                        }
    1.99 -                    } else {
   1.100 -                        lexError("illegal.char", String.valueOf((int)'#'));
   1.101 -                    }
   1.102 -                    return;
   1.103                  default:
   1.104                      if (isSpecial(ch)) {
   1.105                          scanOperator();

mercurial