2 * Copyright 2008, Haiku.
3 * Distributed under the terms of the MIT license.
6 * Michael Pfeiffer <laplace@users.sourceforge.net>
9 #include "CharacterClasses.h"
14 void Print(Scanner
* scanner
)
16 Position position
= scanner
->GetPosition();
17 const char* filename
= scanner
->GetFileName();
18 int ch
= scanner
->GetCurrentChar();
19 printf("[%d, %d] (%s) %c\n", position
.x
, position
.y
, filename
, ch
);
24 Scanner
scanner("main.ppd");
25 if (scanner
.InitCheck() != B_OK
) {
26 fprintf(stderr
, "Could not open file main.ppd\n");
31 for (int i
= 0; i
< 10; i
++) {
32 int ch
= scanner
.GetCurrentChar();
34 fprintf(stderr
, "Unexpected end of file!\n");
41 if (!scanner
.Include("include.ppd")) {
42 fprintf(stderr
, "Could not include file include.ppd\n");
46 while (scanner
.GetCurrentChar() != kEof
) {
52 string
.Append('a', 1);
53 printf("%d\n", (int)string
.Length());
54 string
.Append((char)0, 1);
55 string
.Append('b', 1);
56 printf("%d\n", (int)string
.Length());
57 for (int i
= 0; i
< string
.Length(); i
++) {
58 printf("%c ", string
.String()[i
]);