mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 21:35:03 +00:00
shortcut for quote
This commit is contained in:
parent
9e03179650
commit
51058b18d3
@ -17,7 +17,14 @@ class Reader
|
||||
|
||||
private function readForm(array $tokens, int &$index)
|
||||
{
|
||||
if ($tokens[$index] == '(') {
|
||||
if ($tokens[$index] == "'") {
|
||||
$index++;
|
||||
$contents = [new Symbol('quote')];
|
||||
if ($index < count($tokens) && !in_array($tokens[$index], [')', ']', '}'])) {
|
||||
$contents[] = $this->readForm($tokens, $index);
|
||||
}
|
||||
return new MList($contents);
|
||||
} elseif ($tokens[$index] == '(') {
|
||||
return $this->readList($tokens, $index);
|
||||
} elseif ($tokens[$index] == '[') {
|
||||
return $this->readVector($tokens, $index);
|
||||
|
Loading…
Reference in New Issue
Block a user