From 8eb9e27bccca4a0cd6a0b1b15bee76576ce030c3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 6 Mar 2015 07:28:35 +0100 Subject: Bug 1134 - Add ASTLocationTag, locating source of [semantic] errors while parsing / analyzing New GlueGenException supports ASTLocationTag, which will be throws in case of semantic and/or parsing errors. --- src/java/com/jogamp/gluegen/ConstantDefinition.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/java/com/jogamp/gluegen/ConstantDefinition.java') diff --git a/src/java/com/jogamp/gluegen/ConstantDefinition.java b/src/java/com/jogamp/gluegen/ConstantDefinition.java index 78d2e43..1ea4233 100644 --- a/src/java/com/jogamp/gluegen/ConstantDefinition.java +++ b/src/java/com/jogamp/gluegen/ConstantDefinition.java @@ -33,24 +33,27 @@ package com.jogamp.gluegen; +import com.jogamp.gluegen.ASTLocusTag.ASTLocusTagProvider; import com.jogamp.gluegen.cgram.types.AliasedSymbol.AliasedSymbolImpl; import com.jogamp.gluegen.cgram.types.TypeComparator.AliasedSemanticSymbol; import com.jogamp.gluegen.cgram.types.TypeComparator.SemanticEqualityOp; /** Represents the definition of a constant which was provided either via a #define statement or through an enum definition. */ -public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSemanticSymbol { +public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSemanticSymbol, ASTLocusTagProvider { private final boolean relaxedEqSem; private final String sValue; private final long iValue; private final boolean hasIntValue; private final boolean isEnum; private final String enumName; + private final ASTLocusTag astLocus; /** Covering enums */ public ConstantDefinition(final String name, final long value, - final String enumName) { + final String enumName, + final ASTLocusTag astLocus) { super(name); this.relaxedEqSem = TypeConfig.relaxedEqualSemanticsTest(); this.sValue = String.valueOf(value); @@ -58,11 +61,13 @@ public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSema this.hasIntValue = true; this.isEnum = true; this.enumName = enumName; + this.astLocus = astLocus; } /** Covering defines */ public ConstantDefinition(final String name, - final String value) { + final String value, + final ASTLocusTag astLocus) { super(name); this.relaxedEqSem = TypeConfig.relaxedEqualSemanticsTest(); this.sValue = value; @@ -82,8 +87,12 @@ public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSema } this.isEnum = false; this.enumName = null; + this.astLocus = astLocus; } + @Override + public ASTLocusTag getASTLocusTag() { return astLocus; } + /** * Hash by its given {@link #getName() name}. */ -- cgit v1.2.3