diff --git a/.gitignore b/.gitignore
index 9c2098d..8b59ba1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
tmp
*.sw?
+seed.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf10526..f3a04c9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,82 +1,69 @@
+# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
#
-# File:
-# CMakeLists.txt
+# https://snapwebsites.org/project/csspp
+# contact@m2osw.com
#
-# Description:
-# Definitions to create the build environment with cmake
+# This program 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 2 of the License, or
+# (at your option) any later version.
#
-# Documentation:
-# See the CMake documentation.
-#
-# License:
-# csspp -- a CSS Preprocessor
-# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
-#
-# https://snapwebsites.org/
-# contact@m2osw.com
-#
-# This program 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 2 of the License, or
-# (at your option) any later version.
-#
-# This program 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.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# This program 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.
#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
## Initialization
##
-cmake_minimum_required(VERSION 2.8.4)
+cmake_minimum_required(VERSION 3.10.2)
-project( csspp_project )
+project(csspp_project)
-enable_language( CXX )
+enable_language(CXX)
enable_testing()
## Include support modules
##
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
-find_package( AdvGetOpt REQUIRED )
-find_package( LibExcept REQUIRED )
-find_package( LibUtf8 REQUIRED )
-find_package( SnapCMakeModules REQUIRED )
-find_package( SnapDoxygen )
+find_package(AdvGetOpt REQUIRED)
+find_package(LibExcept REQUIRED)
+find_package(LibUtf8 REQUIRED)
+find_package(SnapCMakeModules REQUIRED)
+find_package(SnapDev REQUIRED)
-SnapGetVersion( CSSPP ${CMAKE_CURRENT_SOURCE_DIR} )
+SnapGetVersion(CSSPP ${CMAKE_CURRENT_SOURCE_DIR})
-if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
+if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message("Debug is in effect for csspp!")
- add_definitions( -DDEBUG -D_DEBUG )
+ add_definitions(-DDEBUG -D_DEBUG)
else()
message("Debug is turned OFF")
- add_definitions( -DNDEBUG )
+ add_definitions(-DNDEBUG)
endif()
# A few extra warnings specifically for snapwebsites libraries and tools
# You can also play with -Weffc++ although we are definitively not compliant
# (especially we do not define all the auto-initialized variables!)
# -Wconversion -- would be nice, a few things are still not cooperating with that one
-set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Wnoexcept" )
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Wnoexcept")
include_directories(
- ${PROJECT_SOURCE_DIR}/include
- ${PROJECT_BINARY_DIR}/include
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
)
##
## Compiling
##
-add_subdirectory(include) # public headers
-add_subdirectory(lib) # csspp library
-add_subdirectory(scripts) # command line tools
-add_subdirectory(src) # command line tools
+add_subdirectory(csspp) # csspp library
+add_subdirectory(cmake) # cmake include files
+add_subdirectory(scripts) # csspp system & validation scripts
+add_subdirectory(tools) # command line tools
add_subdirectory(tests) # tests
add_subdirectory(doc) # library API documentation
diff --git a/INSTALL.txt b/INSTALL.txt
index 69a51d8..b7009e3 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,21 +1,9 @@
-To build csspp, use cmake:
+With the current setup, compiling csspp should be done from within the
+snapcpp environment or using the standalone tarball (see dev/INSTALL.md
+for details about that other option).
- tar xf csspp.tar.gz
- mkdir BUILD
- cd BUILD
- cmake ../csspp
- make
- make install
-
-The csspp directory is likely to include a version by default. Change the
-references in that script as required.
-
-The creation of the documentation requires doxygen:
-
- sudo apt-get install doxygen
-
-The creation of the tests require catch.hpp, under Ubuntu:
-
- sudo apt-get install catch
+The csspp project is also available pre-compiled on launchpad, which is
+probably you best/easiest option if you have Ubuntu or some other Debian
+flavor system.
diff --git a/README.md b/README.md
index 712efe9..c6e0ef1 100644
--- a/README.md
+++ b/README.md
@@ -40,8 +40,8 @@ generated.
# Compile the library and `csspp` command line tool
-The INSTALL in the root directory tells you how to generate the
-distribution directory (or dev/INSTALL in the `csspp` project itself.)
+The `INSTALL.md` in the root directory tells you how to generate the
+distribution directory (or `dev/INSTALL.md` in the standalone `csspp` project).
We will be looking at making this simpler with time... for now, the
environment is a bit convoluted.
diff --git a/TODO.txt b/TODO.txt
index 4245001..b14c412 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,4 +1,5 @@
+
To be closer to what SASS supports, we shall implement the following
additional features:
@@ -20,7 +21,7 @@ additional features:
we may end up with what looks like an invalid expression even if it is
not. By first parsing everything and creating a tree, we could 100%
avoid calculating what is going to be simplified in the first place.
- In the case of the ?: oeprator, that means only the true or false
+ In the case of the ?: operator, that means only the true or false
tree is taken in account. The other tree is completely ignored.
@@ -108,4 +109,8 @@ additional features:
the final tarball.
+. Look at fixing the ./mk script so it works for all versions (only Debug
+ is properly supported at the moment)
+
+
vim: tw=2 sw=2 et
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
new file mode 100644
index 0000000..50cd441
--- /dev/null
+++ b/cmake/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
+#
+# https://snapwebsites.org/project/csspp
+# contact@m2osw.com
+#
+# This program 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+project(csspp)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake
+ @ONLY
+)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfigVersion.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake
+ @ONLY
+)
+
+install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake
+
+ DESTINATION
+ share/cmake/CSSPP
+)
+
+# Local Variables:
+# indent-tabs-mode: nil
+# tab-width: 4
+# End:
+
+# vim: ts=4 sw=4 et nocindent
diff --git a/cmake/CSSPPConfig.cmake.in b/cmake/CSSPPConfig.cmake.in
new file mode 100644
index 0000000..b563ee9
--- /dev/null
+++ b/cmake/CSSPPConfig.cmake.in
@@ -0,0 +1,43 @@
+# Try to find the CSS Preprocessor development files
+#
+# Once done this will define
+#
+# CSSPP_FOUND - System has the csspp library
+# CSSPP_INCLUDE_DIRS - The csspp include directories
+# CSSPP_LIBRARIES - The libraries needed to use libcsspp
+# CSSPP_DEFINITIONS - Compiler switches required for linking against csspp
+
+# Version
+set(CSSPP_VERSION_MAJOR @CSSPP_VERSION_MAJOR@)
+set(CSSPP_VERSION_MINOR @CSSPP_VERSION_MINOR@)
+set(CSSPP_VERSION_PATCH @CSSPP_VERSION_PATCH@)
+set(CSSPP_VERSION @CSSPP_VERSION_MAJOR@.@CSSPP_VERSION_MINOR@.@CSSPP_VERSION_PATCH@)
+
+# For verification files
+set(CSSPP_CONFIG_DIR /usr/lib/csspp)
+
+find_path(CSSPP_INCLUDE_DIR csspp/csspp.h
+ HINTS $ENV{CSSPP_INCLUDE_DIR}
+)
+
+find_library(CSSPP_LIBRARY csspp
+ HINTS $ENV{CSSPP_LIBRARY}
+)
+
+mark_as_advanced(CSSPP_INCLUDE_DIR CSSPP_LIBRARY)
+
+set(CSSPP_INCLUDE_DIRS ${CSSPP_INCLUDE_DIR})
+set(CSSPP_LIBRARIES ${CSSPP_LIBRARY})
+
+# handle the QUIETLY and REQUIRED arguments and set CSSPP_FOUND to TRUE
+# if all listed variables are TRUE
+#
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ CSSPP
+ DEFAULT_MSG
+ CSSPP_INCLUDE_DIR
+ CSSPP_LIBRARY
+)
+
+# vim: ts=4 sw=4 et
diff --git a/lib/CSSPPConfigVersion.cmake.in b/cmake/CSSPPConfigVersion.cmake.in
similarity index 95%
rename from lib/CSSPPConfigVersion.cmake.in
rename to cmake/CSSPPConfigVersion.cmake.in
index e5ff346..37c0ea9 100644
--- a/lib/CSSPPConfigVersion.cmake.in
+++ b/cmake/CSSPPConfigVersion.cmake.in
@@ -1,7 +1,7 @@
# Verify CSS Preprocessor version validity.
#
# License:
-# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/lib/CMakeLists.txt b/csspp/CMakeLists.txt
similarity index 53%
rename from lib/CMakeLists.txt
rename to csspp/CMakeLists.txt
index 2c3e75f..78a6833 100644
--- a/lib/CMakeLists.txt
+++ b/csspp/CMakeLists.txt
@@ -1,45 +1,30 @@
+# Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
#
-# File:
-# lib/CMakeLists.txt
+# https://snapwebsites.org/project/csspp
+# contact@m2osw.com
#
-# Description:
-# The csspp library.
+# This program 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 2 of the License, or
+# (at your option) any later version.
#
-# Documentation:
-# See the CMake documentation.
-#
-# License:
-# Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
-#
-# https://snapwebsites.org/
-# contact@m2osw.com
-#
-# This program 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 2 of the License, or
-# (at your option) any later version.
-#
-# This program 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.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# This program 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.
#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
project(csspp)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfig.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake
- @ONLY)
-
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CSSPPConfigVersion.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake
- @ONLY)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/csspp.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/csspp.h
+)
-add_library( ${PROJECT_NAME} SHARED
+add_library(${PROJECT_NAME} SHARED
assembler.cpp # Write the nodes back out
csspp.cpp # Some basics about the library
color.cpp # Manager RGBA colors
@@ -65,28 +50,52 @@ add_library( ${PROJECT_NAME} SHARED
unicode_range.cpp # Handle a Unicode Range value
)
-#target_link_libraries( ${PROJECT_NAME}
-# ${LIBTLD_LIBRARIES}
-#)
+target_include_directories(${PROJECT_NAME}
+ PUBLIC
+ ${ADVGETOPT_INCLUDE_DIRS}
+ ${LIBEXCEPT_INCLUDE_DIRS}
+)
-set_target_properties( ${PROJECT_NAME} PROPERTIES
+set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${CSSPP_VERSION_MAJOR}.${CSSPP_VERSION_MINOR}
SOVERSION ${CSSPP_VERSION_MAJOR}
)
install(
- TARGETS ${PROJECT_NAME}
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
+ TARGETS
+ ${PROJECT_NAME}
+
+ RUNTIME DESTINATION
+ bin
+
+ LIBRARY DESTINATION
+ lib
+
+ ARCHIVE DESTINATION
+ lib
)
install(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfig.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/CSSPPConfigVersion.cmake
- DESTINATION share/cmake/CSSPP
+ FILES
+ assembler.h
+ color.h
+ compiler.h
+ ${CMAKE_CURRENT_BINARY_DIR}/csspp.h
+ error.h
+ exception.h
+ expression.h
+ lexer.h
+ node.h
+ nth_child.h
+ parser.h
+ position.h
+ unicode_range.h
+
+ DESTINATION
+ include/csspp
)
+
# Local Variables:
# indent-tabs-mode: nil
# tab-width: 4
diff --git a/lib/assembler.cpp b/csspp/assembler.cpp
similarity index 95%
rename from lib/assembler.cpp
rename to csspp/assembler.cpp
index de8a03a..ce5818b 100644
--- a/lib/assembler.cpp
+++ b/csspp/assembler.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor assembler.
@@ -28,14 +27,26 @@
* \sa \ref lexer_rules
*/
-#include "csspp/assembler.h"
+// self
+//
+#include "csspp/assembler.h"
+
+#include "csspp/exception.h"
+#include "csspp/lexer.h"
+#include "csspp/nth_child.h"
+#include "csspp/unicode_range.h"
+
+
+// C++
+//
+#include
+
+
+// last include
+//
+#include
-#include "csspp/exceptions.h"
-#include "csspp/lexer.h"
-#include "csspp/nth_child.h"
-#include "csspp/unicode_range.h"
-#include
namespace csspp
{
@@ -734,17 +745,17 @@ void assembler::output_component_value(node::pointer_t n)
std::stringstream ss; // LCOV_EXCL_LINE
ss << "assembler.cpp: expected all direct children of COMPONENT_VALUE to be ARG instead of " // LCOV_EXCL_LINE
<< c->get_type() // LCOV_EXCL_LINE
- << " on line "
- << c->get_position().get_line()
- << " in \""
- << c->get_position().get_filename()
+ << " on line " // LCOV_EXCL_LINE
+ << c->get_position().get_line() // LCOV_EXCL_LINE
+ << " in \"" // LCOV_EXCL_LINE
+ << c->get_position().get_filename() // LCOV_EXCL_LINE
<< "\"."; // LCOV_EXCL_LINE
- if(c->is(node_type_t::IDENTIFIER))
+ if(c->is(node_type_t::IDENTIFIER)) // LCOV_EXCL_LINE
{
- ss << " (identifier is \"" << escape_id(c->get_string()) << "\")";
+ ss << " (identifier is \"" << escape_id(c->get_string()) << "\")"; // LCOV_EXCL_LINE
}
throw csspp_exception_logic(ss.str()); // LCOV_EXCL_LINE
- }
+ } // LCOV_EXCL_LINE
else if(c->empty() || !c->get_last_child()->is(node_type_t::PLACEHOLDER))
{
// TODO: if we compile out PLACEHOLDER nodes in the compiler
diff --git a/include/csspp/assembler.h b/csspp/assembler.h
similarity index 81%
rename from include/csspp/assembler.h
rename to csspp/assembler.h
index 0294a89..5005258 100644
--- a/include/csspp/assembler.h
+++ b/csspp/assembler.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_ASSEMBLER_H
-#define CSSPP_ASSEMBLER_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,11 +10,15 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
+
+// self
+//
+#include "csspp/node.h"
-#include "csspp/node.h"
namespace csspp
{
@@ -59,14 +60,4 @@ class assembler
std::ostream & operator << (std::ostream & out, csspp::output_mode_t const type);
-#endif
-// #ifndef CSSPP_ASSEMBLER_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/color.cpp b/csspp/color.cpp
similarity index 97%
rename from lib/color.cpp
rename to csspp/color.cpp
index 10ebe4a..1399aac 100644
--- a/lib/color.cpp
+++ b/csspp/color.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor color class.
@@ -28,13 +27,25 @@
* into in string as small as possible (i.e. compress colors.)
*/
-#include "csspp/lexer.h"
+// self
+//
+#include "csspp/lexer.h"
+
+#include "csspp/exception.h"
+
+
+// C++
+//
+#include
+#include
+#include
+
+
+// last include
+//
+#include
-#include "csspp/exceptions.h"
-#include
-#include
-#include
namespace csspp
{
diff --git a/include/csspp/color.h b/csspp/color.h
similarity index 85%
rename from include/csspp/color.h
rename to csspp/color.h
index 5e1d37a..f8b5419 100644
--- a/include/csspp/color.h
+++ b/csspp/color.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_COLOR_H
-#define CSSPP_COLOR_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,12 +10,16 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
+
+// C++
+//
+#include
+#include
-#include
-#include
namespace csspp
{
@@ -67,14 +68,4 @@ class color
};
} // namespace csspp
-#endif
-// #ifndef CSSPP_COLOR_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/compiler.cpp b/csspp/compiler.cpp
similarity index 99%
rename from lib/compiler.cpp
rename to csspp/compiler.cpp
index 059e0d2..f6b20bb 100644
--- a/lib/compiler.cpp
+++ b/csspp/compiler.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor compiler.
@@ -24,17 +23,32 @@
* \sa \ref compiler_reference
*/
-#include "csspp/compiler.h"
+// self
+//
+#include "csspp/compiler.h"
+
+#include "csspp/exception.h"
+#include "csspp/nth_child.h"
+#include "csspp/parser.h"
+
+
+// C++
+//
+#include
+#include
+#include
+
+
+// C
+//
+#include
+
-#include "csspp/exceptions.h"
-#include "csspp/nth_child.h"
-#include "csspp/parser.h"
+// last include
+//
+#include
-#include
-#include
-#include
-#include
namespace csspp
{
@@ -428,7 +442,7 @@ void compiler::set_date_time_variables(time_t now)
// convert date/time in a string
struct tm t;
- localtime_r(&now, &t);
+ gmtime_r(&now, &t);
char buf[20];
strftime(buf, sizeof(buf), "%m/%d/%Y%T", &t);
@@ -1133,7 +1147,7 @@ void compiler::compile_declaration_values(node::pointer_t declaration)
<< component->get_type() // LCOV_EXCL_LINE
<< ", expected a LIST."; // LCOV_EXCL_LINE
throw csspp_exception_logic(errmsg.str()); // LCOV_EXCL_LINE
- }
+ } // LCOV_EXCL_LINE
if(j < item->size()
&& component == item->get_child(j))
{
@@ -1916,9 +1930,7 @@ void compiler::remove_empty_rules(node::pointer_t n)
f_state.get_previous_parent()->remove_child(n);
return;
}
-#if __cplusplus >= 201700
[[fallthrough]];
-#endif
case node_type_t::AT_KEYWORD:
//case node_type_t::ARG:
case node_type_t::DECLARATION:
@@ -2206,7 +2218,7 @@ void compiler::replace_variable(node::pointer_t parent, node::pointer_t n, size_
}
}
- compiler c(&c.f_state);
+ compiler c(f_compiler_validating);
c.set_root(root);
c.f_state.set_paths(f_state);
c.f_state.set_empty_on_undefined_variable(f_state.get_empty_on_undefined_variable());
@@ -4116,7 +4128,7 @@ void compiler::expand_nested_declarations(std::string const & name, node::pointe
}
break;
- case node_type_t::AT_KEYWORD:
+ case node_type_t::AT_KEYWORD: // LCOV_EXCL_LINE
// we may have to handle declarations within an @-keyword, but
// it is not a sub-expand-nested-declaration
throw csspp_exception_logic("compiler.cpp:compiler::expand_nested_declarations(): @-keyword cannot appear within a declaration."); // LCOV_EXCL_LINE
diff --git a/include/csspp/compiler.h b/csspp/compiler.h
similarity index 93%
rename from include/csspp/compiler.h
rename to csspp/compiler.h
index b49676c..a1f76f6 100644
--- a/include/csspp/compiler.h
+++ b/csspp/compiler.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_COMPILER_H
-#define CSSPP_COMPILER_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,11 +10,14 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
-#include "csspp/expression.h"
+// self
+//
+#include "csspp/expression.h"
namespace csspp
{
@@ -130,14 +130,4 @@ class compiler
};
} // namespace csspp
-#endif
-// #ifndef CSSPP_COMPILER_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/csspp.cpp b/csspp/csspp.cpp
similarity index 89%
rename from lib/csspp.cpp
rename to csspp/csspp.cpp
index 626874d..cfadbb5 100644
--- a/lib/csspp.cpp
+++ b/csspp/csspp.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor library.
@@ -25,15 +24,27 @@
* \sa \ref lexer_rules
*/
-#include "csspp/csspp.h"
+// self
+//
+#include "csspp/csspp.h"
+
+#include "csspp/exception.h"
+
+
+// C++
+//
+#include
+#include
+#include
+#include
+#include
+
+
+// last include
+//
+#include
-#include "csspp/exceptions.h"
-#include
-#include
-#include
-#include
-#include
/** \brief The namespace of all the classes in the CSS Preprocessor.
*
diff --git a/include/csspp/csspp.h.in b/csspp/csspp.h.in
similarity index 83%
rename from include/csspp/csspp.h.in
rename to csspp/csspp.h.in
index 7638b22..3372999 100644
--- a/include/csspp/csspp.h.in
+++ b/csspp/csspp.h.in
@@ -1,7 +1,4 @@
-#ifndef CSSPP_CSSPP_H
-#define CSSPP_CSSPP_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,15 +10,22 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
-#include "csspp/exceptions.h"
+// self
+//
+#include "csspp/exception.h"
+
+
+// C++
+//
+#include
+#include
+#include
-#include
-#include
-#include
#ifdef __CYGWIN__
namespace std
@@ -116,14 +120,4 @@ private:
};
} // namespace csspp
-#endif
-// #ifndef CSSPP_CSSPP_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/error.cpp b/csspp/error.cpp
similarity index 96%
rename from lib/error.cpp
rename to csspp/error.cpp
index dbc7609..906b1f0 100644
--- a/lib/error.cpp
+++ b/csspp/error.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor error handling.
@@ -54,10 +53,10 @@
* \sa \ref lexer_rules
*/
-#include "csspp/error.h"
+#include "csspp/error.h"
-#include
-#include
+#include
+#include
namespace csspp
{
diff --git a/include/csspp/error.h b/csspp/error.h
similarity index 88%
rename from include/csspp/error.h
rename to csspp/error.h
index a0fa556..98346a0 100644
--- a/include/csspp/error.h
+++ b/csspp/error.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_ERROR_H
-#define CSSPP_ERROR_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,14 +10,21 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
-#include "csspp/position.h"
+// self
+//
+#include "csspp/position.h"
+
+
+// C++
+//
+#include
+#include
-#include
-#include
namespace csspp
{
@@ -128,14 +132,4 @@ class error_happened_t
std::ostream & operator << (std::ostream & out, csspp::error_mode_t const type);
-#endif
-// #ifndef CSSPP_LEXER_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/include/csspp/exceptions.h b/csspp/exception.h
similarity index 82%
rename from include/csspp/exceptions.h
rename to csspp/exception.h
index 09f2656..e914d4a 100644
--- a/include/csspp/exceptions.h
+++ b/csspp/exception.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_EXCEPTIONS_H
-#define CSSPP_EXCEPTIONS_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,11 +10,15 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
+
+// C++
+//
+#include
-#include
namespace csspp
{
@@ -76,14 +77,4 @@ class csspp_exception_exit : public csspp_exception_runtime
};
} // namespace csspp
-#endif
-// #ifndef CSSPP_EXCEPTIONS_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/expr_additive.cpp b/csspp/expr_additive.cpp
similarity index 94%
rename from lib/expr_additive.cpp
rename to csspp/expr_additive.cpp
index 4d45770..5faec98 100644
--- a/lib/expr_additive.cpp
+++ b/csspp/expr_additive.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,27 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+// self
+//
+#include "csspp/expression.h"
+
+#include "csspp/exception.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
+
+
+// C++
+//
+#include
+#include
+#include
+
+
+// last include
+//
+#include
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
-#include
-#include
-#include
namespace csspp
{
@@ -281,7 +292,7 @@ node::pointer_t add(node::pointer_t lhs, node::pointer_t rhs, bool subtract)
}
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:add(): 'type' set to a value which is not handled here."); // LCOV_EXCL_LINE
}
@@ -329,12 +340,4 @@ node::pointer_t expression::additive()
}
} // namespace csspp
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/expr_conditional.cpp b/csspp/expr_conditional.cpp
similarity index 87%
rename from lib/expr_conditional.cpp
rename to csspp/expr_conditional.cpp
index b6c11ba..422b508 100644
--- a/lib/expr_conditional.cpp
+++ b/csspp/expr_conditional.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,14 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/lib/expr_equality.cpp b/csspp/expr_equality.cpp
similarity index 94%
rename from lib/expr_equality.cpp
rename to csspp/expr_equality.cpp
index b422588..410ffba 100644
--- a/lib/expr_equality.cpp
+++ b/csspp/expr_equality.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,15 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/exception.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
@@ -93,7 +92,7 @@ bool match(node_type_t op, node::pointer_t lhs, node::pointer_t rhs)
s = "-" + s + "-";
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:include_match(): called with an invalid operator."); // LCOV_EXCL_LINE
}
@@ -270,7 +269,7 @@ node::pointer_t expression::equality()
boolean_result = match(op, result, rhs);
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:equality(): unexpected operator in 'op'."); // LCOV_EXCL_LINE
}
diff --git a/lib/expr_list.cpp b/csspp/expr_list.cpp
similarity index 96%
rename from lib/expr_list.cpp
rename to csspp/expr_list.cpp
index 0091668..3c800ba 100644
--- a/lib/expr_list.cpp
+++ b/csspp/expr_list.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,15 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/exception.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/lib/expr_logical_and.cpp b/csspp/expr_logical_and.cpp
similarity index 86%
rename from lib/expr_logical_and.cpp
rename to csspp/expr_logical_and.cpp
index 26a30c5..494b46d 100644
--- a/lib/expr_logical_and.cpp
+++ b/csspp/expr_logical_and.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,14 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/lib/expr_logical_or.cpp b/csspp/expr_logical_or.cpp
similarity index 82%
rename from lib/expr_logical_or.cpp
rename to csspp/expr_logical_or.cpp
index 29938d6..1b780a8 100644
--- a/lib/expr_logical_or.cpp
+++ b/csspp/expr_logical_or.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,14 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/lib/expr_multiplicative.cpp b/csspp/expr_multiplicative.cpp
similarity index 97%
rename from lib/expr_multiplicative.cpp
rename to csspp/expr_multiplicative.cpp
index 0a0674c..a2b37f5 100644
--- a/lib/expr_multiplicative.cpp
+++ b/csspp/expr_multiplicative.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,27 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+// self
+//
+#include "csspp/expression.h"
+
+#include "csspp/exception.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
+
+
+// C++
+//
+#include
+#include
+#include
+
+
+// last include
+//
+#include
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
-#include
-#include
-#include
namespace csspp
{
@@ -486,7 +497,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node::
alpha = fmod(alpha, bf);
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE
}
@@ -566,7 +577,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node::
lalpha = fmod(lalpha , ralpha);
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE
}
@@ -671,7 +682,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node::
result->set_string(multiplicative_dimension(lhs->get_position(), ldim, op, rdim));
break;
- default:
+ default: // LCOV_EXCL_LINE
// that should never happen
throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE
@@ -709,7 +720,7 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node::
result->set_integer(ai % bi);
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE
}
@@ -751,13 +762,13 @@ node::pointer_t expression::multiply(node_type_t op, node::pointer_t lhs, node::
result->set_decimal_number(fmod(af, bf));
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:multiply(): unexpected operator."); // LCOV_EXCL_LINE
}
break;
- default:
+ default: // LCOV_EXCL_LINE
throw csspp_exception_logic("expression.cpp:multiply(): 'type' set to a value which is not handled here."); // LCOV_EXCL_LINE
}
diff --git a/lib/expr_power.cpp b/csspp/expr_power.cpp
similarity index 94%
rename from lib/expr_power.cpp
rename to csspp/expr_power.cpp
index d02a377..e069ac5 100644
--- a/lib/expr_power.cpp
+++ b/csspp/expr_power.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,15 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/exception.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/lib/expr_relational.cpp b/csspp/expr_relational.cpp
similarity index 92%
rename from lib/expr_relational.cpp
rename to csspp/expr_relational.cpp
index 3275704..41923f4 100644
--- a/lib/expr_relational.cpp
+++ b/csspp/expr_relational.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,15 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/exception.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/lib/expr_unary.cpp b/csspp/expr_unary.cpp
similarity index 96%
rename from lib/expr_unary.cpp
rename to csspp/expr_unary.cpp
index 4458b89..61cdb54 100644
--- a/lib/expr_unary.cpp
+++ b/csspp/expr_unary.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,14 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/lib/expression.cpp b/csspp/expression.cpp
similarity index 82%
rename from lib/expression.cpp
rename to csspp/expression.cpp
index 68baf81..37ae7f1 100644
--- a/lib/expression.cpp
+++ b/csspp/expression.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -21,18 +20,40 @@
* The CSS Preprocessor expression class is used to reduce a list
* of nodes by applying expressions to the various values.
*
- * \sa \ref expression_rules
+ * \section expression_rules Expression Rules
+ *
+ * The expression rules are as follow:
+ *
+ * \code
+ * expr '+' expr
+ * | expr '*' expr
+ * | ...
+ * \endcode
+ *
+ * TODO: determine what I meant to include in this section.
*/
-#include "csspp/expression.h"
+// self
+//
+#include "csspp/expression.h"
+
+#include "csspp/exception.h"
+#include "csspp/parser.h"
+#include "csspp/unicode_range.h"
+
+
+// C++
+//
+#include
+#include
+#include
+
+
+// last include
+//
+#include
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
-#include "csspp/unicode_range.h"
-#include
-#include
-#include
namespace csspp
{
@@ -137,12 +158,4 @@ void expression::next()
}
} // namespace csspp
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/include/csspp/expression.h b/csspp/expression.h
similarity index 94%
rename from include/csspp/expression.h
rename to csspp/expression.h
index ea9f7fb..70b2aaf 100644
--- a/include/csspp/expression.h
+++ b/csspp/expression.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_EXPRESSION_H
-#define CSSPP_EXPRESSION_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,11 +10,15 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
+
+// self
+//
+#include "csspp/node.h"
-#include "csspp/node.h"
namespace csspp
{
@@ -159,14 +160,4 @@ class expression
#pragma GCC diagnostic pop
} // namespace csspp
-#endif
-// #ifndef CSSPP_LEXER_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/internal_functions.cpp b/csspp/internal_functions.cpp
similarity index 99%
rename from lib/internal_functions.cpp
rename to csspp/internal_functions.cpp
index e5f804d..a7d5d6d 100644
--- a/lib/internal_functions.cpp
+++ b/csspp/internal_functions.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor expression.
@@ -24,15 +23,14 @@
* \sa \ref expression_rules
*/
-#include "csspp/expression.h"
+#include "csspp/expression.h"
-#include "csspp/exceptions.h"
-#include "csspp/parser.h"
+#include "csspp/parser.h"
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
namespace csspp
{
@@ -1064,7 +1062,10 @@ node::pointer_t expression::internal_function__max(node::pointer_t func)
{
if(n->is(node_type_t::PERCENT))
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wrestrict"
dimension = "%";
+#pragma GCC diagnostic pop
}
else
{
@@ -1123,7 +1124,10 @@ node::pointer_t expression::internal_function__min(node::pointer_t func)
{
if(n->is(node_type_t::PERCENT))
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wrestrict"
dimension = "%";
+#pragma GCC diagnostic pop
}
else
{
diff --git a/lib/lexer.cpp b/csspp/lexer.cpp
similarity index 99%
rename from lib/lexer.cpp
rename to csspp/lexer.cpp
index 9786e9e..88290b6 100644
--- a/lib/lexer.cpp
+++ b/csspp/lexer.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor lexer.
@@ -38,14 +37,14 @@
* \sa \ref lexer_rules
*/
-#include "csspp/lexer.h"
+#include "csspp/lexer.h"
-#include "csspp/exceptions.h"
-#include "csspp/unicode_range.h"
+#include "csspp/exception.h"
+#include "csspp/unicode_range.h"
-#include
-#include
-#include
+#include
+#include
+#include
namespace csspp
{
diff --git a/include/csspp/lexer.h b/csspp/lexer.h
similarity index 89%
rename from include/csspp/lexer.h
rename to csspp/lexer.h
index dfd8b9e..d1e9e70 100644
--- a/include/csspp/lexer.h
+++ b/csspp/lexer.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_LEXER_H
-#define CSSPP_LEXER_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,11 +10,15 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
+
+// self
+//
+#include "csspp/node.h"
-#include "csspp/node.h"
namespace csspp
{
@@ -130,14 +131,4 @@ class lexer
};
} // namespace csspp
-#endif
-// #ifndef CSSPP_LEXER_H
-
-// Local Variables:
-// mode: cpp
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// tab-width: 4
-// End:
-
// vim: ts=4 sw=4 et
diff --git a/lib/node.cpp b/csspp/node.cpp
similarity index 98%
rename from lib/node.cpp
rename to csspp/node.cpp
index 7d9d224..498cf10 100644
--- a/lib/node.cpp
+++ b/csspp/node.cpp
@@ -1,5 +1,4 @@
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -11,9 +10,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/** \file
* \brief Implementation of the CSS Preprocessor node.
@@ -29,14 +28,26 @@
* \sa \ref lexer_rules
*/
-#include
+// self
+//
+#include
+
+#include
+#include
+#include
+
+
+// C++
+//
+#include
+#include
+
+
+// last include
+//
+#include
-#include
-#include
-#include
-#include
-#include
namespace csspp
{
diff --git a/include/csspp/node.h b/csspp/node.h
similarity index 94%
rename from include/csspp/node.h
rename to csspp/node.h
index a12d85d..32accdf 100644
--- a/include/csspp/node.h
+++ b/csspp/node.h
@@ -1,7 +1,4 @@
-#ifndef CSSPP_NODE_H
-#define CSSPP_NODE_H
-// CSS Preprocessor
-// Copyright (c) 2015-2019 Made to Order Software Corp. All Rights Reserved
+// Copyright (c) 2015-2025 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -13,15 +10,22 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#pragma once
-#include
-#include
+// self
+//
+#include "csspp/color.h"
+#include "csspp/error.h"
+
+
+// C++
+//
+#include