4 #include "lexeme_impl.h"
8 using namespace utakata::lexeme;
9 using namespace utakata::utf8_string;
11 smart_ptr<ILexeme> utakata::lexeme::makeOpenParen()
13 return smart_ptr<ILexeme>(new OpenParen());
16 smart_ptr<ILexeme> utakata::lexeme::makeEOF()
18 return smart_ptr<ILexeme>(new EOFToken());
21 smart_ptr<ILexeme> utakata::lexeme::makeCloseParen()
23 return smart_ptr<ILexeme>(new CloseParen());
26 smart_ptr<ILexeme> utakata::lexeme::makeBackQuote()
28 return smart_ptr<ILexeme>(new BackQuote());
31 smart_ptr<ILexeme> utakata::lexeme::makeQuote()
33 return smart_ptr<ILexeme>(new Quote());
36 smart_ptr<ILexeme> utakata::lexeme::makeDot()
38 return smart_ptr<ILexeme>(new Dot());
41 smart_ptr<ILexeme> utakata::lexeme::makeIdentifier(const utakata::utf8_string::UTF8String& str)
43 return smart_ptr<ILexeme>(new Identifier(str));
46 smart_ptr<ILexeme> utakata::lexeme::makeString(const utakata::utf8_string::UTF8String& str)
48 return smart_ptr<ILexeme>(new String(str));
51 smart_ptr<ILexeme> utakata::lexeme::makeUnquoteSplicing(const utakata::utf8_string::UTF8String& str)
53 return smart_ptr<ILexeme>(new UnquoteSplicing());
56 smart_ptr<ILexeme> utakata::lexeme::makeUnquote()
58 return smart_ptr<ILexeme>(new Unquote());
61 smart_ptr<ILexeme> utakata::lexeme::makeByteVector()
63 return smart_ptr<ILexeme>(new ByteVector());
66 smart_ptr<ILexeme> utakata::lexeme::makeSyntax()
68 return smart_ptr<ILexeme>(new Syntax());
71 smart_ptr<ILexeme> utakata::lexeme::makeQuasiSyntax()
73 return smart_ptr<ILexeme>(new QuasiSyntax());
76 smart_ptr<ILexeme> utakata::lexeme::makeUnsyntaxSplicing()
78 return smart_ptr<ILexeme>(new UnsyntaxSplicing());
81 smart_ptr<ILexeme> utakata::lexeme::makeUnsyntax()
83 return smart_ptr<ILexeme>(new Unsyntax());
86 smart_ptr<ILexeme> utakata::lexeme::makeCharactor(const utakata::utf8_string::UTF8String& str)
88 return smart_ptr<ILexeme>(new Charactor(str));
91 smart_ptr<ILexeme> utakata::lexeme::makeBoolean(const smart_ptr<utakata::utf8_string::UTF8Char>& ch)
93 return smart_ptr<ILexeme>(new Boolean(ch));
96 smart_ptr<ILexeme> utakata::lexeme::makeNanImaginary(const utakata::utf8_string::UTF8String& str,
99 return smart_ptr<ILexeme>(new Number(utakata::utf8_string::UTF8String(),
103 smart_ptr<ILexeme> utakata::lexeme::makeInfImaginary(const utakata::utf8_string::UTF8String& str,
106 return smart_ptr<ILexeme>(new Number(utakata::utf8_string::UTF8String(),
110 smart_ptr<ILexeme> utakata::lexeme::makeImaginaryOnly(const utakata::utf8_string::UTF8String& str,
114 return smart_ptr<ILexeme>(new Number(utakata::utf8_string::UTF8String(),
118 smart_ptr<ILexeme> utakata::lexeme::makeNumber(const utakata::utf8_string::UTF8String& real,
119 const utakata::utf8_string::UTF8String& imagin,
120 bool exact, int radix)
122 return smart_ptr<ILexeme>(new Number(real, imagin, exact, radix));
132 int OpenParen::getID() const
134 return IDProxy()->openParenthesis;
137 smart_ptr<utakata::utf8_string::UTF8String> OpenParen::toString() const
139 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
140 *p += std::string("(");
148 int EOFToken::getID() const
150 return IDProxy()->eof;
153 smart_ptr<utakata::utf8_string::UTF8String> EOFToken::toString() const
155 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
156 *p += std::string("");
165 int CloseParen::getID() const
167 return IDProxy()->closeParenthesis;
170 smart_ptr<utakata::utf8_string::UTF8String> CloseParen::toString() const
172 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
173 *p += std::string(")");
181 int BackQuote::getID() const
183 return IDProxy()->backquote;
186 smart_ptr<utakata::utf8_string::UTF8String> BackQuote::toString() const
188 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
189 *p += std::string("`");
197 int Quote::getID() const
199 return IDProxy()->quote;
202 smart_ptr<utakata::utf8_string::UTF8String> Quote::toString() const
204 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
205 *p += std::string("'");
213 int Dot::getID() const
215 return IDProxy()->dot;
218 smart_ptr<utakata::utf8_string::UTF8String> Dot::toString() const
220 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
221 *p += std::string(".");
225 /////////////////////
226 // UnquoteSplicing //
227 /////////////////////
229 int UnquoteSplicing::getID() const
231 return IDProxy()->unquoteSplicing;
234 smart_ptr<utakata::utf8_string::UTF8String> UnquoteSplicing::toString() const
236 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
237 *p += std::string(",@");
245 int ByteVector::getID() const
247 return IDProxy()->unquoteSplicing;
250 smart_ptr<utakata::utf8_string::UTF8String> ByteVector::toString() const
252 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
253 *p += std::string("#vu8(");
262 int Unquote::getID() const
264 return IDProxy()->unquote;
267 smart_ptr<utakata::utf8_string::UTF8String> Unquote::toString() const
269 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
270 *p += std::string(",");
278 int Syntax::getID() const
280 return IDProxy()->syntax;
283 smart_ptr<utakata::utf8_string::UTF8String> Syntax::toString() const
285 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
286 *p += std::string("#'");
294 int QuasiSyntax::getID() const
296 return IDProxy()->quasiSyntax;
299 smart_ptr<utakata::utf8_string::UTF8String> QuasiSyntax::toString() const
301 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
302 *p += std::string("#`");
310 int Unsyntax::getID() const
312 return IDProxy()->unsyntax;
315 smart_ptr<utakata::utf8_string::UTF8String> Unsyntax::toString() const
317 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
318 *p += std::string("#,");
322 //////////////////////
323 // UnsyntaxSplicing //
324 //////////////////////
326 int UnsyntaxSplicing::getID() const
328 return IDProxy()->unsyntaxSplicing;
331 smart_ptr<utakata::utf8_string::UTF8String> UnsyntaxSplicing::toString() const
333 smart_ptr<utakata::utf8_string::UTF8String> p(new utf8_string::UTF8String);
334 *p += std::string("#,@");
342 Identifier::Identifier(const utakata::utf8_string::UTF8String& str) :
343 str_(new utakata::utf8_string::UTF8String(str))
346 int Identifier::getID() const
348 return IDProxy()->identifier;
351 smart_ptr<utakata::utf8_string::UTF8String> Identifier::toString() const
360 String::String(const utakata::utf8_string::UTF8String& str) :
361 str_(new utakata::utf8_string::UTF8String(str))
364 int String::getID() const
366 return IDProxy()->string;
369 smart_ptr<utakata::utf8_string::UTF8String> String::toString() const
378 Number::Number(const UTF8String& real,
379 const UTF8String& imagin,
380 bool exact, int radix) :
381 real_(new UTF8String(real)), imagin_(new UTF8String(imagin)),
382 exact_(exact), radix_(radix)
386 int Number::getID() const
388 return IDProxy()->number;
391 smart_ptr<utakata::utf8_string::UTF8String> Number::toString() const
393 return smart_ptr<UTF8String>(new UTF8String(*real_ + *imagin_));
400 Charactor::Charactor(const UTF8String& ch) : ch_(new UTF8String(ch))
403 int Charactor::getID() const
405 return IDProxy()->charactor;
408 smart_ptr<utakata::utf8_string::UTF8String> Charactor::toString() const
417 Boolean::Boolean(const smart_ptr<UTF8Char>& ch) : str_(new UTF8String())
422 int Boolean::getID() const
424 return IDProxy()->boolean;
427 smart_ptr<utakata::utf8_string::UTF8String> Boolean::toString() const