diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index 35f81372f..813d69e58 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -11,6 +11,7 @@ env: jobs: build: + if: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository != 'elfmz/far2l') }} # The CMake configure and build commands are platform agnostic and should work equally # well on Windows or Mac. runs-on: ubuntu-latest @@ -36,7 +37,7 @@ jobs: # access regardless of the host operating system shell: bash # -S and -B options specify source and build directories - run: cmake -S . -B _build -DCMAKE_BUILD_TYPE=$BUILD_TYPE ${{ matrix.options }} + run: cmake -S . -B _build -Wno-dev -DCMAKE_BUILD_TYPE=$BUILD_TYPE ${{ matrix.options }} - name: Build shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f2ab46b0..5d91717c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ env: jobs: ubuntu-low-compiler: + if: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository != 'elfmz/far2l') }} runs-on: ubuntu-20.04 strategy: @@ -42,29 +43,35 @@ jobs: compiler: [ gcc, clang ] include: - compiler: gcc - version: 10 - c: /usr/bin/gcc-10 - cxx: /usr/bin/g++-10 + version: 7 + c: /usr/bin/gcc-7 + cxx: /usr/bin/g++-7 - compiler: clang - version: 10 - c: /usr/bin/clang-10 - cxx: /usr/bin/clang++-10 + version: 7 + c: /usr/bin/clang-7 + cxx: /usr/bin/clang++-7 name: ubuntu-${{ matrix.compiler }}-${{ matrix.version }} steps: - name: Checkout source uses: actions/checkout@v4 - - - name: Install dependencies + + - name: Install compilers + run: > + sudo apt-get update; + sudo apt-get -y install gcc-7 g++-7 clang-7 + + - name: Install far2l dependencies run: > - sudo apt-get update; sudo apt-get -y install libuchardet-dev libxml2-dev libwxgtk3.0-gtk3-dev libx11-dev libxi-dev libssl-dev libsmbclient-dev libnfs-dev libneon27-dev libssh-dev libarchive-dev - + libarchive-dev + python3-dev python3-cffi + - name: Create Build Environment # Create a separate build directory as working directory for all subsequent commands run: mkdir -p _build @@ -75,7 +82,7 @@ jobs: shell: bash # -S and -B options specify source and build directories run: > - cmake -S . -B _build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes + cmake -S . -B _build -Wno-dev -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} - name: Build @@ -85,6 +92,7 @@ jobs: cmake --build _build --config $BUILD_TYPE -j$(nproc --all) ubuntu-medium-compiler: + if: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository != 'elfmz/far2l') }} runs-on: ubuntu-22.04 strategy: @@ -107,7 +115,7 @@ jobs: - name: Checkout source uses: actions/checkout@v4 - - name: Install dependencies + - name: Install far2l dependencies run: > sudo apt-get update; sudo apt-get -y install @@ -115,7 +123,8 @@ jobs: libx11-dev libxi-dev libssl-dev libsmbclient-dev libnfs-dev libneon27-dev libssh-dev libarchive-dev - + python3-dev python3-cffi + - name: Create Build Environment # Create a separate build directory as working directory for all subsequent commands run: mkdir -p _build @@ -126,7 +135,7 @@ jobs: shell: bash # -S and -B options specify source and build directories run: > - cmake -S . -B _build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes + cmake -S . -B _build -Wno-dev -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} - name: Build @@ -136,6 +145,7 @@ jobs: cmake --build _build --config $BUILD_TYPE -j$(nproc --all) ubuntu-high-compiler: + if: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository != 'elfmz/far2l') }} runs-on: ubuntu-24.04 strategy: @@ -158,7 +168,7 @@ jobs: - name: Checkout source uses: actions/checkout@v4 - - name: Install dependencies + - name: Install far2l dependencies run: > sudo apt-get update; sudo apt-get -y install @@ -166,6 +176,7 @@ jobs: libx11-dev libxi-dev libssl-dev libsmbclient-dev libnfs-dev libneon27-dev libssh-dev libarchive-dev + python3-dev python3-cffi - name: Create Build Environment # Create a separate build directory as working directory for all subsequent commands @@ -177,7 +188,7 @@ jobs: shell: bash # -S and -B options specify source and build directories run: > - cmake -S . -B _build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes + cmake -S . -B _build -Wno-dev -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes -DCMAKE_C_COMPILER=${{ matrix.c }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} - name: Build @@ -187,6 +198,7 @@ jobs: cmake --build _build --config $BUILD_TYPE -j$(nproc --all) macos14-arm64-clang15: + if: ${{ !(github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository != 'elfmz/far2l') }} runs-on: macos-14 steps: @@ -194,7 +206,7 @@ jobs: - name: Checkout source uses: actions/checkout@v4 - - name: Install dependencies + - name: Install far2l dependencies # libx11, openssl is already installed run: > brew install @@ -215,7 +227,7 @@ jobs: # access regardless of the host operating system shell: bash # -S and -B options specify source and build directories - run: cmake -S . -B _build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes + run: cmake -S . -B _build -Wno-dev -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON=yes - name: Build shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index c0c08c400..66af0fa17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,8 @@ if(GIT_FOUND) execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tag WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_TAG - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) endif() if(NOT "${GIT_TAG}" STREQUAL "v_${VERSION}") diff --git a/colorer/configs/base/CHANGELOG.md b/colorer/configs/base/CHANGELOG.md index 0741331f0..2740f6570 100644 --- a/colorer/configs/base/CHANGELOG.md +++ b/colorer/configs/base/CHANGELOG.md @@ -17,11 +17,13 @@ - [shell-posix] Commands are not recognized correctly after escaped new-line - [shell-bash] Redirection symbols < and > inside "magic backticks" block break background highlighting till the end of the file - [shell-bash] Fix magic backticks in for loop +- [shell-bash] Fix array extension in for loop - [smarty] fixed the work of smarty templates - [markdown] amend emphasis with underscores - [markdown] fix trailing spaces in em and strong - [smarty] fixed working with nested brackets - [smarty] literal block - text only +- [shell-posix] fix variable assignments with line continuations ### Changed - Simplified catalog.xml. @@ -32,6 +34,7 @@ - remove obsolete from visual-rgb.hrd - [groovy] add .gradle as groovy - Use the new shell-posix schema for shell scripts by default +- [json] highlight JSON object keys ### Added - New package type of base - all packed. Hrc and hrd files in one archive. Directory 'auto' not in archive. @@ -66,6 +69,9 @@ - [shell-bash] add functions to outlined list - [markdown] added the ability to connect the backlight in 'code' by creating your own scheme 'markdown2:markdown2' - [markdown] highlight special all caps HTML tags +- [hcl] add a new schema for HashiCorp HCL +- [terraform] add a new schema for HashiCorp Terraform +- [dockerfile] add a new schema for Dockerfile ## [1.2.0] - 2021-09-12 diff --git a/colorer/configs/base/hrc/inet/smarty.hrc b/colorer/configs/base/hrc/inet/smarty.hrc index b09c2f0ee..326e6aa38 100644 --- a/colorer/configs/base/hrc/inet/smarty.hrc +++ b/colorer/configs/base/hrc/inet/smarty.hrc @@ -281,12 +281,12 @@ - diff --git a/colorer/configs/base/hrc/proto.hrc b/colorer/configs/base/hrc/proto.hrc index fe4b97593..f8302e1fe 100644 --- a/colorer/configs/base/hrc/proto.hrc +++ b/colorer/configs/base/hrc/proto.hrc @@ -733,6 +733,16 @@ /\.y$/i + + + + /\.hcl$/i + + + + /\.tf$/i + /\.tfvars$/i + @@ -788,6 +798,12 @@ /\.nut$/i + + + /^[Dd]ockerfile\..+$/ + /^[Dd]ockerfile$/ + /^\s*FROM\b/ + @@ -927,7 +943,6 @@ /\.jcl$/i - /\.(sml|sig)$/i diff --git a/colorer/configs/base/hrc/rare/json.hrc b/colorer/configs/base/hrc/rare/json.hrc index e85a1864a..97a408b14 100644 --- a/colorer/configs/base/hrc/rare/json.hrc +++ b/colorer/configs/base/hrc/rare/json.hrc @@ -1,47 +1,67 @@ + "http://colorer.sf.net/2003/hrc.dtd"> + version="take5" + xmlns="http://colorer.sf.net/2003/hrc" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd"> - - json scheme - - ]]> + + json scheme + + Konstantin Kushnir + ]]> - + - - - - - - - - + + + + + + + + + + + + + - - - - + + + - - - + + + - - - - - - + + + + + + + + + + + + + + + + + @@ -51,66 +71,75 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ] /x - ]]> - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ] /x + ]]> + + + + + + + diff --git a/colorer/configs/base/hrc/scripts/dockerfile.hrc b/colorer/configs/base/hrc/scripts/dockerfile.hrc new file mode 100644 index 000000000..e8a403d86 --- /dev/null +++ b/colorer/configs/base/hrc/scripts/dockerfile.hrc @@ -0,0 +1,437 @@ + + + + + + + Dockerfile + + Based on: + https://docs.docker.com/reference/dockerfile/ + + Limitations: + 1. Custom escape character is not supported. + 2. Shell is assumed to be a posix shell. There is no possability + to highlight as other shell (e.g. powershell). + 3. heredoc in RUN instruction is highlighted as a shell script. + Practically, it can be anything else (e.g. python script). + + TODO: + 1. Parse URIs in source parameters for ADD/COPY + 2. Highlight sources and destinations differently for ADD/COPY + 3. Recognize and hightlight image name for "COPY --from=..." + 4. Recognize and validate parameters for instructions (FROM/RUN/ADD etc.) + 5. Recognize and highlight parser directives (https://docs.docker.com/reference/dockerfile/#parser-directives) + + Home: https://github.com/chpock/ck.colorer-schemes + Send requests there for bug fixes and features. + + + ]]> + + + + + /^[Dd]ockerfile\..+$/ + /^[Dd]ockerfile$/ + /^\s*FROM\b/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/colorer/configs/base/hrc/scripts/hcl/hcl.hrc b/colorer/configs/base/hrc/scripts/hcl/hcl.hrc new file mode 100644 index 000000000..e67c01371 --- /dev/null +++ b/colorer/configs/base/hrc/scripts/hcl/hcl.hrc @@ -0,0 +1,392 @@ + + + + + + + HashiCorp HCL + + Based on: + https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md + https://github.com/hashicorp/syntax/blob/main/syntaxes/hcl.tmGrammar.json + + Notes: + This schema can be simplified by reducing the number of schemas. + However, now its structure is similar to the official reference at + https://github.com/hashicorp/syntax/blob/main/src/_main.yml to make + it easier to add new features and enhancements. + + Home: https://github.com/chpock/ck.colorer-schemes + Send requests there for bug fixes and features. + + + ]]> + + + + + /\.hcl$/i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/colorer/configs/base/hrc/scripts/hcl/terraform.hrc b/colorer/configs/base/hrc/scripts/hcl/terraform.hrc new file mode 100644 index 000000000..e43c26595 --- /dev/null +++ b/colorer/configs/base/hrc/scripts/hcl/terraform.hrc @@ -0,0 +1,224 @@ + + + + + + + HashiCorp Terraform + + Based on: + https://github.com/hashicorp/syntax/blob/main/src/terraform.yml + + Notes: + This schema can be simplified by reducing the number of schemas. + However, now its structure is similar to the official reference at + https://github.com/hashicorp/syntax/blob/main/src/terraform.yml to make + it easier to add new features and enhancements. + + Home: https://github.com/chpock/ck.colorer-schemes + Send requests there for bug fixes and features. + + + ]]> + + + + + /\.tf$/i + /\.tfvars$/i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/colorer/configs/base/hrc/scripts/shell-bash.hrc b/colorer/configs/base/hrc/scripts/shell-bash.hrc index 0f68772c0..ad182ddee 100644 --- a/colorer/configs/base/hrc/scripts/shell-bash.hrc +++ b/colorer/configs/base/hrc/scripts/shell-bash.hrc @@ -512,6 +512,7 @@ region02="PairStart" region11="PairEnd"/> + diff --git a/colorer/configs/base/hrc/scripts/shell-posix.hrc b/colorer/configs/base/hrc/scripts/shell-posix.hrc index 84050da70..9e39a0150 100644 --- a/colorer/configs/base/hrc/scripts/shell-posix.hrc +++ b/colorer/configs/base/hrc/scripts/shell-posix.hrc @@ -329,6 +329,7 @@ + diff --git a/colorer/src/Colorer-library/src/CMakeLists.txt b/colorer/src/Colorer-library/src/CMakeLists.txt index f6db68165..1ca5d812c 100644 --- a/colorer/src/Colorer-library/src/CMakeLists.txt +++ b/colorer/src/Colorer-library/src/CMakeLists.txt @@ -80,6 +80,7 @@ set(SRC_COLORER colorer/parsers/VirtualEntry.h colorer/utils/Environment.cpp colorer/utils/Environment.h + colorer/utils/FileSystems.h colorer/version.h colorer/viewer/ParsedLineWriter.cpp colorer/viewer/ParsedLineWriter.h @@ -226,11 +227,19 @@ target_include_directories(colorer_lib PUBLIC "$" ) -set_target_properties(colorer_lib PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES - CXX_EXTENSIONS YES -) +if(COLORER_BUILD_OLD_COMPILERS) + set_target_properties(colorer_lib PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS YES + ) +else() + set_target_properties(colorer_lib PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO + ) +endif() target_link_libraries(colorer_lib PUBLIC LibXml2::LibXml2 diff --git a/colorer/src/Colorer-library/src/colorer/base/BaseNames.h b/colorer/src/Colorer-library/src/colorer/base/BaseNames.h index 0c38964cf..f20cf8df3 100644 --- a/colorer/src/Colorer-library/src/colorer/base/BaseNames.h +++ b/colorer/src/Colorer-library/src/colorer/base/BaseNames.h @@ -6,6 +6,5 @@ const char16_t HrdClassRgb[] = u"rgb\0"; const char16_t HrdClassText[] = u"text\0"; UNICODE_LITERAL(jar, u"jar:") -//inline const auto jar = UnicodeString(u"jar:"); #endif // COLORER_BASENAMES_H diff --git a/colorer/src/Colorer-library/src/colorer/common/Logger.h b/colorer/src/Colorer-library/src/colorer/common/Logger.h index 7b0051d58..97eb99e4a 100644 --- a/colorer/src/Colorer-library/src/colorer/common/Logger.h +++ b/colorer/src/Colorer-library/src/colorer/common/Logger.h @@ -2,12 +2,11 @@ #define COLORER_LOGGER_H #include - -#if __cplusplus < 201703L -# include +#if __cplusplus < 201703L && !defined(_MSC_VER) +#include namespace std { - typedef experimental::string_view string_view; +typedef experimental::string_view string_view; } #endif diff --git a/colorer/src/Colorer-library/src/colorer/utils/Environment.h b/colorer/src/Colorer-library/src/colorer/utils/Environment.h index 69e67360a..11a75bb2c 100644 --- a/colorer/src/Colorer-library/src/colorer/utils/Environment.h +++ b/colorer/src/Colorer-library/src/colorer/utils/Environment.h @@ -4,15 +4,7 @@ #include #include #include "colorer/Common.h" - -#ifdef COLORER_FEATURE_OLD_COMPILERS -#include "colorer/platform/filesystem.hpp" -namespace fs = ghc::filesystem; -#else -#include -namespace fs = std::filesystem; -#endif - +#include "colorer/utils/FileSystems.h" namespace colorer { diff --git a/colorer/src/Colorer-library/src/colorer/utils/FileSystems.h b/colorer/src/Colorer-library/src/colorer/utils/FileSystems.h new file mode 100644 index 000000000..b7ef0dbed --- /dev/null +++ b/colorer/src/Colorer-library/src/colorer/utils/FileSystems.h @@ -0,0 +1,14 @@ +#ifndef COLORER_FILESYSTEMS_HPP +#define COLORER_FILESYSTEMS_HPP + +#include + +#ifdef COLORER_FEATURE_OLD_COMPILERS +#include "colorer/platform/filesystem.hpp" +namespace fs = ghc::filesystem; +#else +#include +namespace fs = std::filesystem; +#endif + +#endif diff --git a/colorer/src/Colorer-library/src/colorer/xml/libxml2/LibXmlReader.cpp b/colorer/src/Colorer-library/src/colorer/xml/libxml2/LibXmlReader.cpp index d2cb6a0d5..72a59c466 100644 --- a/colorer/src/Colorer-library/src/colorer/xml/libxml2/LibXmlReader.cpp +++ b/colorer/src/Colorer-library/src/colorer/xml/libxml2/LibXmlReader.cpp @@ -107,7 +107,7 @@ void LibXmlReader::getAttributes(const xmlNode* node, std::unordered_mapproperties; attr != nullptr; attr = attr->next) { const auto content = xmlNodeGetContent(attr->children); - data.emplace(std::make_pair(reinterpret_cast(attr->name), reinterpret_cast(content))); + data.emplace(reinterpret_cast(attr->name), reinterpret_cast(content)); xmlFree(content); } }