コード例 #1
0
ファイル: MacroSession.cs プロジェクト: AxFab/amy
        public void Compile(Queue<Token> store, List<Token> value, Macro md, HashSet<string> parents)
        {
            foreach (Token tk in value) {
            if (md != null && md.Arguments.Count > 0) {
              int aIdx = md.Arguments.IndexOf(tk.Litteral);
              if (aIdx >= 0) {
            // FIXME check args numbers
            Compile(store, currentArgs_[aIdx], null, parents);
            continue;
              }
            }

            Macro sub = FindMacro(tk.Litteral);
            bool cnt = !parents.Contains(tk.Litteral); // DEBUG
            if (sub != null && !parents.Contains(tk.Litteral)) {
              if (sub.Arguments.Count > 0) {
            // Read ARGS ON
              }

              HashSet<string> newHs = new HashSet<string>(parents);
              newHs.Add(sub.Name);
              Compile(store, sub.Value, md, newHs);
              continue;
            }

            store.Enqueue(tk);
              }
        }
コード例 #2
0
ファイル: MacroSession.cs プロジェクト: AxFab/amy
 public void Define(string name, List<Token> value = null, List<string> args = null)
 {
     Macro md;
       if (allMacros_.TryGetValue(name, out md)) {
     // AlreadyExist
     allMacros_.Remove(name);
       }
       md = new Macro(name, value, args);
       allMacros_.Add(name, md);
 }
コード例 #3
0
ファイル: MacroSession.cs プロジェクト: AxFab/amy
 public int SetUpMacro(Macro macro, Token token)
 {
     currentMacro_ = macro;
       // currentArgs_ = null;
       // currentIdx_ = 0;
       return macro.Arguments.Count;
 }