本文整理汇总了Java中com.fujitsu.vdmj.typechecker.TypeChecker类的典型用法代码示例。如果您正苦于以下问题:Java TypeChecker类的具体用法?Java TypeChecker怎么用?Java TypeChecker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeChecker类属于com.fujitsu.vdmj.typechecker包,在下文中一共展示了TypeChecker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefinitions
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
public TCDefinitionList getDefinitions(TCModuleList allModules)
{
TCDefinitionList defs = new TCDefinitionList();
for (TCImportFromModule ifm: imports)
{
if (ifm.name.equals(name))
{
TypeChecker.report(3195, "Cannot import from self", ifm.name.getLocation());
continue;
}
TCModule from = allModules.findModule(ifm.name);
if (from == null)
{
TypeChecker.report(3196, "No such module as " + ifm.name, ifm.name.getLocation());
}
else
{
defs.addAll(ifm.getDefinitions(from));
}
}
return defs;
}
示例2: checkOver
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
public void checkOver()
{
List<String> done = new Vector<String>();
TCDefinitionList singles = defs.singleDefinitions();
for (TCDefinition def1: singles)
{
for (TCDefinition def2: singles)
{
if (def1 != def2 &&
def1.name != null && def2.name != null &&
def1.name.getName().equals(def2.name.getName()) &&
!done.contains(def1.name.getName()))
{
if ((def1.isFunction() && !def2.isFunction()) ||
(def1.isOperation() && !def2.isOperation()))
{
def1.report(3017, "Duplicate definitions for " + def1.name.getName());
TypeChecker.detail2(def1.name.getName(), def1.location, def2.name.getName(), def2.location);
done.add(def1.name.getName());
}
}
}
}
}
示例3: typeCheck
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
@Override
public void typeCheck(Environment base, NameScope scope)
{
def = new TCMultiBindListDefinition(bind.location, bind.getMultipleBindList());
def.typeResolve(base);
def.typeCheck(base, scope);
Environment local = new FlatCheckedEnvironment(def, base, scope);
if (stexp != null &&
!stexp.typeCheck(local, null, scope, null).isType(TCBooleanType.class, location))
{
TypeChecker.report(3225,
"Such that clause is not boolean", stexp.location);
}
body.typeCheck(local, scope);
local.unusedCheck();
}
示例4: parseClasses
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
protected ASTClassList parseClasses(String vpppath, String charset)
{
Settings.release = Release.CLASSIC;
Settings.dialect = Dialect.VDM_PP;
ASTClassList classes = null;
int errs = 0;
TypeChecker.clearErrors();
LexTokenReader ltr = new LexTokenReader(new File(vpppath), Dialect.VDM_PP, charset);
ClassReader cr = new ClassReader(ltr);
classes = cr.readClasses();
cr.close();
errs = cr.getErrorCount();
cr.printErrors(Console.out);
cr.printWarnings(Console.out);
assertEquals("Syntax errors", 0, errs);
TypeChecker.printErrors(Console.out);
assertEquals("Type check errors", 0, TypeChecker.getErrorCount());
return classes;
}
示例5: process
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
private void process(String resource, String charset) throws Exception
{
Console.out.println("Processing " + resource + "...");
URL rurl = getClass().getResource("/charsets/" + resource);
String file = rurl.getPath();
long before = System.currentTimeMillis();
ASTClassList parsed = parseClasses(file, charset);
TCClassList classes = ClassMapper.getInstance(TCNode.MAPPINGS).init().convert(parsed);
long after = System.currentTimeMillis();
Console.out.println("Parsed " + classes.size() + " classes in " +
(double)(after-before)/1000 + " secs. ");
before = System.currentTimeMillis();
TypeChecker typeChecker = new ClassTypeChecker(classes);
typeChecker.typeCheck();
after = System.currentTimeMillis();
Console.out.println("Type checked in " + (double)(after-before)/1000 + " secs. ");
Console.out.println("There were " + TypeChecker.getWarningCount() + " warnings");
assertEquals("Type check errors", 0, TypeChecker.getErrorCount());
}
示例6: readSpecification
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
/**
* @see com.fujitsu.vdmjunit.SpecificationReader#readSpecification(Charset, java.util.List)
*/
@Override
protected Interpreter readSpecification(Charset charset, List<File> files) throws Exception
{
ASTModuleList parsedModules = new ASTModuleList();
for (File file: files)
{
LexTokenReader lexer = new LexTokenReader(file, Settings.dialect, charset.toString());
ModuleReader reader = new ModuleReader(lexer);
parsedModules.addAll(reader.readModules());
if (reader.getErrorCount() > 0)
{
printMessages(reader.getErrors());
fail("Syntax errors (see stdout)");
}
}
TCModuleList checkedModules = ClassMapper.getInstance(TCNode.MAPPINGS).init().convert(parsedModules);
TypeChecker checker = new ModuleTypeChecker(checkedModules);
checker.typeCheck();
if (ModuleTypeChecker.getErrorCount() > 0)
{
printMessages(ModuleTypeChecker.getErrors());
fail("Type errors (see stdout)");
}
INModuleList executableModules = ClassMapper.getInstance(INNode.MAPPINGS).init().convert(checkedModules);
return new ModuleInterpreter(executableModules, checkedModules);
}
示例7: typeCheck
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
/**
* Type check a TC expression tree passed.
*/
public TCType typeCheck(TCNode tree) throws Exception
{
TypeChecker.clearErrors();
TCType type = null;
if (tree instanceof TCExpression)
{
TCExpression exp = (TCExpression)tree;
type = exp.typeCheck(getGlobalEnvironment(), null, NameScope.NAMESANDSTATE, null);
}
else if (tree instanceof TCStatement)
{
TCStatement stmt = (TCStatement)tree;
type = stmt.typeCheck(getGlobalEnvironment(), NameScope.NAMESANDSTATE, null);
}
else
{
throw new Exception("Cannot type check " + tree.getClass().getSimpleName());
}
if (TypeChecker.getErrorCount() > 0)
{
throw new VDMErrorsException(TypeChecker.getErrors());
}
return type;
}
示例8: concern
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
/**
* This is used when a problem would be an error if the type it applies
* to is unambiguous, or a warning otherwise.
* @param serious True if this should be an error
* @param number The error number.
* @param msg The problem.
*/
public void concern(boolean serious, int number, String msg)
{
if (serious)
{
TypeChecker.report(number, msg, location);
}
else
{
TypeChecker.warning(number, msg, location);
}
}
示例9: detail
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
public void detail(boolean serious, String tag, Object obj)
{
if (serious)
{
TypeChecker.detail(tag, obj);
}
}
示例10: detail2
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
public void detail2(boolean serious, String tag1, Object obj1, String tag2, Object obj2)
{
if (serious)
{
TypeChecker.detail2(tag1, obj1, tag2, obj2);
}
}
示例11: concern
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
public void concern(boolean serious, int number, String msg)
{
if (serious)
{
TypeChecker.report(number, msg, getLocation());
}
else
{
TypeChecker.warning(number, msg, getLocation());
}
}
示例12: concern
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
public void concern(boolean serious, int number, String msg)
{
if (serious)
{
TypeChecker.report(number, msg, location);
}
else
{
TypeChecker.warning(number, msg, location);
}
}
示例13: detail2
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
public void detail2(
boolean serious, String tag1, Object obj1, String tag2, Object obj2)
{
if (serious)
{
TypeChecker.detail2(tag1, obj1, tag2, obj2);
}
}
示例14: typeCheck
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
@Override
public void typeCheck(Environment base, NameScope scope)
{
Environment local = base;
core.typeCheck(local, scope);
if (from > to)
{
TypeChecker.report(3277, "Trace repeat illegal values", location);
}
}
示例15: typecheck
import com.fujitsu.vdmj.typechecker.TypeChecker; //导入依赖的package包/类
protected void typecheck(String rpath)
{
setNames("/Overture/typecheck/", rpath);
List<VDMMessage> actual = new Vector<VDMMessage>();
ASTClassList parsed = parse(actual);
if (!actual.isEmpty())
{
Console.out.println(Utils.listToString(actual, "\n"));
assertEquals("Expecting no syntax errors", 0, actual.size());
}
try
{
TCClassList checked = ClassMapper.getInstance(TCNode.MAPPINGS).init().convert(parsed);
parsed = null; // Not needed now
TypeChecker typeChecker = new ClassTypeChecker(checked);
typeChecker.typeCheck();
TypeChecker.printErrors(Console.out);
TypeChecker.printWarnings(Console.out);
actual.addAll(TypeChecker.getErrors());
actual.addAll(TypeChecker.getWarnings());
checkErrors(actual);
}
catch (Exception e)
{
fail("Caught: " + e + " in " + assertName);
}
}