public AlphabetDef(FastToken name, IEnumerable<KeyValuePair<FastToken, FastToken>> attrs, IEnumerable<KeyValuePair<FastToken, FastToken>> constructors) : base(DefKind.Alphabet) { this.sort = new FastSort(name, FastSortKind.Tree); this.symbols = new List<FuncSymbol>(); this.name = name; AddAttributes(attrs); AddConstructors(constructors); }
public Pattern(FastToken symbol, IEnumerable<FastToken> childList) { this.symbol = symbol; foreach (var c in childList) { if (!ids.Add(c.text)) throw new FastParseException(c.Location, string.Format("Duplicate ID '{0}'", c.text)); children.Add(c); } }
public ComplementExp(FastToken func, BuiltinLangExp arg1) : base(func, 1, BuiltinLangExpKind.Complement) { this.arg1 = arg1; }
public BuiltinExp(FastToken func, int arity) { this.func = new FuncSymbol(func, arity); this.arity = arity; }
public BoolQueryDef(FastToken query) : base(query) { }
public TypecheckQueryDef(FastToken isempty, BuiltinLangExp input, BuiltinTransExp trans, BuiltinLangExp output) : base(isempty) { this.trans = trans; this.input = input; this.output = output; }
protected Value(object val, FastToken token) { this.val = val; this._token = token; }
public RestrictionOutExp(FastToken func, BuiltinTransExp arg1, BuiltinLangExp arg2) : base(func, 2, BuiltinTransExpKind.RestrictionOut) { this.arg1 = arg1; this.arg2 = arg2; }
public StringQueryDef(FastToken msg) : base(msg) { this.message = msg.text.Substring(1, msg.text.Length - 2); }
public RecordSort(IEnumerable<KeyValuePair<FastToken, FastSort>> attrs) : base(null, FastSortKind.Record) { foreach (var attr in attrs) { if (fieldSorts.ContainsKey(attr.Key.text)) throw new FastParseException(attr.Key.Location, string.Format("Duplicate attribute ID '{0}'", attr.Key.text)); fieldSorts[attr.Key.text] = attr.Value; fields.Add(attr); } _name = new FastToken(this.ToString(), Tokens.LBRACKET); }
public FastSort getSort(FastToken id) { if (!fieldSorts.ContainsKey(id.text)) throw new FastParseException(id.Location, string.Format("Undefined attribute field '{0}'", id.text)); return (fieldSorts[id.text]); }
public RecordExp(FastToken symbol, IEnumerable<FExp> args) : base(symbol, args) { }
//public QueryKind queryKind; public QueryDef(FastToken token) : base(DefKind.Query) { this.func = new FuncSymbol(token, 0); }
public PreimageExp(FastToken func, BuiltinTransExp arg1, BuiltinLangExp arg2) : base(func, 2, BuiltinLangExpKind.Preimage) { this.arg1 = arg1; this.arg2 = arg2; }
public TreeExpDef(FastToken acc, FastToken alphabet, FExp expr) : base(acc, alphabet, TreeDefKind.Tree) { this.expr = expr; }
public StringValue(FastToken token) : base(getLiteral(token.text), token) { }
public TreeWitnessDef(FastToken acc, FastToken alphabet, BuiltinLangExp language) : base(acc, alphabet, TreeDefKind.Witness) { this.language = language; }
public TransDef(FastToken trans, FastToken domain, FastToken range, FastToken patternMatchName) : base(DefKind.Trans, new FastSort(domain, FastSortKind.Tree)) { this.range = new FastSort(range, FastSortKind.Tree); this.func = new FuncSymbol(trans, 1, false, false, true); cases = new List<GuardedExp>(); if (patternMatchName != null) this.treeMatchName = new FuncSymbol(patternMatchName, 0); }
public UnionExp(FastToken func, BuiltinLangExp arg1, BuiltinLangExp arg2) : base(func, 2, BuiltinLangExpKind.Union) { this.arg1 = arg1; this.arg2 = arg2; }
public TransDefDef(FastToken name, FastToken alphabet1, FastToken alphabet2, BuiltinTransExp expr) : base(DefDefKind.Trans, new FastSort(alphabet1, FastSortKind.Tree)) { this.func = new FuncSymbol(name, 1); range = new FastSort(alphabet2, FastSortKind.Tree); this.expr = expr; }
public Variable(FastToken token) { this._token = token; _sort = null; }
public TransEquivQueryDef(FastToken equiv, BuiltinTransExp trans1, BuiltinTransExp trans2) : base(equiv, trans1, trans2, true) { this.trans1 = trans1; this.trans2 = trans2; }
//FastToken _token; public AttributeVariable(FastToken token) { var strs = token.text.Split('.'); this.treeNodeName = new FastToken(strs[0], token.Location, token.Kind); _token = new FastToken(strs[1], token.Location, token.Kind); }
public TransNameExp(FastToken func) : base(func, 0, BuiltinTransExpKind.Var) { }
public BoolValue(FastToken token) : base(token.Kind == Tokens.TRUE ? true : false, token) { }
public TreeAppDef(FastToken acc, FastToken alphabet, BuiltinTransExp tran, FExp tree) : base(acc, alphabet, TreeDefKind.Apply) { this.transducer = tran; this.expr = tree; }
public BuiltinTransExp(FastToken func, int arity, BuiltinTransExpKind kind) : base(func, arity) { this.kind = kind; }
public TreeDef(FastToken acc, FastToken alphabet, TreeDefKind kind) : base(DefDefKind.Tree, new FastSort(alphabet, FastSortKind.Tree)) { this.func = new FuncSymbol(acc, 1); this.tdkind = kind; }
public CompositionExp(FastToken func, BuiltinTransExp arg1, BuiltinTransExp arg2) : base(func, 2, BuiltinTransExpKind.Composition) { this.arg1 = arg1; this.arg2 = arg2; }
public static object ExtractValue(FastToken token) { if (token.text.StartsWith("'")) { string x = token.text.Substring(1, token.text.Length - 2); //remove single quotes string xv = Regex.Unescape(x); if (xv.Length != 1) throw new FastParseException(token.Location, string.Format("invalid character in '{0}'", token.text)); ; return xv[0]; } if (token.text.StartsWith("\"")) { string x = token.text.Substring(1, token.text.Length - 2); //escaped string, remove double quotes string v = Regex.Unescape(x); return v; } if (token.text.StartsWith("@")) { string x = token.text.Substring(2, token.text.Length - 3); //literal string, remove @ and double quotes return x; } int k; if (token.TryGetInt(out k)) return k; else return token.text; }