diff options
-rw-r--r-- | libgrust/libproc_macro/Makefile.am | 1 | ||||
-rw-r--r-- | libgrust/libproc_macro/Makefile.in | 5 | ||||
-rw-r--r-- | libgrust/libproc_macro/punct.cc | 34 | ||||
-rw-r--r-- | libgrust/libproc_macro/punct.h | 47 |
4 files changed, 86 insertions, 1 deletions
diff --git a/libgrust/libproc_macro/Makefile.am b/libgrust/libproc_macro/Makefile.am index 7c9d9e6ae02..4d5cbbd5967 100644 --- a/libgrust/libproc_macro/Makefile.am +++ b/libgrust/libproc_macro/Makefile.am @@ -53,6 +53,7 @@ toolexeclib_LTLIBRARIES = libproc_macro.la libproc_macro_la_SOURCES = \ proc_macro.cc \ ident.cc \ + punct.cc \ literal.cc include_HEADERS = \ diff --git a/libgrust/libproc_macro/Makefile.in b/libgrust/libproc_macro/Makefile.in index f9e3bfb9c23..efd332a2bed 100644 --- a/libgrust/libproc_macro/Makefile.in +++ b/libgrust/libproc_macro/Makefile.in @@ -138,7 +138,8 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \ "$(DESTDIR)$(includedir)" LTLIBRARIES = $(toolexeclib_LTLIBRARIES) libproc_macro_la_LIBADD = -am_libproc_macro_la_OBJECTS = proc_macro.lo ident.lo literal.lo +am_libproc_macro_la_OBJECTS = proc_macro.lo ident.lo punct.lo \ + literal.lo libproc_macro_la_OBJECTS = $(am_libproc_macro_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -387,6 +388,7 @@ toolexeclib_LTLIBRARIES = libproc_macro.la libproc_macro_la_SOURCES = \ proc_macro.cc \ ident.cc \ + punct.cc \ literal.cc include_HEADERS = \ @@ -473,6 +475,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ident.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/literal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc_macro.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/punct.Plo@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/libgrust/libproc_macro/punct.cc b/libgrust/libproc_macro/punct.cc new file mode 100644 index 00000000000..67d35fec5a8 --- /dev/null +++ b/libgrust/libproc_macro/punct.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2023 Free Software Foundation, Inc. +// +// This file is part of the GNU Proc Macro Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#include "punct.h" +#include <cstdlib> + +namespace Punct { + +Punct +Punct::make_punct (std::uint32_t ch, Spacing spacing) +{ + return {ch, spacing}; +} + +} // namespace Punct diff --git a/libgrust/libproc_macro/punct.h b/libgrust/libproc_macro/punct.h new file mode 100644 index 00000000000..0e5e42f674d --- /dev/null +++ b/libgrust/libproc_macro/punct.h @@ -0,0 +1,47 @@ +// Copyright (C) 2023 Free Software Foundation, Inc. +// +// This file is part of the GNU Proc Macro Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +#ifndef PUNCT_H +#define PUNCT_H + +#include <cstdint> + +namespace Punct { + +enum Spacing +{ + Alone, + Joint +}; + +struct Punct +{ + std::uint32_t ch; + Spacing spacing; + +public: + static Punct make_punct (std::uint32_t ch, Spacing spacing = Spacing::Alone); +}; + +} // namespace Punct + +#endif /* ! PUNCT_H */ |