use of org.eclipse.xtext.serializer.ISerializationContext in project xtext-core by eclipse.
the class SerializationContext method equals.
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof ISerializationContext))
return false;
if (obj == this)
return true;
ISerializationContext other = (ISerializationContext) obj;
boolean eq1 = equalsInternal(other);
// System.out.println("Foo");
return eq1;
}
use of org.eclipse.xtext.serializer.ISerializationContext in project xtext-core by eclipse.
the class SequencerDiagnosticProvider method createBacktrackingFailedDiagnostic.
@Override
@Deprecated
public ISerializationDiagnostic createBacktrackingFailedDiagnostic(SerializableObject semanticObject, EObject context, Nfa<ISemState> nfa) {
ISerializationContext ctx = SerializationContext.fromEObject(context, semanticObject.getEObject());
SerializationContextMap<IConstraint> constraints = grammarConstraints.getConstraints(grammarAccess.getGrammar());
return createBacktrackingFailedDiagnostic(semanticObject, ctx, constraints.get(ctx));
}
use of org.eclipse.xtext.serializer.ISerializationContext in project xtext-core by eclipse.
the class Serializer method serialize.
protected void serialize(EObject obj, ITokenStream tokenStream, SaveOptions options) throws IOException {
ISerializationDiagnostic.Acceptor errors = ISerializationDiagnostic.EXCEPTION_THROWING_ACCEPTOR;
ITokenStream formatterTokenStream;
if (formatter instanceof IFormatterExtension)
formatterTokenStream = ((IFormatterExtension) formatter).createFormatterStream(obj, null, tokenStream, !options.isFormatting());
else
formatterTokenStream = formatter.createFormatterStream(null, tokenStream, !options.isFormatting());
ISerializationContext context = getIContext(obj);
ISequenceAcceptor acceptor = new TokenStreamSequenceAdapter(formatterTokenStream, grammar.getGrammar(), errors);
serialize(context, obj, acceptor, errors);
formatterTokenStream.flush();
}
use of org.eclipse.xtext.serializer.ISerializationContext in project xtext-core by eclipse.
the class AbstractSyntacticSequencer method enterAssignedAction.
@Override
public boolean enterAssignedAction(Action action, EObject semanticChild, ICompositeNode node) {
navigateToAbsorber(action, node);
boolean shouldEnter = delegate.enterAssignedAction(action, semanticChild, node);
if (shouldEnter) {
ISerializationContext child = SerializationContext.forChild(contexts.peek().context, action, semanticChild);
ISynAbsorberState pda = syntacticSequencerPDAs.get(child);
if (pda == null)
throw new IllegalStateException();
SyntacticalContext j = new SyntacticalContext(child, semanticChild, pda, node);
contexts.push(j);
}
return shouldEnter;
}
use of org.eclipse.xtext.serializer.ISerializationContext in project xtext-core by eclipse.
the class AbstractSyntacticSequencer method enterAssignedParserRuleCall.
@Override
public boolean enterAssignedParserRuleCall(RuleCall rc, EObject semanticChild, ICompositeNode node) {
navigateToAbsorber(rc, node);
boolean shouldEnter = delegate.enterAssignedParserRuleCall(rc, semanticChild, node);
if (shouldEnter) {
ISerializationContext child = SerializationContext.forChild(contexts.peek().context, rc, semanticChild);
ISynAbsorberState pda = syntacticSequencerPDAs.get(child);
if (pda == null)
throw new IllegalStateException();
SyntacticalContext j = new SyntacticalContext(child, semanticChild, pda, node);
contexts.push(j);
}
return shouldEnter;
}
Aggregations