Exemplo n.º 1
0
		public Function (string name, InstructionList tree, ArgumentInfo[] args) {
			this.name = name;
			this.tree = tree;
			this.args = args;
		}
Exemplo n.º 2
0
		public Function (string name, TokenList tokens, ArgumentInfo[] args) {
			this.name = name;
			this.tokens = tokens;
			this.args = args;
		}
Exemplo n.º 3
0
		private Function CreateFunction (TokenList func) {
			string name = (string) func[0].Val;
			
			ArrayList args_list = new ArrayList ();
			foreach (Token token in (TokenList) func[1].Val) {
				ArgumentInfo info = new ArgumentInfo ();

				if (token.Type == TokenType.Variable)
					info = new ArgumentInfo ((string) token.Val, null, false);
				else if (token.Type == TokenType.PlaceholderElement) {
					TokenList arg = (TokenList) ((Element) token.Val).Val;
					// FIXME: What if it is longer than 2 elements?
					if (arg.Count > 1)
						info = new ArgumentInfo ((string) arg[0].Val, arg[1].Val, false);
					else
						info = new ArgumentInfo ((string) arg[0].Val, null, true);
				}
				
				args_list.Add (info);
			}
			ArgumentInfo[] args = (ArgumentInfo[]) args_list.ToArray (typeof (ArgumentInfo)); 
			TokenList tokens = (TokenList) func[2].Val;

			return new Function (name, tokens, args);
		}