readme: use proper language modes for source code snippets

This commit is contained in:
2025-08-05 03:15:11 +03:00
committed by Alex Egorov
parent ea13df186f
commit d7055814d3

View File

@@ -35,7 +35,7 @@ Options:
If -E or -m options are provided, defaults to stdout If -E or -m options are provided, defaults to stdout
#+end_src #+end_src
** Compiling Hello World ** Compiling Hello World
#+begin_src #+begin_src shell
sexc ./examples/hell-world.sex -o hello sexc ./examples/hell-world.sex -o hello
#+end_src #+end_src
@@ -46,7 +46,7 @@ but you can pass any using ~--c-compiler~ option, or by setting
** Example ** Example
An example of Sex source: An example of Sex source:
#+begin_src #+begin_src scheme
(include stdio.h) (include stdio.h)
(pub fn int main ((int argc) (char **argv)) (pub fn int main ((int argc) (char **argv))
@@ -59,7 +59,7 @@ An example of Sex source:
#+end_src #+end_src
Compile and run: Compile and run:
#+begin_src #+begin_src shell
~/dev/sex $ ./sexc ./example/hello-world.sex -o hello-world ~/dev/sex $ ./sexc ./example/hello-world.sex -o hello-world
~/dev/sex $ ./hello-world ~/dev/sex $ ./hello-world
Hello from Sex! Hello from Sex!
@@ -97,7 +97,7 @@ return Sex code.
*** Examples: *** Examples:
**** Structure with templated value type **** Structure with templated value type
#+begin_src #+begin_src scheme
(pub defmacro (list-T type) (pub defmacro (list-T type)
(let ((list-type (cat 'list- type))) (let ((list-type (cat 'list- type)))
`(struct ,list-type `(struct ,list-type
@@ -107,14 +107,14 @@ return Sex code.
(list-T int) (list-T int)
#+end_src #+end_src
-> ->
#+begin_src #+begin_src scheme
(struct list_int (struct list_int
((int value) ((int value)
((* list_int) next))) ((* list_int) next)))
#+end_src #+end_src
**** Wrapper for checking return codes **** Wrapper for checking return codes
#+begin_src #+begin_src scheme
(pub defmacro (check-sdl-return call message ret-code) (pub defmacro (check-sdl-return call message ret-code)
`((if (< 0 ,call) `((if (< 0 ,call)
(begin (begin
@@ -127,7 +127,7 @@ return Sex code.
...) ...)
#+end_src #+end_src
-> ->
#+begin_src #+begin_src c
(%fun int init () (%fun int init ()
(if (< 0 (SDL_Init SDL_INIT_VIDEO)) (if (< 0 (SDL_Init SDL_INIT_VIDEO))
(%begin (puts "Failed to initialize SDL") (return 1))) (%begin (puts "Failed to initialize SDL") (return 1)))
@@ -142,7 +142,7 @@ best option.
*** sex-mode.el *** sex-mode.el
To harness the power of sex-mode, add the following lines to your To harness the power of sex-mode, add the following lines to your
~$HOME/.config/emacs/init.el~: ~$HOME/.config/emacs/init.el~:
#+begin_src #+begin_src emacs-lisp
(use-package sex-mode (use-package sex-mode
:load-path "/path/to/sex" :load-path "/path/to/sex"
:mode ("\\.sex\\'")) :mode ("\\.sex\\'"))