init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Zhaizj.Framework.Serialization {
|
||||
|
||||
internal class CharSource {
|
||||
|
||||
public char[] charList;
|
||||
private int index = -1;
|
||||
|
||||
public String strSrc { get; set; }
|
||||
|
||||
public CharSource( String src ) {
|
||||
this.strSrc = clearComment( src );
|
||||
this.charList = this.strSrc.ToCharArray();
|
||||
}
|
||||
|
||||
private String clearComment( String src ) {
|
||||
if (src == null) return null;
|
||||
String[] arr = src.Split( '\n' );
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (String line in arr) {
|
||||
if (line.Trim().StartsWith( "//" )) continue;
|
||||
sb.Append( line );
|
||||
sb.AppendLine();
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public char getCurrent() {
|
||||
|
||||
return charList[index];
|
||||
}
|
||||
|
||||
public void move() {
|
||||
|
||||
if (index >= charList.Length - 1) return;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
public void back() {
|
||||
index--;
|
||||
}
|
||||
|
||||
public void moveToText() {
|
||||
|
||||
index++;
|
||||
|
||||
char c = this.getCurrent();
|
||||
if (c == 0 || c > ' ') return;
|
||||
|
||||
moveToText();
|
||||
}
|
||||
|
||||
public Boolean isEnd() {
|
||||
return (index >= charList.Length - 1);
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return this.index;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user