private bool HandleStorage(Func <CharKind, ICharacter, bool> predicate, CharKind kind, ICharacter c, Queue <char> queue) { bool handled = false; if (predicate(kind, c)) { queue.Enqueue(c.Info); ++this.Position; handled = true; } return(handled); }
private void Identify() { if (Regex.IsMatch(new string(new[] { this.Value }), @"^[(]$")) { this.CharKind = CharKind.LeftParen; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[)]$")) { this.CharKind = CharKind.RightParen; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[,]$")) { this.CharKind = CharKind.Comma; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[-]$")) { this.CharKind = CharKind.Hyphen; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[+]$")) { this.CharKind = CharKind.Plus; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[a-zA-Z_]$")) { this.CharKind = CharKind.Letter; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[\d]$")) { this.CharKind = CharKind.Digit; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[\s]$")) { this.CharKind = CharKind.Whitespace; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[:]$")) { this.CharKind = CharKind.Colon; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[;]$")) { this.CharKind = CharKind.Semicolon; } else if (Regex.IsMatch(new string(new[] { this.Value }), @"^[=]$")) { this.CharKind = CharKind.Equal; } else { this.CharKind = CharKind.Unknown; } }
void _(CharKind kind, string str) { _charKinds.Add(str, kind); }
private bool IsValidWordCharKind(CharKind chKind) { return(!(chKind == CharKind.Control || chKind == CharKind.Whitespace || chKind == CharKind.Punctuation || chKind == CharKind.Others)); }
public SpriteSet GetSpriteSet(CharKind kind, PlayerState state) { return(sprites[kind][state]); }
public static CharKind Crack(char ch) { CharKind result = CharKind.UNKNOWN; if (LanguageService.QUOTE == ch) { result = CharKind.QUOTE; } else if (LanguageService.LETTERS.Contains(ch)) { result = CharKind.ALPHA; } else if (LanguageService.DIGITS.Contains(ch)) { result = CharKind.DIGIT; } else if (LanguageService.SPACE == ch) { result = CharKind.SPACE; } else if (LanguageService.DOT == ch) { result = CharKind.DOT; } else if (LanguageService.DASH == ch) { result = CharKind.DASH; } else if (LanguageService.COMMA == ch) { result = CharKind.COMMA; } else if (LanguageService.OPEN_PAREN == ch) { result = CharKind.OPEN_PAREN; } else if (LanguageService.CLOSE_PAREN == ch) { result = CharKind.CLOSE_PAREN; } else if (LanguageService.OPEN_SQ == ch) { result = CharKind.OPEN_SQ; } else if (LanguageService.CLOSE_SQ == ch) { result = CharKind.CLOSE_SQ; } else if (LanguageService.LINEFEED == ch) { result = CharKind.LINEFEED; } else if (LanguageService.CARRAGERETURN == ch) { result = CharKind.CARRAGERETURN; } else if (LanguageService.PUNCTUATION.Contains(ch)) { result = CharKind.PUNCTUATION; } else if (LanguageService.NULL == ch) { result = CharKind.NULL; } return(result); }
public Sprite[] GetSprite(CharKind gender, PlayerState state) { switch (gender) { case CharKind.man: switch (state) { case PlayerState.idle: return(man_idle); case PlayerState.attkck: return(man_attack); case PlayerState.move: return(man_move); case PlayerState.die: return(man_die); case PlayerState.hit: return(man_hit); case PlayerState.jump: return(man_move); case PlayerState.dash: return(man_move); default: break; } break; case CharKind.woman: switch (state) { case PlayerState.idle: return(woman_idle); case PlayerState.attkck: return(woman_attack); case PlayerState.move: return(woman_move); case PlayerState.die: return(woman_die); case PlayerState.hit: return(woman_hit); case PlayerState.jump: return(woman_move); case PlayerState.dash: return(woman_move); default: break; } break; default: break; } return(null); }
public ITokenizerState NextState(CharKind charKind) { return((this.ExitState.Keys.Contains(charKind)) ? this.ExitState[charKind] : this.DefaultNextState); }
public void AddTransitionState(CharKind cKind, ITokenizerState next) { this.ExitState[cKind] = next; }
private Character(char c, bool eof = false) { this.Info = c; this.Kind = (eof) ? CharKind.NULL : LanguageService.Crack(c); }