diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-27 10:22:58 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-27 10:23:02 -0700 |
| commit | 09d6bad6ac0d4509552d424471bcace649f69c8e (patch) | |
| tree | 90b7ee5d2714deeee0c769de8ecde810e6bbb229 | |
| parent | 65dc1f2196b46dbd527d49da113515bea825416d (diff) | |
Minor fixes.
| -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 |
