use of org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser in project titan.EclipsePlug-ins by eclipse.
the class ASN1ReferenceParser method parseReference.
private Reference parseReference(final IFile file, final String input, final int line, final int offset) {
Reference reference = null;
StringReader reader = new StringReader(input);
CharStream charStream = new UnbufferedCharStream(reader);
Asn1Lexer lexer = new Asn1Lexer(charStream);
lexer.setTokenFactory(new TokenWithIndexAndSubTokensFactory(true));
ASN1Listener lexerListener = new ASN1Listener();
// remove ConsoleErrorListener
lexer.removeErrorListeners();
lexer.addErrorListener(lexerListener);
ModuleLevelTokenStreamTracker tracker = new ModuleLevelTokenStreamTracker(lexer);
tracker.discard(Asn1Lexer.WS);
tracker.discard(Asn1Lexer.MULTILINECOMMENT);
tracker.discard(Asn1Lexer.SINGLELINECOMMENT);
Asn1Parser parser = new Asn1Parser(tracker);
parser.setProject(file.getProject());
parser.setActualFile(file);
parser.setLine(line);
parser.setOffset(offset);
parser.setBuildParseTree(false);
ASN1Listener parserListener = new ASN1Listener();
// remove ConsoleErrorListener
parser.removeErrorListeners();
parser.addErrorListener(parserListener);
reference = parser.pr_parseReference().reference;
return reference;
}
use of org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser 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.designer.parsers.asn1parser.Asn1Parser 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.designer.parsers.asn1parser.Asn1Parser 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.designer.parsers.asn1parser.Asn1Parser 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;
}
Aggregations