Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parser
src
Teuchos_Language.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Teuchos: Common Tools Package
4
//
5
// Copyright 2004 NTESS and the Teuchos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TEUCHOS_LANGUAGE_HPP
11
#define TEUCHOS_LANGUAGE_HPP
12
16
17
#include <string>
18
#include <vector>
19
#include <iosfwd>
20
21
#include <Teuchos_Grammar.hpp>
22
#include <Teuchos_FiniteAutomaton.hpp>
23
#include <
Teuchos_ReaderTables.hpp
>
24
#include <
Teuchos_RCP.hpp
>
25
26
namespace
Teuchos
{
27
28
120
struct
Language
{
121
struct
Token {
122
std::string name;
123
std::string regex;
124
void
operator()(std::string
const
& name_in, std::string
const
& regex_in);
125
};
126
typedef
std::vector<Token> Tokens;
128
Tokens
tokens
;
129
typedef
std::vector<std::string> RHS;
130
struct
Production;
131
struct
RHSBuilder {
132
Production& prod;
133
RHSBuilder(Production& prod_in);
134
RHSBuilder& operator,(std::string
const
& rhs_item);
135
RHSBuilder& operator>>(std::string
const
& rhs_item);
136
};
137
struct
Production {
138
std::string lhs;
139
RHS rhs;
140
RHSBuilder operator()(std::string
const
& lhs_in);
141
};
142
typedef
std::vector<Production> Productions;
144
Productions
productions
;
145
};
146
148
typedef
RCP<const Language>
LanguagePtr
;
149
150
GrammarPtr make_grammar(
Language
const
& language);
151
162
void
make_lexer
(FiniteAutomaton& result,
Language
const
& language);
163
164
169
ReaderTablesPtr
make_reader_tables
(
Language
const
& language);
170
171
std::ostream& operator<<(std::ostream& os,
Language
const
& lang);
172
173
}
174
175
#endif
Teuchos_RCP.hpp
Reference-counted pointer class and non-member templated function implementations.
Teuchos_ReaderTables.hpp
Declares Teuchos::ReaderTables.
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:397
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Teuchos::ReaderTablesPtr
RCP< const ReaderTables > ReaderTablesPtr
an RCP to a const ReaderTables
Definition
Teuchos_ReaderTables.hpp:40
Teuchos::make_lexer
void make_lexer(FiniteAutomaton &result, Language const &language)
construct a lexer for the Language tokens.
Definition
Teuchos_Language.cpp:143
Teuchos::LanguagePtr
RCP< const Language > LanguagePtr
an RCP to a const Language
Definition
Teuchos_Language.hpp:148
Teuchos::make_reader_tables
ReaderTablesPtr make_reader_tables(Language const &language)
constructs ReaderTables for the given Language.
Definition
Teuchos_Language.cpp:198
Teuchos::Language
The main class for users to define a language using TeuchosParser.
Definition
Teuchos_Language.hpp:120
Teuchos::Language::productions
Productions productions
vector of productions
Definition
Teuchos_Language.hpp:144
Teuchos::Language::tokens
Tokens tokens
vector of tokens
Definition
Teuchos_Language.hpp:128
Generated by
1.17.0