View Javadoc
1   /*
2    * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  /*
26   * COMPONENT_NAME: idl.parser
27   *
28   * ORIGINS: 27
29   *
30   * Licensed Materials - Property of IBM
31   * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
32   * RMI-IIOP v1.0
33   *
34   */
35  
36  package com.sun.tools.corba.se.idl;
37  
38  // NOTES:
39  
40  /**
41   * If the framework is being extended, this class must be extended.
42   * At very least, the genFactory method must be overridden to return
43   * the code generator extensions.  The remaining methods may be overridden
44   * if necessary:
45   * <dl>
46   * <dt>symtabFactory
47   * <dd>If you wish to extend the symbol table entries, this method must return the factory which constructs those extensions.  If you only want to extend a few of the symbol table entries, it may be useful to extend com.sun.tools.corba.se.idl.DefaultSymtabFactory and only override the pertinent methods.
48   * <dt>exprFactory
49   * <dd>If you wish to extend the expression classes, this method must return the factory which constructs those extensions.  If you only want to extend a few of the expression classes, it may be useful to extend com.sun.tools.corba.se.idl.constExpr.DefaultSymtabFactory and only override the pertinent methods.
50   * <dt>arguments
51   * <dd>If you wish to add additional arguments to the base set of arguments, extend com.sun.tools.corba.se.idl.Arguments and override this method to return that class.
52   * <dt>languageKeywords
53   * <dd>If the language you are generating code in has keywords other than IDL keywords, these keywords should be returned by this method.  The framework will prepend any IDL identifiers it encounters which are in this list with an underscore (`_') to avoid compilation errors.  For instance, `catch' is a Java keyword.  If the generators are emitting Java code for the following IDL, emitting `catch' as is will cause compile errors, so it is changed to `_catch':
54   * <br>
55   * IDL:
56   * <br>
57   * const long catch = 22;
58   * <br>
59   * Possible generated code:
60   * <br>
61   * public static final int _catch = 22;
62   * </dl>
63   **/
64  public class Factories
65  {
66    /** Return the implementation of the GenFactory interface.  If this
67        returns null, then the compiler cannot generate anything. */
68    public GenFactory genFactory ()
69    {
70      return null;
71    } // genFactory
72  
73    /** Return the implementation of the SymtabFactory interface.  If this
74        returns null, the default symbol table entries will be used. */
75    public SymtabFactory symtabFactory ()
76    {
77      return new DefaultSymtabFactory ();
78    } // symtabFactory
79  
80    /** Return the implementation of the ExprFactory interface.  If this
81        returns null, the default expressions will be used. */
82    public com.sun.tools.corba.se.idl.constExpr.ExprFactory exprFactory ()
83    {
84      return new com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory ();
85    } // exprFactory
86  
87    /** Return a subclass of the Arguments class.  If this returns null,
88        the default will be used. */
89    public Arguments arguments ()
90    {
91      return new Arguments ();
92    } // arguments
93  
94    /** Return the list of keywords in the generated language.
95        Note that these keywords may contain the following wildcards:
96        <dl>
97        <dt>`*'
98        <dd>matches zero or more characters
99        <dt>`+'
100       <dd>matches one or more characters
101       <dt>`.'
102       <dd>matches any single character
103       </dl> */
104   public String[] languageKeywords ()
105   {
106     return null;
107   } // languageKeywords
108 } // interface Factories