Crevice
0.1
Xypron
>
Projects
>
Crevice
> Doxygen
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Pages
src
crevice.cc
1
/*
2
* File: crevice.cc
3
*
4
* Copyright 2014 Heinrich Schuchardt <xypron.glpk@gmx.de>
5
*
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
19
#include <cstdlib>
20
#include <iostream>
21
#include <fstream>
22
#include <string>
23
#include "language/Tokenizer.h"
24
#include "language/Ustring.h"
25
26
using namespace
std;
27
28
static
void
help() {
29
cout <<
"Usage crevice FILE"
<< endl;
30
}
31
32
int
main(
int
argc,
char
*argv[]) {
33
Ustring
*u = NULL;
34
35
if
(argc != 2) {
36
help();
37
return
EXIT_FAILURE;
38
}
39
40
try
{
41
cout <<
"Reading '"
<< argv[1] <<
"'"
<< endl;
42
std::ifstream i(argv[1]);
43
u =
new
Ustring
(&i);
44
cout << u->
length
() <<
" characters read"
<< endl;
45
}
catch
(
const
Ustring::Error
&e) {
46
cout <<
"main: An error occured"
<< endl;
47
return
EXIT_FAILURE;
48
}
49
50
Tokenizer
t(*u);
51
delete
u;
52
53
cout << t.toString() << endl;
54
55
return
EXIT_SUCCESS;
56
}
Generated on Sat Feb 1 2014 14:50:30 for Crevice by
1.8.1.2