From 99c58ddf1d855e3cfa57c24f9f9a838005ab48a2 Mon Sep 17 00:00:00 2001 From: Henny022p Date: Tue, 23 Nov 2021 06:33:11 +0100 Subject: moved preproc --- tools/src/preproc/string_parser.h | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 tools/src/preproc/string_parser.h (limited to 'tools/src/preproc/string_parser.h') diff --git a/tools/src/preproc/string_parser.h b/tools/src/preproc/string_parser.h new file mode 100755 index 00000000..abd2bfe9 --- /dev/null +++ b/tools/src/preproc/string_parser.h @@ -0,0 +1,55 @@ +// Copyright(c) 2016 YamaArashi +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef STRING_PARSER_H +#define STRING_PARSER_H + +#include +#include +#include "preproc.h" + +class StringParser +{ +public: + StringParser(char* buffer, long size) : m_buffer(buffer), m_size(size), m_pos(0) {} + int ParseString(long srcPos, unsigned char* dest, int &destLength); + +private: + struct Integer + { + std::uint32_t value; + int size; + }; + + char* m_buffer; + long m_size; + long m_pos; + + Integer ReadInteger(); + Integer ReadDecimal(); + Integer ReadHex(); + std::string ReadCharOrEscape(); + std::string ReadBracketedConstants(); + void SkipWhitespace(); + void SkipRestOfInteger(int radix); + void RaiseError(const char* format, ...); +}; + +#endif // STRING_PARSER_H -- cgit v1.2.3 From dee773da4a12af1c48bf58d6275fe4fed20871b6 Mon Sep 17 00:00:00 2001 From: Henny022p Date: Tue, 23 Nov 2021 09:31:09 +0100 Subject: apply clang-format to tool sources --- tools/src/preproc/string_parser.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) mode change 100755 => 100644 tools/src/preproc/string_parser.h (limited to 'tools/src/preproc/string_parser.h') diff --git a/tools/src/preproc/string_parser.h b/tools/src/preproc/string_parser.h old mode 100755 new mode 100644 index abd2bfe9..2e212640 --- a/tools/src/preproc/string_parser.h +++ b/tools/src/preproc/string_parser.h @@ -25,15 +25,14 @@ #include #include "preproc.h" -class StringParser -{ -public: - StringParser(char* buffer, long size) : m_buffer(buffer), m_size(size), m_pos(0) {} - int ParseString(long srcPos, unsigned char* dest, int &destLength); +class StringParser { + public: + StringParser(char* buffer, long size) : m_buffer(buffer), m_size(size), m_pos(0) { + } + int ParseString(long srcPos, unsigned char* dest, int& destLength); -private: - struct Integer - { + private: + struct Integer { std::uint32_t value; int size; }; -- cgit v1.2.3