1 #ifndef _LEXEME_DATA_H_
2 #define _LEXEME_DATA_H_
5 #include "src/common/smart_ptr.h"
17 // 文字列を保持するためのデータ型. たんにそのまま.
18 smart_ptr<unicode::UniString> str;
22 // 数値のデータの受け渡しを行うためのデータ型.
23 // 数値データは, それぞれ実数部分と虚数部分, そして
24 // 正確性と radix を定義する必要がある.
25 // radix = 10 ではない場合, 常に exact = true として振る舞う.
26 smart_ptr<unicode::UniString> real;
27 smart_ptr<unicode::UniString> imagin;
33 // Boolean を表すデータ. これでは bool 型の変数によって#t と#f を表現
36 smart_ptr<unicode::UniString> str;
39 struct CharactorData {
40 // Charactor を構成するためのデータ.
41 // この時点で、渡された文字列から数値に変換が完了しているものとする。
42 smart_ptr<unicode::UniChar> spec;
47 smart_ptr<unicode::UniString> id;
51 // リテラルとして存在するデータの一部のみを
53 // このデータは, 実際には Lexeme と Object 間でのデータの受け渡しを
54 // 行うためのインタフェースとなっている.
55 // この上のlexemeによって、返される値が確定されると仮定するため、
58 smart_ptr<StringData> string;
59 smart_ptr<NumberData> number;
60 smart_ptr<BooleanData> boolean;
61 smart_ptr<CharactorData> charactor;
62 smart_ptr<SymbolData> symbol;
65 // 各データ入りのLiteralDataを返すヘルパー関数。
66 smart_ptr<LexemeData> makeStringData(const unicode::UniString& str);
67 smart_ptr<LexemeData> makeNumberData(const unicode::UniString& real,
68 const unicode::UniString& imagin,
69 bool exact, bool radix);
70 smart_ptr<LexemeData> makeBooleanData(const unicode::UniString& str,
72 smart_ptr<LexemeData> makeCharactorData(const unicode::UniChar& ch);
73 smart_ptr<LexemeData> makeSymbolData(const unicode::UniString& str);
77 #endif /* _LEXEME_DATA_H_ */