diff options
Diffstat (limited to 'src/lang/test.cc')
| -rw-r--r-- | src/lang/test.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/lang/test.cc b/src/lang/test.cc new file mode 100644 index 0000000..e59a719 --- /dev/null +++ b/src/lang/test.cc | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /************************************************************************* | ||
| 2 | * | ||
| 3 | * HTCd - Copyright (C) 1998-2006 Henrik Rydberg | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <lang/env.h> | ||
| 21 | |||
| 22 | static fp_stream mout(stdout),merr(stderr); | ||
| 23 | |||
| 24 | main(int argc,char* argv[]) try | ||
| 25 | { | ||
| 26 | Lang lang; | ||
| 27 | req_env req(lang,lang.toks); | ||
| 28 | Env env(lang.ops,req,XSYSTEM); | ||
| 29 | mstring line; | ||
| 30 | while(!feof(stdin)) { | ||
| 31 | merr<<"lang>"; | ||
| 32 | getline(line,stdin); | ||
| 33 | try { | ||
| 34 | env.parse(mout,line); | ||
| 35 | mout<<"\n"; | ||
| 36 | } | ||
| 37 | catch(const merror_t& e) { | ||
| 38 | merr<<e.desc<<"\n"; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | catch(const merror_t& e) { | ||
| 44 | merr<<"ERROR: ["<<e.desc<<"]\n"; | ||
| 45 | } | ||
