Example #1
0
 public static Dictionary<string, int> Parse(string[] src)
 {
     var items = new Dictionary<string, int>();
     var gr = new Grammar(Resources.Grammar);
     for (int i = 0; i < src.Length; i++)
     {
         if (gr.GetPattern("defstart").IsValid(src[i]))
         {
             string name = gr.GetPattern("defstart").Match(src[i]).Groups["funcName"].Value;
             items.Add(name, i);
         }
     }
     return items;
 }
Example #2
0
        public static void Init()
        {
            Grammar = new Grammar(Resources.Grammar);

            //singleline statments
            StatementHandlers.Add(new DeIncreaseStmt());
            StatementHandlers.Add(new AttributeStmt());
            StatementHandlers.Add(new DecStmt());
            StatementHandlers.Add(new DecSetStmt());
            StatementHandlers.Add(new CommentStmt());
            StatementHandlers.Add(new CallStmt());
            StatementHandlers.Add(new ObjCallStmt());
            StatementHandlers.Add(new ImportStmt());
            StatementHandlers.Add(new DelStmt());
            StatementHandlers.Add(new ModeStmt());
            StatementHandlers.Add(new ThrowStmt());

            //MultilineStatements
            MultilineStatementHandler.Add(new IfStmt());
            MultilineStatementHandler.Add(new WhileStmt());
            MultilineStatementHandler.Add(new ForStmt());
            MultilineStatementHandler.Add(new TryCatchStmt());
            MultilineStatementHandler.Add(new SwitchStmt());
            MultilineStatementHandler.Add(new ForEachStmt());
        }