1 #ifndef _LEXEME_IMPL_H_
2 #define _LEXEME_IMPL_H_
6 #include "utf8_string.h"
14 // 各lexemeをsmart_ptrにして取得する。
15 smart_ptr<ILexeme> makeOpenParen();
16 smart_ptr<ILexeme> makeEOS();
17 smart_ptr<ILexeme> makeCloseParen();
18 smart_ptr<ILexeme> makeBackQuote();
19 smart_ptr<ILexeme> makeQuote();
20 smart_ptr<ILexeme> makeDot();
21 smart_ptr<ILexeme> makeUnquoteSplicing(const utakata::utf8_string::UTF8String& str);
22 smart_ptr<ILexeme> makeUnquote();
23 smart_ptr<ILexeme> makeSyntax();
24 smart_ptr<ILexeme> makeQuasiSyntax();
25 smart_ptr<ILexeme> makeUnsyntaxSplicing();
26 smart_ptr<ILexeme> makeUnsyntax();
27 smart_ptr<ILexeme> makeByteVector();
28 smart_ptr<ILexeme> makeVector();
29 smart_ptr<ILexeme> makeIdentifier(const utakata::utf8_string::UTF8String& str);
30 smart_ptr<ILexeme> makeString(const utakata::utf8_string::UTF8String& str);
31 smart_ptr<ILexeme> makeNumber(const utakata::utf8_string::UTF8String& real,
32 const utakata::utf8_string::UTF8String& imaginary,
33 bool exact, int radix);
34 smart_ptr<ILexeme> makeCharactor(const utakata::utf8_string::UTF8String& str);
35 smart_ptr<ILexeme> makeNanImaginary(const utakata::utf8_string::UTF8String& str,
37 smart_ptr<ILexeme> makeInfImaginary(const utakata::utf8_string::UTF8String& str,
39 smart_ptr<ILexeme> makeImaginaryOnly(const utakata::utf8_string::UTF8String& str,
41 smart_ptr<ILexeme> makeBoolean(const smart_ptr<utakata::utf8_string::UTF8Char>& ch);
44 ////////////////////////////////////////////
45 // 実際に利用するlexemeは以下に実装する。 //
46 ////////////////////////////////////////////
48 class OpenParen : public ILexeme
52 virtual ~OpenParen() {}
54 const lexeme::LexemeID getID() const;
55 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
58 class EOS : public ILexeme
64 const lexeme::LexemeID getID() const;
65 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
68 class CloseParen : public ILexeme
72 virtual ~CloseParen() {}
73 const lexeme::LexemeID getID() const;
74 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
78 class BackQuote : public ILexeme
82 virtual ~BackQuote(){}
83 const lexeme::LexemeID getID() const;
84 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
87 class Quote : public ILexeme
92 const lexeme::LexemeID getID() const;
93 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
97 class Dot : public ILexeme
102 const lexeme::LexemeID getID() const;
103 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
106 class UnquoteSplicing : public ILexeme
110 virtual ~UnquoteSplicing(){}
111 const lexeme::LexemeID getID() const;
112 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
116 class Unquote : public ILexeme
121 const lexeme::LexemeID getID() const;
122 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
125 class Syntax : public ILexeme
130 const lexeme::LexemeID getID() const;
131 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
134 class QuasiSyntax : public ILexeme
138 virtual ~QuasiSyntax(){}
139 const lexeme::LexemeID getID() const;
140 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
144 class UnsyntaxSplicing : public ILexeme
148 virtual ~UnsyntaxSplicing(){}
150 const lexeme::LexemeID getID() const;
151 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
155 class Unsyntax : public ILexeme
159 virtual ~Unsyntax(){}
160 const lexeme::LexemeID getID() const;
161 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
169 class Vector : public ILexeme
174 const lexeme::LexemeID getID() const;
175 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
183 class ByteVector : public ILexeme
187 virtual ~ByteVector(){}
188 const lexeme::LexemeID getID() const;
189 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
194 class String : public ILexeme
198 String(const utakata::utf8_string::UTF8String& ident);
200 const lexeme::LexemeID getID() const;
201 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
205 smart_ptr<utakata::utf8_string::UTF8String> str_;
208 class Identifier : public ILexeme
212 Identifier(const utakata::utf8_string::UTF8String& ident);
213 virtual ~Identifier(){}
214 const lexeme::LexemeID getID() const;
215 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
219 smart_ptr<utakata::utf8_string::UTF8String> str_;
222 class Number : public ILexeme
225 Number(const utf8_string::UTF8String& real, const utf8_string::UTF8String& imagin,
226 bool exact, int radix);
228 const lexeme::LexemeID getID() const;
229 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
233 smart_ptr<utakata::utf8_string::UTF8String> real_;
234 smart_ptr<utakata::utf8_string::UTF8String> imagin_;
239 class Charactor : public ILexeme
242 Charactor(const utf8_string::UTF8String& ch);
243 virtual ~Charactor(){}
245 const lexeme::LexemeID getID() const;
246 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
250 smart_ptr<utakata::utf8_string::UTF8String> ch_;
253 class Boolean : public ILexeme
256 Boolean(const smart_ptr<utf8_string::UTF8Char>& ch);
259 const lexeme::LexemeID getID() const;
260 smart_ptr<utakata::utf8_string::UTF8String> toString() const;
264 smart_ptr<utakata::utf8_string::UTF8String> str_;
271 #endif /* _LEXEME_IMPL_H_ */