mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
applied patch from bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=248463
This commit is contained in:
parent
5918db7759
commit
a342c45ff0
6 changed files with 26 additions and 22 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src-gen"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
log4j.rootLogger=debug, default
|
||||
|
||||
log4j.appender.default=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.default.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.default.layout.ConversionPattern=%-4r [%t] %-5p %35.35c %x - %m%n
|
||||
|
||||
log4j.logger.org.eclipse=INFO
|
|
@ -9,12 +9,12 @@
|
|||
package org.eclipse.xtext.parsetree.reconstr;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.xtext.ParserRule;
|
||||
import org.eclipse.xtext.parsetree.reconstr.callbacks.WhitespacePreservingCallback;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.tests.AbstractGeneratorTest;
|
||||
import org.eclipse.xtext.tests.EcoreModelComparator;
|
||||
|
@ -40,7 +40,6 @@ public class ComplexReconstrTest extends AbstractGeneratorTest {
|
|||
System.out.println(EmfFormater.objToStr(pr, ""));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
|
@ -58,9 +57,7 @@ public class ComplexReconstrTest extends AbstractGeneratorTest {
|
|||
System.out.println(EmfFormater.objToStr(result, ""));
|
||||
IParseTreeConstructor con = getParseTreeConstructor();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
WhitespacePreservingCallback callback = new WhitespacePreservingCallback(out,
|
||||
getValueConverterService());
|
||||
con.update(result, callback);
|
||||
con.serialize(out, result, Collections.emptyMap());
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,20 +28,20 @@ StrangeStuff :
|
|||
*/
|
||||
|
||||
|
||||
TrickyA returns TypeA1: TrickyA1 (name += ID)* ({TypeB.x=current} 'x' | {TypeC.x=current} 'y')? name+=STRING;
|
||||
TrickyA returns TypeA1: 'TA' TrickyA1 (name += ID)* ({TypeB.x=current} 'x' | {TypeC.x=current} 'y')? name+=STRING;
|
||||
TrickyA1 returns TypeD: name+=ID;
|
||||
|
||||
TrickyB : (name = ID type += INT)? (type += ID)*;
|
||||
TrickyB : 'TB' (name = ID type += INT)? (type += ID)*;
|
||||
|
||||
TrickyC : name = ID ({C1.x=current} 'x')? ({C2.y=current} 'y')? ({C3.z=current} 'z')?;
|
||||
TrickyC : 'TC' name = ID ({C1.x=current} 'x')? ({C2.y=current} 'y')? ({C3.z=current} 'z')?;
|
||||
|
||||
TrickyD: (name += INT foo = STRING type += ID)? (name += INT type += ID)? (type += ID)*;
|
||||
TrickyD: 'TD' (name += INT foo = STRING type += ID)? (name += INT type += ID)? (type += ID)*;
|
||||
|
||||
// 34 "abc" XX 123 "de" YY x 34 DD 45 CC
|
||||
TrickyE: (name+=INT foo+=STRING type+=ID)* 'x' (name+=INT type+=ID)*;
|
||||
TrickyE: 'TE' (name+=INT foo+=STRING type+=ID)* 'x' (name+=INT type+=ID)*;
|
||||
|
||||
//
|
||||
TrickyF: (name+=ID type+=INT)* (name+=ID | type+=INT);
|
||||
TrickyF: 'TF' (name+=ID type+=INT)* (name+=ID | type+=INT);
|
||||
|
||||
|
||||
// TrickyG: TrickyG1 | TrickyG2;
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
package org.eclipse.xtext.parsetree.reconstr;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.parsetree.reconstr.callbacks.WhitespacePreservingCallback;
|
||||
import org.eclipse.xtext.testlanguages.SimpleExpressionsStandaloneSetup;
|
||||
import org.eclipse.xtext.tests.AbstractGeneratorTest;
|
||||
import org.eclipse.xtext.util.EmfFormater;
|
||||
|
@ -49,9 +49,7 @@ public class SimpleReconstrTest extends AbstractGeneratorTest {
|
|||
|
||||
IParseTreeConstructor con = getParseTreeConstructor();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
WhitespacePreservingCallback callback = new WhitespacePreservingCallback(out,
|
||||
getValueConverterService());
|
||||
con.update(result, callback);
|
||||
con.serialize(out, result, Collections.emptyMap());
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package org.eclipse.xtext.parsetree.reconstr;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.parser.IAstFactory;
|
||||
import org.eclipse.xtext.parsetree.reconstr.callbacks.WhitespacePreservingCallback;
|
||||
import org.eclipse.xtext.tests.AbstractGeneratorTest;
|
||||
|
||||
public class WhitespacePreservingCallbackTest extends AbstractGeneratorTest {
|
||||
|
@ -65,10 +64,14 @@ public class WhitespacePreservingCallbackTest extends AbstractGeneratorTest {
|
|||
}
|
||||
|
||||
private String serialize(EObject result) {
|
||||
// IParseTreeConstructor con = getParseTreeConstructor();
|
||||
// ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// WhitespacePreservingCallback cb = new WhitespacePreservingCallback(out,getValueConverterService());
|
||||
// con.update(result, cb);
|
||||
// return out.toString();
|
||||
IParseTreeConstructor con = getParseTreeConstructor();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
WhitespacePreservingCallback cb = new WhitespacePreservingCallback(out,getValueConverterService());
|
||||
con.update(result, cb);
|
||||
con.serialize(out, result, Collections.emptyMap());
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
|
@ -76,8 +79,7 @@ public class WhitespacePreservingCallbackTest extends AbstractGeneratorTest {
|
|||
try {
|
||||
IParseTreeConstructor con = getParseTreeConstructor();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
WhitespacePreservingCallback cb = new WhitespacePreservingCallback(out,getValueConverterService());
|
||||
con.update(o, cb);
|
||||
con.serialize(out, o, Collections.emptyMap());
|
||||
fail("Should fail with "+clazz.getSimpleName());
|
||||
} catch (RuntimeException e) {
|
||||
if (!clazz.isInstance(e)) {
|
||||
|
|
Loading…
Reference in a new issue