X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Freport.git;a=blobdiff_plain;f=pret-lam.lua;h=a87137c0dc0b2428a1484552fe7d0357781f2fcf;hp=94dd81085a9aa53617c262c12315a094864d82fe;hb=6493f3173bbe36cdcd51ea6fc607966e10373944;hpb=207cddf520024052b4da9040aa3a9636f30924db diff --git a/pret-lam.lua b/pret-lam.lua index 94dd810..a87137c 100644 --- a/pret-lam.lua +++ b/pret-lam.lua @@ -21,9 +21,13 @@ buffers.visualizers.lam.tokens = { [' '] = {repr = '\\obs '}, ['_'] = {repr = '\\_'}, ['->'] = {repr = '\\rightarrow'}, + -- The default * sits very high above the baseline, \ast (u+2217) looks + -- better. + ['*'] = {repr = '\\ast'}, ['case'] = {style = 'bold'}, ['of'] = {style = 'bold'}, ['let'] = {style = 'bold'}, + ['in'] = {style = 'bold'}, } function buffers.visualizers.lam.flush_line(str,nested) @@ -52,8 +56,10 @@ function buffers.visualizers.lam.flush_line(str,nested) end end if not found then - result[#result+1] = utf.sub(str, 1, 1) - str = utf.sub(str, 2) + -- Take a full word, or a single character. Taking a full word is + -- to prevent matching "in" in "bind" , for example. + result[#result+1] = utf.match(str, "^%a+") or utf.sub(str, 1, 1) + str = utf.sub(str, utf.len(result[#result]) + 1) end end state = finish(state, result)