From b082c8123e572e24b0b28275f473faa101720010 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Wed, 5 Jun 2019 11:07:08 -0400 Subject: [PATCH] Update tm_language_gen. --- tools/tm_lang_gen.janet | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tools/tm_lang_gen.janet b/tools/tm_lang_gen.janet index 3f87392c..9d283026 100644 --- a/tools/tm_lang_gen.janet +++ b/tools/tm_lang_gen.janet @@ -2,6 +2,25 @@ # Used to help build the tmLanguage grammar. Emits # the entire .tmLanguage file for janet. +# Use dynamic binding and make this the first +# expression in the file to not pollute (all-bindings) +(setdyn :allsyms + (array/concat + @["break" + "def" + "do" + "var" + "set" + "fn" + "while" + "if" + "quote" + "quasiquote" + "unquote" + "splice"] + (all-bindings))) +(def allsyms (dyn :allsyms)) + (def grammar-template ````` @@ -343,22 +362,6 @@ # Now we generate the bindings in the language. -(def- specials - @["break" - "def" - "do" - "var" - "set" - "fn" - "while" - "if" - "quote" - "quasiquote" - "unquote" - "splice"]) - -(def allsyms (array/concat @[] specials (all-bindings))) - (def- escapes {(get "|" 0) `\|` (get "-" 0) `\-`