void action(final int d) throws IOException,
      UnterminatedRegExpLiteralException, UnterminatedCommentException,
      UnterminatedStringLiteralException {
    switch (d) {
    case 1:
      out.write(theA);
      if (theA == theB && (theA == '+' || theA == '-') && theY != theA) {
        out.write(' ');
      }
    case 2:
      theA = theB;

      if (theA == '\'' || theA == '"' || theA == '`') {
        for (;;) {
          out.write(theA);
          theA = get();
          if (theA == theB) {
            break;
          }
          if (theA <= '\n') {
            throw new UnterminatedStringLiteralException();
          }
          if (theA == '\\') {
            out.write(theA);
            theA = get();
          }
        }
      }

    case 3:
      theB = next();
      if (theB == '/'
          && (theA == '(' || theA == ',' || theA == '=' || theA == ':'
              || theA == '[' || theA == '!' || theA == '&' || theA == '|'
              || theA == '?' || theA == '+' || theA == '-' || theA == '~'
              || theA == '*' || theA == '/' || theA == '{' || theA == '\n')) {
        out.write(theA);
        if (theA == '/' || theA == '*') {
          out.write(' ');
        }
        out.write(theB);
        for (;;) {
          theA = get();
          if (theA == '[') {
            for (;;) {
              out.write(theA);
              theA = get();
              if (theA == ']') {
                break;
              }
              if (theA == '\\') {
                out.write(theA);
                theA = get();
              }
              if (theA <= '\n') {
                throw new UnterminatedRegExpLiteralException();
              }
            }
          } else if (theA == '/') {
            switch (peek()) {
            case '/':
            case '*':
              throw new UnterminatedRegExpLiteralException();
            }
            break;
          } else if (theA == '\\') {
            out.write(theA);
            theA = get();
          } else if (theA <= '\n') {
            throw new UnterminatedRegExpLiteralException();
          }
          out.write(theA);
        }
        theB = next();
      }
    }
  }
void action ( final int d ) throws IOException , UnterminatedRegExpLiteralException , UnterminatedCommentException , UnterminatedStringLiteralException { switch ( d ) { case 1 : out . write ( theA ) ; if ( theA == theB && ( theA == '+' || theA == '-' ) && theY != theA ) { out . write ( ' ' ) ; } case 2 : theA = theB ; if ( theA == '\'' || theA == '"' || theA == '`' ) { for ( ; ; ) { out . write ( theA ) ; theA = get ( ) ; if ( theA == theB ) { break ; } if ( theA <= '\n' ) { throw new UnterminatedStringLiteralException ( ) ; } if ( theA == '\\' ) { out . write ( theA ) ; theA = get ( ) ; } } } case 3 : theB = next ( ) ; if ( theB == '/' && ( theA == '(' || theA == ',' || theA == '=' || theA == ':' || theA == '[' || theA == '!' || theA == '&' || theA == '|' || theA == '?' || theA == '+' || theA == '-' || theA == '~' || theA == '*' || theA == '/' || theA == '{' || theA == '\n' ) ) { out . write ( theA ) ; if ( theA == '/' || theA == '*' ) { out . write ( ' ' ) ; } out . write ( theB ) ; for ( ; ; ) { theA = get ( ) ; if ( theA == '[' ) { for ( ; ; ) { out . write ( theA ) ; theA = get ( ) ; if ( theA == ']' ) { break ; } if ( theA == '\\' ) { out . write ( theA ) ; theA = get ( ) ; } if ( theA <= '\n' ) { throw new UnterminatedRegExpLiteralException ( ) ; } } } else if ( theA == '/' ) { switch ( peek ( ) ) { case '/' : case '*' : throw new UnterminatedRegExpLiteralException ( ) ; } break ; } else if ( theA == '\\' ) { out . write ( theA ) ; theA = get ( ) ; } else if ( theA <= '\n' ) { throw new UnterminatedRegExpLiteralException ( ) ; } out . write ( theA ) ; } theB = next ( ) ; } } }
action -- do something! What you do is determined by the argument:
<ul>
<li>1 Output A. Copy B to A. Get the next B.</li>
<li>2 Copy B to A. Get the next B. (Delete A).</li>
<li>3 Get the next B. (Delete B).</li>
</ul>
action treats a string as a single character. Wow!<br/>
action recognizes a regular expression if it is preceded by ( or , or =.