Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_regex.hpp
1#ifndef TEUCHOS_REGEX_HPP
2#define TEUCHOS_REGEX_HPP
3
5#include <Teuchos_FiniteAutomaton.hpp>
7#include <Teuchos_Reader.hpp>
8
9namespace Teuchos {
10namespace regex {
11
12enum {
13 PROD_REGEX,
14 PROD_UNION_DECAY,
15 PROD_UNION,
16 PROD_CONCAT_DECAY,
17 PROD_CONCAT,
18 PROD_QUAL_DECAY,
19 PROD_STAR,
20 PROD_PLUS,
21 PROD_MAYBE,
22 PROD_SINGLE_CHAR,
23 PROD_ANY,
24 PROD_SINGLE_SET,
25 PROD_PARENS_UNION,
26 PROD_SET_POSITIVE,
27 PROD_SET_NEGATIVE,
28 PROD_POSITIVE_SET,
29 PROD_NEGATIVE_SET,
30 PROD_SET_ITEMS_DECAY,
31 PROD_SET_ITEMS_ADD,
32 PROD_SET_ITEM_CHAR,
33 PROD_SET_ITEM_RANGE,
34 PROD_RANGE
35};
36
37enum { NPRODS = PROD_RANGE + 1 };
38
39enum {
40 TOK_CHAR,
41 TOK_DOT,
42 TOK_LRANGE,
43 TOK_RRANGE,
44 TOK_LPAREN,
45 TOK_RPAREN,
46 TOK_UNION,
47 TOK_RANGE,
48 TOK_NEGATE,
49 TOK_STAR,
50 TOK_PLUS,
51 TOK_MAYBE
52};
53
54enum { NTOKS = TOK_MAYBE + 1 };
55
56Language make_language();
57LanguagePtr ask_language();
58
59void make_lexer(FiniteAutomaton& result);
60
61ReaderTablesPtr ask_reader_tables();
62
63void make_dfa(FiniteAutomaton& result, std::string const& name, std::string const& regex, int token);
64
65class Reader : public Teuchos::Reader {
66 public:
67 Reader(int result_token_in);
68 virtual ~Reader() {}
69 protected:
70 virtual void at_shift(any& result, int token, std::string& text);
71 virtual void at_reduce(any& result, int token, std::vector<any>& rhs);
72 private:
73 int result_token;
74};
75
76} // end namespace regex
77} // end namespace Teuchos
78
79#endif
Declares Teuchos::Language.
Declares Teuchos::ReaderTables.
Declares Teuchos::Reader.
The main class for users to read text using TeuchosParser.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
RCP< const ReaderTables > ReaderTablesPtr
an RCP to a const ReaderTables
void make_lexer(FiniteAutomaton &result, Language const &language)
construct a lexer for the Language tokens.
RCP< const Language > LanguagePtr
an RCP to a const Language