add something

This commit is contained in:
Tan, Kian-ting 2021-06-20 23:24:44 +08:00
parent c04efe041d
commit a33fa666b6
3 changed files with 40 additions and 9 deletions

View file

@ -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]]

0
playground/example1.clc Normal file
View file

View file

@ -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+|\\%|%|\\\[|\\\]|[[]|[]])')