1 /*$Id: m_base_in.cc,v 1.2 2009-11-18 20:53:18 felix Exp $ -*- C++ -*-
2 * Copyright (C) 2003 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 *------------------------------------------------------------------
23 //testing=script,sparse 2009.08.13
25 /*--------------------------------------------------------------------------*/
26 void Float::parse(CS
& File
)
31 unsigned here
= File
.cursor();
33 if (File
.stuck(&here
)) {untested();
39 /*--------------------------------------------------------------------------*/
40 void Name_String::parse(CS
& File
)
44 if (File
.is_pfloat()) {
45 while (File
.is_pfloat()) {
48 if (File
.match1("eE")) {
50 if (File
.match1("+-")) {
54 while (File
.is_digit()) {
59 while (File
.is_alpha()) {
63 while (File
.is_alpha() || File
.is_pfloat() || File
.match1("_[]")) {
69 /*--------------------------------------------------------------------------*/
70 void Quoted_String::parse(CS
& File
)
73 unsigned here
= File
.cursor();
74 char quote
= File
.ctoc();
77 if (File
.skip1(quote
)) {untested();
79 }else if (!File
.more()) {untested();
80 File
.warn(0, "end of file in quoted string");
81 File
.warn(0, here
, "string begins here");
89 /*--------------------------------------------------------------------------*/
90 void Tail_String::parse(CS
& File
)
92 static char end_marks
[] = "\n";
94 const char* begin
= File
.tail().c_str();
95 File
.skipto1(end_marks
);
96 const char* end
= File
.tail().c_str();
99 while ((--end
>= begin
) && (isspace(*end
))) {untested();
102 assert(end
>= begin
);
104 _data
= std::string(begin
, static_cast<size_t>(end
-begin
));
106 /*--------------------------------------------------------------------------*/
108 void Text_Block::parse(CS
& File
)
109 {untested(); // c_str
110 const char* begin
= File
.tail().c_str();
111 for (;;) {untested();
112 File
.skipto1("\n").skip();
113 if (File
.peek() == '[') {untested();
118 const char* end
= File
.tail().c_str();
119 _data
= std::string(begin
, static_cast<size_t>(end
-begin
));
122 /*--------------------------------------------------------------------------*/
123 /*--------------------------------------------------------------------------*/
124 // vim:ts=8:sw=2:noet: