From 29c8ce737f513766673fd3e57e30233d9fcce159 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 13 Sep 2009 14:02:04 +0200 Subject: Add C++ source code indenter --- cutl/compiler/cxx-indenter.cxx | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 cutl/compiler/cxx-indenter.cxx (limited to 'cutl/compiler/cxx-indenter.cxx') diff --git a/cutl/compiler/cxx-indenter.cxx b/cutl/compiler/cxx-indenter.cxx new file mode 100644 index 0000000..2173942 --- /dev/null +++ b/cutl/compiler/cxx-indenter.cxx @@ -0,0 +1,50 @@ +// file : cutl/compiler/cxx-indenter.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include + +namespace cutl +{ + namespace compiler + { + template<> + char const* cxx_indenter:: + keyword (cxx_indenter::keyword_type t) + { + static char const* keywords[] = + { + "if", + "do", + "for", + "else", + "case", + "while", + "catch", + "default" + }; + + return keywords[t]; + } + + template<> + wchar_t const* cxx_indenter:: + keyword (cxx_indenter::keyword_type t) + { + static wchar_t const* keywords[] = + { + L"if", + L"do", + L"for", + L"else", + L"case", + L"while", + L"catch", + L"default" + }; + + return keywords[t]; + } + } +} -- cgit v1.1