mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
Merge branch 'sz/bug394436' into sz/xtext_grammar_enhancements
This commit is contained in:
commit
fb519c29fe
5 changed files with 93 additions and 8 deletions
|
@ -8,6 +8,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.util;
|
||||
|
||||
import static com.google.common.collect.Sets.*;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -24,6 +26,7 @@ import java.util.Set;
|
|||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
|
@ -215,6 +218,25 @@ public class MergeableManifest extends Manifest {
|
|||
getMainAttributes().put(REQUIRE_BUNDLE, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.9
|
||||
*/
|
||||
public String getBREE() {
|
||||
return (String) getMainAttributes().get(BUNDLE_REQUIRED_EXECUTION_ENV);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.9
|
||||
*/
|
||||
public void setBREE(String bree) {
|
||||
String oldValue = getBREE();
|
||||
if(Objects.equal(oldValue, bree)) {
|
||||
return;
|
||||
}
|
||||
getMainAttributes().put(BUNDLE_REQUIRED_EXECUTION_ENV, bree);
|
||||
this.modified = true;
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
return modified;
|
||||
}
|
||||
|
@ -259,6 +281,18 @@ public class MergeableManifest extends Manifest {
|
|||
this.modified = modified.get();
|
||||
getMainAttributes().put(EXPORT_PACKAGE, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* adds the qualified names to the export-package attribute, if not already
|
||||
* present.
|
||||
*
|
||||
* @param packages - packages to add
|
||||
*
|
||||
* @since 2.9
|
||||
*/
|
||||
public void addExportedPackages(String... packages) {
|
||||
addExportedPackages(newHashSet(packages));
|
||||
}
|
||||
|
||||
public void addImportedPackages(Set<String> packages) {
|
||||
String s = (String) getMainAttributes().get(IMPORT_PACKAGE);
|
||||
|
|
|
@ -84,7 +84,9 @@
|
|||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//Alternatives"/>
|
||||
<genClasses ecoreClass="Xtext.ecore#//UnorderedGroup"/>
|
||||
<genClasses ecoreClass="Xtext.ecore#//Group"/>
|
||||
<genClasses ecoreClass="Xtext.ecore#//Group">
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//Group/guardCondition"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//CharacterRange">
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//CharacterRange/left"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//CharacterRange/right"/>
|
||||
|
@ -96,14 +98,26 @@
|
|||
<genClasses ecoreClass="Xtext.ecore#//Parameter">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//Parameter/name"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//ConditionalBranch">
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Xtext.ecore#//ConditionalBranch/parameter"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//ConditionalBranch/filtered"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//NamedArgument">
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Xtext.ecore#//NamedArgument/parameter"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//NamedArgument/literalValue"/>
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Xtext.ecore#//NamedArgument/value"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//NamedArgument/calledByName"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//Condition"/>
|
||||
<genClasses ecoreClass="Xtext.ecore#//Conjunction"/>
|
||||
<genClasses ecoreClass="Xtext.ecore#//Negation">
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//Negation/value"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//Disjunction"/>
|
||||
<genClasses ecoreClass="Xtext.ecore#//CompositeCondition">
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//CompositeCondition/left"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Xtext.ecore#//CompositeCondition/right"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//ParameterReference">
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Xtext.ecore#//ParameterReference/parameter"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="Xtext.ecore#//LiteralCondition">
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//LiteralCondition/true"/>
|
||||
</genClasses>
|
||||
</genPackages>
|
||||
</genmodel:GenModel>
|
||||
|
|
|
@ -343,7 +343,7 @@ public abstract class AbstractTraceRegion {
|
|||
if (data.getSrcRelativePath() == null) {
|
||||
if (!allNull)
|
||||
throw new IllegalStateException(
|
||||
"If multiple associated locations are present, the path has to be set");
|
||||
"Iff multiple associated locations are present, the path has to be set");
|
||||
} else {
|
||||
allNull = false;
|
||||
path = data.getSrcRelativePath();
|
||||
|
|
|
@ -163,12 +163,23 @@ public class XtextLinker extends Linker {
|
|||
if (!argument.isCalledByName()) {
|
||||
RuleCall ruleCall = EcoreUtil2.getContainerOfType(argument, RuleCall.class);
|
||||
AbstractRule calledRule = ruleCall.getRule();
|
||||
if (calledRule instanceof ParserRule && !calledRule.eIsProxy()) {
|
||||
if (!(calledRule instanceof ParserRule)) {
|
||||
producer.addDiagnostic(new DiagnosticMessage("Arguments can only be used with parser rules.", Severity.ERROR, null));
|
||||
return;
|
||||
}
|
||||
if (!calledRule.eIsProxy()) {
|
||||
ParserRule casted = (ParserRule) calledRule;
|
||||
int idx = ruleCall.getArguments().indexOf(argument);
|
||||
if (idx < casted.getParameters().size()) {
|
||||
argument.setParameter(casted.getParameters().get(idx));
|
||||
return;
|
||||
} else if (casted.getParameters().size() == 0) {
|
||||
producer.addDiagnostic(new DiagnosticMessage(
|
||||
"Rule " + calledRule.getName() + " has no arguments.", Severity.ERROR, null));
|
||||
} else {
|
||||
String message = "Invalid number of arguments for rule " + calledRule.getName() + ", expecting "
|
||||
+ casted.getParameters().size() + " but was " + (idx+1);
|
||||
producer.addDiagnostic(new DiagnosticMessage(message, Severity.ERROR, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* 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
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext;
|
||||
|
||||
import org.eclipse.xtext.junit4.internal.AbstractPortableURIsTest;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author zarnekow - Initial contribution and API
|
||||
*/
|
||||
public class URIsInEcoreFilesTest extends AbstractPortableURIsTest {
|
||||
|
||||
@Test public void testXtext() {
|
||||
doTestResource("org.eclipse.xtext/org/eclipse/xtext/Xtext.ecore", "xtext");
|
||||
}
|
||||
|
||||
@Test public void testXtextGenmodel() {
|
||||
doTestResource("org.eclipse.xtext/org/eclipse/xtext/Xtext.genmodel", "xtext");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue