コード例 #1
0
 protected static Set<String> computeRestrictedKeywords(Grammar grammar) {
   Set<String> keywords = new HashSet<String>(GrammarUtil.getAllKeywords(grammar));
   Set<String> unrestrictedNames = getAllKeywords(grammar, "UnrestrictedName");
   keywords.removeAll(unrestrictedNames);
   //			printKeywords("Unrestricted", unrestrictedNames);
   return keywords;
 }
コード例 #2
0
 protected static Set<String> computeKeywords(Grammar grammar) {
   Set<String> keywords = new HashSet<String>(GrammarUtil.getAllKeywords(grammar));
   keywords.removeAll(getAllKeywords(grammar, "UnrestrictedName"));
   keywords.removeAll(getAllKeywords(grammar, "EssentialOCLReservedKeyword"));
   keywords.removeAll(getAllKeywords(grammar, "RestrictedKeywords"));
   keywords.removeAll(getAllKeywords(grammar, "CollectionTypeIdentifier"));
   keywords.removeAll(getAllKeywords(grammar, "PrimitiveTypeIdentifier"));
   return keywords;
 }
コード例 #3
0
  public class IDConverter extends AbstractNullSafeConverter<String> {

    private Set<String> allKeywords = ImmutableSet.copyOf(GrammarUtil.getAllKeywords(getGrammar()));

    @Override
    protected String internalToValue(String string, INode node) {
      return string.replaceAll("[\\^\\s]", "");
    }

    @Override
    protected String internalToString(String value) {
      if (allKeywords.contains(value)) return "^" + value;
      return value;
    }
  }
コード例 #4
0
 public IDConverter(Grammar grammar) {
   allKeywords = GrammarUtil.getAllKeywords(grammar);
 }
コード例 #5
0
 @Override
 protected Set<String> computeValuesToEscape(Grammar grammar) {
   Set<String> result = Sets.newHashSet();
   for (String keyword : GrammarUtil.getAllKeywords(grammar)) result.add(keyword.toLowerCase());
   return ImmutableSet.copyOf(result);
 }