Exemple #1
0
        public bool Match_Comment(Token token)
        {
            if (!token.IsEOF && token.Line.StartsWith("#"))
            {
                token.MatchedType = TokenType.Comment;
                token.Text        = token.Line.GetRestTrimmed(0).Substring(1);

                if (languageChangeAllowed && token.Text.StartsWith(LANGUAGE_PREFIX, StringComparison.OrdinalIgnoreCase))
                {
                    var language = token.Text.Substring(LANGUAGE_PREFIX.Length).Trim();
                    currentDialect = dialectProvider.GetDialect(language);
                }
                languageChangeAllowed = false;

                return(true);
            }
            return(false);
        }
Exemple #2
0
        public bool Match_Comment(Token token)
        {
            if (!token.IsEOF && token.Line.StartsWith("#"))
            {
                token.MatchedType = TokenType.Comment;
                token.Text = token.Line.GetRestTrimmed(0).Substring(1);

                if (languageChangeAllowed && token.Text.StartsWith(LANGUAGE_PREFIX, StringComparison.OrdinalIgnoreCase))
                {
                    var language = token.Text.Substring(LANGUAGE_PREFIX.Length).Trim();
                    currentDialect = dialectProvider.GetDialect(language);
                }
                languageChangeAllowed = false;

                return true;
            }
            return false;
        }
Exemple #3
0
        public TokenMatcher(GherkinDialectProvider dialectProvider = null)
        {
            this.dialectProvider = dialectProvider ?? new GherkinDialectProvider();

            currentDialect = this.dialectProvider.DefaultDialect;
        }
 public GherkinDialectProvider(string defaultLanguage = "en")
 {
     defaultDialect = GetDialect(defaultLanguage);
 }
 public GherkinDialectProvider(string defaultLanguage = "en")
 {
     defaultDialect = GetDialect(defaultLanguage);
 }
Exemple #6
0
        public TokenMatcher(GherkinDialectProvider dialectProvider = null)
        {
            this.dialectProvider = dialectProvider ?? new GherkinDialectProvider();

            currentDialect = this.dialectProvider.DefaultDialect;
        }