예제 #1
0
파일: Parser.cs 프로젝트: Silica/CsPSL
 public bool Parse(Variable v)
 {
     var c = new Code();
     c.PushCode(new PushVariable("arg"));
     c.PushCode(new Argument());
     while (t.checkNext() != "")
         ParseStatement(v, c);
     v.setCode(c);
     return error != 0;
 }
예제 #2
0
파일: Environment.cs 프로젝트: Silica/CsPSL
 public Variable GetVariable(string s)
 {
     var v = scope.GetVariable(s);
     if (v != null)
         return v;
     if (global.Exist(s))
         return global[s];
     v = new Variable();
     scope.AddLocal(s, v);
     return v;
 }
예제 #3
0
파일: PSL.cs 프로젝트: Silica/CsPSL
 public bool LoadString(string str)
 {
     var t = new Tokenizer(str);
     var p = new Parser(t);
     var v = new Variable();
     if (p.Parse(v))
         return true;
     v.prepare(env);
     v["print"] = new Variable(print);
     env.Set(v);
     return false;
 }
예제 #4
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override vBase substitution(Variable v)
 {
     x = v.toString(); return this;
 }
예제 #5
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override bool eq(Variable v)
 {
     return x == v.toString();
 }
예제 #6
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void setchild(string s, Variable v)
 {
     if (!table.ContainsKey(s))
         table.Add(s, v);
     else
         table[s] = v;
 }
예제 #7
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void xor(Variable v)
 {
     x ^= v.toInt();
 }
예제 #8
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void or(Variable v)
 {
     x |= v.toInt();
 }
예제 #9
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override Variable call(Environment env, Variable arg)
 {
     return x(arg);
 }
예제 #10
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public virtual void xor(Variable v)
 {
 }
예제 #11
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public virtual vBase substitution(Variable v)
 {
     return v.x.clone();
 }
예제 #12
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public virtual void sub(Variable v)
 {
 }
예제 #13
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public virtual void shr(Variable v)
 {
 }
예제 #14
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public virtual void setchild(string s, Variable v)
 {
     substitution(v);
 }
예제 #15
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public virtual bool ne(Variable v)
 {
     return false;
 }
예제 #16
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void mul(Variable v)
 {
     x *= v.toInt();
 }
예제 #17
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override bool ne(Variable v)
 {
     return x != v.toInt();
 }
예제 #18
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void add(Variable v)
 {
     x += v.toInt();
 }
예제 #19
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void sub(Variable v)
 {
     x -= v.toInt();
 }
예제 #20
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void and(Variable v)
 {
     x &= v.toInt();
 }
예제 #21
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override Variable call(Environment env, Variable arg)
 {
     if (code == null)
         return arg;
     env.AddScope(new FunctionScope(code));
     env.Push(arg);
     env.Run();
     return env.Pop();
 }
예제 #22
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void div(Variable v)
 {
     x /= v.toInt();
 }
예제 #23
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void add(Variable v)
 {
     x += v.toString();
 }
예제 #24
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override bool eq(Variable v)
 {
     return x == v.toInt();
 }
예제 #25
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override bool ne(Variable v)
 {
     return x != v.toString();
 }
예제 #26
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override bool gt(Variable v)
 {
     return x > v.toInt();
 }
예제 #27
0
파일: PSL.cs 프로젝트: Silica/CsPSL
 public static Variable print(Variable v)
 {
     Console.WriteLine(v.toString());
     return v;
 }
예제 #28
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override bool lt(Variable v)
 {
     return x < v.toInt();
 }
예제 #29
0
파일: PSL.cs 프로젝트: Silica/CsPSL
 public Variable Run(Variable v)
 {
     env.Push(v);
     env.Run();
     return env.Pop();
 }
예제 #30
0
파일: Variable.cs 프로젝트: Silica/CsPSL
 public override void mod(Variable v)
 {
     x %= v.toInt();
 }