Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

!parse-bool

  • Loading branch information...
commit a9e51d7f070c2f58d8ff7ef6ad10600e627e6411 1 parent 7519da0
authored
BIN  plc/stdlib/parser.bc
Binary file not shown
12 plc/stdlib/parser.lisp
@@ -74,17 +74,25 @@
74 74 (read-char in) ; eat #\)
75 75 (!parse-list-impl in)))
76 76
  77 + (define !parse-boolean-or-char (lambda (in)
  78 + (read-char in) ; eat #\#
  79 + (case (read-char in)
  80 + ((#\\) (!parse-char in))
  81 + ((#\t) #t)
  82 + ((#\f) #f)
  83 + (else (undef)))))
  84 +
77 85 (define !parse-port (lambda (in)
78 86 (!skip-whitespace in)
79 87 (let ((ch (peek-char in)))
80 88 (case (!char-type ch)
81   - ((@eof) 1)
  89 + ((@eof) (undef))
82 90 ((@comment) (!skip-comment-line in) (!parse-port in))
83 91 ((@string) (!parse-string in))
84 92 ((@list) (!parse-list in))
85 93 ((@quote) (!parse-quote in))
86 94 ((@symbol) (!parse-symbol in))
87   - ((@boolean-or-char) 8)
  95 + ((@boolean-or-char) (!parse-boolean-or-char in))
88 96 ((@maybe-number) 9)))))
89 97
90 98 (define !parse-file (lambda (filepath)
5 plvm/include/psil/vm/Native.hh
@@ -240,6 +240,10 @@ namespace psil {
240 240 push(env, head);
241 241 }
242 242
  243 + static void _undef(Environment& env, uint1 arity) {
  244 + push(env, Undef::make());
  245 + }
  246 +
243 247 static void _is_eqv(Environment& env, uint1 arity) {
244 248 Object* x = pop(env);
245 249 Object* y = pop(env);
@@ -335,6 +339,7 @@ namespace psil {
335 339 reg("STRING-REF", _string_ref);
336 340 reg("STRING-SET!", _string_set);
337 341 reg("STRING->SYMBOL", _string_to_symbol);
  342 + reg("UNDEF", _undef);
338 343
339 344 regval("STDIN", &Port::STDIN);
340 345 regval("STDOUT", &Port::STDOUT);

0 comments on commit a9e51d7

Please sign in to comment.
Something went wrong with that request. Please try again.