Changeset 66 in default for v2/trunk/de.ugoe.cs.swe.bnftools.ebnf
- Timestamp:
- 05/14/14 10:07:49 (10 years ago)
- Location:
- v2/trunk/de.ugoe.cs.swe.bnftools.ebnf
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf/src-gen/de/ugoe/cs/swe/bnftools/serializer/EbnfSyntacticSequencer.java
r65 r66 76 76 * Syntax: 77 77 * ( 78 '+' | 79 '[' | 80 ')' | 78 81 '{' | 79 ' +' |80 ' }' |82 ']' | 83 '|' | 81 84 '*' | 82 ')' |83 '|' |84 '[' |85 85 '(' | 86 ' ]'86 '}' 87 87 )* 88 88 */ -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf/src-gen/de/ugoe/cs/swe/bnftools/validation/AbstractEbnfValidator.java
r65 r66 9 9 import org.eclipse.xtext.validation.ComposedChecks; 10 10 11 @ComposedChecks(validators= {org.eclipse.xtext.validation.ImportUriValidator.class , org.eclipse.xtext.validation.NamesAreUniqueValidator.class})11 @ComposedChecks(validators= {org.eclipse.xtext.validation.ImportUriValidator.class}) 12 12 public class AbstractEbnfValidator extends org.eclipse.xtext.validation.AbstractDeclarativeValidator { 13 13 -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/GenerateEBNF.mwe2
r65 r66 74 74 fragment = validation.ValidatorFragment auto-inject { 75 75 composedCheck = "org.eclipse.xtext.validation.ImportUriValidator" 76 composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"76 // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" 77 77 } 78 78 … … 115 115 116 116 // provides the necessary bindings for java types integration 117 //fragment = types.TypesGeneratorFragment auto-inject {}117 //fragment = types.TypesGeneratorFragment auto-inject {} 118 118 119 119 // generates the required bindings only if the grammar inherits from Xbase -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/validation/EbnfAnalysisUtils.java
r61 r66 5 5 6 6 import org.eclipse.xtext.EcoreUtil2; 7 import org.eclipse.xtext.resource.IReferenceDescription; 8 import org.eclipse.xtext.resource.IResourceDescription; 9 import org.eclipse.xtext.resource.IResourceDescriptions; 10 7 11 import de.ugoe.cs.swe.bnftools.ebnf.Atom; 8 12 import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList; … … 83 87 return rules; 84 88 } 89 90 //---------------------------------------------------------------------------------------------------- 91 static public List<Rule> findReferences(Rule rule, IResourceDescriptions resourceDescriptions) { 92 List<Rule> ruleReferences = new ArrayList<Rule>(); 93 94 final String ruleURIF = rule.eResource().getURIFragment(rule); 95 96 for (IResourceDescription resourceDescription : resourceDescriptions 97 .getAllResourceDescriptions()) { 98 if (!resourceDescription.getURI().equals(rule.eResource().getURI())) 99 continue; 100 101 for (IReferenceDescription referenceDescription : resourceDescription 102 .getReferenceDescriptions()) { 103 if (ruleURIF.equals(referenceDescription.getTargetEObjectUri() 104 .fragment())) { 105 ruleReferences.add((Rule) rule.eResource().getEObject(referenceDescription.getTargetEObjectUri().fragment())); 106 } 107 108 } 109 } 110 return ruleReferences; 111 } 85 112 } -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/validation/EbnfValidator.xtend
r65 r66 15 15 import de.ugoe.cs.swe.bnftools.ebnf.SingleDefinition 16 16 import java.util.ArrayList 17 import com.google.inject.Inject 18 import org.eclipse.xtext.resource.IResourceDescriptions 17 19 18 20 //import java.util.HashMap … … 27 29 class EbnfValidator extends AbstractEbnfValidator { 28 30 31 32 @Inject 33 IResourceDescriptions resourceDescriptions; 34 35 29 36 public static final String ruleReferencedOneDescription = "The rule is only referenced by one other rule"; 30 37 public static final String passthroughRuleDescription = "The rule is a passthrough rule"; … … 48 55 return; 49 56 50 var List<Rule Reference> references = EbnfAnalysisUtils.findReferences(rule);51 52 if (references.size ()== 1 && rule.rulenumber != 1) {57 var List<Rule> references = EbnfAnalysisUtils.findReferences(rule,resourceDescriptions); 58 var List<RuleReference> references1 = EbnfAnalysisUtils.findReferences(rule); 59 if (references.size+references1.size == 1 && rule.rulenumber != 1) { 53 60 warning(ruleReferencedOneDescription, EbnfPackage$Literals::RULE__NAME, ruleReferencedOneDescription, 54 61 rule.name); … … 172 179 173 180 var List<RuleReference> references = EbnfAnalysisUtils.findReferences(rule); 174 175 if ((references.size ()== 0) && (rule.getRulenumber() != 1))181 var List<Rule> references1 = EbnfAnalysisUtils.findReferences(rule,resourceDescriptions); 182 if ((references.size+references1.size == 0) && (rule.getRulenumber() != 1)) 176 183 warning(unusedRuleDescription, EbnfPackage$Literals::RULE__NAME, unusedRuleDescription, rule.name); 177 184 } … … 214 221 215 222 var List<RuleReference> references = EbnfAnalysisUtils.findReferences(rule); 216 223 var List<Rule> references1 = EbnfAnalysisUtils.findReferences(rule,resourceDescriptions); 217 224 if (EbnfAnalysisUtils.isPassthroughRule(rule) && rule.rulenumber != 1) { 218 if (references.size ()== 0) {225 if (references.size+references1.size == 0) { 219 226 warning(unreferencedPassthroughRuleDescription, EbnfPackage$Literals::RULE__NAME); 220 227 } else {
Note: See TracChangeset
for help on using the changeset viewer.