mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 00:10:27 +00:00
Add the parse function.
This commit is contained in:
parent
0a4d58468e
commit
9bc5ac05c4
@ -2,6 +2,7 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unreleased - ???
|
## Unreleased - ???
|
||||||
|
- Add the `parse` function to parse strings of source code more conveniently.
|
||||||
- Add `jpm rule-tree` subcommand.
|
- Add `jpm rule-tree` subcommand.
|
||||||
- Add `--offline` flag to jpm to force use of the cache.
|
- Add `--offline` flag to jpm to force use of the cache.
|
||||||
- Allow sending pointers and C functions across threads via `thread/send`.
|
- Allow sending pointers and C functions across threads via `thread/send`.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# This file is invoked by build_win.bat
|
# This file is invoked by build_win.bat
|
||||||
# Relevant configuration variables are set there.
|
# Relevant configuration variables are set there.
|
||||||
|
|
||||||
|
SetCompressor /FINAL /SOLID lzma
|
||||||
Unicode True
|
Unicode True
|
||||||
|
|
||||||
!echo "Program Files: ${PROGRAMFILES}"
|
!echo "Program Files: ${PROGRAMFILES}"
|
||||||
|
@ -2052,6 +2052,19 @@
|
|||||||
(res)
|
(res)
|
||||||
(error (res :error))))
|
(error (res :error))))
|
||||||
|
|
||||||
|
(defn parse
|
||||||
|
"Parse a string and return the first value. For complex parsing, such as for a repl with error handling,
|
||||||
|
use the parser api."
|
||||||
|
[str]
|
||||||
|
(let [p (parser/new)]
|
||||||
|
(parser/consume p str)
|
||||||
|
(parser/eof p)
|
||||||
|
(if (parser/has-more p)
|
||||||
|
(parser/produce p)
|
||||||
|
(if (= :error (parser/status p))
|
||||||
|
(error (parser/error p))
|
||||||
|
(error "no value")))))
|
||||||
|
|
||||||
(def make-image-dict
|
(def make-image-dict
|
||||||
"A table used in combination with marshal to marshal code (images), such that
|
"A table used in combination with marshal to marshal code (images), such that
|
||||||
(make-image x) is the same as (marshal x make-image-dict)."
|
(make-image x) is the same as (marshal x make-image-dict)."
|
||||||
|
Loading…
Reference in New Issue
Block a user