1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpeclipse.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
14 import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
15 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
16 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
17 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
20 public abstract class Literal extends Expression {
22 public Literal(int s,int e) {
27 public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
31 public abstract void computeConstant() ;
32 //ON ERROR constant STAYS NULL
33 public abstract TypeBinding literalType(BlockScope scope);
34 public StringBuffer printExpression(int indent, StringBuffer output){
36 return output.append(source());
38 public TypeBinding resolveType(BlockScope scope) {
39 // compute the real value, which must range its type's range
42 if (constant == null) {
43 scope.problemReporter().constantOutOfRange(this);
44 constant = Constant.NotAConstant;
47 this.resolvedType = literalType(scope);
48 return this.resolvedType;
50 public abstract char[] source() ;