Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes HiddenTokenSequencer configurable (save/restore). Adds test.
The HiddenTokenSequencer now asks an advisor if hidden state should be saved/restored to work around a sequencing problem. Test added to show that sequencing gets start/end wrong.
- Loading branch information
Showing
4 changed files
with
157 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...p.dsl.tests/src/org/cloudsmith/geppetto/pp/dsl/tests/utils/DebugHiddenTokenSequencer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/** | |||
* Copyright (c) 2012 Cloudsmith Inc. and other contributors, as listed below. | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* Contributors: | |||
* Cloudsmith | |||
* | |||
*/ | |||
package org.cloudsmith.geppetto.pp.dsl.tests.utils; | |||
|
|||
import org.eclipse.emf.ecore.EObject; | |||
import org.eclipse.xtext.junit.serializer.DebugSequenceAcceptor; | |||
import org.eclipse.xtext.serializer.acceptor.ISequenceAcceptor; | |||
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor; | |||
import org.eclipse.xtext.serializer.sequencer.IHiddenTokenSequencer; | |||
|
|||
/** | |||
* A DebugSequenceAcceptor that implements IHiddenTokenSequencer. | |||
* | |||
*/ | |||
public class DebugHiddenTokenSequencer extends DebugSequenceAcceptor implements IHiddenTokenSequencer { | |||
|
|||
@Override | |||
public void init(EObject context, EObject semanticObject, ISequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) { | |||
add("HIDDEN INIT", "", "", -1, NO_NODE); | |||
|
|||
} | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...tto.pp.dsl/src/org/cloudsmith/xtext/serializer/acceptor/IHiddenTokenSequencerAdvisor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
/** | |||
* Copyright (c) 2011 Cloudsmith Inc. and other contributors, as listed below. | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* Contributors: | |||
* Cloudsmith | |||
* | |||
*/ | |||
package org.cloudsmith.xtext.serializer.acceptor; | |||
|
|||
import com.google.inject.ImplementedBy; | |||
|
|||
/** | |||
* Helps with advice to the HiddenTokenSequencer | |||
* | |||
*/ | |||
@ImplementedBy(org.cloudsmith.xtext.serializer.acceptor.IHiddenTokenSequencerAdvisor.Default.class) | |||
public interface IHiddenTokenSequencerAdvisor { | |||
|
|||
public static class Default implements IHiddenTokenSequencerAdvisor { | |||
|
|||
@Override | |||
public boolean shouldSaveRestoreState() { | |||
return true; | |||
} | |||
|
|||
} | |||
|
|||
public boolean shouldSaveRestoreState(); | |||
} |