mirror of
				https://github.com/Reuh/anselme.git
				synced 2025-10-27 16:49:31 +00:00 
			
		
		
		
	Add variable reference and use them in alias(ref, id)
This commit is contained in:
		
							parent
							
								
									037654ebcf
								
							
						
					
					
						commit
						acb8945dec
					
				
					 11 changed files with 138 additions and 45 deletions
				
			
		|  | @ -148,12 +148,18 @@ local function eval(state, exp) | |||
| 	-- variable | ||||
| 	elseif exp.type == "variable" then | ||||
| 		return get_variable(state, exp.name) | ||||
| 	-- function | ||||
| 	-- references | ||||
| 	elseif exp.type == "function reference" then | ||||
| 		return { | ||||
| 			type = "function reference", | ||||
| 			value = exp.names | ||||
| 		} | ||||
| 	elseif exp.type == "variable reference" then | ||||
| 		return { | ||||
| 			type = "variable reference", | ||||
| 			value = exp.name | ||||
| 		} | ||||
| 	-- function | ||||
| 	elseif exp.type == "function call" then | ||||
| 		-- eval args: list_brackets | ||||
| 		local args = {} | ||||
|  | @ -372,7 +378,7 @@ local function eval(state, exp) | |||
| 						if r then | ||||
| 							ret = r | ||||
| 						else | ||||
| 							return nil, ("%s; in Lua function %q"):format(e, exp.called_name) | ||||
| 							return nil, ("%s; in Lua function %q"):format(e or "raw function returned nil and no error message", exp.called_name) | ||||
| 						end | ||||
| 					-- untyped raw mode: same as raw, but strips custom types from the arguments | ||||
| 					elseif lua_fn.mode == "untyped raw" then | ||||
|  | @ -386,7 +392,7 @@ local function eval(state, exp) | |||
| 						if r then | ||||
| 							ret = r | ||||
| 						else | ||||
| 							return nil, ("%s; in Lua function %q"):format(e, exp.called_name) | ||||
| 							return nil, ("%s; in Lua function %q"):format(e or "untyped raw function returned nil and no error message", exp.called_name) | ||||
| 						end | ||||
| 					-- normal mode: convert args to Lua and convert back Lua value to Anselme | ||||
| 					elseif lua_fn.mode == nil then | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue