Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
joey-coleman committed May 20, 2014
2 parents a21a76b + 7b7a35a commit 4b615e7
Show file tree
Hide file tree
Showing 1,550 changed files with 34,420 additions and 62,641 deletions.
4,050 changes: 4,050 additions & 0 deletions catches.txt

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions core/ast/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/target
/target
/target
/target
/target
2 changes: 1 addition & 1 deletion core/ast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.overturetool</groupId>
<artifactId>core</artifactId>
<version>2.0.6</version>
<version>2.0.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
import org.overture.ast.util.type.NumericBasisChecker;
import org.overture.ast.util.type.NumericFinder;


//TODO Add assistant Javadoc
/**
* This is the main AST assistant factory. everyone ultimately inherits from here.
* @author ldc
*
*/

public class AstAssistantFactory implements IAstAssistantFactory
{

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
package org.overture.ast.assistant;

import java.lang.reflect.Method;

import org.overture.ast.analysis.intf.IAnswer;
import org.overture.ast.assistant.definition.PAccessSpecifierAssistant;
import org.overture.ast.assistant.definition.PDefinitionAssistant;
import org.overture.ast.assistant.pattern.PPatternAssistant;
import org.overture.ast.assistant.type.ABracketTypeAssistant;
import org.overture.ast.assistant.type.ANamedInvariantTypeAssistant;
import org.overture.ast.assistant.type.AOptionalTypeAssistant;
import org.overture.ast.assistant.type.AParameterTypeAssistant;
import org.overture.ast.assistant.type.AUnionTypeAssistant;
import org.overture.ast.assistant.type.AUnknownTypeAssistant;
import org.overture.ast.assistant.type.PTypeAssistant;
import org.overture.ast.assistant.type.SNumericBasicTypeAssistant;
<<<<<<< HEAD
import org.overture.ast.lex.LexNameList;
import org.overture.ast.types.SNumericBasicType;
import org.overture.ast.util.pattern.AllVariableNameLocator;
import org.overture.ast.util.type.HashChecker;
import org.overture.ast.util.type.NumericBasisChecker;
import org.overture.ast.util.type.NumericFinder;

=======
//TODO Add assistant Javadoc
/**
* This is the main AST assistant factory. everyone ultimately inherits from here.
* @author ldc
*
*/
>>>>>>> origin/ldc/astntrw
public class AstAssistantFactory implements IAstAssistantFactory
{

static
{
// FIXME: remove this when conversion to factory obtained assistants are completed.
init(new AstAssistantFactory());
}

/**
* Remove this when conversion is completed it just configures the static factory fields in the assistants
*/
public static void init(Object o)
{
for (Method m : o.getClass().getMethods())
{
if (m.getParameterTypes().length == 0 && m.getName().startsWith("create"))
{
try
{
m.invoke(o, new Object[] {});
} catch (Exception e)
{
e.printStackTrace();
}
}
}
}

@Override
public PAccessSpecifierAssistant createPAccessSpecifierAssistant()
{
return new PAccessSpecifierAssistant(this);
}

@Override
public PDefinitionAssistant createPDefinitionAssistant()
{
return new PDefinitionAssistant(this);
}

@Override
public PPatternAssistant createPPatternAssistant()
{
return new PPatternAssistant(this);
}

@Override
public ABracketTypeAssistant createABracketTypeAssistant()
{
return new ABracketTypeAssistant(this);
}

@Override
public ANamedInvariantTypeAssistant createANamedInvariantTypeAssistant()
{
return new ANamedInvariantTypeAssistant(this);
}

@Override
public AOptionalTypeAssistant createAOptionalTypeAssistant()
{
return new AOptionalTypeAssistant(this);
}

@Override
public AParameterTypeAssistant createAParameterTypeAssistant()
{
return new AParameterTypeAssistant(this);
}

@Override
public AUnionTypeAssistant createAUnionTypeAssistant()
{
return new AUnionTypeAssistant(this);
}

@Override
public AUnknownTypeAssistant createAUnknownTypeAssistant()
{
return new AUnknownTypeAssistant(this);
}

@Override
public PTypeAssistant createPTypeAssistant()
{
return new PTypeAssistant(this);
}

@Override
public SNumericBasicTypeAssistant createSNumericBasicTypeAssistant()
{
return new SNumericBasicTypeAssistant(this);
}

//visitors

@Override
public IAnswer<LexNameList> getAllVariableNameLocator()
{
return new AllVariableNameLocator(this);
}

@Override
public IAnswer<Boolean> getNumericFinder()
{
return new NumericFinder(this);
}

@Override
public IAnswer<SNumericBasicType> getNumericBasisChecker()
{
return new NumericBasisChecker(this);
}

@Override
public IAnswer<Integer> getHashChecker()
{
return new HashChecker(this);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
import org.overture.ast.lex.LexNameList;
import org.overture.ast.types.SNumericBasicType;

//TODO Add assistant Javadoc
/**
* This is the main Assistant factory interface. Everyone will see this
* so it should be well documented.
* @author ldc
*
*/
public interface IAstAssistantFactory
{
PAccessSpecifierAssistant createPAccessSpecifierAssistant();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static SNumericBasicType getNumeric(AUnionType type)

for (PType t : type.getTypes())
{
if (PTypeAssistant.isNumeric(t))
if (af.createPTypeAssistant().isNumeric(t))
{
SNumericBasicType nt = PTypeAssistant.getNumeric(t);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public PTypeAssistant(IAstAssistantFactory af)
this.af = af;
}

public static boolean isNumeric(PType type)
public boolean isNumeric(PType type)
{
try
{
Expand All @@ -38,10 +38,15 @@ public static SNumericBasicType getNumeric(PType type)
{
return null;
}


}

public int hashCode(PType type)
{
return internalHashCode(type);
}

public static int hashCode(PType type)
protected static int internalHashCode(PType type)
{
try
{
Expand All @@ -56,7 +61,9 @@ public static int hashCode(List<PType> list)
{
int hashCode = 1;
for (PType e : list)
hashCode = 31 * hashCode + (e == null ? 0 : hashCode(e));
{
hashCode = 31 * hashCode + (e == null ? 0 : internalHashCode(e));
}
return hashCode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ protected static void initClassDefinition(SClassDefinition result,
// others
result.setSettingHierarchy(ClassDefinitionSettings.UNSET);

//Reset parent set by member graph field
result.parent(null);
}

public static ASystemClassDefinition newASystemClassDefinition(
Expand Down Expand Up @@ -2096,6 +2098,10 @@ public static AModuleModules newAModuleModules(File file,
result.setImportdefs(new Vector<PDefinition>()); // and import nothing

result.setIsFlat(true);

//Reset parent set by member graph field
result.parent(null);

return result;
}

Expand Down Expand Up @@ -2133,6 +2139,9 @@ public static AModuleModules newAModuleModules(LexIdentifierToken name,
result.setExportdefs(new Vector<PDefinition>()); // By default, export nothing
result.setImportdefs(new Vector<PDefinition>()); // and import nothing

//Reset parent set by member graph field
result.parent(null);

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public GraphViz()
{
if (isWindowsPlatform())
{
dotPath = "c:/Program Files/Graphviz 2.28/bin/dot.exe";
dotPath = "\"c:/Program Files/Graphviz 2.28/bin/dot.exe\"".replace('/', '\\');
} else
{
dotPath = "/usr/bin/dot";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
*/
public class AllVariableNameLocator extends AnswerAdaptor<LexNameList>
{
/**
*
*/
private static final long serialVersionUID = 1L;
protected static IAstAssistantFactory af;

@SuppressWarnings("static-access")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.overture.ast.analysis.AnalysisException;
import org.overture.ast.analysis.AnswerAdaptor;
import org.overture.ast.assistant.IAstAssistantFactory;
import org.overture.ast.assistant.type.PTypeAssistant;
import org.overture.ast.node.INode;
import org.overture.ast.types.ABracketType;
import org.overture.ast.types.AClassType;
Expand Down Expand Up @@ -52,9 +53,7 @@ public Integer caseAClassType(AClassType type) throws AnalysisException
public Integer caseAFunctionType(AFunctionType type)
throws AnalysisException
{
AFunctionType ftype = type;
return af.createPTypeAssistant().hashCode(ftype.getParameters()) + af.createPTypeAssistant().hashCode(ftype.getResult());

return PTypeAssistant.hashCode(type.getParameters()) + af.createPTypeAssistant().hashCode(type.getResult());
}

@Override
Expand Down Expand Up @@ -92,7 +91,7 @@ public Integer caseAOperationType(AOperationType type)
throws AnalysisException
{
AOperationType otype = type;
return af.createPTypeAssistant().hashCode(otype.getParameters()) + af.createPTypeAssistant().hashCode(otype.getResult());
return PTypeAssistant.hashCode(otype.getParameters()) + af.createPTypeAssistant().hashCode(otype.getResult());

}

Expand All @@ -115,8 +114,7 @@ public Integer caseAParameterType(AParameterType type)
@Override
public Integer caseAProductType(AProductType type) throws AnalysisException
{

return af.createPTypeAssistant().hashCode(type.getTypes());
return PTypeAssistant.hashCode(type.getTypes());
}

@Override
Expand All @@ -142,8 +140,7 @@ public Integer caseASetType(ASetType type) throws AnalysisException
@Override
public Integer caseAUnionType(AUnionType type) throws AnalysisException
{
AUnionType utype = type;
return af.createPTypeAssistant().hashCode(utype.getTypes());
return PTypeAssistant.hashCode(type.getTypes());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public SNumericBasicType caseAUnionType(AUnionType type)

for (PType t : type.getTypes())
{
if (PTypeAssistant.isNumeric(t))
if (af.createPTypeAssistant().isNumeric(t))
{
SNumericBasicType nt = PTypeAssistant.getNumeric(t);

Expand Down
4 changes: 2 additions & 2 deletions core/ast/src/main/resources/overtureII.astv2.tostring
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.overture.ast.util.ToStringUtil;
%exp->exists = "(exists " + $Utils.listToString($[bindList]$)$+ " & " + [predicate] + ")"
%exp->exists1 = "(exists1 " + [bind] + " & " + [predicate] + ")"
%exp->field = "(" [object] "." + $($ [memberName] $ == null ? $[field]$.getName() : $[memberName]$.getFullName())$ + ")"
%exp->fieldNumber = "(" + [tuple] + "." + [field] + ")"
%exp->fieldNumber = "(" + [tuple] + ".#" + [field] + ")"
%exp->forAll = "(forall " + $Utils.listToString($ [bindList] $)$ + " & " [predicate] ")"
%exp->funcInstatiation = "(" [function] ")[" + $Utils.listToString($[actualTypes]$)$ + "]"
%exp->if = "" + $Utils.ifToString($[test]$, $[then]$, $[elseList]$, $[else]$)$
Expand Down Expand Up @@ -85,7 +85,7 @@ import org.overture.ast.util.ToStringUtil;
%exp->#Seq->seqComp = "[" [first] " | " [setBind] + $($[predicate]$ == null ? "]" : " & " + $[predicate]$ + "]")$
%exp->#Seq->seqEnum = "" + $Utils.listToString("[", $[members]$, ", ", "]")$

%exp->#Set->setComp = "{" [first] " | " [bindings] + $($[predicate]$ == null ? "}" : " & " + $[predicate]$ + "}")$
%exp->#Set->setComp = "{" [first] " | " + $Utils.listToString($[bindings]$) + ($[predicate]$ == null ? "}" : " & " + $[predicate]$ + "}")$
%exp->#Set->setEnum = "" + $Utils.listToString("{", $[members]$, ", ", "}")$
%exp->#Set->setRange = "{" [first] ", ... ," + [last] "}"

Expand Down
15 changes: 15 additions & 0 deletions core/codegen-runtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# VDM Code Generation Runtime
- **Primary Contacts:**
Peter Würtz Vinther Jørgensen
- **Status:**
Production

## Description:


## Known Issues:


## Contributors:


Loading

0 comments on commit 4b615e7

Please sign in to comment.