<commit_before>/*-
 * Copyright (c) 2010, 2011
 *	<NAME>.  All rights reserved.
 *
 * See the LICENSE file for redistribution information.
 */

#ifndef PARSER_H_
#define PARSER_H_

#include "shell.h"

namespace ucsh {

typedef const char*  source_type;
typedef source_type& source_ref;
typedef CommandGroup result_type;
typedef result_type& result_ref;
typedef string&      string_buf;

typedef enum { END, CONT, ERRTOK, ERRPAIR, ERRSYN } status_type;

cstr_t      parse_env  (source_ref);
cstr_t      parse_var  (source_type); // do not changes input
status_type parse_all  (source_ref, result_ref);
status_type parse_word (source_ref, result_ref, string_buf);

inline bool ismagic(const char c)
{ return c == '*' or c == '?' or c == '[' or c == '\\'; }

inline bool isterm(const char c)
{ return c == ' ' or c == ';' or c == '|' or c == '&'
	or c == '<' or c == '>' or !c; }

}

#endif<commit_msg>Uses switch style symbol judgment.<commit_after>/*-
 * Copyright (c) 2010, 2011
 *	<NAME>.  All rights reserved.
 *
 * See the LICENSE file for redistribution information.
 */

#ifndef PARSER_H_
#define PARSER_H_

#include "shell.h"

namespace ucsh {

typedef const char*  source_type;
typedef source_type& source_ref;
typedef CommandGroup result_type;
typedef result_type& result_ref;
typedef string&      string_buf;

typedef enum { END, CONT, ERRTOK, ERRPAIR, ERRSYN } status_type;

cstr_t      parse_env  (source_ref);
cstr_t      parse_var  (source_type); // do not changes input
status_type parse_all  (source_ref, result_ref);
status_type parse_word (source_ref, result_ref, string_buf);

inline bool ismagic(const char c) {
	switch (c) {
	case '*': case '?': case '[': case '\\':
		return true;
	}
	return false;
}

inline bool isterm(const char c) {
	switch (c) {
	case ' ': case ';': case '|': case '&':
	case '<': case '>': case '\0':
		return true;
	}
	return false;
}

}

#endif
{'fraction_non_alphanumeric': 0.13227513227513227, 'fraction_numerical': 0.008994708994708995, 'mean_word_length': 4.015915119363395, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4271871', 'n_tokens_mistral': 720, 'n_tokens_neox': 670, 'n_words': 205}