mirror of
https://github.com/elladunbar/tree-sitter-hy.git
synced 2025-11-05 14:59:55 -06:00
Add more structured syntax
This commit is contained in:
parent
d330f85c67
commit
66026fe74b
11 changed files with 18956 additions and 4528 deletions
30
test/highlight/highlight_examples.hy
Normal file
30
test/highlight/highlight_examples.hy
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
(setv foobar (+ 2 2))
|
||||
(setv [tim eric] ["jim" "derrick"])
|
||||
(setv alpha "a" beta "b")
|
||||
|
||||
(sorted "abcBC"
|
||||
:key (fn [x] (.lower x)))
|
||||
|
||||
(defn test [a b [c "x"] #* d]
|
||||
[a b c d])
|
||||
|
||||
(with [o (open "file.txt" "rt")]
|
||||
(setv buffer [])
|
||||
(while (< (len buffer) 10)
|
||||
(.append buffer (next o))))
|
||||
|
||||
(lfor
|
||||
x (range 3)
|
||||
y (range 3)
|
||||
:if (= (+ x y) 3)
|
||||
(* x y))
|
||||
|
||||
(defmacro do-while [test #* body]
|
||||
`(do
|
||||
~@body
|
||||
(while ~test
|
||||
~@body)))
|
||||
|
||||
(setv x 0)
|
||||
(do-while x
|
||||
(print "Printed once."))
|
||||
Loading…
Add table
Add a link
Reference in a new issue