feat: add missing KF6 framework recipes
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# clang-format
|
||||
56ed6f3f5f505eb0dbffc630729d67c3fb510546
|
||||
ba947348217c468a0cea117289f3a3fc43bb66e6
|
||||
#clang-tidy
|
||||
0960472cc3f57831a97697a4ae0cd139e2cc5551
|
||||
@@ -0,0 +1,19 @@
|
||||
*.kdev4
|
||||
*.orig
|
||||
*.out
|
||||
*.rej
|
||||
*~
|
||||
/compile.pl
|
||||
CMakeLists.txt.user
|
||||
callgrind.*
|
||||
heaptrack.*
|
||||
/build*/
|
||||
*.unc-backup*
|
||||
/.clang-format
|
||||
/.cmake/
|
||||
/*.code-workspace
|
||||
/compile_commands.json
|
||||
.clangd
|
||||
.idea
|
||||
/cmake-build*
|
||||
.cache
|
||||
@@ -0,0 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include:
|
||||
- project: sysadmin/ci-utilities
|
||||
file:
|
||||
- /gitlab-templates/linux-qt6.yml
|
||||
- /gitlab-templates/android-qt6.yml
|
||||
- /gitlab-templates/freebsd-qt6.yml
|
||||
- /gitlab-templates/windows-qt6.yml
|
||||
- /gitlab-templates/alpine-qt6.yml
|
||||
@@ -0,0 +1 @@
|
||||
// kate: space-indent on; indent-width 4; remove-trailing-spaces modified;
|
||||
@@ -0,0 +1,12 @@
|
||||
Dependencies:
|
||||
- 'on': ['@all']
|
||||
'require':
|
||||
'frameworks/extra-cmake-modules': '@same'
|
||||
|
||||
Options:
|
||||
test-before-installing: True
|
||||
require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
|
||||
|
||||
# exclude stuff from cppcheck that takes too long
|
||||
cppcheck-ignore-files:
|
||||
- 'src/lib/abstracthighlighter.cpp'
|
||||
@@ -0,0 +1,2 @@
|
||||
CHECKSETS kde5
|
||||
SKIP /autotests/input/
|
||||
@@ -0,0 +1,155 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(KF_VERSION "6.10.0")
|
||||
project(KSyntaxHighlighting VERSION ${KF_VERSION})
|
||||
|
||||
find_package(ECM 6.10.0 REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
|
||||
include(KDEGitCommitHooks)
|
||||
|
||||
include(FeatureSummary)
|
||||
include(GenerateExportHeader)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMGenerateHeaders)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(ECMPoQmTools)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
include(ECMMarkNonGuiExecutable)
|
||||
include(ECMAddQch)
|
||||
include(ECMOptionalAddSubdirectory)
|
||||
include(ECMGenerateExportHeader)
|
||||
include(ECMDeprecationSettings)
|
||||
include(ECMQmlModule)
|
||||
|
||||
set(ksyntaxhighlighting_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/lib/ksyntaxhighlighting_version.h")
|
||||
ecm_setup_version(PROJECT
|
||||
VARIABLE_PREFIX KSYNTAXHIGHLIGHTING
|
||||
VERSION_HEADER "${ksyntaxhighlighting_version_header}"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6SyntaxHighlightingConfigVersion.cmake"
|
||||
SOVERSION 6
|
||||
)
|
||||
|
||||
set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
|
||||
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
set(REQUIRED_QT_VERSION 6.6.0)
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Network)
|
||||
option(KSYNTAXHIGHLIGHTING_USE_GUI "Build components depending on QtGui" ON)
|
||||
if(KSYNTAXHIGHLIGHTING_USE_GUI)
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Gui)
|
||||
endif()
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE QUIET OPTIONAL_COMPONENTS PrintSupport Widgets)
|
||||
set_package_properties(Qt6 PROPERTIES URL "http://qt-project.org/")
|
||||
set_package_properties(Qt6Widgets PROPERTIES PURPOSE "Example application.")
|
||||
set_package_properties(Qt6PrintSupport PROPERTIES PURPOSE "Example application.")
|
||||
set_package_properties(Qt6Quick PROPERTIES PURPOSE "QtQuick bindings.")
|
||||
|
||||
# https://xerces.apache.org/index.html for validation
|
||||
find_package (XercesC)
|
||||
set_package_properties(XercesC PROPERTIES PURPOSE "Compile-time validation of syntax definition files.")
|
||||
|
||||
find_package(Perl REQUIRED)
|
||||
set_package_properties(Perl PROPERTIES PURPOSE "Auto-generate PHP syntax definition files.")
|
||||
|
||||
#
|
||||
# allow to install the "differently" licensed syntax xml files instead of putting them in a QRC and link them in
|
||||
#
|
||||
option(QRC_SYNTAX "Bundle the syntax definition files inside the library as resources" ON)
|
||||
add_feature_info(SYNTAX_RESOURCE ${QRC_SYNTAX} "Bundle the syntax definition files inside the library as resources")
|
||||
|
||||
#
|
||||
# allow to turn of lookup for syntax files and themes via QStandardPaths
|
||||
#
|
||||
option(NO_STANDARD_PATHS "Skip lookup of syntax and theme definitions in QStandardPaths locations" OFF)
|
||||
add_feature_info(FEATURE_NO_STANDARD_PATHS ${NO_STANDARD_PATHS} "Skip lookup of syntax and theme definitions in QStandardPaths locations")
|
||||
|
||||
#
|
||||
# API documentation
|
||||
#
|
||||
option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
|
||||
add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
|
||||
|
||||
#
|
||||
# Translations
|
||||
#
|
||||
#ecm_install_po_files_as_qm(poqm)
|
||||
|
||||
# tell the framework if it shall use the syntax files from the resource
|
||||
if (QRC_SYNTAX)
|
||||
add_definitions(-DHAS_SYNTAX_RESOURCE)
|
||||
endif()
|
||||
|
||||
# skip standard paths?
|
||||
if (NO_STANDARD_PATHS)
|
||||
add_definitions(-DNO_STANDARD_PATHS)
|
||||
endif()
|
||||
|
||||
ecm_set_disabled_deprecation_versions(
|
||||
QT 6.8.0
|
||||
)
|
||||
|
||||
#
|
||||
# Actually build the stuff
|
||||
#
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(src)
|
||||
if(TARGET Qt6::Gui)
|
||||
add_subdirectory(examples)
|
||||
############# if (BUILD_TESTING)
|
||||
############# add_subdirectory(autotests)
|
||||
############# endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# CMake package config file generation
|
||||
#
|
||||
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6SyntaxHighlighting")
|
||||
|
||||
if (BUILD_QCH)
|
||||
ecm_install_qch_export(
|
||||
TARGETS KF6SyntaxHighlighting_QCH
|
||||
FILE KF6SyntaxHighlightingQchTargets.cmake
|
||||
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF6SyntaxHighlightingQchTargets.cmake\")")
|
||||
endif()
|
||||
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/KF6SyntaxHighlightingConfig.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF6SyntaxHighlightingConfig.cmake"
|
||||
INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF6SyntaxHighlightingConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF6SyntaxHighlightingConfigVersion.cmake"
|
||||
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
COMPONENT Devel)
|
||||
|
||||
if(TARGET KF6SyntaxHighlighting)
|
||||
install(EXPORT KF6SyntaxHighlightingTargets
|
||||
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
FILE KF6SyntaxHighlightingTargets.cmake
|
||||
NAMESPACE KF6::)
|
||||
endif()
|
||||
|
||||
install(FILES "${ksyntaxhighlighting_version_header}"
|
||||
DESTINATION "${KDE_INSTALL_INCLUDEDIR_KF}/KSyntaxHighlighting"
|
||||
COMPONENT Devel)
|
||||
|
||||
include(ECMFeatureSummary)
|
||||
ecm_feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
# add target to update kate-editor.org syntax page + update site
|
||||
add_custom_target(update_kate_editor_org
|
||||
COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/utils/update-kate-editor-org.pl" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
|
||||
|
||||
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
||||
@@ -0,0 +1,8 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Qt6Core @REQUIRED_QT_VERSION@)
|
||||
find_dependency(Qt6Gui @REQUIRED_QT_VERSION@)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/KF6SyntaxHighlightingTargets.cmake")
|
||||
@PACKAGE_INCLUDE_QCHTARGETS@
|
||||
@@ -0,0 +1,121 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
@@ -0,0 +1,319 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public License is intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users. This General Public License applies to
|
||||
most of the Free Software Foundation's software and to any other program whose
|
||||
authors commit to using it. (Some other Free Software Foundation software
|
||||
is covered by the GNU Lesser General Public License instead.) You can apply
|
||||
it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must give the recipients all the rights that you have. You
|
||||
must make sure that they, too, receive or can get the source code. And you
|
||||
must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
||||
offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that
|
||||
everyone understands that there is no warranty for this free software. If
|
||||
the software is modified by someone else and passed on, we want its recipients
|
||||
to know that what they have is not the original, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that redistributors of a free program will individually
|
||||
obtain patent licenses, in effect making the program proprietary. To prevent
|
||||
this, we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice
|
||||
placed by the copyright holder saying it may be distributed under the terms
|
||||
of this General Public License. The "Program", below, refers to any such program
|
||||
or work, and a "work based on the Program" means either the Program or any
|
||||
derivative work under copyright law: that is to say, a work containing the
|
||||
Program or a portion of it, either verbatim or with modifications and/or translated
|
||||
into another language. (Hereinafter, translation is included without limitation
|
||||
in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running the Program
|
||||
is not restricted, and the output from the Program is covered only if its
|
||||
contents constitute a work based on the Program (independent of having been
|
||||
made by running the Program). Whether that is true depends on what the Program
|
||||
does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code
|
||||
as you receive it, in any medium, provided that you conspicuously and appropriately
|
||||
publish on each copy an appropriate copyright notice and disclaimer of warranty;
|
||||
keep intact all the notices that refer to this License and to the absence
|
||||
of any warranty; and give any other recipients of the Program a copy of this
|
||||
License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it,
|
||||
thus forming a work based on the Program, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or
|
||||
in part contains or is derived from the Program or any part thereof, to be
|
||||
licensed as a whole at no charge to all third parties under the terms of this
|
||||
License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run,
|
||||
you must cause it, when started running for such interactive use in the most
|
||||
ordinary way, to print or display an announcement including an appropriate
|
||||
copyright notice and a notice that there is no warranty (or else, saying that
|
||||
you provide a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this License.
|
||||
(Exception: if the Program itself is interactive but does not normally print
|
||||
such an announcement, your work based on the Program is not required to print
|
||||
an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Program, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Program, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with
|
||||
the Program (or with a work based on the Program) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section
|
||||
2) in object code or executable form under the terms of Sections 1 and 2 above
|
||||
provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code,
|
||||
which must be distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give
|
||||
any third party, for a charge no more than your cost of physically performing
|
||||
source distribution, a complete machine-readable copy of the corresponding
|
||||
source code, to be distributed under the terms of Sections 1 and 2 above on
|
||||
a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute
|
||||
corresponding source code. (This alternative is allowed only for noncommercial
|
||||
distribution and only if you received the program in object code or executable
|
||||
form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable work, complete source code means all
|
||||
the source code for all modules it contains, plus any associated interface
|
||||
definition files, plus the scripts used to control compilation and installation
|
||||
of the executable. However, as a special exception, the source code distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to
|
||||
copy from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place counts as distribution of the source code,
|
||||
even though third parties are not compelled to copy the source along with
|
||||
the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except
|
||||
as expressly provided under this License. Any attempt otherwise to copy, modify,
|
||||
sublicense or distribute the Program is void, and will automatically terminate
|
||||
your rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses terminated
|
||||
so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Program or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Program
|
||||
(or any work based on the Program), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute or modify the Program subject to these terms and conditions.
|
||||
You may not impose any further restrictions on the recipients' exercise of
|
||||
the rights granted herein. You are not responsible for enforcing compliance
|
||||
by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Program at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Program
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply and
|
||||
the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system, which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Program under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of
|
||||
the General Public License from time to time. Such new versions will be similar
|
||||
in spirit to the present version, but may differ in detail to address new
|
||||
problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Program does not specify a version number of this License, you may choose
|
||||
any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs
|
||||
whose distribution conditions are different, write to the author to ask for
|
||||
permission. For software which is copyrighted by the Free Software Foundation,
|
||||
write to the Free Software Foundation; we sometimes make exceptions for this.
|
||||
Our decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing and reuse
|
||||
of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively convey the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and an idea of what it does.>
|
||||
|
||||
Copyright (C)< yyyy> <name of author>
|
||||
|
||||
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
|
||||
Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when
|
||||
it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
|
||||
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
|
||||
and you are welcome to redistribute it under certain conditions; type `show
|
||||
c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may be
|
||||
called something other than `show w' and `show c'; they could even be mouse-clicks
|
||||
or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon >, 1 April 1989 Ty Coon, President of Vice This General
|
||||
Public License does not permit incorporating your program into proprietary
|
||||
programs. If your program is a subroutine library, you may consider it more
|
||||
useful to permit linking proprietary applications with the library. If this
|
||||
is what you want to do, use the GNU Lesser General Public License instead
|
||||
of this License.
|
||||
@@ -0,0 +1,446 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
a program with the library, you must provide complete object files to the
|
||||
recipients so that they can relink them with the library, after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library General Public License
|
||||
(also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the operating
|
||||
system on which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties to this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Library General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library 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 Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -0,0 +1,468 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts as the
|
||||
successor of the GNU Library Public License, version 2, hence the version
|
||||
number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some specially
|
||||
designated software packages--typically libraries--of the Free Software Foundation
|
||||
and other authors who decide to use it. You can use it too, but we suggest
|
||||
you first think carefully about whether this license or the ordinary General
|
||||
Public License is the better strategy to use in any particular case, based
|
||||
on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use, not price.
|
||||
Our General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish); that you receive source code or can get it if you want it; that you
|
||||
can change the software and use pieces of it in new free programs; and that
|
||||
you are informed that you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid distributors
|
||||
to deny you these rights or to ask you to surrender these rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
other code with the library, you must provide complete object files to the
|
||||
recipients, so that they can relink them with the library after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the library,
|
||||
and (2) we offer you this license, which gives you legal permission to copy,
|
||||
distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that there is no
|
||||
warranty for the free library. Also, if the library is modified by someone
|
||||
else and passed on, the recipients should know that what they have is not
|
||||
the original version, so that the original author's reputation will not be
|
||||
affected by problems that might be introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of any free
|
||||
program. We wish to make sure that a company cannot effectively restrict the
|
||||
users of a free program by obtaining a restrictive license from a patent holder.
|
||||
Therefore, we insist that any patent license obtained for a version of the
|
||||
library must be consistent with the full freedom of use specified in this
|
||||
license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License. This license, the GNU Lesser General Public License,
|
||||
applies to certain designated libraries, and is quite different from the ordinary
|
||||
General Public License. We use this license for certain libraries in order
|
||||
to permit linking those libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using a shared
|
||||
library, the combination of the two is legally speaking a combined work, a
|
||||
derivative of the original library. The ordinary General Public License therefore
|
||||
permits such linking only if the entire combination fits its criteria of freedom.
|
||||
The Lesser General Public License permits more lax criteria for linking other
|
||||
code with the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it does Less
|
||||
to protect the user's freedom than the ordinary General Public License. It
|
||||
also provides other free software developers Less of an advantage over competing
|
||||
non-free programs. These disadvantages are the reason we use the ordinary
|
||||
General Public License for many libraries. However, the Lesser license provides
|
||||
advantages in certain special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to encourage the
|
||||
widest possible use of a certain library, so that it becomes a de-facto standard.
|
||||
To achieve this, non-free programs must be allowed to use the library. A more
|
||||
frequent case is that a free library does the same job as widely used non-free
|
||||
libraries. In this case, there is little to gain by limiting the free library
|
||||
to free software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free programs
|
||||
enables a greater number of people to use a large body of free software. For
|
||||
example, permission to use the GNU C Library in non-free programs enables
|
||||
many more people to use the whole GNU operating system, as well as its variant,
|
||||
the GNU/Linux operating system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the users'
|
||||
freedom, it does ensure that the user of a program that is linked with the
|
||||
Library has the freedom and the wherewithal to run that program using a modified
|
||||
version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, whereas the latter must be combined with the library in
|
||||
order to run.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other program
|
||||
which contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Lesser General
|
||||
Public License (also called "this License"). Each licensee is addressed as
|
||||
"you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (1) uses at run time a copy of the library
|
||||
already present on the user's computer system, rather than copying library
|
||||
functions into the executable, and (2) will operate properly with a modified
|
||||
version of the library, if the user installs one, as long as the modified
|
||||
version is interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the materials to be distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties with this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Lesser General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and an idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
< signature of Ty Coon > , 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -0,0 +1,19 @@
|
||||
MIT License Copyright (c) <year> <copyright holders>
|
||||
|
||||
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 (including the next
|
||||
paragraph) 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.
|
||||
@@ -0,0 +1,261 @@
|
||||
# Syntax Highlighting
|
||||
|
||||
Syntax highlighting engine for Kate syntax definitions
|
||||
|
||||
## Table of contents
|
||||
|
||||
1. [Introduction](#introduction)
|
||||
2. [Out of scope](#out-of-scope)
|
||||
3. [Syntax definition files](#syntax-definition-files)
|
||||
4. [Color theme files](#color-theme-files)
|
||||
5. [Build it](#build-it)
|
||||
6. [How to contribute](#how-to-contribute)
|
||||
* [Licensing](#licensing)
|
||||
* [Tips for contributing to syntax definition files](#tips-for-contributing-to-syntax-definition-files)
|
||||
* [Adding unit tests for a syntax definition](#adding-unit-tests-for-a-syntax-definition)
|
||||
7. [Report bug or help to fix them](#report-bug-or-help-to-fix-them)
|
||||
8. [Updating the syntax & themes pages of the kate-editor.org website](#updating-the-kate-editororgsyntax-website)
|
||||
|
||||
## Introduction
|
||||
|
||||
This is a stand-alone implementation of the Kate syntax highlighting engine.
|
||||
It's meant as a building block for text editors as well as for simple highlighted
|
||||
text rendering (e.g. as HTML), supporting both integration with a custom editor
|
||||
as well as a ready-to-use QSyntaxHighlighter sub-class.
|
||||
|
||||
Besides a C++ API, a [QML API](@ref qml_api) is also provided.
|
||||
|
||||
## Out of scope
|
||||
|
||||
To not turn this into yet another text editor, the following things are considered
|
||||
out of scope:
|
||||
|
||||
* code folding, beyond providing folding range information
|
||||
* auto completion
|
||||
* spell checking
|
||||
* user interface for configuration
|
||||
* management of text buffers or documents
|
||||
|
||||
If you need any of this, check out [KTextEditor](https://api.kde.org/frameworks/ktexteditor/html/).
|
||||
|
||||
## Syntax definition files
|
||||
|
||||
This library uses Kate syntax definition files for the actual highlighting,
|
||||
the file format is documented [here](https://docs.kde.org/?application=katepart&branch=stable5&path=highlight.html).
|
||||
|
||||
More than 300 syntax definition files are included, that are located
|
||||
in **data/syntax/** and have the **.xml** extension. Some files are
|
||||
generated at compile time, all xml files are available
|
||||
[here](https://kate-editor.org/syntax/). Additional ones are
|
||||
picked up from the file system if present, so you can easily extend this
|
||||
by application-specific syntax definitions for example.
|
||||
|
||||
To install or test a syntax definition file locally, place it in
|
||||
**org.kde.syntax-highlighting/syntax/**, which is located in your user directory.
|
||||
Usually it is:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>For local user</td>
|
||||
<td>$HOME/.local/share/org.kde.syntax-highlighting/syntax/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>For Flatpak packages</td>
|
||||
<td>$HOME/.var/app/<em>package-name</em>/data/org.kde.syntax-highlighting/syntax/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>For Snap packages</a></td>
|
||||
<td>$HOME/snap/<em>package-name</em>/current/.local/share/org.kde.syntax-highlighting/syntax/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>On Windows®</td>
|
||||
<td>%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax\</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>On macOS®</td>
|
||||
<td>$HOME/Library/Application Support/org.kde.syntax-highlighting/syntax/</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
For more details, see ["The Highlight Definition XML Format" (Working with Syntax Highlighting, KDE Documentation)](https://docs.kde.org/?application=katepart&branch=stable5&path=highlight.html#katehighlight-xml-format).
|
||||
|
||||
Also, in **data/schema/** there is a script to validate the syntax definition XML
|
||||
files. Use the command `validatehl.sh mySyntax.xml`.
|
||||
|
||||
## Color theme files
|
||||
|
||||
This library includes the color themes, which are documented
|
||||
[here](https://docs.kde.org/?application=katepart&branch=stable5&path=color-themes.html).
|
||||
|
||||
The color theme files use the JSON format and are located in **data/themes/**
|
||||
with the **.theme** extension.
|
||||
Additional ones are also picked up from the file system if present,
|
||||
in the **org.kde.syntax-highlighting/themes/** folder of your user directory,
|
||||
allowing you to easily add custom color theme files. This location is the same
|
||||
as shown in the table of the [previous section](#syntax-definition-files),
|
||||
replacing the **syntax** folder with **themes**.
|
||||
For more details, see ["The Color Themes JSON Format" (Working with Color Themes, KDE Documentation)](https://docs.kde.org/?application=katepart&branch=stable5&path=color-themes.html#color-themes-json).
|
||||
|
||||
The [KTextEditor](https://api.kde.org/frameworks/ktexteditor/html/) library
|
||||
(used by Kate, Kile and KDevelop, for example) provides a
|
||||
[user interface](https://docs.kde.org/?application=katepart&branch=stable5&path=color-themes.html#color-themes-gui)
|
||||
for editing and creating KSyntaxHighlighting color themes, including
|
||||
a tool for exporting and importing the JSON theme files.
|
||||
|
||||
Note that in KDE text editors, the KSyntaxHighlighting color themes are used
|
||||
[since KDE Frameworks 5.75](https://kate-editor.org/post/2020/2020-09-13-kate-color-themes-5.75/),
|
||||
released on October 10, 2020. Previously, Kate's color schemes
|
||||
(KConfig based schema config) were used and are now deprecated.
|
||||
The tool **utils/schema-converter/** and the script **utils/kateschema_to_theme_converter.py**
|
||||
convert the old Kate schemas to KSyntaxHighlighting themes.
|
||||
|
||||
Also see ["Submit a KSyntaxHighlighting Color Theme" (Kate Editor Website)](https://kate-editor.org/post/2020/2020-09-18-submit-a-ksyntaxhighlighting-color-theme/).
|
||||
|
||||
## Build it
|
||||
|
||||
1. Create and change into a build directory. Usually, a folder called **build**
|
||||
is created inside the **syntax-highlighting** source directory.
|
||||
|
||||
```bash
|
||||
mkdir <build-directory>
|
||||
cd <build-directory>
|
||||
```
|
||||
|
||||
2. Run the configure process with *cmake* and compile:
|
||||
|
||||
```bash
|
||||
cmake <source-directory>
|
||||
make
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
git clone git@invent.kde.org:frameworks/syntax-highlighting.git
|
||||
mkdir ./syntax-highlighting/build
|
||||
cd ./syntax-highlighting/build
|
||||
cmake ../
|
||||
make
|
||||
```
|
||||
|
||||
For more details see ["Building Kate from Sources on Linux" (Kate Editor Website)](https://kate-editor.org/build-it/).
|
||||
|
||||
**NOTE:** If running *cmake* shows an error related to your version of KDE
|
||||
Frameworks, you edit the **CMakeLists.txt** file in the line
|
||||
`find_package(ECM 5.XX.X ...)`.
|
||||
|
||||
3. To run tests:
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
The tests are located in the **autotests** directory.
|
||||
This command can be used to check changes to units test after modifying some
|
||||
syntax definition file. To add a unit test or update the references, see the
|
||||
section ["Adding unit tests for a syntax definition"](#adding-unit-tests-for-a-syntax-definition).
|
||||
|
||||
## How to contribute
|
||||
|
||||
KDE uses a GitLab instance at **invent.kde.org** for code review. The official
|
||||
repository of the KSyntaxHighlighting framework is [here](https://invent.kde.org/frameworks/syntax-highlighting).
|
||||
|
||||
All the necessary information to send contributions is [here](https://community.kde.org/Infrastructure/GitLab).
|
||||
|
||||
### Licensing
|
||||
|
||||
Contributions to KSyntaxHighlighting shall be licensed under [MIT](LICENSES/MIT.txt).
|
||||
|
||||
All files shall contain a proper "SPDX-License-Identifier: MIT" identifier inside a header like:
|
||||
|
||||
```cpp
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2020 Christoph Cullmann <cullmann@kde.org>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
```
|
||||
|
||||
### Tips for contributing to syntax definition files
|
||||
|
||||
* If you are modifying an existing syntax definition XML file, you must increase
|
||||
the version number of the language.
|
||||
|
||||
* Do not use hard-coded colors, as they may not look good or be illegible in some color
|
||||
themes. Prefer to use the default color styles.
|
||||
|
||||
For more information, see:
|
||||
|
||||
* [Available Default Styles (Working with Syntax Highlighting, KDE Documentation)](https://docs.kde.org/?application=katepart&branch=stable5&path=highlight.html#kate-highlight-default-styles)
|
||||
* [Kate Part (KF5): New Default Styles for better Color Schemes (Kate Editor Website)](https://kate-editor.org/2014/03/07/kate-part-kf5-new-default-styles-for-better-color-schemes/)
|
||||
|
||||
* While writing syntax, you can use `ksyntaxhighlighter6` (previously named `kate-syntax-highlighter`) to display the style or others informations associated with each part of text. For example `ksyntaxhighlighter6 --output-format=ansi --syntax-trace=format test.cpp`.
|
||||
|
||||
On Linux and Unix systems, you can isolate the syntax files to be modified by using the `XDG_DATA_DIRS`
|
||||
environment variable to point to a folder containing `org.kde.syntax-highlighting/syntax/`
|
||||
in which you will put all the files required for a syntax:
|
||||
|
||||
`XDG_DATA_DIRS=mydir ksyntaxhighlighter6 ...`.
|
||||
|
||||
* Add test files, these are found in **autotests/input/**.
|
||||
If you are going to add a new syntax XML file, create a new test file; if you
|
||||
are going to modify a XML file, adds examples to existing test files.
|
||||
|
||||
Then, it is necessary to generate and update the files in **autotests/folding/**,
|
||||
**autotests/html/** and **autotests/reference/**, which must be included in the
|
||||
patches. Instructions are [below](#adding-unit-tests-for-a-syntax-definition).
|
||||
|
||||
### Adding unit tests for a syntax definition
|
||||
|
||||
1. Add an input file into the **autotests/input/** folder, lets call it
|
||||
**test.<language-extension>**.
|
||||
|
||||
2. If the file extension is not sufficient to trigger the right syntax definition, you can add an
|
||||
second file **testname.<language-extension>.syntax** that contains the syntax definition name
|
||||
to enforce the use of the right extension.
|
||||
|
||||
3. Do `make && make test`.
|
||||
|
||||
Note that after adding or modifying something in
|
||||
**<source-directory>/autotests/input/**, an error will be showed when
|
||||
running `make test`, because the references in the source directory do not
|
||||
match the ones now generated.
|
||||
|
||||
4. Inspect the outputs found in your binary directory **autotests/folding.out/**,
|
||||
**autotests/html.output/** and **autotests/output/**.
|
||||
|
||||
5. If OK, run in the binary folder `./autotests/update-reference-data.sh`
|
||||
to copy the results to the right location.
|
||||
That script updates the references in the source directory in
|
||||
**autotest/folding/**, **autotest/html/** and **autotest/reference/**.
|
||||
|
||||
6. Add the result references after the copying to the git.
|
||||
|
||||
## Report bug or help to fix them
|
||||
|
||||
KDE uses Bugzilla to management of bugs at **bugs.kde.org**. You can see the bugs
|
||||
reported of **frameworks-syntax-highlighting** [here](https://bugs.kde.org/describecomponents.cgi?product=frameworks-syntax-highlighting).
|
||||
|
||||
Also, you can report a bug [here](https://bugs.kde.org/enter_bug.cgi?product=frameworks-syntax-highlighting).
|
||||
|
||||
However, some users often report bugs related to syntax highlighting in
|
||||
[kate/syntax](https://bugs.kde.org/buglist.cgi?component=syntax&product=kate&resolution=---)
|
||||
and [kile/editor](https://bugs.kde.org/buglist.cgi?component=editor&product=kile&resolution=---).
|
||||
|
||||
## Updating the syntax & themes pages of the kate-editor.org website
|
||||
|
||||
To update the [kate-editor.org/syntax](https://kate-editor.org/syntax/) and
|
||||
[kate-editor.org/themes](https://kate-editor.org/themes/) websites
|
||||
including the update site & all linked examples/files,
|
||||
please run after successful **build** & **test** the following make target:
|
||||
|
||||
```bash
|
||||
make update_kate_editor_org
|
||||
```
|
||||
|
||||
This will clone the [kate-editor.org git](https://invent.kde.org/websites/kate-editor-org)
|
||||
from *invent.kde.org* into **kate-editor-org** inside the build directory and update the needed things.
|
||||
|
||||
You can afterwards step into **kate-editor-org** and commit & push the change after review.
|
||||
|
||||
The [kate-editor.org](https://kate-editor.org) webserver will update itself periodically from the repository on *invent.kde.org*.
|
||||
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# test configuration
|
||||
#
|
||||
configure_file(test-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/test-config.h)
|
||||
|
||||
#
|
||||
# helper to update the references for the unit tests
|
||||
#
|
||||
configure_file(update-reference-data.sh.in ${CMAKE_CURRENT_BINARY_DIR}/update-reference-data.sh)
|
||||
|
||||
#
|
||||
# unit tests
|
||||
# always executed during testing, required to pass, else stuff is in a bad shape ;=)
|
||||
#
|
||||
add_executable(wildcardmatcher_test wildcardmatcher_test.cpp)
|
||||
ecm_mark_nongui_executable(wildcardmatcher_test)
|
||||
add_test(NAME wildcardmatcher_test COMMAND wildcardmatcher_test)
|
||||
target_link_libraries(wildcardmatcher_test KF6SyntaxHighlighting Qt6::Test)
|
||||
|
||||
add_executable(repository_test repository_test_base.cpp repository_test.cpp)
|
||||
ecm_mark_nongui_executable(repository_test)
|
||||
add_test(NAME repository_test COMMAND repository_test)
|
||||
target_link_libraries(repository_test KF6SyntaxHighlighting Qt6::Test)
|
||||
|
||||
add_executable(theme_test theme_test.cpp)
|
||||
ecm_mark_nongui_executable(theme_test)
|
||||
add_test(NAME theme_test COMMAND theme_test)
|
||||
target_link_libraries(theme_test KF6SyntaxHighlighting Qt6::Test)
|
||||
|
||||
add_executable(testhighlighter_test testhighlighter.cpp)
|
||||
ecm_mark_nongui_executable(testhighlighter_test)
|
||||
add_test(NAME testhighlighter_test COMMAND testhighlighter_test)
|
||||
target_link_libraries(testhighlighter_test KF6SyntaxHighlighting Qt6::Test)
|
||||
|
||||
add_executable(htmlhighlighter_test htmlhighlighter_test.cpp)
|
||||
ecm_mark_nongui_executable(htmlhighlighter_test)
|
||||
add_test(NAME htmlhighlighter_test COMMAND htmlhighlighter_test)
|
||||
target_link_libraries(htmlhighlighter_test KF6SyntaxHighlighting Qt6::Test)
|
||||
|
||||
add_executable(folding_test foldingtest.cpp)
|
||||
ecm_mark_nongui_executable(folding_test)
|
||||
add_test(NAME folding_test COMMAND folding_test)
|
||||
target_link_libraries(folding_test KF6SyntaxHighlighting Qt6::Test)
|
||||
|
||||
#
|
||||
# benchmarks, don't execute during normal testing
|
||||
# they don't test additional stuff but only hang the CI
|
||||
#
|
||||
add_executable(highlighter_benchmark highlighter_benchmark.cpp)
|
||||
ecm_mark_nongui_executable(highlighter_benchmark)
|
||||
add_test(NAME highlighter_benchmark COMMAND highlighter_benchmark CONFIGURATIONS BENCHMARK)
|
||||
target_link_libraries(highlighter_benchmark KF6SyntaxHighlighting Qt6::Test)
|
||||
|
||||
add_executable(repository_benchmark repository_test_base.cpp repository_benchmark.cpp)
|
||||
ecm_mark_nongui_executable(repository_benchmark)
|
||||
add_test(NAME repository_benchmark COMMAND repository_benchmark CONFIGURATIONS BENCHMARK)
|
||||
target_link_libraries(repository_benchmark KF6SyntaxHighlighting Qt6::Test)
|
||||
@@ -0,0 +1,8 @@
|
||||
# exclude everything except directory foo/bar in subdir foobar
|
||||
/foobar/*
|
||||
!/foobar/foo
|
||||
/foobar/foo/*
|
||||
!/foobar/foo/bar
|
||||
|
||||
/**/a?[a-z12!][]][!][:upper:]][^[=a=]]\?[\\incomplete?*
|
||||
!/**/a?[a-z][]][!][:upper:]][^[=a=]]\?[\\incomplete?*
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
# List of all options: https://docs.kde.org/trunk5/en/kdesrc-build/kdesrc-build/conf-options-table.html
|
||||
|
||||
<beginfold id='1'>global</beginfold id='1'>
|
||||
branch-group kf6-qt6
|
||||
|
||||
# strange capitalisation of value
|
||||
include-dependencies TrUe
|
||||
|
||||
# path with tilde
|
||||
kdedir ~/kde/usr
|
||||
|
||||
# try using the existing option as value for other option
|
||||
qtdir ${source-dir} # Comment on the same line with value
|
||||
|
||||
# Use line breaks
|
||||
cmake-options -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DQT_MAJOR_VERSION=6 \
|
||||
-DBUILD_WITH_QT6=ON
|
||||
|
||||
num-cores ${non-existing-var}
|
||||
num-cores-low-mem 4
|
||||
|
||||
non-existing-option 12345
|
||||
|
||||
# use int value for binary option
|
||||
install-session-driver 5
|
||||
|
||||
# impossible enum value (allowed are: invent, flat, metadata)
|
||||
directory-layout project-ids-as-folder-names
|
||||
|
||||
# option with valid value with spaces
|
||||
cmake-generator Kate - Ninja
|
||||
<endfold id='1'>end global</endfold id='1'>
|
||||
|
||||
# Comment with \
|
||||
# line break
|
||||
|
||||
include ~/kde6/src/kdesrc-build/kf6-common-options-build-include
|
||||
|
||||
<beginfold id='2'>options</beginfold id='2'> kcalc
|
||||
# use of module-set only option in the options block:
|
||||
use-modules one two \
|
||||
three
|
||||
|
||||
# use of unrecognized option:
|
||||
new-option true
|
||||
<endfold id='2'>end options</endfold id='2'>
|
||||
|
||||
|
||||
<beginfold id='3'>module-set</beginfold id='3'>
|
||||
# use of global-only option in module-set:
|
||||
stop-on-failure true
|
||||
|
||||
# use allowed option:
|
||||
use-modules one two three
|
||||
<endfold id='3'>end module-set</endfold id='3'>
|
||||
|
||||
# module block without the actual name
|
||||
<beginfold id='2'>module</beginfold id='2'>
|
||||
repository kde-projects
|
||||
<endfold id='2'>end module</endfold id='2'>
|
||||
|
||||
# double opening module block (forget ending the module block):
|
||||
<beginfold id='2'>module</beginfold id='2'> kcalc
|
||||
module kcalc
|
||||
# body without options
|
||||
<endfold id='2'>end module</endfold id='2'> kcalc
|
||||
|
||||
# non-recognized block
|
||||
kcalc
|
||||
repository kde-projects
|
||||
end kcalc
|
||||
|
||||
# kate: syntax kdesrc-buildrc;
|
||||
@@ -0,0 +1,19 @@
|
||||
# LGPLv2+ example file
|
||||
|
||||
# This is a comment
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER James Turnbull <james@example.com> # comment
|
||||
ENV REFRESHED_AT 2014-06-01
|
||||
|
||||
RUN apt-get -yqq update
|
||||
RUN apt-get install -yqq software-properties-common python-software-properties
|
||||
RUN add-apt-repository ppa:chris-lea/redis-server
|
||||
RUN apt-get -yqq update
|
||||
RUN apt-get -yqq install redis-server redis-tools
|
||||
RUN apt-get -yqq update # comment
|
||||
|
||||
VOLUME [ "/var/lib/redis", "/var/log/redis/" ]
|
||||
|
||||
EXPOSE 6379
|
||||
|
||||
CMD []
|
||||
+2406
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,143 @@
|
||||
# kate: hl earthfile;
|
||||
|
||||
VERSION --shell-out-anywhere 0.6
|
||||
|
||||
# <beginfold id='1'>BEGIN</beginfold id='1'> Global parameters
|
||||
ARG DEVTOOLSET_VERSION = 11
|
||||
ARG DEVTOOLSET = devtoolset-${DEVTOOLSET_VERSION}
|
||||
# <endfold id='1'>END</endfold id='1'> Global parameters
|
||||
|
||||
ARG param_1 = "String w/ variable interpolation ${DEVTOOLSET}"
|
||||
ARG param_2 = 'String w/o variable interpolation ${DEVTOOLSET}'
|
||||
# Run shell command
|
||||
ARG param_3 = $(echo "String w/ variable interpolation ${DEVTOOLSET}")
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>sample-target:</beginfold id='2'>
|
||||
FROM alpine
|
||||
ARG stage
|
||||
COPY --if-exists files/${stage}/ /files/
|
||||
SAVE ARTIFACT --keep-ts /files /share
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>repos-conf-apt:</beginfold id='2'>
|
||||
ARG image
|
||||
ARG ppa
|
||||
|
||||
FROM ${image}
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV DEBCONF_NONINTERACTIVE_SEEN=true
|
||||
|
||||
<beginfold id='3'>IF</beginfold id='3'> [ "${ppa}" != '' ]
|
||||
ARG _more_cmds = add-apt-repository -y -n ppa:${ppa}/ppa
|
||||
ELSE
|
||||
ARG _more_cmds = :
|
||||
<endfold id='3'>END</endfold id='3'>
|
||||
|
||||
RUN --mount type=secret,id=+secrets/repo_gpg_key,target=/run/secrets/private-archive-keyring.gpg \
|
||||
--mount type=cache,target=/var/cache/apt/archives \
|
||||
--mount type=cache,target=/var/lib/apt/lists \
|
||||
set -x; \
|
||||
debconf-set-selections /tmp/debconf-preset.txt \
|
||||
&& rm -rf /etc/apt/apt.conf.d/docker-clean \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y software-properties-common \
|
||||
&& add-apt-repository --remove multiverse \
|
||||
&& gpg -v --dearmor - </run/secrets/private-archive-keyring.gpg > /usr/share/keyrings/private-archive-keyring.gpg \
|
||||
&& ${_more_cmds}
|
||||
|
||||
SAVE ARTIFACT /etc/apt/sources.list /sources.list
|
||||
SAVE ARTIFACT /usr/share/keyrings/private-archive-keyring.gpg /private-archive-keyring.gpg
|
||||
|
||||
<beginfold id='3'>IF</beginfold id='3'> [ "${ppa}" != '' ]
|
||||
SAVE ARTIFACT /etc/apt/sources.list.d/${ppa}*.list /sources.list.d
|
||||
SAVE ARTIFACT /etc/apt/trusted.gpg.d/${ppa}*.gpg /trusted.gpg.d
|
||||
<endfold id='3'>END</endfold id='3'>
|
||||
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>APT_INSTALL:</beginfold id='2'>
|
||||
FUNCTION
|
||||
|
||||
ARG image
|
||||
ARG packages = ''
|
||||
ARG packages_on_hold = ''
|
||||
ARG upgrade = 0
|
||||
ARG clean = 0
|
||||
ARG pm_aux_options = ''
|
||||
ARG more_rm_files = ''
|
||||
ARG more_cmds = :
|
||||
|
||||
<beginfold id='3'>IF</beginfold id='3'> [ ! -f /root/debconf-preset.txt ]
|
||||
COPY (+repos-conf-apt/debconf-preset.txt --image=${image}) /root/debconf-preset.txt
|
||||
ARG _debconf_cmd_cond = debconf-set-selections /root/debconf-preset.txt
|
||||
ELSE
|
||||
ARG _debconf_cmd_cond = :
|
||||
<endfold id='3'>END</endfold id='3'>
|
||||
|
||||
<beginfold id='3'>IF</beginfold id='3'> [ ! -f /usr/share/keyrings/private-archive-keyring.gpg ]
|
||||
COPY (+repos-conf-apt/private-archive-keyring.gpg --image=${image}) \
|
||||
/usr/share/keyrings/private-archive-keyring.gpg
|
||||
# NOTE Also copy the `sources.list` file with `multiverse` disabled!
|
||||
COPY (+repos-conf-apt/sources.list --image=${image}) /etc/apt
|
||||
<endfold id='3'>END</endfold id='3'>
|
||||
|
||||
# ...
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>MAKE_PYTHON_CI_IMAGE:</beginfold id='2'>
|
||||
FUNCTION
|
||||
|
||||
ARG image
|
||||
ARG python = python3
|
||||
ARG python_pkg = ${python}
|
||||
ARG python_bin = ${python}
|
||||
ARG python_ver = 3.11
|
||||
|
||||
DO +APT_INSTALL --packages="${python_pkg} git"
|
||||
|
||||
ARG _chroot_base = $(dirname <beginfold id='4'>$(</beginfold id='4'>cat /etc/debian_chroot<endfold id='4'>)</endfold id='4'>)
|
||||
|
||||
DO ./share+IMAGE_INIT \
|
||||
--image_description="CI image for Python projects" \
|
||||
--debian_chroot=${_chroot_base}/python/${python_ver}/ci \
|
||||
--storage_name=none
|
||||
|
||||
COPY --dir (+prep-python-ci/local --image=${image}) /usr
|
||||
|
||||
ENV SETUPTOOLS_USE_DISTUTILS='stdlib'
|
||||
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>all:</beginfold id='2'>
|
||||
LOCALLY
|
||||
|
||||
# Primary images
|
||||
BUILD +ci
|
||||
BUILD +clang-ci
|
||||
BUILD +python-ci
|
||||
|
||||
<beginfold id='3'>IF</beginfold id='3'> [ "${BUILD_TESTING}" -gt 0 ]
|
||||
# Also include all tests
|
||||
BUILD +tests
|
||||
<endfold id='3'>END</endfold id='3'>
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>tests:</beginfold id='2'>
|
||||
LOCALLY
|
||||
|
||||
BUILD +ci-tests
|
||||
BUILD +clang-ci-tests
|
||||
BUILD +python-ci-tests
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>ci-tests:</beginfold id='2'>
|
||||
FROM +ci
|
||||
COPY .env /
|
||||
DO share+RUN_TESTS --VERBOSE=${VERBOSE}
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>clang-ci-tests:</beginfold id='2'>
|
||||
FROM +clang-ci
|
||||
COPY .env /
|
||||
ENV EXPECT_CLANG_VERSION=${CLANG_VERSION}
|
||||
DO share+RUN_TESTS --VERBOSE=${VERBOSE} --script=ci-tests.sh
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>python-ci-tests:</beginfold id='2'>
|
||||
FROM +python-ci
|
||||
COPY .env /
|
||||
DO share+RUN_TESTS --VERBOSE=${VERBOSE}
|
||||
@@ -0,0 +1,248 @@
|
||||
project
|
||||
: requirements <include>/home/ghost/Work/boost <threading>multi
|
||||
;
|
||||
project a : : debug ;
|
||||
|
||||
exe hello : hello.cpp ;
|
||||
|
||||
exe hello
|
||||
: hello.cpp
|
||||
: <include>boost <threading>multi
|
||||
;
|
||||
exe app : app.cpp ../util/foo//bar ;
|
||||
exe important : main.cpp helpers/<link>static ;
|
||||
|
||||
exe b : [ glob *.cpp ] ;
|
||||
|
||||
lib tools :
|
||||
[ glob *.cpp ] ;
|
||||
|
||||
lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ;
|
||||
|
||||
lib network : network.cpp
|
||||
: <conditional>@my-rule
|
||||
;
|
||||
|
||||
DEPENDS foo.o : foo.c ;
|
||||
|
||||
using msvc : : "Z:/Programs/Microsoft Visual Studio/vc98/bin/cl" ;
|
||||
using msvc : : echo Compiling && foo/bar/baz/cl ;
|
||||
using gcc : 5 : : <cxxflags>"-std=c++14 -O2" ;
|
||||
using clang : 3.9 : : <cxxflags>-std=c++14 <cxxflags>-O2 ;
|
||||
exe test3 : test3.cpp : -<threading>multi ;
|
||||
XYZ += <cxxflags>-Wzero-as-null-pointer-constant&&-Wno-zero-as-null-pointer-constant ;
|
||||
exe hello : hello.cpp : <os>NT,<toolset>gcc:<link>static ;
|
||||
|
||||
install dist : hello helpers :
|
||||
<variant>release:<location>dist/release
|
||||
<variant>debug:<location>dist/debug ;
|
||||
install dist2 : hello helpers : <location>$(DIST) ;
|
||||
|
||||
exe app : app.cpp : [ check-target-builds has_foo "System has foo" : <library>foo : <define>FOO_MISSING=1 ] ;
|
||||
|
||||
import path : * ;
|
||||
|
||||
using python
|
||||
: 2.7 # version
|
||||
: # Interpreter/path to dir
|
||||
: /usr/include/python2.7 # includes
|
||||
: /usr/lib/x86_64-linux-gnu # libs
|
||||
: # conditions
|
||||
;
|
||||
|
||||
xx ;
|
||||
xx ;; ;
|
||||
xx ;a ;
|
||||
xx a; ;
|
||||
xx ;a; ;
|
||||
|
||||
## comment title
|
||||
# BUG
|
||||
# TODO
|
||||
# aTODOa
|
||||
|
||||
#| multi
|
||||
line
|
||||
comment
|
||||
TODO
|
||||
bla bla
|
||||
|#
|
||||
|
||||
if cond <beginfold id='1'>{</beginfold id='1'>
|
||||
statements ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
else <beginfold id='1'>{</beginfold id='1'>
|
||||
statements ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
for var in list <beginfold id='1'>{</beginfold id='1'>
|
||||
statements ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
while cond <beginfold id='1'>{</beginfold id='1'>
|
||||
statements ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
switch value
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
case pattern1 : statements ;
|
||||
case pattern2 : statements ;
|
||||
other ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
if xxinxx <beginfold id='1'>{</beginfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
ifxxx s ;
|
||||
|
||||
rule a? ( x )
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
echo $(x) ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
a? 23 ;
|
||||
|
||||
local rule test ( a )
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
rule example
|
||||
(
|
||||
parameter1 :
|
||||
parameter2 ? :
|
||||
parameter3 + :
|
||||
parameter4 *
|
||||
)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
if <variant>debug in $(properties)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
OPTIONS on $(targets) = --debug ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
rule my-rule ( properties * )
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
local result ;
|
||||
if <toolset>gcc <optimization>speed in $(properties)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
result += <define>USE_INLINE_ASSEMBLER ;
|
||||
return $(result) ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
local m = [ CALLER_MODULE ] ;
|
||||
local result ;
|
||||
for v in $(values)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
if [ modules.call-in $(m) : $(f) $(v) ]
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
result += $(v) ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
return result ;
|
||||
return <name>$(name) ;
|
||||
return [ virtual-target.register $(t) ] ;
|
||||
return [ sequence.transform virtual-target.register : $(targets) ] ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
rule run ( project name ? : property-set : sources * )
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
if [ $(s).type ] = PY
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
python = $(s) ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
local new-sources ;
|
||||
for local s in $(sources)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
if [ type.is-derived [ $(s).type ] CPP ]
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
local name = [ $(s).name ] ; # get the target's basename
|
||||
if $(name) = [ $(python).name ]
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
name = $(name)_ext ; # rename the target
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
new-sources += [ generators.construct $(project) $(name) :
|
||||
PYTHON_EXTENSION : $(property-set) : $(s) $(libs) ] ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
result = [ construct-result $(python) $(new-sources) : $(project) $(name)
|
||||
: $(property-set) ] ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
|
||||
rule link
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
|
||||
actions link bind DEF_FILE
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
<beginfold id='2'>$(</beginfold id='2'>.LD<endfold id='2'>)</endfold id='2'> .... /DEF:<beginfold id='2'>$(</beginfold id='2'>DEF_FILE<endfold id='2'>)</endfold id='2'> ....
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
actions create-file-from-another
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
create-file-from-another <beginfold id='2'>$(</beginfold id='2'>OPTIONS<endfold id='2'>)</endfold id='2'> <beginfold id='2'>$(</beginfold id='2'><<endfold id='2'>)</endfold id='2'> <beginfold id='2'>$(</beginfold id='2'>><endfold id='2'>)</endfold id='2'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
|
||||
mypackage =
|
||||
[ pkg-config.import mypackage : usage-requirements <conditional>@define_ns
|
||||
] ;
|
||||
|
||||
me = [ modules.binding $(__name__) ] ;
|
||||
|
||||
local ZLIB_INCLUDE = [ modules.peek : ZLIB_INCLUDE ] ;
|
||||
|
||||
local t = [ new file-target $(name) : CPP : $(project) : $(a) ] ;
|
||||
|
||||
$(var) field1 : field2 : ... : fieldN ;
|
||||
$(var)o aaaa ;
|
||||
|
||||
on target $(var) field1 : field2 : ... : fieldN ;
|
||||
|
||||
[ $(var) field1 : field2 : ... : fieldN ]
|
||||
[ on target $(var) field1 : field2 : ... : fieldN ]
|
||||
|
||||
local key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths" ;
|
||||
local values = [ W32_GETREGNAMES "$(key)\\$(subkey)" : values ] ;
|
||||
|
||||
variable = $(b) $(c) ;
|
||||
variable += elements ;
|
||||
variable on targets = elements ;
|
||||
variable on targets += "elements" ;
|
||||
variable default = elements ;
|
||||
variable ?= elements ;
|
||||
|
||||
defs += <define>NAME='\"$(VALUE)\"' ;
|
||||
|
||||
x = $($(Z)) ;
|
||||
x = $(Z)x ;
|
||||
x = x$(Z) ;
|
||||
x = x$(Z)x ;
|
||||
|
||||
x = "C:\\Program Files\\Borland" ; ECHO $(x:T) ;
|
||||
|
||||
module my_module # my module
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
rule salute ( x ) <beginfold id='1'>{</beginfold id='1'> ECHO $(x), world ; <endfold id='1'>}</endfold id='1'>
|
||||
rule greet ( ) <beginfold id='1'>{</beginfold id='1'> salute hello ; <endfold id='1'>}</endfold id='1'>
|
||||
greet ; # ok
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
class verbatim-scanner : common-scanner
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
rule pattern ( )
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
return "//###include[ ]*\"([^\"]*)\"" ;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
greet ; # error
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
# test crazy (and valid) name
|
||||
a<b> a<b> [ a<b> a<b> a] ] ;
|
||||
rule a<b>() () <beginfold id='1'>{</beginfold id='1'> <endfold id='1'>}</endfold id='1'>
|
||||
actions a<b> <beginfold id='1'>{</beginfold id='1'> <endfold id='1'>}</endfold id='1'>
|
||||
local a<x> ;
|
||||
local a<x> = a<b> ;
|
||||
@@ -0,0 +1,356 @@
|
||||
This is wrong but should not crash ] ) } !
|
||||
|
||||
# comment
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> BR2_PACKAGE_GAMMARAY
|
||||
bool "gammaray"
|
||||
depends on BR2_PACKAGE_QT5
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
GammaRay Qt introspection probe.
|
||||
second line of help, with correct indentation
|
||||
|
||||
GammaRay Qt introspection probe.
|
||||
second line of help, with correct indentation
|
||||
<endfold id='2'></endfold id='2'>third line underindented and thus wrong
|
||||
default 'true'
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> W1_MASTER_GPIO_CUSTOM
|
||||
tristate "Custom GPIO-based W1 driver"
|
||||
depends on GENERIC_GPIO
|
||||
select W1_GPIOconfig AG71XX
|
||||
tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support"
|
||||
depends on ATH79
|
||||
imply HAS_TXX9_SERIAL
|
||||
def_bool LD_VERSION >= 225000000 || LD_IS_LLD
|
||||
select PHYLIB
|
||||
<beginfold id='2'>---help---</beginfold id='2'>
|
||||
If you wish to compile a kernel for AR7XXX/91XXX and enable
|
||||
ethernet support, then you should always answer Y to this.
|
||||
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><beginfold id='3'>comment</beginfold id='3'> "module support disabled"
|
||||
depends on !MODULES
|
||||
|
||||
<endfold id='3'></endfold id='3'><beginfold id='4'>menu</beginfold id='4'> myMenu
|
||||
depends on NET
|
||||
<beginfold id='1'>config</beginfold id='1'> NETDEVICES
|
||||
bool "Atheros AR71xx built-in ethernet driver debugging"
|
||||
def_bool ds
|
||||
default n
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
Atheros AR71xx built-in ethernet driver debugging messages.
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><endfold id='4'>endmenu</endfold id='4'>
|
||||
<beginfold id='5'>if</beginfold id='5'> TARGET_OX820
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> SYS_CPU
|
||||
default "arm1136"
|
||||
|
||||
<endfold id='1'></endfold id='1'><endfold id='5'>endif</endfold id='5'>
|
||||
|
||||
<beginfold id='5'>if</beginfold id='5'> AG71XX
|
||||
<beginfold id='1'>config</beginfold id='1'> AG71XX_DEBUG
|
||||
bool "Atheros AR71xx built-in ethernet driver debugging"
|
||||
default n
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
Atheros AR71xx built-in ethernet driver debugging messages.
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><endfold id='5'>endif</endfold id='5'>
|
||||
|
||||
# comment
|
||||
|
||||
<beginfold id='4'>menu</beginfold id='4'> "System setup"
|
||||
|
||||
<beginfold id='6'>choice</beginfold id='6'>
|
||||
prompt "Alpha system type"
|
||||
default ALPHA_GENERIC
|
||||
string "bad"
|
||||
<beginfold id='2'>---help---</beginfold id='2'>
|
||||
This is the system type of your hardware.
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='1'>config</beginfold id='1'> HZ_32
|
||||
bool "32 Hz"
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> HZ_64
|
||||
bool "64 Hz"
|
||||
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> ALPHA_GENERIC
|
||||
bool "Generic"
|
||||
depends on TTY
|
||||
select HAVE_EISA
|
||||
select GENERIC_BUG_RELATIVE_POINTERS if X86_64
|
||||
bool "64-bit kernel" if "$(SUBARCH)" = "x86"
|
||||
bool "Support the legacy \"mmu-masters\" devicetree bindings"
|
||||
depends on ARM_SMMU=y && OF
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
A generic kernel will run on all supported Alpha hardware.
|
||||
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><endfold id='6'>endchoice</endfold id='6'>
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> VGA_HOSE
|
||||
bool
|
||||
def_bool y
|
||||
depends on VGA_CONSOLE && <beginfold id='7'>(</beginfold id='7'>ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI<endfold id='7'>)</endfold id='7'>
|
||||
default y
|
||||
default n
|
||||
default 3
|
||||
bool "Use WTINT" if ALPHA_SRM || ALPHA_GENERIC
|
||||
default y if ALPHA_QEMU
|
||||
default n if ALPHA_EV5 || ALPHA_EV56 || <beginfold id='7'>(</beginfold id='7'>ALPHA_EV4 && !ALPHA_LCA<endfold id='7'>)</endfold id='7'>
|
||||
default n if !ALPHA_SRM && !ALPHA_GENERIC
|
||||
default y if SMP
|
||||
default "y" if PPC_POWERNV
|
||||
range 2 32
|
||||
depends on SMP
|
||||
default "32" if ALPHA_GENERIC || ALPHA_MARVEL
|
||||
default '4' if !ALPHA_GENERIC && !ALPHA_MARVEL
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
Support VGA on an arbitrary hose; needed for several platforms
|
||||
which always have multiple hoses, and whose consoles support it.
|
||||
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><endfold id='4'>endmenu</endfold id='4'>
|
||||
|
||||
<beginfold id='4'>menu</beginfold id='4'> "ARC Architecture Configuration"
|
||||
|
||||
<beginfold id='4'>menu</beginfold id='4'> "ARC Platform/SoC/Board"
|
||||
|
||||
#New platform adds here
|
||||
source "arch/arc/plat-eznps/Kconfig"
|
||||
source 'arch/arc/plat-hsdk/Kconfig'
|
||||
|
||||
<endfold id='4'>endmenu</endfold id='4'>
|
||||
|
||||
<beginfold id='4'>menu</beginfold id='4'> "ARC CPU Configuration"
|
||||
|
||||
<beginfold id='6'>choice</beginfold id='6'>
|
||||
prompt "ARC Core"
|
||||
default ARC_CPU_HS if ISA_ARCV2
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
bla bla
|
||||
|
||||
<endfold id='2'></endfold id='2'><beginfold id='5'>if</beginfold id='5'> ISA_ARCOMPACT
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> ARC_CPU_750D
|
||||
bool "ARC750D"
|
||||
select ARC_CANT_LLSC
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
Support for ARC750 core
|
||||
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><endfold id='5'>endif</endfold id='5'> #ISA_ARCOMPACT
|
||||
|
||||
<endfold id='6'>endchoice</endfold id='6'>
|
||||
|
||||
<beginfold id='5'>if</beginfold id='5'> SMP
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> NR_CPUS
|
||||
int "Maximum number of CPUs (2-4096)"
|
||||
range 2 4096
|
||||
default "4"
|
||||
|
||||
<endfold id='1'></endfold id='1'><endfold id='5'>endif</endfold id='5'> #SMP
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> ARC_MMU_V4
|
||||
bool "MMU v4"
|
||||
depends on ISA_ARCV2
|
||||
|
||||
<endfold id='1'></endfold id='1'><endfold id='4'>endmenu</endfold id='4'> # "ARC CPU Configuration"
|
||||
|
||||
<beginfold id='1'>menuconfig</beginfold id='1'> ARC_PLAT_EZNPS
|
||||
bool "\"EZchip\" ARC dev platform"
|
||||
depends on ISA_ARCOMPACT
|
||||
select CPU_BIG_ENDIAN
|
||||
select CLKSRC_NPS if !PHYS_ADDR_T_64BIT
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
Support for EZchip development platforms,
|
||||
based on ARC700 cores.
|
||||
We handle few flavors:
|
||||
- Hardware Emulator AKA HE which is FPGA based chassis
|
||||
- Simulator based on MetaWare nSIM
|
||||
- NPS400 chip based on ASIC
|
||||
|
||||
<endfold id='2'></endfold id='2'># SPDX-License-Identifier: GPL-2.0-only
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> ARM64
|
||||
def_bool y
|
||||
select HAVE_DYNAMIC_FTRACE_WITH_REGS \
|
||||
if $(cc-option,-fpatchable-function-entry=2)
|
||||
select HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
ARM 64-bit (AArch64) Linux support.
|
||||
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> PHYS_OFFSET
|
||||
hex "Physical address of main memory" if MMU
|
||||
depends on !ARM_PATCH_PHYS_VIRT
|
||||
default DRAM_BASE if !MMU
|
||||
default 0x00000000 if ARCH_EBSA110 || \
|
||||
ARCH_FOOTBRIDGE || \
|
||||
ARCH_INTEGRATOR || \
|
||||
ARCH_REALVIEW
|
||||
default 0x10000000 if ARCH_OMAP1 || ARCH_RPC
|
||||
default 0x20000000 if ARCH_S5PV210
|
||||
default 0xc0000000 if ARCH_SA1100
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
Please provide the physical address corresponding to the
|
||||
location of main memory in your system.
|
||||
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><beginfold id='3'>comment</beginfold id='3'> "S3C2416 Boards"
|
||||
|
||||
<endfold id='3'></endfold id='3'><beginfold id='1'>config</beginfold id='1'> KERNEL_RAM_BASE_ADDRESS
|
||||
hex "Virtual address of memory base"
|
||||
default 0xe0000000 if SOC_TMS320C6455
|
||||
default 0xe0000000 if SOC_TMS320C6457
|
||||
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> CC_IS_GCC
|
||||
def_bool $(success,echo "$(CC_VERSION_TEXT)" | grep -q gcc)
|
||||
|
||||
<endfold id='1'></endfold id='1'>endif # error
|
||||
|
||||
# next line caused hang, see https://phabricator.kde.org/D18509
|
||||
<beginfold id='4'>menu</beginfold id='4'>
|
||||
|
||||
# the next lines should all be fine
|
||||
plain:=plain_value
|
||||
with_whitespace := plain value whitespace
|
||||
value_with_expansion := $(ARCH)
|
||||
plain_expansion_mix := Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration
|
||||
|
||||
# function definition
|
||||
cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1))
|
||||
|
||||
# function call
|
||||
$(cc-option-bit,-m64)
|
||||
|
||||
# function call and storing the result
|
||||
m32-flag := $(cc-option-bit,-m32)
|
||||
|
||||
# call to known function
|
||||
name := $(filename)
|
||||
|
||||
# call to known function with arguments
|
||||
$(warning-if,y,hello world 1)
|
||||
|
||||
# ... with nested expansions
|
||||
$(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supported)
|
||||
|
||||
# expansion in different contexts
|
||||
<beginfold id='1'>config</beginfold id='1'> FOO_$(BAR$(BAZ))
|
||||
int "$(filename)"
|
||||
default $(lineno) if $(lineno) >= 5
|
||||
|
||||
<endfold id='1'></endfold id='1'><beginfold id='4'>menu</beginfold id='4'> "A MENU"
|
||||
visible if 01 > 00
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> A_BOOL
|
||||
def_bool y && m || !!<beginfold id='7'>(</beginfold id='7'>!<beginfold id='7'>(</beginfold id='7'>!!n<endfold id='7'>)</endfold id='7'><endfold id='7'>)</endfold id='7'> || "$(foo)"
|
||||
|
||||
<endfold id='1'></endfold id='1'><endfold id='4'>endmenu</endfold id='4'>
|
||||
|
||||
# Advanced real world example taken from init/Kconfig in Linux 5.10:
|
||||
# Invoke the system shell /bin/sh with a command to pipe a C program with an
|
||||
# asm goto statement to the C compiler that is set by the environment. If the
|
||||
# exit code is 0 then set the default value of CC_HAS_ASM_GOTO_OUTPUT to y,
|
||||
# otherwise to n.
|
||||
<beginfold id='1'>config</beginfold id='1'> CC_HAS_ASM_GOTO_OUTPUT
|
||||
depends on CC_HAS_ASM_GOTO
|
||||
def_bool $(success,echo 'int foo(int x) { asm goto ("": "=r"(x) ::: bar); return x; bar: return 0; }' | $(CC) -x c - -c -o /dev/null)
|
||||
|
||||
# Real world example with irregular indentation
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> W1_MASTER_DS2490
|
||||
tristate "DS2490 USB <-> W1 transport layer for 1-wire"
|
||||
depends on USB
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
Say Y here if you want to have a driver for DS2490 based USB <-> W1 bridges,
|
||||
for example DS9490*.
|
||||
|
||||
This support is also available as a module. If so, the module
|
||||
will be called ds2490.
|
||||
|
||||
<endfold id='2'></endfold id='2'># synthetic example
|
||||
<endfold id='1'></endfold id='1'>to_upper=$(shell,echo $(1) | tr [:lower:] [:upper:])
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> ARGS_$(to_upper,$(CC))
|
||||
string "Arguments for the current compiler \"$(CC)\""
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
This is a bad idea.
|
||||
See <file:Documentation/completely/made-up.rst>
|
||||
|
||||
<endfold id='2'></endfold id='2'># binary operator in expression of an if statement
|
||||
<endfold id='1'></endfold id='1'><beginfold id='5'>if</beginfold id='5'> CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
|
||||
source "drivers/cpufreq/Kconfig"
|
||||
<endfold id='5'>endif</endfold id='5'>
|
||||
|
||||
# alert on characters (here a colon) that are ignored (taken from axTLS 2.1.5)
|
||||
<beginfold id='1'>config</beginfold id='1'> CONFIG_LUA_CORE
|
||||
string "Location of Lua CORE"
|
||||
default "/usr/local"
|
||||
<beginfold id='2'>help</beginfold id='2'>:
|
||||
If the Lua exists on another directory then this needs to be changed
|
||||
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'></endfold id='1'><beginfold id='3'>comment</beginfold id='3'> "Comment texts know expansions, too: $(CC), and the depends property:"
|
||||
depends on A_BOOL
|
||||
|
||||
# "boolean" is now a free variable name ...
|
||||
<endfold id='1'></endfold id='1'>boolean=foo
|
||||
# ... but it looks like a bad idea. This may be disputed.
|
||||
|
||||
<beginfold id='1'>menuconfig</beginfold id='1'> MODULES
|
||||
bool "Enable loadable module support"
|
||||
modules
|
||||
|
||||
# the three modern options
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> OPTIONS
|
||||
option allnoconfig_y
|
||||
option modules
|
||||
option defconfig_list
|
||||
|
||||
# old option "env" and obsolete custom options
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> OPTIONS
|
||||
option env=ARCH
|
||||
option custom-without-argument
|
||||
option custom-with-argument=ABC
|
||||
|
||||
# old syntax
|
||||
<endfold id='1'></endfold id='1'><beginfold id='4'>menu</beginfold id='4'> OLD_STYLE_PROMPT
|
||||
visible if CPU_SUPPORTS_CPUFREQ
|
||||
|
||||
# busybox 1.31.1
|
||||
source libbb/Config.in
|
||||
|
||||
# uClibc-ng-1.0.37
|
||||
<beginfold id='1'>config</beginfold id='1'> DESIRED_TARGET_ARCH
|
||||
string
|
||||
option env="ARCH"
|
||||
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>config</beginfold id='1'> OLD_HELP
|
||||
hex
|
||||
<beginfold id='2'>---help---</beginfold id='2'>
|
||||
old help property
|
||||
<endfold id='2'></endfold id='2'>default 0x1CEC0FEE
|
||||
<endfold id='1'></endfold id='1'><endfold id='4'>endmenu</endfold id='4'>
|
||||
|
||||
# a few errors
|
||||
allnoconfig_y
|
||||
bool
|
||||
def_bool
|
||||
def_tristate
|
||||
default
|
||||
defconfig_list
|
||||
depends
|
||||
endchoice
|
||||
endif
|
||||
help
|
||||
hex
|
||||
imply
|
||||
int
|
||||
mainmenu
|
||||
modules
|
||||
on
|
||||
option
|
||||
optional
|
||||
prompt
|
||||
range
|
||||
select
|
||||
string
|
||||
tristate
|
||||
visible
|
||||
|
||||
<beginfold id='1'>config</beginfold id='1'> OK
|
||||
bool "still OK"
|
||||
<beginfold id='2'>help</beginfold id='2'>
|
||||
still OK
|
||||
<endfold id='2'></endfold id='2'>now=fail
|
||||
<endfold id='1'></endfold id='1'>andNow=OK
|
||||
@@ -0,0 +1,114 @@
|
||||
# comment
|
||||
|
||||
include Makefile.in
|
||||
-include Makefile.doesntexist
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: target
|
||||
|
||||
foo = bar $(var) \
|
||||
$(baz) quux
|
||||
|
||||
<beginfold id='1'>ifeq</beginfold id='1'> ($(CC),gcc)
|
||||
bla=$(call func,param1,param2)
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> ifeq "x" "y"
|
||||
$(error this seems wrong)
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'>
|
||||
libs=$(normal_libs)
|
||||
<endfold id='1'>endif</endfold id='1'>
|
||||
|
||||
target1:
|
||||
error
|
||||
|
||||
target2: bla.cpp $@
|
||||
$(CC) bla.c -o bla.o
|
||||
$(CC) bla.o $< \
|
||||
-o bla.exe
|
||||
@echo "hello" \
|
||||
bla bla
|
||||
echo "hello" \
|
||||
bla bla
|
||||
|
||||
target3: ; @echo ’hello \
|
||||
world’ ; echo "hello \
|
||||
world"
|
||||
@echo "hello"
|
||||
|
||||
target4: ; echo ’hello \
|
||||
world’ ; echo "hello \
|
||||
world"
|
||||
echo "hello"
|
||||
|
||||
target5 \
|
||||
target6 \
|
||||
target7 &::
|
||||
@echo "hello"
|
||||
# this should not break the rule
|
||||
# ifndef is a command
|
||||
ifndef
|
||||
|
||||
# String Substitution
|
||||
VAR := $(ANOTHER_VAR:%=%+1)
|
||||
|
||||
# Variable Assignment
|
||||
RELAXED ::= mello
|
||||
rempl := x
|
||||
foo := a b c
|
||||
bar := foo
|
||||
hello := $($(bar):a=$(rempl))
|
||||
my??var=value
|
||||
var??=value
|
||||
var?=value
|
||||
var? = value
|
||||
var :::= value
|
||||
var ::= value
|
||||
var += value
|
||||
var != value
|
||||
var = value\#nocomment
|
||||
var = value#comment
|
||||
var = value;value2
|
||||
override var = a
|
||||
|
||||
define var :::=
|
||||
bar
|
||||
endef
|
||||
|
||||
override define var :::=
|
||||
bar
|
||||
endef
|
||||
|
||||
undefine var
|
||||
override undefine var
|
||||
|
||||
export foo bar
|
||||
export foo = bar
|
||||
unexport foo bar
|
||||
|
||||
prog: private EXTRA_CFLAGS = -L/usr/local/lib
|
||||
prog: CFLAGS = -g
|
||||
prog: a.o b.o
|
||||
|
||||
# Conditionals
|
||||
bar =
|
||||
foo = $(bar)
|
||||
<beginfold id='1'>ifdef</beginfold id='1'> bar
|
||||
frobozz = yes
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> ifdef foo
|
||||
frobozz = no
|
||||
<endfold id='1'>endif</endfold id='1'>
|
||||
|
||||
error_type := 0
|
||||
check:
|
||||
<beginfold id='1'>ifeq</beginfold id='1'> ($(error_type),0)
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> ifeq ($(error_type),1)
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> ifeq ($(error_type),2)
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> ifeq ($(error_type),3)
|
||||
<endfold id='1'>endif</endfold id='1'>
|
||||
|
||||
$(info "'")
|
||||
$(info '"')
|
||||
$(info $(??))
|
||||
|
||||
$(eval $(call Variable_rule,target/compile_flags,$${CXX} $$(CXXFLAGS)))
|
||||
$(eval ${call Variable_rule,target/link_flags,$$(CXX) $$(LDFLAGS) $${LDLIBS}})
|
||||
@@ -0,0 +1,53 @@
|
||||
[Adblock Plus 2.0]
|
||||
! Checksum: OBK3kgyECgXJtrF4BTO3Fg
|
||||
! Version: 201709021630
|
||||
! Title: Test Adblock List
|
||||
! Last modified: 02 Sep 2017 16:30 UTC
|
||||
! Expires: 2 days (update frequency)
|
||||
! Homepage: https://www.kde.org/
|
||||
! Licence: MIT
|
||||
!
|
||||
! Some more text
|
||||
!
|
||||
|
||||
! basic rules
|
||||
http://example.com/ads/banner123.gif
|
||||
http://example.com/ads/banner*.gif
|
||||
http://example.com/ads/*
|
||||
http://example.com/*
|
||||
|
||||
! exception rules
|
||||
@@advice
|
||||
@@||example.com^$document
|
||||
|
||||
! begin/end matches
|
||||
swf|
|
||||
||example.com/banner.gif
|
||||
|
||||
! separator characters
|
||||
http://example.com^
|
||||
^example.com^
|
||||
^%D1%82%D0%B5%D1%81%D1%82^
|
||||
|
||||
! filter options
|
||||
*/ads/*$script,match-case
|
||||
*$donottrack,image,~image
|
||||
*$domain=example.com|example.net
|
||||
*/BannerAd.gif$match-case
|
||||
|
||||
! regular expressions
|
||||
/banner\d+/
|
||||
/\.bla\/[0-9]{2,9}\/$/$script,stylesheet,third-party,xmlhttprequest
|
||||
|
||||
! element selectors
|
||||
##.textad.
|
||||
###sponsorad
|
||||
example.com##.sponsor
|
||||
~foo.example.com##.sponsor
|
||||
|
||||
! attribute selectors
|
||||
##table[width="80%"]
|
||||
##div[title^="adv"][title$="ert"]
|
||||
|
||||
! element selector exceptions
|
||||
exmaple.com#@#.adwords
|
||||
@@ -0,0 +1,67 @@
|
||||
# Apache configuration highlighting unit test
|
||||
# comment with alters TODO FIXME ###
|
||||
|
||||
<beginfold id='1'><IfModule</beginfold id='1'> mod_dav_fs.c>
|
||||
DAVLockDB /var/lock/apache/DAVLock
|
||||
<endfold id='1'></IfModule</endfold id='1'>>
|
||||
|
||||
<beginfold id='1'><VirtualHost</beginfold id='1'> *:443>
|
||||
Include something_else.inc
|
||||
|
||||
SSLEngine on
|
||||
# exclude insecure protocols
|
||||
SSLProtocol all -SSLv2 -SSLv3
|
||||
SSLHonorCipherOrder on
|
||||
# exclude insecure ciphers
|
||||
SSLCipherSuite "HIGH !EXP !eNULL !aNULL !LOW !RC4 !3DES !MD5 !EXP !PSK !SRP !DSS !DES !aECDH"
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/cert.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/chain.pem
|
||||
CustomLog /var/log/apache2/ssl_request_log ssl_combined
|
||||
<endfold id='1'></VirtualHost</endfold id='1'>>
|
||||
|
||||
<beginfold id='1'><Proxy</beginfold id='1'> "http://localhost:10000/">
|
||||
SSLRequireSSL
|
||||
<endfold id='1'></Proxy</endfold id='1'>>
|
||||
|
||||
<beginfold id='1'><Directory</beginfold id='1'> "/some/quoted/path">
|
||||
Options -Indexes -FollowSymLinks
|
||||
DirectoryIndex index.php
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
|
||||
Options FollowSymLinks
|
||||
AllowOverride FileInfo Options All
|
||||
<beginfold id='1'><LimitExcept</beginfold id='1'> GET>
|
||||
Require valid-user
|
||||
<endfold id='1'></LimitExcept</endfold id='1'>>
|
||||
|
||||
<beginfold id='1'><Files</beginfold id='1'> ~ "\.(cgi|shtml|phtml|php3?)$">
|
||||
ForceType text/plain
|
||||
<endfold id='1'></Files</endfold id='1'>>
|
||||
<endfold id='1'></Directory</endfold id='1'>>
|
||||
|
||||
Alias /foo/ "/srv/www/htdocs/foo/"
|
||||
|
||||
AuthType Basic
|
||||
AuthName "KDE"
|
||||
AuthUserFile /srv/www/htpasswd.db
|
||||
Require user konqui
|
||||
|
||||
<beginfold id='1'><VirtualHost</beginfold id='1'> _default_:80>
|
||||
ServerName www.kde.org
|
||||
ServerAlias kde.org
|
||||
|
||||
RewriteEngine On
|
||||
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent]
|
||||
<endfold id='1'></VirtualHost</endfold id='1'>>
|
||||
|
||||
AuthBasicProvider ldap
|
||||
AuthLDAPBindDN uid=ldapproxy,ou=people,dc=kde,dc=org
|
||||
AuthLDAPBindPassword top_secret
|
||||
AuthLDAPURL ldap://localhost:389/ou=people,dc=kde,dc=org?uid?sub?(objectClass=posixAccount)
|
||||
AuthLDAPGroupAttributeIsDN on
|
||||
AuthLDAPGroupAttribute member
|
||||
Require ldap-group cn=sysadmin,ou=Group,dc=kde,dc=org
|
||||
+2771
File diff suppressed because it is too large
Load Diff
+143
@@ -0,0 +1,143 @@
|
||||
|
||||
#i am macro
|
||||
|
||||
library "a"
|
||||
|
||||
<beginfold id='1'>function</beginfold id='1'> myfunc ( foo as Integer , bar as Float = 3.5 ) as Void
|
||||
end <endfold id='1'>function</endfold id='1'>
|
||||
|
||||
<beginfold id='2'>sub</beginfold id='2'> mysub ( foo as Integer , bar as Float = 3.5 ) as Void
|
||||
end <endfold id='2'>sub</endfold id='2'>
|
||||
|
||||
' my comment
|
||||
|
||||
<beginfold id='1'>Function</beginfold id='1'> MyCamelCaseFunction()
|
||||
lvalue = rvalue
|
||||
a=5
|
||||
a=5!
|
||||
a=5#
|
||||
a=5%
|
||||
a=5&
|
||||
|
||||
a$=5
|
||||
a!=5
|
||||
a#=5
|
||||
a%=5
|
||||
a&=5
|
||||
|
||||
a=a$
|
||||
a=a!
|
||||
a=a#
|
||||
a=a%
|
||||
a=a&
|
||||
|
||||
foo()
|
||||
a.foo()
|
||||
a=a.foo()
|
||||
|
||||
eval=5
|
||||
eval()
|
||||
a.eval()
|
||||
|
||||
a=eval
|
||||
a=eval()
|
||||
a=a.eval()
|
||||
|
||||
sleep=5
|
||||
sleep()
|
||||
a.sleep()
|
||||
|
||||
a=sleep
|
||||
a=sleep()
|
||||
a=a.sleep()
|
||||
|
||||
if a=b c=d
|
||||
if a foo()
|
||||
if a then foo()
|
||||
|
||||
if a
|
||||
end if
|
||||
|
||||
if a then
|
||||
end if
|
||||
|
||||
if a
|
||||
else if
|
||||
else
|
||||
end if
|
||||
|
||||
if a
|
||||
elseif
|
||||
endif
|
||||
|
||||
for each a in b
|
||||
end for
|
||||
|
||||
for a=1 to 10 step 2
|
||||
endFor
|
||||
|
||||
for each a in b
|
||||
next
|
||||
|
||||
while a
|
||||
end while
|
||||
|
||||
while a
|
||||
endWhile
|
||||
|
||||
a [ "a" , 1, foo() ] = 1
|
||||
a.foo()[1]=1
|
||||
|
||||
a = {
|
||||
a : 1
|
||||
b : "2"
|
||||
c : <beginfold id='1'>function</beginfold id='1'>() : end <endfold id='1'>function</endfold id='1'>
|
||||
}
|
||||
|
||||
b.foo("string",1,{a:b},1.5,[1,2,3])
|
||||
a = b.foo("string",1,{a:b},1.5,[1,2,3])
|
||||
|
||||
unnamed_function = <beginfold id='1'>function</beginfold id='1'> ( a as Integer ) as Float
|
||||
|
||||
a = +-b
|
||||
a = &h42abcdef
|
||||
c = var@attr
|
||||
end <endfold id='1'>function</endfold id='1'>
|
||||
|
||||
unnamed_sub = <beginfold id='2'>sub</beginfold id='2'> ( a as Integer ) as Void
|
||||
end <endfold id='2'>sub</endfold id='2'>
|
||||
end<endfold id='1'>Function</endfold id='1'>
|
||||
|
||||
<beginfold id='2'>sub</beginfold id='2'> exceptions()
|
||||
try=1
|
||||
try()
|
||||
try.foo
|
||||
try foo
|
||||
|
||||
catch=1
|
||||
catch()
|
||||
catch.foo
|
||||
catch foo
|
||||
|
||||
try
|
||||
catch foo
|
||||
end try
|
||||
|
||||
try ' comment
|
||||
endtry
|
||||
|
||||
throw {a: "abc"}
|
||||
end <endfold id='2'>sub</endfold id='2'>
|
||||
|
||||
<beginfold id='2'>sub</beginfold id='2'> inline_lambda()
|
||||
a(a, "string")(a, "string")
|
||||
|
||||
a = <beginfold id='2'>sub</beginfold id='2'>()
|
||||
end <endfold id='2'>sub</endfold id='2'>(a, "string", [a, foo("string")])
|
||||
|
||||
b = <beginfold id='1'>function</beginfold id='1'>()
|
||||
end <endfold id='1'>function</endfold id='1'>(a, "string")
|
||||
|
||||
c = <beginfold id='2'>sub</beginfold id='2'>()
|
||||
end <endfold id='2'>sub</endfold id='2'>
|
||||
end <endfold id='2'>sub</endfold id='2'>
|
||||
@@ -0,0 +1,86 @@
|
||||
<beginfold id='1'>/*</beginfold id='1'> highlighting test case for Gradle (which actually uses Groovy syntax) <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
// single line comment with ### TODO FIXME
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> multiline comment with ### TODO FIXME <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='2'>/**</beginfold id='2'> Javadoc comment with ### TODO FIXME
|
||||
* @param foo bla bla ATTENTION
|
||||
* @return abc cde
|
||||
* @see javadoc.xml
|
||||
<endfold id='2'>*/</endfold id='2'>
|
||||
|
||||
buildscript <beginfold id='3'>{</beginfold id='3'>
|
||||
repositories <beginfold id='3'>{</beginfold id='3'>
|
||||
jcenter()
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
dependencies <beginfold id='3'>{</beginfold id='3'>
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
allprojects <beginfold id='3'>{</beginfold id='3'>
|
||||
repositories <beginfold id='3'>{</beginfold id='3'>
|
||||
jcenter()
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
dependencies <beginfold id='3'>{</beginfold id='3'>
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'org.mnode.ical4j:ical4j:2.2.0'
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
android <beginfold id='3'>{</beginfold id='3'>
|
||||
compileSdkVersion androidCompileSdkVersion.toInteger()
|
||||
|
||||
buildToolsVersion androidBuildToolsVersion
|
||||
|
||||
sourceSets <beginfold id='3'>{</beginfold id='3'>
|
||||
main <beginfold id='3'>{</beginfold id='3'>
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
|
||||
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
|
||||
res.srcDirs = [qt5AndroidDir + '/res', 'res']
|
||||
resources.srcDirs = ['src']
|
||||
renderscript.srcDirs = ['src']
|
||||
assets.srcDirs = ['assets']
|
||||
jniLibs.srcDirs = ['libs']
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
lintOptions <beginfold id='3'>{</beginfold id='3'>
|
||||
abortOnError false
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
def a = 'ab\'c'
|
||||
def a = '''\
|
||||
abc $x.toString() ${x.toString()}
|
||||
\nxy
|
||||
'''
|
||||
def a = '''
|
||||
abc $x.toString() ${x.toString()}
|
||||
\nxy
|
||||
'''
|
||||
|
||||
def a = "ab\'c"
|
||||
def a = """\
|
||||
abc $x.toString() ${x.toString()}
|
||||
\nxy
|
||||
"""
|
||||
def a = """
|
||||
abc $x.toString() ${x.toString()}
|
||||
\nxy
|
||||
"""
|
||||
|
||||
def a = $/$ $$ $/ $= $x.toString() ${x.toString()}
|
||||
abc
|
||||
\nxy/$
|
||||
|
||||
def a = /ab\/c
|
||||
\nxyd/
|
||||
|
||||
1_2e3_4
|
||||
@@ -0,0 +1,125 @@
|
||||
# comment
|
||||
rule b
|
||||
rule c
|
||||
#d
|
||||
rule c
|
||||
description=a
|
||||
rule d
|
||||
description = ds
|
||||
description = ds
|
||||
rule=ds
|
||||
description = ds
|
||||
rule b
|
||||
|
||||
rule c
|
||||
|
||||
rule c
|
||||
# ds
|
||||
ds=ds
|
||||
description=a
|
||||
rule d
|
||||
rule =description = ds
|
||||
|
||||
rule b
|
||||
command = clang -MMD -MF $out.d -o $out -c $in
|
||||
description = building $out
|
||||
unknown = xyz
|
||||
|
||||
rule dump
|
||||
command = sleep 1; ls -l /proc/self/fd; exit 1
|
||||
pool = link_pool
|
||||
# blah blah
|
||||
pool = console
|
||||
pool = $console
|
||||
|
||||
rule xy-z_
|
||||
rule --xy-z_
|
||||
rule _xy-z_
|
||||
|
||||
# error
|
||||
rule with error
|
||||
rule a:a
|
||||
rule a|a
|
||||
rule a$
|
||||
rule 0-@#d
|
||||
|
||||
# browse_py.h is used to inline browse.py.
|
||||
rule inline
|
||||
command = "$root/src/inline.sh" $varname < $in > $out
|
||||
description = INLINE $out
|
||||
|
||||
default foo bar
|
||||
default baz
|
||||
|
||||
include ninja1.ninja
|
||||
|
||||
subninja ninja2.ninja
|
||||
|
||||
pool link_pool
|
||||
depth = 4
|
||||
xxx = d
|
||||
|
||||
pool link_pool d
|
||||
depth = 4
|
||||
|
||||
build a.o: b a.c
|
||||
|
||||
build a.o|c: b a.c || a | b
|
||||
|
||||
build a.o | c : b a.c | a || b
|
||||
|
||||
build $a.o | $c : b $a.c | $a || $b
|
||||
|
||||
build 0: sleep README
|
||||
|
||||
build 1: sleep README
|
||||
|
||||
build all: phony 0 1
|
||||
deps = xxx
|
||||
CMD = cc
|
||||
build all: phony 0 1
|
||||
|
||||
build $builddir/browse_py.h: inline $root/src/browse.py | $root/src/inline.sh
|
||||
varname = kBrowsePy
|
||||
|
||||
build $builddir/subprocess-posix.o: cxx $root/src/subprocess-posix.cc
|
||||
build $builddir/libninja.a: ar $builddir/browse.o $builddir/build.o $
|
||||
$builddir/build_log.o $builddir/clean.o $builddir/debug_flags.o $
|
||||
$builddir/depfile_parser.o $builddir/deps_log.o
|
||||
|
||||
build $root/doc/manual.pdf: dblatex $builddir/manual.xml | $
|
||||
$root/doc/dblatex.xsl
|
||||
|
||||
build out: cat in |@ validate1 validate2 |@ validate1 | dep
|
||||
build out: cat in || dep |@ validate
|
||||
|
||||
builddir=/
|
||||
builddir =/
|
||||
builddir= /
|
||||
ldflags = -L$builddir
|
||||
|
||||
xx x
|
||||
|
||||
x = $a
|
||||
x = $-a_
|
||||
x = ${a}
|
||||
x = ${-a}
|
||||
x = $a@
|
||||
x = $@
|
||||
x = $$
|
||||
x = $:
|
||||
x = $ a
|
||||
x = $
|
||||
b
|
||||
x = $
|
||||
$
|
||||
a
|
||||
x = $
|
||||
$a
|
||||
x = $a a
|
||||
x = ${a} a
|
||||
x = $$ a
|
||||
x = $: a
|
||||
x = $! a
|
||||
x = ${a b ds
|
||||
x = a
|
||||
@@ -0,0 +1,73 @@
|
||||
; Test file, released under MIT License
|
||||
(ns ^{:doc "Syntax highlighting test file"
|
||||
:author "Markus Brenneis"}
|
||||
highlighting)
|
||||
|
||||
(defn something-else [f xs]
|
||||
#_(map #(apply f (% [%])) (cons 1 xs))
|
||||
(map #(apply f (% xs)) (cons 1 xs))
|
||||
#_[1 '(2)]
|
||||
xs)
|
||||
|
||||
(def foo [\a \b \n \ucafe \o123 \n
|
||||
\newline \tab \space \formfeed \backspace])
|
||||
|
||||
(def fizz {#{\a \b}
|
||||
#{\n \newline}})
|
||||
|
||||
(def fizz' #{{\a \b}
|
||||
{\n \newline}})
|
||||
|
||||
(defn bar [xs]
|
||||
(as-> xs <>
|
||||
(cons :a <>)
|
||||
(map #(%1 %2) <>) ; TODO improve
|
||||
(into <> [:konjure.logic.specs/numShips])))
|
||||
|
||||
(def x-2-y
|
||||
#_"do \" sth"
|
||||
(domonad set-m
|
||||
[x #{1.1, (+ -2 +4)}
|
||||
y #{1.1, (- -2.0 4.0)}]
|
||||
(*' x y)))
|
||||
|
||||
(def bases
|
||||
(and (= -1 -1N)
|
||||
(= 1/4 -2.5e-1)
|
||||
(= -1/2 -0.5M)
|
||||
(= -0x1Ab -0X1ab)
|
||||
(= +2r101010 25R1h)
|
||||
(= 39r13 42R10))) ; FIXME this one is not correct
|
||||
|
||||
(def ^{:private true}
|
||||
(= (last #{#{}}) #{{#{}}}))
|
||||
|
||||
(def s "#repl\n")
|
||||
(def r #"repl")
|
||||
|
||||
(defn- stuff!
|
||||
[a]
|
||||
"This is no \"documentation\"!"
|
||||
(= (class #'+) (class #'foo))
|
||||
(let [+ -] [(+ a 1) (@#'+ a 1)]))
|
||||
|
||||
(defn- throwIllegalArgumentException!
|
||||
"Throws an \"IllegalArgumentException\" or
|
||||
a js/Error."
|
||||
[message]
|
||||
#?(:clj (throw (IllegalArgumentException. message))
|
||||
:cljs (throw (js/Error. message))))
|
||||
|
||||
(defmacro let-fn "a nonsense macro" [one-binding & body]
|
||||
`(+ 1 ~(inc' 1))
|
||||
(let [[identifier & fn-body] one-binding]
|
||||
`(let [~identifier (fn ~identifier ~@fn-body)]
|
||||
~@body `a#)))
|
||||
|
||||
(def state (atom [(= false true) nil]))
|
||||
|
||||
(defn something-cool [] (first @state))
|
||||
|
||||
(defn- something-different [] (first (into @state [12])))
|
||||
|
||||
(defn- instance-getfield [this k] (@(.state this) k))
|
||||
@@ -0,0 +1,14 @@
|
||||
Source: libdemo
|
||||
Section: unknown
|
||||
Priority: extra
|
||||
Maintainer: Foo Bar <foo.bar@example.org>
|
||||
Build-Depends: debhelper (>=9)
|
||||
Standards-Version: 3.9.8
|
||||
Homepage: https://libdemo.example.org
|
||||
|
||||
Package: libdemo
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Demonstration library
|
||||
This library serves only the purpose of demonstration
|
||||
@@ -0,0 +1,203 @@
|
||||
<beginfold id='1'><#</beginfold id='1'>
|
||||
.SYNOPSIS
|
||||
Lorem ipsum dolor sit amet.
|
||||
|
||||
.DESCRIPTION
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
||||
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
|
||||
.PARAMETER InputPath
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
.parameter InputPath
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
bla .PARAMETER InputPath
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
.EXAMPLE
|
||||
PS> .\foo.ps1
|
||||
<endfold id='1'>#></endfold id='1'>
|
||||
|
||||
<beginfold id='2'>@"</beginfold id='2'> multi
|
||||
line
|
||||
string
|
||||
$x
|
||||
"'
|
||||
\n
|
||||
"@
|
||||
<endfold id='2'>"@</endfold id='2'>
|
||||
|
||||
<beginfold id='2'>@'</beginfold id='2'> multi
|
||||
line
|
||||
string
|
||||
$x
|
||||
"'
|
||||
\n
|
||||
'@
|
||||
<endfold id='2'>'@</endfold id='2'>
|
||||
|
||||
$foo = "Test `u{2013} String`nwith `"escapes`" """
|
||||
$foo = "Test `u{2013} String`nwith `"escapes`" `
|
||||
dssad"
|
||||
$foo = 'bla bla''bla bla $x `n'
|
||||
$Global:HOME = "abc"
|
||||
|
||||
[bool]::Parse('false')
|
||||
|
||||
echo [bool]::Parse('false')
|
||||
echo $env:EDITOR ${env:EDITOR} $foo ${foo} $foo-bar ${foo-bar} ${a b
|
||||
c}
|
||||
echo "hashtable: $(@<beginfold id='3'>{</beginfold id='3'> key = 'value' <endfold id='3'>}</endfold id='3'>)"
|
||||
echo 122.42kb 332.d 23d 625 3232e+2 0x233 0b1101
|
||||
echo 0xaj 0b1112 123a
|
||||
|
||||
docker run -dp 3000:3000 `
|
||||
-w /app -v "$(pwd):/app" `
|
||||
--network todo-app `
|
||||
-e MYSQL_HOST=mysql `
|
||||
-e MYSQL_USER=root `
|
||||
-e MYSQL_PASSWORD=secret `
|
||||
-e MYSQL_DB=todos `
|
||||
node:12-alpine `
|
||||
cmd "npm install && npm run start"
|
||||
|
||||
|
||||
function Get-NewPix
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
$start = Get-Date -Month 1 -Day 1 -Year 2010
|
||||
$allpix = Get-ChildItem -Path $env:UserProfile\*.jpg -Recurse
|
||||
$allpix | Where-Object <beginfold id='3'>{</beginfold id='3'>$_.LastWriteTime -gt $Start<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
function Get-SmallFiles <beginfold id='3'>{</beginfold id='3'>
|
||||
Param($Size)
|
||||
Get-ChildItem $HOME | Where-Object <beginfold id='3'>{</beginfold id='3'>
|
||||
$_.Length -lt $Size -and !$_.PSIsContainer
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
function Get-EscapedPath
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
param(
|
||||
[Parameter(
|
||||
Position=0,
|
||||
Mandatory=$true
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true)
|
||||
]
|
||||
[string]$path
|
||||
)
|
||||
|
||||
process <beginfold id='3'>{</beginfold id='3'>
|
||||
if ($path.Contains(' '))
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
return '"' + $path + '"'
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
return $path
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
<beginfold id='1'><#</beginfold id='1'>
|
||||
Copied from Craft for testing syntax highlighting
|
||||
<endfold id='1'>#></endfold id='1'>
|
||||
|
||||
# this file sets some environment variables that are needed
|
||||
# for finding programs and libraries etc.
|
||||
# by Hannah von Reth <vonreth@kde.org>
|
||||
# you should copy kdesettings.ini to ..\etc\kdesettings.ini
|
||||
# and adapt it to your needs (see that file for more info)
|
||||
|
||||
# this file should contain all path settings - and provide thus an environment
|
||||
# to build and run kde programs
|
||||
# based on kdeenv.bat
|
||||
|
||||
cls
|
||||
|
||||
|
||||
$env:CraftRoot=[System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition)
|
||||
|
||||
$CRAFT_ARGUMENTS = $args
|
||||
|
||||
&<beginfold id='3'>{</beginfold id='3'>
|
||||
[version]$minPythonVersion = 3.6
|
||||
|
||||
function findPython([string] $name)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
$py = (Get-Command $name -ErrorAction SilentlyContinue)
|
||||
if ($py -and ($py | Get-Member Version) -and $py.Version -ge $minPythonVersion) <beginfold id='3'>{</beginfold id='3'>
|
||||
$env:CRAFT_PYTHON=$py.Source
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
findPython("python3")
|
||||
findPython("python")
|
||||
|
||||
function readINI([string] $fileName)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
$ini = @<beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>
|
||||
|
||||
switch -regex -file $fileName <beginfold id='3'>{</beginfold id='3'>
|
||||
"^\[(.+)\]$" <beginfold id='3'>{</beginfold id='3'>
|
||||
$section = $matches[1].Trim()
|
||||
$ini[$section] = @<beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
"^\s*([^#].+?)\s*=\s*(.*)" <beginfold id='3'>{</beginfold id='3'>
|
||||
$name,$value = $matches[1..2]
|
||||
$ini[$section][$name] = $value.Trim()
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
$ini
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
|
||||
|
||||
if(test-path -path $env:CraftRoot\..\etc\kdesettings.ini)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
$settings = readINI $env:CraftRoot\..\etc\kdesettings.ini
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
else
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
Write-Error("$env:CraftRoot\..\etc\kdesettings.ini Does not exist")
|
||||
break
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
if( $CRAFT_ARGUMENTS[0] -eq "--get")
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
Write-Host($settings[$CRAFT_ARGUMENTS[1]][$CRAFT_ARGUMENTS[2]])
|
||||
break
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
|
||||
function prependPATH([string] $path)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
$env:PATH="$path{0}$env:PATH" -f [IO.Path]::PathSeparator
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
if( -Not $env:CRAFT_PYTHON)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
prependPATH $settings["Paths"]["Python"]
|
||||
$env:CRAFT_PYTHON=[IO.PATH]::COMBINE($settings["Paths"]["Python"], "python")
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
(& $env:CRAFT_PYTHON ([IO.PATH]::COMBINE("$env:CraftRoot", "bin", "CraftSetupHelper.py")) "--setup") |
|
||||
foreach <beginfold id='3'>{</beginfold id='3'>
|
||||
if ($_ -match "=") <beginfold id='3'>{</beginfold id='3'>
|
||||
$v = $_.split("=")
|
||||
set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
|
||||
#Write-Host("$v[0]=$v[1]")
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
cd "$env:KDEROOT"
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
|
||||
function Global:craft() <beginfold id='3'>{</beginfold id='3'>
|
||||
return & $env:CRAFT_PYTHON ([IO.PATH]::COMBINE("$env:CraftRoot", "bin", "craft.py")) $args
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
|
||||
if($args.Length -ne 0)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
invoke-expression -command "$args"
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
@@ -0,0 +1,38 @@
|
||||
// this is a single-line comment
|
||||
// NOTE ### FIXME TODO
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> this is a
|
||||
multi-line comment
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> this is another
|
||||
* multiline comment
|
||||
* NOTE ### FIXME TODO
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='2'>/** </beginfold id='2'>this is another
|
||||
* multiline comment
|
||||
* NOTE ### FIXME TODO
|
||||
<endfold id='2'>*/</endfold id='2'>
|
||||
|
||||
// simple assignment
|
||||
var i = 5;
|
||||
|
||||
var j = // assignment missing, still should be nice highlighting
|
||||
var k // assignment missing, still should be nice highlighting
|
||||
|
||||
// test a string
|
||||
var s = "Hello World!";
|
||||
|
||||
// arr is an array
|
||||
var arr = new[] <beginfold id='3'>{</beginfold id='3'> 0, 1, 2, 3, 4 <endfold id='3'>}</endfold id='3'>;
|
||||
|
||||
// expr is compiled as IEnumerable<Customer>
|
||||
// or perhaps IQueryable<Customer>
|
||||
var expr =
|
||||
from c in customers
|
||||
where c.City == "London"
|
||||
select c;
|
||||
|
||||
// compiled anonymous type
|
||||
var anon = new <beginfold id='3'>{</beginfold id='3'> Country = "Germany", Inhabitants = 80000000 <endfold id='3'>}</endfold id='3'>;
|
||||
@@ -0,0 +1,33 @@
|
||||
# cube.obj
|
||||
#
|
||||
|
||||
g cube
|
||||
|
||||
v 0.0 0.0 0.0
|
||||
v 0.0 0.0 1.0
|
||||
v 0.0 1.0 0.0
|
||||
v 0.0 1.0 1.0
|
||||
v 1.0 0.0 0.0
|
||||
v 1.0 0.0 1.0
|
||||
v 1.0 1.0 0.0
|
||||
v 1.0 1.0 1.0
|
||||
|
||||
vn 0.0 0.0 1.0
|
||||
vn 0.0 0.0 -1.0
|
||||
vn 0.0 1.0 0.0
|
||||
vn 0.0 -1.0 0.0
|
||||
vn 1.0 0.0 0.0
|
||||
vn -1.0 0.0 0.0
|
||||
|
||||
f 1//2 7//2 5//2
|
||||
f 1//2 3//2 7//2
|
||||
f 1//6 4//6 3//6
|
||||
f 1//6 2//6 4//6
|
||||
f 3//3 8//3 7//3
|
||||
f 3//3 4//3 8//3
|
||||
f 5//5 7//5 8//5
|
||||
f 5//5 8//5 6//5
|
||||
f 1//4 5//4 6//4
|
||||
f 1//4 6//4 2//4
|
||||
f 2//1 6//1 8//1
|
||||
f 2//1 8//1 4//1
|
||||
@@ -0,0 +1,26 @@
|
||||
error before header
|
||||
|
||||
ply
|
||||
format ascii 1.0
|
||||
comment TODO this is a comment
|
||||
element vertex 8
|
||||
property float x
|
||||
property float y
|
||||
property float z
|
||||
element face 6
|
||||
property list uint int vertex_indices
|
||||
end_header
|
||||
-1 -1 -1
|
||||
1 -1 -1
|
||||
1 1 -1
|
||||
-1 1 -1
|
||||
-1 -1 1
|
||||
1 -1 1
|
||||
1 1 1
|
||||
-1 1 1
|
||||
4 0 1 2 3
|
||||
4 5 4 7 6
|
||||
4 6 2 1 5
|
||||
4 3 7 4 0
|
||||
4 7 3 2 6
|
||||
4 5 1 0 4
|
||||
@@ -0,0 +1,30 @@
|
||||
solid cube_corner
|
||||
facet normal 0.0 -1.0 0.0
|
||||
outer loop
|
||||
vertex 0.0 0.0 0.0
|
||||
vertex 1.0 0.0 0.0
|
||||
vertex 0.0 0.0 1.0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.0 0.0 -1.0
|
||||
outer loop
|
||||
vertex 0.0 0.0 0.0
|
||||
vertex 0.0 1.0 0.0
|
||||
vertex 1.0 0.0 0.0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1.0 0.0 0.0
|
||||
outer loop
|
||||
vertex 0.0 0.0 0.0
|
||||
vertex 0.0 0.0 1.0
|
||||
vertex 0.0 1.0 0.0
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.577 0.577 0.577
|
||||
outer loop
|
||||
vertex 1.0 0.0 0.0
|
||||
vertex 0.0 1.0 0.0
|
||||
vertex 0.0 0.0 1.0
|
||||
endloop
|
||||
endfacet
|
||||
endsolid
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
normal X:string other: normal X:string other: normal
|
||||
normal X{string other} normal X:string other: normal
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
# Highlight words
|
||||
word1
|
||||
_word2
|
||||
/word3
|
||||
word4+
|
||||
<word5>
|
||||
&
|
||||
;;;
|
||||
w w-word8-
|
||||
|
||||
normal word1
|
||||
normal _word2
|
||||
normal /word3
|
||||
normal word4+
|
||||
normal <word5>
|
||||
normal &
|
||||
normal ;;;
|
||||
normal w w-word8-
|
||||
|
||||
....word1....
|
||||
...._word2....
|
||||
..../word3....
|
||||
....word4+....
|
||||
....<word5>....
|
||||
....&....
|
||||
....;;;....
|
||||
....w w-word8-....
|
||||
|
||||
normal_word2 <-- _word2
|
||||
normal/word3 <-- /word3
|
||||
word4+normal <-- word4+
|
||||
normal<word5>normal <-- <word5>
|
||||
normal&normal <-- &
|
||||
normal;;;normal <-- ;;;
|
||||
w w-word8-normal <-- w w-word8-
|
||||
|
||||
aaa_word2_aaa <-- _word2
|
||||
aaa/word3/aaa <-- /word3
|
||||
aaa+word4+aaa <-- word4+
|
||||
aaa-w w-word8-aaa <-- w w-word8-
|
||||
|
||||
# Normal text
|
||||
aaaword1aaa
|
||||
aaa_word2aaa
|
||||
aaa/word3aaa
|
||||
aaaword4+aaa
|
||||
aaaw w-word8-aaa
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
#
|
||||
# Copyright (c) 2016-2018 Varnish Cache project
|
||||
# Copyright (c) 2012-2016 Varnish Software AS
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# detectdevice.vcl - regex based device detection for Varnish
|
||||
# https://github.com/varnishcache/varnish-devicedetect/
|
||||
#
|
||||
# Original author: Lasse Karstensen <lkarsten@varnish-software.com>
|
||||
|
||||
sub devicedetect <beginfold id='1'>{</beginfold id='1'>
|
||||
unset req.http.X-UA-Device;
|
||||
set req.http.X-UA-Device = "pc";
|
||||
|
||||
# Handle that a cookie may override the detection alltogether.
|
||||
if <beginfold id='2'>(</beginfold id='2'>req.http.Cookie ~ "(?i)X-UA-Device-force"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'>
|
||||
<beginfold id='4'>/*</beginfold id='4'> ;?? means zero or one ;, non-greedy to match the first. <endfold id='4'>*/</endfold id='4'>
|
||||
set req.http.X-UA-Device = regsub(req.http.Cookie, "(?i).*X-UA-Device-force=([^;]+);??.*", "\1");
|
||||
<beginfold id='4'>/*</beginfold id='4'> Clean up our mess in the cookie header <endfold id='4'>*/</endfold id='4'>
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *X-UA-Device-force=[^;]+;? *", "\1");
|
||||
<beginfold id='4'>/*</beginfold id='4'> If the cookie header is now empty, or just whitespace, unset it. <endfold id='4'>*/</endfold id='4'>
|
||||
if <beginfold id='2'>(</beginfold id='2'>req.http.Cookie ~ "^ *$"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> unset req.http.Cookie; <endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'> else <beginfold id='3'>{</beginfold id='3'>
|
||||
if <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "\(compatible; Googlebot-Mobile/2.1; \+http://www.google.com/bot.html\)" ||
|
||||
<beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(Android|iPhone)" && req.http.User-Agent ~ "\(compatible.?; Googlebot/2.1.?; \+http://www.google.com/bot.html"<endfold id='2'>)</endfold id='2'> ||
|
||||
<beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(iPhone|Windows Phone)" && req.http.User-Agent ~ "\(compatible; bingbot/2.0; \+http://www.bing.com/bingbot.htm"<endfold id='2'>)</endfold id='2'><endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'>
|
||||
set req.http.X-UA-Device = "mobile-bot"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(?i)(ads|google|bing|msn|yandex|baidu|ro|career|seznam|)bot" ||
|
||||
req.http.User-Agent ~ "(?i)(baidu|jike|symantec)spider" ||
|
||||
req.http.User-Agent ~ "(?i)pingdom" ||
|
||||
req.http.User-Agent ~ "(?i)facebookexternalhit" ||
|
||||
req.http.User-Agent ~ "(?i)scanner" ||
|
||||
req.http.User-Agent ~ "(?i)slurp" ||
|
||||
req.http.User-Agent ~ "(?i)(web)crawler"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'>
|
||||
set req.http.X-UA-Device = "bot"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(?i)ipad"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "tablet-ipad"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(?i)ip(hone|od)"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "mobile-iphone"; <endfold id='3'>}</endfold id='3'>
|
||||
<beginfold id='4'>/*</beginfold id='4'> how do we differ between an android phone and an android tablet?
|
||||
http://stackoverflow.com/questions/5341637/how-do-detect-android-tablets-in-general-useragent <endfold id='4'>*/</endfold id='4'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(?i)android.*(mobile|mini)"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "mobile-android"; <endfold id='3'>}</endfold id='3'>
|
||||
// android 3/honeycomb was just about tablet-only, and any phones will probably handle a bigger page layout.
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(?i)android 3"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "tablet-android"; <endfold id='3'>}</endfold id='3'>
|
||||
<beginfold id='4'>/*</beginfold id='4'> Opera Mobile <endfold id='4'>*/</endfold id='4'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "Opera Mobi"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "mobile-smartphone"; <endfold id='3'>}</endfold id='3'>
|
||||
// May very well give false positives towards android tablets. Suggestions welcome.
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(?i)android"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "tablet-android"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "PlayBook; U; RIM Tablet"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "tablet-rim"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "hp-tablet.*TouchPad"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "tablet-hp"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "Kindle/3"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "tablet-kindle"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "Touch.+Tablet PC" ||
|
||||
req.http.User-Agent ~ "Windows NT [0-9.]+; ARM;" <endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'>
|
||||
set req.http.X-UA-Device = "tablet-microsoft";
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "Mobile.+Firefox"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'> set req.http.X-UA-Device = "mobile-firefoxos"; <endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "^HTC" ||
|
||||
req.http.User-Agent ~ "Fennec" ||
|
||||
req.http.User-Agent ~ "IEMobile" ||
|
||||
req.http.User-Agent ~ "BlackBerry" ||
|
||||
req.http.User-Agent ~ "BB10.*Mobile" ||
|
||||
req.http.User-Agent ~ "GT-.*Build/GINGERBREAD" ||
|
||||
req.http.User-Agent ~ "SymbianOS.*AppleWebKit"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'>
|
||||
set req.http.X-UA-Device = "mobile-smartphone";
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
elsif <beginfold id='2'>(</beginfold id='2'>req.http.User-Agent ~ "(?i)symbian" ||
|
||||
req.http.User-Agent ~ "(?i)^sonyericsson" ||
|
||||
req.http.User-Agent ~ "(?i)^nokia" ||
|
||||
req.http.User-Agent ~ "(?i)^samsung" ||
|
||||
req.http.User-Agent ~ "(?i)^lg" ||
|
||||
req.http.User-Agent ~ "(?i)bada" ||
|
||||
req.http.User-Agent ~ "(?i)blazer" ||
|
||||
req.http.User-Agent ~ "(?i)cellphone" ||
|
||||
req.http.User-Agent ~ "(?i)iemobile" ||
|
||||
req.http.User-Agent ~ "(?i)midp-2.0" ||
|
||||
req.http.User-Agent ~ "(?i)u990" ||
|
||||
req.http.User-Agent ~ "(?i)netfront" ||
|
||||
req.http.User-Agent ~ "(?i)opera mini" ||
|
||||
req.http.User-Agent ~ "(?i)palm" ||
|
||||
req.http.User-Agent ~ "(?i)nintendo wii" ||
|
||||
req.http.User-Agent ~ "(?i)playstation portable" ||
|
||||
req.http.User-Agent ~ "(?i)portalmmm" ||
|
||||
req.http.User-Agent ~ "(?i)proxinet" ||
|
||||
req.http.User-Agent ~ "(?i)windows\ ?ce" ||
|
||||
req.http.User-Agent ~ "(?i)winwap" ||
|
||||
req.http.User-Agent ~ "(?i)eudoraweb" ||
|
||||
req.http.User-Agent ~ "(?i)htc" ||
|
||||
req.http.User-Agent ~ "(?i)240x320" ||
|
||||
req.http.User-Agent ~ "(?i)avantgo"<endfold id='2'>)</endfold id='2'> <beginfold id='3'>{</beginfold id='3'>
|
||||
set req.http.X-UA-Device = "mobile-generic";
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
@@ -0,0 +1,68 @@
|
||||
<beginfold id='1'>---</beginfold id='1'>
|
||||
title: <beginfold id='2'>"</beginfold id='2'>test<endfold id='2'>"</endfold id='2'>
|
||||
author: <beginfold id='2'>"</beginfold id='2'>me<endfold id='2'>"</endfold id='2'>
|
||||
date: <beginfold id='2'>"</beginfold id='2'>07.10.2014<endfold id='2'>"</endfold id='2'>
|
||||
output: html_document
|
||||
<endfold id='1'>---</endfold id='1'>
|
||||
|
||||
This is a simple test document. It shows syntax highlighting switches between YAML (above), R blocks
|
||||
<beginfold id='3'>```{r, echo=FALSE}</beginfold id='3'>
|
||||
for (i in 1:10) <beginfold id='4'>{</beginfold id='4'>
|
||||
if(i>=10) print(i)
|
||||
<endfold id='4'>}</endfold id='4'>
|
||||
# two blank lines below
|
||||
|
||||
sessionInfo()
|
||||
<endfold id='3'>```</endfold id='3'>
|
||||
|
||||
LaTeX equations,
|
||||
<beginfold id='5'>$$</beginfold id='5'>
|
||||
h_{i}(t \mid q,C) = h_{0}(t) e^{\beta_{1}quality_{i} + \beta_{2}C_{iq}}
|
||||
<endfold id='5'>$$</endfold id='5'>
|
||||
|
||||
and Markdown. A [link](http://example.com) in Markdown.
|
||||
|
||||
Inline `r y <- 5 + x - sin(3)` R code.
|
||||
Inline `y <- 5 + x - sin(3)` code.
|
||||
|
||||
|
||||
Heading
|
||||
=======
|
||||
|
||||
Sub-heading
|
||||
-----------
|
||||
A list of editors:
|
||||
* kate
|
||||
* vim
|
||||
* emacs
|
||||
|
||||
*italic*, **bold**, `monospace`
|
||||
|
||||
code block
|
||||
more code
|
||||
|
||||
normal text
|
||||
normal text
|
||||
normal text
|
||||
|
||||
1. item
|
||||
* This is a list item
|
||||
with multiple lines.
|
||||
|
||||
<beginfold id='3'>```{r pressure, echo=FALSE}</beginfold id='3'>
|
||||
plot(pressure)
|
||||
<endfold id='3'>```</endfold id='3'>
|
||||
|
||||
> This is a
|
||||
blockquote `r cos(33) `
|
||||
|
||||
This is a new paragraph, which
|
||||
is part of this <beginfold id='5'>$$</beginfold id='5'> \text{item} <endfold id='5'>$$</endfold id='5'>.
|
||||
|
||||
indented code block
|
||||
|
||||
Other paragraph.
|
||||
|
||||
* subitem
|
||||
* subitem
|
||||
<beginfold id='5'>$$</beginfold id='5'> A = B + C <endfold id='5'>$$</endfold id='5'>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
keyword
|
||||
{keyword}
|
||||
`keyword`
|
||||
'keyword'
|
||||
@@ -0,0 +1,9 @@
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# Use 'blkid' to print the universally unique identifier for a device; this may
|
||||
# be used with UUID= as a more robust way to name devices that works even if
|
||||
# disks are added and removed. See fstab(5).
|
||||
#
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
UUID=A7EF-407D /boot/efi vfat umask=0077 0 2
|
||||
/dev/mapper/luks-6d67ccaf-3e9a-44fb-8e51-f38175256a87 / ext4 defaults,noatime 0 1
|
||||
@@ -0,0 +1,58 @@
|
||||
pick 318aceb Add test for Makefile highlighting
|
||||
p 4c7182a Add first batch of test files resurrected from Kate 4.6
|
||||
r 6f7d8a7 Sync xml files with KTextEditor
|
||||
reword 8f0dbdc Add another batch of resurrected tests from Kate 4.6
|
||||
e 828de45 Add some more resurrected tests from Kate 4.6
|
||||
edit 6aa6264 Add simple coverage information for syntax definition tests
|
||||
s 63df253 Add more syntax highlighting tests from Kate 4.6
|
||||
squash 3e7771f Add three more tests recovered from Kate 4.6
|
||||
f 5c7fd91 Add Kate 4.6 ASP syntax test
|
||||
f -c 5c7fd91 Add Kate 4.6 ASP syntax test
|
||||
fixup 7a777ff Implement case-sensitive overrides for keyword rules
|
||||
fixup -C 7a777ff Implement case-sensitive overrides for keyword rules
|
||||
exec 2b16665 Implement dynamic DetectChar rules
|
||||
x 0b703a3 Add a few more tests from the Kate 4.6 test suite
|
||||
d dd808dc Quote captured strings we replace in regular expressions
|
||||
drop dd808dc Quote captured strings we replace in regular expressions
|
||||
b afafafaffa
|
||||
break afafafaffa
|
||||
l label
|
||||
label afafafaffa
|
||||
t label
|
||||
reset afafafaffa
|
||||
m label # bla bla bla
|
||||
merge -c afafafaffa label
|
||||
u ref
|
||||
update-ref ref
|
||||
|
||||
# Rebase a27a854..0b703a3 onto a27a854 (13 command(s))
|
||||
#
|
||||
# Commands:
|
||||
# p, pick <commit> = use commit
|
||||
# r, reword <commit> = use commit, but edit the commit message
|
||||
# e, edit <commit> = use commit, but stop for amending
|
||||
# s, squash <commit> = use commit, but meld into previous commit
|
||||
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
|
||||
# commit's log message, unless -C is used, in which case
|
||||
# keep only this commit's message; -c is same as -C but
|
||||
# opens the editor
|
||||
# x, exec <command> = run command (the rest of the line) using shell
|
||||
# b, break = stop here (continue rebase later with 'git rebase --continue')
|
||||
# d, drop <commit> = remove commit
|
||||
# l, label <label> = label current HEAD with a name
|
||||
# t, reset <label> = reset HEAD to a label
|
||||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
|
||||
# create a merge commit using the original merge commit's
|
||||
# message (or the oneline, if no original merge commit was
|
||||
# specified); use -c <commit> to reword the commit message
|
||||
# u, update-ref <ref> = track a placeholder for the <ref> to be updated
|
||||
# to this position in the new commits. The <ref> is
|
||||
# updated at the end of the rebase
|
||||
#
|
||||
# These lines can be re-ordered; they are executed from top to bottom.
|
||||
#
|
||||
# If you remove a line here THAT COMMIT WILL BE LOST.
|
||||
#
|
||||
# However, if you remove everything, the rebase will be aborted.
|
||||
#
|
||||
# Note that empty commits are commented out
|
||||
@@ -0,0 +1,16 @@
|
||||
# Example gitolite.conf
|
||||
|
||||
include "mygroups.conf"
|
||||
|
||||
@admin = user1 user2
|
||||
@admin = user3@domain.com
|
||||
|
||||
repo @all
|
||||
option deny-rules = 1
|
||||
option hooks.emailprefix = '[%GL_REPO] '
|
||||
|
||||
repo myrepo
|
||||
- protected$ = @all # Nobody can push
|
||||
RW+CD = @admin
|
||||
RW = @group1
|
||||
R = user3@domain.com
|
||||
@@ -0,0 +1,131 @@
|
||||
## R Script Sample File
|
||||
## Source: http://www.rexamples.com
|
||||
|
||||
## Basics
|
||||
a <- 42.24
|
||||
a <- 42i
|
||||
a <- 42L
|
||||
a <- 42
|
||||
A <- a * 2 # R is case sensitive
|
||||
print(a)
|
||||
cat(A, "\n") # "84" is concatenated with "\n"
|
||||
if(A>a) # true, 84 > 42
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
cat(A, ">", a, "\n")
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
## Functions
|
||||
Square <- function(x) <beginfold id='1'>{</beginfold id='1'>
|
||||
return(x^2)
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
print(Square(4))
|
||||
print(Square(x=4)) # same thing
|
||||
|
||||
DoSomething(color="red",number=55)
|
||||
|
||||
## Countdown
|
||||
countdown <- function(from)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
print(from)
|
||||
while(from!=0)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
Sys.sleep(1)
|
||||
from <- from - 1
|
||||
print(from)
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
countdown(5)
|
||||
|
||||
## Reading user input
|
||||
readinteger <- function()
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
n <- readline(prompt="Enter an integer: ")
|
||||
n <- as.integer(n)
|
||||
if (is.na(n))<beginfold id='1'>{</beginfold id='1'>
|
||||
n <- readinteger()
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
return(n)
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
print(readinteger())
|
||||
|
||||
readinteger <- function()
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
n <- readline(prompt="Enter an integer: ")
|
||||
if(!grepl("^[0-9]+$",n))
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
return(readinteger())
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
return(as.integer(n))
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
print(readinteger())
|
||||
|
||||
## Guess a random number game
|
||||
readinteger <- function()
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
n <- readline(prompt="Enter an integer: ")
|
||||
if(!grepl("^[0-9]+$",n))
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
return(readinteger())
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
return(as.integer(n))
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
# real program start here
|
||||
|
||||
num <- round(runif(1) * 100, digits = 0)
|
||||
guess <- -1
|
||||
|
||||
cat("Guess a number between 0 and 100.\n")
|
||||
|
||||
while(guess != num)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
guess <- readinteger()
|
||||
if (guess == num)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
cat("Congratulations,", num, "is right.\n")
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
else if (guess < num)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
cat("It's bigger!\n")
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
else if(guess > num)
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
cat("It's smaller!\n")
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
## Lists
|
||||
sum(0:9)
|
||||
append(LETTERS[1:13],letters[14:26])
|
||||
c(1,6,4,9)*2
|
||||
something <- c(1,4,letters[2]) # indices start at one, you get (1,4,"b")
|
||||
length(something)
|
||||
|
||||
## margrittr's pipe
|
||||
diamonds %>%
|
||||
filter(price > 1000) %>%
|
||||
group_by(cut) %>%
|
||||
tally() %>%
|
||||
rename(tally = n) %>%
|
||||
arrange(-tally) %>%
|
||||
mutate(pct = tally / sum(tally)) -> df
|
||||
|
||||
## R native pipes (R > 4.1)
|
||||
Sys.setenv("_R_USE_PIPEBIND_"= TRUE)
|
||||
mtcars |> x => lm(mpg ~ cyl, data = x)
|
||||
|
||||
## ggplot2
|
||||
plot = ggplot(diamonds, aes(x = price, y = carat)) +
|
||||
geom_point(alpha = 0.3, colour = 'steelblue') +
|
||||
labs(
|
||||
title = "ggplot diamonds",
|
||||
x = "Price, $",
|
||||
y = "Carat"
|
||||
) +
|
||||
facet_wrap(~ cut) +
|
||||
theme_minimal()
|
||||
|
||||
plot + coord_flip()
|
||||
@@ -0,0 +1,43 @@
|
||||
-- Test file for kate's syntax highlighting
|
||||
Title "Test file";
|
||||
|
||||
<beginfold id='1'>-- BEGIN region (a region marker region) :)</beginfold id='1'>
|
||||
|
||||
% multiline comment
|
||||
goes on here %
|
||||
|
||||
<endfold id='1'>-- END</endfold id='1'>
|
||||
|
||||
FUNCTION FCT <beginfold id='2'>(</beginfold id='2'>Clk, Key<endfold id='2'>)</endfold id='2'> RETURNS <beginfold id='2'>(</beginfold id='2'>pulse<endfold id='2'>)</endfold id='2'>;
|
||||
|
||||
SUBDESIGN CDCLOCK2
|
||||
<beginfold id='2'>(</beginfold id='2'>
|
||||
in : INPUT; -- go in
|
||||
out[3..0] : OUTPUT; -- come out
|
||||
<endfold id='2'>)</endfold id='2'>
|
||||
|
||||
VARIABLE
|
||||
start : soft;
|
||||
usec[3..0] : node;
|
||||
|
||||
<beginfold id='3'>BEGIN</beginfold id='3'>
|
||||
|
||||
in = FCT<beginfold id='2'>(</beginfold id='2'>clock, some_key<endfold id='2'>)</endfold id='2'>; -- senseless code
|
||||
|
||||
-- comment
|
||||
blubb = <beginfold id='2'>(</beginfold id='2'>blobb[] == H"3ff"<endfold id='2'>)</endfold id='2'>;
|
||||
|
||||
<beginfold id='4'>IF</beginfold id='4'> in THEN asdf
|
||||
-- folde me
|
||||
<endfold id='4'>END IF</endfold id='4'>;
|
||||
|
||||
<beginfold id='5'>TABLE</beginfold id='5'>
|
||||
-- missing code
|
||||
<endfold id='5'>END TABLE</endfold id='5'>
|
||||
|
||||
|
||||
<endfold id='3'>END</endfold id='3'>;
|
||||
|
||||
-- hex, octal, binary
|
||||
H"0" => B"1000000";
|
||||
O"01234567";
|
||||
@@ -0,0 +1,604 @@
|
||||
^j:: ; hotkey label
|
||||
::ftw::Free the whales ; hotstring label abbreviation
|
||||
::btw:: ; hotstring label action
|
||||
MsgBox, You typed btw.
|
||||
Run, notepad.exe ; Run Notepad when you press CTRL+N.
|
||||
MsgBox, Wow!
|
||||
MsgBox, There are
|
||||
Run, notepad.exe
|
||||
WinActivate, Untitled - Notepad
|
||||
WinWaitActive, Untitled - Notepad
|
||||
Send, 7 lines{!}{Enter}
|
||||
SendInput, inside the CTRL{+}J hotkey.
|
||||
return
|
||||
|
||||
Numpad0 & Numpad1::
|
||||
MsgBox, You pressed Numpad1 while holding down Numpad0.
|
||||
Run, notepad.exe
|
||||
return
|
||||
|
||||
; Untitled - Notepad
|
||||
#IfWinActive Untitled - Notepad
|
||||
!q::
|
||||
MsgBox, You pressed ALT+Q in Notepad.
|
||||
return
|
||||
|
||||
; Any window that isn't Untitled - Notepad
|
||||
#IfWinActive
|
||||
!q::
|
||||
MsgBox, You pressed ALT+Q in any window.
|
||||
return
|
||||
|
||||
; Retrieve the ID/HWND of the active window
|
||||
id := WinExist("A")
|
||||
MsgBox % id
|
||||
|
||||
; Press Win+↑ to maximize the active window
|
||||
#Up::WinMaximize, A
|
||||
|
||||
#i::
|
||||
Run, https://www.google.com/
|
||||
return
|
||||
|
||||
^p::
|
||||
Run, notepad.exe
|
||||
return
|
||||
|
||||
~j::
|
||||
Send, ack
|
||||
return
|
||||
|
||||
:*:acheiv::achiev
|
||||
::achievment::achievement
|
||||
::acquaintence::acquaintance
|
||||
:*:adquir::acquir
|
||||
::aquisition::acquisition
|
||||
:*:agravat::aggravat
|
||||
:*:allign::align
|
||||
::ameria::America
|
||||
:*:ftw::Free the whales ; Hotstring modifiers
|
||||
this_is_a_label: ; label
|
||||
|
||||
#IfWinActive Untitled - Notepad
|
||||
#Space::
|
||||
MsgBox, You pressed WIN+SPACE in Notepad.
|
||||
return
|
||||
|
||||
Send, {Ctrl down}c{Ctrl up}
|
||||
SendInput, [b]{Ctrl down}v{Ctrl up}[/b]
|
||||
return ; This ends the hotkey. The code below this point will not get triggered.
|
||||
|
||||
Send, This text has been typed{!}
|
||||
Send, {a} ; WRONG
|
||||
Send, {a}{b}{c} ; WRONG
|
||||
Send, {abc} ; WRONG
|
||||
Send, abc ; CORRECT
|
||||
Send, ^s ; Both of these send CTRL+S
|
||||
Send, {Ctrl down}s{Ctrl up} ; Both of these send CTRL+S
|
||||
Send, {Ctrl down}c{Ctrl up}
|
||||
Send, {b down}{b up}
|
||||
Send, {Tab down}{Tab up}
|
||||
Send, {Up down} ; Press down the up-arrow key.
|
||||
Sleep, 1000 ; Keep it down for one second.
|
||||
Send, {Up up} ; Release the up-arrow key.
|
||||
|
||||
Send,
|
||||
<beginfold id='1'>(</beginfold id='1'>
|
||||
Line 1
|
||||
Line 2
|
||||
Apples are a fruit.
|
||||
<endfold id='1'>)</endfold id='1'>
|
||||
|
||||
Send %A_Hour%
|
||||
SubStr(37 * 12, 1, 2)
|
||||
SubStr(A_Hour - 12, 2)
|
||||
SubStr(A_AhkPath, InStr(A_AhkPath, "AutoHotkey"))
|
||||
SubStr("I'm scripting, awesome!", 16)
|
||||
|
||||
SetTitleMatchMode RegEx
|
||||
WinActivate ahk_exe i)\\notepad\.exe$ ; Match the name part of the full path.
|
||||
WinActivate ahk_exe im)(*BSR_ANYCRLF)abc\Rxyz
|
||||
WinActivate ahk_exe im)(*BSR_ANY[^]]CRLF)abc\Rxyz
|
||||
|
||||
if (MyVar = 5)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox, MyVar equals %MyVar%!!
|
||||
ExitApp
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
MyVar = Text
|
||||
MyVar = %MyVar2%
|
||||
MyVar = %MyVar2% some text %MyVar3%.
|
||||
MyVar := SubStr("I'm scripting, awesome!", 16)
|
||||
MyVar := "Text"
|
||||
MyVar := MyVar2
|
||||
MyVar := 6 + 8 / 3 * 2 - Sqrt(9)
|
||||
MyVar := "The value of 5 + " MyVar2 " is: " 5 + MyVar2
|
||||
if (Var1 != Var2)
|
||||
Var1 := Var2 + 100
|
||||
|
||||
; Some examples showing when to use percents and when not:
|
||||
Var = Text ; Assign some text to a variable (legacy).
|
||||
Number := 6 ; Assign a number to a variable (expression).
|
||||
Var2 = %Var% ; Assign a variable to another (legacy).
|
||||
Var3 := Var ; Assign a variable to another (expression).
|
||||
Var4 .= Var ; Append a variable to the end of another (expression).
|
||||
Var5 += Var ; Add the value of a variable to another (expression).
|
||||
Var5 -= Var ; Subtract the value of a variable from another (expression).
|
||||
Var6 := SubStr(Var, 2, 2) ; Variable inside a function. This is always an expression.
|
||||
Var7 = %Var% Text ; Assigns a variable to another with some extra text (legacy).
|
||||
Var8 := Var " Text" ; Assigns a variable to another with some extra text (expression).
|
||||
MsgBox, %Var% ; Variable inside a command.
|
||||
StringSplit, Var, Var, x ; Variable inside a command that uses InputVar and OutputVar.
|
||||
if (Number = 6) ; Whenever an IF has parentheses, it'll be an expression. So no percent signs.
|
||||
if (Var != Number) ; Whenever an IF has parentheses, it'll be an expression. So no percent signs.
|
||||
if Number = 6 ; Without parentheses, the IF is legacy. However, only variables on the 'right side' need percent signs.
|
||||
if Var1 < %Var2% ; Without parentheses, the IF is legacy. However, only variables on the 'right side' need percent signs.
|
||||
|
||||
MyObject := ["one", "two", "three", 17]
|
||||
Banana := <beginfold id='2'>{</beginfold id='2'>"Color": "Yellow", "Taste": "Delicious", "Price": 3<endfold id='2'>}</endfold id='2'>
|
||||
MyObject := Array("one", "two", "three", 17)
|
||||
Banana := Object("Color", "Yellow", "Taste", "Delicious", "Price", 3)
|
||||
Banana["Pickled"] := True ; This banana has been pickled. Eww.
|
||||
Banana.Consistency := "Mushy"
|
||||
Value := Banana["Color"]
|
||||
Value := Banana.Color
|
||||
MyObject["NewerKey"] := 3.1415
|
||||
MyObject.NewKey := "Shiny"
|
||||
MyObject.Push(Value1, Value2, Value3...)
|
||||
Banana.Consistency := ""
|
||||
RemovedValue := MyObject.Delete(AnyKey)
|
||||
NumberOfRemovedKeys := MyObject.Delete(FirstKey, LastKey)
|
||||
arr := [<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>] ; Creates an array containing an object.
|
||||
arr[1] := <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'> ; Creates a second object, implicitly freeing the first object.
|
||||
arr.RemoveAt(1) ; Removes and frees the second object.
|
||||
x := <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>, y := <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'> ; Create two objects.
|
||||
x.child := y, y.parent := x ; Create a circular reference.
|
||||
y.parent := ""
|
||||
x := "", y := ""
|
||||
table.base.__Get(table, x)[y] := content ; A
|
||||
table.base.__Set(table, x, y, content) ; B
|
||||
RemovedValue := MyObject.RemoveAt(Index)
|
||||
NumberOfRemovedKeys := MyObject.RemoveAt(Index, Length)
|
||||
val := obj.Property := 42
|
||||
m1 := new GMem(0, 20)
|
||||
m2 := <beginfold id='2'>{</beginfold id='2'>base: GMem<endfold id='2'>}</endfold id='2'>.__New(0, 30)
|
||||
x ? CallIfTrue() : CallIfFalse()
|
||||
ProductIsAvailable := (Color = "Red")
|
||||
? false ; We don't have any red products, so don't bother calling the function.
|
||||
: ProductIsAvailableInColor(Product, Color)
|
||||
MyObject.Pop()
|
||||
%Var%()
|
||||
|
||||
Sleep MillisecondsToWait
|
||||
Sleep %MillisecondsToWait%
|
||||
Sleep % MillisecondsToWait
|
||||
MsgBox % 1+1 ; Shows "2"
|
||||
MsgBox 1+1 ; Shows "1+1"
|
||||
|
||||
MsgBox % "This is text."
|
||||
MsgBox This is text.
|
||||
MsgBox % A_AhkVersion
|
||||
MsgBox %A_AhkVersion%
|
||||
MsgBox % %A_AhkVersion%
|
||||
MsgBox % "Hello %A_UserName%." ; Shows "%A_UserName%"
|
||||
MsgBox Hello %A_UserName%. ; Shows your username.
|
||||
MsgBox % "Hello " . A_UserName . "." ; Shows your username.
|
||||
MyVar := "This is text."
|
||||
MyVar = This is text.
|
||||
|
||||
if (Var1 = Var2)
|
||||
if Var1 = %Var2%
|
||||
if (Var1 >= Low and Var1 <= High)
|
||||
if Var1 between %Low% and %High%
|
||||
|
||||
Format("{:L}{:U}{:T}", input, input, input)
|
||||
|
||||
*#up::MouseMove, 0, -10, 0, R ; Win+UpArrow hotkey => Move cursor upward
|
||||
*#Down::MouseMove, 0, 10, 0, R ; Win+DownArrow => Move cursor downward
|
||||
*#Left::MouseMove, -10, 0, 0, R ; Win+LeftArrow => Move cursor to the left
|
||||
*#Right::MouseMove, 10, 0, 0, R ; Win+RightArrow => Move cursor to the right
|
||||
|
||||
*<#RCtrl:: ; LeftWin + RightControl => Left-click (hold down Control/Shift to Control-Click or Shift-Click).
|
||||
SendEvent {Blind}{LButton down}
|
||||
KeyWait RCtrl ; Prevents keyboard auto-repeat from repeating the mouse click.
|
||||
SendEvent {Blind}{LButton up}
|
||||
return
|
||||
|
||||
*<#AppsKey:: ; LeftWin + AppsKey => Right-click
|
||||
SendEvent {Blind}{RButton down}
|
||||
KeyWait AppsKey ; Prevents keyboard auto-repeat from repeating the mouse click.
|
||||
SendEvent {Blind}{RButton up}
|
||||
return
|
||||
|
||||
#Persistent ; Keep this script running until the user explicitly exits it.
|
||||
SetTimer, WatchPOV, 5
|
||||
return
|
||||
|
||||
WatchPOV:
|
||||
POV := GetKeyState("JoyPOV") ; Get position of the POV control.
|
||||
KeyToHoldDownPrev := KeyToHoldDown ; Prev now holds the key that was down before (if any).
|
||||
|
||||
; Some joysticks might have a smooth/continous POV rather than one in fixed increments.
|
||||
; To support them all, use a range:
|
||||
if (POV < 0) ; No angle to report
|
||||
KeyToHoldDown := ""
|
||||
else if (POV > 31500) ; 315 to 360 degrees: Forward
|
||||
KeyToHoldDown := "Up"
|
||||
else if POV between 0 and 4500 ; 0 to 45 degrees: Forward
|
||||
KeyToHoldDown := "Up"
|
||||
else if POV between 4501 and 13500 ; 45 to 135 degrees: Right
|
||||
KeyToHoldDown := "Right"
|
||||
else if POV between 13501 and 22500 ; 135 to 225 degrees: Down
|
||||
KeyToHoldDown := "Down"
|
||||
else ; 225 to 315 degrees: Left
|
||||
KeyToHoldDown := "Left"
|
||||
|
||||
if (KeyToHoldDown = KeyToHoldDownPrev) ; The correct key is already down (or no key is needed).
|
||||
return ; Do nothing.
|
||||
|
||||
; Otherwise, release the previous key and press down the new key:
|
||||
SetKeyDelay -1 ; Avoid delays between keystrokes.
|
||||
if KeyToHoldDownPrev ; There is a previous key to release.
|
||||
Send, {%KeyToHoldDownPrev% up} ; Release it.
|
||||
if KeyToHoldDown ; There is a key to press down.
|
||||
Send, {%KeyToHoldDown% down} ; Press it down.
|
||||
return
|
||||
|
||||
<^>!m::MsgBox You pressed AltGr+m.
|
||||
<^<!m::MsgBox You pressed LeftControl+LeftAlt+m.
|
||||
|
||||
AppsKey::ToolTip Press < or > to cycle through windows.
|
||||
AppsKey Up::ToolTip
|
||||
~AppsKey & <::Send !+{Esc}
|
||||
~AppsKey & >::Send !{Esc}
|
||||
|
||||
; Press AppsKey and Alt in any order, then slash (/).
|
||||
#if GetKeyState("AppsKey", "P")
|
||||
Alt & /::MsgBox Hotkey activated.
|
||||
|
||||
; If the keys are swapped, Alt must be pressed first (use one at a time):
|
||||
#if GetKeyState("Alt", "P")
|
||||
AppsKey & /::MsgBox Hotkey activated.
|
||||
|
||||
; [ & ] & \::
|
||||
#if GetKeyState("[") && GetKeyState("]")
|
||||
\::MsgBox
|
||||
|
||||
; Ctrl+Shift+O to open containing folder in Explorer.
|
||||
; Ctrl+Shift+E to open folder with current file selected.
|
||||
; Supports SciTE and Notepad++.
|
||||
^+o::
|
||||
^+e::
|
||||
editor_open_folder() <beginfold id='2'>{</beginfold id='2'>
|
||||
WinGetTitle, path, A
|
||||
if RegExMatch(path, "\*?\K(.*)\\[^\\]+(?= [-*] )", path)
|
||||
if (FileExist(path) && A_ThisHotkey = "^+e")
|
||||
Run explorer.exe /select`,"%path%"
|
||||
else
|
||||
Run explorer.exe "%path1%"
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#h:: ; Win+H hotkey
|
||||
; Get the text currently selected. The clipboard is used instead of
|
||||
; "ControlGet Selected" because it works in a greater variety of editors
|
||||
; (namely word processors). Save the current clipboard contents to be
|
||||
; restored later. Although this handles only plain text, it seems better
|
||||
; than nothing:
|
||||
AutoTrim Off ; Retain any leading and trailing whitespace on the clipboard.
|
||||
ClipboardOld := ClipboardAll
|
||||
Clipboard := "" ; Must start off blank for detection to work.
|
||||
Send ^c
|
||||
ClipWait 1
|
||||
if ErrorLevel ; ClipWait timed out.
|
||||
return
|
||||
; Replace CRLF and/or LF with `n for use in a "send-raw" hotstring:
|
||||
; The same is done for any other characters that might otherwise
|
||||
; be a problem in raw mode:
|
||||
StringReplace, Hotstring, Clipboard, ``, ````, All ; Do this replacement first to avoid interfering with the others below.
|
||||
StringReplace, Hotstring, Hotstring, `r`n, ``r, All ; Using `r works better than `n in MS Word, etc.
|
||||
StringReplace, Hotstring, Hotstring, `n, ``r, All
|
||||
StringReplace, Hotstring, Hotstring, %A_Tab%, ``t, All
|
||||
StringReplace, Hotstring, Hotstring, `;, ```;, All
|
||||
Clipboard := ClipboardOld ; Restore previous contents of clipboard.
|
||||
; This will move the InputBox's caret to a more friendly position:
|
||||
SetTimer, MoveCaret, 10
|
||||
if ErrorLevel ; The user pressed Cancel.
|
||||
return
|
||||
if InStr(Hotstring, ":R`:::")
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox You didn't provide an abbreviation. The hotstring has not been added.
|
||||
return
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
; Otherwise, add the hotstring and reload the script:
|
||||
FileAppend, `n%Hotstring%, %A_ScriptFullPath% ; Put a `n at the beginning in case file lacks a blank line at its end.
|
||||
Reload
|
||||
Sleep 200
|
||||
MsgBox, 4,, The hotstring just added appears to be improperly formatted.
|
||||
IfMsgBox, Yes, Edit
|
||||
return
|
||||
|
||||
MoveCaret:
|
||||
IfWinNotActive, New Hotstring
|
||||
return
|
||||
; Otherwise, move the InputBox's insertion point to where the user will type the abbreviation.
|
||||
Send {Home}{Right 3}
|
||||
SetTimer, MoveCaret, Off
|
||||
return
|
||||
|
||||
; This example also demonstrates one way to implement case conformity in a script.
|
||||
:C:BTW:: ; Typed in all-caps.
|
||||
:C:Btw:: ; Typed with only the first letter upper-case.
|
||||
: :btw:: ; Typed in any other combination.
|
||||
case_conform_btw() <beginfold id='2'>{</beginfold id='2'>
|
||||
hs := A_ThisHotkey ; For convenience and in case we're interrupted.
|
||||
if (hs == ":C:BTW")
|
||||
Send BY THE WAY
|
||||
else if (hs == ":C:Btw")
|
||||
Send By the way
|
||||
else
|
||||
Send by the way
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#IfWinActive ahk_class Notepad
|
||||
::btw::This replacement text will appear only in Notepad.
|
||||
#IfWinActive
|
||||
::btw::This replacement text appears in windows other than Notepad.
|
||||
|
||||
#Hotstring EndChars -()[]{}:;'"/\,.?!`n `t
|
||||
|
||||
Hotstring("EndChars", "-()[]{}:;")
|
||||
|
||||
::btw::
|
||||
MsgBox You typed "``btw``".
|
||||
return
|
||||
|
||||
:*:]d:: ; This hotstring replaces "]d" with the current date and time via the commands below.
|
||||
|
||||
MyFunction(FirstParameter, Second, ByRef Third, Fourth:="")
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
return "a value"
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
Loop 3
|
||||
MsgBox % MyArray%A_Index%
|
||||
|
||||
SysGet, WA, MonitorWorkArea
|
||||
MsgBox, Left: %WALeft% -- Top: %WATop% -- Right: %WARight% -- Bottom: %WABottom%.
|
||||
|
||||
n := 123 00123 -1. 0x7B 0x007B -0x1 3.14159
|
||||
|
||||
FileAppend, ; Comment.
|
||||
; Comment.
|
||||
( LTrim Join ; Comment.
|
||||
; This is not a comment; it is literal. Include the word Comments in the line above to make it a comment.
|
||||
), C:\File.txt ; Comment.
|
||||
|
||||
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
|
||||
|
||||
Add(X, Y, Z:=0) <beginfold id='2'>{</beginfold id='2'>
|
||||
return X + Y + Z
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
Join(sep, params*) <beginfold id='2'>{</beginfold id='2'>
|
||||
for index,param in params
|
||||
str .= param . sep
|
||||
return SubStr(str, 1, -StrLen(sep))
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
MsgBox % Join("`n", "one", "two", "three")
|
||||
|
||||
LogToFile(TextToLog)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
global LogFileName ; This global variable was previously given a value somewhere outside this function.
|
||||
FileAppend, %TextToLog%`n, %LogFileName%
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
SetDefaults()
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
global
|
||||
MyGlobal := 33
|
||||
local x, y:=0, z
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
LogToFile(TextToLog)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
static LoggedLines := 0
|
||||
LoggedLines += 1
|
||||
global LogFileName
|
||||
FileAppend, %LoggedLines%: %TextToLog%`n, %LogFileName%
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
GetFromStaticArray(WhichItemNumber)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
static
|
||||
static FirstCallToUs := true
|
||||
if FirstCallToUs
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
FirstCallToUs := false
|
||||
Loop 10
|
||||
StaticArray%A_Index% := "Value #" . A_Index
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
return StaticArray%WhichItemNumber%
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
if (ColorName != "" AND not FindColor(ColorName))
|
||||
MsgBox %ColorName% could not be found.
|
||||
|
||||
class baseObject {
|
||||
static foo := "bar"
|
||||
}
|
||||
baseObject := <beginfold id='2'>{</beginfold id='2'>foo: "bar"<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
thing := <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
thing.foo := "bar"
|
||||
thing.test := Func("thing_test")
|
||||
thing.test()
|
||||
|
||||
thing_test(this) <beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox % this.foo
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
class Color
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
__New(aRGB)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
this.RGB := aRGB
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
__Delete()
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox % "Delete Color."
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
static Shift := <beginfold id='2'>{</beginfold id='2'>R:16, G:8, B:0<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
__Get(aName)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
; NOTE: Using this.Shift here would cause an infinite loop!
|
||||
shift := Color.Shift[aName] ; Get the number of bits to shift.
|
||||
if (shift != "") ; Is it a known property?
|
||||
return (this.RGB >> shift) & 0xff
|
||||
; NOTE: Using 'return' here would break this.RGB.
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
__Set(aName, aValue)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
if ((shift := Color.Shift[aName]) != "")
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
aValue &= 255 ; Truncate it to the proper range.
|
||||
|
||||
; Calculate and store the new RGB value.
|
||||
this.RGB := (aValue << shift) | (this.RGB & ~(0xff << shift))
|
||||
|
||||
; 'Return' must be used to indicate a new key-value pair should not be created.
|
||||
; This also defines what will be stored in the 'x' in 'x := clr[name] := val':
|
||||
return aValue
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
; NOTE: Using 'return' here would break this.stored_RGB and this.RGB.
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
; Meta-functions can be mixed with properties:
|
||||
RGB <beginfold id='2'>{</beginfold id='2'>
|
||||
get <beginfold id='2'>{</beginfold id='2'>
|
||||
; Return it in hex format:
|
||||
return format("0x{:06x}", this.stored_RGB)
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
set <beginfold id='2'>{</beginfold id='2'>
|
||||
return this.stored_RGB := value
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
class __Get extends Properties
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
R() <beginfold id='2'>{</beginfold id='2'>
|
||||
return (this.RGB >> 16) & 255
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
G() <beginfold id='2'>{</beginfold id='2'>
|
||||
return (this.RGB >> 8) & 255
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
B() <beginfold id='2'>{</beginfold id='2'>
|
||||
return this.RGB & 255
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
Property[] ; Brackets are optional
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
get <beginfold id='2'>{</beginfold id='2'>
|
||||
return ...
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
set <beginfold id='2'>{</beginfold id='2'>
|
||||
return ... := value
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
class Properties extends FunctionObject
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
Call(aTarget, aName, aParams*)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
; If this Properties object contains a definition for this half-property, call it.
|
||||
if ObjHasKey(this, aName)
|
||||
return this[aName].Call(aTarget, aParams*)
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
MyGet(this, Key, Key2)
|
||||
MySet(this, Key, Key2, Value)
|
||||
MyCall(this, Name, Params)
|
||||
|
||||
ClassName := <beginfold id='2'>{</beginfold id='2'> __Get: Func("MyGet"), __Set: Func("MySet"), __Call: Func("MyCall") <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
red := new Color(0xff0000), red.R -= 5
|
||||
cyan := new Color(0), cyan.G := 255, cyan.B := 255
|
||||
|
||||
MsgBox % "red: " red.R "," red.G "," red.B " = " red.RGB
|
||||
MsgBox % "cyan: " cyan.R "," cyan.G "," cyan.B " = " cyan.RGB
|
||||
|
||||
; This example requires the FunctionObject class in order to work.
|
||||
blue := new Color(0x0000ff)
|
||||
MsgBox % blue.R "," blue.G "," blue.B
|
||||
|
||||
x := <beginfold id='2'>{</beginfold id='2'>base: <beginfold id='2'>{</beginfold id='2'>addr: Func("x_Addr"), __Set: Func("x_Setter")<endfold id='2'>}</endfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
; Assign value, implicitly calling x_Setter to create sub-objects.
|
||||
x[1,2,3] := "..."
|
||||
|
||||
; Retrieve value and call example method.
|
||||
MsgBox % x[1,2,3] "`n" x.addr() "`n" x[1].addr() "`n" x[1,2].addr()
|
||||
|
||||
x_Setter(x, p1, p2, p3) <beginfold id='2'>{</beginfold id='2'>
|
||||
x[p1] := new x.base
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
x_Addr(x) <beginfold id='2'>{</beginfold id='2'>
|
||||
return &x
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
InputBox, OutputVar, Question 1, What is your first name?
|
||||
if (OutputVar = "Bill")
|
||||
MsgBox, That's an awesome name`, %OutputVar%.
|
||||
|
||||
InputBox, OutputVar2, Question 2, Do you like AutoHotkey?
|
||||
if (OutputVar2 = "yes")
|
||||
MsgBox, Thank you for answering %OutputVar2%`, %OutputVar%! We will become great friends.
|
||||
else
|
||||
MsgBox, %OutputVar%`, That makes me sad.
|
||||
|
||||
MsgBox, 4,, Would you like to continue?
|
||||
IfMsgBox, No
|
||||
return ; If No, stop the code from going further.
|
||||
MsgBox, You pressed YES. ; Otherwise, the user picked yes.
|
||||
|
||||
if (car = "old")
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox, The car is really old.
|
||||
if (wheels = "flat")
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox, This car is not safe to drive.
|
||||
return
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
else
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox, Be careful! This old car will be dangerous to drive.
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
else
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
MsgBox, My`, what a shiny new vehicle you have there.
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
if (Color = "Red" or Color = "Green" or Color = "Blue" ; Comment.
|
||||
or Color = "Black" or Color = "Gray" or Color = "White") ; Comment.
|
||||
and ProductIsAvailableInColor(Product, Color) ; Comment.
|
||||
|
||||
if (codepage != "")
|
||||
codepage := " /CP" . codepage
|
||||
cmd="%A_AhkPath%"%codepage% "`%1" `%*
|
||||
key=AutoHotkeyScript\Shell\Open\Command
|
||||
if A_IsAdmin ; Set for all users.
|
||||
RegWrite, REG_SZ, HKCR, %key%,, %cmd%
|
||||
else ; Set for current user only.
|
||||
RegWrite, REG_SZ, HKCU, Software\Classes\%key%,, %cmd%
|
||||
|
||||
^j:: ; hotkey label
|
||||
MsgBox, You typed btw.
|
||||
@@ -0,0 +1,88 @@
|
||||
createTextField("greet", 0, 0, 0, 100, 100);
|
||||
greet.text = "Hello, world";
|
||||
|
||||
class com.example.Greeter extends MovieClip
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
public function Greeter()
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
var txtHello:TextField = this.createTextField("txtHello", 0, 0, 0, 100, 100);
|
||||
txtHello.text = "Hello, world";
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
var txtHello:TextField = new TextField();
|
||||
txtHello.text = "Hello World";
|
||||
this.addChild(txtHello);
|
||||
|
||||
package com.example
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
import flash.text.TextField;
|
||||
import flash.display.Sprite;
|
||||
|
||||
public class Greeter extends Sprite
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
public function Greeter()
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
var txtHello:TextField = new TextField();
|
||||
txtHello.text = "Hello World";
|
||||
addChild(txtHello);
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
var myObject:Object = new Object();
|
||||
var myObject = <beginfold id='1'>{</beginfold id='1'><endfold id='1'>}</endfold id='1'>;
|
||||
var myString:String = "Hello Wikipedia!"; // This would automatically set the variable as a string.
|
||||
var myNumber:Number = 5; // This would do the same for a number.
|
||||
var myObject:Object = <beginfold id='1'>{</beginfold id='1'>Param1:"Hi!", Param2:76<endfold id='1'>}</endfold id='1'>; //This creates an object with two variables.
|
||||
// Param1 is a string with the data of "Hi!",
|
||||
// and Param2 is a number with the data of 76.
|
||||
var myArray:Array = [5,"Hello!",<beginfold id='1'>{</beginfold id='1'>a:5, b:7<endfold id='1'>}</endfold id='1'>]; //This is the syntax for automatically creating an Array.
|
||||
//It creates an Array with 3 variables.
|
||||
//The first (0) is a number with the value of 5,
|
||||
//the second (1) is a string with the value of "Hello!",
|
||||
//and the third (2) is an object with {a:5, b:7}.
|
||||
|
||||
var item1:String="ABC";
|
||||
var item2:Boolean=true;
|
||||
var item3:Number=12;
|
||||
var item4:Array=["a","b","c"];
|
||||
var item5:Object=<beginfold id='1'>{</beginfold id='1'>name:"Actionscript",version:"3.0"<endfold id='1'>}</endfold id='1'>;
|
||||
var item6:XML = <node><child/></node>; //Note that the primitive XML is not quoted
|
||||
|
||||
var item1:XML=new XML("<node><child/></node>");
|
||||
var item2:XML=item1;
|
||||
item2.firstChild.attributes.value=13;
|
||||
//item1 now equals item2 since item2 simply points to what item1 points to.
|
||||
//Both are now:
|
||||
//<node><child value="13"/></node>
|
||||
|
||||
private function getNeighbours(_arg1:int, _arg2:int):Array<beginfold id='1'>{</beginfold id='1'>
|
||||
var _local3:Array = -(((null - !NULL!) % ~(undefined)));
|
||||
var _local4:*;
|
||||
var _local5:*;
|
||||
var _local6:*;
|
||||
_local3 = new Array();
|
||||
_local4 = 0;
|
||||
for (;//unresolved jump
|
||||
, _arg2 < 8;_local4++) <beginfold id='1'>{</beginfold id='1'>
|
||||
_local5 = (_arg1 + int(!NULL!));
|
||||
_local6 = (_arg2 + int(!NULL!));
|
||||
if (true)<beginfold id='1'>{</beginfold id='1'>
|
||||
_arg1 = (((//unresolved nextvalue or nextname << !NULL!) + !NULL!)
|
||||
<< undefined);
|
||||
_arg1 = (!(!NULL!) ^ !NULL!);
|
||||
(!NULL! instanceof !NULL!);
|
||||
var _local1 = (((!NULL! as !NULL!) + !NULL!) == this);
|
||||
if (!(!NULL! == !NULL!))<beginfold id='1'>{</beginfold id='1'>
|
||||
-((true << !NULL!)).push(Cell(cells[_local5][_local6]));
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
if (!true)<beginfold id='1'>{</beginfold id='1'>
|
||||
(_local6 < 0);
|
||||
(_local6 < 0);
|
||||
(_local5 < 0);
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
return (_local3);
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
.MEMORYMAP
|
||||
SLOTSIZE $8000 ; The slot is $8000 bytes in size. More details on slots later.
|
||||
DEFAULTSLOT 0 ; There's only 1 slot in SNES, there are more in other consoles.
|
||||
SLOT 0 $8000 ; Defines Slot 0's starting address.
|
||||
.ENDME
|
||||
|
||||
.SNESHEADER
|
||||
ID "SNES"
|
||||
NAME "Test Demo Mode 7 "
|
||||
; "123456789012345678901"
|
||||
LOROM
|
||||
SLOWROM
|
||||
CARTRIDGETYPE $00
|
||||
ROMSIZE $09 ;size rom 09-0d
|
||||
VERSION 00
|
||||
.ENDSNES
|
||||
|
||||
.MACRO Clear_RAM
|
||||
ldx #$0
|
||||
ldy #0
|
||||
-:
|
||||
sty 0,x
|
||||
inx
|
||||
inx
|
||||
cpx #$2000
|
||||
bne -
|
||||
.ENDM
|
||||
|
||||
.include "header.asm"
|
||||
|
||||
.bank 0 slot 0
|
||||
.org 0
|
||||
|
||||
Main:
|
||||
sei
|
||||
clc
|
||||
xce
|
||||
|
||||
rep #$10 ;16 bit xy
|
||||
sep #$20 ; 8 bit a
|
||||
|
||||
.dw $1C02,$1C02,$1C02,$1C02
|
||||
|
||||
lda sincos.l + $80,X
|
||||
|
||||
sincos2:
|
||||
.include "DATA/dsincos.asm"
|
||||
|
||||
lda #\1&$FF
|
||||
sta $211B
|
||||
|
||||
cmp #$04
|
||||
bne +++
|
||||
lda #$04
|
||||
bra lab
|
||||
+++:
|
||||
|
||||
TMP EQU $6
|
||||
|
||||
XY:
|
||||
BCC MOD7
|
||||
CPX #3 ; bla bla
|
||||
BCS MARCH
|
||||
DEY
|
||||
MARCH EOR #$7F ; bla bla
|
||||
JSR MOD7
|
||||
CPY #200
|
||||
ADC MTAB-1,X
|
||||
STA TMP
|
||||
TYA
|
||||
SBC TMP
|
||||
LSR
|
||||
TYA
|
||||
STA TMP
|
||||
MOD7 ADC #7
|
||||
RTS
|
||||
CLC
|
||||
MTAB DB 1,4,23,34,3,12
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
;********************************************************************
|
||||
;* LED flasher: LED will flash with a X on/off ratio at PD6
|
||||
;*
|
||||
;* NOTE: delay depends in the value of X, 1 is fast, 255 is slow
|
||||
;*
|
||||
;* No copyright ©1998 RES® * FREEWARE *
|
||||
;*
|
||||
;* NOTE: Connect a low current LED with a 1k resistor in serie from
|
||||
;* Vdd to pin 11 of the MCU. (Or a normal LED with a 330ohm)
|
||||
;*
|
||||
;* RES® can be reached by email: digitalaudio@mail.com
|
||||
;* or visit the website: http://home.wanadoo.nl/electro1/avr
|
||||
;*
|
||||
;* Version :1.0
|
||||
;* Date :12/26/98
|
||||
;* Author :Rob's ElectroSoft®
|
||||
;* Target MCU :AT90S1200-12PI@4MHz
|
||||
;********************************************************************
|
||||
|
||||
.include "1200def.inc"
|
||||
|
||||
rjmp RESET ;reset handle
|
||||
|
||||
|
||||
;* Long delay
|
||||
|
||||
;* Register variables
|
||||
|
||||
.def T1 = r1
|
||||
.def T2 = r2
|
||||
.def temp = r19
|
||||
|
||||
;* Code
|
||||
|
||||
longDelay:
|
||||
clr T1 ;T1 used as delay 2nd count
|
||||
clr T2 ;T2 used as delay 3d count
|
||||
delay_1:
|
||||
dec T2
|
||||
brne delay_1
|
||||
dec T1
|
||||
brne delay_1
|
||||
dec temp ;temp must be preset as
|
||||
brne delay_1 ; delay master count
|
||||
ret
|
||||
|
||||
|
||||
;* Resets the data direction register D
|
||||
|
||||
;* Defines
|
||||
|
||||
.equ led = 6 ;LED at PD6
|
||||
|
||||
;* Code
|
||||
|
||||
RESET:
|
||||
sbi DDRD, led ;connect LED to PORTD pin 6
|
||||
|
||||
|
||||
;* Main program
|
||||
|
||||
;* This part will let the LED go on and off by X
|
||||
|
||||
;* Register variables
|
||||
|
||||
.equ X = 10 ;enter delaytime X
|
||||
|
||||
flash:
|
||||
sbi PORTD, led ;LED on
|
||||
ldi temp, X ;X sec delay
|
||||
rcall longDelay
|
||||
cbi PORTD, led ;LED off
|
||||
ldi temp, X ;X sec delay
|
||||
rcall longDelay
|
||||
rjmp flash ;another run
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> other
|
||||
tests <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
.org LARGEBOOTSTART
|
||||
; the following sets up RAMPZ:Z to point to a FLASH data object, typically
|
||||
; for use with ELPM.
|
||||
ldi ZL, low (cmdtable * 2)
|
||||
ldi ZH, high (cmdtable * 2)
|
||||
.if ((cmdtable * 2) > 65535)
|
||||
ldi r16, 1
|
||||
sts RAMPZ, r16
|
||||
.endif
|
||||
; more code follows here
|
||||
cmdtable: .db "foo", 0x0
|
||||
.db "Hello\n" // is equivalent to:
|
||||
.db 'H', 'e', 'l', 'l', 'o', '\\', 'n'
|
||||
.db '\0', '\177', '\xff'
|
||||
.db "\nx\rx\ax\bx\fx\tx\vx\\x\0000\xfff\0\1"
|
||||
0b10_111_2 0xaf3_4 0_12 32_32 $32_3
|
||||
|
||||
.macro m
|
||||
ldi @0, @1
|
||||
.endm m r16,\ 0
|
||||
|
||||
#define TEST \
|
||||
.IF val \
|
||||
.DW __TIME__ \
|
||||
.ELSE \
|
||||
.DW 1 \
|
||||
.ENDIF
|
||||
|
||||
#defi TEST
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
* initialization
|
||||
n equ 20
|
||||
start equ $40
|
||||
wddr equ $0
|
||||
cddr equ $0
|
||||
input equ $ffe0
|
||||
output equ $ffe1
|
||||
;
|
||||
org p:start
|
||||
move #wddr,r0 ;r0 ¬ samples
|
||||
move #cddr,r4 ;r1 ¬ coefficients
|
||||
move #n-1,m0 ;set modulo arithmetic
|
||||
move m0,m4 ;for the 2 circular buffers
|
||||
;
|
||||
opt cc
|
||||
; filter loop :8+(n-1) cycles
|
||||
|
||||
movep y:input,x: (r0) ;input sample in memory
|
||||
clr a x:(r0)+,x0 y: (r4)+,y0
|
||||
rep #n-1
|
||||
mac x0,y0,a x:(r0)+,x0 y:(r4)+,y0
|
||||
macr x0,x0,a (r0)-
|
||||
|
||||
movep a,y:output ;output filtered sample
|
||||
|
||||
fftr2a macro points,data,coef
|
||||
fftr2a: ident 1,1
|
||||
|
||||
move #points/2,n0 ;initialize butterflies per group
|
||||
move #1,n2 ;initialize groups per pass
|
||||
move #points/4,n6 ;initialize C pointer offset
|
||||
move #-1,m0 ;initialize A and B address modifiers
|
||||
move m0,m1 ;for linear addressing
|
||||
move m0,m4
|
||||
move m0,m5
|
||||
move #0,m6 ;initialize C address modifier for
|
||||
;reverse carry (bit-reversed) addressing
|
||||
|
||||
do #@cvi (@log(points)/@log(2)+0.5),_end_pass
|
||||
move #data,r0 ;initialize A input pointer
|
||||
move r0,r4 ;initialize A output pointer
|
||||
|
||||
_end_bfy
|
||||
move a,x:(r5)+n5 y:(r1)+n1,y1
|
||||
|
||||
end_cell
|
||||
rnd a
|
||||
movep #0,x:$fffe
|
||||
dc @sin(@cvf(count)*freq)
|
||||
move #twiddle,r2
|
||||
|
||||
MOVE L:<$1,A
|
||||
SUB X,A L:<$3,B
|
||||
|
||||
bad_label
|
||||
good_label:
|
||||
+516
@@ -0,0 +1,516 @@
|
||||
jmp near dword [0]
|
||||
jmp far dword [0]
|
||||
|
||||
mov bx,ax ; general register to general register
|
||||
mov [char],al ; general register to memory
|
||||
mov dl,32 ; immediate value to general register
|
||||
mov cr3,ebx ; general register to control register
|
||||
|
||||
xchg ax,bx ; swap two general registers
|
||||
xchg al,[char] ; swap register with memory
|
||||
|
||||
push ax ; store general register
|
||||
push es ; store segment register
|
||||
pushw [bx] ; store memory
|
||||
push 1000h ; store immediate value
|
||||
|
||||
imul ax,[si],10 ; memory by immediate value to register
|
||||
|
||||
bt ax,15 ; test bit in register
|
||||
bts word [bx],15 ; test and set bit in memory
|
||||
|
||||
bswap edx ; swap bytes in register
|
||||
|
||||
jmp 100h ; direct near jump
|
||||
jmp 0FFFFh:0 ; direct far jump
|
||||
jmp ax ; indirect near jump
|
||||
jmp pword [ebx] ; indirect far jump
|
||||
|
||||
movs byte [di],[si] ; transfer byte
|
||||
movs word [es:di],[ss:si] ; transfer word
|
||||
movsd ; transfer double word
|
||||
|
||||
cmpxchg8b [bx] ; compare and exchange 8 bytes
|
||||
|
||||
movq2dq xmm0,mm1 ; move from MMX register to SSE register
|
||||
movdq2q mm0,xmm1 ; move from SSE register to MMX register
|
||||
|
||||
enter 2048,0 ; enter and allocate 2048 bytes on stack
|
||||
|
||||
mov [rip+3],sil ; manual RIP-relative addressing
|
||||
|
||||
blendvps xmm3,xmm7,xmm0 ; blend according to mask
|
||||
vgatherqps xmm0,[xmm2],xmm3 ; gather two floats
|
||||
vgatherqps xmm0,[ymm2+64],xmm3 ; gather four floats
|
||||
vfmsub231ps ymm1,ymm2,ymm3 ; multiply and subtract
|
||||
vfnmadd132sd xmm0,xmm5,[ebx] ; multiply, negate and add
|
||||
vpermil2ps ymm0,ymm3,ymm7,ymm2,0 ; permute from two sources
|
||||
|
||||
vscatterdps [eax+xmm1]{k1},xmm0 ; scatter four floats
|
||||
vscatterdpd [ymm3*8]{k3},zmm0 ; scatter eight doubles
|
||||
|
||||
dd sum
|
||||
x = 1
|
||||
x = x+2
|
||||
sum = x
|
||||
|
||||
|
||||
if count>0
|
||||
mov cx,count
|
||||
rep movsb
|
||||
end if
|
||||
|
||||
|
||||
if count & ~ count mod 4
|
||||
mov cx,count/4
|
||||
rep movsd
|
||||
else if count>4
|
||||
mov cx,count/4
|
||||
rep movsd
|
||||
mov cx,count mod 4
|
||||
rep movsb
|
||||
else
|
||||
mov cx,count
|
||||
rep movsb
|
||||
end if
|
||||
|
||||
repeat 8
|
||||
mov byte [bx],%
|
||||
inc bx
|
||||
end repeat
|
||||
|
||||
|
||||
s = x/2
|
||||
repeat 100
|
||||
if x/s = s
|
||||
break
|
||||
end if
|
||||
s = (s+x/s)/2
|
||||
end repeat
|
||||
|
||||
repeat $-$$
|
||||
load a byte from $$+%-1
|
||||
store byte a xor c at $$+%-1
|
||||
end repeat
|
||||
|
||||
GDTR dp ?
|
||||
virtual at GDTR
|
||||
GDT_limit dw ?
|
||||
GDT_address dd ?
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
file 'a.txt':10h,1
|
||||
load char from 0
|
||||
end virtual
|
||||
|
||||
virtual at 0 as 'asc'
|
||||
times 256 db %-1
|
||||
end virtual
|
||||
|
||||
virtual at 0
|
||||
hex_digits::
|
||||
db '0123456789ABCDEF'
|
||||
end virtual
|
||||
load a byte from hex_digits:10
|
||||
|
||||
bits = 16
|
||||
display 'Current offset is 0x'
|
||||
repeat bits/4
|
||||
d = '0' + $ shr (bits-%*4) and 0Fh
|
||||
if d > '9'
|
||||
d = d + 'A'-'9'-1
|
||||
end if
|
||||
display d
|
||||
end repeat
|
||||
display 13,10
|
||||
|
||||
if ~ defined alpha
|
||||
alpha:
|
||||
end if
|
||||
|
||||
if ~ defined alpha | defined @f
|
||||
alpha:
|
||||
@@:
|
||||
end if
|
||||
|
||||
include 'macros.inc'
|
||||
|
||||
d equ dword
|
||||
NULL equ d 0
|
||||
d equ edx
|
||||
|
||||
d equ d,eax
|
||||
|
||||
b equ byte
|
||||
w equ word
|
||||
d equ dword
|
||||
p equ pword
|
||||
f equ fword
|
||||
q equ qword
|
||||
t equ tword
|
||||
x equ dqword
|
||||
y equ qqword
|
||||
|
||||
incl fix include
|
||||
|
||||
macro tst {test al,0xFF}
|
||||
|
||||
macro stos0
|
||||
{
|
||||
xor al,al
|
||||
stosb
|
||||
}
|
||||
|
||||
macro align value { rb (value-1)-($+value-1) mod value }
|
||||
|
||||
macro mov op1,op2
|
||||
{
|
||||
if op1 in <ds,es,fs,gs,ss> & op2 in <cs,ds,es,fs,gs,ss>
|
||||
push op2
|
||||
pop op1
|
||||
else
|
||||
mov op1,op2
|
||||
end if
|
||||
}
|
||||
|
||||
macro stoschar [char]
|
||||
{
|
||||
mov al,char
|
||||
stosb
|
||||
}
|
||||
|
||||
macro movstr
|
||||
{
|
||||
local move
|
||||
move:
|
||||
lodsb
|
||||
stosb
|
||||
test al,al
|
||||
jnz move
|
||||
}
|
||||
|
||||
macro strtbl name,[string]
|
||||
{
|
||||
common
|
||||
label name dword
|
||||
forward
|
||||
local label
|
||||
dd label
|
||||
forward
|
||||
label db string,0
|
||||
}
|
||||
|
||||
push 3
|
||||
push 2
|
||||
push 1
|
||||
call foo
|
||||
|
||||
macro invoke proc,[arg]
|
||||
{ common stdcall [proc],arg }
|
||||
|
||||
macro jif op1,cond,op2,label
|
||||
{
|
||||
cmp op1,op2
|
||||
j#cond label
|
||||
}
|
||||
|
||||
macro label name
|
||||
{
|
||||
label name
|
||||
if ~ used name
|
||||
display `name # " is defined but not used.",13,10
|
||||
end if
|
||||
}
|
||||
|
||||
macro message arg
|
||||
{
|
||||
if arg eqtype ""
|
||||
local str
|
||||
jmp @f
|
||||
str db arg,0Dh,0Ah,24h
|
||||
@@:
|
||||
mov dx,str
|
||||
else
|
||||
mov dx,arg
|
||||
end if
|
||||
mov ah,9
|
||||
int 21h
|
||||
}
|
||||
|
||||
macro ext instr
|
||||
{
|
||||
macro instr op1,op2,op3
|
||||
\{
|
||||
if op3 eq
|
||||
instr op1,op2
|
||||
else
|
||||
instr op1,op2
|
||||
instr op2,op3
|
||||
end if
|
||||
\}
|
||||
}
|
||||
|
||||
ext add
|
||||
ext sub
|
||||
|
||||
|
||||
macro tmacro [params]
|
||||
{
|
||||
common macro params {
|
||||
}
|
||||
MACRO fix tmacro
|
||||
ENDM fix }
|
||||
|
||||
|
||||
MACRO stoschar char
|
||||
mov al,char
|
||||
stosb
|
||||
ENDM
|
||||
|
||||
postpone
|
||||
{
|
||||
code_size = $
|
||||
}
|
||||
|
||||
struc point x,y
|
||||
{
|
||||
.x dw x
|
||||
.y dw y
|
||||
}
|
||||
|
||||
struc db [data]
|
||||
{
|
||||
common
|
||||
. db data
|
||||
.size = $ - .
|
||||
}
|
||||
|
||||
rept 5 { in al,dx }
|
||||
|
||||
rept 3 counter
|
||||
{
|
||||
byte#counter db counter
|
||||
}
|
||||
|
||||
match +,+ { include 'first.inc' }
|
||||
match +,- { include 'second.inc' }
|
||||
match a b, 1+2+3 { db a }
|
||||
|
||||
V fix {
|
||||
macro empty
|
||||
V
|
||||
V fix }
|
||||
V
|
||||
|
||||
|
||||
list equ
|
||||
|
||||
macro append item
|
||||
{
|
||||
match any, list \{ list equ list,item \}
|
||||
match , list \{ list equ item \}
|
||||
}
|
||||
|
||||
define a b+4
|
||||
define b 3
|
||||
rept 1 result:a*b+2 { define c result }
|
||||
|
||||
rept 8 n:0 { pxor xmm#n,xmm#n }
|
||||
|
||||
|
||||
irps reg, al bx ecx
|
||||
{ xor reg,reg }
|
||||
|
||||
|
||||
if 0
|
||||
a = 1
|
||||
b equ 2
|
||||
end if
|
||||
dd b
|
||||
|
||||
|
||||
extrn exit
|
||||
extrn '__imp__MessageBoxA@16' as MessageBox:dword
|
||||
|
||||
extrn 'printf' as _printf
|
||||
printf = PLT _printf
|
||||
|
||||
tester? = 0
|
||||
|
||||
space:
|
||||
space.x = 1
|
||||
space.y = 2
|
||||
space.color:
|
||||
space.color.r = 0
|
||||
space.color.g = 0
|
||||
space.color.b = 0
|
||||
|
||||
space:
|
||||
namespace space
|
||||
x = 1
|
||||
y = 2
|
||||
color:
|
||||
.r = 0
|
||||
.g = 0
|
||||
.b = 0
|
||||
end namespace
|
||||
|
||||
|
||||
first:
|
||||
.child = 1
|
||||
..other = 0
|
||||
second:
|
||||
.child = 2
|
||||
..another = ..other
|
||||
|
||||
|
||||
label character:byte
|
||||
label char:1
|
||||
|
||||
byte? = 1 ; 8 bits
|
||||
word? = 2 ; 16 bits
|
||||
dword? = 4 ; 32 bits
|
||||
fword? = 6 ; 48 bits
|
||||
pword? = 6 ; 48 bits
|
||||
qword? = 8 ; 64 bits
|
||||
tbyte? = 10 ; 80 bits
|
||||
tword? = 10 ; 80 bits
|
||||
dqword? = 16 ; 128 bits
|
||||
xword? = 16 ; 128 bits
|
||||
qqword? = 32 ; 256 bits
|
||||
yword? = 32 ; 256 bits
|
||||
dqqword? = 64 ; 512 bits
|
||||
zword? = 64 ; 512 bits
|
||||
|
||||
element A
|
||||
linpoly = A + A + 3
|
||||
vterm = linpoly scale 1 * linpoly element 1 ; vterm = 2 * A
|
||||
|
||||
db 4 dup 90h ; generate 4 bytes
|
||||
db 2 dup ('abc',10) ; generate 8 bytes
|
||||
|
||||
macro measured name,string
|
||||
local top
|
||||
name db string
|
||||
top: name.length = top - name
|
||||
end macro
|
||||
|
||||
measured hello, 'Hello!' ; hello.length = 6
|
||||
|
||||
A equ 1
|
||||
A equ 2
|
||||
|
||||
drop A
|
||||
drop A
|
||||
|
||||
data1 dw 1
|
||||
buffer1 rb 10h ; zeroed and present in the output
|
||||
|
||||
org 400h
|
||||
data dw 2
|
||||
buffer2 rb 20h ; not in the output
|
||||
|
||||
section 1000h
|
||||
data3 dw 3
|
||||
buffer3 rb 30h ; not in the output
|
||||
|
||||
virtual at 0
|
||||
hex_digits::
|
||||
db '0123456789ABCDEF'
|
||||
end virtual
|
||||
load a:byte from hex_digits:10 ; a = 'A'
|
||||
|
||||
db "Text"
|
||||
key = 7Bh
|
||||
repeat $-$$
|
||||
load a : byte from $$+%-1
|
||||
store a xor key : byte at $$+%-1
|
||||
end repeat
|
||||
|
||||
load char : byte from const:0
|
||||
|
||||
if $>10000h
|
||||
err 'segment too large'
|
||||
end if
|
||||
calminstruction please? cmd&
|
||||
match =do? =not? cmd, cmd
|
||||
jyes done
|
||||
assemble cmd
|
||||
done:
|
||||
end calminstruction
|
||||
|
||||
please do not display 'Bye!'
|
||||
|
||||
macro jmpi target
|
||||
if target-($+2) < 80h & target-($+2) >= -80h
|
||||
db 0EBh
|
||||
db target-($+1)
|
||||
else
|
||||
db 0E9h
|
||||
dw target-($+2)
|
||||
end if
|
||||
end macro
|
||||
|
||||
macro EX? first,second
|
||||
match (=SP?), first
|
||||
match =HL?, second
|
||||
db 0E3h
|
||||
else match =IX?, second
|
||||
db 0DDh,0E3h
|
||||
else match =IY?, second
|
||||
db 0FDh,0E3h
|
||||
else
|
||||
err "incorrect second argument"
|
||||
end match
|
||||
else match =AF?, first
|
||||
match =AF'?, second
|
||||
db 08h
|
||||
else
|
||||
err "incorrect second argument"
|
||||
end match
|
||||
else match =DE?, first
|
||||
match =HL?, second
|
||||
db 0EBh
|
||||
else
|
||||
err "incorrect second argument"
|
||||
end match
|
||||
else
|
||||
err "incorrect first argument"
|
||||
end match
|
||||
end macro
|
||||
|
||||
EX (SP),HL
|
||||
|
||||
macro INC? argument
|
||||
match [:r:], argument
|
||||
db 100b + r shl 3
|
||||
else match (=HL?), argument
|
||||
db 34h
|
||||
else match (=IX?+d), argument
|
||||
db 0DDh,34h,d
|
||||
else match (=IY?+d), argument
|
||||
db 0FDh,34h,d
|
||||
else
|
||||
err "incorrect argument"
|
||||
end match
|
||||
end macro
|
||||
|
||||
INC (IX+2)
|
||||
|
||||
element IY?
|
||||
|
||||
element L? : register + 101b
|
||||
|
||||
macro CALL? arguments&
|
||||
local cc,nn
|
||||
match condition =, target, arguments
|
||||
cc = condition - CC
|
||||
nn = target
|
||||
db 0C4h + cc shl 3
|
||||
else
|
||||
nn = arguments
|
||||
db 0CDh
|
||||
end match
|
||||
dw nn
|
||||
end macro
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
map_collision_rom:
|
||||
dc.b 0,0,7,7
|
||||
|
||||
hud_tile:
|
||||
dc.w $6268,$6269,$6268,$6269
|
||||
|
||||
MAP_DATA1 macro
|
||||
|
||||
dc.w $4200+\2+(\1*$400),$4200+\2+2+(\1*$400)
|
||||
move.w \2,Sprite+0+(8*\1)
|
||||
|
||||
endm
|
||||
|
||||
move.w MarioArmy+0+6*\2,d0
|
||||
move.w #$050B+2*\2,d1
|
||||
|
||||
cmp.w #15,MarioAnim
|
||||
if_mi
|
||||
addi.w #$0800,d2
|
||||
endi
|
||||
|
||||
if_eq
|
||||
|
||||
andi.w #$01,d5
|
||||
cmp.w #$1,d5
|
||||
if_ne
|
||||
move.w #$200,d0
|
||||
endi
|
||||
endi
|
||||
|
||||
Draw_Sprite 0,Selecty,#$0501,SelectTile,Selectx
|
||||
|
||||
move.w #$0030,d6
|
||||
|
||||
cmp.w #0,SelectChoix
|
||||
|
||||
;Mario3 Menu
|
||||
Draw_Sprite 4,#$80+28,#$0505,d4,#$80+8*9
|
||||
|
||||
move.w #1,d1
|
||||
|
||||
lea EnemyArmyDgt,a0
|
||||
lea EnemyArmy,a1
|
||||
move.w #9,d0
|
||||
move.w d4,d2
|
||||
subi.w #$80,d2
|
||||
lsr.w #4,d2
|
||||
|
||||
move.w d3,d7
|
||||
subi.w #$C0,d7
|
||||
asr.w #4,d7
|
||||
asl.w #4,d7
|
||||
|
||||
move.l a1,a2
|
||||
move.w #0,(a2)+
|
||||
move.w #$0,(a0) ;remove de l'écran
|
||||
|
||||
move.l a1,a2
|
||||
move.w Selectx,(a2)+
|
||||
move.w #$1,(a3) ;est a l'écran
|
||||
add.w #$6,a3
|
||||
|
||||
org $000000
|
||||
dc.l $0,Main
|
||||
dc.l INT,INT,INT,INT,INT,INT,INT
|
||||
dc.b ' 00000000-00' ; Product code, version nu
|
||||
mber. 12 bytes long
|
||||
dc.w $FDDB ; Checksum. 2 bytes long
|
||||
dc.b 'J ' ; I/O support. 16 bytes
|
||||
dc.l $00000000,$00020000
|
||||
do
|
||||
move.l (a2)+,VDP_DATA
|
||||
while_dbra d0
|
||||
|
||||
if_ne macro
|
||||
bne L1\@!
|
||||
endm
|
||||
|
||||
_A = 12
|
||||
|
||||
VDP_Port_VRAMW #$A000+(2*\2)+($40*\3)
|
||||
|
||||
lea \1,a2
|
||||
move.w #3,d7
|
||||
|
||||
VDP_DATA equ $C00000
|
||||
VDP_CTRL equ $C00004
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
# A demonstration of some simple MIPS instructions
|
||||
# used to test QtSPIM
|
||||
|
||||
# Declare main as a global function
|
||||
.globl main
|
||||
|
||||
# All program code is placed after the
|
||||
# .text assembler directive
|
||||
.text
|
||||
|
||||
# The label 'main' represents the starting point
|
||||
main:
|
||||
li $t2, 25 # Load immediate value (25)
|
||||
lw $t3, value # Load the word stored in value (see bottom)
|
||||
add $t4, $t2, $t3 # Add
|
||||
sub $t5, $t2, $t3 # Subtract
|
||||
sw $t5, Z #Store the answer in Z (declared at the bottom)
|
||||
|
||||
# Exit the program by means of a syscall.
|
||||
# There are many syscalls - pick the desired one
|
||||
# by placing its code in $v0. The code for exit is "10"
|
||||
li $v0, 10 # Sets $v0 to "10" to select exit syscall
|
||||
syscall # Exit
|
||||
|
||||
# All memory structures are placed after the
|
||||
# .data assembler directive
|
||||
.data
|
||||
|
||||
# The .word assembler directive reserves space
|
||||
# in memory for a single 4-byte word (or multiple 4-byte words)
|
||||
# and assigns that memory location an initial value
|
||||
# (or a comma separated list of initial values)
|
||||
value: .word 12
|
||||
Z: .word 0
|
||||
+523
@@ -0,0 +1,523 @@
|
||||
; Example file for nasm.xml kate syntax file
|
||||
; compile with `nasm example.asm -f elf -o example.o`
|
||||
; and link with 'gcc example.o -o example`
|
||||
; Public domain
|
||||
; kate: hl Intel x86 (NASM);
|
||||
|
||||
section .data
|
||||
|
||||
hello dd 'Hello World', 0x0A, 0h
|
||||
printf_param dd '%s', 0q
|
||||
|
||||
section .text
|
||||
|
||||
extern printf
|
||||
|
||||
global main
|
||||
main:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push hello
|
||||
push printf_param
|
||||
call printf
|
||||
|
||||
mov eax, 0b
|
||||
leave
|
||||
ret
|
||||
|
||||
|
||||
NULL EQU 0 ; Constants
|
||||
STD_OUTPUT_HANDLE EQU -11
|
||||
|
||||
extern GetStdHandle ; Import external symbols
|
||||
|
||||
global Start ; Export symbols. The entry point
|
||||
|
||||
section .data ; Initialized data segment
|
||||
Message db "Console Message 64", 0Dh, 0Ah
|
||||
MessageLength EQU $-Message ; Address of this line ($) - address of Message
|
||||
|
||||
section .bss ; Uninitialized data segment
|
||||
alignb 8
|
||||
Written resq 1
|
||||
|
||||
section .text ; Code segment
|
||||
Start:
|
||||
sub RSP, 8 ; Align the stack to a multiple of 16 bytes
|
||||
|
||||
mov ECX, STD_OUTPUT_HANDLE
|
||||
call GetStdHandle
|
||||
mov qword [REL StandardHandle], RAX
|
||||
|
||||
sub RSP, 32 + 8 + 8 ; Shadow space + 5th parameter + align stack
|
||||
; to a multiple of 16 bytes
|
||||
mov RCX, qword [REL StandardHandle] ; 1st parameter
|
||||
lea RDX, [REL Message] ; 2nd parameter
|
||||
mov R8, MessageLength ; 3rd parameter
|
||||
mov qword [RSP + 4 * 8], NULL ; 5th parameter
|
||||
; Message Box, 64 bit. V1.02
|
||||
.DisplayMessageBox:
|
||||
xor ECX, ECX ; 1st parameter
|
||||
lea RDX, [REL MessageBoxText] ; 2nd parameter
|
||||
lea R8, [REL MessageBoxCaption] ; 3rd parameter
|
||||
mov R9D, MB_YESNO | MB_DEFBUTTON2 ; 4th parameter. 2 constants ORed together
|
||||
call MessageBoxA
|
||||
|
||||
cmp RAX, IDNO ; Check the return value for "No"
|
||||
je .DisplayMessageBox
|
||||
|
||||
extern _GetStdHandle@4 ; Import external symbols
|
||||
Start:
|
||||
call _WriteFile@20
|
||||
|
||||
section .data ; Initialized data segment
|
||||
Static1Colour dd 0F0F0F0h,
|
||||
Edit2 resq 1
|
||||
|
||||
%define Screen.Width RBP - 160 ; 4 bytes
|
||||
%define ClientArea RBP - 152 ; RECT structure. 16 bytes
|
||||
|
||||
mov dword [wc.cbSize], 80 ; [RBP - 136]
|
||||
mov dword [wc.style], CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW ; [RBP - 132]
|
||||
mov qword [wc.lpfnWndProc], RAX ; [RBP - 128]
|
||||
mov qword [wc.hIcon], RAX ; [RBP - 104]
|
||||
mov dword [RSP + 4 * 8], EAX ; X position, now centred
|
||||
|
||||
cmp qword [uMsg], WM_CLOSE ; [RBP + 24]
|
||||
je WMCLOSE
|
||||
call DestroyWindow ; Send a WM_DESTROY message
|
||||
jmp Return.WM_Processed
|
||||
mov EDX, 0604060h
|
||||
call SetBkColor
|
||||
mov EDX, 0005000h
|
||||
|
||||
db 0x55 ; just the byte 0x55
|
||||
db 0x55,0x56,0x57 ; three bytes in succession
|
||||
db 'a',0x55 ; character constants are OK
|
||||
db 'hello',13,10,'$' ; so are string constants
|
||||
dw 0x1234 ; 0x34 0x12
|
||||
dw 'a' ; 0x61 0x00 (it's just a number)
|
||||
dw 'ab' ; 0x61 0x62 (character constant)
|
||||
dw 'abc' ; 0x61 0x62 0x63 0x00 (string)
|
||||
dd 0x12345678 ; 0x78 0x56 0x34 0x12
|
||||
dd 1.234567e20 ; floating-point constant
|
||||
dq 0x123456789abcdef0 ; eight byte constant
|
||||
dq 1.234567e20 ; double-precision float
|
||||
dt 1.234567e20 ; extended-precision float
|
||||
|
||||
db 33
|
||||
db (44) ; Integer expression
|
||||
; db (44,55) ; Invalid - error
|
||||
db %(44,55)
|
||||
db %('XX','YY')
|
||||
db ('AA') ; Integer expression - outputs single byte
|
||||
db %('BB') ; List, containing a string
|
||||
db ?
|
||||
db 6 dup (33)
|
||||
db 6 dup (33, 34)
|
||||
db 6 dup (33, 34), 35
|
||||
db 7 dup (99)
|
||||
db 7 dup dword (?, word ?, ?)
|
||||
dw byte (?,44)
|
||||
dw 3 dup (0xcc, 4 dup byte ('PQR'), ?), 0xabcd
|
||||
dd 16 dup (0xaaaa, ?, 0xbbbbbb)
|
||||
dd 64 dup (?)
|
||||
db `\u263a` ; UTF-8 smiley face
|
||||
db `\xe2\x98\xba` ; UTF-8 smiley face
|
||||
db 0E2h, 098h, 0BAh ; UTF-8 smiley face
|
||||
buffer: resb 64 ; reserve 64 bytes
|
||||
wordvar: resw 1 ; reserve a word
|
||||
buffer: db 64 dup (?) ; reserve 64 bytes
|
||||
wordvar: dw ? ; reserve a word
|
||||
|
||||
incbin "file.dat" ; include the whole file
|
||||
incbin "file.dat",1024 ; skip the first 1024 bytes
|
||||
incbin "file.dat",1024,512 ; skip the first 1024, and
|
||||
; actually include at most 512
|
||||
|
||||
message db 'hello, world'
|
||||
msglen equ $-message
|
||||
|
||||
buffer: db 'hello, world'
|
||||
times 64-$+buffer db ' '
|
||||
|
||||
bndstx [rbx*1+rax+0x3], bnd0 ; GAS - '*1' indecates an index reg
|
||||
VDIVPS zmm4, zmm5, dword [rbx]{1to16} ; single-precision float
|
||||
VDIVPS zmm4, zmm5, zword [rbx] ; packed 512 bit memory
|
||||
|
||||
mov ax,200 ; decimal
|
||||
mov ax,0200 ; still decimal
|
||||
mov ax,0200d ; explicitly decimal
|
||||
mov ax,0d200 ; also decimal
|
||||
mov ax,0c8h ; hex
|
||||
mov ax,$0c8 ; hex again: the 0 is required
|
||||
mov ax,0xc8 ; hex yet again
|
||||
mov ax,0hc8 ; still hex
|
||||
mov ax,310q ; octal
|
||||
mov ax,310o ; octal again
|
||||
mov ax,0o310 ; octal yet again
|
||||
mov ax,0q310 ; octal yet again
|
||||
mov ax,11001000b ; binary
|
||||
mov ax,1100_1000b ; same binary constant
|
||||
mov ax,1100_1000y ; same binary constant once more
|
||||
mov ax,0b1100_1000 ; same binary constant yet again
|
||||
mov ax,0y1100_1000 ; same binary constant yet again
|
||||
|
||||
%define u(x) __?utf16?__(x)
|
||||
%define w(x) __?utf32?__(x)
|
||||
|
||||
dw u('C:\WINDOWS'), 0 ; Pathname in UTF-16
|
||||
dd w(`A + B = \u206a`), 0 ; String in UTF-32
|
||||
|
||||
db -0.2 ; "Quarter precision"
|
||||
dw -0.5 ; IEEE 754r/SSE5 half precision
|
||||
dd 1.2 ; an easy one
|
||||
dd 1.222_222_222 ; underscores are permitted
|
||||
dd 0x1p+2 ; 1.0x2^2 = 4.0
|
||||
dq 0x1p+32 ; 1.0x2^32 = 4 294 967 296.0
|
||||
dq 1.e10 ; 10 000 000 000.0
|
||||
dq 1.e+10 ; synonymous with 1.e10
|
||||
dq 1.e-10 ; 0.000 000 000 1
|
||||
dt 3.141592653589793238462 ; pi
|
||||
do 1.e+4000 ; IEEE 754r quad precision
|
||||
|
||||
mov rax,__?float64?__(3.141592653589793238462)
|
||||
mov rax,0x400921fb54442d18
|
||||
|
||||
%define Inf __?Infinity?__
|
||||
%define NaN __?QNaN?__
|
||||
|
||||
dq +1.5, -Inf, NaN ; Double-precision constants
|
||||
dt 12_345_678_901_245_678p
|
||||
dt -12_345_678_901_245_678p
|
||||
dt +0p33
|
||||
dt 33p
|
||||
|
||||
dq b * (a // b) + (a %% b)
|
||||
|
||||
call (seg procedure):procedure
|
||||
call weird_seg:(procedure wrt weird_seg)
|
||||
|
||||
push dword 33
|
||||
push strict dword 33
|
||||
|
||||
times (label-$) db 0
|
||||
|
||||
label: db 'Where am I?'
|
||||
times (label-$+1) db 0
|
||||
label: db 'NOW where am I?'
|
||||
|
||||
label1 ; some code
|
||||
|
||||
.loop
|
||||
; some more code
|
||||
|
||||
jne .loop
|
||||
ret
|
||||
|
||||
label1: ; a non-local label
|
||||
.local: ; this is really label1.local
|
||||
..@foo: ; this is a special symbol
|
||||
label2: ; another non-local label
|
||||
.local: ; this is really label2.local
|
||||
|
||||
jmp ..@foo ; this will jump three lines up
|
||||
|
||||
|
||||
%define THIS_VERY_LONG_MACRO_NAME_IS_DEFINED_TO \
|
||||
THIS_VALUE
|
||||
|
||||
%define ctrl 0x1F &
|
||||
%define param(a,b) ((a)+(a)*(b))
|
||||
|
||||
mov byte [param(2,ebx)], ctrl 'D'
|
||||
mov byte [(2)+(2)*(ebx)], 0x1F & 'D'
|
||||
|
||||
%define a(x) 1+b(x)
|
||||
%define b(x) 2*x
|
||||
|
||||
mov ax,a(8)
|
||||
|
||||
%define foo (a,b) ; no arguments, (a,b) is the expansion
|
||||
%define bar(a,b) ; two arguments, empty expansion
|
||||
|
||||
%define ereg(foo,) e %+ foo
|
||||
mov eax,ereg(dx,cx)
|
||||
|
||||
%define xyzzy(=expr,&val) expr, str
|
||||
%define plugh(x) xyzzy(x,x)
|
||||
db plugh(3+5), `\0` ; Expands to: db 8, "3+5", `\0`
|
||||
|
||||
mov ax,Foo%[__?BITS?__] ; The Foo value
|
||||
%xdefine Bar Quux ; Expands due to %xdefine
|
||||
%define Bar %[Quux] ; Expands due to %[...]
|
||||
|
||||
|
||||
|
||||
%define BDASTART 400h ; Start of BIOS data area
|
||||
|
||||
struc tBIOSDA ; its structure
|
||||
.COM1addr RESW 1
|
||||
.COM2addr RESW 1
|
||||
; ..and so on
|
||||
endstruc
|
||||
|
||||
mov ax,BDASTART + tBIOSDA.COM1addr
|
||||
mov bx,BDASTART + tBIOSDA.COM2addr
|
||||
; Macro to access BIOS variables by their names (from tBDA):
|
||||
|
||||
%idefine Foo mov %?,%??
|
||||
|
||||
%idefine keyword $%?
|
||||
|
||||
%idefine pause $%? ; Hide the PAUSE instruction
|
||||
%define foo bar
|
||||
%undef foo
|
||||
|
||||
mov eax, foo
|
||||
%assign i i+1
|
||||
%defstr test TEST
|
||||
%define test 'TEST'
|
||||
%defstr PATH %!PATH ; The operating system PATH variable
|
||||
|
||||
%deftok test 'TEST'
|
||||
|
||||
%define test TEST
|
||||
|
||||
%define greedy(a,b,c+) a + 66 %, b * 3 %, c
|
||||
|
||||
db greedy(1,2) ; db 1 + 66, 2 * 3
|
||||
db greedy(1,2,3) ; db 1 + 66, 2 * 3, 3
|
||||
db greedy(1,2,3,4) ; db 1 + 66, 2 * 3, 3, 4
|
||||
db greedy(1,2,3,4,5) ; db 1 + 66, 2 * 3, 3, 4, 5
|
||||
|
||||
%macro silly 2
|
||||
%2: db %1
|
||||
%endmacro
|
||||
|
||||
silly 'a', letter_a ; letter_a: db 'a'
|
||||
silly 'ab', string_ab ; string_ab: db 'ab'
|
||||
silly {13,10}, crlf ; crlf: db 13,10
|
||||
%pragma preproc sane_empty_expansion
|
||||
|
||||
%macro mpar 1-*
|
||||
db %{3:5}
|
||||
db %{-1:-3}
|
||||
%endmacro
|
||||
|
||||
mpar 1,2,3,4,5,6
|
||||
|
||||
%macro die 0-1 "Painful program death has occurred."
|
||||
|
||||
writefile 2,%1
|
||||
mov ax,0x4c01
|
||||
int 0x21
|
||||
|
||||
%endmacro
|
||||
|
||||
%macro multipush 1-*
|
||||
|
||||
%rep %0
|
||||
push %1
|
||||
%rotate 1
|
||||
%endrep
|
||||
|
||||
j%-1 %%skip
|
||||
ret
|
||||
%%skip:
|
||||
|
||||
%endmacro
|
||||
|
||||
|
||||
%macro foo 1.nolist
|
||||
|
||||
%endmacro
|
||||
|
||||
%macro pushparam 1
|
||||
|
||||
%ifidni %1,ip
|
||||
call %%label
|
||||
%%label:
|
||||
%else
|
||||
push %1
|
||||
%endif
|
||||
|
||||
%endmacro
|
||||
|
||||
%assign i 0
|
||||
%rep 64
|
||||
inc word [table+2*i]
|
||||
%assign i i+1
|
||||
%endrep
|
||||
|
||||
|
||||
fibonacci:
|
||||
%assign i 0
|
||||
%assign j 1
|
||||
%rep 100
|
||||
%if j > 65535
|
||||
%exitrep
|
||||
%endif
|
||||
dw j
|
||||
%assign k j+i
|
||||
%assign i j
|
||||
%assign j k
|
||||
%endrep
|
||||
|
||||
fib_number equ ($-fibonacci)/2
|
||||
|
||||
|
||||
%include "macros.mac"
|
||||
|
||||
|
||||
%ifndef MACROS_MAC
|
||||
%define MACROS_MAC
|
||||
; now define some macros
|
||||
%endif
|
||||
|
||||
%pathsearch MyFoo "foo.bin"
|
||||
|
||||
%imacro incbin 1-2+ 0
|
||||
%pathsearch dep %1
|
||||
%depend dep
|
||||
incbin dep,%2
|
||||
%endmacro
|
||||
%use altreg
|
||||
%use 'altreg'
|
||||
|
||||
%push foobar
|
||||
|
||||
%macro repeat 0
|
||||
|
||||
%push repeat
|
||||
%$begin:
|
||||
|
||||
%endmacro
|
||||
|
||||
%macro until 1
|
||||
|
||||
j%-1 %$begin
|
||||
%pop
|
||||
|
||||
%endmacro
|
||||
|
||||
%define %$localmac 3
|
||||
|
||||
%macro else 0
|
||||
|
||||
%ifctx if
|
||||
%repl else
|
||||
jmp %$ifend
|
||||
%$ifnot:
|
||||
%else
|
||||
%error "expected `if' before `else'"
|
||||
%endif
|
||||
|
||||
%endmacro
|
||||
|
||||
%macro endif 0
|
||||
|
||||
%ifctx if
|
||||
%$ifnot:
|
||||
%pop
|
||||
%elifctx else
|
||||
%$ifend:
|
||||
%pop
|
||||
%else
|
||||
%error "expected `if' or `else' before `endif'"
|
||||
%endif
|
||||
|
||||
%endmacro
|
||||
|
||||
some_function:
|
||||
%push mycontext ; save the current context
|
||||
%stacksize small ; tell NASM to use bp
|
||||
%assign %$localsize 0 ; see text for explanation
|
||||
%local old_ax:word, old_dx:word
|
||||
|
||||
enter %$localsize,0 ; see text for explanation
|
||||
mov [old_ax],ax ; swap ax & bx
|
||||
mov cx,[old_dx]
|
||||
leave ; restore old bp
|
||||
ret ;
|
||||
|
||||
%pop ; restore original context
|
||||
|
||||
|
||||
%ifdef F1
|
||||
; do some setup
|
||||
%elifdef F2
|
||||
; do some different setup
|
||||
%else
|
||||
%error "Neither F1 nor F2 was defined."
|
||||
%endif
|
||||
%ifdef F1
|
||||
; do some setup
|
||||
%elifdef F2
|
||||
; do some different setup
|
||||
%else
|
||||
%warning "Neither F1 nor F2 was defined, assuming F1."
|
||||
%define F1
|
||||
%endif%if foo > 64
|
||||
%assign foo_over foo-64
|
||||
%error foo is foo_over bytes too large
|
||||
%endif
|
||||
|
||||
db __?NASM_VER?__
|
||||
|
||||
struc mytype
|
||||
mt_long: resd 1
|
||||
.str: resb 32
|
||||
endstruc
|
||||
|
||||
%use altreg
|
||||
|
||||
|
||||
%macro writefile 2+
|
||||
|
||||
[section .data]
|
||||
|
||||
%%str: db %2
|
||||
%%endstr:
|
||||
|
||||
__?SECT?__
|
||||
|
||||
mov dx,%%str
|
||||
mov cx,%%endstr-%%str
|
||||
mov bx,%1
|
||||
mov ah,0x40
|
||||
int 0x21
|
||||
|
||||
%endmacro
|
||||
|
||||
DEFAULT BND
|
||||
call foo ; BND will be prefixed
|
||||
nobnd call foo ; BND will NOT be prefixed
|
||||
|
||||
global _main
|
||||
_main:
|
||||
global hashlookup:function, hashtable:data
|
||||
|
||||
common intvar 4
|
||||
static foo
|
||||
foo:
|
||||
; codes
|
||||
|
||||
%pragma macho lprefix L_
|
||||
; The most common conventions
|
||||
%pragma output gprefix _
|
||||
%pragma output lprefix L_
|
||||
; ELF uses a different convention
|
||||
%pragma elf gprefix ; empty
|
||||
%pragma elf lprefix .L
|
||||
|
||||
section .pdata rdata align=4
|
||||
dd main wrt ..imagebase
|
||||
dd main_end wrt ..imagebase
|
||||
dd xmain wrt ..imagebase
|
||||
section .xdata rdata align=8
|
||||
xmain: db 9,0,0,0
|
||||
dd handler wrt ..imagebase
|
||||
section .drectve info
|
||||
db '/defaultlib:user32.lib /defaultlib:msvcrt.lib '
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
; Blank line
|
||||
loop sleep ; Label and operation
|
||||
incf 6,1 ; Operation with 2 parameters
|
||||
goto loop ; Operation with 1 parameter
|
||||
|
||||
#define X Y
|
||||
#defin ; incomplete
|
||||
#undefine X
|
||||
|
||||
number equ 5
|
||||
|
||||
label_#v((number + 1) * 5)_suffix equ 0x10
|
||||
|
||||
db .34,O'35',O'93',0xAf,0xady,a'a',a'ap,A'\'
|
||||
|
||||
any macro parm
|
||||
movlw parm
|
||||
endm
|
||||
any 33
|
||||
|
||||
; Shift reg left
|
||||
slf macro reg
|
||||
clrc
|
||||
rlf reg,f
|
||||
endm
|
||||
|
||||
; Scale W by “factor”. Result in “reg”, W unchanged.
|
||||
scale macro reg, factor
|
||||
if (factor == 1)
|
||||
movwf reg ; 1 X is easy
|
||||
else
|
||||
scale reg, (factor / 2) ; W * (factor / 2)
|
||||
slf reg,f ; double reg
|
||||
if ((factor & 1) == 1) ; if lo-bit set ..
|
||||
addwf reg,f ; .. add W to reg
|
||||
endif
|
||||
endif
|
||||
endm
|
||||
|
||||
scale tmp,D'10'
|
||||
|
||||
movwf tmp
|
||||
clrc
|
||||
rlf tmp,f
|
||||
addwf tmp,f
|
||||
|
||||
spin macro n
|
||||
movlw n
|
||||
addlw 0xff
|
||||
btfss STATUS,Z
|
||||
goto $-2
|
||||
endm
|
||||
|
||||
LOOP: BTFSS flag,0x00
|
||||
GOTO LOOP
|
||||
|
||||
|
||||
BTFSS flag,0x00
|
||||
GOTO $ - 1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
-- comment with FIXME alerts
|
||||
-- example code taken from https://en.wikipedia.org/wiki/ASN.1
|
||||
|
||||
FooProtocol DEFINITIONS ::= <beginfold id='1'>BEGIN</beginfold id='1'>
|
||||
<beginfold id='2'>/*</beginfold id='2'>* Multiline comment
|
||||
* with ### alerts
|
||||
<endfold id='2'>*/</endfold id='2'>
|
||||
FooQuestion ::= SEQUENCE <beginfold id='3'>{</beginfold id='3'>
|
||||
trackingNumber INTEGER(0..199),
|
||||
question IA5String
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
FooAnswer ::= SEQUENCE <beginfold id='3'>{</beginfold id='3'>
|
||||
questionNumber INTEGER(10..20),
|
||||
answer BOOLEAN
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
FooHistory ::= SEQUENCE <beginfold id='3'>{</beginfold id='3'>
|
||||
questions SEQUENCE(SIZE(0..10)) OF FooQuestion,
|
||||
answers SEQUENCE(SIZE(1..10)) OF FooAnswer,
|
||||
anArray SEQUENCE(SIZE(100)) OF INTEGER(0..1000)
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
<endfold id='1'>END</endfold id='1'>
|
||||
|
||||
-- exmaples from ERA FCB barcode.asn
|
||||
ASN-Module DEFINITIONS AUTOMATIC TAGS ::= <beginfold id='1'>BEGIN</beginfold id='1'>
|
||||
IssuingData ::= SEQUENCE <beginfold id='3'>{</beginfold id='3'>
|
||||
-- [...]
|
||||
-- currency of the price: ISO4217 currency codes
|
||||
currency IA5String (SIZE(3)) DEFAULT "EUR"
|
||||
-- [...]
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
<endfold id='1'>END</endfold id='1'>
|
||||
@@ -0,0 +1,58 @@
|
||||
<beginfold id='1'><%</beginfold id='1'> 'kate: hl ASP;
|
||||
<beginfold id='2'>if</beginfold id='2'> ( instr(request.servervariables("PATH_INFO"),"login.asp") <= 0 and instr(request.servervariables("PATH_INFO"),"inset") <= 0 and instr(request.servervariables("PATH_INFO"),"Data") <= 0 and instr(request.servervariables("PATH_INFO"),"dropDown") <= 0 ) then
|
||||
Session("originalRequestedPage") = Request.ServerVariables("PATH_INFO") & "?" & Request.ServerVariables("QUERY_STRING")
|
||||
<endfold id='2'>end if</endfold id='2'>
|
||||
|
||||
<beginfold id='3'>function</beginfold id='3'> countRecords( rsToCount )
|
||||
numRecs = 0
|
||||
|
||||
<beginfold id='4'>do</beginfold id='4'> until rsToCount.eof
|
||||
numRecs = numRecs + 1
|
||||
|
||||
rsToCount.movenext
|
||||
<endfold id='4'>loop</endfold id='4'>
|
||||
|
||||
rsToCount.close ' just to make sure nobody
|
||||
' tries to operate on the recordset,
|
||||
' which has already reached eof
|
||||
|
||||
countRecords = numRecs
|
||||
<endfold id='3'>end function</endfold id='3'>
|
||||
|
||||
<beginfold id='3'>function</beginfold id='3'> unique( rs, sortColumn ) ' return unique instances of text in sortColumn within rs
|
||||
dim sorted()
|
||||
|
||||
redim sorted(1)
|
||||
dim i
|
||||
i = 0
|
||||
<beginfold id='4'>do</beginfold id='4'> until rs.eof
|
||||
<beginfold id='2'>if</beginfold id='2'> (not find( rs(sortColumn), sorted )) then
|
||||
redim preserve sorted(i+1)
|
||||
sorted(i) = rs(sortColumn)
|
||||
i = i + 1
|
||||
<endfold id='2'>end if</endfold id='2'>
|
||||
rs.MoveNext
|
||||
<endfold id='4'>loop</endfold id='4'>
|
||||
|
||||
redim preserve sorted(i-1) ' the function will add an extra blank entry to the array
|
||||
|
||||
rs.Close ' close the recordset - we'll be using it again - and reset i - well be using it again, too
|
||||
|
||||
unique = sorted
|
||||
<endfold id='3'>end function</endfold id='3'>
|
||||
|
||||
<beginfold id='5'>sub</beginfold id='5'> testSub( variable ) ' do nothing impressive...
|
||||
dim newVar
|
||||
|
||||
newVar = variable
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> ( variable = true )
|
||||
response.end
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> <endfold id='1'>%></endfold id='1'>
|
||||
|
||||
<p>We are writing text.</p>
|
||||
<p class="stuff"><beginfold id='1'><%</beginfold id='1'>=newVar<endfold id='1'>%></endfold id='1'></p>
|
||||
<p>We have written text and outputted a variable.</p>
|
||||
|
||||
<beginfold id='1'><%</beginfold id='1'> <endfold id='2'>end if</endfold id='2'>
|
||||
<endfold id='5'>end sub</endfold id='5'> <endfold id='1'>%></endfold id='1'>
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/usr
|
||||
# AWK hl test
|
||||
|
||||
# <beginfold id='1'>BEGIN</beginfold id='1'> and <endfold id='1'>END</endfold id='1'> are also matched as patterns
|
||||
BEGIN <beginfold id='2'>{</beginfold id='2'>
|
||||
p = 0;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
/some pattern/ <beginfold id='2'>{</beginfold id='2'>
|
||||
p++;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
# / inside brackets is not considered end of expression
|
||||
# a loose division operator (/) is not mismatched as a pattern.
|
||||
$1 =~ /[^abc/]def/ || b == 3 / 5 <beginfold id='2'>{</beginfold id='2'>
|
||||
|
||||
gsub ( FILENAME );
|
||||
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
# TODO and FIXME also work in comments in Awk.
|
||||
|
||||
# Also backslash in patterns works.
|
||||
/\/usr\/bin\/awk/ <beginfold id='2'>{</beginfold id='2'> print "This is me"; <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
END <beginfold id='2'>{</beginfold id='2'>
|
||||
print p;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
function myfunc()
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
print 42
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
/abc/,/a[b]c/<beginfold id='2'>{</beginfold id='2'>
|
||||
# parameter with a regex
|
||||
if (match($0, /a/)) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
"x\ax\nx\ex\zx\023x\2x\xffx\xFf\xax\12x"
|
||||
|
||||
a =~ /[[:alpha:]]/
|
||||
a =~ /[xx[:alpha:]xx]/
|
||||
a =~ /[a-z[:alpha:]xx-]/
|
||||
a =~ /[]a]/
|
||||
a =~ /[-a]/
|
||||
a =~ /[^]a]/
|
||||
a =~ /[^-a]/
|
||||
a =~ /[a]a\/\n/
|
||||
# incomplete regex
|
||||
a =~ /[xx[:alph
|
||||
a = 23.2
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
@@ -0,0 +1,31 @@
|
||||
% test file for kate's bibtex syntax highlighting
|
||||
|
||||
@Article<beginfold id='1'>{</beginfold id='1'>artikel,
|
||||
author = {Me},
|
||||
title = {Something},
|
||||
journal = {JHEP},
|
||||
year = {2003},
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
@Book
|
||||
|
||||
<beginfold id='1'>{</beginfold id='1'>
|
||||
|
||||
boek,
|
||||
author = "Someone",
|
||||
title = "Something",
|
||||
journal = "Nucl. Phys. B",
|
||||
year = "2003",
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
This is ignored by BibTeX, no special highlighting
|
||||
%This is not a comment, it is just ignored (thanks to the people in #latex) :)
|
||||
|
||||
@string{test="lange string die ik niet vaak opnieuw wil intikken"}
|
||||
|
||||
@PhdThesis<beginfold id='1'>{</beginfold id='1'>thesis,
|
||||
author = {Me},
|
||||
title = {Dunno},
|
||||
school = {ITFA},
|
||||
year = {2005, hopefully},
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
@@ -0,0 +1,37 @@
|
||||
<indentfold><beginfold id='1'>"""</beginfold id='1'>module docstring<endfold id='1'>"""</endfold id='1'>
|
||||
|
||||
namespace My.NameSpace #optional namespace declaration
|
||||
|
||||
import Assembly.Reference #import statements
|
||||
|
||||
#followed by the Members of this module (classes, methods, etc.)
|
||||
class MyClass:
|
||||
pass
|
||||
|
||||
def domyfunction<beginfold id='2'>(</beginfold id='2'>it<endfold id='2'>)</endfold id='2'>:
|
||||
print<beginfold id='2'>(</beginfold id='2'>it<endfold id='2'>)</endfold id='2'>
|
||||
|
||||
#start "main" section that is executed when script is run
|
||||
x as int
|
||||
x = 3
|
||||
domyfunction<beginfold id='2'>(</beginfold id='2'>x<endfold id='2'>)</endfold id='2'>
|
||||
|
||||
#optional assembly attribute declarations used when compiling
|
||||
[assembly: AssemblyTitle<beginfold id='2'>(</beginfold id='2'>'foo'<endfold id='2'>)</endfold id='2'>]
|
||||
[assembly: AssemblyDescription<beginfold id='2'>(</beginfold id='2'>'bar'<endfold id='2'>)</endfold id='2'>]
|
||||
|
||||
import MyLibrary
|
||||
print <beginfold id='2'>(</beginfold id='2'>Version<endfold id='2'>)</endfold id='2'>
|
||||
doit<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'>
|
||||
|
||||
[Module]
|
||||
class MainClass:
|
||||
public static Version as string
|
||||
|
||||
static def constructor<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'>:
|
||||
Version = "0.1"
|
||||
|
||||
def doit<beginfold id='2'>(</beginfold id='2'><endfold id='2'>)</endfold id='2'>:
|
||||
#you can refer to "globals" from within your library, too:
|
||||
print<beginfold id='2'>(</beginfold id='2'>"This library's version is: "+MainClass.Version<endfold id='2'>)</endfold id='2'>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
Thread 1 "lab_dialog" received signal SIGSEGV, Segmentation fault.
|
||||
0x000055555555a279 in Ui_Window::setupUi (this=0x0, Window=0x7fffffffc350) at ./ui_window.h:56
|
||||
56 centralwidget = new QWidget(Window);
|
||||
|
||||
[Current thread is 1 (Thread 0x7ffff7edd840 (LWP 7267))]
|
||||
|
||||
Thread 3 (Thread 0x7fffe035e700 (LWP 2289)):
|
||||
#0 0x00007ffff565697b in poll () from /usr/lib/libc.so.6
|
||||
#1 0x00007ffff3a29613 in ?? () from /usr/lib/libglib-2.0.so.0
|
||||
#2 0x00007ffff3a2972e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
|
||||
#3 0x00007ffff69ae241 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
|
||||
#4 0x00007ffff695032b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
|
||||
#5 0x00007ffff675f72e in QThread::exec() () from /usr/lib/libQt5Core.so.5
|
||||
#6 0x00007fffeed1d416 in ?? () from /usr/lib/libQt5DBus.so.5
|
||||
#7 0x00007ffff6764acd in ?? () from /usr/lib/libQt5Core.so.5
|
||||
#8 0x00007ffff621308c in start_thread () from /usr/lib/libpthread.so.0
|
||||
#9 0x00007ffff5660e7f in clone () from /usr/lib/libc.so.6
|
||||
|
||||
Thread 2 (Thread 0x7fffebd8a700 (LWP 2287)):
|
||||
#0 0x00007ffff565697b in poll () from /usr/lib/libc.so.6
|
||||
#1 0x00007ffff011a180 in ?? () from /usr/lib/libxcb.so.1
|
||||
#2 0x00007ffff011be4b in xcb_wait_for_event () from /usr/lib/libxcb.so.1
|
||||
#3 0x00007fffef21382a in ?? () from /usr/lib/libQt5XcbQpa.so.5
|
||||
#4 0x00007ffff6764acd in ?? () from /usr/lib/libQt5Core.so.5
|
||||
#5 0x00007ffff621308c in start_thread () from /usr/lib/libpthread.so.0
|
||||
#6 0x00007ffff5660e7f in clone () from /usr/lib/libc.so.6
|
||||
|
||||
Thread 1 (Thread 0x7ffff7f80cc0 (LWP 2283)):
|
||||
#0 0x000055555555a279 in Ui_Window::setupUi (this=0x0, Window=0x7fffffffc350) at ./ui_window.h:56
|
||||
#1 0x0000555555558ea2 in Window::Window (this=0x7fffffffc350, parent=0x0) at ../window.cpp:22
|
||||
#2 0x0000555555558b85 in main (argc=1, argv=0x7fffffffc498) at ../main.cpp:20
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
name: Foo
|
||||
version: 1.0
|
||||
|
||||
if(os(darwin))
|
||||
optimization: False
|
||||
elif(os(freebsd))
|
||||
packages: freebsd/*.cabal
|
||||
else
|
||||
optimization: True
|
||||
|
||||
import: https://some.remote.source/subdir/cabal.config
|
||||
|
||||
import: relativepath/extra-project.project
|
||||
-- bla bla
|
||||
|
||||
import: /absolutepath/some-project.project
|
||||
|
||||
tested-with: GHC == 9.0.1
|
||||
, GHC == 8.10.4 -- bla bla
|
||||
, GHC == 8.8.4
|
||||
|
||||
tested-with:
|
||||
GHC == 9.0.1
|
||||
GHC == 8.10.4
|
||||
|
||||
tested-with: GHC == { 9.0.1, 8.10.4, 8.8.4 }
|
||||
|
||||
library attoparsec
|
||||
build-depends:
|
||||
, base ^>= 4.11.1.0
|
||||
, bytestring ^>= 0.10.2.0
|
||||
|
||||
cabal-version: 3.0
|
||||
name: haddock-library
|
||||
version: 1.6.0
|
||||
license: BSD-3-Clause
|
||||
|
||||
test-suite foo
|
||||
type: exitcode-stdio-1.0
|
||||
|
||||
-- bla bla
|
||||
library
|
||||
build-depends:
|
||||
, base ^>= 4.11.1.0
|
||||
, containers ^>= 0.4.2.1 || ^>= 0.5.0.0
|
||||
|
||||
library
|
||||
default-language: Haskell2010
|
||||
build-depends: base >= 4 && < 5
|
||||
exposed-modules: Foo
|
||||
extensions: ForeignFunctionInterface
|
||||
ghc-options: -Wall
|
||||
if os(windows)
|
||||
build-depends: Win32 >= 2.1 && < 2.6
|
||||
@@ -0,0 +1,112 @@
|
||||
*> These are equivalent.
|
||||
INVOKE my-class "foo" RETURNING var
|
||||
MOVE my-class::"foo" TO var *> Inline method invocation
|
||||
|
||||
ADD 1 TO x
|
||||
ADD 1, a, b TO x ROUNDED, y, z ROUNDED
|
||||
|
||||
ADD a, b TO c
|
||||
ON SIZE ERROR
|
||||
DISPLAY "Error"
|
||||
END-ADD
|
||||
|
||||
ADD a TO b
|
||||
NOT SIZE ERROR
|
||||
DISPLAY "No error"
|
||||
ON SIZE ERROR
|
||||
DISPLAY "Error"
|
||||
|
||||
RD sales-report
|
||||
PAGE LIMITS 60 LINES
|
||||
FIRST DETAIL 3
|
||||
CONTROLS seller-name.
|
||||
|
||||
01 TYPE PAGE HEADING.
|
||||
03 COL 1 VALUE "Sales Report".
|
||||
03 COL 74 VALUE "Page".
|
||||
03 COL 79 PIC Z9 SOURCE PAGE-COUNTER.
|
||||
|
||||
01 sales-on-day TYPE DETAIL, LINE + 1.
|
||||
03 COL 3 VALUE "Sales on".
|
||||
03 COL 12 PIC 99/99/9999 SOURCE sales-date.
|
||||
03 COL 21 VALUE "were".
|
||||
03 COL 26 PIC $$$$9.99 SOURCE sales-amount.
|
||||
|
||||
01 invalid-sales TYPE DETAIL, LINE + 1.
|
||||
03 COL 3 VALUE "INVALID RECORD:".
|
||||
03 COL 19 PIC X(34) SOURCE sales-record.
|
||||
|
||||
01 TYPE CONTROL HEADING seller-name, LINE + 2.
|
||||
03 COL 1 VALUE "Seller:".
|
||||
03 COL 9 PIC X(30) SOURCE seller-name.
|
||||
|
||||
PIC 99.
|
||||
PIC 9(7)V99.
|
||||
PIC 9(10). *> sads
|
||||
PIC 9(5)V9(2).
|
||||
PIC 9(5)
|
||||
PIC +++++
|
||||
PIC 99/99/9(4)
|
||||
PIC *(4)9.99
|
||||
PIC X(3)BX(3)BX(3)
|
||||
|
||||
OPEN INPUT sales, OUTPUT report-out
|
||||
INITIATE sales-report
|
||||
|
||||
PERFORM UNTIL 1 <> 1
|
||||
READ sales
|
||||
AT END
|
||||
EXIT PERFORM
|
||||
END-READ
|
||||
|
||||
VALIDATE sales-record
|
||||
IF valid-record
|
||||
GENERATE sales-on-day
|
||||
ELSE
|
||||
GENERATE invalid-sales
|
||||
END-IF
|
||||
END-PERFORM
|
||||
|
||||
TERMINATE sales-report
|
||||
CLOSE sales, report-out
|
||||
|
||||
EVALUATE TRUE ALSO desired-speed ALSO current-speed
|
||||
WHEN lid-closed ALSO min-speed THRU max-speed ALSO LESS THAN desired-speed
|
||||
PERFORM speed-up-machine
|
||||
WHEN lid-closed ALSO min-speed THRU max-speed ALSO GREATER THAN desired-speed
|
||||
PERFORM slow-down-machine
|
||||
WHEN lid-open ALSO ANY ALSO NOT ZERO
|
||||
PERFORM emergency-stop
|
||||
WHEN OTHER
|
||||
CONTINUE
|
||||
END-EVALUATE
|
||||
|
||||
//COBUCLG JOB (001),'COBOL BASE TEST', 00010000
|
||||
// CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1) 00020000
|
||||
//BASETEST EXEC COBUCLG 00030000
|
||||
//COB.SYSIN DD * 00040000
|
||||
00000* VALIDATION OF BASE COBOL INSTALL 00050000
|
||||
01000 IDENTIFICATION DIVISION. 00060000
|
||||
01100 <beginfold id='1'>PROGRAM-ID</beginfold id='1'>. 'HELLO'. 00070000
|
||||
02000 ENVIRONMENT DIVISION. 00080000
|
||||
02100 CONFIGURATION SECTION. 00090000
|
||||
02110 SOURCE-COMPUTER. GNULINUX. 00100000
|
||||
02120 OBJECT-COMPUTER. HERCULES. 00110000
|
||||
02200 SPECIAL-NAMES. 00120000
|
||||
02210 CONSOLE IS CONSL. 00130000
|
||||
03000 DATA DIVISION. 00140000
|
||||
04000 PROCEDURE DIVISION. 00150000
|
||||
04100 00-MAIN. 00160000
|
||||
04110 DISPLAY 'HELLO, WORLD' UPON CONSL. 00170000
|
||||
04900 STOP RUN. 00180000
|
||||
//LKED.SYSLIB DD DSNAME=SYS1.COBLIB,DISP=SHR 00190000
|
||||
// DD DSNAME=SYS1.LINKLIB,DISP=SHR 00200000
|
||||
//GO.SYSPRINT DD SYSOUT=A 00210000
|
||||
// 00220000
|
||||
|
||||
*> COBOL with embedded SQL.
|
||||
*> Normally for extensions pco, scb and sqb, but currently integrated into COBOL
|
||||
<beginfold id='2'>EXEC SQL</beginfold id='2'>
|
||||
select count(*) from abc
|
||||
<endfold id='2'>END-EXEC</endfold id='2'>
|
||||
ADD 1 TO x
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
<beginfold id='1'><!---</beginfold id='1'> ColdFusion Sample File <endfold id='1'>---></endfold id='1'>
|
||||
<beginfold id='1'><!---</beginfold id='1'> Source: https://helpx.adobe.com/coldfusion/developing-applications/the-cfml-programming-language/using-arrays-and-structures/structure-examples.html <endfold id='1'>---></endfold id='1'>
|
||||
|
||||
<head>
|
||||
<title>Add New Employees</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Add New Employees</h1>
|
||||
<beginfold id='1'><!---</beginfold id='1'> Action page code for the form at the bottom of this page. <endfold id='1'>---></endfold id='1'>
|
||||
|
||||
<beginfold id='1'><!---</beginfold id='1'> Establish parameters for first time through <endfold id='1'>---></endfold id='1'>
|
||||
<cfparam name="Form.firstname" default="">
|
||||
<cfparam name="Form.lastname" default="">
|
||||
<cfparam name="Form.email" default="">
|
||||
<cfparam name="Form.phone" default="">
|
||||
<cfparam name="Form.department" default="">
|
||||
|
||||
<beginfold id='1'><!---</beginfold id='1'> If at least the firstname form field is passed, create
|
||||
a structure named employee and add values. <endfold id='1'>---></endfold id='1'>
|
||||
<cfif #Form.firstname# eq "">
|
||||
<p>Please fill out the form.</p>
|
||||
<cfelse>
|
||||
<cfoutput>
|
||||
<beginfold id='2'><cfscript</beginfold id='2'>>
|
||||
employee=StructNew();
|
||||
employee.firstname = Form.firstname;
|
||||
employee.lastname = Form.lastname;
|
||||
employee.email = Form.email;
|
||||
employee.phone = Form.phone;
|
||||
employee.department = Form.department;
|
||||
<endfold id='2'></cfscript></endfold id='2'>
|
||||
|
||||
<beginfold id='1'><!---</beginfold id='1'> Display results of creating the structure. <endfold id='1'>---></endfold id='1'>
|
||||
First name is #StructFind(employee, "firstname")#<br>
|
||||
Last name is #StructFind(employee, "lastname")#<br>
|
||||
EMail is #StructFind(employee, "email")#<br>
|
||||
Phone is #StructFind(employee, "phone")#<br>
|
||||
Department is #StructFind(employee, "department")#<br>
|
||||
</cfoutput>
|
||||
|
||||
<beginfold id='1'><!---</beginfold id='1'> Call the custom tag that adds employees. <endfold id='1'>---></endfold id='1'>
|
||||
<cf_addemployee empinfo="#employee#">
|
||||
</cfif>
|
||||
|
||||
<beginfold id='1'><!---</beginfold id='1'> The form for adding the new employee information <endfold id='1'>---></endfold id='1'>
|
||||
<hr>
|
||||
<form action="newemployee.cfm" method="Post">
|
||||
First Name:
|
||||
<input name="firstname" type="text" hspace="30" maxlength="30"><br>
|
||||
Last Name:
|
||||
<input name="lastname" type="text" hspace="30" maxlength="30"><br>
|
||||
EMail:
|
||||
<input name="email" type="text" hspace="30" maxlength="30"><br>
|
||||
Phone:
|
||||
<input name="phone" type="text" hspace="20" maxlength="20"><br>
|
||||
Department:
|
||||
<input name="department" type="text" hspace="30" maxlength="30"><br>
|
||||
|
||||
<input type="Submit" value="OK">
|
||||
</form>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<cfoutput>
|
||||
Error. No employee data was passed.<br>
|
||||
</cfoutput>
|
||||
<cfexit method="ExitTag">
|
||||
<cfelse>
|
||||
<beginfold id='1'><!---</beginfold id='1'> Add the employee <endfold id='1'>---></endfold id='1'>
|
||||
<cfquery name="AddEmployee" datasource="cfdocexamples">
|
||||
INSERT INTO Employees
|
||||
(FirstName, LastName, Email, Phone, Department)
|
||||
VALUES (
|
||||
'#attributes.empinfo.firstname#' ,
|
||||
'#attributes.empinfo.lastname#' ,
|
||||
'#attributes.empinfo.email#' ,
|
||||
'#attributes.empinfo.phone#' ,
|
||||
'#attributes.empinfo.department#' )
|
||||
</cfquery>
|
||||
</cfif>
|
||||
<cfoutput>
|
||||
<hr>Employee Add Complete
|
||||
</cfoutput>
|
||||
|
||||
<beginfold id='1'><!---</beginfold id='1'> temperature.cfc <endfold id='1'>---></endfold id='1'>
|
||||
<cfcomponent>
|
||||
<cffunction name="FtoC" access="public" returntype="numeric">
|
||||
<cfargument name="fahrenheit" required="yes" type="numeric" />
|
||||
<cfset answer= (fahrenheit - 32)*100/180 />
|
||||
<cfreturn answer />
|
||||
</cffunction>
|
||||
</cfcomponent>
|
||||
<beginfold id='1'><!---</beginfold id='1'> test.cfm <endfold id='1'>---></endfold id='1'>
|
||||
<cfset fDegrees = 212 />
|
||||
<cfinvoke component="temperature" method="FtoC" returnvariable="result">
|
||||
<cfinvokeargument name="fahrenheit" value="#fDegrees#" />
|
||||
</cfinvoke>
|
||||
<cfoutput>#fDegrees#°F = #result#°C</cfoutput> <br />
|
||||
|
||||
<cfset person = CreateObject("component", "Person") />
|
||||
@@ -0,0 +1,47 @@
|
||||
PROGRAM testtest;
|
||||
|
||||
|
||||
INTERFACE
|
||||
|
||||
extern inout int inputs_int[];
|
||||
extern out int nur_out[];
|
||||
extern in int nur_in[];
|
||||
|
||||
CODE
|
||||
|
||||
function jetzt_mach_schon(in int grenze, out int fak)<beginfold id='1'>{</beginfold id='1'>
|
||||
int temp, counter;
|
||||
counter=grenze;
|
||||
temp=1;
|
||||
while(counter>1)
|
||||
temp*=(counter--);
|
||||
fak=temp;
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
function mach_mal(inout int i)<beginfold id='1'>{</beginfold id='1'>
|
||||
if(i==3) i=6;
|
||||
else if(i==4) i=24;
|
||||
else if(i>=5) jetzt_mach_schon(i,i);
|
||||
// 1 und 2: gleich.
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
function mach_nochmal(in int k1, out int k2, in int vektor)<beginfold id='1'>{</beginfold id='1'>
|
||||
int4 hossa;
|
||||
hossa=k1;
|
||||
int4 hasso;
|
||||
hasso=-vektor;
|
||||
|
||||
k2=(hasso|hossa>k1)?k1:-k1; //parse error before `|'
|
||||
// k2=(hasso||hossa>k1)?k1:-k1; //only works on expressions of equal dimension
|
||||
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
CONTROL
|
||||
forall (int i in inputs_int:1D) do <beginfold id='1'>{</beginfold id='1'>
|
||||
mach_mal(i);
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
forall (int j in inputs_int:1D;
|
||||
int i in nur_out:1D;
|
||||
int vektor in nur_in:1D) do <beginfold id='1'>{</beginfold id='1'>
|
||||
mach_nochmal(j,i, vektor);
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
@@ -0,0 +1,48 @@
|
||||
version 12.2
|
||||
service timestamps debug datetime msec
|
||||
service timestamps log datetime msec
|
||||
no service password-encryption
|
||||
|
||||
! bla bla
|
||||
hostname R-site2
|
||||
|
||||
logging queue-limit 100
|
||||
no logging console
|
||||
enable secret 5 $1$UzZM$BTdJlwFCg63tUdyLmq6cr0
|
||||
|
||||
username admin password 0 Yas!8^VB5q$yZ53C35#nC
|
||||
ip subnet-zero
|
||||
|
||||
no ip domain lookup
|
||||
ip domain name solea2.local
|
||||
ip dhcp excluded-address 10.1.22.200 10.1.22.254
|
||||
|
||||
ip dhcp pool Administrateur
|
||||
network 10.1.10.0 255.255.255.0
|
||||
dns-server 8.8.8.8
|
||||
default-router 10.1.10.254
|
||||
|
||||
crypto map VPNSOLEA 20 ipsec-isakmp
|
||||
set peer 192.168.141.4
|
||||
set transform-set SETVPN
|
||||
match address 110
|
||||
|
||||
interface FastEthernet0/0.22
|
||||
encapsulation dot1Q 22
|
||||
ip address 10.1.22.254 255.255.255.0
|
||||
ip nat inside
|
||||
|
||||
access-list 110 permit ip 10.1.0.0 0.0.255.255 10.0.0.0 0.0.255.255
|
||||
|
||||
route-map nonat permit 20
|
||||
match ip address 150
|
||||
|
||||
line con 0
|
||||
password 57vmLD3
|
||||
line aux 0
|
||||
line vty 0 4
|
||||
login local
|
||||
transport input ssh
|
||||
line vty 5 15
|
||||
login local
|
||||
transport input ssh
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
# This CMakeLists.txt doesn't do anything useful,
|
||||
# but it shoudl demonstrate the cmake syntax highlighting
|
||||
#
|
||||
# Alex Turbov <i.zaufi@gmail.com>
|
||||
#
|
||||
|
||||
<beginfold id='1'>#[[.rst:</beginfold id='1'>
|
||||
Demo
|
||||
----
|
||||
|
||||
This is an **RST** documentation.
|
||||
|
||||
<indentfold>::
|
||||
|
||||
# Sample code block
|
||||
blah-blah
|
||||
|
||||
</indentfold>But we are about to test CMake here ;-)
|
||||
|
||||
<endfold id='1'>#]]</endfold id='1'>
|
||||
|
||||
cmake_policy(VERSION 3.11)
|
||||
|
||||
project(
|
||||
Demo VERSION 1.0
|
||||
DESCRIPTION "For unit testing purposes"
|
||||
# NOTE that particular languages is a separate style
|
||||
# to highlight "special" (well known values)
|
||||
LANGUAGES C CXX
|
||||
)
|
||||
|
||||
set(SOME_TRUE_OPTION TRUE) # `true` value
|
||||
# `false` value and "internal" variable
|
||||
set(_ANOTHER_FALSE_OPTION OFF CACHE INTERNAL "Internal option")
|
||||
|
||||
#BEGIN Message block
|
||||
message(FATAL_ERROR "Ordinal message do ${VARIABLE_EXPANSION}")
|
||||
message(AUTHOR_WARNING "... standard variables have a dedicated style")
|
||||
message(SEND_ERROR "e.g. ${PROJECT_DESCRIPTION} or ${CMAKE_COMMAND}")
|
||||
message(
|
||||
STATUS <beginfold id='2'>[=[</beginfold id='2'>
|
||||
Raw messages do not do ${VARIABLES_EXPANSION} or \n
|
||||
escape symbols highlighting...
|
||||
<endfold id='2'>]=]</endfold id='2'>
|
||||
)
|
||||
#END Message block
|
||||
|
||||
# ATTENTION Every command highlight only its own named keywords...
|
||||
# Also, note aliased (most of the time imported) targets higlighted as well
|
||||
add_library(Foo::foo IMPORTED GLOBAL)
|
||||
set(KW_HL IMPORTED GLOBAL) # `IMPORTED` and `GLOBAL` are not highlighted here!
|
||||
|
||||
# Properties are separate ("special value") style
|
||||
set_target_properties(Foo::foo PROPERTIES LOCATION "${FOO_LIBRARY}")
|
||||
|
||||
# Generator expressions
|
||||
target_compile_definitions(
|
||||
# NOTE Ok w/ CMake >= 3.11
|
||||
Foo::foo
|
||||
$<$<PLATFORM_ID:Windows>:WINDOWS_FOO>
|
||||
$<$<PLATFORM_ID:Linux>:
|
||||
LINUX_FOO
|
||||
$<$<BOOL:${_has_foo}>:SOME_FOO_PATH=${PROJECT_BINARY_DIR}/foo>
|
||||
>
|
||||
)
|
||||
|
||||
<beginfold id='1'>#[=======================================================================[.rst:</beginfold id='1'>
|
||||
.. cmake:command:: my_fun
|
||||
|
||||
*RST* documentation ``can`` refer to :cmake:command:`any_commands` or
|
||||
:cmake:variable:`variables`...
|
||||
|
||||
<indentfold>.. code-block:: cmake
|
||||
:caption: **Synopsys**
|
||||
|
||||
my_fun([ANYTHING...])
|
||||
|
||||
</indentfold><endfold id='1'>#]=======================================================================]</endfold id='1'>
|
||||
<beginfold id='3'>function</beginfold id='3'>(my_fun)
|
||||
# TODO Add implementation
|
||||
<endfold id='3'>endfunction</endfold id='3'>()
|
||||
|
||||
my_fun(
|
||||
# Custom functions do not highlight "standard" named args ...
|
||||
PUBLIC LOCATION PARENT_SCOPE
|
||||
# only some well-known values ...
|
||||
smth-NOTFOUND ON
|
||||
# and standard variables
|
||||
PROJECT_VERSION
|
||||
# or substitutions
|
||||
$ENV{HOME} OR ${_internal_var_is_grey}
|
||||
)
|
||||
|
||||
# I dont'recall exactly, but there was some bug with `if`...
|
||||
<beginfold id='4'>if</beginfold id='4'>((A AND "${B}") OR C OR (var MATCHES "regex"))
|
||||
# Anyway... it is Ok nowadays ;-)
|
||||
|
||||
elseif(POLICY CMP066)
|
||||
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cc)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE
|
||||
Qt5::Core
|
||||
$<$<BOOL:${HAS_FOO}>:Foo::foo>
|
||||
)
|
||||
|
||||
<endfold id='4'>endif</endfold id='4'>()
|
||||
|
||||
# In each function call below, all 3 named parameter lines should apply the same highlighting.
|
||||
add_custom_command(
|
||||
COMMAND true
|
||||
COMMAND (true)
|
||||
COMMAND true
|
||||
)
|
||||
add_custom_target(TargetName
|
||||
WORKING_DIRECTORY somedir
|
||||
COMMAND (true)
|
||||
BYPRODUCTS somefile
|
||||
)
|
||||
execute_process(
|
||||
COMMAND true
|
||||
COMMAND (true)
|
||||
COMMAND true
|
||||
)
|
||||
add_test(
|
||||
NAME sometest
|
||||
COMMAND (true)
|
||||
WORKING_DIRECTORY somedir
|
||||
)
|
||||
|
||||
# nested parentheses
|
||||
<beginfold id='4'>if</beginfold id='4'>( true AND ( false OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ) )
|
||||
<endfold id='4'>endif</endfold id='4'>()
|
||||
@@ -0,0 +1,584 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
#include "assert.h"
|
||||
#include "assert.hpp" // abc
|
||||
#include "path/assert.hpp"
|
||||
#include "assert.h"a
|
||||
#include "assert.h" a
|
||||
#include <cassert>a
|
||||
#include <cassert> a
|
||||
#include FOO() error
|
||||
#include_next <cassert> a
|
||||
#include_next <cassert> <beginfold id='1'>/*</beginfold id='1'> a
|
||||
<endfold id='1'>*/</endfold id='1'> b
|
||||
#include PATH_IN_MACRO
|
||||
#include PATH_IN_MACRO()
|
||||
#include PATH_IN_MACRO(a, b)
|
||||
|
||||
#define SOME_VAR 1
|
||||
#<beginfold id='2'></beginfold id='2'>ifdef SOME_VAR
|
||||
|
||||
#define MULTILINE_MACRO one \
|
||||
two \
|
||||
three
|
||||
|
||||
# define MULTILINE_MACRO_TEXT \
|
||||
<beginfold id='1'>/*</beginfold id='1'> NOTE The contents of macro is too green :D <endfold id='1'>*/</endfold id='1'> \
|
||||
char const s[] = "a\\b" \
|
||||
"c\nd" \
|
||||
std::uint##x##_t \
|
||||
std::vector<beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'><T> \
|
||||
std::chrono::<beginfold id='1'>/*</beginfold id='1'>milli<endfold id='1'>*/</endfold id='1'>seconds
|
||||
|
||||
|
||||
# define VARIADIC(a, ...) \
|
||||
f(a##a) \
|
||||
f(__VA_ARGS__) \
|
||||
f(#__VA_ARGS__) \
|
||||
f(__VA_ARGS__) \
|
||||
f(0 __VA_OPT__(,) __VA_ARGS__) \
|
||||
x __VA_OPT__(= { __VA_ARGS__ })
|
||||
|
||||
# define MACRO() BAD \ ESCAPED
|
||||
|
||||
# error dds
|
||||
# warning dds
|
||||
# line 2 "file.cpp"
|
||||
# define A(x, y) x##y x#y
|
||||
// OK(L, a) -> L"a"
|
||||
# define OK(x, y) x###y
|
||||
# define BAD(x, y) x####y
|
||||
# define A <beginfold id='1'>/*</beginfold id='1'> multi line
|
||||
with comment <endfold id='1'>*/</endfold id='1'> expr
|
||||
# define A <beginfold id='1'>/*</beginfold id='1'> multi line
|
||||
with comment <endfold id='1'>*/</endfold id='1'>
|
||||
23
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> // x
|
||||
#42 // gcc extension = #line 42
|
||||
|
||||
// error
|
||||
#wrong
|
||||
# wrong
|
||||
#<endfold id='2'>endif</endfold id='2'> x
|
||||
#<beginfold id='2'></beginfold id='2'>if DS()
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> x
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> <beginfold id='1'>/*</beginfold id='1'> <endfold id='1'>*/</endfold id='1'>x
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> <beginfold id='1'>/*</beginfold id='1'> x
|
||||
y <endfold id='1'>*/</endfold id='1'> z
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
|
||||
// check that _XXX defines work, bug 397766
|
||||
#<beginfold id='2'></beginfold id='2'>ifndef _HEADER_GUARD
|
||||
#define _HEADER_GUARD 1
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
#<beginfold id='2'></beginfold id='2'>ifdef _HEADER_GUARD
|
||||
#<beginfold id='2'></beginfold id='2'>if (_HEADER_GUARD >= 1)
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
|
||||
static int g_global;
|
||||
|
||||
template<class T, typename U, template<class> class = std::is_pointer>
|
||||
struct class1
|
||||
: private std::vector<T>, public U
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
class1()
|
||||
try
|
||||
: _member1(xxx)
|
||||
<beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>
|
||||
catch(...)
|
||||
<beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>
|
||||
|
||||
class1(class1&&) = default;
|
||||
|
||||
~class1()
|
||||
<beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>
|
||||
|
||||
void foo() <beginfold id='3'>{</beginfold id='3'> return; <endfold id='3'>}</endfold id='3'>
|
||||
void foo() const <beginfold id='3'>{</beginfold id='3'> return; <endfold id='3'>}</endfold id='3'>
|
||||
void foo() noexcept <beginfold id='3'>{</beginfold id='3'> return; <endfold id='3'>}</endfold id='3'>
|
||||
void foo() const noexcept <beginfold id='3'>{</beginfold id='3'> return; <endfold id='3'>}</endfold id='3'>
|
||||
virtual void foo() const noexcept <beginfold id='3'>{</beginfold id='3'> return; <endfold id='3'>}</endfold id='3'>
|
||||
static void foo() <beginfold id='3'>{</beginfold id='3'> return; <endfold id='3'>}</endfold id='3'>
|
||||
constexpr static void foo() const
|
||||
noexcept(noexcept(std::is_pointer<U>::value)) override
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
xxx::template ttt<U>::type <beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>;
|
||||
xxx.template get<U>();
|
||||
xxx.std::rdbuf();
|
||||
auto x = C<'a'> + y;
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
int operator->*(T (C::*m)(int));
|
||||
operator value_t ();
|
||||
|
||||
private:
|
||||
protected:
|
||||
public:
|
||||
value_type _member1; // NOTE internal ?
|
||||
value_type __internal;
|
||||
value_type internal__;
|
||||
value_type _M_internal;
|
||||
value_t member2_;
|
||||
value_type m_member3;
|
||||
|
||||
static int s_static;
|
||||
static constexpr int s_static;
|
||||
static inline int s_static;
|
||||
static inline constexpr int s_static;
|
||||
<endfold id='3'>}</endfold id='3'>;
|
||||
|
||||
constexpr struct : xyz
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
using xyz::xyz;
|
||||
using xyz::operator=;
|
||||
|
||||
int a : 1;
|
||||
int b : 7;
|
||||
<endfold id='3'>}</endfold id='3'> x <beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>;
|
||||
|
||||
template<class T>
|
||||
using is_pointer = std::is_pointer<T>::type;
|
||||
|
||||
template<class T>
|
||||
constexpr auto is_pointer_v = std::is_pointer<T>::value;
|
||||
|
||||
uint64_t namespaces()
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
std::vector<T>;
|
||||
boost::vector<T>;
|
||||
detail::vector<T>;
|
||||
details::vector<T>;
|
||||
aux::vector<T>;
|
||||
internals::vector<T>;
|
||||
other::vector<T>;
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
task<> tcp_echo_server() <beginfold id='3'>{</beginfold id='3'>
|
||||
char data[1024];
|
||||
for (;;) <beginfold id='3'>{</beginfold id='3'>
|
||||
size_t n = co_await socket.async_read_some(buffer(data));
|
||||
co_await async_write(socket, buffer(data, n));
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 1
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 0
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 1
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#elif</beginfold id='2'> 1
|
||||
double foo(const A);
|
||||
#elif 0
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 0
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#elif 1</beginfold id='2'>
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#elif</beginfold id='2'> 0
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 0
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#elif</beginfold id='2'> a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif 0
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#elif</beginfold id='2'> a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 0 // blah blah
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#elif 1 </beginfold id='2'>// blah blah
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 0 || a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 1 || a
|
||||
double foo(const A);
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 0 && a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 1 && a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> // else
|
||||
double foo(const A);
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif 0
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif 1
|
||||
double foo(const A);
|
||||
<endfold id='2'>#endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if a
|
||||
double foo(const A);
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif a
|
||||
double foo(const A);
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
int bar(void*p, void * pp)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
# <beginfold id='2'></beginfold id='2'>if 0
|
||||
double foo();
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'># else</beginfold id='2'> // else
|
||||
double foo();
|
||||
<endfold id='2'># endif</endfold id='2'> // end
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if abc 0
|
||||
double foo();
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if xxx
|
||||
double foo();
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'>
|
||||
double foo();
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if xxx
|
||||
double foo();
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif xxx // elseif
|
||||
double foo();
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif xxx // elseif
|
||||
double foo();
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
// error
|
||||
#
|
||||
#d
|
||||
# d
|
||||
#<beginfold id='2'></beginfold id='2'>if
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
#<beginfold id='2'></beginfold id='2'>ifndef
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
#<beginfold id='2'></beginfold id='2'>ifdef 0
|
||||
#<endfold id='2'>endif</endfold id='2'> // end
|
||||
|
||||
static uint64_t intWithSuffix = 42ull;
|
||||
static long intWithSuffixAndPrefix = 0b0101L;
|
||||
static int octNum = 07232;
|
||||
static int invalidOctNum = 09231;
|
||||
static uint64_t hexNum = 0xDEADBEEF42;
|
||||
static uint64_t invalidHexNum = 0xGLDFKG;
|
||||
static char binNum = 0b0101010;
|
||||
|
||||
static int64_t intWithSuffix = -42LL;
|
||||
static long intWithSuffixAndPrefix = -0b0101L;
|
||||
static int octNum = -07232;
|
||||
static int invalidOctNum = -09231;
|
||||
static int64_t hexNum = -0xDEADBEEF42;
|
||||
static int64_t invalidHexNum = -0xGLDFKG;
|
||||
static char binNum = -0b0101010;
|
||||
|
||||
static uint64_t intWithSuffixWithSep = 4'2ull;
|
||||
static long intWithSuffixAndPrefixWithSep = 0b0'10'1L;
|
||||
static int octNumWithSep = 07'232;
|
||||
static int invalidOctNumWithSep = 09'23'1;
|
||||
static uint64_t hexNumWithSep = 0xD'EAD'BE'EF'42;
|
||||
static uint64_t invalidHexNumWithSep = 0xGLD'FKG;
|
||||
static char binNumWithSep = 0b0'1010'10;
|
||||
|
||||
static uint64_t invalidSep = 42'ull;
|
||||
static uint64_t invalidSep = 42';
|
||||
|
||||
static double d1 = 42.;
|
||||
static double d2 = .42;
|
||||
static double d2a = -0.49;
|
||||
static double d2b = -0.09;
|
||||
static double d3 = 42.3e1;
|
||||
static double d4 = .2e-12;
|
||||
static double d5 = 32.e+12;
|
||||
static double invalidD1 = 32.e+a12;
|
||||
static float floatQualifier = 23.123f;
|
||||
// Hexadecimal floating point (c++17)
|
||||
static double d6 = 0x1ffp10;
|
||||
static double d7 = 0X0p-1;
|
||||
static double d8 = 0x1.p0;
|
||||
static double d9 = 0xf.p-1L;
|
||||
static double d10 = 0x0.123p-1;
|
||||
static double d11 = 0xa.bp10l;
|
||||
static double invalidD2 = 0x0.123p-a;
|
||||
static float floatQualifier = 0xf.p-1f;
|
||||
|
||||
60min; // c++17
|
||||
60.min;
|
||||
60.3min;
|
||||
0x1ffp10min;
|
||||
2us
|
||||
2d; // c++20
|
||||
23._f
|
||||
23._fd
|
||||
2.3_f
|
||||
2.3_fd
|
||||
2._f
|
||||
2._fd
|
||||
2e4_f
|
||||
2e4_fd
|
||||
|
||||
// error
|
||||
23.fd
|
||||
2e_fd
|
||||
2e
|
||||
1.y
|
||||
1.0_E+2.0
|
||||
1.0_E +2.0 // ok
|
||||
1_p+2
|
||||
1_p +2 // ok
|
||||
4s.count()
|
||||
4s. count()
|
||||
4s .count() // ok
|
||||
|
||||
// float suffix
|
||||
1.2f
|
||||
1.2f3
|
||||
1.2f32 // C++23
|
||||
12f32
|
||||
12BF32
|
||||
12BF16
|
||||
12.BF16 // C++23
|
||||
|
||||
static bool yes = true;
|
||||
static bool no = false;
|
||||
|
||||
// *char*
|
||||
static const char c1 = 'c';
|
||||
static const char c1a = u8'c'; // utf-8 char (c++17)
|
||||
static const char16_t c1b = u'c';
|
||||
static const char32_t c1c = U'c';
|
||||
static const wchar_t c1d = L'c';
|
||||
static const char c2 = '\n';
|
||||
static const char c2a = '\120'; // octal
|
||||
static const char c2b = '\x1f'; // hex
|
||||
static const char c2c = '\'';
|
||||
static const char c2d = '\\';
|
||||
static const wchar_t c2e = L'\x1ff'; // hex
|
||||
static const wchar_t c2e = U'\x1fffffff'; // hex
|
||||
// error
|
||||
'\x123';
|
||||
'\u1234';
|
||||
'\U12345678';
|
||||
U'\u12345';
|
||||
u'\u123';
|
||||
U'\U1234567';
|
||||
U'\U123456789';
|
||||
U'\x123456789';
|
||||
|
||||
// string
|
||||
static const char* c3 = "string";
|
||||
static const char* c4 = "\"string\n\t\012\x12\"";
|
||||
static const char* c5 = "multiline \
|
||||
string";
|
||||
static const char* c6 = "multifragment" "other""string";
|
||||
static const char* c6a = u8"string";
|
||||
static const char16_t* c6b = u"string";
|
||||
static const char32_t* c6c = U"string";
|
||||
static const wchar_t* c6d = L"string";
|
||||
static const char* rawString1 = R<beginfold id='4'>"(</beginfold id='4'>string<endfold id='4'>)"</endfold id='4'>;
|
||||
static const char* rawString1a = u8R<beginfold id='4'>"(</beginfold id='4'>string<endfold id='4'>)"</endfold id='4'>;
|
||||
static const char16_t* rawString1b = uR<beginfold id='4'>"(</beginfold id='4'>string<endfold id='4'>)"</endfold id='4'>;
|
||||
static const char32_t* rawString1c = UR<beginfold id='4'>"(</beginfold id='4'>string<endfold id='4'>)"</endfold id='4'>;
|
||||
static const wchar_t* rawString1d = LR<beginfold id='4'>"(</beginfold id='4'>string\nstring<endfold id='4'>)"</endfold id='4'>;
|
||||
static const char* rawString2 = R<beginfold id='4'>"ab(</beginfold id='4'>string\nstring%s)ab "<endfold id='4'>)ab"</endfold id='4'>;
|
||||
static const char* rawString3 = R<beginfold id='4'>"ab(</beginfold id='4'>string
|
||||
string%<endfold id='4'>)ab"</endfold id='4'>;
|
||||
" %d %df fd" U"ds %d" R<beginfold id='4'>"(</beginfold id='4'>a%d<endfold id='4'>)"</endfold id='4'>;
|
||||
"\x{12343} \x{1} \o{12121} \u{1221a} \N{LATIN CAPITAL LETTER A WITH MACRON}"
|
||||
"\x123xsk";
|
||||
u"\x123xsk";
|
||||
// error
|
||||
u8"\x123xsk";
|
||||
"\x{123x43} \o{121821} \u{12x21as} \N{LATIN CAPITAL letter A WITH MACRON}"
|
||||
|
||||
// printf format
|
||||
"a%10sa%-10sa%*sa%-10.*sa%-*.*sa"
|
||||
"a%ca%*ca%%a%ia%da%.6ia%.0ia%+ia%ia%xa%#xa"
|
||||
"a%.0fa%.32fa%05.2fa%.2fa%5.2fa%Ea%aa"
|
||||
// std::format
|
||||
"a{{:6}}a{}a{:6}a{:*<6}a{:6d}a"
|
||||
"a{0:}a{0:+}a{0:-}a{0: }a"
|
||||
"a{:+06d}a{:#06x}a{:<06}a"
|
||||
"a{:{}}a{0:{1}.{2}f}a"
|
||||
;
|
||||
|
||||
// UDL (c++11)
|
||||
|
||||
operator""_a(const char*);
|
||||
operator ""_a(const char*);
|
||||
operator "" _a(const char*);
|
||||
// invalid suffix
|
||||
operator "" a(const char*);
|
||||
operator ""a(const char*);
|
||||
operator""a(const char*);
|
||||
|
||||
"string"_s; // user
|
||||
"string"s; // standard
|
||||
"string"_s-b; // -b is not part of the string
|
||||
|
||||
// Macro
|
||||
|
||||
MY_XXX;
|
||||
BOOST_XXX;
|
||||
__STDC_VERSION__;
|
||||
__TIME__;
|
||||
__cplusplus;
|
||||
|
||||
// Attributes
|
||||
|
||||
[[noreturn]] void foo();
|
||||
[[deprecated]] void foo();
|
||||
[[deprecated("because")]] void foo();
|
||||
void foo([[carries_dependency]] int);
|
||||
|
||||
[[opt(1), debug]]
|
||||
[[using CC: opt(1), debug]] // c++17
|
||||
[[using CC: CC::opt(1)]] // c++17
|
||||
|
||||
[[gnu::assume_aligned(3'2l,2)]] void* f();
|
||||
[[using gnu: assume_aligned(3)]]
|
||||
[[clang::assume_aligned(3)]]
|
||||
|
||||
void f([[maybe_unused]] int val)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
[[maybe_unused]] int x;
|
||||
switch (x = foo(); x) <beginfold id='3'>{</beginfold id='3'>
|
||||
case 1:
|
||||
[[fallthrough]];
|
||||
case XXX:
|
||||
case Class::foo():
|
||||
[[fallthrough]];
|
||||
default:
|
||||
;
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
// c++17: fold expression
|
||||
(args + ... + (1 * 2));
|
||||
(v.push_back(args), ...);
|
||||
|
||||
[[omp::parallel]] for (auto&& x : v)
|
||||
x;
|
||||
for (auto&& [first,second] : mymap) <beginfold id='3'>{</beginfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
auto [x, y] = foo();
|
||||
|
||||
[x = 1, =y]()<beginfold id='3'>{</beginfold id='3'><endfold id='3'>}</endfold id='3'>;
|
||||
|
||||
decltype((auto)) x = foo();
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
auto f() -> decltype(foo());
|
||||
|
||||
__attribute__((pure)) void f();
|
||||
|
||||
label:
|
||||
goto label;
|
||||
|
||||
|
||||
<beginfold id='5'>//BEGIN</beginfold id='5'> region
|
||||
// TODO comment FIXME comment ### comment BUG comment
|
||||
<endfold id='5'>//END</endfold id='5'> region
|
||||
|
||||
// \brief blah blah
|
||||
/// \brief blah blah
|
||||
|
||||
<beginfold id='6'>/**</beginfold id='6'>
|
||||
* Doxygen
|
||||
* @param p1 text
|
||||
* \brief <b>bold text</b>
|
||||
* <beginfold id='7'>\dot</beginfold id='7'>
|
||||
* a -> b
|
||||
* <endfold id='7'>\enddot</endfold id='7'>
|
||||
*
|
||||
* <beginfold id='7'>\verbatim</beginfold id='7'>
|
||||
* <dummy>
|
||||
* <endfold id='7'>\endverbatim</endfold id='7'>
|
||||
* <html>text</html>
|
||||
<endfold id='6'>*/</endfold id='6'>
|
||||
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
|
||||
// Some GNU macros, cross-referenced from gcc.xml to isocpp.xml
|
||||
__GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
__GNUC__
|
||||
__linux__
|
||||
|
||||
// Digraphs (see bug #411508)
|
||||
%:include <stdio.h>
|
||||
int main()
|
||||
<beginfold id='3'><%</beginfold id='3'>
|
||||
[]()<beginfold id='3'>{</beginfold id='3'><endfold id='3'>%></endfold id='3'>();
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<:<:fallthrough]]
|
||||
|
||||
<beginfold id='6'>/**</beginfold id='6'>
|
||||
* multi-line comment
|
||||
<endfold id='6'>*/</endfold id='6'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> comment <endfold id='1'>*/</endfold id='1'>
|
||||
<beginfold id='3'>{</beginfold id='3'> <beginfold id='3'>{</beginfold id='3'> <endfold id='3'>}</endfold id='3'> <beginfold id='3'>{</beginfold id='3'>
|
||||
<beginfold id='5'>//BEGIN</beginfold id='5'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='5'>//END</endfold id='5'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 0
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#elif 1</beginfold id='2'>
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>#else</beginfold id='2'>
|
||||
<endfold id='2'>#endif</endfold id='2'>
|
||||
|
||||
#<beginfold id='2'></beginfold id='2'>if 1
|
||||
int x; // variable shall not be grey
|
||||
<endfold id='2'>#endif</endfold id='2'>
|
||||
#<beginfold id='2'></beginfold id='2'>if defined (A)
|
||||
int y; // variable shall not be grey
|
||||
#<endfold id='2'></endfold id='2'><beginfold id='2'></beginfold id='2'>elif defined (B)
|
||||
int z; // variable shall not be grey
|
||||
#<endfold id='2'>endif</endfold id='2'>
|
||||
|
||||
<beginfold id='6'>/*!</beginfold id='6'>
|
||||
* formula <beginfold id='7'>@f$</beginfold id='7'>a+b<endfold id='7'>@f$</endfold id='7'> inside a block comment
|
||||
<endfold id='6'>*/</endfold id='6'>
|
||||
|
||||
//! formula <beginfold id='7'>@f$</beginfold id='7'>a+b<endfold id='7'>@f$</endfold id='7'> inside a inline comment
|
||||
// formula @f$a+b@f$ inside a normal comment
|
||||
|
||||
/// \b sa
|
||||
@@ -0,0 +1,250 @@
|
||||
# This file is a testcase for the highlighting of Crystal code
|
||||
# It's not executable code, but a collection of code snippets
|
||||
#
|
||||
|
||||
require "lib_z"
|
||||
require "./digest"
|
||||
|
||||
<beginfold id='1'>module</beginfold id='1'> Digest::Adler32
|
||||
<beginfold id='1'>def</beginfold id='1'> self.initial : UInt32
|
||||
LibZ.adler32(0, nil, 0).to_u32
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> self.checksum(data) : UInt32
|
||||
update(data, initial)
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> self.update(data, adler32 : UInt32) : UInt32
|
||||
slice = data.to_slice
|
||||
LibZ.adler32(adler32, slice, slice.size).to_u32
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> self.combine(adler1 : UInt32, adler2 : UInt32, len) : UInt32
|
||||
LibZ.adler32_combine(adler1, adler2, len).to_u32
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>struct</beginfold id='1'> BigRational
|
||||
Number.expand_div [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128], BigRational
|
||||
Number.expand_div [Float32, Float64], BigRational
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>module</beginfold id='1'> Crystal::Repl::Closure
|
||||
VAR_NAME = ".closure_var"
|
||||
ARG_NAME = ".closure_arg"
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>class</beginfold id='1'> FunctionType
|
||||
getter arg_types : Array(ArgType)
|
||||
getter return_type : ArgType
|
||||
|
||||
@@cvar = 3
|
||||
@ivar = 7
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> initialize(@arg_types, @return_type)
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> //(other : Int::Unsigned) : BigInt
|
||||
check_division_by_zero other
|
||||
unsafe_floored_div(other)
|
||||
end
|
||||
|
||||
def //(other : Int) : BigInt
|
||||
check_division_by_zero other
|
||||
|
||||
<beginfold id='1'>if</beginfold id='1'> other < 0
|
||||
(-self).unsafe_floored_div(-other)
|
||||
@cvar += 1
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'>
|
||||
unsafe_floored_div(other)
|
||||
@ivar += 10
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
require "llvm/enums/atomic"
|
||||
<beginfold id='1'>struct</beginfold id='1'> Atomic(T)
|
||||
# Creates an Atomic with the given initial value.
|
||||
<beginfold id='1'>def</beginfold id='1'> compare_and_set(cmp : T, new : T) : <beginfold id='1'>{</beginfold id='1'>T, Bool<endfold id='1'>}</endfold id='1'>
|
||||
<beginfold id='1'>{%</beginfold id='1'> if T.union? && T.union_types.all? <beginfold id='1'>{</beginfold id='1'> |t| t == Nil || t < Reference <endfold id='1'>}</endfold id='1'> %}
|
||||
address, success = Ops.cmpxchg(pointerof(@value).as(LibC::SizeT*), LibC::SizeT.new(cmp.as(T).object_id), LibC::SizeT.new(new.as(T).object_id), :sequentially_consistent, :sequentially_consistent)
|
||||
<beginfold id='1'>{</beginfold id='1'>address == 0 ? nil : Pointer(T).new(address).as(T), success<endfold id='1'>}</endfold id='1'>
|
||||
<beginfold id='1'>{%</beginfold id='1'> <endfold id='1'></endfold id='1'><beginfold id='1'>elsif</beginfold id='1'> T < Reference <endfold id='1'>%}</endfold id='1'>
|
||||
# Use addresses again (but this can't return nil)
|
||||
address, success = Ops.cmpxchg(pointerof(@value).as(LibC::SizeT*), LibC::SizeT.new(cmp.as(T).object_id), LibC::SizeT.new(new.as(T).object_id), :sequentially_consistent, :sequentially_consistent)
|
||||
<beginfold id='1'>{</beginfold id='1'>Pointer(T).new(address).as(T), success<endfold id='1'>}</endfold id='1'>
|
||||
<beginfold id='1'>{%</beginfold id='1'> <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> <endfold id='1'>%}</endfold id='1'>
|
||||
Ops.cmpxchg(pointerof(@value), cmp, new, :sequentially_consistent, :sequentially_consistent)
|
||||
<beginfold id='1'>{%</beginfold id='1'> <endfold id='1'>end</endfold id='1'> <endfold id='1'>%}</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> swap(value : T)
|
||||
<beginfold id='1'>{%</beginfold id='1'> if T.union? && T.union_types.all? <beginfold id='1'>{</beginfold id='1'> |t| t == Nil || t < Reference <endfold id='1'>}</endfold id='1'> || T < Reference <endfold id='1'>%}</endfold id='1'>
|
||||
address = Ops.atomicrmw(:xchg, pointerof(@value).as(LibC::SizeT*), LibC::SizeT.new(value.as(T).object_id), :sequentially_consistent, false)
|
||||
Pointer(T).new(address).as(T)
|
||||
<beginfold id='1'>{%</beginfold id='1'> <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> <endfold id='1'>%}</endfold id='1'>
|
||||
Ops.atomicrmw(:xchg, pointerof(@value), value, :sequentially_consistent, false)
|
||||
<beginfold id='1'>{%</beginfold id='1'> <endfold id='1'>end</endfold id='1'> <endfold id='1'>%}</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>class</beginfold id='1'> Deque(T)
|
||||
include Indexable::Mutable(T)
|
||||
|
||||
@start = 0
|
||||
protected setter size
|
||||
private getter buffer
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> initialize(size : Int, value : T)
|
||||
<beginfold id='1'>if</beginfold id='1'> size < 0
|
||||
raise ArgumentError.new("Negative deque size: #{size}")
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
@size = size.to_i
|
||||
@capacity = size.to_i
|
||||
|
||||
<beginfold id='1'>unless</beginfold id='1'> @capacity == 0
|
||||
@buffer = Pointer(T).malloc(@capacity, value)
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
# Returns a new `Deque` that has this deque's elements cloned.
|
||||
# That is, it returns a deep copy of this deque.
|
||||
#
|
||||
# Use `#dup` if you want a shallow copy.
|
||||
<beginfold id='1'>def</beginfold id='1'> clone
|
||||
<beginfold id='1'>{%</beginfold id='1'> if T == ::Bool || T == ::Char || T == ::String || T == ::Symbol || T < ::Number::Primitive %<endfold id='1'>}</endfold id='1'>
|
||||
Deque(T).new(size) <beginfold id='1'>{</beginfold id='1'> |i| self[i].clone.as(T) <endfold id='1'>}</endfold id='1'>
|
||||
<beginfold id='1'>{</beginfold id='1'>% <endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> %<endfold id='1'>}</endfold id='1'>
|
||||
exec_recursive_clone <beginfold id='1'>do</beginfold id='1'> |hash|
|
||||
clone = Deque(T).new(size)
|
||||
each <beginfold id='1'>do</beginfold id='1'> |element|
|
||||
clone << element.clone
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
clone
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<beginfold id='1'>{</beginfold id='1'>% <endfold id='1'>end</endfold id='1'> %<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> delete_at(index : Int) : T
|
||||
<beginfold id='1'>unless</beginfold id='1'> 0 <= index < @size
|
||||
raise IndexError.new
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
return shift if index == 0
|
||||
|
||||
<beginfold id='1'>if</beginfold id='1'> index > @size // 2
|
||||
# Move following items to the left, starting with the first one
|
||||
# [56-01234] -> [6x-01235]
|
||||
dst = rindex
|
||||
finish = (@start + @size - 1) % @capacity
|
||||
loop <beginfold id='1'>do</beginfold id='1'>
|
||||
src = dst + 1
|
||||
src -= @capacity if src >= @capacity
|
||||
@buffer[dst] = @buffer[src]
|
||||
break if src == finish
|
||||
dst = src
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
(@buffer + finish).clear
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> each(& : T ->) : Nil
|
||||
halfs <beginfold id='1'>do</beginfold id='1'> |r|
|
||||
r.each <beginfold id='1'>do</beginfold id='1'> |i|
|
||||
yield @buffer[i]
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> pop : T
|
||||
pop <beginfold id='1'>{</beginfold id='1'> raise IndexError.new <endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
|
||||
macro [](*args)
|
||||
array = uninitialized Array(Int32)
|
||||
<beginfold id='1'>{</beginfold id='1'>% for arg, i in args %<endfold id='1'>}</endfold id='1'>
|
||||
array.to_unsafe[<beginfold id='1'>{</beginfold id='1'><beginfold id='1'>{</beginfold id='1'>i<endfold id='1'>}</endfold id='1'><endfold id='1'>}</endfold id='1'>] = <beginfold id='1'>{</beginfold id='1'><beginfold id='1'>{</beginfold id='1'>arg<endfold id='1'>}</endfold id='1'><endfold id='1'>}</endfold id='1'>
|
||||
<beginfold id='1'>{</beginfold id='1'>% <endfold id='1'>end</endfold id='1'> %<endfold id='1'>}</endfold id='1'>
|
||||
array
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>def</beginfold id='1'> message : String
|
||||
case self
|
||||
when SUCCESS then "No error occurred. System call completed successfully."
|
||||
when TXTBSY then Errno::ETXTBSY
|
||||
when NOTCAPABLE then Errno::ENOTCAPABLE
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>else</beginfold id='1'> Errno::EINVAL
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
enum Signal
|
||||
KILL = 0
|
||||
BILL = 101
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
|
||||
# :nodoc:
|
||||
module Ops
|
||||
# Defines methods that directly map to LLVM instructions related to atomic operations.
|
||||
|
||||
@[Primitive(:cmpxchg)]
|
||||
<beginfold id='1'>def</beginfold id='1'> self.cmpxchg(ptr : T*, cmp : T, new : T, success_ordering : LLVM::AtomicOrdering, failure_ordering : LLVM::AtomicOrdering) : <beginfold id='1'>{</beginfold id='1'>T, Bool<endfold id='1'>}</endfold id='1'> forall T
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
@[Primitive(:atomicrmw)]
|
||||
<beginfold id='1'>def</beginfold id='1'> self.atomicrmw(op : LLVM::AtomicRMWBinOp, ptr : T*, val : T, ordering : LLVM::AtomicOrdering, singlethread : Bool) : T forall T
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
|
||||
@[Link("z")]
|
||||
lib LibZ
|
||||
alias Char = LibC::Char
|
||||
alias SizeT = LibC::SizeT
|
||||
|
||||
fun zlibVersion : Char*
|
||||
fun crc32_combine(crc1 : ULong, crc2 : ULong, len : Long) : ULong
|
||||
|
||||
alias AllocFunc = Void*, UInt, UInt -> Void*
|
||||
alias FreeFunc = (Void*, Void*) ->
|
||||
|
||||
struct ZStream
|
||||
next_in : Bytef*
|
||||
avail_in : UInt
|
||||
next_out : Bytef*
|
||||
total_out : ULong
|
||||
msg : Char*
|
||||
state : Void*
|
||||
zalloc : AllocFunc
|
||||
zfree : FreeFunc
|
||||
opaque : Void*
|
||||
data_type : Int
|
||||
adler : Long
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
# error codes
|
||||
enum Error
|
||||
OK = 0
|
||||
VERSION_ERROR = -6
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
enum Flush
|
||||
NO_FLUSH = 0
|
||||
TREES = 6
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
|
||||
MAX_BITS = 15
|
||||
|
||||
fun deflateInit2 = deflateInit2_(stream : ZStream*, level : Int32, method : Int32,
|
||||
window_bits : Int32, mem_level : Int32, strategy : Int32,
|
||||
version : UInt8*, stream_size : Int32) : Error
|
||||
fun deflate(stream : ZStream*, flush : Flush) : Error
|
||||
fun deflateSetDictionary(stream : ZStream*, dictionary : UInt8*, len : UInt) : Int
|
||||
|
||||
fun inflateInit2 = inflateInit2_(stream : ZStream*, window_bits : Int32, version : UInt8*, stream_size : Int32) : Error
|
||||
fun inflate(stream : ZStream*, flush : Flush) : Error
|
||||
fun inflateSetDictionary(stream : ZStream*, dictionary : UInt8*, len : UInt) : Error
|
||||
<endfold id='1'>end</endfold id='1'>
|
||||
@@ -0,0 +1,441 @@
|
||||
<beginfold id='1'>/*</beginfold id='1'>*
|
||||
* This is a pseudo CSS file to test Kate's CSS syntax highlighting.
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Properties <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
body <beginfold id='2'>{</beginfold id='2'>
|
||||
font-size: 15pt;
|
||||
font-family: Verdana, Helvetica, "Bitstream Vera Sans", sans-serif;
|
||||
margin-top: 0px; <beginfold id='1'>/*</beginfold id='1'> yet another comment <endfold id='1'>*/</endfold id='1'>
|
||||
margin-bottom: 0px;
|
||||
// this is no comment, it's just broken!
|
||||
background-color: hsl(0, 0%, calc(95% - 3%));
|
||||
font-family: "Droid Sans", Arial, sans-serif;
|
||||
font-size: 11pt;
|
||||
line-height: 1.5em;
|
||||
background: #fff000;
|
||||
text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
|
||||
box-sizing: border-box;
|
||||
font-variant-alternates: styleset(nice-style);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Selectors <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
body, blockquote <beginfold id='2'>{</beginfold id='2'>
|
||||
margin: 0;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
header #logo <beginfold id='2'>{</beginfold id='2'>
|
||||
width: 100px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
div#footer .link <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.something
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
margin-right: 0px;
|
||||
color: #cdd;
|
||||
color: #AAFE04;
|
||||
color: rgb(10%,30%,43%);
|
||||
background: maroon;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
sidebar #subscribe .subscribe_form input[type="text"] <beginfold id='2'>{</beginfold id='2'>
|
||||
font-size: 20px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
sidebar #subscribe .subscribe_form:nth-child(2n + 1):hover input[class*="small-"] <beginfold id='2'>{</beginfold id='2'>
|
||||
font-weight: bold;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
input[value=text]
|
||||
input[value= text ]
|
||||
input[value= text i]
|
||||
input[value= "text" i]
|
||||
input[value=i]
|
||||
input[value= i] <beginfold id='2'>{</beginfold id='2'>
|
||||
font-size: 20px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#header,
|
||||
a:hover,
|
||||
p.intro:first-letter,
|
||||
p:lang(nl),
|
||||
img[align="right"]
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
border: 1px solid Qt::red !important;
|
||||
-moz-border-radius: 15px; <beginfold id='1'>/*</beginfold id='1'> unknown properties render italic <endfold id='1'>*/</endfold id='1'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.nice-look <beginfold id='2'>{</beginfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
ul <beginfold id='2'>{</beginfold id='2'>
|
||||
list-style: thumbs;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> SVG <a> <endfold id='1'>*/</endfold id='1'>
|
||||
svg|a <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> XHTML and SVG <a> <endfold id='1'>*/</endfold id='1'>
|
||||
*|a <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
*<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
.class<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
#id<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
:hover<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
:lang(fr)<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E F<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E>F<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E > F<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E~F<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E ~ F<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E:first-child<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E:visited<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E::after<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E:lang(c)<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E:lang(fr-ca)<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E + F<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E+F<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[foo]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[foo=warning]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[foo="warning"]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[foo~="warning"]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[foo^="warning"]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[foo$="warning"]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[foo*="warning"]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E[lang|="en"]<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
DIV.warning<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
DIV .warning<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E#myid<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E #myid<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E,E<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E, E<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E ,E<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
E , E<beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
p:nth-child(2) <beginfold id='2'>{</beginfold id='2'>
|
||||
background: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Elements that are not <div> or <span> elements <endfold id='1'>*/</endfold id='1'>
|
||||
body :not(div):not(span) <beginfold id='2'>{</beginfold id='2'>
|
||||
font-weight: bold;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Elements that are not `.crazy` or `.fancy` <endfold id='1'>*/</endfold id='1'>
|
||||
<beginfold id='1'>/*</beginfold id='1'> Note that this syntax is not well supported yet. <endfold id='1'>*/</endfold id='1'>
|
||||
body :not(.crazy, .fancy) <beginfold id='2'>{</beginfold id='2'>
|
||||
font-family: sans-serif;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
:nth-child(odd) <beginfold id='2'>{</beginfold id='2'> color: lime; <endfold id='2'>}</endfold id='2'>
|
||||
:nth-child(even) <beginfold id='2'>{</beginfold id='2'> color: lime; <endfold id='2'>}</endfold id='2'>
|
||||
:nth-child(4) <beginfold id='2'>{</beginfold id='2'> color: lime; <endfold id='2'>}</endfold id='2'>
|
||||
:nth-child(4n) <beginfold id='2'>{</beginfold id='2'> color: lime; <endfold id='2'>}</endfold id='2'>
|
||||
:nth-child(3n+4) <beginfold id='2'>{</beginfold id='2'> color: lime; <endfold id='2'>}</endfold id='2'>
|
||||
:nth-child(-n+3) <beginfold id='2'>{</beginfold id='2'> color: lime; <endfold id='2'>}</endfold id='2'>
|
||||
:nth-child(n+8):nth-child(-n+15) <beginfold id='2'>{</beginfold id='2'> color: lime; <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.first span:nth-child(2n+1),
|
||||
.second span:nth-child(2n+1),
|
||||
.third span:nth-of-type(2n+1) <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: lime;
|
||||
unknown-property: lime;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
:root<beginfold id='2'>{</beginfold id='2'>
|
||||
--foo: if(x > 5) this.width = 10; <beginfold id='1'>/*</beginfold id='1'> valid custom property, invalid in any normal property <endfold id='1'>*/</endfold id='1'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
:root,
|
||||
:root:lang(en) <beginfold id='2'>{</beginfold id='2'>--external-link: "external link";<endfold id='2'>}</endfold id='2'>
|
||||
:root:lang(de) <beginfold id='2'>{</beginfold id='2'>--external-link: "externer Link";<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
a[href^="http"]::after <beginfold id='2'>{</beginfold id='2'>content: " (" var(--external-link) ")"<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
one <beginfold id='2'>{</beginfold id='2'> --foo: 10px; <endfold id='2'>}</endfold id='2'>
|
||||
two <beginfold id='2'>{</beginfold id='2'> --bar: calc(var(--foo) + 10px); <endfold id='2'>}</endfold id='2'>
|
||||
three <beginfold id='2'>{</beginfold id='2'> --foo: calc(var(--bar) + 10px); <endfold id='2'>}</endfold id='2'>
|
||||
.foo <beginfold id='2'>{</beginfold id='2'>
|
||||
--gap: 20;
|
||||
margin-top: var(--gap)px; <beginfold id='1'>/*</beginfold id='1'>20 px<endfold id='1'>*/</endfold id='1'>
|
||||
margin-top: calc(var(--gap) * 1px); <beginfold id='1'>/*</beginfold id='1'>20px<endfold id='1'>*/</endfold id='1'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
foo <beginfold id='2'>{</beginfold id='2'>
|
||||
width: calc(50% -8px); <beginfold id='1'>/*</beginfold id='1'> invalid <endfold id='1'>*/</endfold id='1'>
|
||||
width: calc(50%- 8px); <beginfold id='1'>/*</beginfold id='1'> invalid <endfold id='1'>*/</endfold id='1'>
|
||||
width: calc(50% +8px); <beginfold id='1'>/*</beginfold id='1'> invalid <endfold id='1'>*/</endfold id='1'>
|
||||
width: calc(50%+ 8px); <beginfold id='1'>/*</beginfold id='1'> invalid <endfold id='1'>*/</endfold id='1'>
|
||||
width: calc(2px -var(--a)); <beginfold id='1'>/*</beginfold id='1'> invalid <endfold id='1'>*/</endfold id='1'>
|
||||
width: calc(50%*-8px);
|
||||
width: calc(50% - 8px);
|
||||
width: calc(50% + -8px);
|
||||
width: calc(50% +(8px));
|
||||
width: calc(2px -(var(--a)));
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
sweet-alert input:focus::-moz-placeholder <beginfold id='2'>{</beginfold id='2'>
|
||||
-webkit-transition: opacity 0.3s 0.03s ease;
|
||||
transition: opacity 0.3s 0.03s ease;
|
||||
opacity: 0.5;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
|
||||
@font-feature-values Font One <beginfold id='2'>{</beginfold id='2'>
|
||||
@styleset <beginfold id='2'>{</beginfold id='2'>
|
||||
nice-style: 12;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@font-feature-values Font Two <beginfold id='2'>{</beginfold id='2'>
|
||||
@styleset <beginfold id='2'>{</beginfold id='2'>
|
||||
nice-style: 4;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@font-palette-values --identifier <beginfold id='2'>{</beginfold id='2'>
|
||||
font-family: Bixa;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@counter-style thumbs <beginfold id='2'>{</beginfold id='2'>
|
||||
system: cyclic;
|
||||
symbols: "\1F44D";
|
||||
suffix: " ";
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@font-face <beginfold id='2'>{</beginfold id='2'>
|
||||
font-family: "Open Sans";
|
||||
<beginfold id='1'>/*</beginfold id='1'> comments <endfold id='1'>*/</endfold id='1'>
|
||||
unknown: 2px;
|
||||
src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
|
||||
url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@page <beginfold id='2'>{</beginfold id='2'>
|
||||
margin: 1cm;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@page :first <beginfold id='2'>{</beginfold id='2'>
|
||||
margin: 2cm;
|
||||
<beginfold id='1'>/*</beginfold id='1'> comments <endfold id='1'>*/</endfold id='1'>
|
||||
marks: crop cross;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@page :unknown <beginfold id='2'>{</beginfold id='2'>
|
||||
margin: 2cm;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@document url("https://www.example.com/") <beginfold id='2'>{</beginfold id='2'>
|
||||
h1 <beginfold id='2'>{</beginfold id='2'>
|
||||
color: green;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@charset "UTF-8";
|
||||
|
||||
@import 'custom.css';
|
||||
@import "common.css" screen;
|
||||
@import url("fineprint.css") print;
|
||||
@import url(fineprint.css) print;
|
||||
@import url('bluish.css') speech;
|
||||
@import url("chrome://communicator/skin/");
|
||||
@import url('landscape.css') screen and (orientation:landscape);
|
||||
@import url("othersheet.css") screen, print;
|
||||
|
||||
@namespace url(http://www.w3.org/1999/xhtml);
|
||||
@namespace svg url(http://www.w3.org/2000/svg);
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Animation (Keyframes) <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
@keyframes important1 <beginfold id='2'>{</beginfold id='2'>
|
||||
from <beginfold id='2'>{</beginfold id='2'> margin-top: 50px; <endfold id='2'>}</endfold id='2'>
|
||||
50% <beginfold id='2'>{</beginfold id='2'> margin-top: 150px !important; <endfold id='2'>}</endfold id='2'> <beginfold id='1'>/*</beginfold id='1'> ignored <endfold id='1'>*/</endfold id='1'>
|
||||
to <beginfold id='2'>{</beginfold id='2'> margin-top: 100px; <endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@keyframes important2 <beginfold id='2'>{</beginfold id='2'>
|
||||
from <beginfold id='2'>{</beginfold id='2'> margin-top: 50px;
|
||||
margin-bottom: 100px; <endfold id='2'>}</endfold id='2'>
|
||||
to <beginfold id='2'>{</beginfold id='2'> margin-top: 150px !important; <beginfold id='1'>/*</beginfold id='1'> ignored <endfold id='1'>*/</endfold id='1'>
|
||||
margin-bottom: 50px; <endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@keyframes slidein <beginfold id='2'>{</beginfold id='2'>
|
||||
from <beginfold id='2'>{</beginfold id='2'>
|
||||
margin-left: 100%;
|
||||
width: 300%;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
to <beginfold id='2'>{</beginfold id='2'>
|
||||
margin-left: 0%;
|
||||
width: 100%;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Media Queries <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
@media print <beginfold id='2'>{</beginfold id='2'>
|
||||
.container <beginfold id='2'>{</beginfold id='2'>
|
||||
width: 100%;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
a:hover <beginfold id='2'>{</beginfold id='2'> color: red <endfold id='2'>}</endfold id='2'>
|
||||
<beginfold id='1'>/*</beginfold id='1'> comments <endfold id='1'>*/</endfold id='1'>
|
||||
a:hover <beginfold id='2'>{</beginfold id='2'> color: red <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#header
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
display: none;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media screen and (min-width: 768px) and (max-width: 960px) <beginfold id='2'>{</beginfold id='2'>
|
||||
.container <beginfold id='2'>{</beginfold id='2'>
|
||||
width: 720px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media (max-width: 600px) <beginfold id='2'>{</beginfold id='2'>
|
||||
.sidebar <beginfold id='2'>{</beginfold id='2'>
|
||||
display: none;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media print <beginfold id='2'>{</beginfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media (height > 600px) <beginfold id='2'>{</beginfold id='2'>
|
||||
body <beginfold id='2'>{</beginfold id='2'>
|
||||
line-height: 1.4;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media (400px <= width <= 700px) <beginfold id='2'>{</beginfold id='2'>
|
||||
body <beginfold id='2'>{</beginfold id='2'>
|
||||
line-height: 1.4;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@supports (display: grid) <beginfold id='2'>{</beginfold id='2'>
|
||||
div <beginfold id='2'>{</beginfold id='2'>
|
||||
display: grid;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@supports font-tech(color-COLRv1) <beginfold id='2'>{</beginfold id='2'>
|
||||
font-family: "Bungee Spice";
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@supports not (not (transform-origin: 2px)) <beginfold id='2'>{</beginfold id='2'>
|
||||
div <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@supports (display: grid) and (not (display: inline-grid)) <beginfold id='2'>{</beginfold id='2'>
|
||||
div <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
* CSS Syntax Highlight Sample File (Standard)
|
||||
*
|
||||
* This file contains most CSS syntax, CSS3 properties, @media, @font-face and
|
||||
* @keyframes annotations.
|
||||
*
|
||||
* @author Guo Yunhe guoyunhebrave@gmail.com
|
||||
* @date 2016-09-16
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
* Block comment
|
||||
*
|
||||
* Alert keywords:
|
||||
* TODO BUG FIXME
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Region markers <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='3'>/*BEGIN Comment */</beginfold id='3'>
|
||||
|
||||
|
||||
<endfold id='3'>/*END Comment */</endfold id='3'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
* CSS Syntax Highlight Sample File (Complex)
|
||||
*
|
||||
* This file contains complex CSS syntax that can test unexpected situations.
|
||||
*
|
||||
* @author Guo Yunhe guoyunhebrave@gmail.com
|
||||
* @date 2016-09-16
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Comments with special content <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
* .class-selector #id "string" 'comment' // comment {} [] () /* comment
|
||||
* TODO BUG DEBUG
|
||||
* body {
|
||||
* margin: 0 !important;
|
||||
* }
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Comments in special positions <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
header<beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'>.active <beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'> <beginfold id='2'>{</beginfold id='2'>
|
||||
<beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'> color : <beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'> blue<beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'>;
|
||||
font-family: Arial <beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'>,
|
||||
"Droid Sans", <beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'>
|
||||
sans-serif<beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'>;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media screen <beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'> and (max-width: 300px <beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'>) <beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'> <beginfold id='2'>{</beginfold id='2'><beginfold id='1'>/*</beginfold id='1'> comment here <endfold id='1'>*/</endfold id='1'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Strings with special content <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
@import url("{} $variable /* comment */");
|
||||
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Without extra breaklines and spaces <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
pre.primary:hover.large:nth-child(2n-1)<beginfold id='2'>{</beginfold id='2'>font-size:17px;font-family:"Noto Sans";-webkit-box-shadow:1px 1px 3px rgba(0,0,0,0.3)<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> With unnecessary breaklines and spaces <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
blockquote .ref
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
flex : 0 1 30%;
|
||||
flex-wrap : wrap;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media screen and (orientation: landscape) <beginfold id='2'>{</beginfold id='2'>
|
||||
.sidebar <beginfold id='2'>{</beginfold id='2'>
|
||||
width: 500px; <endfold id='2'>}</endfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> Special selectors: HTML5 allows user defined tags <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
header <beginfold id='2'>{</beginfold id='2'>
|
||||
flex <beginfold id='2'>{</beginfold id='2'>
|
||||
width: 300px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> CSS Nesting <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
header <beginfold id='2'>{</beginfold id='2'>
|
||||
.abc <beginfold id='2'>{</beginfold id='2'>
|
||||
width: 300px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
width: 300px;
|
||||
& width:hover <beginfold id='2'>{</beginfold id='2'>
|
||||
width: 300px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
width: 300px;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
abc|abc|"abc|abc|abc|abc|abc|abc|abc|abc|abc
|
||||
abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc
|
||||
abc|abc|abc|abc|abc|abc|abc|abc|abc|abc|abc
|
||||
abc
|
||||
abc
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
abc;abc;"abc;";"abc""def";abc"abc;"abc"def;"abc
|
||||
def""ghi";abc;abc;abc;abc
|
||||
abc;abc;abc;abc;abc;abc;abc;abc;abc;abc;abc
|
||||
abc;abc;abc;abc;abc;abc;abc;abc;abc;abc;abc
|
||||
abc
|
||||
abc
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
abc abc "abc "abc abc abc abc abc abc abc abc
|
||||
abc abc "abc "abc abc abc abc abc abc abc abc
|
||||
abc
|
||||
abc
|
||||
@@ -0,0 +1,6 @@
|
||||
abc,abc,"abc,","abc""def",abc"abc,"abc"def,"abc
|
||||
def""ghi",abc,abc,abc,abc
|
||||
abc,abc,abc,abc,abc,abc,abc,abc,abc,abc,abc
|
||||
abc,abc,abc,abc,abc,abc,abc,abc,abc,abc,abc
|
||||
abc
|
||||
abc
|
||||
@@ -0,0 +1,219 @@
|
||||
<beginfold id='1'>/********</beginfold id='1'>
|
||||
* Highlight testing module.
|
||||
*
|
||||
* Do not attempt to run this!
|
||||
<endfold id='1'>***********/</endfold id='1'>
|
||||
module highlighttest;
|
||||
import X = null;
|
||||
|
||||
<beginfold id='2'>/++</beginfold id='2'> Pragma directives. DDoc + DDoc embedded items. Special Tokens.
|
||||
+
|
||||
+ ---
|
||||
+ // comment
|
||||
+ #line 12 "hightlighttest.d" <beginfold id='3'>/*</beginfold id='3'> block comment <endfold id='3'>*/</endfold id='3'>
|
||||
+ #line __LINE__ __FILE__ <beginfold id='2'>/++</beginfold id='2'> embedded block comment <endfold id='2'>+/</endfold id='2'>
|
||||
+
|
||||
+ pragma <beginfold id='3'>/*</beginfold id='3'> <endfold id='3'>*/</endfold id='3'> (msg, "what?");
|
||||
+ pragma(<beginfold id='2'>/++</beginfold id='2'> <endfold id='2'>+/</endfold id='2'> lib, "insane.a");
|
||||
+ pragma(inline);
|
||||
+ pragma(linkerDirective);
|
||||
+ pragma(mangle);
|
||||
+ pragma(startaddress);
|
||||
+ pragma(D_Custom_Extension, "custom data");
|
||||
+ pragma(foo 0);
|
||||
+ ---
|
||||
<endfold id='2'>+/</endfold id='2'>
|
||||
|
||||
/// version condition
|
||||
version = X;
|
||||
version = 1_2_3;
|
||||
version (X) ;
|
||||
version(linux) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// linkage
|
||||
extern
|
||||
(C) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern :
|
||||
;
|
||||
extern (C++) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (C++, foo.bar.baz) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (D) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (Windows) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (Pascal) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (System) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (unknown) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (C,) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
extern (C++, foo, bar) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// alias & typedef
|
||||
alias int.min minint;
|
||||
typedef int myint;
|
||||
|
||||
int main(char[][] args) <beginfold id='4'>{</beginfold id='4'>
|
||||
/// statements
|
||||
if (1) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
else <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
with (N) <beginfold id='4'>{</beginfold id='4'>x = B<endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// attributes
|
||||
auto x = 1;
|
||||
static if (true) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
void (in X, out Y) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'> // NOTE: using in like this is rare, more common to use as an expression and no way to tell apart?
|
||||
|
||||
/// deprecated
|
||||
deprecated void fct ();
|
||||
|
||||
/// types
|
||||
void a;
|
||||
ushort u;
|
||||
int[uint] AA;
|
||||
class C;
|
||||
enum N : int <beginfold id='4'>{</beginfold id='4'> A = 5, B <endfold id='4'>}</endfold id='4'>
|
||||
typeof(u) u2;
|
||||
|
||||
/// expressions
|
||||
x = cast(int) 55;
|
||||
void* p = null;
|
||||
p = cast(void*) new int;
|
||||
x = 1 in AA; // NOTE: a THIRD use of in. How to detect??
|
||||
assert (true);
|
||||
|
||||
/// libsymbols
|
||||
string s = "";
|
||||
throw new Exception;
|
||||
TypeInfo ti = typeid(int);
|
||||
|
||||
/// tests
|
||||
debug <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
debug (2) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
debug (DSymb) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
unittest <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// scope (as attribute and as statement)
|
||||
scope struct S;
|
||||
scope (exit) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
scope
|
||||
(success) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'> // NOTE: rules cannot match across new-lines
|
||||
scope (failure) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// Properties
|
||||
x = int.min;
|
||||
s = (5-3).stringof;
|
||||
|
||||
/// strings
|
||||
s = r"raw string";
|
||||
s = x"00FF";
|
||||
s = \n \a;
|
||||
s = \u1234;
|
||||
s = \U12345678;
|
||||
s = \& ;
|
||||
char c = 'a';
|
||||
s = "abc 012 \" \n \x12 \u1234 \U12345678";
|
||||
s = `BQString '"`;
|
||||
s = q{foo "bar" 123};
|
||||
s = q"FOO
|
||||
foo
|
||||
FOO";
|
||||
s = q"[foo [bar] q"[baz]"]";
|
||||
s = q"(foo (bar) q"(baz)")";
|
||||
s = q"<foo <bar> q"<baz>">";
|
||||
s = q"{foo {bar} q"{baz}"}";
|
||||
s = q"/foo/";
|
||||
s = q"!foo!";
|
||||
|
||||
/// region markers
|
||||
<beginfold id='5'>//BEGIN</beginfold id='5'> x
|
||||
<endfold id='5'>//END</endfold id='5'> x
|
||||
|
||||
/// DDoc
|
||||
<beginfold id='1'>/*******</beginfold id='1'>
|
||||
* DDoc
|
||||
*
|
||||
* Section:
|
||||
* New section.
|
||||
* $(I italic)
|
||||
<endfold id='1'>*******/</endfold id='1'>
|
||||
<beginfold id='2'>/+++++++</beginfold id='2'>
|
||||
+ DDoc
|
||||
+ /+
|
||||
+ +/
|
||||
<endfold id='2'>+++++++/</endfold id='2'>
|
||||
|
||||
// comments
|
||||
// FIXME NOTE
|
||||
<beginfold id='3'>/*</beginfold id='3'> comment <endfold id='3'>*/</endfold id='3'>
|
||||
<beginfold id='6'>/+</beginfold id='6'> comment <beginfold id='6'>/+</beginfold id='6'> nested comment <endfold id='6'>+/</endfold id='6'> <endfold id='6'>+/</endfold id='6'>
|
||||
|
||||
/// brace folding
|
||||
<beginfold id='4'>{</beginfold id='4'>
|
||||
<endfold id='4'>}</endfold id='4'>
|
||||
|
||||
<beginfold id='1'>/**</beginfold id='1'> normal text
|
||||
* ---
|
||||
* .x;
|
||||
* ..
|
||||
* ...
|
||||
* ....
|
||||
* .....
|
||||
* _._
|
||||
* _e1
|
||||
* ---
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
/// float and int literals
|
||||
int i;
|
||||
real r;
|
||||
ireal ir;
|
||||
r = .0;
|
||||
r = 0f;
|
||||
ir = 0e0i;
|
||||
ir = 0.fi;
|
||||
r = 0.0e0;
|
||||
r = 0xF.Fp0;
|
||||
r = 0x_._p0_;
|
||||
i = 5;
|
||||
i = -1;
|
||||
i = 0b10;
|
||||
i = 0070;
|
||||
i = 00;
|
||||
i = 0xF0;
|
||||
|
||||
/// ranges
|
||||
int[] A;
|
||||
i = A[1];
|
||||
A = A[0..$];
|
||||
A = A[0..0];
|
||||
A = A[0..length];
|
||||
|
||||
/// labels
|
||||
label:
|
||||
goto label;
|
||||
|
||||
/// function, delegate
|
||||
creal function () fp = function creal() <beginfold id='4'>{</beginfold id='4'> return 0f+0fi; <endfold id='4'>}</endfold id='4'>;
|
||||
void delegate (in int i, lazy int b) dg = delegate void (int, int) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// in, out, body
|
||||
// NOTE: highlighting in & out as statements here could be difficult
|
||||
float F ()
|
||||
in <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
out (result) <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
body <beginfold id='4'>{</beginfold id='4'><endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// try, catch, finally
|
||||
try <beginfold id='4'>{</beginfold id='4'>
|
||||
throw new Exception("oh no... ");
|
||||
<endfold id='4'>}</endfold id='4'> catch (Exception e) <beginfold id='4'>{</beginfold id='4'>
|
||||
<endfold id='4'>}</endfold id='4'> finally <beginfold id='4'>{</beginfold id='4'>
|
||||
<endfold id='4'>}</endfold id='4'>
|
||||
|
||||
/// mixin
|
||||
mixin("return false;").stringof;
|
||||
|
||||
/// templates
|
||||
macro; // what does this do?
|
||||
template Tp (T) <beginfold id='4'>{</beginfold id='4'>
|
||||
Tp t;
|
||||
<endfold id='4'>}</endfold id='4'>
|
||||
Tp!(int) y;
|
||||
<endfold id='4'>}</endfold id='4'>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
libdemo (0.2) UNRELEASED; urgency=low
|
||||
|
||||
* Fix rendering bug. Closes: #1001
|
||||
|
||||
-- Foo Bar <foo.bar@example.org> Thu, 05 Sep 2020 10:30:00 +0200
|
||||
|
||||
libdemo (0.1-1) UNRELEASED; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Foo Bar <foo.bar@example.org> Thu, 03 Sep 2020 10:22:07 +0200
|
||||
@@ -0,0 +1,89 @@
|
||||
<beginfold id='1'>/*</beginfold id='1'> Test file for kate's stata syntax highlighting
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
*! version 1.2.0 2mar2003 E. Leuven
|
||||
program define spellsplit
|
||||
version 7
|
||||
syntax [anything], spell(varlist min=2 max=2) [ by(varlist)]
|
||||
tokenize `spell'
|
||||
local date0 `1'
|
||||
local date1 `2'
|
||||
local f0 : format `date0'
|
||||
local f1 : format `date1'
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> set default statistic <endfold id='1'>*/</endfold id='1'>
|
||||
local current "mean"
|
||||
|
||||
gettoken left anything : anything, match(prns)
|
||||
while "`left'"!="" <beginfold id='2'>{</beginfold id='2'>
|
||||
if "`prns'"!="" <beginfold id='2'>{</beginfold id='2'>
|
||||
if !inlist("`left'","mean","sum") <beginfold id='2'>{</beginfold id='2'>
|
||||
di as error "Statistic `left' not supported"
|
||||
exit 198
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
local current "`left'"
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
else <beginfold id='2'>{</beginfold id='2'>
|
||||
local `current'vars ``current'vars' `left'
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
gettoken left anything : anything, match(prns)
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
if ("`meanvars'"!="") <beginfold id='2'>{</beginfold id='2'>
|
||||
confirm var `meanvars'
|
||||
unab meanvars : `meanvars'
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
if ("`sumvars'"!="") <beginfold id='2'>{</beginfold id='2'>
|
||||
confirm var `sumvars'
|
||||
unab sumvars : `sumvars'
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
quietly <beginfold id='2'>{</beginfold id='2'>
|
||||
g _count = 1
|
||||
local xvars `meanvars' `sumvars' _count
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> create dummy by-var if no by option is specified <endfold id='1'>*/</endfold id='1'>
|
||||
if "`by'"=="" <beginfold id='2'>{</beginfold id='2'>
|
||||
tempvar by
|
||||
g byte `by' = 1
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
tempvar `xvars' `by'
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> create negative for subtraction when spell ends <endfold id='1'>*/</endfold id='1'>
|
||||
cap foreach v of varlist `xvars' <beginfold id='2'>{</beginfold id='2'>
|
||||
g double ``v'' = -`v'
|
||||
local txvars `txvars' ``v''
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
cap foreach v of varlist `by' <beginfold id='2'>{</beginfold id='2'>
|
||||
g double ``v'' = `v'
|
||||
local txvars `txvars' ``v''
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
stack `date0' `xvars' `by' `date1' `txvars', into(`date0' `xvars' `by') clear
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> calculate totals per date <endfold id='1'>*/</endfold id='1'>
|
||||
cap foreach v of varlist `xvars' <beginfold id='2'>{</beginfold id='2'>
|
||||
egen double ``v'' = sum(`v'), by(`by' `date0')
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> unique dates only <endfold id='1'>*/</endfold id='1'>
|
||||
by `by' `date0', sort: keep if _n==1
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> calculate totals (+ when spell starts - when ends) <endfold id='1'>*/</endfold id='1'>
|
||||
sort `by'
|
||||
cap foreach v of varlist `xvars' <beginfold id='2'>{</beginfold id='2'>
|
||||
by `by': replace `v' = sum(``v'')
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
by `by': g `date1' = `date0'[_n + 1]
|
||||
|
||||
drop if `date0'>`date1'
|
||||
drop _stack
|
||||
drop if _count==0
|
||||
order `by' `date0' `date1' `xvars'
|
||||
format `date0' `f0'
|
||||
format `date1' `f1'
|
||||
|
||||
cap for var `meanvars': replace X = X/_count
|
||||
|
||||
compress
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
end
|
||||
@@ -0,0 +1,232 @@
|
||||
This is a pseudo doxygen file to test Kate's doxygen syntax highlighting.
|
||||
|
||||
Normal text, no HL.
|
||||
===================
|
||||
a multiline comment may begin with a <beginfold id='1'>/*!</beginfold id='1'> <endfold id='1'>*/</endfold id='1'>, too. That should work,
|
||||
because it is the same "entrance rule".
|
||||
|
||||
popping tests:
|
||||
<beginfold id='1'>/** </beginfold id='1'>multiline <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/*!</beginfold id='1'> multiline <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
//! singleline, where */ should be ignored! still doxygen HL mode
|
||||
/// singleline, where */ should be ignored! still doxygen HL mode
|
||||
///< singleline, where */ should be ignored! still doxygen HL mode
|
||||
begin and end immediately:
|
||||
/********/ actually no doxygen comment - used for "info boxes" :)
|
||||
/**/ <-- it really works --- end of doxygen HL mode
|
||||
<beginfold id='1'>/*!</beginfold id='1'><endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <normal comment HL>
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest of line is normal comment HL <endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest of line is normal comment HL
|
||||
* comment HL mode
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <word> <normal comment HL>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file aword rest of line is normal comment HL <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file <endfold id='1'>*/</endfold id='1'>aword <-- pop! no doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file aword rest of line is normal comment HL
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <rest of line is string>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short description <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief <endfold id='1'>*/</endfold id='1'>A <-- pop! end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short description
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <word> <rest of line is string>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword rest of line is string <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page <endfold id='1'>*/</endfold id='1'>aword <-- pop! end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword rest of line is string
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <word> <word> <normal comment HL>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword aword rest of line is normal HL <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword <endfold id='1'>*/</endfold id='1'>aword <-- pop! end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image <endfold id='1'>*/</endfold id='1'>aword aword <-- pop! end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword aword rest of line is normal HL
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
Tests for HTML tags in doxygen HL mode:
|
||||
=======================================
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href='blubb'> <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href='blubb'<endfold id='1'>*/</endfold id='1'>> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href='blubb<endfold id='1'>*/</endfold id='1'>'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href='blub<endfold id='1'>*/</endfold id='1'>b'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href='b<endfold id='1'>*/</endfold id='1'>lubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href='<endfold id='1'>*/</endfold id='1'>blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href=<endfold id='1'>*/</endfold id='1'>'blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" href<endfold id='1'>*/</endfold id='1'>='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" hre<endfold id='1'>*/</endfold id='1'>f='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb" <endfold id='1'>*/</endfold id='1'>href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb"> <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb"<endfold id='1'>*/</endfold id='1'>> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blubb<endfold id='1'>*/</endfold id='1'>"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="blub<endfold id='1'>*/</endfold id='1'>b"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href="<endfold id='1'>*/</endfold id='1'>blubb"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href=<endfold id='1'>*/</endfold id='1'>"blubb"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a href<endfold id='1'>*/</endfold id='1'>="blubb"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a h<endfold id='1'>*/</endfold id='1'>ref="blubb"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a <endfold id='1'>*/</endfold id='1'>href="blubb"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><a<endfold id='1'>*/</endfold id='1'> href="blubb"> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><<endfold id='1'>*/</endfold id='1'>a href="blubb"> end of doxygen HL mode
|
||||
|
||||
//! <a href="blubb" href='blubb'> */ stay in doygen HL mode
|
||||
//! <a href="blubb" href='blubb'*/> stay in doygen HL mode
|
||||
//! <a href="blubb" href='blubb*/'> stay in doygen HL mode
|
||||
//! <a href="blubb" href='blu*/bb'> stay in doygen HL mode
|
||||
//! <a href="blubb" href='*/blubb'> stay in doygen HL mode
|
||||
//! <a href="blubb" href=*/'blubb'> stay in doygen HL mode
|
||||
//! <a href="blubb"> */ stay in doygen HL mode
|
||||
//! <a href="blubb"*/> stay in doygen HL mode
|
||||
//! <a href="blubb*/"> stay in doygen HL mode
|
||||
//! <a href="blub*/b"> stay in doygen HL mode
|
||||
//! <a href="*/blubb"> stay in doygen HL mode
|
||||
//! <a href=*/"blubb"> stay in doygen HL mode
|
||||
//! <a href*/="blubb"> stay in doygen HL mode
|
||||
//! <a h*/ref="blubb"> stay in doygen HL mode
|
||||
//! <a */href="blubb"> stay in doygen HL mode
|
||||
//! <a*/ href="blubb"> stay in doygen HL mode
|
||||
//! <*/a href="blubb"> stay in doygen HL mode
|
||||
//! <a href="blubb"> stay in doygen HL <mode
|
||||
here should be normal HL mode (no doxygen!)
|
||||
|
||||
Tests for HTML tags in doxygen HL mode with tags:
|
||||
=================================================
|
||||
<tag> <normal comment HL>
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a href="blubb"> of </a href='blubb'> line is normal comment HL <endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a href="blubb"> of </a href='blubb'<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a href="blubb"> of </a href='blubb<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a href="blubb"> of </a href='<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a href="blubb"> of </a href=<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>'blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a href="blubb<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>"> of </a href=*/'blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a href=<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>"blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <a h<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>ref="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest <<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'>a href="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'><beginfold id='2'>\code</beginfold id='2'> rest of line is normal comment HL
|
||||
* comment HL mode <html> text </html>
|
||||
<endfold id='2'></endfold id='2'><endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <word> <normal comment HL>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file awo<html_should_be_ignored_here>rd rest of line is normal comment HL <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file awo<html_should_be_ignored_here><endfold id='1'>*/</endfold id='1'>rd end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file awo<html_should_be_i<endfold id='1'>*/</endfold id='1'>gnored_here>rd end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file awo<<endfold id='1'>*/</endfold id='1'>html_should_be_ignored_here>rd end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file a<endfold id='1'>*/</endfold id='1'>wo<html_should_be_ignored_here>rd end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\file aword rest of line is normal co<code>mment HL
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <rest of line is string>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of </a href='blubb'> description <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of </a href='blubb'<endfold id='1'>*/</endfold id='1'>> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of </a href='<endfold id='1'>*/</endfold id='1'>blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of </a href=<endfold id='1'>*/</endfold id='1'>'blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of </a href<endfold id='1'>*/</endfold id='1'>='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of </a <endfold id='1'>*/</endfold id='1'>href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of <<endfold id='1'>*/</endfold id='1'>/a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"<endfold id='1'>*/</endfold id='1'>> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb<endfold id='1'>*/</endfold id='1'>"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="<endfold id='1'>*/</endfold id='1'>blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href=<endfold id='1'>*/</endfold id='1'>"blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href<endfold id='1'>*/</endfold id='1'>="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a h<endfold id='1'>*/</endfold id='1'>ref="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\brief A short <a href="blubb"> of </a href='blubb'> description
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <word> <rest of line is string>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of </a href='blubb'> description <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of </a href='blubb'<endfold id='1'>*/</endfold id='1'>> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of </a href='<endfold id='1'>*/</endfold id='1'>blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of </a href=<endfold id='1'>*/</endfold id='1'>'blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of </a href<endfold id='1'>*/</endfold id='1'>='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of </a <endfold id='1'>*/</endfold id='1'>href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of <<endfold id='1'>*/</endfold id='1'>/a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"<endfold id='1'>*/</endfold id='1'>> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb<endfold id='1'>*/</endfold id='1'>"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="<endfold id='1'>*/</endfold id='1'>blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href=<endfold id='1'>*/</endfold id='1'>"blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href<endfold id='1'>*/</endfold id='1'>="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a h<endfold id='1'>*/</endfold id='1'>ref="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <<endfold id='1'>*/</endfold id='1'>a href="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A shor<endfold id='1'>*/</endfold id='1'>t <a href="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page awor<endfold id='1'>*/</endfold id='1'>d A short <a href="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page <endfold id='1'>*/</endfold id='1'>aword A short <a href="blubb"> of </a href='blubb'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\page aword A short <a href="blubb"> of </a href='blubb'> description
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
<tag> <word> <word> <rest of line is string>
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword aword rest of line is normal HL <endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword aword rest of line is<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword aword<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword aw<endfold id='1'>*/</endfold id='1'>ord end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword <endfold id='1'>*/</endfold id='1'>aword end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image awo<endfold id='1'>*/</endfold id='1'>rd end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image <endfold id='1'>*/</endfold id='1'>aword end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\ima<endfold id='1'>*/</endfold id='1'>ge end of doxygen HL mode
|
||||
<beginfold id='1'>/** </beginfold id='1'>\image aword aword rest of line is normal HL
|
||||
* comment HL mode
|
||||
<endfold id='1'>*/</endfold id='1'> end of doxygen HL mode
|
||||
|
||||
Some further tests for singlelinecomments (* / should not pop!)
|
||||
===============================================================
|
||||
/// a singlelinecommment blubb blubb */. stay in doxygen HL mode
|
||||
/// <beginfold id='2'>\code</beginfold id='2'> a singlelinecommment blubb b*/lubb. stay in doxygen HL mode
|
||||
<endfold id='2'></endfold id='2'>end of doxygen HL mode
|
||||
/// \endcode
|
||||
/// <beginfold id='2'>\code</beginfold id='2'>*/ a singlelinecommment blubb blubb. stay in doxygen HL mode
|
||||
<endfold id='2'></endfold id='2'>end of doxygen HL mode
|
||||
/// <beginfold id='2'>\code</beginfold id='2'> a multilinecommment blubb blubb
|
||||
/// blubb blubb
|
||||
/// <endfold id='2'>\endcode</endfold id='2'>
|
||||
/// \brief a descriptive text (string) stay in doxygen HL mode
|
||||
/// \brief a descriptive text (string)*/ description should go on here
|
||||
/// \brief a descriptive text */(string) description should go on here
|
||||
/// \brief */a descriptive text (string) description should go on here
|
||||
/// \ref aword a descriptive text (string) */ description should go on here
|
||||
/// \ref aword a descriptive text (str*/ing) description should go on here
|
||||
/// \ref aword a des*/criptive text (string) description should go on here
|
||||
/// \ref aword*/ a descriptive text (string) description should go on here
|
||||
/// \ref aw*/ord a descriptive text (string) description should go on here
|
||||
/// \ref */aword a descriptive text (string) description should go on here
|
||||
|
||||
HTML comment tests:
|
||||
===================
|
||||
//! \ref word de<!--*/ -->scriptive text (string)
|
||||
normal HL mode.
|
||||
//! \ref w descriptive text (string)
|
||||
<beginfold id='1'>/** </beginfold id='1'>\ref word de<!--<endfold id='1'>*/</endfold id='1'> -->scriptive text (string)
|
||||
normal HL mode.
|
||||
<beginfold id='1'>/** </beginfold id='1'>\ref w <!--
|
||||
* HTML comments
|
||||
* -->
|
||||
* normal doxygen HL mode.
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
|
||||
And final tests for a word: a single char:
|
||||
===========================================
|
||||
<tag> <word> <rest of line as string>
|
||||
//! \ref word descriptive text (string)
|
||||
//! \ref w descriptive text (string)
|
||||
|
||||
<tag> <word> <word> <rest is normal HL>
|
||||
//! \image word1 word2 b descriptive text (string)
|
||||
//! \image a word b descriptive text (string)
|
||||
|
||||
<tag> <rest of line is string>
|
||||
//! \brief A b c d e description should go on here
|
||||
|
||||
<tag> <word> <rest of line is normal doxygen HL mode>
|
||||
//! \file word rest of line is normal comment HL
|
||||
//! \file a word rest of line is normal comment HL
|
||||
|
||||
no doxygen HL mode here.
|
||||
== END OF TESTFILE ==
|
||||
@@ -0,0 +1,107 @@
|
||||
<indentfold>port module Test exposing
|
||||
( (&&)
|
||||
, Expect(..)
|
||||
, Test
|
||||
, run
|
||||
)
|
||||
|
||||
<beginfold id='1'>{-</beginfold id='1'>| Module documentation
|
||||
|
||||
# Test
|
||||
|
||||
@docs Test, Expect
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
@docs run
|
||||
|
||||
|
||||
# Operator
|
||||
|
||||
@docs (&&)
|
||||
|
||||
<endfold id='1'>-}</endfold id='1'>
|
||||
|
||||
import Multiline as ML
|
||||
exposing
|
||||
( Data(..)
|
||||
, Payload(..)
|
||||
, response
|
||||
)
|
||||
import Singleline as SL exposing (Dale(..), Single)
|
||||
|
||||
|
||||
-- test file for Elm syntax highlighting in KDE's Kate
|
||||
-- this is a single-line comment
|
||||
<beginfold id='1'>{-</beginfold id='1'>
|
||||
this is a multi-line comment
|
||||
<endfold id='1'>-}</endfold id='1'>
|
||||
|
||||
|
||||
|
||||
infix left 0 (|>) = apR
|
||||
infix right 3 (&&) = and
|
||||
infix non 4 (>=) = ge
|
||||
|
||||
|
||||
type T
|
||||
= T
|
||||
| A
|
||||
| G
|
||||
| C
|
||||
|
||||
|
||||
type alias Alt =
|
||||
T
|
||||
|
||||
|
||||
operator : Int -> Int -> Int
|
||||
operator =
|
||||
(+)
|
||||
|
||||
|
||||
conditional : number -> number -> Maybe number
|
||||
conditional a b =
|
||||
if b == 0 then
|
||||
Nothing
|
||||
|
||||
else if a == 0 then
|
||||
Just 0
|
||||
|
||||
else
|
||||
Just (a / b)
|
||||
|
||||
|
||||
lambda = Int -> Int
|
||||
lambda a =
|
||||
(\a -> a + 35)
|
||||
|
||||
|
||||
|
||||
<beginfold id='1'>{-</beginfold id='1'>| Documentation comment
|
||||
|
||||
Should be same as comment
|
||||
|
||||
<endfold id='1'>-}</endfold id='1'>
|
||||
caseStatement : Maybe number -> number -> number
|
||||
caseStatement a b =
|
||||
case a of
|
||||
Just a_ ->
|
||||
a_
|
||||
|
||||
_ ->
|
||||
b
|
||||
|
||||
|
||||
record : { float : Float, int : Int }
|
||||
record =
|
||||
{ float = 1.455321, int = 83 }
|
||||
|
||||
|
||||
tuple : ( Float, Float )
|
||||
tuple =
|
||||
( 3.14, 9.553 )
|
||||
|
||||
|
||||
port portTest : () -> Cmd msg
|
||||
@@ -0,0 +1,68 @@
|
||||
% testing for the erlang syntax highlighter
|
||||
% NOTE alerts work in comments to TODO !
|
||||
|
||||
% pragmas (show as keywords)
|
||||
-module
|
||||
-export
|
||||
-define
|
||||
-undef
|
||||
-ifdef
|
||||
-ifndef
|
||||
-else
|
||||
-endif
|
||||
-include
|
||||
-include_lib
|
||||
|
||||
% key words
|
||||
after begin case catch cond end fun if let of query receive all_true some_true
|
||||
|
||||
% operators
|
||||
div rem or xor bor bxor bsl bsr and band not bnot
|
||||
+ - * / == /= =:= =/= < =< > >= ++ -- = ! <-
|
||||
|
||||
% separators (show as functions)
|
||||
( ) { } [ ] . : | || ; , ? -> #
|
||||
|
||||
% functions - predefined (part of erlang module) - show as functions
|
||||
abs accept alarm apply atom_to_list binary_to_list binary_to_term check_process_code
|
||||
concat_binary date delete_module disconnect_node element erase exit float float_to_list
|
||||
garbage_collect get get_keys group_leader halt hd integer_to_list is_alive is_atom is_binary
|
||||
is_boolean is_float is_function is_integer is_list is_number is_pid is_port is_process_alive
|
||||
is_record is_reference is_tuple length link list_to_atom list_to_binary list_to_float list_to_integer
|
||||
list_to_pid list_to_tuple load_module loaded localtime make_ref module_loaded node nodes now
|
||||
open_port pid_to_list port_close port_command port_connect port_control ports pre_loaded process_flag
|
||||
process_info processes purge_module put register registered round self setelement size
|
||||
spawn spawn_link spawn_opt split_binary statistics term_to_binary throw time tl trunc tuple_to_list
|
||||
unlink unregister whereis
|
||||
|
||||
% functions - inferred
|
||||
module:function
|
||||
function()
|
||||
|
||||
% atoms (show as "char")
|
||||
% begin with underscore, lowercase, contain numbers letters and @ - or anything between ''
|
||||
middle_underscore
|
||||
abc ab4d a@cd8 a@
|
||||
'And this is (\012) an atom \' Atoo' Variable 'atom again'
|
||||
|
||||
% variables (begin with capital letter or underscore, contain numbers, letters and @)
|
||||
_leadingUnderscore AbdD@ B45@c
|
||||
|
||||
% this is a string
|
||||
"a string sits between \" double quotes" atom "more string"
|
||||
|
||||
% integers (decimal)
|
||||
1. 234 $A
|
||||
|
||||
% integers (specified base)
|
||||
2#10101 34#567
|
||||
|
||||
% float
|
||||
12.23 12.9e-67 12.8E+89 33.34e89
|
||||
|
||||
% and finally some real code, so we can see what it looks like...
|
||||
-module(codetest). % everything is in a module
|
||||
-export([fac/1]). % name and number of arguments - need this to be called outside of the module
|
||||
|
||||
fac(N) when N > 0 -> N * fac(N-1);
|
||||
fac(N) when N == 0 -> 1.
|
||||
@@ -0,0 +1,97 @@
|
||||
-- Test file for Kate's Euphoria syntax highlighting/code folding.
|
||||
<beginfold id='1'>-- BEGIN region marker test</beginfold id='1'>
|
||||
|
||||
-- code here
|
||||
|
||||
<endfold id='1'>-- END region marker test</endfold id='1'>
|
||||
|
||||
-- The N Queens Problem:
|
||||
-- Place N Queens on an NxN chess board
|
||||
-- such that they don't threaten each other.
|
||||
constant N = 8 -- try some other sizes
|
||||
constant ROW = 1, COLUMN = 2
|
||||
constant TRUE = 1, FALSE = 0
|
||||
<beginfold id='2'>type</beginfold id='2'> square(sequence x)
|
||||
-- a square on the board
|
||||
return length(x) = 2
|
||||
<endfold id='2'>end type</endfold id='2'>
|
||||
<beginfold id='2'>type</beginfold id='2'> row(integer x)
|
||||
-- a row on the board
|
||||
return x >= 1 and x <= N
|
||||
<endfold id='2'>end type</endfold id='2'>
|
||||
|
||||
<beginfold id='3'>function</beginfold id='3'> threat(square q1, square q2)
|
||||
-- do two queens threaten each other?
|
||||
<beginfold id='4'>if</beginfold id='4'> q1[COLUMN] = q2[COLUMN] then
|
||||
return TRUE
|
||||
elsif q1[ROW] - q1[COLUMN] = q2[ROW] - q2[COLUMN] then
|
||||
return TRUE
|
||||
elsif q1[ROW] + q1[COLUMN] = q2[ROW] + q2[COLUMN] then
|
||||
return TRUE
|
||||
elsif q1[ROW] = q2[ROW] then
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
<endfold id='4'>end if</endfold id='4'>
|
||||
<endfold id='3'>end function</endfold id='3'>
|
||||
|
||||
<beginfold id='3'>function</beginfold id='3'> conflict(square q, sequence queens)
|
||||
-- Would square p cause a conflict with other queens on board so far?
|
||||
<beginfold id='5'>for</beginfold id='5'> i = 1 to length(queens) do
|
||||
<beginfold id='4'>if</beginfold id='4'> threat(q, queens[i]) then
|
||||
return TRUE
|
||||
<endfold id='4'>end if</endfold id='4'>
|
||||
<endfold id='5'>end for</endfold id='5'>
|
||||
return FALSE
|
||||
<endfold id='3'>end function</endfold id='3'>
|
||||
|
||||
integer soln
|
||||
soln = 0 -- solution number
|
||||
|
||||
<beginfold id='6'>procedure</beginfold id='6'> print_board(sequence queens)
|
||||
-- print a solution, showing the Queens on the board
|
||||
integer k
|
||||
position(1, 1)
|
||||
printf(1, "Solution #%d\n\n ", soln)
|
||||
<beginfold id='5'>for</beginfold id='5'> c = 'a' to 'a' + N - 1 do
|
||||
printf(1, "%2s", c)
|
||||
<endfold id='5'>end for</endfold id='5'>
|
||||
puts(1, "\n")
|
||||
<beginfold id='5'>for</beginfold id='5'> r = 1 to N do
|
||||
printf(1, "%2d ", r)
|
||||
<beginfold id='5'>for</beginfold id='5'> c = 1 to N do
|
||||
<beginfold id='4'>if</beginfold id='4'> find({r,c}, queens) then
|
||||
puts(1, "Q ")
|
||||
else
|
||||
puts(1, ". ")
|
||||
<endfold id='4'>end if</endfold id='4'>
|
||||
<endfold id='5'>end for</endfold id='5'>
|
||||
puts(1, "\n")
|
||||
<endfold id='5'>end for</endfold id='5'>
|
||||
puts(1, "\nPress Enter. (q to quit) ")
|
||||
<beginfold id='7'>while</beginfold id='7'> TRUE do
|
||||
k = get_key()
|
||||
<beginfold id='4'>if</beginfold id='4'> k = 'q' then
|
||||
abort(0)
|
||||
elsif k != -1 then
|
||||
exit
|
||||
<endfold id='4'>end if</endfold id='4'>
|
||||
<endfold id='7'>end while</endfold id='7'>
|
||||
<endfold id='6'>end procedure</endfold id='6'>
|
||||
|
||||
<beginfold id='6'>procedure</beginfold id='6'> place_queen(sequence queens)
|
||||
-- place queens on a NxN chess board
|
||||
-- (recursive procedure)
|
||||
row r -- only need to consider one row for each queen
|
||||
<beginfold id='4'>if</beginfold id='4'> length(queens) = N then
|
||||
soln += 1
|
||||
print_board(queens)
|
||||
return
|
||||
<endfold id='4'>end if</endfold id='4'>
|
||||
r = length(queens)+1
|
||||
<beginfold id='5'>for</beginfold id='5'> c = 1 to N do
|
||||
<beginfold id='4'>if</beginfold id='4'> not conflict({r,c}, queens) then
|
||||
place_queen(append(queens, {r,c}))
|
||||
<endfold id='4'>end if</endfold id='4'>
|
||||
<endfold id='5'>end for</endfold id='5'>
|
||||
<endfold id='6'>end procedure</endfold id='6'>
|
||||
@@ -0,0 +1,31 @@
|
||||
* This file is an example to test the syntax highlighting file fortran-fixed.xml
|
||||
* (for fortran, fixed format)
|
||||
|
||||
c <-- this is a comment in the old fortran 77 style (fixed form)
|
||||
c In the free form file, so we shouldn't use this kind of comments!
|
||||
c But fortran 90 still understands fixed form, when parsing sources with
|
||||
c the *.f extension.
|
||||
|
||||
* this 'c' shouldn't be highlighted as a comment!
|
||||
c
|
||||
|
||||
* Prints the values of e ** (j * i * pi / 4) for i = 0, 1, 2, ..., 7
|
||||
* where j is the imaginary number sqrt(-1)
|
||||
|
||||
<beginfold id='1'>PROGRAM</beginfold id='1'> CMPLXD
|
||||
IMPLICIT COMPLEX(X)
|
||||
PARAMETER (PI = 3.141592653589793, XJ = (0, 1)) this text should be highlighted as a comment because it is after the 72th column (ignored by the compiler)
|
||||
<beginfold id='2'>DO</beginfold id='2'> 1, I = 0, 7
|
||||
X = EXP(XJ * I * PI / 4)
|
||||
IF (AIMAG(X).LT.0) <beginfold id='2'>THEN</beginfold id='2'>
|
||||
PRINT 2, 'e**(j*', I, '*pi/4) = ', ! I am an in-line comment
|
||||
* REAL(X), ' - j',-AIMAG(X) ! the character at the 6th column indicate a continuation line and should be highlighted as a continuation character
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>ELSE</beginfold id='2'>
|
||||
PRINT 2, 'e**(j*', I, '*pi/4) = ',
|
||||
* REAL(X), ' + j', AIMAG(X)
|
||||
<endfold id='2'>END IF</endfold id='2'>
|
||||
FORMAT (A, I1, A, F10.7, A, F9.7)
|
||||
CONTINUE
|
||||
<endfold id='2'>ENDDO</endfold id='2'>
|
||||
STOP
|
||||
<endfold id='1'>END</endfold id='1'>
|
||||
@@ -0,0 +1,177 @@
|
||||
! This file is an example to test the syntax highlighting file fortran-free.xml
|
||||
! (for fortran, free format)
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! THIS IS AN EXAMPLE OF A MODULE !
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
<beginfold id='1'>module</beginfold id='1'> module_example
|
||||
|
||||
! use 'implicit none' when you want all variables to be declared
|
||||
implicit none
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! PUBLICS AND PRIVATES
|
||||
|
||||
! In fortran 90 you can define your own operator
|
||||
public :: operator(.norm.)
|
||||
public :: operator(+) ! <-- you can also overload the usual operators
|
||||
public :: factorial
|
||||
public :: example_fn
|
||||
|
||||
private :: point3d_add
|
||||
private :: point3d_norm
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! USER-DEFINED TYPES...
|
||||
|
||||
! This is a definition to use in declarations of real variables,
|
||||
! parameters, etc.
|
||||
integer, parameter, public :: kr = selected_real_kind(10)
|
||||
|
||||
! This is a user-defined type
|
||||
type, public :: point3d
|
||||
real(kind=kr) :: x, y, z
|
||||
end type point3d
|
||||
|
||||
! This type is useless: it is only an example of type definition!
|
||||
type, public :: example_type
|
||||
complex(kind=kr) :: c ! <-- a complex number (two reals of kind kr)!
|
||||
real, dimension(-10:10) :: & ! <-- this line does not end here!
|
||||
r1, r2 ! <-- this is the final part of the previous line
|
||||
real, pointer, dimension(:) :: pointer_to_array_of_real
|
||||
real, dimension(:), pointer :: array_of_pointer_to_real
|
||||
end type example_type
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! INTERFACES...
|
||||
|
||||
! Interface for the norm of a 3-D vector
|
||||
interface operator(.norm.)
|
||||
module procedure point3d_norm
|
||||
end interface
|
||||
|
||||
! Interface for the operator '+'
|
||||
interface operator(+)
|
||||
module procedure point3d_add
|
||||
end interface
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! SOME DECLARATIONS...
|
||||
|
||||
! A real number can be declared with the following line:
|
||||
real(kind=kr) :: real_var1
|
||||
! But if you are not interested on the precision of floating point numbers,
|
||||
! you can use simply:
|
||||
real :: real_var2
|
||||
|
||||
! An array can be declared in two ways:
|
||||
real(kind=kr), dimension(1:10, -4:5), private :: a, b, c
|
||||
real(kind=kr), private :: d(1:10, -4:5)
|
||||
|
||||
! This is a string with fixed lenght
|
||||
character(len=10) :: str_var
|
||||
|
||||
! This is an allocatable array, which can be a target of a pointer
|
||||
type(example_type), private, dimension(:), allocatable, target :: &
|
||||
many_examples
|
||||
|
||||
! Fortran 90 hasn't got its own preprocessor, it uses the C preprocessor!
|
||||
#ifdef XXX
|
||||
|
||||
#endif
|
||||
|
||||
<endfold id='1'></endfold id='1'><beginfold id='1'>contains</beginfold id='1'>
|
||||
|
||||
|
||||
! The sum of two points
|
||||
pure <beginfold id='1'>function</beginfold id='1'> point3d_add(a, b) result(rs)
|
||||
type(point3d) :: rs
|
||||
type(point3d), intent(in) :: a, b
|
||||
rs%x = a%x + b%x
|
||||
rs%y = a%y + b%y
|
||||
rs%z = a%z + b%z
|
||||
<endfold id='1'>end function</endfold id='1'> point3d_add
|
||||
|
||||
|
||||
! The norm of a point
|
||||
pure <beginfold id='1'>function</beginfold id='1'> point3d_norm(a) result(rs)
|
||||
real(kind=kr) :: rs
|
||||
type(point3d), intent(in) :: a
|
||||
rs = sqrt(a%x * a%x + a%y * a%y + a%z * a%z)
|
||||
<endfold id='1'>end function</endfold id='1'> point3d_norm
|
||||
|
||||
|
||||
! A simple recursive function
|
||||
recursive <beginfold id='1'>function</beginfold id='1'> factorial(i) result (rs)
|
||||
integer :: rs
|
||||
integer, intent(in) :: i
|
||||
if ( i <= 1 ) <beginfold id='2'>then</beginfold id='2'>
|
||||
rs = 1
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'>
|
||||
rs = i * factorial(i - 1)
|
||||
<endfold id='2'>end if</endfold id='2'>
|
||||
<endfold id='1'>end function</endfold id='1'> factorial
|
||||
|
||||
|
||||
! This is a useless function
|
||||
<beginfold id='1'>subroutine</beginfold id='1'> example_fn(int_arg, real_arg, str_arg)
|
||||
integer, intent(in) :: int_arg
|
||||
real(kind=kr), intent(out) :: real_arg
|
||||
character(len=*), intent(in) :: str_arg
|
||||
|
||||
type(example_type), pointer :: p
|
||||
integer :: n, i, j
|
||||
logical :: flag
|
||||
|
||||
flag = .true. ! .true. is not an operator!
|
||||
if ( flag .and. flag ) <beginfold id='2'>then</beginfold id='2'> ! .and. is a pre-defined operator
|
||||
print *, "blabla"
|
||||
<endfold id='2'>end if</endfold id='2'>
|
||||
|
||||
! Examples of inquiry functions: allocated, lbound, ubound.
|
||||
if ( .not. allocated(many_examples) ) <beginfold id='2'>then</beginfold id='2'>
|
||||
allocate( many_examples(10) )
|
||||
<endfold id='2'>end if</endfold id='2'>
|
||||
print *, "Lower bound = ", lbound(many_examples, 1)
|
||||
print *, "Upper bound = ", ubound(many_examples, 1)
|
||||
|
||||
p => many_examples(5) ! <-- p is a pointer
|
||||
|
||||
! A strange way to calculate i*i: add the first i odd numbers
|
||||
i = 6
|
||||
j = 0
|
||||
<beginfold id='2'>do</beginfold id='2'> n = 1, i
|
||||
j = j + (2*n - 1)
|
||||
<endfold id='2'>end do</endfold id='2'>
|
||||
print *, "i*i = ", i*i, j
|
||||
|
||||
real_arg = real(j) ! <-- here the highlighting is not very good:
|
||||
! it is unable to distinguish between this and a definition like:
|
||||
! real(kind=kr) :: a
|
||||
deallocate( many_examples )
|
||||
<endfold id='1'>end subroutine</endfold id='1'> example_fn
|
||||
|
||||
<endfold id='1'>end module</endfold id='1'> module_example
|
||||
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! THIS IS THE MAIN PROGRAM !
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
<beginfold id='1'>program</beginfold id='1'> example
|
||||
use module_example
|
||||
|
||||
! this is another example of use of the 'implicit' keyword
|
||||
implicit double precision (a-h,o-z)
|
||||
|
||||
real(kind=kr) :: var_out
|
||||
|
||||
type(point3d) :: &
|
||||
a = point3d(0.0_kr, 1.0_kr, 2.0_kr), &
|
||||
b = point3d(4.0_kr, 5.0_kr, 6.0_kr)
|
||||
|
||||
print *, "a + b = ", .norm. (a + b)
|
||||
print *, "factorial of 5 = ", factorial(5)
|
||||
|
||||
call example_fn(1, var_out, "hello!")
|
||||
|
||||
<endfold id='1'>end program</endfold id='1'> example
|
||||
+499
@@ -0,0 +1,499 @@
|
||||
### Comments
|
||||
# TODO
|
||||
# <beginfold id='1'>BEGIN</beginfold id='1'>
|
||||
# fg sfg sfh sft
|
||||
# <endfold id='1'>END</endfold id='1'>
|
||||
#
|
||||
# text in (parenthesis) is ok, (even
|
||||
# over several lines)
|
||||
# escaped \) and \( are ok
|
||||
# an unbalanced single ) is not ok
|
||||
# This is due to fish comment handling in command substitutions
|
||||
# which cannot reasonably handled by kate syntax highlighting
|
||||
|
||||
|
||||
### Commands and paths
|
||||
ls -l |sort
|
||||
ls -1
|
||||
/usr/bin/ls -l /usr/local/test/ -xyz # option as indicator of CommandArgs context
|
||||
./bin/ls -l /usr/abc**/tes?/lkhlk -xyz # tabulator as separator
|
||||
../bin/ls -l /usr/abc**/tes?/lkhlk
|
||||
~/bin/ls -l ../usr/lo\ cal/test
|
||||
~user/bin/ls -l /usr/{local,remote}}/test|cat # show error
|
||||
/usr/bin/../lib/ls -l /usr/local/test.???|cat
|
||||
/usr/bin\ sdfg/ls -l /usr/local/test.*
|
||||
usr/bin/other -l ~user/local/test
|
||||
\ usr/bin/other -l ~user/local/test
|
||||
/usr/bin/lsother
|
||||
../test/root/bin/fish -c "echo $t8"
|
||||
test/root/bin/fish -c "echo $t8"
|
||||
u?r/bin/ls
|
||||
usr/b?n/ls
|
||||
u*ls # doesn't work, but ok
|
||||
"ls" /tmp/testtest # Quotes in commands are expanded
|
||||
/us"r/bin"/xy/ls
|
||||
abcd$a # show error
|
||||
other) abc # show error
|
||||
<other abc # show error
|
||||
other> abc # ok
|
||||
oth>er abc # ok
|
||||
ot(her) abc # show error
|
||||
|
||||
-cmd
|
||||
déjà-vu
|
||||
|
||||
ls /ho"me/te"st'user'/abc$dir[3]/ab(echo cdefg)cd/xyz
|
||||
cat\ alog -abc
|
||||
ls path_not_detected
|
||||
ls * no_path
|
||||
ls *path_detected
|
||||
ls/
|
||||
ls;echo xy
|
||||
flex++
|
||||
echo [abc] abc
|
||||
|
||||
#specials
|
||||
command -s ls
|
||||
builtin --names jobs
|
||||
exec bash
|
||||
exec $test
|
||||
set -e i[-1]
|
||||
set test1[-1..1] $test; echo $test1
|
||||
set test1[1..$n] $test; echo $test1
|
||||
set test1[$n..1] $test; echo $test1
|
||||
set test1[2..4 -2..-4] $test1[4..2 -4..-2]; echo $test1
|
||||
set test1[2..4 -2..-4][1] $test1[4..2 -4..-2][1]
|
||||
# ~~~ invalid
|
||||
set test1\
|
||||
[2..4 -2..-4]\
|
||||
[1] a
|
||||
#~~ invalid
|
||||
set test1 \
|
||||
#bla bla
|
||||
a b c
|
||||
set page_url http://fishshell.com/docs/$version_string/$fish_help_page # ???
|
||||
string split . example.com
|
||||
set b (string repeat -n 512 x)
|
||||
|
||||
read -gi test # ok
|
||||
read -gi $test
|
||||
read -gi "test"
|
||||
read -gi (echo test)
|
||||
|
||||
set x (string split --max 1 --right / (status current-filename) #Comment test)
|
||||
set test (exec $cmd)
|
||||
|
||||
# direct path
|
||||
test -d $tmpldir/resources
|
||||
|
||||
### Options
|
||||
cat -l /usr/local/test>logfile
|
||||
ls --longopt=/test
|
||||
ls -l"kasdflakjs" -r/usr/test -x../test/../bla -z~xyz/hello
|
||||
|
||||
### Arguments
|
||||
echo abc"def"ghi
|
||||
echo abc/def
|
||||
echo abc[de]
|
||||
echo abc(echo def)ghi
|
||||
echo abc{de,f}ghi
|
||||
|
||||
# Path Detection
|
||||
cd abc*efghi # fish assumes * is glob -> path
|
||||
cd abc?efghi
|
||||
cd ..
|
||||
cd .. #
|
||||
cd .
|
||||
cd . #
|
||||
cd ~
|
||||
cd ~abc/abc/*.txt
|
||||
cd ./abc
|
||||
cd ../abc
|
||||
cd \ abc/tmp\ .txt
|
||||
|
||||
test .. abc
|
||||
|
||||
### Escapes
|
||||
touch a\?bc\[\]ax\~dsf\#gsd\af\(\)dg\?sd\ fg\bhh\%j\$k\\l\?sed\*jk\>hj\<hou\&h\;hgkj\^kj\"kjh\'jhg
|
||||
touch sdf\xa5lh\Xb7kll\157j\158hk\ua47bz\U123b5678fs\cxzdfga
|
||||
|
||||
touch "a\?bc\[\]a" # no escaping in Quotes
|
||||
touch fgh\y1 # \y is no escape sequence in fish, show it as normal text like fish itself
|
||||
|
||||
### Builtins
|
||||
. hallo
|
||||
source hallo
|
||||
eval ls . /tmp
|
||||
eval ls .../tmp
|
||||
eval $var
|
||||
eval abc
|
||||
eval {l,a}s # lists ./as. colours not ok, but we cut here
|
||||
eval "echo bla"
|
||||
|
||||
history merge
|
||||
|
||||
true ;ls
|
||||
echo (true)
|
||||
echo (true #comment)
|
||||
echo (true>>xyz/abc)
|
||||
true -error # show error
|
||||
pwd > abc
|
||||
|
||||
command -s ls;cat test
|
||||
builtin -n;builtin echo
|
||||
|
||||
complete -c myprog -s o -l output -a "yes no"
|
||||
builtin jobs
|
||||
|
||||
math -s0 10.0 / 6.0
|
||||
|
||||
#special keywords as directory names:
|
||||
/usr/function/testtest /usr/function/testtest
|
||||
/usr/for/testtest /usr/for/testtest
|
||||
/usr/begin/testtest /usr/begin/testtest
|
||||
/usr/switch/testtest /usr/switch/testtest
|
||||
/usr/if/testtest /usr/if/testtest
|
||||
/usr/while/testtest /usr/while/testtest
|
||||
/usr/command/testtest /usr/command/testtest
|
||||
/usr/builtin/testtest /usr/builtin/testtest
|
||||
/usr/eval/testtest /usr/eval/testtest
|
||||
/usr/exec/testtest /usr/exec/testtest
|
||||
/usr/set/testtest /usr/set/testtest
|
||||
/usr/test/testtest /usr/test/testtest
|
||||
|
||||
### test
|
||||
test NUM1 -eq NUM2
|
||||
test -f /tmp/abc -a -e /tmp/def;cat /tmp/abc;
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> test \( -f /foo -o -f /bar \) -a \( -f /baz -o -f /bat \)
|
||||
echo Success.
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
|
||||
[ 25 -eq $NUM2 ]
|
||||
[ "abc" = "$STRING2" ]
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> [ ! \(STRING1 != STRING2\) ];ls;<endfold id='2'>end</endfold id='2'>
|
||||
<beginfold id='2'>if</beginfold id='2'> [ -f abc ]# show error
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
<beginfold id='2'>if</beginfold id='2'> [ -f abc ] # ok
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> [ ! \(STRING1 != STRING2\) ] ls;<endfold id='2'>end</endfold id='2'> # show error
|
||||
<beginfold id='2'>if</beginfold id='2'> [ "abc" != "def" ] # hallo
|
||||
echo x;<endfold id='2'>end</endfold id='2'>
|
||||
|
||||
### Redirections
|
||||
ls < SOURCE_FILE # stdin
|
||||
ls > DESTINATION # stdout
|
||||
ls ^ DESTINATION # stderr
|
||||
ls >> DESTINATION_FILE # append
|
||||
ls ^^ DESTINATION_FILE # append
|
||||
ls >? DESTINATION # noclobber
|
||||
ls ^? DESTINATION
|
||||
|
||||
ls ^? ~
|
||||
ls ^? ~testuser/abc
|
||||
ls ^?/DESTINATION
|
||||
ls ^?#DESTINATION # show error
|
||||
|
||||
ls > $abc[5]
|
||||
ls >"abc"/defg$v/xyz
|
||||
|
||||
ls >& # show error
|
||||
ls > &1 # show error
|
||||
ls abc>&25 xyz /tmp/xyz $abc
|
||||
ls /tmp/tst>&25? # show error
|
||||
ls /tmp/tst>&25 ? # ok
|
||||
ls 3>&- xyz
|
||||
ls 1<DESTINATION
|
||||
echo Hello > all_output.txt ^&1 xyz
|
||||
ls 2>&-;echo end
|
||||
ls xyz 2>|cat
|
||||
|
||||
ls>x
|
||||
abs>x
|
||||
/bin/ls>x
|
||||
/bin/abs>x
|
||||
|
||||
### Quoting
|
||||
echo 'abcdefg'
|
||||
echo 'abc\'de\\fg'
|
||||
echo 'abc\defg'
|
||||
|
||||
echo "1\"23\$45\\6"
|
||||
echo '1\"23\$45\\6'
|
||||
echo '
|
||||
hallo
|
||||
'
|
||||
echo "$i: '$$name[1][$i]'"
|
||||
|
||||
|
||||
### Piping, Pipelines and background jobs
|
||||
ls -l /tmp/hello 1<DEST| sort
|
||||
comand_1;command_2
|
||||
comand_1 ;command_2
|
||||
ls;ls
|
||||
run_long_job & ls # yes & is a command sequencing operator like | and ;
|
||||
cat foo.txt | head
|
||||
make fish 2>| less #show error
|
||||
|
||||
### Variable Expansion
|
||||
echo $PATH
|
||||
echo $PATH[1..3]
|
||||
echo $PATH[-1..3 5 9..15]
|
||||
echo $PATH[$n[2]]
|
||||
echo $test[1..$n]
|
||||
echo $test[$n..1]
|
||||
echo The plural of $WORD is "$WORD"s
|
||||
echo The plural of $WORD is {$WORD}s
|
||||
echo $$foo[$i]
|
||||
echo $test[(count $test)..1]
|
||||
echo $test[1..(count $test[3])]
|
||||
echo $$foo[1..-1][5]
|
||||
echo $$foo[1..-1]\
|
||||
[5][2]\
|
||||
[5]
|
||||
|
||||
#show error
|
||||
echo $PATH[error
|
||||
echo $PATH[1..error]
|
||||
|
||||
echo $PATH[1 2 34 ]
|
||||
echo $PATH[1.. 2]
|
||||
echo $PATH[1 ..2]
|
||||
|
||||
### Brace Expansion
|
||||
echo input.{c,12h,TXT}
|
||||
echo input.{abc$test[(count $test)..1],(echo $txt)}
|
||||
echo input.{a{b,c},12h,TXT}} # show error
|
||||
|
||||
|
||||
### Index range expansion
|
||||
echo (echo $a)[2..5]
|
||||
echo (echo $a)[2..5 1..3]
|
||||
echo (echo $a)[-1..1]
|
||||
|
||||
### Process expansion
|
||||
fg %ema # ???
|
||||
|
||||
|
||||
### Command substitution
|
||||
echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' (set_color $color_cwd) (/usr/bin/ls) (set_color normal)
|
||||
|
||||
echo (#hallo)abc # ok
|
||||
echo (ls #hallo)abc # ok, die context-Tiefe ist anders
|
||||
echo (ls;#hallo)abc # als hier.
|
||||
echo (ls#hallo)abc # ok: # may be inner part of function names!
|
||||
echo (/usr/bin/ls)
|
||||
echo (ls >>mem/abc)
|
||||
echo (echo $test[2])
|
||||
echo (/usr"/bi"n/ls /tmp)
|
||||
echo (seq 10)[1][2]
|
||||
# ~~~ not an index
|
||||
echo (seq 10)\
|
||||
[1][2]
|
||||
# ~~~ not an index
|
||||
echo (seq 10)\
|
||||
[1]\
|
||||
[2]
|
||||
#~~ not an index
|
||||
|
||||
# multline command substitution
|
||||
set x (echo dirlist; # blabla
|
||||
ls)
|
||||
|
||||
## same, but commented out:
|
||||
|
||||
# set x (echo dirlist; # blabla
|
||||
# ls)
|
||||
|
||||
set pi (math "scale=10; 4*a(1)")
|
||||
|
||||
### Continuation lines
|
||||
ls \
|
||||
/usr/bin
|
||||
|
||||
test "STRING1"="STRING2" -a \
|
||||
"STRING3" = (echo "STRING4")
|
||||
|
||||
echo input.{abc\
|
||||
,12h,\
|
||||
TXT}
|
||||
|
||||
echo (\
|
||||
ls)
|
||||
|
||||
# no line continuation within single quotes
|
||||
echo 'abcdefg\
|
||||
s$dfg sdf'
|
||||
# but within double quotes
|
||||
echo "123456\
|
||||
78910"
|
||||
echo $PATH[1..3\
|
||||
]
|
||||
ls /usr\
|
||||
local/bin
|
||||
echo foo\ bar
|
||||
echo foo\
|
||||
bar
|
||||
|
||||
<beginfold id='3'>for</beginfold id='3'> i \
|
||||
in \
|
||||
a b c
|
||||
echo $i
|
||||
<endfold id='3'>end</endfold id='3'>
|
||||
|
||||
# Bug?
|
||||
# Depending on weakDeliminators, either this works:
|
||||
cat\ alog -abc
|
||||
# or this:
|
||||
builtin\
|
||||
--names jobs
|
||||
builtin \
|
||||
--names jobs
|
||||
|
||||
command \
|
||||
ls
|
||||
|
||||
eval \
|
||||
ls . /tmp
|
||||
eval\
|
||||
ls .../tmp
|
||||
|
||||
set \
|
||||
-e i[-1]
|
||||
set \
|
||||
test1[-1..1] \
|
||||
$test; \
|
||||
echo $test1
|
||||
|
||||
read \
|
||||
-gi test
|
||||
|
||||
|
||||
|
||||
# see https://github.com/fish-shell/fish-shell/pull/1987
|
||||
echo before comment \
|
||||
# comment
|
||||
# comment2
|
||||
after comment # just another argument
|
||||
echo before comment\
|
||||
# comment ^ no space
|
||||
# comment2
|
||||
after comment # a command
|
||||
from root
|
||||
|
||||
echo "hello" | \
|
||||
#remove 'l'
|
||||
#and more
|
||||
tr -d 'l'
|
||||
|
||||
### Trouble
|
||||
make; and make install; or make clean # ok
|
||||
printf '%s\t%s\n' flounder fish # ok
|
||||
diff (sort a.txt | psub) (sort b.txt | psub)
|
||||
source-highlight -f esc (cpp main.c | psub -s .c)
|
||||
|
||||
<beginfold id='4'>while</beginfold id='4'> test -f foo.txt # comment
|
||||
echo hallo
|
||||
<endfold id='4'>end</endfold id='4'>
|
||||
|
||||
<beginfold id='3'>for</beginfold id='3'> i in {1,(ls),3} # comment
|
||||
echo $i
|
||||
<endfold id='3'>end</endfold id='3'>
|
||||
|
||||
# function
|
||||
<beginfold id='5'>function</beginfold id='5'> __hidden # comment
|
||||
cd /
|
||||
<endfold id='5'>end</endfold id='5'>
|
||||
|
||||
<beginfold id='5'>function</beginfold id='5'> ll \
|
||||
<beginfold id='6'>-d </beginfold id='6'>"multiline
|
||||
description<endfold id='6'>"</endfold id='6'>
|
||||
ls -l $argv
|
||||
<endfold id='5'>end</endfold id='5'>
|
||||
|
||||
<beginfold id='5'>function</beginfold id='5'> ls <beginfold id='6'>--description=</beginfold id='6'>"Description<endfold id='6'>"</endfold id='6'> -a a b c # comment
|
||||
command ls --color=auto $argv
|
||||
<beginfold id='2'>if</beginfold id='2'> test -f foo.txt
|
||||
echo foo.txt exists
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> if test -f bar.txt # comment
|
||||
echo bar.txt exists
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'>
|
||||
echo foo.txt and bar.txt do not exist
|
||||
<endfold id='2'>end</endfold id='2'> # comment
|
||||
<endfold id='5'>end</endfold id='5'>
|
||||
|
||||
<beginfold id='5'>function</beginfold id='5'> test;echo hallo;<endfold id='5'>end</endfold id='5'> # comment
|
||||
|
||||
<beginfold id='7'>switch</beginfold id='7'> $animal # comment
|
||||
<beginfold id='8'>case</beginfold id='8'> cat # comment
|
||||
echo evil
|
||||
<endfold id='8'></endfold id='8'><beginfold id='8'>case</beginfold id='8'> wolf \
|
||||
dog
|
||||
echo mammal
|
||||
<endfold id='8'></endfold id='8'><beginfold id='8'>case</beginfold id='8'> '*'
|
||||
echo I have no idea what a $animal is
|
||||
<endfold id='8'></endfold id='8'><endfold id='7'>end</endfold id='7'>
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> test (count $argv) = 1
|
||||
echo $argv
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'>
|
||||
echo "?"
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> not test -f spoon #comment
|
||||
echo There is no spoon
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'>
|
||||
exit 1
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
|
||||
<beginfold id='3'>for</beginfold id='3'> file in $cfgfiles
|
||||
<beginfold id='2'>if</beginfold id='2'> test -f $file
|
||||
string match -r '\[Dialer' < $file | string replace -r '\[Dialer (.+)\]' '$1'
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
<endfold id='3'>end</endfold id='3'> | sort -u | string match -v Defaults
|
||||
|
||||
<beginfold id='3'>for</beginfold id='3'> i in *.c
|
||||
<beginfold id='2'>if</beginfold id='2'> grep smurf $i # comment
|
||||
echo Smurfs are present in $i
|
||||
break
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
<endfold id='3'>end</endfold id='3'>
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> <beginfold id='9'>begin</beginfold id='9'> contains -- $argv --force # ohne ; nach begin: geht
|
||||
or not status --is-interactive and not status --is-login
|
||||
<endfold id='9'>end</endfold id='9'>
|
||||
echo ""
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
|
||||
<beginfold id='9'>begin</beginfold id='9'> # comment
|
||||
<beginfold id='3'>for</beginfold id='3'> i in *.tmp
|
||||
<beginfold id='2'>if</beginfold id='2'> grep smurf $i
|
||||
continue
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
rm $i
|
||||
<endfold id='3'>end</endfold id='3'>
|
||||
<endfold id='9'>end</endfold id='9'>
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> [ $status -eq 1 ]
|
||||
set sta pass
|
||||
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'>
|
||||
set sta fail
|
||||
<endfold id='2'>end</endfold id='2'>
|
||||
|
||||
exec "$test"
|
||||
|
||||
|
||||
# Process Expansion
|
||||
# see fish issue 4230
|
||||
kill -STOP %self
|
||||
|
||||
endcmd # is a command
|
||||
|
||||
<beginfold id='3'>for</beginfold id='3'> inc in a # inc is a variable
|
||||
<endfold id='3'>end</endfold id='3'>
|
||||
|
||||
<beginfold id='7'>switch</beginfold id='7'> d;<beginfold id='8'>case</beginfold id='8'> "*" ; <endfold id='8'></endfold id='8'><beginfold id='8'>case</beginfold id='8'> d;echo; <endfold id='8'></endfold id='8'><endfold id='7'>end</endfold id='7'>
|
||||
|
||||
<beginfold id='2'>if</beginfold id='2'> ; <endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> if ; <endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> if ; <beginfold id='2'>if</beginfold id='2'> ; <endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> ; <endfold id='2'>end</endfold id='2'>;<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> ; <endfold id='2'>end</endfold id='2'>
|
||||
@@ -0,0 +1,148 @@
|
||||
<beginfold id='1'>/*</beginfold id='1'> This test file tests Kate's ANTLR highlighting
|
||||
compilable bt ANTLR although not directly:
|
||||
grammar can be alone file for both parser and lexer
|
||||
or two files
|
||||
This file is merged TestParser.g4 and TestLexer.g4
|
||||
this lines also tests regions of multiline comment
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
//file TestParser.g4
|
||||
parser grammar TestParser;
|
||||
|
||||
options { tokenVocab = TestLexer; }
|
||||
|
||||
// The main entry point for parsing a grammar.
|
||||
|
||||
startRule
|
||||
: (expression | STRING)+ EOF
|
||||
;
|
||||
|
||||
expression
|
||||
: expression PLUS mulExpr
|
||||
| expression MINUS mulExpr
|
||||
| mulExpr
|
||||
;
|
||||
|
||||
mulExpr
|
||||
: mulExpr MUL unaryExpr
|
||||
| mulExpr DIV unaryExpr
|
||||
| unaryExpr
|
||||
;
|
||||
|
||||
unaryExpr
|
||||
: atom
|
||||
| LPAR expression RPAR
|
||||
;
|
||||
|
||||
atom
|
||||
: IDENT
|
||||
| number
|
||||
;
|
||||
|
||||
number
|
||||
: INT
|
||||
| FLOAT
|
||||
;
|
||||
|
||||
//================================
|
||||
//file TestLexer.g4
|
||||
|
||||
lexer grammar TestLexer;
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>'channels' and '{' must be in one line
|
||||
to correct highlighting, highlighter can't
|
||||
recognize regular expression "(options|tokens|channels)(?=([\s]*{))"
|
||||
where apart from \s whitrspaces are end of lines
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
channels { OFF_CHANNEL , COMMENT }
|
||||
|
||||
|
||||
PLUS
|
||||
: '+'
|
||||
;
|
||||
|
||||
MINUS
|
||||
: '-'
|
||||
;
|
||||
|
||||
MUL
|
||||
: '*'
|
||||
;
|
||||
|
||||
DIV
|
||||
: '/'
|
||||
;
|
||||
|
||||
LPAR
|
||||
: '('
|
||||
;
|
||||
|
||||
RPAR
|
||||
: ')'
|
||||
;
|
||||
|
||||
IDENT
|
||||
: Nondigit
|
||||
( Nondigit
|
||||
| Digit
|
||||
)*
|
||||
;
|
||||
|
||||
fragment
|
||||
Digit
|
||||
: [0-9]
|
||||
;
|
||||
|
||||
fragment
|
||||
NonzeroDigit
|
||||
: [1-9]
|
||||
;
|
||||
|
||||
fragment
|
||||
Nondigit
|
||||
: [a-zA-Z_]
|
||||
;
|
||||
|
||||
Sign
|
||||
: '+' | '-'
|
||||
;
|
||||
|
||||
INT
|
||||
: Sign? (NonzeroDigit Digit* | '0')
|
||||
;
|
||||
|
||||
fragment
|
||||
DigitSequence
|
||||
: Digit+
|
||||
;
|
||||
|
||||
fragment
|
||||
ExponentPart
|
||||
: [eE] Sign? DigitSequence
|
||||
;
|
||||
|
||||
fragment
|
||||
FractionalConstant
|
||||
: DigitSequence? '.' DigitSequence
|
||||
| DigitSequence '.'
|
||||
;
|
||||
|
||||
FLOAT
|
||||
: (FractionalConstant ExponentPart? | DigitSequence ExponentPart)
|
||||
;
|
||||
|
||||
|
||||
fragment
|
||||
EscapeSequence
|
||||
: '\\' ['"?abfnrtvhe\\]
|
||||
;
|
||||
|
||||
//between [] is charset , test escape \
|
||||
fragment
|
||||
SChar
|
||||
: ~["\\\r\n]
|
||||
| EscapeSequence
|
||||
;
|
||||
|
||||
STRING
|
||||
: '"' SChar* '"'
|
||||
;
|
||||
@@ -0,0 +1,157 @@
|
||||
GNU gdb (GDB) 8.1
|
||||
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
|
||||
and "show warranty" for details.
|
||||
This GDB was configured as "x86_64-pc-linux-gnu".
|
||||
Type "show configuration" for configuration details.
|
||||
For bug reporting instructions, please see:
|
||||
<http://www.gnu.org/software/gdb/bugs/>.
|
||||
Find the GDB manual and other documentation resources online at:
|
||||
<http://www.gnu.org/software/gdb/documentation/>.
|
||||
For help, type "help".
|
||||
Type "apropos word" to search for commands related to "word"...
|
||||
Reading symbols from your_application...done.
|
||||
(gdb) break main
|
||||
# this is a comment
|
||||
(gdb) run <arguments for your application>
|
||||
...
|
||||
Breakpoint 1 at 0x400b56: file yourmain.cpp, line 3
|
||||
3: int main(int argc, char* argv[])
|
||||
(gdb) continue
|
||||
(gdb) backtrace
|
||||
#0 0x7f59e39bf18d in poll () from /usr/lib/libc.so.6
|
||||
#1 0x7f59df6c8c7c in ?? () from /usr/lib/libglib-2.0.so.0
|
||||
#2 0x7f59df6c8d8c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
|
||||
#3 0x7f59e480b23f in QEventDispatcherGlib::processEvents(...)
|
||||
from /usr/lib/libQt5Core.so.5
|
||||
...
|
||||
(gdb) where
|
||||
#0 main (argc=1, argv=0x7fffffffca88) at ../../debugging/ex_debugger/main.cpp:11
|
||||
(gdb) list
|
||||
10 bool run = true;
|
||||
11 while (run) {
|
||||
12 // infinite loop! can you make it quit?
|
||||
13 }
|
||||
(gdb) info locals
|
||||
app = <incomplete type>
|
||||
run = true
|
||||
complexData = {{d = 0x61d430, e = 0x61d430}}
|
||||
(gdb) info scope main.cpp:12
|
||||
Scope for main.cpp:12:
|
||||
Symbol argc is a variable at frame base reg $rbp offset 0+-8, length 4.
|
||||
Symbol argv is a variable at frame base reg $rbp offset 0+-16, length 8.
|
||||
(gdb) ptype run
|
||||
type = bool
|
||||
(gdb) print run
|
||||
run = true
|
||||
(gdb) set run = false
|
||||
(gdb) print run
|
||||
run = false
|
||||
(gdb) print myString.size()
|
||||
42
|
||||
(gdb) ptype MyType
|
||||
type = class MyType {
|
||||
private:
|
||||
int foo;
|
||||
public:
|
||||
int foo() const;
|
||||
...
|
||||
}
|
||||
(gdb) break QMessageLogger::warning
|
||||
Breakpoint 1 at 0x7ffff6f143f0 (8 locations)
|
||||
(gdb) command 1
|
||||
Type commands for breakpoint(s) 1, one per line.
|
||||
End with a line saying just \"end\".
|
||||
> backtrace
|
||||
> continue
|
||||
> end
|
||||
(gdb) catch throw # or when an exception is thrown
|
||||
Catchpoint 2 (throw)
|
||||
(gdb) break main.cpp:12 # or when certain code is executed
|
||||
Breakpoint 3 at 0x401216: file ../../debugging/ex_debugger/main.cpp, line 12.
|
||||
(gdb) info breakpoints
|
||||
Num Type Disp Enb Address What
|
||||
1 breakpoint keep y <MULTIPLE>
|
||||
1.1 y 0x7ffff6f143f0 <QMessageLogger::warning(char const*, …
|
||||
...
|
||||
2 breakpoint keep y 0x7ffff66d9b90 exception throw
|
||||
3 breakpoint keep y 0x000000401216 in main(int, char**)
|
||||
at debugging/ex_debugger/main.cpp:12
|
||||
(gdb) condition 3 argc > 5
|
||||
# ^-- breakpoint id, see `info breakpoints` above
|
||||
(gdb) call myFunction()
|
||||
(gdb) set pagination off
|
||||
(gdb) set logging file /tmp/warnings.log
|
||||
(gdb) set logging on
|
||||
Copying output to /tmp/warnings.log.
|
||||
(gdb) info threads
|
||||
Id Target Id Frame
|
||||
2 Thread 0x7fffe10e1700 (LWP 7271) \"QXcbEventReader\"
|
||||
0x7ffff0b6718d in poll () from /usr/lib/libc.so.6
|
||||
* 1 Thread 0x7ffff7edd840 (LWP 7267) \"kwrite\"
|
||||
0x7ffff0b6718d in poll () from /usr/lib/libc.so.6
|
||||
(gdb) thread
|
||||
[Current thread is 1 (Thread 0x7ffff7edd840 (LWP 7267))]
|
||||
(gdb) thread 2
|
||||
[Switching to thread 2 (Thread 0x7fffe10e1700 (LWP 9765))]
|
||||
(gdb) thread apply all backtrace
|
||||
(gdb) info sharedlibrary
|
||||
From To Syms Read Shared Object Library
|
||||
0x7ffff7ddbb80 0x7ffff7df5610 Yes (*) /lib64/ld-linux-x86-64.so.2
|
||||
0x7ffff7690460 0x7ffff7ab723c Yes /opt/qt/5.5/gcc_64/lib/libQt5Gui.so.5
|
||||
0x7ffff6efdb80 0x7ffff71af318 Yes /opt/qt/5.5/gcc_64/lib/libQt5Core.so.5
|
||||
0x7ffff6c02f60 0x7ffff6c5f852 Yes (*) /usr/lib/libGL.so.1
|
||||
0x7ffff69d3ac0 0x7ffff69e0931 Yes (*) /usr/lib/libpthread.so.0
|
||||
0x7ffff66d5fa0 0x7ffff6781d89 Yes /usr/lib/libstdc++.so.6
|
||||
0x7ffff6353510 0x7ffff63bb33a Yes (*) /usr/lib/libm.so.6
|
||||
...
|
||||
(*): Shared library is missing debugging information.
|
||||
(gdb) list 64
|
||||
59 * If no red can be seen, then the cached implementation is \"good enough\".
|
||||
60 */
|
||||
61 void paintEvent(QPaintEvent *event)
|
||||
62 {
|
||||
63 const QRect rect = event->rect();
|
||||
64
|
||||
65 QPainter painter(this);
|
||||
66 painter.setRenderHint(QPainter::Antialiasing);
|
||||
67 painter.fillRect(rect, Qt::black);
|
||||
68
|
||||
(gdb) dprintf main.cpp:64,\"paint rect(w=%d,h=%d)\\n\",rect.width(),rect.height()
|
||||
Dprintf 1 at 0x403a1e: file path/to/main.cpp, line 64.
|
||||
(gdb) continue
|
||||
Continuing.
|
||||
paint rect(w=202,h=200)
|
||||
paint rect(w=213,h=203)
|
||||
(gdb) target remote <device ip>:<port>
|
||||
Remote debugging using <device ip>:<port>
|
||||
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
|
||||
warning: File transfers from remote targets can be slow.
|
||||
Use \"set sysroot\"to access files locally instead.
|
||||
...
|
||||
(gdb) set sysroot /path/to/sysroot
|
||||
(gdb) print myMap
|
||||
$1 = QMap<QString, int> = {
|
||||
[\"bar\"] = 1,
|
||||
[\"foo\"] = 2
|
||||
}
|
||||
(gdb) print money
|
||||
$1 {
|
||||
{value = 1.20000005, currency = Money::Euro},
|
||||
{value = 3.4000001, currency = Money::Dollar}
|
||||
}
|
||||
(gdb) python
|
||||
> import sys
|
||||
> sys.path.insert<beginfold id='1'>(</beginfold id='1'>0, '/path/to/addon/debugging/ex_gdb_pretty_printer'<endfold id='1'>)</endfold id='1'>
|
||||
> import money_printer
|
||||
> end
|
||||
(gdb) print money
|
||||
$2 = {
|
||||
\"1.200000 Euro\",
|
||||
\"3.400000 Dollar\"
|
||||
}
|
||||
(gdb) continue
|
||||
(gdb) detach
|
||||
(gdb) quit
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
python
|
||||
import sys
|
||||
sys.path.insert<beginfold id='1'>(</beginfold id='1'>0, '/home/milian/projects/compiled/kf5/share/kdevgdb/printers/'<endfold id='1'>)</endfold id='1'>
|
||||
sys.path.insert<beginfold id='1'>(</beginfold id='1'>0, '/home/milian/projects/kdab/training-material/addon/debugging/ex_gdb_pretty_printer'<endfold id='1'>)</endfold id='1'>
|
||||
import money_printer
|
||||
import money_printer_qtcreator
|
||||
end
|
||||
|
||||
source /home/milian/projects/compiled/kf5/share/kdevgdb/printers/gdbinit
|
||||
@@ -0,0 +1,89 @@
|
||||
// This is a test file for the Katepart GLSL Syntax Highlighting.
|
||||
|
||||
normal text
|
||||
// this is a single-line comment
|
||||
normal text
|
||||
<beginfold id='1'>/*</beginfold id='1'> this
|
||||
is a multi-line
|
||||
comment <endfold id='1'>*/</endfold id='1'>
|
||||
normal text
|
||||
|
||||
some_symbol.some_member;
|
||||
some_symbol.some_member_function();
|
||||
some_function();
|
||||
|
||||
// this is a function
|
||||
void main()
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
float f = 1.4e3; // decimal float literal
|
||||
int i1 = 2884; // decimal int literal
|
||||
int i2 = 0x44; // hex int literal
|
||||
int i3 = 0456; // octal int literal
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// this is a structure
|
||||
struct some_struct
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
vec3 some_member_vector;
|
||||
<endfold id='2'>}</endfold id='2'>;
|
||||
|
||||
# this is
|
||||
#preprocessor code
|
||||
|
||||
// all keywords
|
||||
break continue do for while
|
||||
if else
|
||||
true false
|
||||
discard return
|
||||
struct
|
||||
|
||||
// all basic types
|
||||
float int void bool
|
||||
mat2 mat3 mat4
|
||||
vec2 vec3 vec4
|
||||
ivec2 ivec3 ivec4
|
||||
bvec2 bvec3 bvec4
|
||||
sampler1D sampler2D sampler3D
|
||||
samplerCube sampler1DShadow sampler1DShadow
|
||||
|
||||
// all type qualifiers
|
||||
attribute const uniform varying
|
||||
in out inout
|
||||
|
||||
// attensions:
|
||||
// FIXME
|
||||
// TODO
|
||||
// BUG
|
||||
|
||||
// some of the std functions
|
||||
radians degrees sin cos tan asin acos atan
|
||||
|
||||
// some of the std variables
|
||||
gl_Position gl_PointSize gl_ClipVertex
|
||||
|
||||
#version 330 core
|
||||
|
||||
// single line comment
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> single line commonet <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
multi line comment
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
in ColorFormat <beginfold id='2'>{</beginfold id='2'>
|
||||
vec3 color;
|
||||
<endfold id='2'>}</endfold id='2'> fs_in;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
vec3 fun(const in vec3 foo) <beginfold id='2'>{</beginfold id='2'>
|
||||
foo[2] = foo.x;
|
||||
|
||||
return foo;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
void main()
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
fragColor = vec4( fs_in.color, 1.0 );
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
# Examples taken from https://graphql.org/learn/schema/#type-language
|
||||
#
|
||||
# Alerts: TODO FIXME
|
||||
|
||||
query Hero($episode: Episode, $withFriends: Boolean!) <beginfold id='1'>{</beginfold id='1'>
|
||||
hero(episode: $episode) <beginfold id='1'>{</beginfold id='1'>
|
||||
name
|
||||
friends @include(if: $withFriends) <beginfold id='1'>{</beginfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
query <beginfold id='1'>{</beginfold id='1'>
|
||||
droid(id: "2000", num: 42, active: true) <beginfold id='1'>{</beginfold id='1'>
|
||||
name
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
type Person @addExternalFields(source: "profiles") @excludeField(name: "photo") <beginfold id='1'>{</beginfold id='1'>
|
||||
name: String
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
# block strings (from https://github.com/graphql/graphql-spec/blob/master/spec/Section%202%20--%20Language.md)
|
||||
|
||||
"""
|
||||
This starts with and ends with an empty line,
|
||||
which makes it easier to read.
|
||||
"""
|
||||
|
||||
"""This does not start with or end with any empty lines,
|
||||
which makes it a little harder to read."""
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
<indentfold>%title
|
||||
= @title
|
||||
\= @title
|
||||
%script<beginfold id='1'>{</beginfold id='1'>
|
||||
"type": "text/javascript",
|
||||
|
||||
"src": "javascripts/script_#{2 + 7}",
|
||||
"data": <beginfold id='2'>{</beginfold id='2'>
|
||||
"controller": "reporter",
|
||||
<endfold id='2'>}</endfold id='2'>,
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
%div<beginfold id='1'>{</beginfold id='1'>:id => [@item.type, @item.number], :class => [@item.type, @item.urgency]<endfold id='1'>}</endfold id='1'>
|
||||
%div<beginfold id='1'>{</beginfold id='1'>:id => "#{@item.type}_#{@item.number}", :class => "#{@item.type} #{@item.urgency}"<endfold id='1'>}</endfold id='1'>
|
||||
.item<beginfold id='1'>{</beginfold id='1'>:class => @item.is_empty? && "empty"<endfold id='1'>}</endfold id='1'>
|
||||
%a<beginfold id='3'>(</beginfold id='3'>title=@title href=href<endfold id='3'>)</endfold id='3'> Stuff
|
||||
%a<beginfold id='3'>(</beginfold id='3'>title=@title<endfold id='3'>)</endfold id='3'><beginfold id='1'>{</beginfold id='1'>:href => @link.href<endfold id='1'>}</endfold id='1'> Stuff
|
||||
%a<beginfold id='1'>{</beginfold id='1'>:href=>"/posts", :data => <beginfold id='2'>{</beginfold id='2'>:author_id => 123, :category => 7<endfold id='2'>}</endfold id='2'><endfold id='1'>}</endfold id='1'> Posts By Author
|
||||
.book-info<beginfold id='1'>{</beginfold id='1'>:data => <beginfold id='2'>{</beginfold id='2'>:book => <beginfold id='2'>{</beginfold id='2'>:id => 123, :genre => 'programming'<endfold id='2'>}</endfold id='2'>, :category => 7<endfold id='2'>}</endfold id='2'><endfold id='1'>}</endfold id='1'>
|
||||
%div#things
|
||||
%span#rice Chicken Fried
|
||||
%p.beans<beginfold id='1'>{</beginfold id='1'> :food => 'true' <endfold id='1'>}</endfold id='1'> The magical fruit
|
||||
%h1.class.otherclass#id La La La
|
||||
%br/
|
||||
%meta<beginfold id='1'>{</beginfold id='1'>'http-equiv' => 'Content-Type', :content => 'text/html'<endfold id='1'>}</endfold id='1'>/
|
||||
%p<beginfold id='4'>[</beginfold id='4'>user<endfold id='4'>]</endfold id='4'><beginfold id='1'>{</beginfold id='1'>:class => 'alpha bravo'<endfold id='1'>}</endfold id='1'>
|
||||
|
||||
%blockquote<
|
||||
%div
|
||||
Foo!
|
||||
|
||||
%img
|
||||
%img>
|
||||
%img
|
||||
|
||||
%img
|
||||
%pre><
|
||||
foo
|
||||
bar
|
||||
%img
|
||||
|
||||
-# file: app/views/users/show.haml
|
||||
%p
|
||||
hello
|
||||
%div<beginfold id='4'>[</beginfold id='4'>@user, :greeting<endfold id='4'>]</endfold id='4'>
|
||||
%bar<beginfold id='4'>[</beginfold id='4'>290<endfold id='4'>]</endfold id='4'>/
|
||||
Hello!
|
||||
- user = User.find(1)
|
||||
.foo.moo<beginfold id='1'>{</beginfold id='1'>:class => ['bar', 'alpha']<endfold id='1'>}</endfold id='1'><beginfold id='3'>(</beginfold id='3'>class='baz'<endfold id='3'>)</endfold id='3'>
|
||||
!!! XML
|
||||
|
||||
%peanutbutterjelly
|
||||
/ This is the peanutbutterjelly element
|
||||
I like sandwiches!
|
||||
/
|
||||
%p This doesn't render...
|
||||
%div
|
||||
%h1 Because it's commented out!
|
||||
%p
|
||||
/[if IE]
|
||||
%a<beginfold id='1'>{</beginfold id='1'> :href => 'http://www.mozilla.com/en-US/firefox/' <endfold id='1'>}</endfold id='1'>
|
||||
%h1 Get Firefox
|
||||
|
||||
%p foo
|
||||
-# This is a comment
|
||||
%p bar
|
||||
|
||||
%p foo
|
||||
-#
|
||||
This won't be displayed
|
||||
Nor will this
|
||||
Nor will this.
|
||||
%p bar
|
||||
|
||||
%p
|
||||
= ['hi', 'there', 'reader!'].join " "
|
||||
= "yo"
|
||||
|
||||
= link_to_remote "Add to cart",
|
||||
:url => <beginfold id='2'>{</beginfold id='2'> :action => "add", :id => product.id <endfold id='2'>}</endfold id='2'>,
|
||||
:update => <beginfold id='2'>{</beginfold id='2'> :success => "cart", :failure => "error" <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
- foo = "hello"
|
||||
- foo << " there"
|
||||
- foo << " you!"
|
||||
%p= foo
|
||||
|
||||
- links = <beginfold id='2'>{</beginfold id='2'>:home => "/",
|
||||
:docs => "/docs",
|
||||
:about => "/about"<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
- (42...47).each do |i|
|
||||
%p= i
|
||||
%p See, I can count!
|
||||
|
||||
%p
|
||||
- case 2
|
||||
- when 1
|
||||
= "1!"
|
||||
- when 2
|
||||
= "2?"
|
||||
- when 3
|
||||
= "3."
|
||||
|
||||
~ "Foo\n<pre>Bar\nBaz</pre>"
|
||||
|
||||
%p This is #{h quality} cake!
|
||||
%p
|
||||
Look at \\#{h word} lack of backslash: \#{foo}
|
||||
And yon presence thereof: \{foo}
|
||||
&= "I like cheese & crackers"
|
||||
& I like #{"cheese & crackers"}
|
||||
= "I feel <strong>!"
|
||||
!= "I feel <strong>!"
|
||||
! I feel #{"<strong>"}!
|
||||
|
||||
%whoo
|
||||
%hoo= h( |
|
||||
"I think this might get " + |
|
||||
"pretty long so I should " + |
|
||||
"probably make it " + |
|
||||
"multiline so it doesn't " + |
|
||||
"look awful.") |
|
||||
%p This is short.
|
||||
|
||||
!!!
|
||||
%html<beginfold id='1'>{</beginfold id='1'> :xmlns => "http://www.w3.org/1999/xhtml", :lang => "en", "xml:lang" => "en"<endfold id='1'>}</endfold id='1'>
|
||||
%head
|
||||
%title BoBlog
|
||||
%meta<beginfold id='1'>{</beginfold id='1'>"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"<endfold id='1'>}</endfold id='1'>
|
||||
%meta<beginfold id='3'>(</beginfold id='3'>http-equiv="Content-Type" content = "text/html; charset=utf-8" class=21 id='d3'<endfold id='3'>)</endfold id='3'>
|
||||
%link<beginfold id='1'>{</beginfold id='1'>rel: 'stylesheet', href: 'main.css', type: 'text/css'<endfold id='1'>}</endfold id='1'>
|
||||
:css
|
||||
</indentfold> body <beginfold id='5'>{</beginfold id='5'>
|
||||
font-size: 16px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
font-family: Arial, sans-serif;
|
||||
<indentfold> <endfold id='5'>}</endfold id='5'>
|
||||
|
||||
</indentfold> p <beginfold id='5'>{</beginfold id='5'>
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
<indentfold> <endfold id='5'>}</endfold id='5'>
|
||||
%body
|
||||
#header
|
||||
%a<beginfold id='1'>{</beginfold id='1'>
|
||||
href: root_path,
|
||||
name: "home"
|
||||
<endfold id='1'>}</endfold id='1'>
|
||||
%h1 BoBlog
|
||||
%h2 Bob's Blog
|
||||
#content
|
||||
- @entries.each do |entry|
|
||||
.entry<beginfold id='1'>{</beginfold id='1'> id: entry.id <endfold id='1'>}</endfold id='1'>
|
||||
%h3.title= entry.title
|
||||
%p.date
|
||||
Posted on #{entry.posted.strftime("%A, %B %d, %Y")}
|
||||
%p.body= entry.body
|
||||
= button_to "Load more", entries_path,
|
||||
class: "btn btn-primary",
|
||||
method: :get,
|
||||
params: <beginfold id='2'>{</beginfold id='2'> last_id: @entries.map(&:id).min <endfold id='2'>}</endfold id='2'>,
|
||||
form: <beginfold id='2'>{</beginfold id='2'> data: <beginfold id='2'>{</beginfold id='2'> turbo_stream: true <endfold id='2'>}</endfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
:ruby
|
||||
provide(:title, user_title(@user))
|
||||
provide(:og, user_opengraph(@user))
|
||||
provide(:meta, user_twitter_card(@user))
|
||||
|
||||
parent_layout 'user/profile'
|
||||
#footer
|
||||
%p
|
||||
All content copyright © Bob
|
||||
|
||||
#filterTest
|
||||
%p Just testing some more HAML filters
|
||||
|
||||
:coffee
|
||||
window.alert "Hello from CoffeeScript #{1}"
|
||||
|
||||
:coffeescript
|
||||
window.alert "Hello from CoffeeScript again, #{1 + 1}"
|
||||
|
||||
:css
|
||||
</indentfold> #filterTest <beginfold id='5'>{</beginfold id='5'>
|
||||
display: none;
|
||||
<indentfold> <endfold id='5'>}</endfold id='5'>
|
||||
|
||||
:erb
|
||||
For some reason <%= "ERB works too #{@abcdef}" %>.
|
||||
|
||||
:plain
|
||||
Anything else should be treated as plain text.
|
||||
This also means that the following shouldn't be highlighted:
|
||||
|
||||
%h1#superawesomeheading Heading 1
|
||||
|
||||
%div Filter test done
|
||||
@@ -0,0 +1,8 @@
|
||||
THIS IS INVALID
|
||||
:020000006428721
|
||||
:10000800803120007F08FD002700931D0C280D2853
|
||||
:0603D800890BEA29003444
|
||||
:020000040001F9
|
||||
:04000E0084EFFFDE9E
|
||||
:04000E0884EFFFDE9E
|
||||
:00000001FF
|
||||
@@ -0,0 +1,142 @@
|
||||
<indentfold>-- test file for Haskell syntax highlighting in KDE's Kate
|
||||
|
||||
-- The test file for literate Haskell can be easily created like this:
|
||||
-- cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
|
||||
-- You only have to manually edit the multi-line comment below.
|
||||
|
||||
-- this is a single-line comment
|
||||
|
||||
<beginfold id='1'>{-</beginfold id='1'> this is a multi-line comment
|
||||
|
||||
Things like "a string" or a 'c' character shouldn't be highlighted in here.
|
||||
|
||||
-- I could even start a new
|
||||
-- one-line comment.
|
||||
|
||||
<endfold id='1'>-}</endfold id='1'>
|
||||
|
||||
import Prelude --
|
||||
import Prelude ---
|
||||
|
||||
-- a data definition
|
||||
|
||||
data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
|
||||
|
||||
|
||||
-- function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted
|
||||
|
||||
funnyfunction::(Tree a)=>[a]->Integer->Int->Bool
|
||||
|
||||
|
||||
-- strings and chars
|
||||
-- first line of function definitions (type declaration) should be highlighted
|
||||
|
||||
strangefunction::Int->String
|
||||
strangefunction 1 = "hello"
|
||||
strangefunction 2 = "what's up"
|
||||
strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
|
||||
strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
|
||||
strangefunction 5 = '\n':[]
|
||||
strangefunction 6 = '\invalidhaskell':[]
|
||||
|
||||
-- function name including the single quote character
|
||||
-- and infix operator (`div`)
|
||||
|
||||
justtesting'::Int->Int
|
||||
justtesting' 2 = 2+1
|
||||
justtesting' 9 = 7 `div` 2
|
||||
|
||||
-- same definition as above, slightly different function name and a couple more whitespaces
|
||||
|
||||
justtesting'' :: Int -> Int
|
||||
justtesting'' 2 = 3
|
||||
justtesting'' 9 = 3 + 9 - 9
|
||||
|
||||
-- the following lines are copied out of Haskell's "Prelude.hs"
|
||||
|
||||
infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, %
|
||||
|
||||
|
||||
-- everything highlighted except the "a"
|
||||
|
||||
class Bounded a where
|
||||
minBound, maxBound :: a
|
||||
|
||||
class (Num a, Ord a) => Real a where
|
||||
toRational :: a -> Rational
|
||||
|
||||
-- finally, some keyword lists
|
||||
|
||||
-- keywords
|
||||
|
||||
case, class, data, deriving, do, else, family, forall, if, in, infixl, infixr,
|
||||
instance, let, module, of, pattern, primitive,
|
||||
then, type, where
|
||||
|
||||
-- infix operators
|
||||
|
||||
quot, rem, div, mod, elem, notElem, seq
|
||||
|
||||
-- this stuff is not handled yet
|
||||
|
||||
!!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
|
||||
|
||||
-- functions
|
||||
|
||||
abs, acos, acosh, all, and, any, appendFile,
|
||||
approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
|
||||
break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
|
||||
curry, cycle, decodeFloat, denominator, digitToInt, div, divMod, drop,
|
||||
dropWhile, either, elem, encodeFloat, enumFrom, enumFromThen,
|
||||
enumFromThenTo, enumFromTo, error, even, exp, exponent, fail, filter, flip,
|
||||
floatDigits, floatRadix, floatRange, floor, fmap, foldl, foldl1, foldr,
|
||||
foldr1, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
|
||||
fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
|
||||
index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
|
||||
isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
|
||||
isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
|
||||
lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
|
||||
mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
|
||||
negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
|
||||
primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
|
||||
quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
|
||||
readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
|
||||
readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
|
||||
return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
|
||||
sequence, sequence_, show, showChar, showInt, showList, showLitChar,
|
||||
showParen, showSigned, showString, shows, showsPrec, significand, signum,
|
||||
sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
|
||||
either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
|
||||
enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
|
||||
floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
|
||||
toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
|
||||
undefined, unlines, until, unwords, unzip, unzip3, userError, words,
|
||||
writeFile, zip, zip3, zipWith, zipWith3
|
||||
|
||||
-- type constructors
|
||||
|
||||
Bool, Char, Double, Either, FilePath, Float, IO, IOError, Integer, Int, Maybe,
|
||||
Ordering, Rational, Ratio, ReadS, ShowS, String
|
||||
|
||||
-- classes
|
||||
|
||||
Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
|
||||
RealFrac, Real, Show
|
||||
|
||||
-- data constructors
|
||||
|
||||
EQ, False, GT, Just, LT, Left, Nothing, Right, True
|
||||
|
||||
-- promoted data constructors
|
||||
|
||||
'True
|
||||
|
||||
-- pragma with compiler flags
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- multiline pragma with language extensions
|
||||
|
||||
{-# LANGUAGE OverlappingInstances,
|
||||
BangPatterns
|
||||
#-}
|
||||
@@ -0,0 +1,53 @@
|
||||
<beginfold id='1'>/*</beginfold id='1'> highlighting test case for Java <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
// single line comment with ### TODO FIXME
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> multiline comment with ### TODO FIXME <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
<beginfold id='2'>/**</beginfold id='2'> Javadoc comment with ### TODO FIXME
|
||||
* @param foo bla bla ATTENTION
|
||||
* @return abc cde
|
||||
* @see javadoc.xml
|
||||
<endfold id='2'>*/</endfold id='2'>
|
||||
|
||||
package org.kde.itinerary;
|
||||
|
||||
import org.qtproject.qt5.android.bindings.QtActivity;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class Activity extends QtActivity
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
private static final String TAG = "org.kde.itinerary";
|
||||
|
||||
public void launchViewIntentFromUri(String uri)
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
Uri mapIntentUri = Uri.parse(uri);
|
||||
Intent mapIntent = new Intent(Intent.ACTION_VIEW, mapIntentUri);
|
||||
startActivity(mapIntent);
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
|
||||
@Override
|
||||
protected String stuff()
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
while (true) <beginfold id='3'>{</beginfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
int num = 1;
|
||||
num = 0x2;
|
||||
double f = .4e+49;
|
||||
var other = "string";
|
||||
var multilineString = """
|
||||
string \\ \n
|
||||
sdsda""";
|
||||
|
||||
long int_dec = 1__23_48l;
|
||||
long int_oct = 072034__4l;
|
||||
long int_hex = 0xa__12Ff_13L;
|
||||
int int_bin = 0B1011___01;
|
||||
|
||||
double float_hex = 0x1f__a2.d_f10P+1074D;
|
||||
float float_dec = 1__24.1_32e-1____23F;
|
||||
float[] float_d = <beginfold id='3'>{</beginfold id='3'>1.,1.E+3,1.E+3f,1.F,1.1E+3d,1.1E+3,1.1f,1.1,.1E+3f,.1E+3,.1f,.1,1E+3f,1E+3,1f,1d<endfold id='3'>}</endfold id='3'>;
|
||||
assert 1 > 0;
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
h1. Biggest heading
|
||||
h2. Bigger heading
|
||||
h3. Big heading
|
||||
h4. Normal heading
|
||||
h5. Small heading
|
||||
h6. Smallest heading
|
||||
|
||||
*strong* *strong*
|
||||
|
||||
_emphasis_ _emphasis_
|
||||
|
||||
??citation?? ??citation??
|
||||
|
||||
-deleted- -deleted-
|
||||
|
||||
+inserted+ +inserted+
|
||||
|
||||
^superscript^ ^superscript^
|
||||
|
||||
~subscript~ ~subscript~
|
||||
|
||||
{{monospaced}} {{monospaced}}
|
||||
|
||||
bq. Some block quoted text
|
||||
on two lines
|
||||
|
||||
{quote}
|
||||
here is quotable
|
||||
content to be quoted
|
||||
{quote}
|
||||
|
||||
{color:red}
|
||||
look ma, red text!
|
||||
{color}
|
||||
|
||||
(empty line)
|
||||
|
||||
\\
|
||||
----
|
||||
---
|
||||
--
|
||||
|
||||
[#anchor]
|
||||
[^attachment.ext]
|
||||
|
||||
[https://kate-editor.org]
|
||||
[Kate|http://kate-editor.org]
|
||||
|
||||
[mailto:no-real-address-spam@kate-editor.org]
|
||||
|
||||
[file:///c:/temp/foo.txt]
|
||||
[file:///z:/file/on/network/share.txt]
|
||||
|
||||
{anchor:anchorname}
|
||||
[~username]
|
||||
|
||||
* some
|
||||
* bullet
|
||||
** indented
|
||||
** bullets
|
||||
* points
|
||||
|
||||
- different
|
||||
- bullet
|
||||
- types
|
||||
|
||||
# a
|
||||
# numbered
|
||||
# list
|
||||
|
||||
# a
|
||||
# numbered
|
||||
#* with
|
||||
#* nested
|
||||
#* bullet
|
||||
# list
|
||||
|
||||
* a
|
||||
* bulleted
|
||||
*# with
|
||||
*# nested
|
||||
*# numbered
|
||||
* list
|
||||
|
||||
!http://kate-editor.org/image.gif!
|
||||
|
||||
!attached-image.gif!
|
||||
|
||||
!image.jpg|thumbnail!
|
||||
|
||||
!image.gif|align=right, vspace=4!
|
||||
|
||||
!quicktime.mov!
|
||||
!spaceKey:pageTitle^attachment.mov!
|
||||
!quicktime.mov|width=300,height=400!
|
||||
!media.wmv|id=media!
|
||||
|
||||
||heading 1||heading 2||heading 3||
|
||||
|col A1|col A2|col A3|
|
||||
|col B1|col B2|col B3|
|
||||
|
||||
{noformat}
|
||||
preformatted piece of text
|
||||
so *no* further _formatting_ is done here
|
||||
{noformat}
|
||||
|
||||
{panel}
|
||||
Some text
|
||||
{panel}
|
||||
|
||||
{panel:title=My Title|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
|
||||
a block of text surrounded with a *panel*
|
||||
yet _another_ line
|
||||
{panel}
|
||||
|
||||
{code:xml}
|
||||
<beginfold id='1'><</beginfold id='1'>test>
|
||||
<beginfold id='1'><</beginfold id='1'>another tag="attribute"<endfold id='1'>/></endfold id='1'>
|
||||
</test<endfold id='1'>></endfold id='1'>
|
||||
{code}
|
||||
|
||||
{code:xml|borderStyle=solid}
|
||||
<beginfold id='1'><</beginfold id='1'>test>
|
||||
<beginfold id='1'><</beginfold id='1'>another tag="attribute"<endfold id='1'>/></endfold id='1'>
|
||||
</test<endfold id='1'>></endfold id='1'>
|
||||
{code}
|
||||
|
||||
{code:title=file.xml}
|
||||
<beginfold id='1'><</beginfold id='1'>test>
|
||||
<beginfold id='1'><</beginfold id='1'>another tag="attribute"<endfold id='1'>/></endfold id='1'>
|
||||
</test<endfold id='1'>></endfold id='1'>
|
||||
{code}
|
||||
|
||||
{code:title=Bar.java|borderStyle=solid}
|
||||
// Some comments here
|
||||
public String getFoo()
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
return foo;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
{code}
|
||||
@@ -0,0 +1,262 @@
|
||||
#! shebang
|
||||
#! no-shebang
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'> comment <endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
function fun()
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
var boo = <beginfold id='2'>{</beginfold id='2'> 'key': <beginfold id='3'>[</beginfold id='3'> 1, 2.0, 3.0e1, 004, 0x5 <endfold id='3'>]</endfold id='3'> <endfold id='2'>}</endfold id='2'>;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
class MyClass; // reserved keywords
|
||||
|
||||
class ClassWithPrivateField <beginfold id='2'>{</beginfold id='2'>
|
||||
static #privateStaticField = 42;
|
||||
|
||||
static publicStaticMethod() <beginfold id='2'>{</beginfold id='2'>
|
||||
return ClassWithPrivateField.#privateStaticField;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#message;
|
||||
|
||||
#privateMethod() <beginfold id='2'>{</beginfold id='2'>
|
||||
return 42;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
publicMethod() <beginfold id='2'>{</beginfold id='2'>
|
||||
return this.#privateMethod();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
get #decoratedMessage() <beginfold id='2'>{</beginfold id='2'>
|
||||
return this.#message
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
set #decoratedMessage(msg) <beginfold id='2'>{</beginfold id='2'>
|
||||
this.#message = msg;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Member objects: text after "."
|
||||
object.property instanceof Number;
|
||||
iden1.iden2 . iden3.class class;
|
||||
iden1?.iden2 . iden3.class class;
|
||||
iden1.#iden2 . iden3.class class;
|
||||
|
||||
var escapes = "aa\b\n\0a\"a\x12a\32a\u{123}a\$\%\ \#\y\aaa\
|
||||
aaa";
|
||||
var octal = 0o124;
|
||||
var bin = 0b1010;
|
||||
|
||||
日本語().ლಠ益ಠლ.ñá = 42;
|
||||
δ /No-Regex/
|
||||
|
||||
// Only highlight valid regular expressions, of a single line, after strings
|
||||
// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786
|
||||
"text" /No-Regex
|
||||
"text" /Regex[:)]*/;
|
||||
const a = "6" / 2; <beginfold id='1'>/*</beginfold id='1'>comment<endfold id='1'>*/</endfold id='1'> const b = 5;
|
||||
console.log("4" / "2"); // 2
|
||||
// Single quote
|
||||
const a = '6' / 2; <beginfold id='1'>/*</beginfold id='1'>comment<endfold id='1'>*/</endfold id='1'> const b = 5;
|
||||
console.log('4' / '2'); // 2
|
||||
// Template
|
||||
const a = <beginfold id='4'>`</beginfold id='4'>6<endfold id='4'>`</endfold id='4'> / 2; <beginfold id='1'>/*</beginfold id='1'>comment<endfold id='1'>*/</endfold id='1'> const b = 5;
|
||||
console.log(<beginfold id='4'>`</beginfold id='4'>4<endfold id='4'>`</endfold id='4'> / <beginfold id='4'>`</beginfold id='4'>2<endfold id='4'>`</endfold id='4'>); // 2
|
||||
|
||||
// Built-in
|
||||
const os = require('os');
|
||||
JSON.stringify("hello");
|
||||
console.error("hello");
|
||||
Math.LOG10E;
|
||||
Number.MAX_SAFE_INTEGER;
|
||||
String.raw<beginfold id='4'>`</beginfold id='4'>raw text \.\n${}<endfold id='4'>`</endfold id='4'>
|
||||
|
||||
// Tagged template literals
|
||||
tagFunc<beginfold id='4'>`</beginfold id='4'>
|
||||
Hello world!
|
||||
${ alert("Hello!"); }<endfold id='4'>`</endfold id='4'>;
|
||||
obj.something.tagFunc<beginfold id='4'>`</beginfold id='4'>Setting ${setting} is ${value + 5}!<endfold id='4'>`</endfold id='4'>;
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
NOTE: The words "todo", "fixme" and "note" should be rendered in a different style
|
||||
within comments, match should be caseless (to test for regexp insensitive attribute).
|
||||
The regex used for this rule is <endfold id='1'>*/</endfold id='1'>
|
||||
String = /\b(?:fixme|todo|note)\b/
|
||||
<beginfold id='1'>/*</beginfold id='1'> Thus, for example "Notebook" is not caught by
|
||||
this rule. (the "?:" in the subpattern is there to avoid the regex engine wasting time
|
||||
saving a backref, which is not used for anything. I do not know if the overhead of parsing
|
||||
that is greater than the time saved by not capturing the text...)
|
||||
The rule for catching these words is placed in a context "Comment common", which is used
|
||||
by both comment contexts (single line, multiline) using the new "IncludeRules" item.
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
// test if regex support works - nice with new fallthrough prop in context:)
|
||||
somestring.replace( /dooh/ , "bah!");
|
||||
re=/foo/ig; // hehe
|
||||
|
||||
somestring.search(
|
||||
/^foo\w+\s\d{0,15}$/
|
||||
);
|
||||
|
||||
re =
|
||||
/dooh/;
|
||||
|
||||
// This is supposedly legal:
|
||||
re = somebool ? /foo/ : /bar/;
|
||||
|
||||
// NOTE - Special case: an empty regex, not a comment.
|
||||
// The rule uses a positive lookahead assertion to catch it: "//(?=;)".
|
||||
re = //;
|
||||
re = /a|b/;
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
Tests for the regex parser.
|
||||
It will parse classes, quantifiers, special characters and regex operaters,
|
||||
as specified in the netscape documentation for javascript.
|
||||
Regexps are only parsed in their clean form, as the RegExp(string) constructor
|
||||
is using a quoted string.
|
||||
TODO: Find out if more regex feats should be supported.
|
||||
Consider using more itemDatas - assertion, quantifier are options.
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
re = /^text\s+\d+\s*$/;
|
||||
re = /a pattern with caret \(^\) in it/;
|
||||
re = /(\d{0,4})\D/;
|
||||
re = /[a-zA-Z_]+/;
|
||||
re = /[^\d^]+/;
|
||||
re = /\s+?\w+\.$/;
|
||||
re = /\/\//;
|
||||
re = /a|b/;
|
||||
|
||||
// the following are not regexps in E4X (=xml embedded into JavaScript)
|
||||
var p = <p>Hello World</p>
|
||||
var p = /</
|
||||
var p = />/
|
||||
|
||||
// a test if #pop back from a comment will work
|
||||
re = <beginfold id='1'>/*</beginfold id='1'>/foo/<endfold id='1'>*/</endfold id='1'> /bar/;
|
||||
// ^ POP
|
||||
// ^ we got back after pop in comment, if there is regexp attribs here :-)
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
Some tests if the fallthrough works.
|
||||
The fallthrough happens if a regexp is not found in a possible (!) position,
|
||||
which is after "search(" or "replace(" or "=" or "?" or ":" in version 0.1 of the xml file
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
var foo = 'bar';
|
||||
// ^ fallthrough!
|
||||
|
||||
|
||||
somestring.replace( new RegExp("\\b\\w+\\b"), "word: $1");
|
||||
// ^ fallthrough expected. ("new" whould be bold)
|
||||
|
||||
|
||||
something.method =
|
||||
function ( a, b, c ) <beginfold id='2'>{</beginfold id='2'> <beginfold id='1'>/*</beginfold id='1'> ... <endfold id='1'>*/</endfold id='1'> <endfold id='2'>}</endfold id='2'>
|
||||
// ^ fallthrough ?!
|
||||
|
||||
something.other =
|
||||
function ( d, e, f ) <beginfold id='2'>{</beginfold id='2'> <beginfold id='1'>/*</beginfold id='1'> ... <endfold id='1'>*/</endfold id='1'> <endfold id='2'>}</endfold id='2'>
|
||||
// fallthrough expected at col 0 ("function" should be bold)
|
||||
|
||||
var ary = new Array(5);
|
||||
// ^ fallthrough ? (if keyword is correctly rendered)
|
||||
|
||||
var b = a ? 1 : 0;
|
||||
// ^ ^ fallthroughs. numbers must be rendered correctly.
|
||||
|
||||
var c = d ? true : false;
|
||||
|
||||
var conditinalstring = b ?
|
||||
"something" :
|
||||
"something else";
|
||||
// guess...
|
||||
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
Normal program flow...
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
if (something)
|
||||
dostuff();
|
||||
else
|
||||
dont();
|
||||
|
||||
return;
|
||||
|
||||
try <beginfold id='2'>{</beginfold id='2'> bla() <endfold id='2'>}</endfold id='2'> catch (e) <beginfold id='2'>{</beginfold id='2'> alert("ERROR! : " + e) <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
for (int i=0; i < j; i++)
|
||||
document.write("i is" + i + "<br>");
|
||||
|
||||
while (something)
|
||||
<beginfold id='2'>{</beginfold id='2'>
|
||||
block();
|
||||
picky:
|
||||
if (!1)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
with (a) <beginfold id='2'>{</beginfold id='2'>
|
||||
do <beginfold id='2'>{</beginfold id='2'>
|
||||
stuff( b ); // a.b if it exists
|
||||
<endfold id='2'>}</endfold id='2'> while (itmakessense);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
switch (i) <beginfold id='2'>{</beginfold id='2'>
|
||||
case 0:
|
||||
f();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Numerics
|
||||
var a = 0xA;
|
||||
var b = 0b1;
|
||||
var c = 0o7;
|
||||
var c = 07;
|
||||
var c = 08;
|
||||
var d = 1.1E+3;
|
||||
var e = 1.E+3;
|
||||
var f = .1E+3;
|
||||
var g = 1E+3;
|
||||
var h = 1.1;
|
||||
var i = 1.;
|
||||
var j = .1;
|
||||
var k = 1;
|
||||
// Bigint
|
||||
const binBig = 0b101n;
|
||||
const octBig = 0o567n;
|
||||
const hexBig = 0xC0Bn;
|
||||
const decBig = 123n;
|
||||
// Invalid numbers
|
||||
var l = 0xA1t;
|
||||
var m = 0b0123;
|
||||
var n = 0o29;
|
||||
var n = 000_7;
|
||||
// Number with separator
|
||||
let a = 0xA_b_1
|
||||
let a = 0xA_b_1n
|
||||
let a = 0xA_b_1_
|
||||
let a = 0xA_b__1
|
||||
let b = 0o1_2_3
|
||||
let b = 0o1_2_3n
|
||||
let b = 0o1_2_3_
|
||||
let b = 0o1_2__3
|
||||
let b = 0o1_2_38
|
||||
let b = 01_2_3
|
||||
let b = 01_2_3n
|
||||
let b = 01_2_3_
|
||||
let b = 01_2__3
|
||||
let c = 0b0_1_1
|
||||
let c = 0b0_1_1n
|
||||
let c = 0b0_1_1_
|
||||
let c = 0b0_1__1
|
||||
let d = 1_2_3
|
||||
let d = 1_2_3n
|
||||
let d = 1_2_3_
|
||||
let d = 1_2__3
|
||||
let d = 01_2_8
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
local utils = import <beginfold id='1'>'</beginfold id='1'>utils.libsonnet<endfold id='1'>'</endfold id='1'>;
|
||||
|
||||
<beginfold id='2'>/*</beginfold id='2'> A C-style
|
||||
comment.
|
||||
<endfold id='2'>*/</endfold id='2'>
|
||||
# A Python-style comment.
|
||||
|
||||
// Define a "local" function.
|
||||
// Default arguments are like Python:
|
||||
local my_function(x, y=10) = x + y;
|
||||
|
||||
local object = <beginfold id='3'>{</beginfold id='3'>
|
||||
// A method
|
||||
my_method(x): x * x,
|
||||
<endfold id='3'>}</endfold id='3'>;
|
||||
|
||||
local string1 = <beginfold id='1'>'</beginfold id='1'>Farmer\'s Gin<endfold id='1'>'</endfold id='1'>;
|
||||
local string_newline1 = <beginfold id='1'>'</beginfold id='1'>this is
|
||||
a valid string
|
||||
with newlines<endfold id='1'>'</endfold id='1'>;
|
||||
local string_newline2 = <beginfold id='4'>"</beginfold id='4'>this is
|
||||
also
|
||||
a valid string<endfold id='4'>"</endfold id='4'>;
|
||||
|
||||
local timcollins = <beginfold id='5'>|||</beginfold id='5'>
|
||||
The Tom Collins is essentially gin and
|
||||
lemonade. The bitters add complexity.
|
||||
<endfold id='5'>|||</endfold id='5'>;
|
||||
|
||||
local obj = <beginfold id='3'>{</beginfold id='3'>
|
||||
<beginfold id='4'>"</beginfold id='4'>foo<endfold id='4'>"</endfold id='4'>: 1,
|
||||
<beginfold id='4'>"</beginfold id='4'>bar<endfold id='4'>"</endfold id='4'>: <beginfold id='3'>{</beginfold id='3'>
|
||||
<beginfold id='4'>"</beginfold id='4'>arr<endfold id='4'>"</endfold id='4'>: <beginfold id='6'>[</beginfold id='6'>1, 2, 3<endfold id='6'>]</endfold id='6'>,
|
||||
<beginfold id='4'>"</beginfold id='4'>number<endfold id='4'>"</endfold id='4'>: 10 + 7,
|
||||
<endfold id='3'>}</endfold id='3'>,
|
||||
<endfold id='3'>}</endfold id='3'>;
|
||||
|
||||
// Define a local function.
|
||||
// Default arguments are like Python:
|
||||
local my_function(x, y=10) = x + y;
|
||||
|
||||
// Define a local multiline function.
|
||||
local multiline_function(x) =
|
||||
// One can nest locals.
|
||||
local temp = x * 2;
|
||||
// Every local ends with a semi-colon.
|
||||
<beginfold id='6'>[</beginfold id='6'>temp, temp + 1<endfold id='6'>]</endfold id='6'>;
|
||||
|
||||
local object = <beginfold id='3'>{</beginfold id='3'>
|
||||
// A method
|
||||
my_method(x): x * x,
|
||||
<endfold id='3'>}</endfold id='3'>;
|
||||
|
||||
local large = true;
|
||||
|
||||
<beginfold id='3'>{</beginfold id='3'>
|
||||
|
||||
// Functions are first class citizens.
|
||||
call_inline_function:
|
||||
(function(x) x * x)(5),
|
||||
|
||||
call_multiline_function: multiline_function(4),
|
||||
|
||||
// Using the variable fetches the function,
|
||||
// the parens call the function.
|
||||
call: my_function(2),
|
||||
|
||||
// Like python, parameters can be named at
|
||||
// call time.
|
||||
named_params: my_function(x=2),
|
||||
// This allows changing their order
|
||||
named_params2: my_function(y=3, x=2),
|
||||
|
||||
// object.my_method returns the function,
|
||||
// which is then called like any other.
|
||||
call_method1: object.my_method(3),
|
||||
|
||||
standard_lib:
|
||||
std.join(<beginfold id='1'>'</beginfold id='1'> <endfold id='1'>'</endfold id='1'>, std.split(<beginfold id='4'>"</beginfold id='4'>foo/bar<endfold id='4'>"</endfold id='4'>, <beginfold id='1'>'</beginfold id='1'>/<endfold id='1'>'</endfold id='1'>)),
|
||||
len: <beginfold id='6'>[</beginfold id='6'>
|
||||
std.length(<beginfold id='1'>'</beginfold id='1'>hello<endfold id='1'>'</endfold id='1'>),
|
||||
std.length(<beginfold id='6'>[</beginfold id='6'>1, 2, 3<endfold id='6'>]</endfold id='6'>),
|
||||
<endfold id='6'>]</endfold id='6'>,
|
||||
|
||||
cocktails: <beginfold id='3'>{</beginfold id='3'>
|
||||
local factor = if large then 2 else 1,
|
||||
|
||||
// Ingredient quantities are in fl oz.
|
||||
<beginfold id='1'>'</beginfold id='1'>Tom Collins<endfold id='1'>'</endfold id='1'>: <beginfold id='3'>{</beginfold id='3'>
|
||||
ingredients: <beginfold id='6'>[</beginfold id='6'>
|
||||
<beginfold id='3'>{</beginfold id='3'> kind: string1, qty: 1.5*factor <endfold id='3'>}</endfold id='3'>,
|
||||
<beginfold id='3'>{</beginfold id='3'> kind: <beginfold id='1'>'</beginfold id='1'>Lemon<endfold id='1'>'</endfold id='1'>, qty: 1 <endfold id='3'>}</endfold id='3'>,
|
||||
<beginfold id='3'>{</beginfold id='3'> kind: <beginfold id='1'>'</beginfold id='1'>Simple Syrup<endfold id='1'>'</endfold id='1'>, qty: 0.5E+1 <endfold id='3'>}</endfold id='3'>,
|
||||
<beginfold id='3'>{</beginfold id='3'> kind: <beginfold id='1'>'</beginfold id='1'>Soda<endfold id='1'>'</endfold id='1'>, qty: 2 <endfold id='3'>}</endfold id='3'>,
|
||||
<beginfold id='3'>{</beginfold id='3'> kind: <beginfold id='1'>'</beginfold id='1'>Angostura<endfold id='1'>'</endfold id='1'>, qty: <beginfold id='1'>'</beginfold id='1'>dash<endfold id='1'>'</endfold id='1'> <endfold id='3'>}</endfold id='3'>,
|
||||
<endfold id='6'>]</endfold id='6'>,
|
||||
garnish: <beginfold id='1'>'</beginfold id='1'>Maraschino Cherry<endfold id='1'>'</endfold id='1'>,
|
||||
served: <beginfold id='1'>'</beginfold id='1'>Tall<endfold id='1'>'</endfold id='1'>,
|
||||
description: timcollins,
|
||||
<endfold id='3'>}</endfold id='3'>,
|
||||
<endfold id='3'>}</endfold id='3'>,
|
||||
<endfold id='3'>}</endfold id='3'>
|
||||
@@ -0,0 +1,173 @@
|
||||
<beginfold id='1'><%--</beginfold id='1'>
|
||||
This page won't actually work, as it is simply designed to display jsp syntax highlighting.
|
||||
<endfold id='1'>--%></endfold id='1'>
|
||||
<%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%>
|
||||
<%@ include file="/include/myglobalvars.jsp"%> --%>
|
||||
<%@ page import="java.util.*,
|
||||
java.io.*,
|
||||
java.math.*" %>
|
||||
<%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%>
|
||||
<jsp:useBean id="aPageBean" scope="page" class="my.package.MyPageBean"/>
|
||||
<jsp:useBean id="aRequestBean" scope="request" class="my.package.MyRequestBean"/>
|
||||
<beginfold id='2'><%</beginfold id='2'>
|
||||
// We can decipher our expected parameters here.
|
||||
String parm1 = noNull(request.getParameter(PARAMETER_1)).trim();
|
||||
String parm2 = noNull(request.getParameter(PARAMETER_2)).trim();
|
||||
String parm3 = noNull(request.getParameter(PARAMETER_3)).trim();
|
||||
String parm4 = noNull(request.getParameter(PARAMETER_4)).trim();
|
||||
String parm5 = noNull(request.getParameter(PARAMETER_5)).trim();
|
||||
|
||||
// A sample collection of Integers to display some code folding.
|
||||
List intList = getIntList(10);
|
||||
|
||||
|
||||
<endfold id='2'>%></endfold id='2'>
|
||||
<html>
|
||||
<title>A Sample Jsp</title>
|
||||
<head>
|
||||
<beginfold id='3'><script</beginfold id='3'> language="javascript"><!--
|
||||
function doAlert1() <beginfold id='4'>{</beginfold id='4'>
|
||||
alert("This is the first javascript example.");
|
||||
<endfold id='4'>}</endfold id='4'>
|
||||
|
||||
function doAlert2() <beginfold id='4'>{</beginfold id='4'>
|
||||
alert("This is the second javascript example.");
|
||||
<endfold id='4'>}</endfold id='4'>
|
||||
//--><endfold id='3'></script</endfold id='3'>>
|
||||
<beginfold id='5'><style</beginfold id='5'> type="text/css">
|
||||
body<beginfold id='6'>{</beginfold id='6'> color: yellow; <endfold id='6'>}</endfold id='6'>
|
||||
<endfold id='5'></style></endfold id='5'>
|
||||
</head>
|
||||
<body>
|
||||
<beginfold id='1'><%--</beginfold id='1'> The top label table. <endfold id='1'>--%></endfold id='1'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td><font size="3"><b>The following parameters were detected:</b></font></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<beginfold id='1'><%--</beginfold id='1'> Display the parameters which might have been passed in. <endfold id='1'>--%></endfold id='1'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
||||
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
||||
<tr>
|
||||
<td><b>PARAMETER_1</b></td>
|
||||
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_1<endfold id='2'>%></endfold id='2'></td>
|
||||
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm1<endfold id='2'>%></endfold id='2'>"</td>
|
||||
</tr>
|
||||
|
||||
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
||||
<tr>
|
||||
<td><b>PARAMETER_2</b></td>
|
||||
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_2<endfold id='2'>%></endfold id='2'></td>
|
||||
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm2<endfold id='2'>%></endfold id='2'>"</td>
|
||||
</tr>
|
||||
|
||||
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
||||
<tr>
|
||||
<td><b>PARAMETER_3</b></td>
|
||||
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_3<endfold id='2'>%></endfold id='2'></td>
|
||||
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm3<endfold id='2'>%></endfold id='2'>"</td>
|
||||
</tr>
|
||||
|
||||
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
||||
<tr>
|
||||
<td><b>PARAMETER_4</b></td>
|
||||
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_4<endfold id='2'>%></endfold id='2'></td>
|
||||
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm4<endfold id='2'>%></endfold id='2'>"</td>
|
||||
</tr>
|
||||
|
||||
<beginfold id='1'><%--</beginfold id='1'> Label; Actual Parameter String; Value Detected <endfold id='1'>--%></endfold id='1'>
|
||||
<tr>
|
||||
<td><b>PARAMETER_5</b></td>
|
||||
<td align="center"><beginfold id='2'><%=</beginfold id='2'>PARAMETER_5<endfold id='2'>%></endfold id='2'></td>
|
||||
<td align="right">"<beginfold id='2'><%=</beginfold id='2'>parm5<endfold id='2'>%></endfold id='2'>"</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
|
||||
<beginfold id='1'><%--</beginfold id='1'> Display our list of random Integers (shows code folding). <endfold id='1'>--%></endfold id='1'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
||||
<beginfold id='2'><%</beginfold id='2'>
|
||||
if (intList != null && intList.size() > 0) <beginfold id='7'>{</beginfold id='7'>
|
||||
<endfold id='2'>%></endfold id='2'>
|
||||
<tr><td><b>Here are the elements of intList...</b></td></tr>
|
||||
<beginfold id='2'><%</beginfold id='2'>
|
||||
Iterator intListIt = intList.iterator();
|
||||
while (intListIt.hasNext()) <beginfold id='7'>{</beginfold id='7'>
|
||||
Integer i = (Integer) intListIt.next();
|
||||
<endfold id='2'>%></endfold id='2'>
|
||||
<tr><td><beginfold id='2'><%=</beginfold id='2'>i.toString()<endfold id='2'>%></endfold id='2'></td></tr>
|
||||
<beginfold id='2'><%</beginfold id='2'>
|
||||
<endfold id='7'>}</endfold id='7'>
|
||||
<endfold id='7'>}</endfold id='7'> else <beginfold id='7'>{</beginfold id='7'>
|
||||
<endfold id='2'>%></endfold id='2'>
|
||||
<tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr>
|
||||
<beginfold id='2'><%</beginfold id='2'>
|
||||
<endfold id='7'>}</endfold id='7'>
|
||||
<endfold id='2'>%></endfold id='2'>
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
|
||||
<beginfold id='1'><%--</beginfold id='1'> We can call javascript functions. <endfold id='1'>--%></endfold id='1'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr><td colspan="2"><b>Test our javascript...</b></td></tr>
|
||||
<tr>
|
||||
<td><input type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()"></td>
|
||||
<td><input type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
<beginfold id='1'><%--</beginfold id='1'> If we actually had defined a tag library. <endfold id='1'>--%></endfold id='1'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr><td>
|
||||
<my:SampleTag prop1="first" prop2="third">
|
||||
<my:SampleTagChild nameProp="value1"/>
|
||||
<my:SampleTagChild nameProp="value2"/>
|
||||
</my:SampleTag>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
<beginfold id='1'><%--</beginfold id='1'> Expression language. <endfold id='1'>--%></endfold id='1'>
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0">
|
||||
<c:if test="${!empty param.aParam}">
|
||||
<c:set var="myParam" scope="session" value="${param.aParam}"/>
|
||||
</c:if>
|
||||
|
||||
<tr><td>myParam's value: "<c:out value="${myParam}" default=="Default"/>"</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
<beginfold id='2'><%!</beginfold id='2'>
|
||||
<beginfold id='8'>/*</beginfold id='8'> A place for class variables and functions... <endfold id='8'>*/</endfold id='8'>
|
||||
|
||||
// Define some sample parameter names that this page might understand.
|
||||
private static final String PARAMETER_1 = "p1";
|
||||
private static final String PARAMETER_2 = "p2";
|
||||
private static final String PARAMETER_3 = "p3";
|
||||
private static final String PARAMETER_4 = "p4";
|
||||
private static final String PARAMETER_5 = "p5";
|
||||
|
||||
// Returns str trimmed, or an empty string if str is null.
|
||||
private static String noNull(String str) <beginfold id='7'>{</beginfold id='7'>
|
||||
String retStr;
|
||||
if (str == null)
|
||||
retStr = "";
|
||||
else
|
||||
retStr = str.trim();
|
||||
|
||||
return retStr;
|
||||
<endfold id='7'>}</endfold id='7'>
|
||||
|
||||
// Returns a list of Integers with listSize elements.
|
||||
private static List getIntList(int listSize) <beginfold id='7'>{</beginfold id='7'>
|
||||
ArrayList retList = new ArrayList(listSize);
|
||||
for (int i = 0; i < listSize; i++)
|
||||
retList.add(new Integer( (int) (Math.random() * 100) ));
|
||||
|
||||
return retList;
|
||||
<endfold id='7'>}</endfold id='7'>
|
||||
<endfold id='2'>%></endfold id='2'>
|
||||
@@ -0,0 +1,10 @@
|
||||
dn: dc=adminmart,dc=com
|
||||
dc: adminmart
|
||||
description: LDAP Admin
|
||||
objectClass: dcObject
|
||||
objectClass: organizationalUnit
|
||||
ou: rootobject
|
||||
dn: ou=People, dc=adminmart,dc=com
|
||||
ou: People
|
||||
description: Users of adminmart
|
||||
objectClass: organizationalUnit
|
||||
+701
@@ -0,0 +1,701 @@
|
||||
<beginfold id='1'>/*</beginfold id='1'>*
|
||||
* Less syntax highlighting test file
|
||||
*
|
||||
* Based on the Less documentation ((c) 2017 Alexis Sellier, the Less Core Team, Contributors, The MIT License)
|
||||
*
|
||||
* @see http://lesscss.org/features/
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
.mixin(@color; @padding; @margin: 2) <beginfold id='2'>{</beginfold id='2'>
|
||||
colorr: @color;
|
||||
padding-3: @padding;
|
||||
margin: @margin @margin @margin @margin;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@my-ruleset: <beginfold id='2'>{</beginfold id='2'>
|
||||
.my-selector <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: black;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>;
|
||||
|
||||
@bacon: red;
|
||||
@beacon: background-color;
|
||||
@baecon: @{w} + @w;
|
||||
|
||||
.noStar:extend(.class #sh:extend(#hhh) ) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
.noStar:nth-child(w: red) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@media (max-width: @width2) and handheld <beginfold id='2'>{</beginfold id='2'>
|
||||
height: auto;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.test when (@color = blue) .ffff <beginfold id='2'>{</beginfold id='2'>color: red;<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.foo (@bg: #f5f5f5, @color: #900) <beginfold id='2'>{</beginfold id='2'>
|
||||
background: @bg;
|
||||
color: @color;
|
||||
|
||||
.x <beginfold id='2'>{</beginfold id='2'>
|
||||
x: @nn;
|
||||
a: white @{nn@{ww}};
|
||||
background: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Variables
|
||||
|
||||
@link-color: #428bca; // sea blue
|
||||
@link-color-hover: darken(@link-color, 10%);
|
||||
|
||||
a, .link <beginfold id='2'>{</beginfold id='2'>
|
||||
color: @link-color;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
a:hover <beginfold id='2'>{</beginfold id='2'>
|
||||
color: @link-color-hover;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.widget <beginfold id='2'>{</beginfold id='2'>
|
||||
color: #fff;
|
||||
background: @link-color;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Variable interpolation
|
||||
|
||||
@my-selector: banner;
|
||||
|
||||
.@{my-selector} when (@s = calc("s"); @{s} = calc("dddd")) <beginfold id='2'>{</beginfold id='2'>
|
||||
font-weight: bold;
|
||||
line-height+: 40px;
|
||||
margin: 0 auto;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@images: "../img";
|
||||
|
||||
body <beginfold id='2'>{</beginfold id='2'>
|
||||
color: #444;
|
||||
background: url("@{images}/white-sand.png");
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@themes: "../../src/themes";
|
||||
|
||||
@import "@{themes}/tidal-wave.less";
|
||||
|
||||
@property: color;
|
||||
|
||||
.widget <beginfold id='2'>{</beginfold id='2'>
|
||||
@{property}: #0ee;
|
||||
background-@{property}: #999;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Variable names
|
||||
|
||||
@fnord: "I am fnord.";
|
||||
@var: "fnord";
|
||||
|
||||
.variable-names-example <beginfold id='2'>{</beginfold id='2'>
|
||||
content: @@var;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Lazy Evaluation
|
||||
|
||||
.lazy-eval <beginfold id='2'>{</beginfold id='2'>
|
||||
width: @var;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@var: @a;
|
||||
@a: 9%;
|
||||
|
||||
@var: 0;
|
||||
.class <beginfold id='2'>{</beginfold id='2'>
|
||||
@var: 1;
|
||||
.brass <beginfold id='2'>{</beginfold id='2'>
|
||||
@var: 2;
|
||||
three: @var;
|
||||
@var: 3;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
one: @var;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Default Variables
|
||||
|
||||
@base-color: green;
|
||||
@dark-color: darken(@base-color, 10%);
|
||||
|
||||
@import "library.less";
|
||||
@base-color: red;
|
||||
|
||||
// Extend
|
||||
|
||||
nav ul <beginfold id='2'>{</beginfold id='2'>
|
||||
&:extend(.inline);
|
||||
background: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.inline <beginfold id='2'>{</beginfold id='2'>
|
||||
color: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Extend Syntax
|
||||
|
||||
.e:extend(.f) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
.e:extend(.g) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.e:extend(.f, .g) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Extend Attached to Selector
|
||||
|
||||
.big-division,
|
||||
.big-bag:extend(.bag),
|
||||
.big-bucket:extend(.bucket) <beginfold id='2'>{</beginfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Extend Inside Ruleset
|
||||
|
||||
pre:hover,
|
||||
.some-class <beginfold id='2'>{</beginfold id='2'>
|
||||
&:extend(div pre);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
pre:hover:extend(div pre),
|
||||
.some-class:extend(div pre) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Extending Nested Selectors
|
||||
|
||||
.bucket <beginfold id='2'>{</beginfold id='2'>
|
||||
tr <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.some-class:extend(.bucket tr) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Exact Matching with Extend
|
||||
|
||||
*.class <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.noStar:extend(.class) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
link:hover:visited <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.selector:extend(link:visited:hover) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// nth Expression
|
||||
|
||||
:nth-child(1n+3) <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.child:extend(:nth-child(n+3)) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
[title=identifier] <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
[title='identifier'] <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
[title="identifier"] <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.noQuote:extend([title=identifier]) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
.singleQuote:extend([title='identifier']) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
.doubleQuote:extend([title="identifier"]) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Extend "all"
|
||||
|
||||
.a.b.test,
|
||||
.test.c <beginfold id='2'>{</beginfold id='2'>
|
||||
color: orange;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.test <beginfold id='2'>{</beginfold id='2'>
|
||||
&:hover <beginfold id='2'>{</beginfold id='2'>
|
||||
color: green;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.replacement:extend(.test all) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Selector Interpolation with Extend
|
||||
|
||||
.bucket <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
@{variable}:extend(.bucket) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
@variable: .selector;
|
||||
|
||||
// Scoping / Extend Inside @media
|
||||
|
||||
@media print <beginfold id='2'>{</beginfold id='2'>
|
||||
.screenClass:extend(.selector) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
.selector <beginfold id='2'>{</beginfold id='2'>
|
||||
color: black;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.selector <beginfold id='2'>{</beginfold id='2'>
|
||||
color: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
@media screen <beginfold id='2'>{</beginfold id='2'>
|
||||
.selector <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Use Cases for Extend
|
||||
|
||||
.animal <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: black;
|
||||
color: white;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.bear <beginfold id='2'>{</beginfold id='2'>
|
||||
&:extend(.animal);
|
||||
background-color: brown;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.my-inline-block <beginfold id='2'>{</beginfold id='2'>
|
||||
display: inline-block;
|
||||
font-size: 0;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.thing1 <beginfold id='2'>{</beginfold id='2'>
|
||||
&:extend(.my-inline-block);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.thing2 <beginfold id='2'>{</beginfold id='2'>
|
||||
&:extend(.my-inline-block);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Mixins
|
||||
|
||||
.a, #b <beginfold id='2'>{</beginfold id='2'>
|
||||
color: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin-class <beginfold id='2'>{</beginfold id='2'>
|
||||
.a();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin-id <beginfold id='2'>{</beginfold id='2'>
|
||||
#b();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Not Outputting the Mixin
|
||||
|
||||
.my-mixin <beginfold id='2'>{</beginfold id='2'>
|
||||
color: black;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.my-other-mixin() <beginfold id='2'>{</beginfold id='2'>
|
||||
background: white;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.class <beginfold id='2'>{</beginfold id='2'>
|
||||
.my-mixin;
|
||||
.my-other-mixin;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Selectors in Mixins
|
||||
|
||||
.my-hover-mixin() <beginfold id='2'>{</beginfold id='2'>
|
||||
&:hover <beginfold id='2'>{</beginfold id='2'>
|
||||
border: 1px solid red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
button <beginfold id='2'>{</beginfold id='2'>
|
||||
.my-hover-mixin();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Namespaces
|
||||
|
||||
#outer <beginfold id='2'>{</beginfold id='2'>
|
||||
.inner <beginfold id='2'>{</beginfold id='2'>
|
||||
color: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.c <beginfold id='2'>{</beginfold id='2'>
|
||||
#outer > .inner;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.d <beginfold id='2'>{</beginfold id='2'>
|
||||
#outer > .inner;
|
||||
#outer > .inner();
|
||||
#outer .inner;
|
||||
#outer .inner();
|
||||
#outer.inner;
|
||||
#outer.inner();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Guarded Namespaces
|
||||
|
||||
#namespace when (@mode=huge) <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin() <beginfold id='2'>{</beginfold id='2'> <beginfold id='1'>/*</beginfold id='1'> <endfold id='1'>*/</endfold id='1'> <endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#namespace <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin() when (@mode=huge) <beginfold id='2'>{</beginfold id='2'> <beginfold id='1'>/*</beginfold id='1'> <endfold id='1'>*/</endfold id='1'> <endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#sp_1 when (default()) <beginfold id='2'>{</beginfold id='2'>
|
||||
#sp_2 when (default()) <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin() when not(default()) <beginfold id='2'>{</beginfold id='2'> <beginfold id='1'>/*</beginfold id='1'> <endfold id='1'>*/</endfold id='1'> <endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// The !important keyword
|
||||
|
||||
.foo (@bg: #f5f5f5, @color: #900) <beginfold id='2'>{</beginfold id='2'>
|
||||
background: @bg;
|
||||
color: @color !important;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.unimportant <beginfold id='2'>{</beginfold id='2'>
|
||||
.foo();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.important <beginfold id='2'>{</beginfold id='2'>
|
||||
.foo() !important;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Parametric Mixins
|
||||
|
||||
.border-radius(@radius) <beginfold id='2'>{</beginfold id='2'>
|
||||
-webkit-border-radius: @radius;
|
||||
-moz-border-radius: @radius;
|
||||
border-radius: @radius;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
#header <beginfold id='2'>{</beginfold id='2'>
|
||||
.border-radius(4px);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.button <beginfold id='2'>{</beginfold id='2'>
|
||||
.border-radius(6px);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.border-radius(@radius: 5px) <beginfold id='2'>{</beginfold id='2'>
|
||||
-webkit-border-radius: @radius;
|
||||
-moz-border-radius: @radius;
|
||||
border-radius: @radius;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.wrap() <beginfold id='2'>{</beginfold id='2'>
|
||||
text-wrap: wrap;
|
||||
white-space: -moz-pre-wrap;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
pre <beginfold id='2'>{</beginfold id='2'> .wrap <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Mixins with Multiple Parameters
|
||||
|
||||
.mixin(@color) <beginfold id='2'>{</beginfold id='2'>
|
||||
color-1: @color;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin(@color; @padding: 2) <beginfold id='2'>{</beginfold id='2'>
|
||||
color-2: @color;
|
||||
padding-2: @padding;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin(@color; @padding; @margin: 2) <beginfold id='2'>{</beginfold id='2'>
|
||||
color-3: @color;
|
||||
padding-3: @padding;
|
||||
margin: @margin @margin @margin @margin;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.some .selector div <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin(#008000);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Named parameters
|
||||
|
||||
.mixin(@color: black; @margin: 10px; @padding: 20px) <beginfold id='2'>{</beginfold id='2'>
|
||||
color: @color;
|
||||
margin: @margin;
|
||||
padding: @padding;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.class1 <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin(@margin: 20px; @color: #33acfe);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.class2 <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin(#efca44; @padding: 40px);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// The @arguments Variable
|
||||
|
||||
.box-shadow(@x: 0; @y: 0; @blur: 1px; @color: #000) <beginfold id='2'>{</beginfold id='2'>
|
||||
-webkit-box-shadow: @arguments;
|
||||
-moz-box-shadow: @arguments;
|
||||
box-shadow: @arguments;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.big-block <beginfold id='2'>{</beginfold id='2'>
|
||||
.box-shadow(2px; 5px);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Advanced Arguments and the @rest Variable
|
||||
|
||||
.mixin(...) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'> // matches 0-N arguments
|
||||
.mixin() <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'> // matches exactly 0 arguments
|
||||
.mixin(@a: 1) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'> // matches 0-1 arguments
|
||||
.mixin(@a: 1; ...) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'> // matches 0-N arguments
|
||||
.mixin(@a; ...) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'> // matches 1-N arguments
|
||||
|
||||
.mixin(@a; @rest...) <beginfold id='2'>{</beginfold id='2'>
|
||||
// @rest is bound to arguments after @a
|
||||
// @arguments is bound to all arguments
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Pattern-matching
|
||||
|
||||
.mixin(@s; @color) <beginfold id='2'>{</beginfold id='2'> ... <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.class <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin(@switch; #888);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.mixin(dark; @color) <beginfold id='2'>{</beginfold id='2'>
|
||||
color: darken(@color, 10%);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin(light; @color) <beginfold id='2'>{</beginfold id='2'>
|
||||
color: lighten(@color, 10%);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin(@_; @color) <beginfold id='2'>{</beginfold id='2'>
|
||||
display: block;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@switch: light;
|
||||
|
||||
.class <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin(@switch; #888);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Mixins as Functions
|
||||
|
||||
.average(@x, @y) <beginfold id='2'>{</beginfold id='2'>
|
||||
@average: ((@x + @y) / 2);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
div <beginfold id='2'>{</beginfold id='2'>
|
||||
.average(16px, 50px); // "call" the mixin
|
||||
padding: @average; // use its "return" value
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Passing Rulesets to Mixins
|
||||
|
||||
// declare detached ruleset
|
||||
@detached-ruleset: <beginfold id='2'>{</beginfold id='2'> background: red; <endfold id='2'>}</endfold id='2'>;
|
||||
|
||||
// use detached ruleset
|
||||
.top <beginfold id='2'>{</beginfold id='2'>
|
||||
@detached-ruleset();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.desktop-and-old-ie(@rules) <beginfold id='2'>{</beginfold id='2'>
|
||||
@media screen and (min-width: 1200px) <beginfold id='2'>{</beginfold id='2'> @rules(); <endfold id='2'>}</endfold id='2'>
|
||||
html.lt-ie9 & <beginfold id='2'>{</beginfold id='2'> @rules(); <endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
header <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: blue;
|
||||
|
||||
.desktop-and-old-ie({
|
||||
background-color: red;
|
||||
});
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
@my-ruleset: <beginfold id='2'>{</beginfold id='2'>
|
||||
.my-selector <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: black;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>;
|
||||
|
||||
@my-ruleset: <beginfold id='2'>{</beginfold id='2'>
|
||||
.my-selector <beginfold id='2'>{</beginfold id='2'>
|
||||
@media tv <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: black;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>;
|
||||
@media (orientation:portrait) <beginfold id='2'>{</beginfold id='2'>
|
||||
@my-ruleset();
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Scoping
|
||||
|
||||
@detached-ruleset: <beginfold id='2'>{</beginfold id='2'>
|
||||
caller-variable: @caller-variable; // variable is undefined here
|
||||
.caller-mixin(); // mixin is undefined here
|
||||
<endfold id='2'>}</endfold id='2'>;
|
||||
|
||||
selector <beginfold id='2'>{</beginfold id='2'>
|
||||
// use detached ruleset
|
||||
@detached-ruleset();
|
||||
|
||||
// define variable and mixin needed inside the detached ruleset
|
||||
@caller-variable: value;
|
||||
.caller-mixin() <beginfold id='2'>{</beginfold id='2'>
|
||||
variable: declaration;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
<beginfold id='1'>/*</beginfold id='1'>
|
||||
* reference: use a Less file but do not output it
|
||||
inline: include the source file in the output but do not process it
|
||||
less: treat the file as a Less file, no matter what the file extension
|
||||
css: treat the file as a CSS file, no matter what the file extension
|
||||
once: only include the file once (this is default behavior)
|
||||
multiple: include the file multiple times
|
||||
optional: continue compiling when file is not found
|
||||
<endfold id='1'>*/</endfold id='1'>
|
||||
|
||||
@import (optional, reference) "foo.less";
|
||||
|
||||
// Mixin Guards
|
||||
|
||||
.mixin (@a) when (lightness(@a) >= 50%) <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: black;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin (@a) when (lightness(@a) < 50%) <beginfold id='2'>{</beginfold id='2'>
|
||||
background-color: white;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.mixin (@a) <beginfold id='2'>{</beginfold id='2'>
|
||||
color: @a;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Guard Comparison Operators
|
||||
|
||||
.truth (@a) when (@a) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
.truth (@a) when (@a = true) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// FIXME: @media as variable
|
||||
@media: mobile;
|
||||
|
||||
.mixin (@a) when (@media = mobile) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
.mixin (@a) when (@media = desktop) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.max (@a; @b) when (@a > @b) <beginfold id='2'>{</beginfold id='2'> width: @a <endfold id='2'>}</endfold id='2'>
|
||||
.max (@a; @b) when (@a < @b) <beginfold id='2'>{</beginfold id='2'> width: @b <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Guard Logical Operators
|
||||
|
||||
.mixin (@a) when (isnumber(@a)) and (@a > 0) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
.mixin (@a) when (@a > 10), (@a < -10) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
.mixin (@b) when not (@b > 0) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Type Checking Functions
|
||||
|
||||
.mixin (@a; @b: 0) when (isnumber(@b)) <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
|
||||
.mixin (@a; @b: black) when (iscolor(@b)) <beginfold id='2'>{</beginfold id='2'><endfold id='2'>}</endfold id='2'>
|
||||
|
||||
button when (@my-option = true) <beginfold id='2'>{</beginfold id='2'>
|
||||
color: white;
|
||||
|
||||
& when (@my-option = true) <beginfold id='2'>{</beginfold id='2'>
|
||||
button <beginfold id='2'>{</beginfold id='2'>
|
||||
color: white;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
a <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Loops
|
||||
|
||||
.loop(@counter) when (@counter > 0) <beginfold id='2'>{</beginfold id='2'>
|
||||
.loop((@counter - 1)); // next iteration
|
||||
width: (10px * @counter); // code for each iteration
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
div <beginfold id='2'>{</beginfold id='2'>
|
||||
.loop(5); // launch the loop
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Merge
|
||||
|
||||
.mixin() <beginfold id='2'>{</beginfold id='2'>
|
||||
box-shadow+: inset 0 0 10px #555;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.myclass <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin();
|
||||
box-shadow+: 0 0 20px black;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Space
|
||||
|
||||
.mixin() <beginfold id='2'>{</beginfold id='2'>
|
||||
transform+_: scale(2);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
.myclass <beginfold id='2'>{</beginfold id='2'>
|
||||
.mixin();
|
||||
transform+_: rotate(15deg);
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Parent Selectors
|
||||
|
||||
a <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
&:hover <beginfold id='2'>{</beginfold id='2'>
|
||||
color: green;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.button <beginfold id='2'>{</beginfold id='2'>
|
||||
&-ok <beginfold id='2'>{</beginfold id='2'>
|
||||
background-image: url("ok.png");
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
&-cancel <beginfold id='2'>{</beginfold id='2'>
|
||||
background-image: url("cancel.png");
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
&-custom <beginfold id='2'>{</beginfold id='2'>
|
||||
background-image: url("custom.png");
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.link <beginfold id='2'>{</beginfold id='2'>
|
||||
& + & <beginfold id='2'>{</beginfold id='2'>
|
||||
color: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
& & <beginfold id='2'>{</beginfold id='2'>
|
||||
color: green;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
&& <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
&, &ish <beginfold id='2'>{</beginfold id='2'>
|
||||
color: cyan;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
.grand <beginfold id='2'>{</beginfold id='2'>
|
||||
.parent <beginfold id='2'>{</beginfold id='2'>
|
||||
& > & <beginfold id='2'>{</beginfold id='2'>
|
||||
color: red;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
& & <beginfold id='2'>{</beginfold id='2'>
|
||||
color: green;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
&& <beginfold id='2'>{</beginfold id='2'>
|
||||
color: blue;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
&, &ish <beginfold id='2'>{</beginfold id='2'>
|
||||
color: cyan;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Changing Selector Order
|
||||
|
||||
.header <beginfold id='2'>{</beginfold id='2'>
|
||||
.menu <beginfold id='2'>{</beginfold id='2'>
|
||||
border-radius: 5px;
|
||||
.no-borderradius & <beginfold id='2'>{</beginfold id='2'>
|
||||
background-image: url('images/button-background.png');
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
|
||||
// Combinatorial Explosion
|
||||
|
||||
p, a, ul, li <beginfold id='2'>{</beginfold id='2'>
|
||||
border-top: 2px dotted #366;
|
||||
& + & <beginfold id='2'>{</beginfold id='2'>
|
||||
border-top: 0;
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
<endfold id='2'>}</endfold id='2'>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user