From 8e761289a2446367267c6c0d9a26e734f0f78306 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 16 Dec 2020 20:29:05 +0300 Subject: Get rid of legacy build systems and rename cutl/ to libcutl/ --- cutl/compiler/cxx-indenter.hxx | 170 ----------------------------------------- 1 file changed, 170 deletions(-) delete mode 100644 cutl/compiler/cxx-indenter.hxx (limited to 'cutl/compiler/cxx-indenter.hxx') diff --git a/cutl/compiler/cxx-indenter.hxx b/cutl/compiler/cxx-indenter.hxx deleted file mode 100644 index 82a6b29..0000000 --- a/cutl/compiler/cxx-indenter.hxx +++ /dev/null @@ -1,170 +0,0 @@ -// file : cutl/compiler/cxx-indenter.hxx -// license : MIT; see accompanying LICENSE file - -#ifndef CUTL_COMPILER_CXX_INDENTER_HXX -#define CUTL_COMPILER_CXX_INDENTER_HXX - -#include -#include -#include -#include -#include // std::size_t - -#include - -namespace cutl -{ - namespace compiler - { - template - class cxx_indenter: public code_stream - { - public: - cxx_indenter (code_stream& out); - - private: - cxx_indenter (cxx_indenter const&); - - cxx_indenter& - operator= (cxx_indenter const&); - - public: - virtual void - put (C); - - virtual void - unbuffer (); - - private: - typedef std::basic_string string; - - enum construct - { - con_other, - con_pp_dir, - con_c_com, - con_cxx_com, - con_string_lit, - con_char_lit - }; - - private: - void - next_token (string const& old, C); - - void - ensure_new_line (); - - void - output_indentation (); - - void - write (C); - - private: - void - tokenize (C, construct old); - - void - retire (C); - - private: - enum char_class_type - { - cc_alpha, // Alpha + '_'. - cc_digit, - cc_op_punc, // Operator or punctuation. - cc_space - }; - - static char_class_type - char_class (C); - - private: - enum keyword_type - { - kw_if, - kw_do, - kw_for, - kw_else, - kw_case, - kw_while, - kw_catch, - kw_default - }; - - static C const* - keyword (keyword_type); - - private: - code_stream& out_; - bool buffering_; // True if write() should buffer the char. - std::size_t position_; // Current position on the line. - std::size_t paren_balance_; // ( ) balance. - std::stack indentation_; - std::size_t spaces_; - bool suppress_nl_; - construct construct_; - - // Special state stack for the do-while construct. The presence - // of an element in the stack indicates that we are in a braced - // do-while construct. The value of the element is the brace - // balance. - std::stack do_while_state_; - - typedef std::deque hold; - hold hold_; - - private: - string token_; // previously fully recognized token - string lexeme_; // current lexeme (accumulator) - - // Keywords that may be folowed by a single-line block, e.g., if, - // else, etc. - // - std::set single_line_blocks_; - - // Keywords that may follow (and be related) to a previous block, - // e.g., else, case, catch. - // - std::set follow_blocks_; - - string do_; - string lbrace_; - string rbrace_; - - private: - // Single-line indented blocks such as if, else, while, etc. The - // newline flag indicates whether a new line has been seen after - // the keyword. This is needed to properly distinguish cases such - // as: - // - // else if (...) - // foo (); - // - // else - // if (...) - // foo (); - // - struct indent_block - { - indent_block (bool newline, std::size_t indentation) - : newline_ (newline), indentation_ (indentation) - { - } - - bool newline_; - std::size_t indentation_; // Size of the indentation_ stack - // corresponding to this block, or - // 0 if it is not indented. - }; - - std::stack indent_stack_; - }; - } -} - -#include -#include - -#endif // CUTL_COMPILER_CXX_INDENTER_HXX -- cgit v1.1