From 09d6bad6ac0d4509552d424471bcace649f69c8e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 27 Jun 2018 10:22:58 -0700 Subject: Minor fixes. --- core/text.nom | 2 +- parser.lua | 1 + parser.moon | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/text.nom b/core/text.nom index a9b2540..840a596 100644 --- a/core/text.nom +++ b/core/text.nom @@ -15,7 +15,7 @@ parse [joined %texts, %texts joined] as: %texts joined with "" compile [capitalized %text, %text capitalized] to Lua value "((\(%text as lua expr)):gsub('%l', string.upper, 1))" -compile [%text with %sub instead of %patt, %text s/%patt/%sub] to +compile [%text with %sub instead of %patt, %text with %patt replaced by %sub, %text s/%patt / %sub] to Lua value "((\(%text as lua expr)):gsub(\(%patt as lua expr), \(%sub as lua expr)))" action [lines in %text, lines of %text] diff --git a/parser.lua b/parser.lua index f856c88..f4ce450 100644 --- a/parser.lua +++ b/parser.lua @@ -153,6 +153,7 @@ Parser.parse = function(nomsu_code, source) if source == nil then source = nil end + source = source or nomsu_code.source nomsu_code = tostring(nomsu_code) local userdata = { indent = "", diff --git a/parser.moon b/parser.moon index d8bd834..c179b03 100644 --- a/parser.moon +++ b/parser.moon @@ -112,6 +112,7 @@ NOMSU_PATTERN = do re.compile(nomsu_peg, NOMSU_DEFS) Parser.parse = (nomsu_code, source=nil)-> + source or= nomsu_code.source nomsu_code = tostring(nomsu_code) userdata = { indent: "", errors: {}, :source -- cgit v1.2.3