use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Enumerated_Type method parseBlockEnumeration.
private void parseBlockEnumeration() {
if (null == mBlock) {
return;
}
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
if (null == parser) {
return;
}
enumerations = parser.pr_special_Enumerations().enumeration;
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
isErroneous = true;
enumerations = null;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
if (enumerations != null) {
if (enumerations.enumItems1 != null) {
enumerations.enumItems1.setFullNameParent(this);
enumerations.enumItems1.setMyScope(getMyScope());
}
if (enumerations.enumItems2 != null) {
enumerations.enumItems2.setFullNameParent(this);
enumerations.enumItems2.setMyScope(getMyScope());
}
}
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class TableConstraint method parseBlocks.
private void parseBlocks() {
if (mObjectSetBlock == null) {
return;
}
objectSet = null;
atNotationList = null;
if (null != mObjectSetBlock) {
if (mAtNotationsBlock == null) {
// SimpleTableConstraint
Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mObjectSetBlock, 0);
if (parser != null) {
objectSet = parser.pr_special_ObjectSetSpec().definition;
List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
objectSet = null;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mObjectSetBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
}
} else {
// ComponentRelationConstraint
Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mObjectSetBlock, 0);
if (parser != null) {
objectSet = parser.pr_DefinedObjectSetBlock().objectSet;
List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
objectSet = null;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlySyntacticMarker((IFile) mObjectSetBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
}
parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mAtNotationsBlock, 0);
if (parser != null) {
atNotationList = parser.pr_AtNotationList().notationList;
List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
objectSet = null;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlySyntacticMarker((IFile) mAtNotationsBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
}
if (atNotationList == null) {
atNotationList = new AtNotations();
}
}
}
if (objectSet == null) {
objectSet = new ObjectSet_definition();
}
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class Parameterised_Reference method addAssignments.
/**
* Fill the assignments according to the formal parameters
* @param aAssPard (in) formal parameters for the conversion
* @param aCompilationTimeStamp compilation timestamp
*/
private void addAssignments(final Ass_pard aAssPard, final CompilationTimeStamp aCompilationTimeStamp) {
final List<FormalParameter_Helper> formalParameters = aAssPard.getFormalParameters(aCompilationTimeStamp);
final int nofFormalParameters = formalParameters.size();
if (null != mBlock) {
final List<List<Token>> actualParameters = new ArrayList<List<Token>>();
List<Token> temporalBuffer = new ArrayList<Token>();
// TODO: implement according to the C++ code:
// See AST_asn1.cc/void Ass_pard::preparse_pars()
// The java version handles only the list of references.
// The tokens containing assignments are not handled properly
/* splitting the list of actual parameters */
final List<Token> unprocessParameters = mBlock.getTokenList();
for (int i = 0; i < unprocessParameters.size(); i++) {
final Token tempToken = unprocessParameters.get(i);
if (tempToken.getType() == Asn1Lexer.COMMA) {
temporalBuffer.add(new TokenWithIndexAndSubTokens(Token.EOF));
actualParameters.add(temporalBuffer);
temporalBuffer = new ArrayList<Token>();
} else {
temporalBuffer.add(tempToken);
}
}
if (!temporalBuffer.isEmpty()) {
temporalBuffer.add(new TokenWithIndexAndSubTokens(Token.EOF));
actualParameters.add(temporalBuffer);
}
/* checking the number of parameters */
final int nofActualParameters = actualParameters.size();
if (nofActualParameters != nofFormalParameters) {
location.reportSemanticError(MessageFormat.format(DIFFERENTPARAMETERNUMBERS, (nofActualParameters < nofFormalParameters) ? "few" : "many", nofFormalParameters, nofActualParameters));
}
assignments = new ASN1Assignments();
for (int i = 0; i < nofFormalParameters; i++) {
final Identifier tempIdentifier = formalParameters.get(i).identifier;
ASN1Assignment temporalAssignment = null;
if (i < nofActualParameters) {
final List<Token> temporalTokenBuffer = new ArrayList<Token>();
temporalTokenBuffer.add(formalParameters.get(i).formalParameterToken);
final Token temporalToken = formalParameters.get(i).governorToken;
if (null != temporalToken) {
temporalTokenBuffer.add(temporalToken);
}
temporalTokenBuffer.add(new TokenWithIndexAndSubTokens(Asn1Lexer.ASSIGNMENT));
temporalTokenBuffer.addAll(actualParameters.get(i));
// parse temp_tokenBuffer as an assignment
// List<ANTLRException> exceptions = null;
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(new Block(temporalTokenBuffer, location));
if (null != parser) {
temporalAssignment = parser.pr_special_Assignment().assignment;
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
isErroneous = true;
temporalAssignment = null;
for (int j = 0; j < errors.size(); j++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(j), IMarker.SEVERITY_ERROR);
}
}
}
}
if (null == temporalAssignment) {
temporalAssignment = new Type_Assignment(tempIdentifier, null, null);
}
temporalAssignment.setLocation(location);
assignments.addAssignment(temporalAssignment);
}
for (List<Token> temporalActualParamater : actualParameters) {
temporalActualParamater.clear();
}
actualParameters.clear();
}
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class ObjectSet_definition method parseBlockObjectSetSpecifications.
private void parseBlockObjectSetSpecifications() {
if (mBlock == null) {
return;
}
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
if (parser == null) {
return;
}
final ObjectSet_definition temporalDefinition = parser.pr_special_ObjectSetSpec().definition;
// internalIndex += parser.nof_consumed_tokens();
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
if (null == temporalDefinition) {
isErroneous = true;
return;
}
temporalDefinition.getObjectSetElements();
for (int i = 0; i < temporalDefinition.getObjectSetElements().size(); i++) {
addObjectSetElement(temporalDefinition.getObjectSetElements().get(i));
}
temporalDefinition.setObjectSetElements(null);
setMyScope(getMyScope());
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class Ass_pard method check.
/**
* Pre-process the block of formal parameters into a list. This list
* together with actual parameters can be used to identify the
* assignments correctly.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
*/
public void check(final CompilationTimeStamp timestamp) {
if (null != lastTimeChecked && (!isErroneous || !lastTimeChecked.isLess(timestamp))) {
return;
}
lastTimeChecked = timestamp;
isErroneous = false;
if (null == mParameterList) {
isErroneous = true;
return;
}
if (null != mParameters) {
return;
}
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mParameterList);
mParameters = parser.pr_special_FormalParameterList().parameters;
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
mParameters = null;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mParameterList.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
if (null == mParameters) {
isErroneous = true;
} else {
mParameters.trimToSize();
}
}
Aggregations