use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Integer_Type method parseBlockInt.
private void parseBlockInt() {
if (null == mBlock) {
return;
}
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
if (null == parser) {
return;
}
namedNumbers = parser.pr_special_NamedNumberList().namedValues;
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
isErroneous = true;
namedNumbers = null;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
if (namedNumbers != null) {
namedNumbers.setFullNameParent(this);
namedNumbers.setMyScope(getMyScope());
}
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class ASN1_Sequence_Type method parseBlockSequence.
/**
* Parses the block as if it were the block of a sequence.
*/
public void parseBlockSequence() {
if (null == mBlock) {
return;
}
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
if (null == parser) {
return;
}
components = parser.pr_special_ComponentTypeLists().list;
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
// isErroneous = true;
components = null;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
}
if (components == null) {
isErroneous = true;
return;
}
components.setFullNameParent(this);
components.setMyScope(getMyScope());
components.setMyType(this);
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class Undefined_Block_Value method parseBlockRelativeObjectIdentifierValue.
private RelativeObjectIdentifier_Value parseBlockRelativeObjectIdentifierValue() {
if (null == mBlock) {
return null;
}
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
if (null == parser) {
return null;
}
final RelativeObjectIdentifier_Value value = parser.pr_special_RelativeObjectIdentifierValue().value;
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
isErroneous = true;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
return null;
}
return value;
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class Undefined_Block_Value method parseBlockSetofValue.
private SetOf_Value parseBlockSetofValue() {
if (null == mBlock) {
return null;
}
final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
if (null == parser) {
return null;
}
final SetOf_Value value = parser.pr_special_SetOfValue().value;
final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
if (null != errors && !errors.isEmpty()) {
isErroneous = true;
for (int i = 0; i < errors.size(); i++) {
ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
}
return null;
}
return value;
}
use of org.eclipse.titan.common.parsers.SyntacticErrorStorage in project titan.EclipsePlug-ins by eclipse.
the class SpecialASN1Module method parseSpecialInternalAssignment.
/**
* Parses the special internal assignments to build their semantic
* representation.
*
* @param inputCode
* the code to parse.
* @param identifier
* the identifier for the assignment to be created.
*
* @return the parsed assignment.
*/
public static ASN1Assignment parseSpecialInternalAssignment(final String inputCode, final Identifier identifier) {
ASN1Assignment assignment = null;
final StringReader reader = new StringReader(inputCode);
final CharStream charStream = new UnbufferedCharStream(reader);
final Asn1Lexer lexer = new Asn1Lexer(charStream);
lexer.setTokenFactory(new TokenWithIndexAndSubTokensFactory(true));
final ASN1Listener lexerListener = new ASN1Listener();
// remove ConsoleErrorListener
lexer.removeErrorListeners();
lexer.addErrorListener(lexerListener);
final ModuleLevelTokenStreamTracker tracker = new ModuleLevelTokenStreamTracker(lexer);
tracker.discard(Asn1Lexer.WS);
tracker.discard(Asn1Lexer.MULTILINECOMMENT);
tracker.discard(Asn1Lexer.SINGLELINECOMMENT);
final Asn1Parser parser = new Asn1Parser(tracker);
parser.setBuildParseTree(false);
final ASN1Listener parserListener = new ASN1Listener(parser);
// remove ConsoleErrorListener
parser.removeErrorListeners();
parser.addErrorListener(parserListener);
assignment = parser.pr_TITAN_special_Assignment(identifier).assignment;
if (!parser.getErrorStorage().isEmpty()) {
ErrorReporter.INTERNAL_ERROR(PARSINGFAILED);
for (SyntacticErrorStorage temp : parser.getErrorStorage()) {
ErrorReporter.logError(temp.message);
}
}
return assignment;
}
Aggregations