MCPcopy Create free account
hub / github.com/couchbase/fleece / parseNumber

Method parseNumber

Fleece/Support/JSON5.cc:87–105  ·  view source on GitHub ↗

Reads a number, writing JSON to the output.

Source from the content-addressed store, hash-verified

85
86 // Reads a number, writing JSON to the output.
87 void parseNumber() {
88 // TODO: Handle hex numbers
89 // TODO: Handle Infinity and NaN
90 char c = get();
91 if (c == '.')
92 _out << "0.";
93 else if (c != '+')
94 _out << c;
95
96 while (true) {
97 // Remember, we don't have to validate that this is a correct JSON number;
98 // we just have to pass valid numbers through.
99 c = peek();
100 if (isdigit(c) || c == '.' || c == 'e' || c == 'E' || c == '-' || c == '+')
101 _out << get();
102 else
103 break;
104 }
105 }
106
107 // Reads a string, writing JSON to the output.
108 void parseString() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected