diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-02 06:25:02 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-02 06:25:02 -0700 |
commit | dead4e05c9ea34c79047eba84949ec366a8ba6b2 (patch) | |
tree | f02f7c2625d226b2f49116d17618d9923d43fd9c /txr.1 | |
parent | edd182e778e116f2c2c62fbc09102372b0c03500 (diff) | |
download | txr-dead4e05c9ea34c79047eba84949ec366a8ba6b2.tar.gz txr-dead4e05c9ea34c79047eba84949ec366a8ba6b2.tar.bz2 txr-dead4e05c9ea34c79047eba84949ec366a8ba6b2.zip |
New function: txr-parse.
txr-parse provides a way for Lisp code to programmatically
parse the TXR language and obtain the Lisp represenation.
This has hitherto not been available.
* eval.c (eval_init): Register txr-parse intrinsic.
* parser.c (txr_parse): New function.
* parser.h (txr_parse): Declared.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -63810,6 +63810,56 @@ otherwise the forms are evaluated in order and the value of the last one specifies the result of .codn txr-case . +.coNP Function @ txr-parse +.synb +.mets (txr-parse >> [ source >> [ error-stream +.mets \ \ \ \ \ \ \ \ \ \ \ >> [ error-retval <> [ name ]]]]) +.syne +.desc +The +.code txr-parse +function converts textual \*(TX query syntax into a Lisp data +structure representation. + +The +.meta source +argument may be either a character +string, or a stream. If it is omitted, then +.code *stdin* +is used as the stream. + +The +.meta source +must provide the text representation of one complete \*(TX query. + +The optional +.meta error-stream +argument can be used to specify a stream to which +parse errors diagnostics are sent. If absent, the diagnostics are suppressed. + +The optional +.meta name +argument can be used to specify the file name which is used for reporting +errors. If this argument is missing, the name is taken from the name +property of the +.meta source +argument if it is a stream, or else the word +.code string +is used as the name if +.meta source +is a string. + +If there are no parse errors, the function returns the parsed data +structure. If there are parse errors, and the +.meta error-retval +parameter is +present, its value is returned. If the +.meta error-retval +parameter +is not present, then an exception of type +.code syntax-error +is thrown. + .SS* Debugging Functions .coNP Functions @ source-loc and @ source-loc-str .synb |