whitespace

This commit is contained in:
Danny Robson 2014-05-20 14:11:28 +10:00
parent d0668cec59
commit 9cb897a381
2 changed files with 16 additions and 16 deletions

View File

@ -5,12 +5,12 @@
* terms of the GNU General Public License as published by the Free Software * terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later * Foundation, either version 3 of the License, or (at your option) any later
* version. * version.
* *
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY * libgim is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. * details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with libgim. If not, see <http://www.gnu.org/licenses/>. * along with libgim. If not, see <http://www.gnu.org/licenses/>.
* *
@ -191,10 +191,10 @@ struct parse_context {
| '\\t' | '\\t'
| '\\u' xdigit{4}; | '\\u' xdigit{4};
string = ('"' string = ('"'
char* >{ nodestack.back ().start = fpc; } char* >{ nodestack.back ().start = fpc; }
%{ nodestack.back ().stop = fpc; }) %{ nodestack.back ().stop = fpc; })
'"' '"'
@new_string; @new_string;
## other ## other
@ -207,11 +207,11 @@ struct parse_context {
array = '[' @{ fhold; fcall _array; } ']'; array = '[' @{ fhold; fcall _array; } ']';
value = value =
string string
| boolean | boolean
| number >{ nodestack.back ().start = fpc; } %{ nodestack.back ().stop = fpc; } %new_number | number >{ nodestack.back ().start = fpc; } %{ nodestack.back ().stop = fpc; } %new_number
| object | object
| array | array
| 'null' %new_null; | 'null' %new_null;
## compound data types ## compound data types
@ -286,7 +286,7 @@ json::parse (const char *start,
%%write init; %%write init;
%%write exec; %%write exec;
if (!__success) if (!__success)
throw parse_error ("unable to parse json"); throw parse_error ("unable to parse json");
return std::unique_ptr<json::node> (__root); return std::unique_ptr<json::node> (__root);
@ -479,9 +479,9 @@ json::array::operator ==(const json::array &rhs) const {
std::ostream& std::ostream&
json::array::write (std::ostream &os) const { json::array::write (std::ostream &os) const {
os << "[\n"; os << "[\n";
{ {
indenter raii(os); indenter raii(os);
for (auto i = m_values.begin (); i != m_values.end (); ++i) { for (auto i = m_values.begin (); i != m_values.end (); ++i) {
(*i)->write (os); (*i)->write (os);
@ -526,7 +526,7 @@ json::number::write (std::ostream &os) const {
bool bool
json::number::operator ==(const json::number &rhs) const json::number::operator ==(const json::number &rhs) const
{ return almost_equal (rhs.m_value, m_value); } { return almost_equal (rhs.m_value, m_value); }
@ -540,7 +540,7 @@ json::boolean::write (std::ostream &os) const {
} }
bool bool
json::boolean::operator ==(const json::boolean &rhs) const json::boolean::operator ==(const json::boolean &rhs) const
{ return rhs.m_value == m_value; } { return rhs.m_value == m_value; }

View File

@ -62,7 +62,7 @@ namespace json {
virtual bool is_array (void) const { return false; } virtual bool is_array (void) const { return false; }
virtual bool is_string (void) const { return false; } virtual bool is_string (void) const { return false; }
virtual bool is_number (void) const { return false; } virtual bool is_number (void) const { return false; }
virtual bool is_boolean (void) const { return false; } virtual bool is_boolean (void) const { return false; }
virtual bool is_null (void) const { return false; } virtual bool is_null (void) const { return false; }
virtual bool operator==(const node &rhs) const = 0; virtual bool operator==(const node &rhs) const = 0;
@ -81,7 +81,7 @@ namespace json {
virtual const node& operator[] (unsigned int) const; virtual const node& operator[] (unsigned int) const;
virtual std::ostream& write (std::ostream &os) const = 0; virtual std::ostream& write (std::ostream &os) const = 0;
}; };
/// Represents a JSON object, and contains its children. /// Represents a JSON object, and contains its children.
@ -141,7 +141,7 @@ namespace json {
{ return rhs == *this; } { return rhs == *this; }
virtual size_t size (void) const virtual size_t size (void) const
{ return m_values.size (); } { return m_values.size (); }
virtual node& operator [](unsigned int idx) virtual node& operator [](unsigned int idx)
{ return *m_values[idx]; } { return *m_values[idx]; }
virtual const node& operator [](unsigned int idx) const virtual const node& operator [](unsigned int idx) const