blob: bab3886085e852226160aab50068de44643176f7 [file] [log] [blame]
Václav Kubernát9ae8cc42020-03-25 19:17:41 +01001/*
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"
11x3::rule<module_identifier_class, std::string> const module_identifier = "module_identifier";
12x3::rule<module_class, module_> const module = "module";
13x3::rule<node_identifier_class, std::string> const node_identifier = "node_identifier";
14auto const node_identifier_def =
15 x3::lexeme[
16 ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_(".")))
17 ];
18
19auto const module_def =
20 module_identifier >> x3::no_skip[':'] >> !x3::no_skip[x3::space];
21
22auto const module_identifier_def =
23 x3::lexeme[
24 ((x3::alpha | x3::char_("_")) >> *(x3::alnum | x3::char_("_") | x3::char_("-") | x3::char_(".")))
25 ];
26
27BOOST_SPIRIT_DEFINE(node_identifier)
28BOOST_SPIRIT_DEFINE(module)
29BOOST_SPIRIT_DEFINE(module_identifier)