//INTEGER | FLOAT | BOOLEAN | STRING | NAME | PARAM; private Expression ParseLiteral(RQ q) { if (q.IsNext(tokens["name"])) { RowValueExpression rv = new RowValueExpression(); rv.row = q.Pop().value; return(rv); } if (q.IsNext(tokens["int"]) || q.IsNext(tokens["float"]) || q.IsNext(tokens["bool"])) { ValueExpression v = new ValueExpression(); v.value = q.Pop().value; return(v); } if (q.IsNext(tokens["param"])) { ValueExpression v = new ValueExpression(); v.value = q.Peek().value; v.parameterId = int.Parse(v.value.Remove(0, 1)); return(v); } if (q.IsNext(tokens["string"])) { ValueExpression v = new ValueExpression(); v.value = q.Peek().value.Remove(0, 1); v.value = v.value.Remove(v.value.Length - 1); q.Pop(); return(v); } return(null); }
//'DROP TABLE' NAME; private Query ParseDrop(RQ q) { if (!q.IsNext(tokens["drop"])) { return(null); } q.Pop(); if (!q.IsNext(tokens["table"])) { return(null); } q.Pop(); if (!q.IsNext(tokens["name"])) { return(null); } string table = q.Pop().value; DropTableQuery dt = new DropTableQuery(); dt.name = table; return(dt); }
//(expression ( 'AND' | 'OR' ) expression) | ('NOT' expression) | (term); private Expression ParseExpression(RQ q) { Expression left = null; if (q.IsNext(tokens["not"])) { q.Pop(); NotExpression n = new NotExpression(); n.exp = ParseExpression(q); if (n.exp == null) { return(null); } left = n; } else { left = ParseTerm(q); } BooleanExpression b = new BooleanExpression(); if (q.IsNext(tokens["and"]) || q.IsNext(tokens["or"])) { b.or = q.Pop().value.ToLower() == "or"; Expression right = null; if (q.IsNext(tokens["not"])) { q.Pop(); NotExpression n = new NotExpression(); n.exp = ParseExpression(q); if (n.exp == null) { return(null); } right = n; } else { right = ParseTerm(q); } if (right == null || left == null) { return(null); } b.left = left; b.right = right; return(b); } else { return(left); } return(null); }
static void KillstealQ() { foreach (var target in HeroManager.Enemies.OrderByDescending(x => x.Health)) { if (RQ.CanCast(target) && AIO_Func.isKillable(target, RQ) && !HAMMER) { AIO_Func.LCast(RQ, target); } } }
//'CREATE TABLE' NAME '(' (NAME NAME (',' NAME NAME)*)? ')'; private Query ParseCreate(RQ q) { if (!q.IsNext(tokens["create"])) { return(null); } q.Pop(); if (!q.IsNext(tokens["table"])) { return(null); } q.Pop(); if (!q.IsNext(tokens["name"])) { return(null); } string table = q.Pop().value; if (!q.IsNext(tokens["open"])) { return(null); } q.Pop(); List <string> elems = new List <string>(); //Column list while (q.IsNext(tokens["name"])) { string name = q.Pop().value; elems.Add(name); if (!q.IsNext(tokens["comma"])) { break; } q.Pop(); } if (!q.IsNext(tokens["close"])) { return(null); } q.Pop(); CreateTableQuery ct = new CreateTableQuery(); ct.name = table; ct.columns = elems.ToArray(); return(ct); }
public async void Resolve(string uuid, Action <string> DisplayName) { if (!Guid.TryParse(uuid, out Guid NOP_0)) { return; } ReadCache(); // Find zone name from cache if (ZoneMap.ContainsKey(uuid)) { DisplayName(ZoneMap[uuid]); return; } if (ResolvQs.TryGetValue(uuid, out ConcurrentQueue <Action <string> > RQ)) { RQ.Enqueue(DisplayName); return; } else { ResolvQs.TryAdd(uuid, new ConcurrentQueue <Action <string> >()); } // Find zone name from online directory IEnumerable <string> AccessTokens = new TokenManager().AuthList.Remap(x => ( string )x.Value); SHSearchLoader SHSL = new SHSearchLoader("uuid: " + uuid, AccessTokens); IList <HubScriptItem> HSIs = await SHSL.NextPage(); if (HSIs.Any()) { string ZName = HSIs.First().Name; DisplayName(ZName); ZoneMap[uuid] = ZName; Shared.ZCacheDb.Write(CacheId, ZoneMap.Data); if (ResolvQs.TryRemove(uuid, out ConcurrentQueue <Action <string> > ResolvQ)) { while (ResolvQ.TryDequeue(out Action <string> Resolved)) { Resolved(ZName); } } } else { // Drop the entire waiting queue as we cannot resolve the name ResolvQs.TryRemove(uuid, out ConcurrentQueue <Action <string> > NOP_1); } }
public Query Parse(List <Match> tokens) { Query q = null; RQ queue = new RQ(tokens); int ind = queue.Step(); q = ParseCreate(queue); if (q != null) { return(q); } queue.Restore(ind); q = ParseDrop(queue); if (q != null) { return(q); } queue.Restore(ind); q = ParseSelect(queue); if (q != null) { return(q); } queue.Restore(ind); q = ParseInsert(queue); if (q != null) { return(q); } queue.Restore(ind); q = ParseUpdate(queue); if (q != null) { return(q); } queue.Restore(ind); q = ParseDelete(queue); if (q != null) { return(q); } queue.Restore(ind); throw new ParseException("Input string is not one of: create | drop | select | insert | update | delete"); }
static void ManualQE() { //var Target = TargetSelector.GetTarget(REQ.Range, Q.DamageType, true); if (QEM)//&& Target != null { if (HAMMER) { R.Cast(); } else if (RQ.IsReady() && RE.IsReady()) { RQ.Cast(Game.CursorPos); Utility.DelayAction.Add( (int)(RQ.Delay), () => RE.Cast(getParalelVec(Game.CursorPos))); //RE.Cast(getParalelVec(Game.CursorPos)); } } }
//literal | ( '(' exp ')' ); private Expression ParseValue(RQ q) { if (q.IsNext(tokens["open"])) { q.Pop(); Expression exp = ParseExpression(q); if (exp == null) { throw new ParseException("No expression in brackets"); } if (q.IsNext(tokens["close"])) { q.Pop(); return(exp); } return(null); } return(ParseLiteral(q)); }
static void Drawing_OnDraw(EventArgs args) { if (Player.IsDead) { return; } var drawQ = AIO_Menu.Champion.Drawings.Qrange; var drawW = AIO_Menu.Champion.Drawings.Wrange; var drawE = AIO_Menu.Champion.Drawings.Erange; var drawR = AIO_Menu.Champion.Drawings.Rrange; var drawRTimer = AIO_Menu.Champion.Drawings.getCircleValue("R Timer"); var pos_temp = Drawing.WorldToScreen(Player.Position); if (Q.IsReady() && drawQ.Active && !Bird) { Render.Circle.DrawCircle(Player.Position, Q.Range, drawQ.Color); } if (RQ.IsReady() && drawQ.Active && Bird) { Render.Circle.DrawCircle(Player.Position, RQ.Range, drawQ.Color); } if (W.IsReady() && drawW.Active) { Render.Circle.DrawCircle(Player.Position, W.Range, drawW.Color); } if (E.IsReady() && drawE.Active) { Render.Circle.DrawCircle(Player.Position, E.Range, drawE.Color); } if (R.IsReady() && drawR.Active) { Render.Circle.DrawCircle(Player.Position, R.Range, drawR.Color); } if (drawRTimer.Active && getRBuffDuration > 0) { Drawing.DrawText(pos_temp[0], pos_temp[1], drawRTimer.Color, "R: " + getRBuffDuration.ToString("0.00")); } }
//'DELETE FROM' NAME ('WHERE' expression)? private Query ParseDelete(RQ q) { if (!q.IsNext(tokens["delete"])) { return(null); } q.Pop(); if (!q.IsNext(tokens["from"])) { return(null); } q.Pop(); TableSource source = ParseSource(q); DeleteFromQuery df = new DeleteFromQuery(); df.table = source; df.eval = new TrueExpression(); if (q.IsNext(tokens["where"])) { q.Pop(); Expression e = ParseExpression(q); if (e == null) { e = new TrueExpression(); } else { df.eval = e; } } return(df); }
static void Drawing_OnDraw(EventArgs args) { if (Player.IsDead) { return; } var drawQ = AIO_Menu.Champion.Drawings.Qrange; var drawW = AIO_Menu.Champion.Drawings.Wrange; var drawE = AIO_Menu.Champion.Drawings.Erange; if (Q.IsReady() && drawQ.Active && HAMMER) { Render.Circle.DrawCircle(Player.Position, Q.Range, drawQ.Color); } if (W.IsReady() && drawW.Active && HAMMER) { Render.Circle.DrawCircle(Player.Position, W.Range, drawW.Color); } if (E.IsReady() && drawE.Active && HAMMER) { Render.Circle.DrawCircle(Player.Position, E.Range, drawE.Color); } if (RQ.IsReady() && drawQ.Active && !HAMMER) { Render.Circle.DrawCircle(Player.Position, RQ.Range, drawQ.Color); } if (RW.IsReady() && drawW.Active && !HAMMER) { Render.Circle.DrawCircle(Player.Position, RW.Range, drawW.Color); } if (E.IsReady() && drawE.Active && !HAMMER) { Render.Circle.DrawCircle(Player.Position, REQ.Range, drawE.Color); } }
//NAME | NAME JOIN SOURCE private TableSource ParseSource(RQ q) { if (!q.IsNext(tokens["name"])) { return(null); } string left = q.Pop().value; if (!q.IsNext(tokens["join"])) { RawSource r = new RawSource(); r.table = left; return(r); } q.Pop(); TableSource right = ParseSource(q); JoinSource j = new JoinSource(); j.left = left; j.right = right; return(j); }
//value | (value ('>' | <' | '=') value); private Expression ParseTerm(RQ q) { Expression left = ParseValue(q); if (!q.IsNext(tokens["compare"])) { return(left); } string comp = q.Pop().value; Expression right = ParseValue(q); if (left == null || right == null) { return(null); } CompareExpression c = new CompareExpression(); c.left = left; c.right = right; c.op = comp; return(c); }
//'SELECT' ('*' | (NAME (',' NAME)*)) 'FROM' table (WHERE expression)?; private Query ParseSelect(RQ q) { if (!q.IsNext(tokens["select"])) { return(null); } q.Pop(); SelectFromQuery sf = new SelectFromQuery(); if (q.IsNext(tokens["*"])) { sf.all = true; q.Pop(); } else { List <string> names = new List <string>(); while (true) { if (!q.IsNext(tokens["name"])) { break; } string name = q.Pop().value; names.Add(name); if (!q.IsNext(tokens["comma"])) { break; } q.Pop(); } sf.fields = names.ToArray(); } if (!q.IsNext(tokens["from"])) { return(null); } q.Pop(); TableSource source = ParseSource(q); if (!q.IsNext(tokens["where"])) { return(null); } q.Pop(); Expression e = ParseExpression(q); if (e == null) { e = new TrueExpression(); } sf.source = source; sf.expr = e; return(sf); }
//'INSERT INTO' NAME ('(' NAME (',' NAME)* ')') 'VALUES' expression (',' expression)*; private Query ParseInsert(RQ q) { if (!q.IsNext(tokens["insert"])) { return(null); } q.Pop(); if (!q.IsNext(tokens["into"])) { return(null); } q.Pop(); TableSource source = ParseSource(q); if (!q.IsNext(tokens["open"])) { return(null); } q.Pop(); List <string> names = new List <string>(); while (q.IsNext(tokens["name"])) { string name = q.Pop().value; names.Add(name); if (!q.IsNext(tokens["comma"])) { break; } q.Pop(); } if (!q.IsNext(tokens["close"])) { return(null); } q.Pop(); if (!q.IsNext(tokens["values"])) { return(null); } q.Pop(); List <Expression> ex = new List <Expression>(); while (true) { Expression e = ParseExpression(q); if (e == null) { break; } ex.Add(e); if (!q.IsNext(tokens["comma"])) { break; } q.Pop(); } InsertIntoQuery ii = new InsertIntoQuery(); ii.exp = ex.ToArray(); ii.fields = names.ToArray(); ii.source = source; return(ii); }
//'UPDATE' NAME 'SET' (NAME '=' expression) (',' NAME '=' expression)* ('WHERE' expression)? private Query ParseUpdate(RQ q) { if (!q.IsNext(tokens["update"])) { return(null); } q.Pop(); TableSource s = ParseSource(q); if (!q.IsNext(tokens["set"])) { return(null); } q.Pop(); List <string> fields = new List <string>(); List <Expression> values = new List <Expression>(); while (true) { if (!q.IsNext(tokens["name"])) { break; } string field = q.Pop().value; if (!q.IsNext(tokens["compare"])) { break; } string op = q.Peek().value; if (op != "=") { break; } q.Pop(); Expression e2 = ParseExpression(q); fields.Add(field); values.Add(e2); if (!q.IsNext(tokens["comma"])) { break; } } if (!q.IsNext(tokens["where"])) { return(null); } q.Pop(); Expression e = ParseExpression(q); if (e == null) { e = new TrueExpression(); } UpdateQuery u = new UpdateQuery(); u.table = s; u.fields = fields.ToArray(); u.values = values.ToArray(); u.exp = e; return(u); }
public RS DoSomething(RQ rq) { return(new RS(rq)); }