private D_PieceContent makePieceContent(PieceTokenizer f) { var g = f.reStart(); D_PieceContent piece = new D_PieceContent(); D_Piece c; string w1; if ((w1 = getWord(f)) != null) { piece.PieceContentClause = D_PieceContent.D_PieceContentClause.Word; piece.Word = new D_Word(); piece.Word.Value = w1; } else if (isString(f)) { piece.PieceContentClause = D_PieceContent.D_PieceContentClause.String; piece.String = new D_String(); piece.String.Value = f.CurrentPiece(); } else if ((c = makePiece(f)) != null) { piece.PieceContentClause = D_PieceContent.D_PieceContentClause.Piece; piece.Piece = c; } else { f.goBack(g); return null; } return piece; }
public bool isToken(PieceTokenizer f, string tok, bool advance = true) { int d; bool fc = f.CurrentPiece() == tok; if (fc && advance) f.Progress(); return fc; }
public bool isString(PieceTokenizer f, bool advance = true) { bool fc = f.CurrentPiece().StartsWith("\"") && f.CurrentPiece().EndsWith("\""); if (fc && advance) f.Progress(); return fc; }
public bool isNumber(PieceTokenizer f, bool advance = true) { int d; bool fc = int.TryParse(f.CurrentPiece(), out d); if (fc && advance) f.Progress(); return fc; }
public bool isBool(PieceTokenizer f, bool advance = true) { bool d; bool fc = bool.TryParse(f.CurrentPiece(), out d); if (fc && advance) f.Progress(); return fc; }
public string getWord(PieceTokenizer f, bool advance = true) { bool j = !isAToken(f, false) && !isBool(f, false) && !isNumber(f, false) && !isString(f, false); if (j) { string d; Console.WriteLine(d = f.CurrentPiece()); if (advance) f.Progress(); return d; } return null; }