corba/src/share/classes/com/sun/tools/corba/se/idl/ParseException.java
author ohair
Tue, 25 May 2010 15:52:11 -0700
changeset 5555 b2b5ed3f0d0d
parent 4 02bb8761fcce
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
/*
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     2
 * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
 *
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    23
 * questions.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
/*
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
 * COMPONENT_NAME: idl.parser
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
 * ORIGINS: 27
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
 * Licensed Materials - Property of IBM
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
 * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
 * RMI-IIOP v1.0
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
package com.sun.tools.corba.se.idl;
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
// NOTES:
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
// -D56351<daz> Update Prefix pragma directive to CORBA 2.3 (see spec.).
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
// -D57110<daz> Update ID pragma directive to CORBA 2.3 (see spec.).
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
// -D46094<daz> Prohibit exceptions from appearing wihtin structs, unions, exceptions.
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
// -D46094<daz> Prohibit attributes from appearing as operation parameter types,
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
//  operation return types, attribute types.
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
// -D59166<daz> Prohibit identifiers form colliding with IDL keywords.
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
// -F60858.1<daz> Add keyword collision warning.
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
// -F60942<daz> Prohibit operations from appearing as operation parameter types.
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
// -D62023<daz> Add deprecated keyword warning; cast char to byte for JDK 1.2 compatability.
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
import java.io.IOException;
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
/**
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
 **/
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
class ParseException extends Exception
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
{
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
   * Constructor: print the supplied message to Standard.err
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
   * and create a new ParseException
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
   * @return a new ParseException.
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
  ParseException (String message)
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
    super (message);
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
    System.err.println (message);
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
    detected = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
  } // ctor
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
   * Constructor: print the supplied message to Standard.err, if it
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
   * is not a warning, and create a new ParseException.
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
   * @return a new ParseException.
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
  ParseException (String message, boolean onlyAWarning)
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
   super (message);
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
   System.err.println (message);
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
   if (!onlyAWarning)
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
     detected = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
  static ParseException abstractValueBox (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
    return arg0 ("abstractValueBox", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
  static ParseException alreadyDeclared (Scanner scanner, String type)
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
    return arg1 ("alreadyDeclared", scanner, type);
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
  static ParseException declNotInSameFile( Scanner scanner, String type,
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
    String firstFile )
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
    return arg2 ("declNotInSameFile", scanner, type, firstFile) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
  static ParseException alreadyDefaulted (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
    return arg0 ("alreadydefaulted", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
  static ParseException alreadyDerived (Scanner scanner, String derived, String iface)
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
    return arg2 ("alreadyDerived", scanner, derived, iface);
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
  static ParseException alreadyRaised (Scanner scanner, String exception)
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
    return arg1 ("alreadyRaised", scanner, exception);
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
  // <d60942>
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
  static ParseException attributeNotType (Scanner scanner, String attr)
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
    return arg1 ("attributeNotType", scanner, attr);
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
  static ParseException badAbstract (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
    return arg1 ("badAbstract", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
  static ParseException badCustom (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
    return arg0 ("badCustom", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
  // <d57110>
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
  static ParseException badRepIDAlreadyAssigned (Scanner scanner, String entry)
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
    return arg1 ("badRepIDAlreadyAssigned", scanner, entry);
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
  // <d57110>
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
  static ParseException badRepIDForm (Scanner scanner, String entry)
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
    return arg1 ("badRepIDForm", scanner, entry);
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
  // <d56351>
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
  static ParseException badRepIDPrefix (Scanner scanner, String entry, String expected, String got)
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
    return arg3 ("badRepIDPrefix", scanner, entry, expected, got);
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
  static ParseException badState (Scanner scanner, String entry)
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
    return arg1 ("badState", scanner, entry);
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
  static ParseException branchLabel (Scanner scanner, String label)
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
    return arg1 ("branchLabel", scanner, label);
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
  static ParseException branchName (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
    return arg1 ("branchName", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
  static ParseException duplicateInit (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
    return arg0 ("duplicateInit", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
  static ParseException duplicateState (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
    return arg1 ("duplicateState", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
  static ParseException elseNoIf (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
    return arg0 ("elseNoIf", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
  static ParseException endNoIf (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
    return arg0 ("endNoIf", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
  static ParseException evaluationError (Scanner scanner, String problem)
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
    return arg1 ("evaluation", scanner, problem);
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
  static ParseException forwardEntry (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
    return arg1 ("forwardEntry", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
  // <f46082.40> Cannot forward value boxes.
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
  static ParseException forwardedValueBox (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
    return arg1 ("forwardedValueBox", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
  static ParseException generic (Scanner scanner, String message)
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
    return arg1 ("generic", scanner, message);
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
  static ParseException illegalArray (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
    return arg1 ("illegalArray", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
  static ParseException illegalException (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
    return arg1 ("illegalException", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
  static ParseException invalidConst (Scanner scanner, String mustBe, String is)
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
    return arg2 ("invalidConst1", scanner, mustBe, is);
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
  static ParseException invalidConst (Scanner scanner, String type)
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
    return arg1 ("invalidConst2", scanner, type);
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
  // <d59166> Non-escaped identifiers that collide with keywords are illegal.
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
  static ParseException keywordCollision (Scanner scanner, String id)
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
    return arg1 ("keywordCollision", scanner, id);
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
  // <d62023> Warning for keywords that will be removed in a future version of IDL.
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
  static ParseException deprecatedKeywordWarning (Scanner scanner, String id)
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
    return arg1Warning ("deprecatedKeywordWarning", scanner, id);
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
  // <f60858.1> Warning for above error.
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
  static ParseException keywordCollisionWarning (Scanner scanner, String id)
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
    return arg1Warning ("keywordCollisionWarning", scanner, id);
02bb8761fcce Initial load
duke
parents:
diff changeset
   238
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   239
02bb8761fcce Initial load
duke
parents:
diff changeset
   240
  static ParseException methodClash (Scanner scanner, String interf, String method)
02bb8761fcce Initial load
duke
parents:
diff changeset
   241
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   242
    return arg2 ("methodClash", scanner, interf, method);
02bb8761fcce Initial load
duke
parents:
diff changeset
   243
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   244
02bb8761fcce Initial load
duke
parents:
diff changeset
   245
  static ParseException moduleNotType (Scanner scanner, String module)
02bb8761fcce Initial load
duke
parents:
diff changeset
   246
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   247
    return arg1 ("moduleNotType", scanner, module);
02bb8761fcce Initial load
duke
parents:
diff changeset
   248
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   249
02bb8761fcce Initial load
duke
parents:
diff changeset
   250
  // <d59067>
02bb8761fcce Initial load
duke
parents:
diff changeset
   251
  static ParseException nestedValueBox (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   252
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   253
    return arg0 ("nestedValueBox", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   254
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   255
02bb8761fcce Initial load
duke
parents:
diff changeset
   256
  static ParseException noDefault (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   257
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   258
    return arg0 ("noDefault", scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   259
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   260
02bb8761fcce Initial load
duke
parents:
diff changeset
   261
  static ParseException nonAbstractParent (Scanner scanner, String baseClass, String parentClass)
02bb8761fcce Initial load
duke
parents:
diff changeset
   262
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   263
    return arg2 ("nonAbstractParent", scanner, baseClass, parentClass);
02bb8761fcce Initial load
duke
parents:
diff changeset
   264
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   265
02bb8761fcce Initial load
duke
parents:
diff changeset
   266
  static ParseException nonAbstractParent2 (Scanner scanner, String baseClass, String parentClass)
02bb8761fcce Initial load
duke
parents:
diff changeset
   267
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   268
    return arg2 ("nonAbstractParent2", scanner, baseClass, parentClass);
02bb8761fcce Initial load
duke
parents:
diff changeset
   269
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   270
02bb8761fcce Initial load
duke
parents:
diff changeset
   271
  static ParseException nonAbstractParent3 (Scanner scanner, String baseClass, String parentClass)
02bb8761fcce Initial load
duke
parents:
diff changeset
   272
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   273
    return arg2 ("nonAbstractParent3", scanner, baseClass, parentClass);
02bb8761fcce Initial load
duke
parents:
diff changeset
   274
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   275
02bb8761fcce Initial load
duke
parents:
diff changeset
   276
  static ParseException notANumber (Scanner scanner, String notNumber)
02bb8761fcce Initial load
duke
parents:
diff changeset
   277
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   278
    return arg1 ("notANumber", scanner, notNumber);
02bb8761fcce Initial load
duke
parents:
diff changeset
   279
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   280
02bb8761fcce Initial load
duke
parents:
diff changeset
   281
  static ParseException nothing (String filename)
02bb8761fcce Initial load
duke
parents:
diff changeset
   282
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   283
    return new ParseException (Util.getMessage ("ParseException.nothing", filename));
02bb8761fcce Initial load
duke
parents:
diff changeset
   284
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   285
02bb8761fcce Initial load
duke
parents:
diff changeset
   286
  static ParseException notPositiveInt (Scanner scanner, String notPosInt)
02bb8761fcce Initial load
duke
parents:
diff changeset
   287
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   288
    return arg1 ("notPosInt", scanner, notPosInt);
02bb8761fcce Initial load
duke
parents:
diff changeset
   289
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   290
02bb8761fcce Initial load
duke
parents:
diff changeset
   291
  static ParseException oneway (Scanner scanner, String method)
02bb8761fcce Initial load
duke
parents:
diff changeset
   292
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   293
    return arg1 ("oneway", scanner, method);
02bb8761fcce Initial load
duke
parents:
diff changeset
   294
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   295
02bb8761fcce Initial load
duke
parents:
diff changeset
   296
  // <d60942>
02bb8761fcce Initial load
duke
parents:
diff changeset
   297
  static ParseException operationNotType (Scanner scanner, String op)
02bb8761fcce Initial load
duke
parents:
diff changeset
   298
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   299
    return arg1 ("operationNotType", scanner, op);
02bb8761fcce Initial load
duke
parents:
diff changeset
   300
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   301
02bb8761fcce Initial load
duke
parents:
diff changeset
   302
  static ParseException outOfRange (Scanner scanner, String value, String type)
02bb8761fcce Initial load
duke
parents:
diff changeset
   303
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   304
    return arg2 ("outOfRange", scanner, value, type);
02bb8761fcce Initial load
duke
parents:
diff changeset
   305
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   306
02bb8761fcce Initial load
duke
parents:
diff changeset
   307
  static ParseException recursive (Scanner scanner, String type, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   308
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   309
    return arg2 ("recursive", scanner, type, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   310
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   311
02bb8761fcce Initial load
duke
parents:
diff changeset
   312
  static ParseException selfInherit (Scanner scanner, String name)
02bb8761fcce Initial load
duke
parents:
diff changeset
   313
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   314
    return arg1 ("selfInherit", scanner, name);
02bb8761fcce Initial load
duke
parents:
diff changeset
   315
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   316
02bb8761fcce Initial load
duke
parents:
diff changeset
   317
  static ParseException stringTooLong (Scanner scanner, String str, String max)
02bb8761fcce Initial load
duke
parents:
diff changeset
   318
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   319
    return arg2 ("stringTooLong", scanner, str, max);
02bb8761fcce Initial load
duke
parents:
diff changeset
   320
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   321
02bb8761fcce Initial load
duke
parents:
diff changeset
   322
  static ParseException syntaxError (Scanner scanner, int expected, int got)
02bb8761fcce Initial load
duke
parents:
diff changeset
   323
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   324
    return arg2 ("syntax1", scanner, Token.toString (expected), Token.toString (got));
02bb8761fcce Initial load
duke
parents:
diff changeset
   325
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   326
02bb8761fcce Initial load
duke
parents:
diff changeset
   327
  static ParseException syntaxError (Scanner scanner, String expected, String got)
02bb8761fcce Initial load
duke
parents:
diff changeset
   328
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   329
    return arg2 ("syntax1", scanner, expected, got);
02bb8761fcce Initial load
duke
parents:
diff changeset
   330
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   331
02bb8761fcce Initial load
duke
parents:
diff changeset
   332
  static ParseException syntaxError (Scanner scanner, int[] expected, int got)
02bb8761fcce Initial load
duke
parents:
diff changeset
   333
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   334
    return syntaxError (scanner, expected, Token.toString (got));
02bb8761fcce Initial load
duke
parents:
diff changeset
   335
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   336
02bb8761fcce Initial load
duke
parents:
diff changeset
   337
  static ParseException syntaxError (Scanner scanner, int[] expected, String got)
02bb8761fcce Initial load
duke
parents:
diff changeset
   338
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   339
    String tokenList = "";
02bb8761fcce Initial load
duke
parents:
diff changeset
   340
    for (int i = 0; i < expected.length; ++i)
02bb8761fcce Initial load
duke
parents:
diff changeset
   341
      tokenList += " `" + Token.toString (expected[i]) + "'";
02bb8761fcce Initial load
duke
parents:
diff changeset
   342
    return arg2 ("syntax2", scanner, tokenList, got);
02bb8761fcce Initial load
duke
parents:
diff changeset
   343
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   344
02bb8761fcce Initial load
duke
parents:
diff changeset
   345
  static ParseException unclosedComment (String filename)
02bb8761fcce Initial load
duke
parents:
diff changeset
   346
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   347
    return new ParseException (Util.getMessage ("ParseException.unclosed", filename));
02bb8761fcce Initial load
duke
parents:
diff changeset
   348
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   349
02bb8761fcce Initial load
duke
parents:
diff changeset
   350
  static ParseException undeclaredType (Scanner scanner, String undeclaredType)
02bb8761fcce Initial load
duke
parents:
diff changeset
   351
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   352
    return arg1 ("undeclaredType", scanner, undeclaredType);
02bb8761fcce Initial load
duke
parents:
diff changeset
   353
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   354
02bb8761fcce Initial load
duke
parents:
diff changeset
   355
  static ParseException warning (Scanner scanner, String message)
02bb8761fcce Initial load
duke
parents:
diff changeset
   356
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   357
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   358
    String[] parameters = { filename, Integer.toString (lineNumber), message, line, pointer };
02bb8761fcce Initial load
duke
parents:
diff changeset
   359
    return new ParseException (Util.getMessage ("ParseException.warning", parameters), true);
02bb8761fcce Initial load
duke
parents:
diff changeset
   360
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   361
02bb8761fcce Initial load
duke
parents:
diff changeset
   362
  static ParseException wrongType (Scanner scanner, String name, String mustBe, String is)
02bb8761fcce Initial load
duke
parents:
diff changeset
   363
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   364
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   365
    String[] parameters = {filename, Integer.toString (lineNumber), name, is, mustBe, line, pointer};
02bb8761fcce Initial load
duke
parents:
diff changeset
   366
    return new ParseException (Util.getMessage ("ParseException.wrongType", parameters));
02bb8761fcce Initial load
duke
parents:
diff changeset
   367
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   368
02bb8761fcce Initial load
duke
parents:
diff changeset
   369
  static ParseException wrongExprType (Scanner scanner, String mustBe, String is)
02bb8761fcce Initial load
duke
parents:
diff changeset
   370
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   371
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   372
    String[] parameters = {filename, Integer.toString (lineNumber),
02bb8761fcce Initial load
duke
parents:
diff changeset
   373
      is, mustBe, line, pointer};
02bb8761fcce Initial load
duke
parents:
diff changeset
   374
    return new ParseException (Util.getMessage ("ParseException.constExprType",
02bb8761fcce Initial load
duke
parents:
diff changeset
   375
      parameters));
02bb8761fcce Initial load
duke
parents:
diff changeset
   376
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   377
02bb8761fcce Initial load
duke
parents:
diff changeset
   378
  static ParseException illegalForwardInheritance( Scanner scanner, String declName,
02bb8761fcce Initial load
duke
parents:
diff changeset
   379
    String baseName )
02bb8761fcce Initial load
duke
parents:
diff changeset
   380
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   381
    scannerInfo( scanner ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   382
    String[] parameters = { filename, Integer.toString(lineNumber),
02bb8761fcce Initial load
duke
parents:
diff changeset
   383
        declName, baseName, line, pointer } ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   384
    return new ParseException (Util.getMessage(
02bb8761fcce Initial load
duke
parents:
diff changeset
   385
        "ParseException.forwardInheritance", parameters ) ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   386
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   387
02bb8761fcce Initial load
duke
parents:
diff changeset
   388
  static ParseException illegalIncompleteTypeReference( Scanner scanner,
02bb8761fcce Initial load
duke
parents:
diff changeset
   389
    String declName )
02bb8761fcce Initial load
duke
parents:
diff changeset
   390
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   391
    scannerInfo( scanner ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   392
    String[] parameters = { filename, Integer.toString(lineNumber),
02bb8761fcce Initial load
duke
parents:
diff changeset
   393
        declName, line, pointer } ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   394
    return new ParseException (Util.getMessage(
02bb8761fcce Initial load
duke
parents:
diff changeset
   395
        "ParseException.illegalIncompleteTypeReference", parameters ) ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   396
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   397
02bb8761fcce Initial load
duke
parents:
diff changeset
   398
  private static void scannerInfo (Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   399
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   400
    filename   = scanner.filename ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   401
    line       = scanner.lastTokenLine ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   402
    lineNumber = scanner.lastTokenLineNumber ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   403
    int pos    = scanner.lastTokenLinePosition ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   404
    pointer    = "^";
02bb8761fcce Initial load
duke
parents:
diff changeset
   405
    if (pos > 1)
02bb8761fcce Initial load
duke
parents:
diff changeset
   406
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   407
      byte[] bytes = new byte[ pos - 1 ];
02bb8761fcce Initial load
duke
parents:
diff changeset
   408
      for (int i = 0; i < pos - 1; ++i)
02bb8761fcce Initial load
duke
parents:
diff changeset
   409
        bytes[i] = (byte)' ';  // <d62023>
02bb8761fcce Initial load
duke
parents:
diff changeset
   410
      pointer = new String (bytes) + pointer;
02bb8761fcce Initial load
duke
parents:
diff changeset
   411
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   412
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   413
02bb8761fcce Initial load
duke
parents:
diff changeset
   414
  private static ParseException arg0 (String msgId, Scanner scanner)
02bb8761fcce Initial load
duke
parents:
diff changeset
   415
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   416
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   417
    String[] parameters = {filename, Integer.toString (lineNumber), line, pointer};
02bb8761fcce Initial load
duke
parents:
diff changeset
   418
    return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
02bb8761fcce Initial load
duke
parents:
diff changeset
   419
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   420
02bb8761fcce Initial load
duke
parents:
diff changeset
   421
  private static ParseException arg1 (String msgId, Scanner scanner, String arg1)
02bb8761fcce Initial load
duke
parents:
diff changeset
   422
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   423
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   424
    String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer};
02bb8761fcce Initial load
duke
parents:
diff changeset
   425
    return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
02bb8761fcce Initial load
duke
parents:
diff changeset
   426
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   427
02bb8761fcce Initial load
duke
parents:
diff changeset
   428
  // <f60858.1>
02bb8761fcce Initial load
duke
parents:
diff changeset
   429
  private static ParseException arg1Warning (String msgId, Scanner scanner, String arg1)
02bb8761fcce Initial load
duke
parents:
diff changeset
   430
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   431
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   432
    String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer};
02bb8761fcce Initial load
duke
parents:
diff changeset
   433
    return new ParseException (Util.getMessage ("ParseException." + msgId, parameters), true);
02bb8761fcce Initial load
duke
parents:
diff changeset
   434
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   435
02bb8761fcce Initial load
duke
parents:
diff changeset
   436
  private static ParseException arg2 (String msgId, Scanner scanner, String arg1, String arg2)
02bb8761fcce Initial load
duke
parents:
diff changeset
   437
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   438
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   439
    String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, line, pointer};
02bb8761fcce Initial load
duke
parents:
diff changeset
   440
    return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
02bb8761fcce Initial load
duke
parents:
diff changeset
   441
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   442
02bb8761fcce Initial load
duke
parents:
diff changeset
   443
  private static ParseException arg3 (String msgId, Scanner scanner, String arg1, String arg2, String arg3)
02bb8761fcce Initial load
duke
parents:
diff changeset
   444
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   445
    scannerInfo (scanner);
02bb8761fcce Initial load
duke
parents:
diff changeset
   446
    String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, arg3, line, pointer};
02bb8761fcce Initial load
duke
parents:
diff changeset
   447
    return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
02bb8761fcce Initial load
duke
parents:
diff changeset
   448
  }
02bb8761fcce Initial load
duke
parents:
diff changeset
   449
02bb8761fcce Initial load
duke
parents:
diff changeset
   450
  private static String filename  = "";
02bb8761fcce Initial load
duke
parents:
diff changeset
   451
  private static String line      = "";
02bb8761fcce Initial load
duke
parents:
diff changeset
   452
  private static int   lineNumber = 0;
02bb8761fcce Initial load
duke
parents:
diff changeset
   453
  private static String pointer   = "^";
02bb8761fcce Initial load
duke
parents:
diff changeset
   454
02bb8761fcce Initial load
duke
parents:
diff changeset
   455
  static boolean detected = false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   456
} // class ParseException