Files
lserp_cs_5.0/插件库/Zhaizj.Framework/Serialization/JsonParser/StringJsonParser.cs
T
2026-07-10 15:25:05 +08:00

50 lines
957 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace Zhaizj.Framework.Serialization {
internal class StringJsonParser : ValueJsonParser {
private String _result;
public override Object getResult() {
return _result;
}
public StringJsonParser( CharSource charSrc, char c ) {
this.quote = c;
this.charSrc = charSrc;
parse();
}
private char quote = '"';
protected override void parse() {
charSrc.move();
char c = charSrc.getCurrent();
if (c == '\n' || c == '\r') throw ex( "String ends at a new line while not end" );
if (c == quote) {
_result = sb.ToString();
return;
}
if (c == '\\')
processEscape();
else
sb.Append( c );
parse();
}
}
}