init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Zhaizj.Framework.Serialization {
|
||||
|
||||
internal abstract class JsonParserBase {
|
||||
|
||||
protected CharSource charSrc;
|
||||
|
||||
protected abstract void parse();
|
||||
public abstract Object getResult();
|
||||
|
||||
public JsonParserBase() {
|
||||
}
|
||||
|
||||
public JsonParserBase( CharSource charSrc ) {
|
||||
this.charSrc = charSrc;
|
||||
parse();
|
||||
}
|
||||
|
||||
protected JsonParserBase moveAndGetParser() {
|
||||
|
||||
charSrc.moveToText();
|
||||
|
||||
char c = charSrc.getCurrent();
|
||||
|
||||
if (c == '"' || c == '\'') {
|
||||
return new StringJsonParser( this.charSrc, c );
|
||||
}
|
||||
|
||||
if (c == '{') {
|
||||
charSrc.back();
|
||||
return new ObjectJsonParser( this.charSrc );
|
||||
}
|
||||
|
||||
if (c == '[') {
|
||||
charSrc.back();
|
||||
return new ArrayJsonParser( this.charSrc );
|
||||
}
|
||||
|
||||
return new ValueJsonParser( this.charSrc );
|
||||
|
||||
}
|
||||
|
||||
protected JsonParserException ex( String msg ) {
|
||||
return new JsonParserException( msg + "(index:"+this.charSrc.getIndex().ToString()+")\n" + this.charSrc.strSrc );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user