Renamed package gel to grel.

Replaced gel with grel in other places in the code base while maintaining backward compatibility.
Changed layout in expression preview dialog to accommodate long GREL name.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1442 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-10-07 05:19:35 +00:00
parent 527067a9a3
commit 1de5e7c00e
98 changed files with 217 additions and 211 deletions

View File

@ -14,7 +14,7 @@ import com.google.refine.browsing.RowFilter;
import com.google.refine.browsing.filters.AnyRowRecordFilter;
import com.google.refine.browsing.filters.ExpressionStringComparisonRowFilter;
import com.google.refine.expr.Evaluable;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.ast.VariableExpr;
import com.google.refine.model.Project;
public class TextSearchFacet implements Facet {

View File

@ -11,9 +11,9 @@ import javax.servlet.http.HttpServletResponse;
import org.json.JSONWriter;
import com.google.refine.commands.Command;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class GetExpressionLanguageInfoCommand extends Command {

View File

@ -8,7 +8,7 @@ import java.util.Set;
import clojure.lang.IFn;
import com.google.refine.gel.Parser;
import com.google.refine.grel.Parser;
abstract public class MetaParser {
static public class LanguageInfo {
@ -27,11 +27,11 @@ abstract public class MetaParser {
static {
s_languages = new HashMap<String, LanguageInfo>();
registerLanguageParser("gel", "Google Refine Expression Language (GREL)", new LanguageSpecificParser() {
registerLanguageParser("grel", "Google Refine Expression Language (GREL)", new LanguageSpecificParser() {
@Override
public Evaluable parse(String s) throws ParsingException {
return parseGEL(s);
return parseGREL(s);
}
}, "value");
@ -88,29 +88,32 @@ abstract public class MetaParser {
/**
* Parse an expression that might have a language prefix into an Evaluable.
* Expressions without valid prefixes or without any prefix are assumed to be
* GEL expressions.
* GREL expressions.
*
* @param s
* @return
* @throws ParsingException
*/
static public Evaluable parse(String s) throws ParsingException {
String language = "gel";
String language = "grel";
int colon = s.indexOf(':');
if (colon >= 0) {
language = s.substring(0, colon);
language = s.substring(0, colon).toLowerCase();
if ("gel".equals(language)) {
language = "grel";
}
}
LanguageInfo info = s_languages.get(language.toLowerCase());
if (info != null) {
return info.parser.parse(s.substring(colon + 1));
} else {
return parseGEL(s);
return parseGREL(s);
}
}
static protected Evaluable parseGEL(String s) throws ParsingException {
static protected Evaluable parseGREL(String s) throws ParsingException {
Parser parser = new Parser(s);
return parser.getExpression();

View File

@ -9,8 +9,8 @@ import com.google.refine.ProjectManager;
import com.google.refine.InterProjectModel.ProjectJoin;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.WrappedCell;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.model.Project;
public class Cross implements Function {

View File

@ -11,8 +11,8 @@ import com.google.refine.expr.EvalError;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.MetaParser;
import com.google.refine.expr.ParsingException;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.model.Column;
import com.google.refine.model.Project;

View File

@ -11,7 +11,7 @@ import org.json.JSONWriter;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.expr.HasFields;
import com.google.refine.expr.HasFieldsList;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Get implements Function {

View File

@ -7,7 +7,7 @@ import org.json.JSONObject;
import org.json.JSONWriter;
import com.google.refine.expr.HasFields;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class HasField implements Function {

View File

@ -9,7 +9,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Jsonize implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.HasFieldsList;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Length implements Function {

View File

@ -9,7 +9,7 @@ import org.json.JSONWriter;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.expr.HasFieldsList;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Slice implements Function {

View File

@ -10,7 +10,7 @@ import org.json.JSONWriter;
import com.google.refine.expr.util.CalendarParser;
import com.google.refine.expr.util.CalendarParserException;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class ToDate implements Function {

View File

@ -6,7 +6,7 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class ToNumber implements Function {

View File

@ -7,7 +7,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class ToString implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Type implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class ArgsToArray implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Join implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.util.JSONUtilities;
public class Reverse implements Function {

View File

@ -10,8 +10,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.util.JSONUtilities;
public class Sort implements Function {

View File

@ -11,8 +11,8 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.util.JSONUtilities;
public class Uniques implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class And implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Not implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Or implements Function {

View File

@ -8,8 +8,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class DatePart implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Inc implements Function {

View File

@ -6,7 +6,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Now implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Ceil implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Exp implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Floor implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Ln implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Log implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Max implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Min implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Mod implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Pow implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Round implements Function {

View File

@ -8,8 +8,8 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Sum implements Function {

View File

@ -6,7 +6,7 @@ import org.apache.commons.lang.StringUtils;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Chomp implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Contains implements Function {

View File

@ -10,7 +10,7 @@ import org.json.JSONWriter;
import com.google.refine.expr.util.CalendarParser;
import com.google.refine.expr.util.CalendarParserException;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Diff implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class EndsWith implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Escape implements Function {

View File

@ -7,7 +7,7 @@ import org.json.JSONWriter;
import com.google.refine.clustering.binning.FingerprintKeyer;
import com.google.refine.clustering.binning.Keyer;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Fingerprint implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class IndexOf implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class LastIndexOf implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class MD5 implements Function {

View File

@ -8,8 +8,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Match implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class NGram implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONWriter;
import com.google.refine.clustering.binning.Keyer;
import com.google.refine.clustering.binning.NGramFingerprintKeyer;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class NGramFingerprint implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONTokener;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class ParseJson implements Function {

View File

@ -7,7 +7,7 @@ import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Partition implements Function {

View File

@ -9,8 +9,8 @@ import com.google.refine.clustering.binning.DoubleMetaphoneKeyer;
import com.google.refine.clustering.binning.MetaphoneKeyer;
import com.google.refine.clustering.binning.SoundexKeyer;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Phonetic implements Function {

View File

@ -7,7 +7,7 @@ import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class RPartition implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONWriter;
import com.google.refine.ProjectManager;
import com.google.refine.ProjectMetadata;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
import com.google.refine.model.Project;
public class Reinterpret implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Replace implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class ReplaceChars implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class SHA1 implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONWriter;
import au.com.bytecode.opencsv.CSVParser;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class SmartSplit implements Function {
static protected CSVParser s_tabParser = new CSVParser(

View File

@ -8,8 +8,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Split implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class SplitByCharType implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class SplitByLengths implements Function {
public Object call(Properties bindings, Object[] args) {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class StartsWith implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class ToLowercase implements Function {

View File

@ -7,8 +7,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class ToTitlecase implements Function {

View File

@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class ToUppercase implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Trim implements Function {

View File

@ -9,8 +9,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.Function;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.Function;
public class Unescape implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class Unicode implements Function {

View File

@ -5,7 +5,7 @@ import java.util.Properties;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
public class UnicodeType implements Function {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel;
package com.google.refine.grel;
import java.util.Properties;
@ -6,7 +6,7 @@ import com.google.refine.Jsonizable;
import com.google.refine.expr.Evaluable;
/**
* Interface of GEL controls such as if, forEach, forNonBlank, with. A control can
* Interface of GREL controls such as if, forEach, forNonBlank, with. A control can
* decide which part of the code to execute and can affect the environment bindings.
* Functions, on the other hand, can't do either.
*/

View File

@ -1,4 +1,4 @@
package com.google.refine.gel;
package com.google.refine.grel;
import java.util.HashMap;
import java.util.Map;
@ -69,19 +69,19 @@ import com.google.refine.expr.functions.strings.Trim;
import com.google.refine.expr.functions.strings.Unescape;
import com.google.refine.expr.functions.strings.Unicode;
import com.google.refine.expr.functions.strings.UnicodeType;
import com.google.refine.gel.controls.Filter;
import com.google.refine.gel.controls.ForEach;
import com.google.refine.gel.controls.ForEachIndex;
import com.google.refine.gel.controls.ForNonBlank;
import com.google.refine.gel.controls.ForRange;
import com.google.refine.gel.controls.If;
import com.google.refine.gel.controls.IsBlank;
import com.google.refine.gel.controls.IsError;
import com.google.refine.gel.controls.IsNonBlank;
import com.google.refine.gel.controls.IsNotNull;
import com.google.refine.gel.controls.IsNull;
import com.google.refine.gel.controls.IsNumeric;
import com.google.refine.gel.controls.With;
import com.google.refine.grel.controls.Filter;
import com.google.refine.grel.controls.ForEach;
import com.google.refine.grel.controls.ForEachIndex;
import com.google.refine.grel.controls.ForNonBlank;
import com.google.refine.grel.controls.ForRange;
import com.google.refine.grel.controls.If;
import com.google.refine.grel.controls.IsBlank;
import com.google.refine.grel.controls.IsError;
import com.google.refine.grel.controls.IsNonBlank;
import com.google.refine.grel.controls.IsNotNull;
import com.google.refine.grel.controls.IsNull;
import com.google.refine.grel.controls.IsNumeric;
import com.google.refine.grel.controls.With;
public class ControlFunctionRegistry {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel;
package com.google.refine.grel;
import java.util.Properties;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel;
package com.google.refine.grel;
import java.util.LinkedList;
import java.util.List;
@ -7,16 +7,16 @@ import java.util.regex.Pattern;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ParsingException;
import com.google.refine.expr.functions.arrays.ArgsToArray;
import com.google.refine.gel.Scanner.NumberToken;
import com.google.refine.gel.Scanner.RegexToken;
import com.google.refine.gel.Scanner.Token;
import com.google.refine.gel.Scanner.TokenType;
import com.google.refine.gel.ast.ControlCallExpr;
import com.google.refine.gel.ast.FieldAccessorExpr;
import com.google.refine.gel.ast.FunctionCallExpr;
import com.google.refine.gel.ast.LiteralExpr;
import com.google.refine.gel.ast.OperatorCallExpr;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.Scanner.NumberToken;
import com.google.refine.grel.Scanner.RegexToken;
import com.google.refine.grel.Scanner.Token;
import com.google.refine.grel.Scanner.TokenType;
import com.google.refine.grel.ast.ControlCallExpr;
import com.google.refine.grel.ast.FieldAccessorExpr;
import com.google.refine.grel.ast.FunctionCallExpr;
import com.google.refine.grel.ast.LiteralExpr;
import com.google.refine.grel.ast.OperatorCallExpr;
import com.google.refine.grel.ast.VariableExpr;
public class Parser {
protected Scanner _scanner;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel;
package com.google.refine.grel;
public class Scanner {
static public enum TokenType {

View File

@ -1,9 +1,9 @@
package com.google.refine.gel.ast;
package com.google.refine.grel.ast;
import java.util.Properties;
import com.google.refine.expr.Evaluable;
import com.google.refine.gel.Control;
import com.google.refine.grel.Control;
/**
* An abstract syntax tree node encapsulating a control call, such as "if".

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.ast;
package com.google.refine.grel.ast;
import java.util.Properties;

View File

@ -1,10 +1,10 @@
package com.google.refine.gel.ast;
package com.google.refine.grel.ast;
import java.util.Properties;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.Function;
import com.google.refine.grel.Function;
/**
* An abstract syntax tree node encapsulating a function call. The function's

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.ast;
package com.google.refine.grel.ast;
import java.util.Properties;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.ast;
package com.google.refine.grel.ast;
import java.util.Properties;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.ast;
package com.google.refine.grel.ast;
import java.util.Properties;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.ArrayList;
import java.util.Collection;
@ -12,9 +12,9 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.ast.VariableExpr;
public class Filter implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.ArrayList;
import java.util.Collection;
@ -12,9 +12,9 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.ast.VariableExpr;
public class ForEach implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.ArrayList;
import java.util.List;
@ -11,9 +11,9 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.ast.VariableExpr;
public class ForEachIndex implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.Properties;
@ -7,9 +7,9 @@ import org.json.JSONWriter;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.ast.VariableExpr;
public class ForNonBlank implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.ArrayList;
import java.util.List;
@ -10,9 +10,9 @@ import org.json.JSONWriter;
import com.google.refine.expr.EvalError;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.ast.VariableExpr;
public class ForRange implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.Properties;
@ -7,8 +7,8 @@ import org.json.JSONWriter;
import com.google.refine.expr.Evaluable;
import com.google.refine.expr.ExpressionUtils;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
public class If implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import com.google.refine.expr.ExpressionUtils;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import com.google.refine.expr.ExpressionUtils;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import com.google.refine.expr.ExpressionUtils;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
public class IsNotNull extends IsTest {
@Override

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
public class IsNull extends IsTest {
@Override

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import org.apache.commons.lang.StringUtils;

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.Properties;
@ -6,8 +6,8 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.Evaluable;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
abstract class IsTest implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -1,4 +1,4 @@
package com.google.refine.gel.controls;
package com.google.refine.grel.controls;
import java.util.Properties;
@ -6,9 +6,9 @@ import org.json.JSONException;
import org.json.JSONWriter;
import com.google.refine.expr.Evaluable;
import com.google.refine.gel.Control;
import com.google.refine.gel.ControlFunctionRegistry;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.Control;
import com.google.refine.grel.ControlFunctionRegistry;
import com.google.refine.grel.ast.VariableExpr;
public class With implements Control {
public String checkArguments(Evaluable[] args) {

View File

@ -5,8 +5,8 @@ import java.util.List;
import com.google.refine.expr.MetaParser;
import com.google.refine.expr.ParsingException;
import com.google.refine.gel.ast.FieldAccessorExpr;
import com.google.refine.gel.ast.VariableExpr;
import com.google.refine.grel.ast.FieldAccessorExpr;
import com.google.refine.grel.ast.VariableExpr;
public class Parser {
static public Template parse(String s) throws ParsingException {

View File

@ -1,19 +1,15 @@
<div class="grid-layout layout-tight layout-full"><table rows="4" cols="2">
<tr>
<div class="grid-layout layout-tight layout-full"><table rows="4" cols="4">
<tr style="vertical-align: bottom;">
<td>Expression</td>
<td>Language</td>
</tr>
<tr>
<td rowspan="2"><div class="input-container"><textarea class="expression-preview-code" bind="expressionPreviewTextarea" /></div></td>
<td width="150" height="1">
<select bind="expressionPreviewLanguageSelect">$LANGUAGE_OPTIONS$</select>
</td>
<td style="text-align: right;">Language</td>
<td colspan="2"><select bind="expressionPreviewLanguageSelect">$LANGUAGE_OPTIONS$</select></td>
</tr>
<tr>
<td colspan="3"><div class="input-container"><textarea class="expression-preview-code" bind="expressionPreviewTextarea" /></div></td>
<td class="expression-preview-error-container" bind="expressionPreviewErrorContainer" width="150" style="vertical-align: top;"></td>
</tr>
<tr>
<td colspan="2">
<td colspan="4">
<div id="expression-preview-tabs" class="refine-tabs">
<ul>
<li><a href="#expression-preview-tabs-preview">Preview</a></li>

View File

@ -52,11 +52,15 @@ ExpressionPreviewDialog.Widget = function(
values,
expression
) {
var language = "gel";
var language = "grel";
if (!(expression)) {
language = $.cookie("scripting.lang");
if (language == "gel") { // backward compatible
language = "grel";
}
if (!(language) || !(language.toLowerCase() in theProject.scripting)) {
language = "gel";
language = "grel";
}
this.expression = theProject.scripting[language].defaultExpression;
} else {
@ -317,7 +321,7 @@ ExpressionPreviewDialog.Widget.prototype._renderPreview = function(expression, d
};
if (this._results !== null) {
this._elmts.expressionPreviewErrorContainer.empty();
this._elmts.expressionPreviewErrorContainer.empty().text("No syntax error.");
} else {
var message = (data.type == "parser") ? data.message : "Internal error";
this._elmts.expressionPreviewErrorContainer.empty().text(message);

View File

@ -168,7 +168,7 @@ ListFacet.prototype._initializeUI = function() {
this._elmts.sortGroup.buttonset();
this._elmts.clusterLink.click(function() { self._doEdit(); }).button();
if (this._config.expression != "value" && this._config.expression != "gel:value") {
if (this._config.expression != "value" && this._config.expression != "grel:value") {
this._elmts.clusterLink.hide();
}
@ -633,7 +633,7 @@ ListFacet.prototype._editExpression = function() {
self._config.expression = expr;
self._elmts.expressionDiv.text(self._config.expression);
if (self._config.expression == "value" || self._config.expression == "gel:value") {
if (self._config.expression == "value" || self._config.expression == "grel:value") {
self._elmts.clusterLink.show();
} else {
self._elmts.clusterLink.hide();

View File

@ -5,6 +5,9 @@ Scripting.parse = function(expression) {
var colon = expression.indexOf(":");
if (colon > 0) {
var l = expression.substring(0, colon);
if (l == "gel") { // backward compatible
l = "grel";
}
if (theProject.scripting.hasOwnProperty(l)) {
return {
language: l,
@ -14,7 +17,7 @@ Scripting.parse = function(expression) {
}
return {
language: "gel",
language: "grel",
expression: expression
};
};