00001 // +-------------------------------------------------------------------------+ 00002 // | I__n__t__e__L__i__b 0.6.10 development | 00003 // | Copyright (c) Andrey Vikt. Stolyarov <crocodil_AT_croco.net> 2000-2007. | 00004 // | | 00005 // | This is free software. The library part is available under | 00006 // | GNU LESSER GENERAL PUBLIC LICENSE v.2.1. | 00007 // | GNU LGPL v2.1 is found in docs/gnu_gpl2.txt, or at http://www.gnu.org | 00008 // | Please see also docs/readme.txt and visit http://www.intelib.org | 00009 // | | 00010 // | !!! THERE IS NO WARRANTY OF ANY KIND, NEITHER EXPRESSED NOR IMPLIED !!! | 00011 // +-------------------------------------------------------------------------+ 00012 00013 00014 00015 00016 #include "../sexpress/svector.hpp" 00017 #include "../sexpress/shashtbl.hpp" 00018 #include "scheme.hpp" 00019 #include "schreadr.hpp" 00020 00022 // transformer 00023 00024 static SReference QuoteExpression(const SReference &ref) 00025 { 00026 return ~(SchReference(ref)); 00027 } 00028 00029 static SReference InvalidLexem(const char *) 00030 { 00031 static SLabel inv("#<UNREADABLE-TOKEN>"); 00032 return inv; 00033 } 00034 00036 // SchemeReader 00037 00038 SchemeReader::SchemeReader() 00039 { 00040 AddStringLiteral("#<", '>', InvalidLexem); 00041 AddQuoter("'", QuoteExpression); 00042 add_vectors_to_reader(*this); 00043 add_hashtables_to_reader(*this); 00044 AddDelimiter("#T", *PTheSchemeBooleanTrue); 00045 AddDelimiter("#t", *PTheSchemeBooleanTrue); 00046 AddDelimiter("#F", *PTheSchemeBooleanFalse); 00047 AddDelimiter("#f", *PTheSchemeBooleanFalse); 00048 } 00049