From a33fa666b687e942227381e8577ec7a31a2a818a Mon Sep 17 00:00:00 2001 From: "Chen, Chien-ting" Date: Sun, 20 Jun 2021 23:24:44 +0800 Subject: [PATCH] add something --- example/manual.clc | 46 ++++++++++++++++++++++++++++++------- playground/example1.clc | 0 src/Clochur/ClochurLexer.py | 3 ++- 3 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 playground/example1.clc diff --git a/example/manual.clc b/example/manual.clc index a99bffa..cb715bc 100644 --- a/example/manual.clc +++ b/example/manual.clc @@ -59,16 +59,46 @@ The functions that it has (although may be buggy or needed to be tested) is: Using 'def-syntax', you can add your macro to sile. the example is a "custom-section" macro: -[font-family "Noto Sans Mono CJK TC" +[font-family "Noto Sans Mono CJK TC" "123 + +124"] + +underline +bold +italic +font-size +font-family +font +begin +cons +car +cdr +ls-ref +ls +begin +script +docu-para +call +xml-to-string +SILE-STRING-ADD! +SILE +print +set! +def-syntax +define function, closure, lambda +str +str-append + + + + + +] % custom macro -"[def-syntax \"section\" -[[_ x][begin] ] -[set! section-title [str-append [str-append [str [str \"section-var\"]] [str \". \" ]] [str x]]] +%[set! section-title [str-append [str-append [str [str \"section-var\"]] [str \". \" ]] [str x]]] -[font [[size \"20pt\"][weight \"800\"]] [str \"section-title\"]] +%[font [[size \"20pt\"][weight \"800\"]] [str \"section-title\"]] -[set! [str \"section-var\"] [+ [str \"section-var\"] 1]] - -]]]" +%[set! [str \"section-var\"] [+ [str \"section-var\"] 1]] \ No newline at end of file diff --git a/playground/example1.clc b/playground/example1.clc new file mode 100644 index 0000000..e69de29 diff --git a/src/Clochur/ClochurLexer.py b/src/Clochur/ClochurLexer.py index ec77359..3f3e760 100644 --- a/src/Clochur/ClochurLexer.py +++ b/src/Clochur/ClochurLexer.py @@ -42,7 +42,8 @@ class ClochurLexer(QsciLexerCustom): operator_list = [ '-', '+', '*', '/', '>' ,'=','<','>=','<='] # SILE and SILE-STRING-ADD! is internal, so they're not added. function_list = ['if', 'docu', 'docu-para', 'script', 'call','xml-to-string', 'begin', - 'str','str-append','set!','print', 'define', 'def-syntax', 'lambda', 'eval'] + 'str','str-append','set!','print', 'define', 'def-syntax', 'lambda', 'eval','cons', + 'car','cdr','ls-ref','ls'] self.PRIMARY = macro_list + boolean_list + operator_list + function_list self.split_pattern = re.compile(r'(\s+|\\%|%|\\\[|\\\]|[[]|[]])')