10 class utakata::utf8_string::CUTF8InputStream;
11 class utakata::utf8_string::CUTF8String;
14 // lexer名前空間で使用されるそれぞれの終端記号と
15 // それらを解析するための関数オブジェクトを定義する。
20 <identifier>を解釈するためのfunctor。
21 <identifier>は次のBNF構文で定義される。
23 <identifier> - <initial> <subsequent>*
24 | <peculiar identifier>
26 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
32 <initial>を解釈するためのfunctor。
33 <initial>は次のBNF構文で定義される。
35 <initial> - <constituent> | <special initial>
38 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
41 struct CConstituentLexer
44 <constituent>を解釈するためのfunctor。
45 <constituent>は次のBNF構文で定義される。
47 <constituent> - <letter>
48 | 〈any character whose Unicode scalar value is greater than
49 127, and whose category is Lu, Ll, Lt, Lm, Lo, Mn,
50 Nl, No, Pd, Pc, Po, Sc, Sm, Sk, So, or Co〉
52 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
58 <letter>を解釈するためのfunctor。
59 <letter>は次のBNF構文で定義される。
61 <letter> - a | b | c | ... | z
64 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
67 struct CSpecialInitialLexer
70 <special initial>を解釈するためのfunctor。
71 <special initial>は次のBNF構文で定義される。
72 <special initial> - ! | $ | % | & | * | / | : | < | =
76 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
82 <digit>を解釈するためのfunctor。
83 <digit>は次のBNF構文で定義される。
84 <digit> - 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
86 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
92 <hex digit>を解釈するためのfunctor。
93 <hex digit>は次のBNF構文で定義される。
95 | a | A | b | B | c | C | d | D | e | E | f
98 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
101 struct CSpecialSubsequentLexer
104 <special subsequent>を解釈するためのfunctor。
105 <special subsequent>は次のBNF構文で定義される。
106 <special subsequent> → + | - | . | @
108 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
111 struct CInlineHexEscapeLexer
114 <inline hex escape>を解釈するためのfunctor
115 <inline hex escape>は次のBNF構文で定義される。
116 <inline hex escape> - \x<hex scalar value>;
118 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
121 struct CHexScalarValueLexer
123 //<hex scalar value>を解釈するためのfunctor。
124 //<hex scalar value>は次のBNF構文で定義される。
125 //<hex scalar value> - <hex digit>+
126 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
131 // <boolean>を解釈するためのfunctor。
132 // <boolean>は次のBNF構文で定義される。
133 // <boolean> - #t | #T | #f | #F
134 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
137 struct CCharactorLexer
139 // <charactor>を解釈するためのfunctor。
140 // <charactor>は次のBNF構文で定義される。
141 // <character> - #\<any character>
142 // | #\<character name>
143 // | #\x<hex scalar value>
144 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
147 struct CCharactorNameLexer
149 // <character name>を解釈するためのfunctor。
150 // <charactor name>は次のBNF構文で定義される。
151 // <character name> - nul | alarm | backspace | tab
152 // | linefeed | newline | vtab | page | return
153 // | esc | space | delete
155 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
160 // <string>を解釈するためのfunctor。
161 // <string>は次のBNF構文で定義される。
162 // <string> - " <string element>* "
163 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
166 struct CStringElementLexer
168 // <string element>を解釈するためのfunctor。
169 // <string element>は次のBNF構文で定義される。
170 // <string element> - <any character other than " or \>
171 // | \a | \b | \t | \n | \v | \f | \r
173 // | \<intraline whitespace>*<line ending>
174 // <intraline whitespace>*
175 // | <inline hex escape>
176 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
179 struct CIntralineWhitespaceLexer
181 // <intraline whitespace>を解釈するためのfunctor。
182 // <intraline whitespace>は次のBNF構文で定義される。
183 // <intraline whitespace> - <character tabulation>
184 // | <any character whose category is Zs>
185 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
188 struct CDelimiterlexer
190 // <delimiter>を解釈するためのfunctor。
191 // <delimiter>は次のBNF構文で定義される。
192 // <delimiter> - ( | ) | [ | ] | " | ; | #
194 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
197 struct CWhitespaceLexer
199 // <whitespace>を解釈するためのfunctor。
200 // <whitespace>は次のBNF構文で定義される。
201 // <whitespace> - <character tabulation>
202 // | <linefeed> | <line tabulation> | <form feed>
203 // | <carriage return> | <next line>
204 // | <any character whose category is Zs, Zl, or Zp>
205 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
208 struct CLineEndingLexer
210 // <line ending>を解釈するためのfunctor。
211 // <line ending>は次のBNF構文で定義される。
212 // <line ending> - <linefeed> | <carriage return>
213 // | <carriage return> <linefeed> | <next line>
214 // | <carriage return> <next line> | <line separator>
215 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
220 // <comment>を解釈するためのfunctor。
221 // <comment>は次のBNF構文で定義される。
222 // <comment> - ; 〈all subsequent characters up to a
223 // <line ending> or <paragraph separator>〉
224 // | <nested comment>
225 // | #; <interlexeme space> <datum>
227 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
230 struct CNestedCommentLexer
232 // <nested comment>を解釈するためのfunctor。
233 // <nested comment>は次のBNF構文で定義される。
234 // <nested comment> - #| <comment text>
235 // <comment cont>* |#
236 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
239 struct CCommentTextLexer
241 // <comment text>を解釈するためのfunctor。
242 // <comment text>は次のBNF構文で定義される。
243 // <comment text> - 〈character sequence not containing
245 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
248 struct CCommentContLexer
250 // <comment cont>を解釈するためのfunctor。
251 // <comment cont>は次のBNF構文で定義される。
252 // <comment cont> - <nested comment> <comment text>
253 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
259 // <number>を解釈するためのfunctor。
260 // <number>は次のBNF構文で定義される。
261 // <number> - <num 2> | <num 8>
262 // | <num 10> | <num 16>
263 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
268 // <num 2>を解釈するためのfunctor。
269 // <num 2>は次のBNF構文で定義される。
270 // <num R> - <prefix R> <complex R>
271 // <complex 2> - <real 2> | <real 2> @ <real 2>
272 // | <real 2> + <ureal 2> i | <real 2> - <ureal 2> i
273 // | <real 2> + <naninf> i | <real 2> - <naninf> i
274 // | <real 2> + i | <real 2> - i
275 // | + <ureal 2> i | - <ureal 2> i
276 // | + <naninf> i | - <naninf> i
278 // <real 2> - <sign> <ureal 2>
279 // | + <naninf> | - <naninf>
280 // <naninf> - nan.0 | inf.0
281 // <ureal 2> - <uinteger 2>
282 // | <uinteger 2> / <uinteger 2>
283 // | <decimal 2> <mantissa width>
284 // <decimal 10> - <uinteger 10> <suffix>
285 // | . <digit 10>+ <suffix>
286 // | <digit 10>+ . <digit 10>* <suffix>
287 // <uinteger 2> - <digit 2>+
288 // <prefix 2> - <radix 2> <exactness>
289 // | <exactness> <radix 2>
291 // <suffix> - <empty>
292 // | <exponent marker> <sign> <digit 10>+
293 // <exponent marker> - e | E | s | S | f | F
295 // <mantissa width> - <empty>
297 // <sign> - <empty> | + | -
298 // <exactness> - <empty>
300 // <radix 2> - #b| #B
302 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
307 // <num 8>を解釈するためのfunctor。
308 // <num 8>は次のBNF構文で定義される。
309 // <num R> - <prefix R> <complex R>
310 // <complex 8> - <real 8> | <real 8> @ <real 8>
311 // | <real 8> + <ureal 8> i | <real 8> - <ureal 8> i
312 // | <real 8> + <naninf> i | <real 8> - <naninf> i
313 // | <real 8> + i | <real 8> - i
314 // | + <ureal 8> i | - <ureal 8> i
315 // | + <naninf> i | - <naninf> i
317 // <real 8> - <sign> <ureal 8>
318 // | + <naninf> | - <naninf>
319 // <naninf> - nan.0 | inf.0
320 // <ureal 8> - <uinteger 8>
321 // | <uinteger 8> / <uinteger 8>
322 // | <decimal 8> <mantissa width>
323 // <decimal 10> - <uinteger 10> <suffix>
324 // | . <digit 10>+ <suffix>
325 // | <digit 10>+ . <digit 10>* <suffix>
326 // <uinteger 8> - <digit 8>+
327 // <prefix 8> - <radix 8> <exactness>
328 // | <exactness> <radix 8>
330 // <suffix> - <empty>
331 // | <exponent marker> <sign> <digit 10>+
332 // <exponent marker> - e | E | s | S | f | F
334 // <mantissa width> - <empty>
336 // <sign> - <empty> | + | -
337 // <exactness> - <empty>
339 // <radix 8> - #b| #B
341 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
346 // <num 10>を解釈するためのfunctor。
347 // <num 10>は次のBNF構文で定義される。
348 // <num R> - <prefix R> <complex R>
349 // <complex 10> - <real 10> | <real 10> @ <real 10>
350 // | <real 10> + <ureal 10> i | <real 10> - <ureal 10> i
351 // | <real 10> + <naninf> i | <real 10> - <naninf> i
352 // | <real 10> + i | <real 10> - i
353 // | + <ureal 10> i | - <ureal 10> i
354 // | + <naninf> i | - <naninf> i
356 // <real 10> - <sign> <ureal 10>
357 // | + <naninf> | - <naninf>
358 // <naninf> - nan.0 | inf.0
359 // <ureal 10> - <uinteger 10>
360 // | <uinteger 10> / <uinteger 10>
361 // | <decimal 10> <mantissa width>
362 // <decimal 10> - <uinteger 10> <suffix>
363 // | . <digit 10>+ <suffix>
364 // | <digit 10>+ . <digit 10>* <suffix>
365 // <uinteger 10> - <digit 10>+
366 // <prefix 10> - <radix 10> <exactness>
367 // | <exactness> <radix 10>
369 // <suffix> - <empty>
370 // | <exponent marker> <sign> <digit 10>+
371 // <exponent marker> - e | E | s | S | f | F
373 // <mantissa width> - <empty>
375 // <sign> - <empty> | + | -
376 // <exactness> - <empty>
378 // <radix 10> - #b| #B
379 // <digit 10> - 0 | 1
380 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
385 // <num 16>を解釈するためのfunctor。
386 // <num 16>は次のBNF構文で定義される。
387 // <num R> - <prefix R> <complex R>
388 // <complex 16> - <real 16> | <real 16> @ <real 16>
389 // | <real 16> + <ureal 16> i | <real 16> - <ureal 16> i
390 // | <real 16> + <naninf> i | <real 16> - <naninf> i
391 // | <real 16> + i | <real 16> - i
392 // | + <ureal 16> i | - <ureal 16> i
393 // | + <naninf> i | - <naninf> i
395 // <real 16> - <sign> <ureal 16>
396 // | + <naninf> | - <naninf>
397 // <naninf> - nan.0 | inf.0
398 // <ureal 16> - <uinteger 16>
399 // | <uinteger 16> / <uinteger 16>
400 // | <decimal 16> <mantissa width>
401 // <decimal 10> - <uinteger 10> <suffix>
402 // | . <digit 10>+ <suffix>
403 // | <digit 10>+ . <digit 10>* <suffix>
404 // <uinteger 16> - <digit 16>+
405 // <prefix 16> - <radix 16> <exactness>
406 // | <exactness> <radix 16>
408 // <suffix> - <empty>
409 // | <exponent marker> <sign> <digit 10>+
410 // <exponent marker> - e | E | s | S | f | F
412 // <mantissa width> - <empty>
414 // <sign> - <empty> | + | -
415 // <exactness> - <empty>
417 // <radix 16> - #b| #B
418 // <digit 16> - 0 | 1
419 smart_ptr<CLexeme> operator()(smart_ptr<utakata::utf8_string::CUTF8InputStream>& stream);
422 //======================================================================
427 // とりあえず最もシンプルな形を取るよ。
429 ILexeme(const utakata::utf8_string::CUTF8String& str, int id);
432 // 終端記号、非終端記号のIDを取得する。
436 const utakata::utf8_string::CUTF8String& getString() const;
442 smart_ptr<Impl> pimpl_;
449 #endif /* _LEXEME_H_ */