diff options
| -rw-r--r-- | core/text.nom | 2 | ||||
| -rw-r--r-- | parser.lua | 1 | ||||
| -rw-r--r-- | parser.moon | 1 |
3 files changed, 3 insertions, 1 deletions
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] @@ -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 |
