Changeset 18 in default for trunk/de.ugoe.cs.swe.bnftools.ebnf/src
- Timestamp:
- 10/26/10 11:53:37 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/validation/EbnfJavaValidator.java ΒΆ
r17 r18 351 351 //TODO: currently compares complete rules and not subrules 352 352 353 CompositeNode node = NodeUtil.getNodeAdapter(rule).getParserNode();354 CompositeNode root = node.getParent();355 356 AbstractNode last = node.getChildren().get(357 node.getChildren().size() - 1);358 359 if (!(last instanceof CompositeNode))360 return;361 362 CompositeNode rightHandSideNode = (CompositeNode) last;363 String rightHandSideText = rightHandSideNode.serialize().trim()364 .replaceAll("[ \t\n\r]", "");365 366 for (int i = 0; i < root.getChildren().size(); i++) {367 if (root.getChildren().get(i) == node)368 continue;369 if (root.getChildren().get(i) == null)370 continue;371 if (!(root.getChildren().get(i) instanceof CompositeNode))372 continue;373 374 CompositeNode child = (CompositeNode) root.getChildren().get(i);375 376 AbstractNode childLastChild = child.getChildren().get(377 child.getChildren().size() - 1);378 if (childLastChild instanceof CompositeNode) {379 CompositeNode childLastChildCompositeNode = (CompositeNode) childLastChild;380 String text = childLastChildCompositeNode.serialize().trim()381 .replaceAll("[ \t\n\r]", "");382 if (text.equals(rightHandSideText)) {383 Rule matchingRule = (Rule) child.getElement();384 String description = EbnfJavaValidator.duplicateSubRulesDescription385 + " with rule "386 + matchingRule.getRulenumber()387 + " (Line "388 + child.getLine() + ")";389 warning(description, 1, description);390 }391 }392 }393 353 } 394 354
Note: See TracChangeset
for help on using the changeset viewer.