16#include "ioss_export.h"
20 template <
class charT>
using String = std::basic_string<charT>;
22 template <
class charT>
class Automata;
24 class IOSS_EXPORT
Error :
public std::exception
27 explicit Error(std::string msg) : msg_{std::move(msg)} {}
30 const char *
what() const noexcept
override {
return msg_.c_str(); }
48 template <
class T,
class U = T> T
exchange(T &obj, U &&new_value)
50 T old_value = std::move(obj);
51 obj = std::forward<U>(new_value);
55 template <
class charT>
class State
134 states_ = std::move(automata.states_);
164 auto r =
ExecAux(str, comp_end);
171 std::vector<String<charT>> vec;
176 vec.push_back(state->MatchedStr());
183 template <
class T,
typename... Args>
size_t NewState(Args &&...args)
185 size_t state_pos =
states_.size();
186 auto state = std::unique_ptr<State<charT>>(
new T(*
this, std::forward<Args>(args)...));
188 states_.push_back(std::move(state));
197 size_t state_pos = 0;
203 std::tie(state_pos, str_pos) =
states_[state_pos]->Next(str, str_pos);
209 if ((state_pos ==
match_state_) && (str_pos == str.length())) {
210 return {
true, str_pos};
213 return {
false, str_pos};
227 std::vector<std::unique_ptr<State<charT>>>
states_;
245 if (
c_ == str[pos]) {
247 return std::tuple<size_t, size_t>(
GetNextStates()[0], pos + 1);
250 return std::tuple<size_t, size_t>(
GetAutomata().FailState(), pos + 1);
275 return std::tuple<size_t, size_t>(
GetNextStates()[0], pos + 1);
302 return std::tuple<size_t, size_t>(
GetNextStates()[1], str.length());
313 return std::tuple<size_t, size_t>(
GetNextStates()[0], pos + 1);
323 virtual bool Check(charT c)
const = 0;
331 bool Check(charT c)
const override {
return c ==
c_; }
341 :
start_{start < end ? start : end},
end_{start < end ? end : start}
367 for (
auto &item :
items_) {
369 if (item.get()->Check(str[pos])) {
388 if (
Check(str, pos)) {
390 return std::tuple<size_t, size_t>(
GetNextStates()[0], pos + 1);
393 return std::tuple<size_t, size_t>(
GetAutomata().FailState(), pos + 1);
397 std::vector<std::unique_ptr<SetItem<charT>>>
items_;
426 std::tie(r, str_pos) = automata->Exec(str_part,
false);
428 return {r, pos + str_pos};
432 return {
false, pos + str_pos};
445 std::tie(r, std::ignore) =
BasicCheck(str, pos);
488 return std::tuple<size_t, size_t>(
GetAutomata().FailState(), new_pos);
501 return std::tuple<size_t, size_t>(
GetNextStates()[1], new_pos);
504 return std::tuple<size_t, size_t>(
GetAutomata().FailState(), new_pos);
514 return std::tuple<size_t, size_t>(
GetNextStates()[1], new_pos);
528 new_pos == str.length()) {
529 return std::tuple<size_t, size_t>(
GetNextStates()[1], new_pos);
531 return std::tuple<size_t, size_t>(
GetNextStates()[0], new_pos);
549 new_pos == str.length()) {
550 return std::tuple<size_t, size_t>(
GetNextStates()[1], new_pos);
552 return std::tuple<size_t, size_t>(
GetNextStates()[0], new_pos);
565 return std::tuple<size_t, size_t>(
GetAutomata().FailState(), new_pos);
574#define TOKEN(X, Y) X,
581 TOKEN(LBRACKET,
"[")
TOKEN(RBRACKET,
"]")
TOKEN(NEGLBRACKET,
"[^") NUM_TOKENS
585#define TOKEN(X, Y) #X,
593 TOKEN(NEGLBRACKET,
"[^")
""};
614 template <
class charU>
621 template <
class charT>
624 stream << '[' << token_name_str[static_cast<int>(token.
kind_)] <<
']';
637 std::vector<Token<charT>> tokens;
643 tokens.push_back(
Select(TokenKind::QUESTLPAREN));
647 tokens.push_back(
Select(TokenKind::QUESTION));
655 tokens.push_back(
Select(TokenKind::STARLPAREN));
659 tokens.push_back(
Select(TokenKind::STAR));
667 tokens.push_back(
Select(TokenKind::PLUSLPAREN));
677 tokens.push_back(
Select(TokenKind::SUB));
683 tokens.push_back(
Select(TokenKind::UNION));
691 tokens.push_back(
Select(TokenKind::ATLPAREN));
703 tokens.push_back(
Select(TokenKind::NEGLPAREN));
713 tokens.push_back(
Select(TokenKind::LPAREN));
719 tokens.push_back(
Select(TokenKind::RPAREN));
727 tokens.push_back(
Select(TokenKind::NEGLBRACKET));
731 tokens.push_back(
Select(TokenKind::LBRACKET));
737 tokens.push_back(
Select(TokenKind::RBRACKET));
745 throw Error(
"No valid char after '\\'");
754 tokens.push_back(
Select(TokenKind::EOS));
784#define GLOB_AST_NODE_LIST(V) \
797 template <
class charT>
class AstVisitor;
800#define DECLARE_TYPE_CLASS(type) template <class charT> class type;
803#undef DECLARE_TYPE_CLASS
837 template <
class charT>
using AstNodePtr = std::unique_ptr<AstNode<charT>>;
843#define DECLARE_VIRTUAL_FUNC(type) \
844 virtual void Visit##type(type<charT> * ) {}
846#undef DECLARE_VIRTUAL_FUNC
1030 throw Error(
"char expected");
1033 charT c = tk.
Value();
1042 if (tk != TokenKind::SUB) {
1043 throw Error(
"range expected");
1061 std::vector<AstNodePtr<charT>> items;
1065 }
while (
GetToken() != TokenKind::RBRACKET);
1076 if (tk == TokenKind::LBRACKET) {
1079 if (tk == TokenKind::NEGLBRACKET) {
1082 throw Error(
"set expected");
1089 switch (tk.
Kind()) {
1098 case TokenKind::LBRACKET:
1099 case TokenKind::NEGLBRACKET:
return ParserSet();
1101 case TokenKind::LPAREN:
1102 case TokenKind::QUESTLPAREN:
1103 case TokenKind::STARLPAREN:
1104 case TokenKind::PLUSLPAREN:
1105 case TokenKind::NEGLPAREN:
1108 default:
throw Error(
"basic glob expected");
1117 switch (tk.
Kind()) {
1130 default:
throw Error(
"Not valid group");
break;
1135 if (tk != TokenKind::RPAREN) {
1136 throw Error(
"Expected ')' at and of group");
1144 auto check_end = [&]() ->
bool {
1147 switch (tk.
Kind()) {
1148 case TokenKind::EOS:
1149 case TokenKind::RPAREN:
1150 case TokenKind::UNION:
return true;
1152 default:
return false;
1156 std::vector<AstNodePtr<charT>> parts;
1158 while (!check_end()) {
1167 std::vector<AstNodePtr<charT>> items;
1170 while (
GetToken() == TokenKind::UNION) {
1182 if (
GetToken() != TokenKind::EOS) {
1183 throw Error(
"Expected the end of glob");
1314 std::vector<std::unique_ptr<SetItem<charT>>> vec;
1315 auto &items = set_node->
GetItems();
1316 for (
auto &item : items) {
1332 auto *start_node =
static_cast<CharNode<charT> *
>(range_node->GetStart());
1333 auto *end_node =
static_cast<CharNode<charT> *
>(range_node->GetEnd());
1335 char start_char = start_node->GetValue();
1336 char end_char = end_node->GetValue();
1339 throw Error(
"Not valid set item");
1345 auto *union_node = group_node->
GetGlob();
1349 switch (group_node->GetGroupType()) {
1376 auto &items = union_node->
GetItems();
1377 std::vector<std::unique_ptr<Automata<charT>>> vec_automatas;
1378 for (
auto &item : items) {
1381 ast_consumer.
ExecConcat(item.get(), *automata_ptr);
1384 automata_ptr->GetState(ast_consumer.
preview_state_).AddNextState(match_state);
1385 automata_ptr->SetMatchState(match_state);
1388 automata_ptr->SetFailState(fail_state);
1390 vec_automatas.push_back(std::move(automata_ptr));
1393 return vec_automatas;
1415 std::vector<Token<charT>> tokens = l.
Scanner();
1437 std::tie(r, std::ignore) =
automata_.Exec(str);
1466 int preview_state = -1;
1468 while (pos < pattern.length()) {
1469 size_t current_state = 0;
1470 char c = pattern[pos];
1473 current_state =
automata_.template NewState<StateAny<charT>>();
1479 current_state =
automata_.template NewState<StateStar<charT>>();
1480 automata_.GetState(current_state).AddNextState(current_state);
1486 current_state =
automata_.template NewState<StateChar<charT>>(c);
1492 if (preview_state >= 0) {
1493 automata_.GetState(preview_state).AddNextState(current_state);
1495 preview_state = current_state;
1498 size_t match_state =
automata_.template NewState<StateMatch<charT>>();
1499 automata_.GetState(preview_state).AddNextState(match_state);
1502 size_t fail_state =
automata_.template NewState<StateFail<charT>>();
1509 std::tie(r, std::ignore) =
automata_.Exec(str);
1525 template <
class charT,
class globT = extended_glob<
charT>>
class BasicGlob
1546 template <
class charU,
class globU>
1549 template <
class charU,
class globU>
1552 template <
class charU,
class globU>
1556 template <
class charU,
class globU>
1605 template <
class charU,
class globU>
1608 template <
class charU,
class globU>
1611 template <
class charU,
class globU>
1615 template <
class charU,
class globU>
1622 template <
class charT,
class globT = extended_glob<
charT>>
1628 template <
class charT,
class globT = extended_glob<
charT>>
1634 template <
class charT,
class globT = extended_glob<
charT>>
1642 template <
class charT,
class globT = extended_glob<
charT>>
1650 template <
class charT,
class globT = extended_glob<
charT>>
#define DECLARE_TYPE_CLASS(type)
Definition Ioss_Glob.h:800
#define GLOB_AST_NODE_LIST(V)
Definition Ioss_Glob.h:784
#define DECLARE_VIRTUAL_FUNC(type)
Definition Ioss_Glob.h:843
Definition Ioss_Glob.h:939
AnyNode()
Definition Ioss_Glob.h:941
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:943
Definition Ioss_Glob.h:1230
size_t current_state_
Definition Ioss_Glob.h:1406
void ExecStar(AstNode< charT > *, Automata< charT > &automata)
Definition Ioss_Glob.h:1289
std::vector< std::unique_ptr< SetItem< charT > > > ProcessSetItems(AstNode< charT > *node)
Definition Ioss_Glob.h:1311
int preview_state_
Definition Ioss_Glob.h:1405
void ExecConcat(AstNode< charT > *node, Automata< charT > &automata)
Definition Ioss_Glob.h:1248
void ExecAny(AstNode< charT > *, Automata< charT > &automata)
Definition Ioss_Glob.h:1284
void ExecBasicGlob(AstNode< charT > *node, Automata< charT > &automata)
Definition Ioss_Glob.h:1258
void NewState(Automata< charT > &automata, Args &&...args)
Definition Ioss_Glob.h:1396
std::vector< std::unique_ptr< Automata< charT > > > ExecUnion(AstNode< charT > *node)
Definition Ioss_Glob.h:1373
void ExecNegativeSet(AstNode< charT > *node, Automata< charT > &automata)
Definition Ioss_Glob.h:1303
void GenAutomata(AstNode< charT > *root_node, Automata< charT > &automata)
Definition Ioss_Glob.h:1234
void ExecChar(AstNode< charT > *node, Automata< charT > &automata)
Definition Ioss_Glob.h:1277
void ExecPositiveSet(AstNode< charT > *node, Automata< charT > &automata)
Definition Ioss_Glob.h:1295
void ExecGroup(AstNode< charT > *node, Automata< charT > &automata)
Definition Ioss_Glob.h:1342
std::unique_ptr< SetItem< charT > > ProcessSetItem(AstNode< charT > *node)
Definition Ioss_Glob.h:1323
Definition Ioss_Glob.h:806
Type
Definition Ioss_Glob.h:808
AstNode(Type type)
Definition Ioss_Glob.h:831
Type type_
Definition Ioss_Glob.h:834
virtual ~AstNode()=default
Type GetType() const
Definition Ioss_Glob.h:826
virtual void Accept(AstVisitor< charT > *visitor)=0
Definition Ioss_Glob.h:840
Definition Ioss_Glob.h:117
Automata< charT > & SetMatchState(size_t state_pos)
Definition Ioss_Glob.h:154
size_t match_state_
Definition Ioss_Glob.h:228
std::vector< String< charT > > GetMatchedStrings() const
Definition Ioss_Glob.h:169
Automata< charT > & operator=(Automata< charT > &&automata)
Definition Ioss_Glob.h:132
const State< charT > & GetState(size_t pos) const
Definition Ioss_Glob.h:142
Automata(const Automata< charT > &)=delete
size_t fail_state_
Definition Ioss_Glob.h:192
void ResetStates()
Definition Ioss_Glob.h:220
size_t NewState(Args &&...args)
Definition Ioss_Glob.h:183
size_t FailState() const
Definition Ioss_Glob.h:146
std::tuple< bool, size_t > Exec(const String< charT > &str, bool comp_end=true)
Definition Ioss_Glob.h:162
Automata< charT > & operator=(const Automata< charT > &automata)=delete
std::tuple< bool, size_t > ExecAux(const String< charT > &str, bool comp_end=true) const
Definition Ioss_Glob.h:195
Automata(Automata< charT > &&automata)
Definition Ioss_Glob.h:125
size_t GetNumStates() const
Definition Ioss_Glob.h:160
std::vector< std::unique_ptr< State< charT > > > states_
Definition Ioss_Glob.h:227
Automata< charT > & SetFailState(size_t state_pos)
Definition Ioss_Glob.h:148
size_t start_state_
Definition Ioss_Glob.h:230
State< charT > & GetState(size_t pos)
Definition Ioss_Glob.h:144
Definition Ioss_Glob.h:1526
const Automata< charT > & GetAutomata() const
Definition Ioss_Glob.h:1541
BasicGlob(BasicGlob &&glob)
Definition Ioss_Glob.h:1533
globT glob_
Definition Ioss_Glob.h:1560
BasicGlob(const String< charT > &pattern)
Definition Ioss_Glob.h:1528
BasicGlob & operator=(BasicGlob &)=delete
friend bool glob_match(const String< charU > &str, BasicGlob< charU, globU > &glob)
friend bool glob_match(const String< charU > &str, MatchResults< charU > &res, BasicGlob< charU, globU > &glob)
friend bool glob_match(const charU *str, MatchResults< charU > &res, BasicGlob< charU, globU > &glob)
BasicGlob(const BasicGlob &)=delete
friend bool glob_match(const charU *str, BasicGlob< charU, globU > &glob)
bool Exec(const String< charT > &str)
Definition Ioss_Glob.h:1544
BasicGlob & operator=(BasicGlob &&glob)
Definition Ioss_Glob.h:1535
Definition Ioss_Glob.h:850
CharNode(charT c)
Definition Ioss_Glob.h:852
char GetValue() const
Definition Ioss_Glob.h:856
charT c_
Definition Ioss_Glob.h:859
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:854
Definition Ioss_Glob.h:969
ConcatNode(std::vector< AstNodePtr< charT > > &&basic_glob)
Definition Ioss_Glob.h:971
std::vector< AstNodePtr< charT > > basic_glob_
Definition Ioss_Glob.h:981
std::vector< AstNodePtr< charT > > & GetBasicGlobs()
Definition Ioss_Glob.h:978
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:976
Definition Ioss_Glob.h:25
std::string msg_
Definition Ioss_Glob.h:33
Error(std::string msg)
Definition Ioss_Glob.h:27
const char * what() const noexcept override
Definition Ioss_Glob.h:30
Definition Ioss_Glob.h:1410
Automata< charT > automata_
Definition Ioss_Glob.h:1444
ExtendedGlob & operator=(ExtendedGlob &)=delete
bool Exec(const String< charT > &str)
Definition Ioss_Glob.h:1434
ExtendedGlob(const ExtendedGlob &)=delete
const Automata< charT > & GetAutomata() const
Definition Ioss_Glob.h:1441
ExtendedGlob & operator=(ExtendedGlob &&glob)
Definition Ioss_Glob.h:1428
ExtendedGlob(const String< charT > &pattern)
Definition Ioss_Glob.h:1412
ExtendedGlob(ExtendedGlob &&glob)
Definition Ioss_Glob.h:1426
Definition Ioss_Glob.h:1001
AstNodePtr< charT > glob_
Definition Ioss_Glob.h:1013
GlobNode(AstNodePtr< charT > &&glob)
Definition Ioss_Glob.h:1003
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:1008
AstNode< charT > * GetConcat()
Definition Ioss_Glob.h:1010
Definition Ioss_Glob.h:947
AstNodePtr< charT > glob_
Definition Ioss_Glob.h:964
GroupType
Definition Ioss_Glob.h:949
GroupType group_type_
Definition Ioss_Glob.h:965
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:957
GroupType GetGroupType() const
Definition Ioss_Glob.h:961
AstNode< charT > * GetGlob()
Definition Ioss_Glob.h:959
GroupNode(GroupType group_type, AstNodePtr< charT > &&glob)
Definition Ioss_Glob.h:951
Definition Ioss_Glob.h:629
std::vector< Token< charT > > Scanner()
Definition Ioss_Glob.h:635
String< charT > str_
Definition Ioss_Glob.h:779
charT c_
Definition Ioss_Glob.h:781
void Advance()
Definition Ioss_Glob.h:769
static const char kEndOfInput
Definition Ioss_Glob.h:631
Token< charT > Select(TokenKind k)
Definition Ioss_Glob.h:765
Token< charT > Select(TokenKind k, charT value)
Definition Ioss_Glob.h:767
Lexer(const String< charT > &str)
Definition Ioss_Glob.h:633
size_t pos_
Definition Ioss_Glob.h:780
Definition Ioss_Glob.h:1564
bool empty() const
Definition Ioss_Glob.h:1588
MatchResults(const MatchResults &m)
Definition Ioss_Glob.h:1570
String< charT > & operator[](size_t n) const
Definition Ioss_Glob.h:1600
friend bool glob_match(const String< charU > &str, BasicGlob< charU, globU > &glob)
std::vector< String< charT > > results_
Definition Ioss_Glob.h:1619
friend bool glob_match(const String< charU > &str, MatchResults< charU > &res, BasicGlob< charU, globU > &glob)
const_iterator cbegin() const noexcept
Definition Ioss_Glob.h:1596
const_iterator begin() const noexcept
Definition Ioss_Glob.h:1592
MatchResults(MatchResults &&m)
Definition Ioss_Glob.h:1572
void SetResults(std::vector< String< charT > > &&results)
Definition Ioss_Glob.h:1603
const_iterator end() const noexcept
Definition Ioss_Glob.h:1594
friend bool glob_match(const charU *str, MatchResults< charU > &res, BasicGlob< charU, globU > &glob)
MatchResults & operator=(MatchResults &&m)
Definition Ioss_Glob.h:1581
MatchResults & operator=(const MatchResults &m)
Definition Ioss_Glob.h:1574
typename std::vector< String< charT > >::const_iterator const_iterator
Definition Ioss_Glob.h:1566
size_t size() const
Definition Ioss_Glob.h:1590
friend bool glob_match(const charU *str, BasicGlob< charU, globU > &glob)
const_iterator cend() const noexcept
Definition Ioss_Glob.h:1598
Definition Ioss_Glob.h:915
AstNode< charT > * GetSet()
Definition Ioss_Glob.h:924
NegativeSetNode(AstNodePtr< charT > &&set)
Definition Ioss_Glob.h:917
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:922
AstNodePtr< charT > set_
Definition Ioss_Glob.h:927
Definition Ioss_Glob.h:1017
AstNodePtr< charT > ParserRange()
Definition Ioss_Glob.h:1037
AstNodePtr< charT > ParserSet()
Definition Ioss_Glob.h:1072
AstNodePtr< charT > ParserConcat()
Definition Ioss_Glob.h:1142
AstNodePtr< charT > ParserChar()
Definition Ioss_Glob.h:1026
AstNodePtr< charT > ParserBasicGlob()
Definition Ioss_Glob.h:1085
AstNodePtr< charT > ParserSetItem()
Definition Ioss_Glob.h:1050
AstNodePtr< charT > ParserSetItems()
Definition Ioss_Glob.h:1059
Token< charT > & NextToken()
Definition Ioss_Glob.h:1202
Token< charT > & GetToken()
Definition Ioss_Glob.h:1191
size_t pos_
Definition Ioss_Glob.h:1226
Parser(std::vector< Token< charT > > &&tok_vec)
Definition Ioss_Glob.h:1021
AstNodePtr< charT > GenAst()
Definition Ioss_Glob.h:1023
AstNodePtr< charT > ParserGroup()
Definition Ioss_Glob.h:1112
const Token< charT > & GetToken() const
Definition Ioss_Glob.h:1189
AstNodePtr< charT > ParserGlob()
Definition Ioss_Glob.h:1178
std::vector< Token< charT > > tok_vec_
Definition Ioss_Glob.h:1225
const Token< charT > & PeekAhead() const
Definition Ioss_Glob.h:1193
bool Advance()
Definition Ioss_Glob.h:1213
AstNodePtr< charT > ParserUnion()
Definition Ioss_Glob.h:1165
size_t Size() const noexcept
Definition Ioss_Glob.h:1223
Definition Ioss_Glob.h:899
PositiveSetNode(AstNodePtr< charT > &&set)
Definition Ioss_Glob.h:901
AstNode< charT > * GetSet()
Definition Ioss_Glob.h:908
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:906
AstNodePtr< charT > set_
Definition Ioss_Glob.h:911
Definition Ioss_Glob.h:863
AstNodePtr< charT > end_
Definition Ioss_Glob.h:879
AstNodePtr< charT > start_
Definition Ioss_Glob.h:878
RangeNode(AstNodePtr< charT > &&start, AstNodePtr< charT > &&end)
Definition Ioss_Glob.h:865
AstNode< charT > * GetEnd() const
Definition Ioss_Glob.h:875
AstNode< charT > * GetStart() const
Definition Ioss_Glob.h:873
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:871
Definition Ioss_Glob.h:327
SetItemChar(charT c)
Definition Ioss_Glob.h:329
bool Check(charT c) const override
Definition Ioss_Glob.h:331
charT c_
Definition Ioss_Glob.h:334
Definition Ioss_Glob.h:338
charT end_
Definition Ioss_Glob.h:349
charT start_
Definition Ioss_Glob.h:348
SetItemRange(charT start, charT end)
Definition Ioss_Glob.h:340
bool Check(charT c) const override
Definition Ioss_Glob.h:345
Definition Ioss_Glob.h:318
virtual ~SetItem()=default
virtual bool Check(charT c) const =0
Definition Ioss_Glob.h:883
std::vector< AstNodePtr< charT > > & GetItems()
Definition Ioss_Glob.h:892
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:890
SetItemsNode(std::vector< AstNodePtr< charT > > &&items)
Definition Ioss_Glob.h:885
std::vector< AstNodePtr< charT > > items_
Definition Ioss_Glob.h:895
Definition Ioss_Glob.h:1448
SimpleGlob(const String< charT > &pattern)
Definition Ioss_Glob.h:1450
SimpleGlob(const SimpleGlob &)=delete
SimpleGlob(SimpleGlob &&glob)
Definition Ioss_Glob.h:1455
const Automata< charT > & GetAutomata() const
Definition Ioss_Glob.h:1513
SimpleGlob & operator=(SimpleGlob &&glob)
Definition Ioss_Glob.h:1457
SimpleGlob & operator=(SimpleGlob &)=delete
void Parser(const String< charT > &pattern)
Definition Ioss_Glob.h:1463
Automata< charT > automata_
Definition Ioss_Glob.h:1516
bool Exec(const String< charT > &str) const
Definition Ioss_Glob.h:1506
Definition Ioss_Glob.h:931
StarNode()
Definition Ioss_Glob.h:933
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:935
Definition Ioss_Glob.h:258
std::tuple< size_t, size_t > Next(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:271
StateAny(Automata< charT > &states)
Definition Ioss_Glob.h:263
bool Check(const String< charT > &, size_t) override
Definition Ioss_Glob.h:265
Definition Ioss_Glob.h:234
bool Check(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:241
StateChar(Automata< charT > &states, charT c)
Definition Ioss_Glob.h:239
charT c_
Definition Ioss_Glob.h:254
std::tuple< size_t, size_t > Next(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:243
Definition Ioss_Glob.h:91
bool Check(const String< charT > &, size_t) override
Definition Ioss_Glob.h:95
StateFail(Automata< charT > &states)
Definition Ioss_Glob.h:93
std::tuple< size_t, size_t > Next(const String< charT > &, size_t pos) override
Definition Ioss_Glob.h:97
Definition Ioss_Glob.h:402
std::tuple< bool, size_t > BasicCheck(const String< charT > &str, size_t pos)
Definition Ioss_Glob.h:417
std::tuple< size_t, size_t > NextBasic(const String< charT > &str, size_t pos)
Definition Ioss_Glob.h:494
bool match_one_
Definition Ioss_Glob.h:571
std::tuple< size_t, size_t > NextAny(const String< charT > &str, size_t pos)
Definition Ioss_Glob.h:507
std::vector< std::unique_ptr< Automata< charT > > > automatas_
Definition Ioss_Glob.h:570
StateGroup(Automata< charT > &states, Type type, std::vector< std::unique_ptr< Automata< charT > > > &&automatas)
Definition Ioss_Glob.h:409
std::tuple< size_t, size_t > Next(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:452
std::tuple< size_t, size_t > NextStar(const String< charT > &str, size_t pos)
Definition Ioss_Glob.h:520
Type
Definition Ioss_Glob.h:407
std::tuple< size_t, size_t > NextNeg(const String< charT > &str, size_t pos)
Definition Ioss_Glob.h:481
void ResetState() override
Definition Ioss_Glob.h:415
bool Check(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:435
Type type_
Definition Ioss_Glob.h:569
std::tuple< size_t, size_t > NextPlus(const String< charT > &str, size_t pos)
Definition Ioss_Glob.h:537
Definition Ioss_Glob.h:104
StateMatch(Automata< charT > &states)
Definition Ioss_Glob.h:106
bool Check(const String< charT > &, size_t) override
Definition Ioss_Glob.h:108
std::tuple< size_t, size_t > Next(const String< charT > &, size_t pos) override
Definition Ioss_Glob.h:110
Definition Ioss_Glob.h:353
bool Check(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:377
bool neg_
Definition Ioss_Glob.h:398
std::tuple< size_t, size_t > Next(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:386
StateSet(Automata< charT > &states, std::vector< std::unique_ptr< SetItem< charT > > > items, bool neg=false)
Definition Ioss_Glob.h:358
bool SetCheck(const String< charT > &str, size_t pos) const
Definition Ioss_Glob.h:364
std::vector< std::unique_ptr< SetItem< charT > > > items_
Definition Ioss_Glob.h:397
Definition Ioss_Glob.h:280
std::tuple< size_t, size_t > Next(const String< charT > &str, size_t pos) override
Definition Ioss_Glob.h:293
StateStar(Automata< charT > &states)
Definition Ioss_Glob.h:285
bool Check(const String< charT > &, size_t) override
Definition Ioss_Glob.h:287
Definition Ioss_Glob.h:56
StateType type_
Definition Ioss_Glob.h:84
State(StateType type, Automata< charT > &states)
Definition Ioss_Glob.h:58
const String< charT > & MatchedStr()
Definition Ioss_Glob.h:74
virtual std::tuple< size_t, size_t > Next(const String< charT > &str, size_t pos)=0
virtual void ResetState()
Definition Ioss_Glob.h:76
const std::vector< size_t > & GetNextStates() const
Definition Ioss_Glob.h:72
void AddNextState(size_t state_pos)
Definition Ioss_Glob.h:70
std::vector< size_t > next_states_
Definition Ioss_Glob.h:86
void SetMatchedStr(const String< charT > &str)
Definition Ioss_Glob.h:79
virtual bool Check(const String< charT > &str, size_t pos)=0
String< charT > matched_str_
Definition Ioss_Glob.h:87
Automata< charT > & states_
Definition Ioss_Glob.h:85
Automata< charT > & GetAutomata()
Definition Ioss_Glob.h:68
StateType Type() const
Definition Ioss_Glob.h:66
void SetMatchedStr(charT c)
Definition Ioss_Glob.h:81
Definition Ioss_Glob.h:597
friend std::ostream & operator<<(std::ostream &stream, const Token< charU > &token)
charT Value() const
Definition Ioss_Glob.h:603
Token(TokenKind kind)
Definition Ioss_Glob.h:599
bool operator!=(TokenKind kind) const
Definition Ioss_Glob.h:611
charT value_
Definition Ioss_Glob.h:618
Token(TokenKind kind, charT value)
Definition Ioss_Glob.h:600
bool operator==(TokenKind kind) const
Definition Ioss_Glob.h:607
TokenKind Kind() const
Definition Ioss_Glob.h:601
bool operator!=(TokenKind kind)
Definition Ioss_Glob.h:609
bool operator==(TokenKind kind)
Definition Ioss_Glob.h:605
TokenKind kind_
Definition Ioss_Glob.h:617
Definition Ioss_Glob.h:985
UnionNode(std::vector< AstNodePtr< charT > > &&items)
Definition Ioss_Glob.h:987
void Accept(AstVisitor< charT > *visitor) override
Definition Ioss_Glob.h:992
std::vector< AstNodePtr< charT > > items_
Definition Ioss_Glob.h:997
std::vector< AstNodePtr< charT > > & GetItems()
Definition Ioss_Glob.h:994
Definition Ioss_Glob.h:18
std::ostream & operator<<(std::ostream &stream, const Token< charT > &token)
Definition Ioss_Glob.h:622
std::basic_string< charT > String
Definition Ioss_Glob.h:20
std::unique_ptr< AstNode< charT > > AstNodePtr
Definition Ioss_Glob.h:837
static const char * token_name_str[]
Definition Ioss_Glob.h:586
StateType
Definition Ioss_Glob.h:36
TokenKind
Definition Ioss_Glob.h:575
bool glob_match(const String< charT > &str, BasicGlob< charT, globT > &glob)
Definition Ioss_Glob.h:1623
T exchange(T &obj, U &&new_value)
Definition Ioss_Glob.h:48