<commit_before>local declarations = {}
local variables = {}
local std = stead

local type = std.type
local rawget = std.rawget
local rawset = std.rawset
local pairs = std.pairs
local table = std.table
local next = std.next

local function __declare(n, t)
	if stead.game then
		std.err ("Use "..t.." only in global context", 2)
	end
	if type(n) ~= 'table' then
		std.err ("Wrong parameter to "..n, 2)
	end
	for k, v in std.pairs(n) do
		if declarations[k] then
			std.err ("Duplicate declaration: "..k, 2)
		end
		if type(v) == 'function' then
			std.functions[v] = k
		end
		declarations[k] = {value = v, type = t}
		if t == 'global' then
			if type(v) == 'function' then
				std.err("Use declare to declare function: "..k, 3)
			end
			rawset(_G, k, v)
			variables[k] = true
		end
	end<commit_msg>new declare form: declare 'name' (val)<commit_after>local declarations = {}
local variables = {}
local std = stead

local type = std.type
local rawget = std.rawget
local rawset = std.rawset
local pairs = std.pairs
local table = std.table
local next = std.next

local function __declare_one(k, v, t)
	if declarations[k] then
		std.err ("Duplicate declaration: "..k, 3)
	end
	if type(v) == 'function' then
		std.functions[v] = k
	end
	declarations[k] = {value = v, type = t}
	if t == 'global' then
		if type(v) == 'function' then
			std.err("Use declare to declare function: "..k, 3)
		end
		rawset(_G, k, v)
		variables[k] = true
	end
end

local function __declare(n, t)
	if stead.game then
		std.err ("Use "..t.." only in global context", 2)
	end
	if type(n) == 'string' then
		return function(v)
			__declare_one(n, v, t)
		end
	end
	if type(n) ~= 'table' then
		std.err ("Wrong parameter to "..n, 2)
	end
	for k, v in std.pairs(n) do
		__declare_one(k, v, t)
	end
{'fraction_non_alphanumeric': 0.14002267573696145, 'fraction_numerical': 0.0045351473922902496, 'mean_word_length': 3.315403422982885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '42410', 'n_tokens_mistral': 721, 'n_tokens_neox': 663, 'n_words': 228}