Here you can find the source of quoteIfCeylonKeyword(String name)
public static String quoteIfCeylonKeyword(String name)
//package com.java2s; //License from project: Apache License public class Main { private static String[] keywords = new String[] { "abstracts", "alias", "assembly", "assert", "assign", "break", "case", "catch", "class", "continue", "dynamic", "else", "exists", "extends", "finally", "for", "function", "given", "if", "import", "in", "interface", "is", "let", "module", "new", "nonempty", "object", "of", "out", "outer", "package", "return", "satisfies", "super", "switch", "then", "this", "throw", "try", "value", "void", "while" }; /** Prefixes the given name with a "\i" if it is a Ceylon keyword */ public static String quoteIfCeylonKeyword(String name) { if (isCeylonKeyword(name)) return "\\i" + name; return name; }//from w ww .ja v a 2 s . co m public static boolean isCeylonKeyword(String token) { for (String keyword : keywords) if (keyword.equals(token)) return true; return false; } public static boolean isCeylonKeyword(String string, int start, int end) { int length = end - start; OUTER: for (int i = 0; i < keywords.length; i++) { String token = keywords[i]; if (token.length() != length) continue; for (int c = 0; c < length; c++) { if (string.charAt(c + start) != token.charAt(c)) continue OUTER; } return true; } return false; } }