Václav Kubernát | 9ae8cc4 | 2020-03-25 19:17:41 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Václav Kubernát <kubernat@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | #include <boost/spirit/home/x3.hpp> |
| 10 | #include "ast_handlers.hpp" |
| 11 | x3::rule<module_identifier_class, std::string> const module_identifier = "module_identifier"; |
| 12 | x3::rule<module_class, module_> const module = "module"; |
| 13 | x3::rule<node_identifier_class, std::string> const node_identifier = "node_identifier"; |
| 14 | auto const node_identifier_def = |
| 15 | x3::lexeme[ |
| 16 | ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_("."))) |
| 17 | ]; |
| 18 | |
| 19 | auto const module_def = |
| 20 | module_identifier >> x3::no_skip[':'] >> !x3::no_skip[x3::space]; |
| 21 | |
| 22 | auto const module_identifier_def = |
| 23 | x3::lexeme[ |
| 24 | ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_("."))) |
| 25 | ]; |
| 26 | |
| 27 | BOOST_SPIRIT_DEFINE(node_identifier) |
| 28 | BOOST_SPIRIT_DEFINE(module) |
| 29 | BOOST_SPIRIT_DEFINE(module_identifier) |