~ubuntu-branches/ubuntu/raring/babel/raring-proposed

« back to all changes in this revision

Viewing changes to compiler/gov/llnl/babel/symbols/FloatLiteral.java

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2008-08-01 07:56:58 UTC
  • mfrom: (3.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080801075658-9ezcrbh8dcs8lg70
Tags: 1.2.0.dfsg-6
Added libparsifal-dev as dependency to libsidl-dev (closes: #483324).

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
package gov.llnl.babel.symbols;
32
32
 
 
33
import gov.llnl.babel.Context;
33
34
import gov.llnl.babel.symbols.AssertionException;
34
 
import gov.llnl.babel.symbols.AssertionExpression;
 
35
import gov.llnl.babel.symbols.ExprVisitor;
35
36
import gov.llnl.babel.symbols.Extendable;
36
37
import gov.llnl.babel.symbols.Method;
37
38
import java.util.ArrayList;
38
39
 
39
40
 
40
 
public class FloatLiteral extends AssertionExpression {
 
41
public class FloatLiteral extends Literal {
41
42
  private String d_image = null;
42
43
  private Float  d_value = null;
43
44
 
50
51
   * @throws  gov.llnl.babel.symbols.AssertionException
51
52
   *                  The exception raise if error during any validation.
52
53
   */
53
 
  public FloatLiteral(Float value, String image) throws AssertionException {
 
54
  public FloatLiteral(Float value, String image, Context context) 
 
55
    throws AssertionException 
 
56
  {
54
57
    /*
55
58
     * Go ahead and claim this literal is valid even though the checks
56
59
     * for valid input have not completed.  This is "okay" since the
57
60
     * literal will be valid IF this method completes without exception.
58
61
     */
59
 
    super(true);
 
62
    super(true, context);
60
63
    if ( (image == null) || (image.equals("")) ) {
61
64
      throw new AssertionException("FloatLiteral", "Cannot create a float "
62
65
                + "literal using a null string image.");
184
187
  }
185
188
 
186
189
 
 
190
 
187
191
  /**
188
192
   * Return the C version of the expression.
189
193
   */
198
202
  public String toString() {
199
203
    return hasParens() ?   "(" + d_image + ")"  :  d_image;
200
204
  }
 
205
  /**
 
206
   * Implement the "visitor pattern".
 
207
   */
 
208
  public Object accept(ExprVisitor ev, Object data) {
 
209
    return ev.visitFloatLiteral(this, data);
 
210
  }
201
211
}