diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-02 20:17:52 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-02 20:17:52 -0700 |
| commit | 9251b462dae2ee808a57c17518697916e3db4c6f (patch) | |
| tree | 4e3e09c2258479472188518d019486ad8fe6b581 /nomsu.moon | |
| parent | e3200dece1ba596c84fe69640db683e0973e926b (diff) | |
Fixed one compiler bug with comments immediately after indenting
Diffstat (limited to 'nomsu.moon')
| -rwxr-xr-x | nomsu.moon | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -27,8 +27,10 @@ colored = setmetatable({}, {__index:(_,color)-> ((msg)-> colors[color]..msg..col -- provide way to run precompiled nomsu -> lua code from nomsu -- better scoping? -- better error reporting +-- fix propagation of filename for error reporting -- add line numbers of function calls -- type checking? +-- Fix compiler bug that breaks when file ends with a block comment lpeg.setmaxstack 10000 -- whoa {:P,:V,:S,:Cg,:C,:Cp,:B,:Cmt} = lpeg @@ -130,12 +132,12 @@ nomsu = [=[ list_line <- (inline_list_item comma)* ((inline_list_item %ws? ",") / (functioncall / expression)) inline_list_item <- inline_functioncall / inline_expression - block_comment <- "#.." [^%nl]* indent [^%nl]* (%nl ((%ws? (!. / &%nl)) / (!%dedented [^%nl]*)))* + block_comment <- "#.." [^%nl]* (%nl (%ws? &%nl))* %nl %indented [^%nl]+ (%nl ((%ws? (!. / &%nl)) / (!%dedented [^%nl]+)))* line_comment <- "#" [^%nl]* eol <- %ws? line_comment? (!. / &%nl) ignored_line <- (%nodented (block_comment / line_comment)) / (%ws? (!. / &%nl)) - indent <- eol (%nl ignored_line)* %nl %indented + indent <- eol (%nl ignored_line)* %nl %indented ((block_comment/line_comment) (%nl ignored_line)* nodent)? nodent <- eol (%nl ignored_line)* %nl %nodented dedent <- eol (%nl ignored_line)* (((!.) &%dedented) / (&(%nl %dedented))) tok_gap <- %ws / %prev_edge / &("[" / "\" / [.,:;{("#%']) |
