// $ANTLR start "STRING_LITERAL"
  public final void mSTRING_LITERAL() throws RecognitionException {
    try {
      int _type = STRING_LITERAL;
      int _channel = DEFAULT_TOKEN_CHANNEL;
      int c;

      // TWS_VARIABLES.g:51:3: ( '\"' (c=~ ( '\"' | '\\r' | '\\n' ) )* '\"' )
      // TWS_VARIABLES.g:51:5: '\"' (c=~ ( '\"' | '\\r' | '\\n' ) )* '\"'
      {
        match('\"');
        StringBuilder b = new StringBuilder();
        // TWS_VARIABLES.g:53:5: (c=~ ( '\"' | '\\r' | '\\n' ) )*
        loop1:
        while (true) {
          int alt1 = 2;
          int LA1_0 = input.LA(1);
          if (((LA1_0 >= '\u0000' && LA1_0 <= '\t')
              || (LA1_0 >= '\u000B' && LA1_0 <= '\f')
              || (LA1_0 >= '\u000E' && LA1_0 <= '!')
              || (LA1_0 >= '#' && LA1_0 <= '\uFFFF'))) {
            alt1 = 1;
          }

          switch (alt1) {
            case 1:
              // TWS_VARIABLES.g:53:7: c=~ ( '\"' | '\\r' | '\\n' )
              {
                c = input.LA(1);
                if ((input.LA(1) >= '\u0000' && input.LA(1) <= '\t')
                    || (input.LA(1) >= '\u000B' && input.LA(1) <= '\f')
                    || (input.LA(1) >= '\u000E' && input.LA(1) <= '!')
                    || (input.LA(1) >= '#' && input.LA(1) <= '\uFFFF')) {
                  input.consume();
                } else {
                  MismatchedSetException mse = new MismatchedSetException(null, input);
                  recover(mse);
                  throw mse;
                }
                b.appendCodePoint(c);
              }
              break;

            default:
              break loop1;
          }
        }

        match('\"');
        setText(b.toString());
      }

      state.type = _type;
      state.channel = _channel;
    } finally {
      // do for sure before leaving
    }
  }
예제 #2
0
 public String show() {
   StringBuilder buf = new StringBuilder();
   if (imports != null) buf.append(" : " + imports);
   for (String name : templates.keySet()) {
     CompiledST c = rawGetTemplate(name);
     if (c.isAnonSubtemplate || c == NOT_FOUND_ST) continue;
     int slash = name.lastIndexOf('/');
     name = name.substring(slash + 1, name.length());
     buf.append(name);
     buf.append('(');
     if (c.formalArguments != null)
       buf.append(Misc.join(c.formalArguments.values().iterator(), ","));
     buf.append(')');
     buf.append(" ::= <<" + Misc.newline);
     buf.append(c.template + Misc.newline);
     buf.append(">>" + Misc.newline);
   }
   return buf.toString();
 }