From 426bafce90b56b2e99b5af661fde60452fba2384 Mon Sep 17 00:00:00 2001 From: starg Date: Thu, 7 Jul 2016 03:38:30 +0900 Subject: [PATCH] =?utf8?q?=E5=B1=9E=E6=80=A7=E3=81=AE=E5=90=8D=E5=89=8D?= =?utf8?q?=E4=BB=98=E3=81=8D=E5=BC=95=E6=95=B0=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/ast/attribute.hpp | 10 +++++++++- src/parser/parser_attribute.hpp | 14 +++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/ast/attribute.hpp b/include/ast/attribute.hpp index 19cf343..f12adde 100644 --- a/include/ast/attribute.hpp +++ b/include/ast/attribute.hpp @@ -13,11 +13,19 @@ namespace YAMML namespace AST { +class AttributeArgument final +{ +public: + boost::optional Name; + Literal Value; + SourceLocation Location; +}; + class Attribute final { public: std::string Name; - std::vector Arguments; + std::vector Arguments; SourceLocation Location; }; diff --git a/src/parser/parser_attribute.hpp b/src/parser/parser_attribute.hpp index 1d56f41..25c3abe 100644 --- a/src/parser/parser_attribute.hpp +++ b/src/parser/parser_attribute.hpp @@ -15,8 +15,20 @@ namespace Parser namespace Grammar { +class AttributeArgument + : public pegtl::seq< + pegtl::opt, pegtl::pad, Separator>>, + pegtl::pad + > +{ +}; + class AttributeArgumentList - : public pegtl::if_must, pegtl::pad_opt, Separator>, Separator>, pegtl::one<')'>> + : public pegtl::if_must< + pegtl::one<'('>, + pegtl::pad_opt, Separator>, Separator>, + pegtl::one<')'> + > { }; -- 2.11.0