scansion.parser: Allow property names to contain underscore

Wed, 28 Oct 2015 02:11:36 +0100

author
Kim Alvefur <zash@zash.se>
date
Wed, 28 Oct 2015 02:11:36 +0100
changeset 47
1cbc0d9d132d
parent 46
d711bf1e9979
child 48
6450aea6c564

scansion.parser: Allow property names to contain underscore

scansion/parser.lua file | annotate | diff | comparison | revisions
--- a/scansion/parser.lua	Tue Oct 27 23:14:19 2015 +0000
+++ b/scansion/parser.lua	Wed Oct 28 02:11:36 2015 +0100
@@ -22,11 +22,11 @@
 				defined_line = line_number;
 			};
 			last_object = parsed.objects[name];
-		elseif line:match("^%s+%a+:.+$") then
+		elseif line:match("^%s+[%a_]+:.+$") then
 			if not last_object then
 				return nil, "Line "..line_number.. "unexpected outside of an object definition";
 			end
-			local k, v = line:match("^%s+(%a+):%s*(.+)$")
+			local k, v = line:match("^%s+([%a_]+):%s*(.+)$")
 			last_object[k] = v;
 		elseif #parsed.actions > 0 and line:sub(1,1) == "\t" then
 			table.insert(parsed.actions[#parsed.actions].extra, line:sub(2));

mercurial