private static bool DoAsterisk(ref StateContext context) { if (context.IsWhitespace()) { return(true); } switch (context.Character) { case ',': context.Include("*"); context.State = State.None; return(true); case '}': context.Include("*"); context.Pop(); context.State = State.None; return(true); default: context.OnError($"SyntaxError: Contains the illegal character '{context.Character}' in the data schema."); return(false); } }
private static bool DoInclude(ref StateContext context) { switch (context.Character) { case ',': context.Include(); context.State = State.None; break; case ':': context.Include(); context.State = State.PagingCount; break; case '(': context.Include(); context.State = State.SortingField; break; case '{': context.Include(); context.Push(); context.State = State.None; break; case '}': context.Include(); context.Pop(); context.State = State.None; break; default: if (context.IsLetterOrDigitOrUnderscore()) { //判断标识中间是否含有空白字符 if (context.Flags.HasWhitespace()) { context.OnError("SyntaxError: The identifier of the data schema contains whitespace characters."); return(false); } context.Accept(); } else if (!context.IsWhitespace()) { context.OnError($"SyntaxError: The identifier of the data schema contains '{context.Character}' illegal character."); return(false); } break; } //重置是否含有空格的标记 context.Flags.HasWhitespace(context.IsWhitespace()); return(true); }