当前位置: 首页>>代码示例>>Java>>正文


Java ASTDefinition类代码示例

本文整理汇总了Java中com.fujitsu.vdmj.ast.definitions.ASTDefinition的典型用法代码示例。如果您正苦于以下问题:Java ASTDefinition类的具体用法?Java ASTDefinition怎么用?Java ASTDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ASTDefinition类属于com.fujitsu.vdmj.ast.definitions包,在下文中一共展示了ASTDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readTraces

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinitionList readTraces() throws LexException, ParserException
{
	checkFor(Token.TRACES, 2013, "Expected 'traces'");
	ASTDefinitionList list = new ASTDefinitionList();

	while (!newSection())
	{
		try
		{
			ASTDefinition def = readNamedTraceDefinition();
			list.add(def);

			if (!newSection())
			{
				ignore(Token.SEMICOLON);	// Optional?
			}
		}
		catch (LocatedException e)
		{
			report(e, afterArray, sectionArray);
		}
	}

	return list;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:26,代码来源:DefinitionReader.java

示例2: readSyncs

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinitionList readSyncs() throws LexException, ParserException
{
	checkFor(Token.SYNC, 2013, "Expected 'sync'");
	ASTDefinitionList list = new ASTDefinitionList();

	while (!newSection())
	{
		try
		{
			ASTDefinition def = readPermissionPredicateDefinition();
			list.add(def);

			if (!newSection())
			{
				checkFor(Token.SEMICOLON,
					2086, "Missing ';' after sync definition");
			}
		}
		catch (LocatedException e)
		{
			report(e, afterArray, sectionArray);
		}
	}

	return list;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:27,代码来源:DefinitionReader.java

示例3: readValueDefinition

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
public ASTDefinition readValueDefinition() throws ParserException, LexException
{
      	// Should be <pattern>[:<type>]=<expression>

   	ASTPattern p = getPatternReader().readPattern();
   	ASTType type = null;

   	if (lastToken().is(Token.COLON))
   	{
   		nextToken();
   		type = getTypeReader().readType();
   	}

		checkFor(Token.EQUALS, 2096, "Expecting <pattern>[:<type>]=<exp>");
	return new ASTValueDefinition(
		p, type, getExpressionReader().readExpression());
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:18,代码来源:DefinitionReader.java

示例4: readOperationDefinition

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinition readOperationDefinition()
	throws ParserException, LexException
{
	ASTDefinition def = null;
	LexIdentifierToken funcName = readIdToken("Expecting new operation identifier");

	if (lastToken().is(Token.COLON))
	{
		def = readExplicitOperationDefinition(funcName);
	}
	else if (lastToken().is(Token.BRA))
	{
		def = readImplicitOperationDefinition(funcName);
	}
	else if (lastToken().is(Token.SEQ_OPEN))
	{
		throwMessage(2059, "Operations cannot have [@T] type parameters");
	}
	else
	{
		throwMessage(2021, "Expecting ':' or '(' after name in operation definition");
	}

	LexLocation.addSpan(idToName(funcName), lastToken());
	return def;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:27,代码来源:DefinitionReader.java

示例5: readInstanceVariableDefinition

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinition readInstanceVariableDefinition()
throws ParserException, LexException
  {
LexToken token = lastToken();

if (token.is(Token.INV))
{
	nextToken();
	ASTExpression exp = getExpressionReader().readExpression();
	String str = getCurrentModule();
	LexNameToken className = new LexNameToken(str, str, token.location);
	return new ASTClassInvariantDefinition(
		className.getInvName(token.location), exp);
}
else
{
	ASTAccessSpecifier access = readAccessSpecifier(false, false);
	ASTAssignmentDefinition def = getStatementReader().readAssignmentDefinition();
	ASTInstanceVariableDefinition ivd =
		new ASTInstanceVariableDefinition(def.name, def.type, def.expression);
	ivd.setAccessSpecifier(access);
	return ivd;
}
  }
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:25,代码来源:DefinitionReader.java

示例6: toString

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
@Override
public String toString()
{
	StringBuilder sb = new StringBuilder();
	sb.append("(\n");

	for (ASTDefinition d: assignmentDefs)
	{
		sb.append(d);
		sb.append("\n");
	}

	sb.append("\n");
	sb.append(super.toString());
	sb.append(")");
	return sb.toString();
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:18,代码来源:ASTBlockStatement.java

示例7: toString

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
@Override
public String toString()
{
	StringBuilder result = new StringBuilder("let ");

	for (ASTDefinition d: localDefs)
	{
		result.append(d.toString());
		result.append(" ");
	}

	result.append("in ");
	result.append(body);

	return result.toString();
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:17,代码来源:ASTTraceLetDefBinding.java

示例8: readValues

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinitionList readValues() throws LexException, ParserException
{
	checkFor(Token.VALUES, 2013, "Expected 'values'");
	ASTDefinitionList list = new ASTDefinitionList();

	while (!newSection())
	{
		try
		{
			ASTAccessSpecifier access = readAccessSpecifier(false, false);
			ASTDefinition def = readValueDefinition();

			// Force all values to be static
			def.setAccessSpecifier(access.getStatic(true));
			list.add(def);

			if (!newSection())
			{
				checkFor(Token.SEMICOLON,
					2081, "Missing ';' after value definition");
			}
		}
		catch (LocatedException e)
		{
			report(e, afterArray, sectionArray);
		}
	}

	return list;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:31,代码来源:DefinitionReader.java

示例9: readFunctions

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinitionList readFunctions() throws LexException, ParserException
{
	checkFor(Token.FUNCTIONS, 2013, "Expected 'functions'");
	ASTDefinitionList list = new ASTDefinitionList();

	while (!newSection())
	{
		try
		{
			ASTAccessSpecifier access = readAccessSpecifier(false, false);
			ASTDefinition def = readFunctionDefinition();

			if (Settings.release == Release.VDM_10)
			{
				// Force all functions to be static for VDM-10
				def.setAccessSpecifier(access.getStatic(true));
			}
			else
			{
				def.setAccessSpecifier(access);
			}

			list.add(def);

			if (!newSection())
			{
				checkFor(Token.SEMICOLON,
					2079, "Missing ';' after function definition");
			}
		}
		catch (LocatedException e)
		{
			report(e, afterArray, sectionArray);
		}
	}

	return list;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:39,代码来源:DefinitionReader.java

示例10: readOperations

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
public ASTDefinitionList readOperations() throws LexException, ParserException
{
	checkFor(Token.OPERATIONS, 2013, "Expected 'operations'");
	ASTDefinitionList list = new ASTDefinitionList();

	while (!newSection())
	{
		try
		{
			ASTAccessSpecifier access = readAccessSpecifier(dialect == Dialect.VDM_RT, true);
			ASTDefinition def = readOperationDefinition();
			def.setAccessSpecifier(access);
			list.add(def);

			if (!newSection())
			{
				checkFor(Token.SEMICOLON,
					2082, "Missing ';' after operation definition");
			}
		}
		catch (LocatedException e)
		{
			report(e, afterArray, sectionArray);
		}
	}

	return list;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:29,代码来源:DefinitionReader.java

示例11: readInstanceVariables

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
public ASTDefinitionList readInstanceVariables() throws LexException, ParserException
{
	checkFor(Token.INSTANCE, 2083, "Expected 'instance variables'");
	checkFor(Token.VARIABLES, 2083, "Expecting 'instance variables'");
	ASTDefinitionList list = new ASTDefinitionList();

	while (!newSection())
	{
		try
		{
			ASTDefinition def = readInstanceVariableDefinition();
			list.add(def);

			if (!newSection())
			{
				checkFor(Token.SEMICOLON,
					2084, "Missing ';' after instance variable definition");
			}
		}
		catch (LocatedException e)
		{
			report(e, afterArray, sectionArray);
		}
	}

	return list;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:28,代码来源:DefinitionReader.java

示例12: readFunctionDefinition

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinition readFunctionDefinition() throws ParserException, LexException
{
	ASTDefinition def = null;
	LexIdentifierToken funcName = readIdToken("Expecting new function identifier");

	if (funcName.name.startsWith("mk_"))
	{
		throwMessage(2016, "Function name cannot start with 'mk_'");
	}

	LexNameList typeParams = readTypeParams();

	if (lastToken().is(Token.COLON))
	{
		def = readExplicitFunctionDefinition(funcName, typeParams);
	}
	else if (lastToken().is(Token.BRA))
	{
		def = readImplicitFunctionDefinition(funcName, typeParams);
	}
	else
	{
		throwMessage(2017, "Expecting ':' or '(' after name in function definition");
	}

	LexLocation.addSpan(idToName(funcName), lastToken());
	return def;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:29,代码来源:DefinitionReader.java

示例13: readStateDefinition

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinition readStateDefinition() throws ParserException, LexException
{
	LexIdentifierToken name = readIdToken("Expecting identifier after 'state' definition");
	checkFor(Token.OF, 2097, "Expecting 'of' after state name");
	ASTFieldList fieldList = getTypeReader().readFieldList();

	ASTExpression invExpression = null;
	ASTExpression initExpression = null;
	ASTPattern invPattern = null;
	ASTPattern initPattern = null;

	if (lastToken().is(Token.INV))
	{
		nextToken();
		invPattern = getPatternReader().readPattern();
		checkFor(Token.EQUALSEQUALS, 2098, "Expecting '==' after pattern in invariant");
		invExpression = getExpressionReader().readExpression();
	}

	if (lastToken().is(Token.INIT))
	{
		nextToken();
		initPattern = getPatternReader().readPattern();
		checkFor(Token.EQUALSEQUALS, 2099, "Expecting '==' after pattern in initializer");
		initExpression = getExpressionReader().readExpression();
	}

	// Be forgiving about the inv/init order
	if (lastToken().is(Token.INV) && invExpression == null)
	{
		nextToken();
		invPattern = getPatternReader().readPattern();
		checkFor(Token.EQUALSEQUALS, 2098, "Expecting '==' after pattern in invariant");
		invExpression = getExpressionReader().readExpression();
	}

	checkFor(Token.END, 2100, "Expecting 'end' after state definition");
	return new ASTStateDefinition(idToName(name), fieldList,
		invPattern, invExpression, initPattern, initExpression);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:41,代码来源:DefinitionReader.java

示例14: readNamedTraceDefinition

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTDefinition readNamedTraceDefinition()
	throws ParserException, LexException
{
	LexLocation start = lastToken().location;
	List<String> names = readTraceIdentifierList();
	checkFor(Token.COLON, 2264, "Expecting ':' after trace name(s)");
	ASTTraceDefinitionTermList traces = readTraceDefinitionList();

	return new ASTNamedTraceDefinition(start, names, traces);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:11,代码来源:DefinitionReader.java

示例15: readLetDefBinding

import com.fujitsu.vdmj.ast.definitions.ASTDefinition; //导入依赖的package包/类
private ASTTraceDefinition readLetDefBinding()
	throws ParserException, LexException
{
	ASTDefinitionList localDefs = new ASTDefinitionList();
	LexToken start = lastToken();

	ASTDefinition def = readLocalDefinition();

	if (!(def instanceof ASTValueDefinition))
	{
		throwMessage(2270, "Only value definitions allowed in traces");
	}

	localDefs.add((ASTValueDefinition)def);

	while (ignore(Token.COMMA))
	{
		def = readLocalDefinition();

		if (!(def instanceof ASTValueDefinition))
		{
			throwMessage(2270, "Only value definitions allowed in traces");
		}

		localDefs.add((ASTValueDefinition)def);
	}

	checkFor(Token.IN, 2231, "Expecting 'in' after local definitions");
	ASTTraceDefinition body = readTraceDefinition();

	return new ASTTraceLetDefBinding(start.location, localDefs, body);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:33,代码来源:DefinitionReader.java


注:本文中的com.fujitsu.vdmj.ast.definitions.ASTDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。