Spinach.exec.Visitline C# (CSharp) Method

Visitline() public method

public Visitline ( string args ) : void
args string
return void
        public void Visitline(string args)
        {
            CommonTokenStream str = new CommonTokenStream();
            //We need the syntax for the core object
            Program myprog = new Program(str);
            myprog.error += new Program.errorreport(Onerror);
            myprog.AstEvent += new Program.AstReport(Onoutput);
            myprog.VisitLine(args);
        }
        public void Onoutput(List<Element> elements)

Usage Example

Example #1
0
 public static void Main(string[] args)
 {
     Spinach.exec obj = new Spinach.exec();
     List<string> keywords = new List<string>();
     keywords = obj.getKeywords();
     obj.error_ += new Spinach.exec.errorreport(error);
     obj.Visitline("int a");
     obj.Visitline("parallelfor(i->1to){Vector<int>[2] a =[1,2,3,4];}");
     obj.Visitline("subPlot(1,1,a,\"abc\",1D);plot(b,\"abcd\",1D);for(i->1to4){struct s{int a;}; s.a = 0;//this is a comment string s; s = \"This is a example\";}");
     obj.Visitline("if(a<=0){int a; a =9; double c; Vector<double>[2] vec=[1.1,2.2]; if(a==9){Matrix<int>[2][2] mat= [1,2,3,4];int d; return mat;} return a;}else{double e; return e;}");
     obj.Visitline("int copy(Matrix<int> a,Vector<double> b , int c ){ int h; int l ; for(i->1to100){int a; a =9; double c; Vector<double>[2] vec=[1.1,2.2]; if(a==9){Matrix<int>[2][2] mat= [1,2,3,4];int d; return mat;}} return a; int j; h= (l+j)*h*l+l-h;}");
     obj.Visitline("int a; a=10; int b; b=20; if(a==b) { print a; } else { print b; }");
 }