xslthl-2.1.0/0000755000175000017500000000000012135713265012707 5ustar mathieumathieuxslthl-2.1.0/.classpath0000644000175000017500000000211512007471540014664 0ustar mathieumathieu xslthl-2.1.0/LICENSE.txt0000644000175000017500000000216212007500004014512 0ustar mathieumathieuxslthl - XSLT Syntax Highlighting http://sourceforge.net/projects/xslthl/ Copyright (C) 2005-2012 Michal Molhanec, Jirka Kosek, Michiel Hendriks This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Michal Molhanec Jirka Kosek Michiel Hendriks xslthl-2.1.0/highlighters/0000755000175000017500000000000012135713254015366 5ustar mathieumathieuxslthl-2.1.0/highlighters/ini-hl.xml0000644000175000017500000000312211037567265017277 0ustar mathieumathieu ; ^(\[.+\]\s*)$ MULTILINE ^(.+)(?==) MULTILINE xslthl-2.1.0/highlighters/xslthl-config.xml0000644000175000017500000000460712021456413020673 0ustar mathieumathieu xslthl-2.1.0/highlighters/cmake-hl.xml0000644000175000017500000001355612020732433017574 0ustar mathieumathieu # " " 0x l . WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 AND BOOL CACHE COMMAND DEFINED DOC EQUAL EXISTS FALSE GREATER INTERNAL LESS MATCHES NAME NAMES NAME_WE NOT OFF ON OR PATH PATHS PROGRAM STREQUAL STRGREATER STRING STRLESS TRUE ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDIF ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE ENDMACRO () () xslthl-2.1.0/highlighters/csharp-hl.xml0000644000175000017500000001310611556222402017766 0ustar mathieumathieu /** */ /// /* */ // [ ] ( ) # \ @" " \ " \ ' \ 0x ul lu u l . e ul lu u f d m l abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual void volatile while add alias from get global group into join orderby partial remove select set value where yield xslthl-2.1.0/highlighters/ruby-hl.xml0000644000175000017500000000625711037717270017506 0ustar mathieumathieu # << " \ %Q{ } \ %/ / \ ' \ %q{ } \ 0x . e alias and BEGIN begin break case class def defined do else elsif END end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield xslthl-2.1.0/highlighters/java-hl.xml0000644000175000017500000000655511037717270017447 0ustar mathieumathieu /** */ /* */ // " \ ' \ @ ( ) 0x . e f d l abstract boolean break byte case catch char class const continue default do double else extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while xslthl-2.1.0/highlighters/lua-hl.xml0000644000175000017500000000747112020734755017305 0ustar mathieumathieu and break do else elseif end false for function goto if in local nil not or repeat return then true until while --[[ ]] --[=[ ]=] --[==[ ]==] --[===[ ]===] --[====[ ]====] -- " " \ ' ' \ [[ ]] [=[ ]=] [==[ ]==] [===[ ]===] [====[ ]====] . e 0x . p xslthl-2.1.0/highlighters/python-hl.xml0000644000175000017500000000571711037717270020046 0ustar mathieumathieu @ ( ) # """ ''' " \ ' \ 0x l . e l and del from not while as elif global or with assert else if pass yield break except import print class exec in raise continue finally is return def for lambda try xslthl-2.1.0/highlighters/tcl-hl.xml0000644000175000017500000001206511037717270017301 0ustar mathieumathieu # " \ -[\p{javaJavaIdentifierStart}][\p{javaJavaIdentifierPart}]+ . if then else elseif for foreach break continue while eval case in switch default exit error proc rename exec return uplevel upvar constructor destructor itcl_class loop for_array_keys for_recursive_glob for_file method body configbody catch namespace class array set unset package source subst list format lappend option expr puts winfo lindex string verified seteach fixme debug rtl::debug rtl::verified rtl::template rtl::seteach mkProc getCreator properties lappendunique rtl::lappendunique place pack grid image font focus tk bind after toplevel frame entry listbox button radiobutton checkbutton canvas menu menubutton text label message zinc tkpath::gradient rtl_combobox rtl_tree rtl_tabset rtl_mlistbox rtl_gridwin rtlysizer rtlxsizer goolbar gstripes zoolbar gistbox gooleditor galette xslthl-2.1.0/highlighters/c-hl.xml0000644000175000017500000000701312020734033016723 0ustar mathieumathieu /** */ /* */ // # \ " \ ' \ 0x ul lu u l . e ul lu u f l auto _Bool break case char _Complex const continue default do double else enum extern float for goto if _Imaginary inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while xslthl-2.1.0/highlighters/cpp-hl.xml0000644000175000017500000001067311040332627017275 0ustar mathieumathieu /** */ /* */ // # \ " \ ' \ 0x ul lu u l . e ul lu u f l auto _Bool break case char _Complex const continue default do double else enum extern float for goto if _Imaginary inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch false operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected true wchar_t xslthl-2.1.0/highlighters/upc-hl.xml0000644000175000017500000001016312020734033017270 0ustar mathieumathieu /** */ /* */ // # \ " \ ' \ 0x ul lu u l . e ul lu u f l auto _Bool break case char _Complex const continue default do double else enum extern float for goto if _Imaginary inline int long register relaxed restrict return shared strict short signed sizeof static struct switch typedef union unsigned upc_blocksizeof upc_elemsizeof upc_localsizeof upc_lock_t upc_forall upc_barrier upc_wait upc_notify upc_fence void volatile while xslthl-2.1.0/highlighters/php-hl.xml0000644000175000017500000001066612020732756017312 0ustar mathieumathieu /** */ /* */ // # " \ ' \ <<< 0x . e and or xor __FILE__ exception __LINE__ array as break case class const continue declare default die do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exit extends for foreach function global if include include_once isset list new print require require_once return static switch unset use var while __FUNCTION__ __CLASS__ __METHOD__ final php_user_filter interface implements extends public private protected abstract clone try catch throw cfunction old_function true false namespace __NAMESPACE__ goto __DIR__ ?> <?php <?= xslthl-2.1.0/highlighters/bourne-hl.xml0000644000175000017500000000520312007476631020006 0ustar mathieumathieu # << ' " - " \ ' \ 0x . if then else elif fi case esac for while until do done exec shift exit times break export trap continue readonly wait eval return cd echo hash pwd read set test type ulimit umask unset xslthl-2.1.0/highlighters/sql1999-hl.xml0000644000175000017500000003457712021456413017657 0ustar mathieumathieu -- /* */ ' B' ' N' ' X' ' . e ABSOLUTE ACTION ADD AFTER ALL ALLOCATE ALTER AND ANY ARE ARRAY AS ASC ASSERTION AT AUTHORIZATION BEFORE BEGIN BETWEEN BINARY BIT BLOB BOOLEAN BOTH BREADTH BY CALL CASCADE CASCADED CASE CAST CATALOG CHAR CHARACTER CHECK CLOB CLOSE COLLATE COLLATION COLUMN COMMIT CONDITION CONNECT CONNECTION CONSTRAINT CONSTRAINTS CONSTRUCTOR CONTINUE CORRESPONDING CREATE CROSS CUBE CURRENT CURRENT_DATE CURRENT_DEFAULT_TRANSFORM_GROUP CURRENT_TRANSFORM_GROUP_FOR_TYPE CURRENT_PATH CURRENT_ROLE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE DATA DATE DAY DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED DELETE DEPTH DEREF DESC DESCRIBE DESCRIPTOR DETERMINISTIC DIAGNOSTICS DISCONNECT DISTINCT DO DOMAIN DOUBLE DROP DYNAMIC EACH ELSE ELSEIF END END-EXEC EQUALS ESCAPE EXCEPT EXCEPTION EXEC EXECUTE EXISTS EXIT EXTERNAL FALSE FETCH FIRST FLOAT FOR FOREIGN FOUND FROM FREE FULL FUNCTION GENERAL GET GLOBAL GO GOTO GRANT GROUP GROUPING HANDLE HAVING HOLD HOUR IDENTITY IF IMMEDIATE IN INDICATOR INITIALLY INNER INOUT INPUT INSERT INT INTEGER INTERSECT INTERVAL INTO IS ISOLATION JOIN KEY LANGUAGE LARGE LAST LATERAL LEADING LEAVE LEFT LEVEL LIKE LOCAL LOCALTIME LOCALTIMESTAMP LOCATOR LOOP MAP MATCH METHOD MINUTE MODIFIES MODULE MONTH NAMES NATIONAL NATURAL NCHAR NCLOB NESTING NEW NEXT NO NONE NOT NULL NUMERIC OBJECT OF OLD ON ONLY OPEN OPTION OR ORDER ORDINALITY OUT OUTER OUTPUT OVERLAPS PAD PARAMETER PARTIAL PATH PRECISION PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURE PUBLIC READ READS REAL RECURSIVE REDO REF REFERENCES REFERENCING RELATIVE RELEASE REPEAT RESIGNAL RESTRICT RESULT RETURN RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP ROUTINE ROW ROWS SAVEPOINT SCHEMA SCROLL SEARCH SECOND SECTION SELECT SESSION SESSION_USER SET SETS SIGNAL SIMILAR SIZE SMALLINT SOME SPACE SPECIFIC SPECIFICTYPE SQL SQLEXCEPTION SQLSTATE SQLWARNING START STATE STATIC SYSTEM_USER TABLE TEMPORARY THEN TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TRAILING TRANSACTION TRANSLATION TREAT TRIGGER TRUE UNDER UNDO UNION UNIQUE UNKNOWN UNNEST UNTIL UPDATE USAGE USER USING VALUE VALUES VARCHAR VARYING VIEW WHEN WHENEVER WHERE WHILE WITH WITHOUT WORK WRITE YEAR ZONE ABS ADA ADMIN ASENSITIVE ASSIGNMENT ASYMMETRIC ATOMIC ATTRIBUTE AVG BIT_LENGTH C CALLED CARDINALITY CATALOG_NAME CHAIN CHAR_LENGTH CHARACTERISTICS CHARACTER_LENGTH CHARACTER_SET_CATALOG CHARACTER_SET_NAME CHARACTER_SET_SCHEMA CHECKED CLASS_ORIGIN COALESCE COBOL COLLATION_CATALOG COLLATION_NAME COLLATION_SCHEMA COLUMN_NAME COMMAND_FUNCTION COMMAND_FUNCTION_CODE COMMITTED CONDITION_IDENTIFIER CONDITION_NUMBER CONNECTION_NAME CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONVERT COUNT CURSOR_NAME DATETIME_INTERVAL_CODE DATETIME_INTERVAL_PRECISION DEFINED DEFINER DEGREE DERIVED DISPATCH EVERY EXTRACT FINAL FORTRAN G GENERATED GRANTED HIERARCHY IMPLEMENTATION INSENSITIVE INSTANCE INSTANTIABLE INVOKER K KEY_MEMBER KEY_TYPE LENGTH LOWER M MAX MIN MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MESSAGE_TEXT MOD MORE MUMPS NAME NULLABLE NUMBER NULLIF OCTET_LENGTH ORDERING OPTIONS OVERLAY OVERRIDING PASCAL PARAMETER_MODE PARAMETER_NAME PARAMETER_ORDINAL_POSITION PARAMETER_SPECIFIC_CATALOG PARAMETER_SPECIFIC_NAME PARAMETER_SPECIFIC_SCHEMA PLI POSITION REPEATABLE RETURNED_CARDINALITY RETURNED_LENGTH RETURNED_OCTET_LENGTH RETURNED_SQLSTATE ROUTINE_CATALOG ROUTINE_NAME ROUTINE_SCHEMA ROW_COUNT SCALE SCHEMA_NAME SCOPE SECURITY SELF SENSITIVE SERIALIZABLE SERVER_NAME SIMPLE SOURCE SPECIFIC_NAME STATEMENT STRUCTURE STYLE SUBCLASS_ORIGIN SUBSTRING SUM SYMMETRIC SYSTEM TABLE_NAME TOP_LEVEL_COUNT TRANSACTIONS_COMMITTED TRANSACTIONS_ROLLED_BACK TRANSACTION_ACTIVE TRANSFORM TRANSFORMS TRANSLATE TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME TRIM TYPE UNCOMMITTED UNNAMED UPPER xslthl-2.1.0/highlighters/css21-hl.xml0000644000175000017500000001475512012002745017446 0ustar mathieumathieu /* */ " \ ' \ . @charset @import @media @page - azimuth background-attachment background-color background-image background-position background-repeat background border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width border bottom caption-side clear clip color content counter-increment counter-reset cue-after cue-before cue cursor direction display elevation empty-cells float font-family font-size font-style font-variant font-weight font height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-right margin-left margin-top margin-bottom margin max-height max-width min-height min-width orphans outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page-break-after page-break-before page-break-inside pause-after pause-before pause pitch-range pitch play-during position quotes richness right speak-header speak-numeral speak-punctuation speak speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space widows width word-spacing z-index xslthl-2.1.0/highlighters/perl-hl.xml0000644000175000017500000000713411037717270017462 0ustar mathieumathieu # << ' " " \ ' \ 0x . if unless while until foreach else elsif for when default given caller continue die do dump eval exit goto last next redo return sub wantarray caller import local my package use do import no package require use bless dbmclose dbmopen package ref tie tied untie use and or not eq ne lt gt le ge cmp xslthl-2.1.0/highlighters/sql2003-hl.xml0000644000175000017500000004076212021456413017621 0ustar mathieumathieu -- /* */ ' U' ' B' ' N' ' X' ' . e A ABS ABSOLUTE ACTION ADA ADMIN AFTER ALWAYS ASC ASSERTION ASSIGNMENT ATTRIBUTE ATTRIBUTES AVG BEFORE BERNOULLI BREADTH C CARDINALITY CASCADE CATALOG_NAME CATALOG CEIL CEILING CHAIN CHAR_LENGTH CHARACTER_LENGTH CHARACTER_SET_CATALOG CHARACTER_SET_NAME CHARACTER_SET_SCHEMA CHARACTERISTICS CHARACTERS CHECKED CLASS_ORIGIN COALESCE COBOL CODE_UNITS COLLATION_CATALOG COLLATION_NAME COLLATION_SCHEMA COLLATION COLLECT COLUMN_NAME COMMAND_FUNCTION_CODE COMMAND_FUNCTION COMMITTED CONDITION_NUMBER CONDITION CONNECTION_NAME CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONSTRAINTS CONSTRUCTORS CONTAINS CONVERT CORR COUNT COVAR_POP COVAR_SAMP CUME_DIST CURRENT_COLLATION CURSOR_NAME DATA DATETIME_INTERVAL_CODE DATETIME_INTERVAL_PRECISION DEFAULTS DEFERRABLE DEFERRED DEFINED DEFINER DEGREE DENSE_RANK DEPTH DERIVED DESC DESCRIPTOR DIAGNOSTICS DISPATCH DOMAIN DYNAMIC_FUNCTION_CODE DYNAMIC_FUNCTION EQUALS EVERY EXCEPTION EXCLUDE EXCLUDING EXP EXTRACT FINAL FIRST FLOOR FOLLOWING FORTRAN FOUND FUSION G GENERAL GO GOTO GRANTED HIERARCHY IMPLEMENTATION INCLUDING INCREMENT INITIALLY INSTANCE INSTANTIABLE INTERSECTION INVOKER ISOLATION K KEY_MEMBER KEY_TYPE KEY LAST LENGTH LEVEL LN LOCATOR LOWER M MAP MATCHED MAX MAXVALUE MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MESSAGE_TEXT MIN MINVALUE MOD MORE MUMPS NAME NAMES NESTING NEXT NORMALIZE NORMALIZED NULLABLE NULLIF NULLS NUMBER OBJECT OCTET_LENGTH OCTETS OPTION OPTIONS ORDERING ORDINALITY OTHERS OVERLAY OVERRIDING PAD PARAMETER_MODE PARAMETER_NAME PARAMETER_ORDINAL_POSITION PARAMETER_SPECIFIC_CATALOG PARAMETER_SPECIFIC_NAME PARAMETER_SPECIFIC_SCHEMA PARTIAL PASCAL PATH PERCENT_RANK PERCENTILE_CONT PERCENTILE_DISC PLACING PLI POSITION POWER PRECEDING PRESERVE PRIOR PRIVILEGES PUBLIC RANK READ RELATIVE REPEATABLE RESTART RETURNED_CARDINALITY RETURNED_LENGTH RETURNED_OCTET_LENGTH RETURNED_SQLSTATE ROLE ROUTINE_CATALOG ROUTINE_NAME ROUTINE_SCHEMA ROUTINE ROW_COUNT ROW_NUMBER SCALE SCHEMA_NAME SCHEMA SCOPE_CATALOG SCOPE_NAME SCOPE_SCHEMA SECTION SECURITY SELF SEQUENCE SERIALIZABLE SERVER_NAME SESSION SETS SIMPLE SIZE SOURCE SPACE SPECIFIC_NAME SQRT STATE STATEMENT STDDEV_POP STDDEV_SAMP STRUCTURE STYLE SUBCLASS_ORIGIN SUBSTRING SUM TABLE_NAME TABLESAMPLE TEMPORARY TIES TOP_LEVEL_COUNT TRANSACTION_ACTIVE TRANSACTION TRANSACTIONS_COMMITTED TRANSACTIONS_ROLLED_BACK TRANSFORM TRANSFORMS TRANSLATE TRIGGER_CATALOG TRIGGER_NAME TRIGGER_SCHEMA TRIM TYPE UNBOUNDED UNCOMMITTED UNDER UNNAMED USAGE USER_DEFINED_TYPE_CATALOG USER_DEFINED_TYPE_CODE USER_DEFINED_TYPE_NAME USER_DEFINED_TYPE_SCHEMA VIEW WORK WRITE ZONE ADD ALL ALLOCATE ALTER AND ANY ARE ARRAY AS ASENSITIVE ASYMMETRIC AT ATOMIC AUTHORIZATION BEGIN BETWEEN BIGINT BINARY BLOB BOOLEAN BOTH BY CALL CALLED CASCADED CASE CAST CHAR CHARACTER CHECK CLOB CLOSE COLLATE COLUMN COMMIT CONNECT CONSTRAINT CONTINUE CORRESPONDING CREATE CROSS CUBE CURRENT_DATE CURRENT_DEFAULT_TRANSFORM_GROUP CURRENT_PATH CURRENT_ROLE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_TRANSFORM_GROUP_FOR_TYPE CURRENT_USER CURRENT CURSOR CYCLE DATE DAY DEALLOCATE DEC DECIMAL DECLARE DEFAULT DELETE DEREF DESCRIBE DETERMINISTIC DISCONNECT DISTINCT DOUBLE DROP DYNAMIC EACH ELEMENT ELSE END END-EXEC ESCAPE EXCEPT EXEC EXECUTE EXISTS EXTERNAL FALSE FETCH FILTER FLOAT FOR FOREIGN FREE FROM FULL FUNCTION GET GLOBAL GRANT GROUP GROUPING HAVING HOLD HOUR IDENTITY IMMEDIATE IN INDICATOR INNER INOUT INPUT INSENSITIVE INSERT INT INTEGER INTERSECT INTERVAL INTO IS ISOLATION JOIN LANGUAGE LARGE LATERAL LEADING LEFT LIKE LOCAL LOCALTIME LOCALTIMESTAMP MATCH MEMBER MERGE METHOD MINUTE MODIFIES MODULE MONTH MULTISET NATIONAL NATURAL NCHAR NCLOB NEW NO NONE NOT NULL NUMERIC OF OLD ON ONLY OPEN OR ORDER OUT OUTER OUTPUT OVER OVERLAPS PARAMETER PARTITION PRECISION PREPARE PRIMARY PROCEDURE RANGE READS REAL RECURSIVE REF REFERENCES REFERENCING REGR_AVGX REGR_AVGY REGR_COUNT REGR_INTERCEPT REGR_R2 REGR_SLOPE REGR_SXX REGR_SXY REGR_SYY RELEASE RESULT RETURN RETURNS REVOKE RIGHT ROLLBACK ROLLUP ROW ROWS SAVEPOINT SCROLL SEARCH SECOND SELECT SENSITIVE SESSION_USER SET SIMILAR SMALLINT SOME SPECIFIC SPECIFICTYPE SQL SQLEXCEPTION SQLSTATE SQLWARNING START STATIC SUBMULTISET SYMMETRIC SYSTEM_USER SYSTEM TABLE THEN TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TRAILING TRANSLATION TREAT TRIGGER TRUE UESCAPE UNION UNIQUE UNKNOWN UNNEST UPDATE UPPER USER USING VALUE VALUES VAR_POP VAR_SAMP VARCHAR VARYING WHEN WHENEVER WHERE WIDTH_BUCKET WINDOW WITH WITHIN WITHOUT YEAR xslthl-2.1.0/highlighters/delphi-hl.xml0000644000175000017500000002103111555776532017770 0ustar mathieumathieu {$ } (*$ ) { } (* *) // ' #$ # $ . e and else inherited packed then array end initialization procedure threadvar as except inline program to asm exports interface property try begin file is raise type case final label record unit class finalization library repeat unsafe const finally mod resourcestring until constructor for nil sealed uses destructor function not set var dispinterface goto object shl while div if of shr with do implementation or static xor downto in out string exit break continue at on absolute dynamic local platform requires abstract export message private resident assembler external name protected safecall automated far near public stdcall cdecl forward nodefault published stored contains implements overload read varargs default index override readonly virtual deprecated inline package register write dispid library pascal reintroduce writeonly byte shortint word smallint longint integer cardinal char real double single extended comp boolean xslthl-2.1.0/highlighters/myxml-hl.xml0000644000175000017500000000574610341055332017664 0ustar mathieumathieu A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR XMP xsl: xslthl-2.1.0/highlighters/javascript-hl.xml0000644000175000017500000001066111037717270020665 0ustar mathieumathieu /* */ // " \ ' \ 0x . e break case catch continue default delete do else finally for function if in instanceof new return switch this throw try typeof var void while with abstract boolean byte char class const debugger double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile prototype Array Boolean Date Error EvalError Function Math Number Object RangeError ReferenceError RegExp String SyntaxError TypeError URIError decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt Infinity NaN undefined xslthl-2.1.0/highlighters/sql92-hl.xml0000644000175000017500000002335012021456413017461 0ustar mathieumathieu -- /* */ ' B' ' N' ' X' ' . e ABSOLUTE ACTION ADD ALL ALLOCATE ALTER AND ANY ARE AS ASC ASSERTION AT AUTHORIZATION AVG BEGIN BETWEEN BIT_LENGTH BIT BOTH BY CASCADE CASCADED CASE CAST CATALOG CHAR_LENGTH CHAR CHARACTER_LENGTH CHARACTER CHECK CLOSE COALESCE COLLATE COLLATION COLUMN COMMIT CONNECT CONNECTION CONSTRAINT CONSTRAINTS CONTINUE CONVERT CORRESPONDING CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURRENT CURSOR DATE DAY DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED DELETE DESC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DISTINCT DOMAIN DOUBLE DROP ELSE END END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXECUTE EXISTS EXTERNAL EXTRACT FALSE FETCH FIRST FLOAT FOR FOREIGN FOUND FROM FULL GET GLOBAL GO GOTO GRANT GROUP HAVING HOUR IDENTITY IMMEDIATE IN INDICATOR INITIALLY INNER INPUT INSENSITIVE INSERT INT INTEGER INTERSECT INTERVAL INTO IS ISOLATION JOIN KEY LANGUAGE LAST LEADING LEFT LEVEL LIKE LOCAL LOWER MATCH MAX MIN MINUTE MODULE MONTH NAMES NATIONAL NATURAL NCHAR NEXT NO NOT NULL NULLIF NUMERIC OCTET_LENGTH OF ON ONLY OPEN OPTION OR ORDER OUTER OUTPUT OVERLAPS PAD PARTIAL POSITION PRECISION PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURE PUBLIC READ REAL REFERENCES RELATIVE RESTRICT REVOKE RIGHT ROLLBACK ROWS SCHEMA SCROLL SECOND SECTION SELECT SESSION_USER SESSION SET SIZE SMALLINT SOME SPACE SQL SQLCODE SQLERROR SQLSTATE SUBSTRING SUM SYSTEM_USER TABLE TEMPORARY THEN TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TRAILING TRANSACTION TRANSLATE TRANSLATION TRIM TRUE UNION UNIQUE UNKNOWN UPDATE UPPER USAGE USER USING VALUE VALUES VARCHAR VARYING VIEW WHEN WHENEVER WHERE WITH WORK WRITE YEAR ZONE ADA C CATALOG_NAME CHARACTER_SET_CATALOG CHARACTER_SET_NAME CHARACTER_SET_SCHEMA CLASS_ORIGIN COBOL COLLATION_CATALOG COLLATION_NAME COLLATION_SCHEMA COLUMN_NAME COMMAND_FUNCTION COMMITTED CONDITION_NUMBER CONNECTION_NAME CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CURSOR_NAME DATA DATETIME_INTERVAL_CODE DATETIME_INTERVAL_PRECISION DYNAMIC_FUNCTION FORTRAN LENGTH MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MESSAGE_TEXT MORE MUMPS NAME NULLABLE NUMBER PASCAL PLI REPEATABLE RETURNED_LENGTH RETURNED_OCTET_LENGTH RETURNED_SQLSTATE ROW_COUNT SCALE SCHEMA_NAME SERIALIZABLE SERVER_NAME SUBCLASS_ORIGIN TABLE_NAME TYPE UNCOMMITTED UNNAMED xslthl-2.1.0/highlighters/m2-hl.xml0000644000175000017500000000522211037717270017032 0ustar mathieumathieu (* *) " ' . e and array begin by case const definition div do else elsif end exit export for from if implementation import in loop mod module not of or pointer procedure qualified record repeat return set then to type until var while with xslthl-2.1.0/.project0000644000175000017500000000105612007471540014353 0ustar mathieumathieu xslthl org.eclipse.jdt.core.javabuilder org.eclipse.m2e.core.maven2Builder org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature xslthl-2.1.0/.fbprefs0000644000175000017500000002227612007471540014343 0ustar mathieumathieu#FindBugs User Preferences #Sun Aug 05 14:14:54 CEST 2012 cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true detectorAtomicityProblem=AtomicityProblem|true detectorBCPMethodReturnCheck=BCPMethodReturnCheck|false detectorBadAppletConstructor=BadAppletConstructor|false detectorBadResultSetAccess=BadResultSetAccess|true detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true detectorBadUseOfReturnValue=BadUseOfReturnValue|true detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true detectorBooleanReturnNull=BooleanReturnNull|true detectorBuildInterproceduralCallGraph=BuildInterproceduralCallGraph|false detectorBuildObligationPolicyDatabase=BuildObligationPolicyDatabase|true detectorCallToUnsupportedMethod=CallToUnsupportedMethod|true detectorCalledMethods=CalledMethods|true detectorCheckCalls=CheckCalls|false detectorCheckExpectedWarnings=CheckExpectedWarnings|false detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true detectorCheckTypeQualifiers=CheckTypeQualifiers|true detectorCloneIdiom=CloneIdiom|true detectorComparatorIdiom=ComparatorIdiom|true detectorConfusedInheritance=ConfusedInheritance|true detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true detectorCrossSiteScripting=CrossSiteScripting|true detectorDefaultEncodingDetector=DefaultEncodingDetector|true detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true detectorDontUseEnum=DontUseEnum|true detectorDroppedException=DroppedException|true detectorDumbMethodInvocations=DumbMethodInvocations|true detectorDumbMethods=DumbMethods|true detectorDuplicateBranches=DuplicateBranches|true detectorEmptyZipFileEntry=EmptyZipFileEntry|true detectorEqStringTest=EqStringTest|false detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true detectorExplicitSerialization=ExplicitSerialization|true detectorFieldItemSummary=FieldItemSummary|true detectorFinalizerNullsFields=FinalizerNullsFields|true detectorFindBadCast=FindBadCast|false detectorFindBadCast2=FindBadCast2|true detectorFindBadEqualsImplementation=FindBadEqualsImplementation|false detectorFindBadForLoop=FindBadForLoop|true detectorFindBugsSummaryStats=FindBugsSummaryStats|true detectorFindCircularDependencies=FindCircularDependencies|false detectorFindDeadLocalStores=FindDeadLocalStores|true detectorFindDoubleCheck=FindDoubleCheck|true detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true detectorFindFinalizeInvocations=FindFinalizeInvocations|true detectorFindFloatEquality=FindFloatEquality|true detectorFindFloatMath=FindFloatMath|false detectorFindHEmismatch=FindHEmismatch|true detectorFindInconsistentSync2=FindInconsistentSync2|true detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true detectorFindMaskedFields=FindMaskedFields|true detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true detectorFindNakedNotify=FindNakedNotify|true detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true detectorFindNonShortCircuit=FindNonShortCircuit|true detectorFindNullDeref=FindNullDeref|true detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true detectorFindOpenStream=FindOpenStream|true detectorFindPuzzlers=FindPuzzlers|true detectorFindRefComparison=FindRefComparison|true detectorFindReturnRef=FindReturnRef|true detectorFindRunInvocations=FindRunInvocations|true detectorFindSelfComparison=FindSelfComparison|true detectorFindSelfComparison2=FindSelfComparison2|true detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true detectorFindSpinLoop=FindSpinLoop|true detectorFindSqlInjection=FindSqlInjection|true detectorFindTwoLockWait=FindTwoLockWait|true detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true detectorFindUnconditionalWait=FindUnconditionalWait|true detectorFindUninitializedGet=FindUninitializedGet|true detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true detectorFindUnreleasedLock=FindUnreleasedLock|true detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true detectorFindUnsyncGet=FindUnsyncGet|true detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true detectorFindUselessControlFlow=FindUselessControlFlow|true detectorFormatStringChecker=FormatStringChecker|true detectorHugeSharedStringConstants=HugeSharedStringConstants|true detectorIDivResultCastToDouble=IDivResultCastToDouble|true detectorIncompatMask=IncompatMask|true detectorInconsistentAnnotations=InconsistentAnnotations|true detectorInefficientMemberAccess=InefficientMemberAccess|false detectorInefficientToArray=InefficientToArray|true detectorInfiniteLoop=InfiniteLoop|true detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|false detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true detectorInitializationChain=InitializationChain|true detectorInstantiateStaticClass=InstantiateStaticClass|true detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true detectorInvalidJUnitTest=InvalidJUnitTest|true detectorIteratorIdioms=IteratorIdioms|true detectorLazyInit=LazyInit|true detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true detectorLockedFields=LockedFields|false detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true detectorMethodReturnCheck=MethodReturnCheck|true detectorMethods=Methods|true detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true detectorMutableLock=MutableLock|true detectorMutableStaticFields=MutableStaticFields|true detectorNaming=Naming|true detectorNoteAnnotationRetention=NoteAnnotationRetention|true detectorNoteCheckReturnValue=NoteCheckReturnValue|true detectorNoteCheckReturnValueAnnotations=NoteCheckReturnValueAnnotations|true detectorNoteDirectlyRelevantTypeQualifiers=NoteDirectlyRelevantTypeQualifiers|true detectorNoteJCIPAnnotation=NoteJCIPAnnotation|true detectorNoteNonNullAnnotations=NoteNonNullAnnotations|true detectorNoteNonnullReturnValues=NoteNonnullReturnValues|true detectorNoteSuppressedWarnings=NoteSuppressedWarnings|true detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true detectorNumberConstructor=NumberConstructor|true detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true detectorPublicSemaphores=PublicSemaphores|false detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true detectorRedundantInterfaces=RedundantInterfaces|true detectorReflectiveClasses=ReflectiveClasses|true detectorRepeatedConditionals=RepeatedConditionals|true detectorResolveAllReferences=ResolveAllReferences|false detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true detectorSerializableIdiom=SerializableIdiom|true detectorStartInConstructor=StartInConstructor|true detectorStaticCalendarDetector=StaticCalendarDetector|true detectorStringConcatenation=StringConcatenation|true detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true detectorSwitchFallthrough=SwitchFallthrough|true detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true detectorTestASM=TestASM|false detectorTestDataflowAnalysis=TestDataflowAnalysis|false detectorTestingGround=TestingGround|false detectorTrainFieldStoreTypes=TrainFieldStoreTypes|true detectorTrainNonNullAnnotations=TrainNonNullAnnotations|true detectorTrainUnconditionalDerefParams=TrainUnconditionalDerefParams|true detectorURLProblems=URLProblems|true detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true detectorUnnecessaryMath=UnnecessaryMath|true detectorUnreadFields=UnreadFields|true detectorUseObjectEquals=UseObjectEquals|false detectorUselessSubclassMethod=UselessSubclassMethod|false detectorVarArgsProblems=VarArgsProblems|true detectorVolatileUsage=VolatileUsage|true detectorWaitInLoop=WaitInLoop|true detectorWrongMapIterator=WrongMapIterator|true detectorXMLFactoryBypass=XMLFactoryBypass|true detector_threshold=2 effort=max filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|15 filter_settings_neg=NOISE| run_at_full_build=true xslthl-2.1.0/CHANGES.txt0000644000175000017500000000335112023717150014513 0ustar mathieumathieu2.1.0 * New syntax configurations for: - bourne (Bourne shell) - css21/css (Cascading Stylesheets version 2.1) - cmake - upc (Unified Parallel C) - lua - sql92 - sql1999 (SQL:1999) - sql2003/sql (SQL:2003) * New option for the Number highlighter: letterNoFollow If set, numbers may not contain a letter at the end. For example: 123kg will not be seen as a number. This was the default before version 2.1 * New option for the Heredoc highlighter: flag Flags that can be put after the start. This parameter can be used more than once. For example in the Bourne shell the following is valid start of a heredoc section: <<-FOO. In this case '-' would be a flag. * New options for the Keyword highlighter: - beginChars: a string of characters which should also be considered as beginning part of an identifier. Together with partChars this will allow you to extend the range of characters which make up an identifier in the language. By default the Java functions Character.isJavaIdentifierStart and Character.isJavaIdentifierPart are used to find identifiers. - partChars: a string of characters which should also be considered as part of an identifier. - exclusiveChars: this is a switch, if present only the characters defined by beginChars and partChars will be considered as part of the identifiers. * Updated keywords for PHP 5.3 * Added LINQ keywords to C# configuration * Additional keywords added to Delphi configuration * Basic plugin support to load additional highlighter implementations in Java. See the following wiki page for some additional info: https://sourceforge.net/apps/mediawiki/xslthl/index.php?title=Syntax_Highlighters#Plugin_highlighter xslthl-2.1.0/maven/0000755000175000017500000000000012135713257014016 5ustar mathieumathieuxslthl-2.1.0/maven/deploy.bat0000644000175000017500000000040611237640670016002 0ustar mathieumathieuset VERSION=2.0.1 set REPO_URL=sftp://web.sourceforge.net/home/groups/x/xs/xslthl/htdocs/maven/repository set REPO_ID=xslthl-sourceforge call mvn deploy:deploy-file -Durl=%REPO_URL% -DrepositoryId=%REPO_ID% -DpomFile=pom.xml -Dfile=..\dist\xslthl-%VERSION%.jar xslthl-2.1.0/src/0000755000175000017500000000000012135713264013475 5ustar mathieumathieuxslthl-2.1.0/src/test/0000755000175000017500000000000012135713257014456 5ustar mathieumathieuxslthl-2.1.0/src/test/java/0000755000175000017500000000000012135713257015377 5ustar mathieumathieuxslthl-2.1.0/src/test/java/net/0000755000175000017500000000000012135713257016165 5ustar mathieumathieuxslthl-2.1.0/src/test/java/net/sf/0000755000175000017500000000000012135713257016575 5ustar mathieumathieuxslthl-2.1.0/src/test/java/net/sf/xslthl/0000755000175000017500000000000012135713257020113 5ustar mathieumathieuxslthl-2.1.0/src/test/java/net/sf/xslthl/StyledBlockTest.java0000644000175000017500000000712411224376646024046 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * * @author Michiel Hendriks */ public class StyledBlockTest { static final String BLOCK_CONTENT = "Foo bar quux."; static final String STYLE = "FooBarQuux"; StyledBlock block; /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { block = new StyledBlock(BLOCK_CONTENT, STYLE); } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { block = null; } /** * Test method for {@link net.sf.xslthl.StyledBlock#getText()}. */ @Test public void testGetText() { assertEquals(BLOCK_CONTENT, block.getText()); } /** * Test method for {@link net.sf.xslthl.StyledBlock#toString()}. */ @Test public void testToString() { assertEquals("<" + STYLE + ">" + BLOCK_CONTENT + "", block.toString()); block = new StyledBlock(BLOCK_CONTENT, StyledBlock.NO_STYLE); assertEquals(BLOCK_CONTENT, block.toString()); block = new StyledBlock(BLOCK_CONTENT, StyledBlock.HIDDEN_STYLE); assertEquals("", block.toString()); } /** * Test method for {@link net.sf.xslthl.StyledBlock#isStyled()}. */ @Test public void testIsStyled() { assertTrue(block.isStyled()); block = new StyledBlock(BLOCK_CONTENT, StyledBlock.NO_STYLE); assertFalse(block.isStyled()); block = new StyledBlock(BLOCK_CONTENT, StyledBlock.HIDDEN_STYLE); assertFalse(block.isStyled()); block = new StyledBlock(BLOCK_CONTENT, null); assertFalse(block.isStyled()); } /** * Test method for * {@link net.sf.xslthl.StyledBlock#StyledBlock(java.lang.String, java.lang.String)} * . */ @Test public void testStyledBlock() { new StyledBlock(null, null); new StyledBlock("foo", null); new StyledBlock(null, "foo"); } /** * Test method for {@link net.sf.xslthl.StyledBlock#getStyle()}. */ @Test public void testGetStyle() { assertEquals(STYLE, block.getStyle()); block = new StyledBlock(BLOCK_CONTENT, StyledBlock.NO_STYLE); assertEquals(StyledBlock.NO_STYLE, block.getStyle()); block = new StyledBlock(BLOCK_CONTENT, StyledBlock.HIDDEN_STYLE); assertEquals(StyledBlock.HIDDEN_STYLE, block.getStyle()); block = new StyledBlock(BLOCK_CONTENT, null); assertNull(block.getStyle()); } } xslthl-2.1.0/src/test/java/net/sf/xslthl/highlighters/0000755000175000017500000000000012135713257022574 5ustar mathieumathieuxslthl-2.1.0/src/test/java/net/sf/xslthl/highlighters/xml/0000755000175000017500000000000012135713257023374 5ustar mathieumathieuxslthl-2.1.0/src/test/java/net/sf/xslthl/BlockTest.java0000644000175000017500000000531711224376646022663 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * * @author Michiel Hendriks */ public class BlockTest { static final String BLOCK_CONTENT = "Foo bar quux."; Block block; /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { block = new Block(BLOCK_CONTENT); } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { block = null; } /** * Test method for {@link net.sf.xslthl.Block#Block(java.lang.String)}. */ @Test public void testBlock() { new Block(null); new Block(""); new Block(BLOCK_CONTENT); } /** * Test method for {@link net.sf.xslthl.Block#getText()}. */ @Test public void testGetText() { assertEquals(BLOCK_CONTENT, block.getText()); } /** * Test method for {@link net.sf.xslthl.Block#toString()}. */ @Test public void testToString() { assertEquals(BLOCK_CONTENT, block.toString()); assertEquals(block.getText(), block.toString()); } /** * Test method for {@link net.sf.xslthl.Block#isStyled()}. */ @Test public void testIsStyled() { assertFalse(block.isStyled()); } /** * Test method for {@link net.sf.xslthl.Block#isEmpty()}. */ @Test public void testEmpty() { assertFalse(block.isEmpty()); Block empty = new Block(null); assertTrue(empty.isEmpty()); empty = new Block(""); assertTrue(empty.isEmpty()); } } xslthl-2.1.0/src/main/0000755000175000017500000000000012135713264014421 5ustar mathieumathieuxslthl-2.1.0/src/main/assembly/0000755000175000017500000000000012135713257016242 5ustar mathieumathieuxslthl-2.1.0/src/main/assembly/dist.xml0000644000175000017500000000203412023720740017715 0ustar mathieumathieu dist tar.gz zip ${project.basedir} / README* LICENSE* NOTICE* CHANGES* ${project.build.directory} / ${project.artifactId}-${project.version}.jar ${project.basedir}/highlighters /highlighters xslthl-2.1.0/src/main/java/0000755000175000017500000000000012135713257015344 5ustar mathieumathieuxslthl-2.1.0/src/main/java/net/0000755000175000017500000000000012135713257016132 5ustar mathieumathieuxslthl-2.1.0/src/main/java/net/sf/0000755000175000017500000000000012135713257016542 5ustar mathieumathieuxslthl-2.1.0/src/main/java/net/sf/xslthl/0000755000175000017500000000000012135713264020056 5ustar mathieumathieuxslthl-2.1.0/src/main/java/net/sf/xslthl/StyledBlock.java0000644000175000017500000000474411224376646023160 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; /** * A block with a style */ public class StyledBlock extends Block { /** * Do not add a style, just "block" it */ public static final String NO_STYLE = "none"; /** * Remove this part from the result */ public static final String HIDDEN_STYLE = "hidden"; /** * The style name */ protected String style; public StyledBlock(String text, String style) { super(text); this.style = style; } /* * (non-Javadoc) * * @see net.sf.xslthl.Block#toString() */ @Override public String toString() { if (StyledBlock.HIDDEN_STYLE.equalsIgnoreCase(style)) { return ""; } if (StyledBlock.NO_STYLE.equalsIgnoreCase(style)) { return getText(); } return String.format("<%s>%s", getStyle(), getText(), getStyle()); } /* * (non-Javadoc) * * @see net.sf.xslthl.Block#getText() */ @Override public String getText() { if (StyledBlock.HIDDEN_STYLE.equalsIgnoreCase(style)) { return ""; } return super.getText(); } /** * @return the style name */ public String getStyle() { return style; } /* * (non-Javadoc) * * @see net.sf.xslthl.Block#isStyled() */ @Override public boolean isStyled() { return style != null && !StyledBlock.NO_STYLE.equalsIgnoreCase(style) && !StyledBlock.HIDDEN_STYLE.equalsIgnoreCase(style); } } xslthl-2.1.0/src/main/java/net/sf/xslthl/CharIter.java0000644000175000017500000001436112004775471022432 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * A special character iterator */ public class CharIter implements Iterable, Iterator { private String buffer; private int position = 0; private int length; private int mark = 0; private Matcher matcher; public CharIter(String input) { buffer = input; length = input.length(); } /** * @return the marked position */ public int getMark() { return mark; } /** * Set the current position as the mark */ public void setMark() { mark = position; } /** * Set the mark to the given location * * @param newMark */ public void setMark(int newMark) { mark = newMark; } /** * @return true if there is a mark set */ public boolean isMarked() { return mark < position; } /** * @return the marked section */ public String getMarked() { if (position > length) { position = length; } return buffer.substring(mark, position); } /** * @return the marked string as a block */ public Block markedToBlock() { Block b = new Block(getMarked()); setMark(); return b; } /** * Create a style block, unless the stylename is equale to * {@value StyledBlock#NO_STYLE} * * @param styleName * @return the marked string as a styled block */ public Block markedToStyledBlock(String styleName) { Block b = new StyledBlock(getMarked(), styleName); setMark(); return b; } /** * Increase the pointer */ public void moveNext() { position++; } /** * Increase the point with the given offset * * @param offset */ public void moveNext(int offset) { position += offset; } /** * Increase the pointer and mark the position after it */ public void moveNextAndMark() { moveNext(); setMark(); } /** * Move to the end of the string */ public void moveToEnd() { position = length; } /** * @return true if the iterator finished */ public boolean finished() { return position >= length; } /** * @return the current character */ public Character current() { return buffer.charAt(position); } /** * @return the next character */ public Character next() { if (position + 1 < length) { return buffer.charAt(position + 1); } return null; } /** * @param offset * @return the characters at the given offset */ public Character next(int offset) { if (position + offset < length) { return buffer.charAt(position + offset); } return null; } /** * @return the previous character */ public Character prev() { if (position > 0) { return buffer.charAt(position - 1); } return null; } /** * @param offset * @return the previous character at a given offset */ public Character prev(int offset) { if (position - offset >= 0) { return buffer.charAt(position - offset); } return null; } /** * @param prefix * @return true if the current position starts with the prefix */ public boolean startsWith(String prefix) { return startsWith(prefix, false); } /** * @param prefix * @param ignoreCase * @return true if the current position starts with the prefix */ public boolean startsWith(String prefix, boolean ignoreCase) { return startsWith(prefix, 0, ignoreCase); } /** * @param prefix * @param diff * @return true if the current position starts with the prefix at a given * offset */ public boolean startsWith(String prefix, int diff) { return startsWith(prefix, diff, false); } /** * @param prefix * @param diff * @param ignoreCase * @return true if the current position starts with the prefix at a given * offset */ public boolean startsWith(String prefix, int diff, boolean ignoreCase) { if (ignoreCase) { int end = position + diff + prefix.length(); if (end >= length) { end = length - 1; } if (position + diff >= end) { return false; } return buffer.substring(position + diff, end).equalsIgnoreCase( prefix); } return buffer.startsWith(prefix, position + diff); } /** * Create a pattern matcher * * @param pattern */ public Matcher createMatcher(Pattern pattern) { matcher = pattern.matcher(buffer); return matcher; } /** * @return */ public int getPosition() { return position; } /** * @return */ public int getLength() { return length; } /** * @return the remaining characters in the buffer */ public int remaining() { if (position < length) { return length - position; } return 0; } /** * @param substr * @return the index of the given string */ public int indexOf(String substr) { int index = buffer.indexOf(substr, position); return index < 0 ? -1 : index - position; } /* * (non-Javadoc) * * @see java.lang.Iterable#iterator() */ public Iterator iterator() { return this; } /* * (non-Javadoc) * * @see java.util.Iterator#hasNext() */ public boolean hasNext() { return !finished(); } /* * (non-Javadoc) * * @see java.util.Iterator#remove() */ public void remove() { throw new UnsupportedOperationException(); } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/0000755000175000017500000000000012135713261022534 5ustar mathieumathieuxslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/XMLHighlighter.java0000644000175000017500000002614311224376646026236 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters; import java.util.Collection; import java.util.HashSet; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; import net.sf.xslthl.WholeHighlighter; import net.sf.xslthl.highlighters.xml.ElementPrefix; import net.sf.xslthl.highlighters.xml.ElementSet; import net.sf.xslthl.highlighters.xml.RealElementSet; /** * XML/SGML highlighter. It has a couple of default styles: tag, attribute, * value, directive. Accepted parameters: *
*
elementSet
*
Specialized highlighting for set elements
*
elementPrefix
*
Specialized highlighting for element prefixes
*
styleElement
*
The style to use for elements, defaults to 'tag'
*
styleAttributes
*
The style to use for attributes, defaults to 'attribute'
*
styleValue
*
The style to use for attribute values, defaults to 'value'
*
stylePi
*
The style to use for processing instructions, defaults to 'directive'
*
styleComment
*
The style to use for comments, defaults to 'comment'
*
styleDoctype
*
The style to use for the doctype declaration, defaults to 'doccomment'
*
*/ public class XMLHighlighter extends WholeHighlighter { final static Character APOSTROPHE = '\''; final static Character EQUALS = '='; final static Character EXCLAMATION_MARK = '!'; final static Character GREATER_THAN = '>'; final static Character HYPHEN = '-'; final static Character LESS_THAN = '<'; final static Character QUESTION_MARK = '?'; final static Character QUOTE = '"'; final static Character SLASH = '/'; /** * Overriden styles */ protected Collection elementSets = new HashSet(); /** * Style to use for elements */ protected String styleElement = "tag"; /** * The style for attributes */ protected String styleAttribute = "attribute"; /** * The style for attribute values */ protected String styleValue = "value"; /** * The style for processing instructions */ protected String stylePi = "directive"; /** * The style for comments */ protected String styleComment = "comment"; /** * Style to use for the doctype part */ protected String styleDoctype = "doctype"; /** * @param tagName * @return */ protected String getStyleForTagName(String tagName) { for (ElementSet es : elementSets) { if (es.matches(tagName)) { return es.getStyle(); } } return null; } /* * (non-Javadoc) * * @see net.sf.xslthl.WholeHighlighter#init(net.sf.xslthl.Params) */ @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); if (params != null) { styleAttribute = params.getParam("styleAttribute", styleAttribute); styleComment = params.getParam("styleComment", styleComment); styleDoctype = params.getParam("styleDoctype", styleDoctype); styleElement = params.getParam("styleElement", styleElement); stylePi = params.getParam("stylePi", stylePi); styleValue = params.getParam("styleValue", styleValue); params.getMultiParams("elementSet", elementSets, new Params.ParamsLoader() { public RealElementSet load(Params params) throws HighlighterConfigurationException { return new RealElementSet(params); } }); params.getMultiParams("elementPrefix", elementSets, new Params.ParamsLoader() { public ElementPrefix load(Params params) throws HighlighterConfigurationException { return new ElementPrefix(params); } }); } } /** * @param in * @param out */ void readTagContent(CharIter in, List out) { while (!in.finished() && !XMLHighlighter.GREATER_THAN.equals(in.current()) && !XMLHighlighter.SLASH.equals(in.current())) { if (!Character.isWhitespace(in.current())) { if (in.isMarked()) { out.add(in.markedToBlock()); } while (!in.finished() && !XMLHighlighter.EQUALS.equals(in.current()) && !Character.isWhitespace(in.current())) { in.moveNext(); } out.add(in.markedToStyledBlock(styleAttribute)); while (!in.finished() && Character.isWhitespace(in.current())) { in.moveNext(); } if (in.finished() || !XMLHighlighter.EQUALS.equals(in.current())) { // HTML // no-value // attributes continue; } in.moveNext(); // skip '=' while (!in.finished() && Character.isWhitespace(in.current())) { in.moveNext(); } out.add(in.markedToBlock()); if (XMLHighlighter.QUOTE.equals(in.current()) || XMLHighlighter.APOSTROPHE.equals(in.current())) { Character boundary = in.current(); in.moveNext(); while (!in.finished() && !boundary.equals(in.current())) { in.moveNext(); } if (!in.finished()) { in.moveNext(); } out.add(in.markedToStyledBlock(styleValue)); } else { while (!in.finished() && !XMLHighlighter.GREATER_THAN .equals(in.current()) && !XMLHighlighter.SLASH.equals(in.current()) && !Character.isWhitespace(in.current())) { in.moveNext(); } out.add(in.markedToStyledBlock(styleValue)); } } else { in.moveNext(); } } } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { while (!in.finished()) { if (XMLHighlighter.LESS_THAN.equals(in.current())) { out.add(in.markedToBlock()); in.moveNext(); // skip < if (XMLHighlighter.SLASH.equals(in.current())) { // closing tag -> tag while (!in.finished() && !XMLHighlighter.GREATER_THAN .equals(in.current())) { in.moveNext(); } String style = getStyleForTagName(in.getMarked().trim() .substring(2)); // trims to and than to in.moveNext(); // get > if (style != null) { out.add(in.markedToStyledBlock(style)); } else { out.add(in.markedToStyledBlock(styleElement)); } } else if (XMLHighlighter.QUESTION_MARK.equals(in.current())) { // processing instruction -> directive while (!in.finished() && !(XMLHighlighter.GREATER_THAN.equals(in .current()) && XMLHighlighter.QUESTION_MARK .equals(in.prev()))) { in.moveNext(); } in.moveNext(); out.add(in.markedToStyledBlock(stylePi)); } else if (XMLHighlighter.EXCLAMATION_MARK.equals(in.current()) && XMLHighlighter.HYPHEN.equals(in.next()) && XMLHighlighter.HYPHEN.equals(in.next(2))) { // comment while (!in.finished() && !(XMLHighlighter.GREATER_THAN.equals(in .current()) && XMLHighlighter.HYPHEN.equals(in.prev()) && XMLHighlighter.HYPHEN .equals(in.prev(2)))) { in.moveNext(); } in.moveNext(); out.add(in.markedToStyledBlock(styleComment)); } else if (XMLHighlighter.EXCLAMATION_MARK.equals(in.current()) && in.startsWith("[CDATA[", 1)) { // CDATA section in.moveNext(8); out.add(in.markedToStyledBlock(styleElement)); int idx = in.indexOf("]]>"); if (idx == -1) { in.moveToEnd(); } else { in.moveNext(idx); } out.add(in.markedToBlock()); if (idx != -1) { in.moveNext(3); out.add(in.markedToStyledBlock(styleElement)); } } else if (XMLHighlighter.EXCLAMATION_MARK.equals(in.current()) && in.startsWith("DOCTYPE", 1)) { // doctype... just ignore most of it int cnt = 1; while (!in.finished() && cnt > 0) { if (in.current().equals(GREATER_THAN)) { --cnt; } else if (in.current().equals(LESS_THAN)) { ++cnt; } in.moveNext(); } out.add(in.markedToStyledBlock(styleDoctype)); } else { // normal tag while (!in.finished() && !XMLHighlighter.GREATER_THAN .equals(in.current()) && !XMLHighlighter.SLASH.equals(in.current()) && !Character.isWhitespace(in.current())) { in.moveNext(); } String style = getStyleForTagName(in.getMarked().trim() .substring(1)); // find short tag boolean shortTag = false; int cnt = 0; while (!in.finished() && !XMLHighlighter.GREATER_THAN .equals(in.current()) && !XMLHighlighter.SLASH.equals(in.current()) && Character.isWhitespace(in.current())) { in.moveNext(); ++cnt; } if (XMLHighlighter.SLASH.equals(in.current())) { in.moveNext(); ++cnt; } if (XMLHighlighter.GREATER_THAN.equals(in.current())) { in.moveNext(); shortTag = true; } else { in.moveNext(-cnt); } if (style != null) { out.add(in.markedToStyledBlock(style)); } else { out.add(in.markedToStyledBlock(styleElement)); } if (!shortTag && !in.finished() && Character.isWhitespace(in.current())) { readTagContent(in, out); if (!in.finished()) { if (XMLHighlighter.SLASH.equals(in.current())) { in.moveNext(); } in.moveNext(); if (style != null) { out.add(in.markedToStyledBlock(style)); } else { out.add(in.markedToStyledBlock(styleElement)); } } } } } else { in.moveNext(); } } if (in.isMarked()) { out.add(in.markedToBlock()); } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { // not really used, just here to prevent an error to pop up return "xml"; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/xml/0000755000175000017500000000000012135713260023333 5ustar mathieumathieuxslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/xml/ElementSet.java0000644000175000017500000000347211224376646026264 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters.xml; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Style overrides for various elements */ public abstract class ElementSet { /** * The overridden stylename */ protected String style; public ElementSet(Params params) throws HighlighterConfigurationException { style = params.getParam("style"); } /** * @param tagName * @return true if it matches an overridden style */ public abstract boolean matches(String tagName); /** * @return the style */ public String getStyle() { return style; } }xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/xml/ElementPrefix.java0000644000175000017500000000402711224376646026763 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters.xml; import java.util.HashSet; import java.util.Set; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Style override based on XML prefix */ public class ElementPrefix extends ElementSet { /** * The prefixex to highlight */ private Set prefix; public ElementPrefix(Params params) throws HighlighterConfigurationException { super(params); prefix = new HashSet(); params.getMutliParams("prefix", prefix); } /* * (non-Javadoc) * * @see net.sf.xslthl.highlighters.XMLHighlighter.ElementSet#matches(java * .lang.String) */ @Override public boolean matches(String tagName) { for (String pf : prefix) { if (tagName.startsWith(pf)) { return true; } } return false; } }xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/xml/RealElementSet.java0000644000175000017500000000427411224376646027071 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters.xml; import java.util.Collection; import java.util.TreeSet; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; import net.sf.xslthl.Highlighter.IgnoreCaseComparator; /** * Override the style for given elements (whole name) */ public class RealElementSet extends ElementSet { /** * The tags names */ private Collection tagNames; public RealElementSet(Params params) throws HighlighterConfigurationException { super(params); boolean ignoreCase = params.isSet("ignoreCase"); if (ignoreCase) { tagNames = new TreeSet(new IgnoreCaseComparator()); } else { tagNames = new TreeSet(); } params.getMutliParams("element", tagNames); } /* * (non-Javadoc) * * @see net.sf.xslthl.highlighters.XMLHighlighter.ElementSet#matches(java * .lang.String) */ @Override public boolean matches(String tagName) { return tagNames.contains(tagName); } }xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/HexaDecimalHighlighter.java0000644000175000017500000000066311224376646027741 0ustar mathieumathieu/** * */ package net.sf.xslthl.highlighters; /** * Number highlighter for hexadecimal numbers */ public class HexaDecimalHighlighter extends NumberHighlighter { /* * (non-Javadoc) * * @see net.sf.xslthl.highlighters.NumberHighlighter#isDigit(char) */ @Override protected boolean isDigit(char ch) { return (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F') || super.isDigit(ch); } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/MultilineCommentHighlighter.java0000644000175000017500000000605011224376646031056 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Performs highlighting for multi-line comments Accepted parameters: *
*
start
*
How the multiline comment starts. Required.
*
end
*
How the multiline comment ends. Required.
*
*/ public class MultilineCommentHighlighter extends Highlighter { /** * The start and end token */ protected String start, end; @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); start = params.getParam("start"); end = params.getParam("end"); if (start == null || start.length() == 0) { throw new HighlighterConfigurationException( "Required parameter 'start' is not set."); } if (end == null || end.length() == 0) { throw new HighlighterConfigurationException( "Required parameter 'end' is not set."); } } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (in.startsWith(start)) { return true; } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { in.moveNext(start.length()); // skip start int endIndex = in.indexOf(end); if (endIndex == -1) { in.moveToEnd(); } else { in.moveNext(endIndex + end.length()); } out.add(in.markedToStyledBlock(styleName)); return true; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return "comment"; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/StringHighlighter.java0000644000175000017500000001003311224376646027033 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Recognizes strings. Accepted parameters: *
*
string
*
How the string starts. Required.
*
endString
*
How the string ends. If not present the start value is used.
*
escape
*
Character to use to escape characters. Optional.
*
doubleEscapes
*
When present the double usage of start is considered to be an escaped * start (used in Pascal). Optional.
*
spanNewLines
*
When present strings can span newlines, otherwise a newline breaks the * string parsing.
*
*/ public class StringHighlighter extends Highlighter { /** * The start token and the escape token. */ private String start, end, escape; /** * If set the double occurance of start escapes it. */ private boolean doubleEscapes; /** * If set newlines are ignored in string parsing. */ private boolean spansNewLines; /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#init(net.sf.xslthl.Params) */ @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); start = params.getParam("string"); end = params.getParam("endString", start); escape = params.getParam("escape"); doubleEscapes = params.isSet("doubleEscapes"); spansNewLines = params.isSet("spanNewLines"); if (start == null || start.length() == 0) { throw new HighlighterConfigurationException( "Required parameter 'start' is not set."); } } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (in.startsWith(start)) { return true; } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { in.moveNext(start.length()); // skip start boolean wasEscape = false; while (!in.finished()) { if (!spansNewLines && isNewLine(in.current())) { break; } if (in.startsWith(end) && !wasEscape) { if (doubleEscapes && in.startsWith(end, end.length())) { in.moveNext(); } else { in.moveNext(end.length() - 1); break; } } else if (escape != null && in.startsWith(escape) && !wasEscape) { wasEscape = true; } else { wasEscape = false; } in.moveNext(); } if (!in.finished()) { in.moveNext(); } out.add(in.markedToStyledBlock(styleName)); return true; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return "string"; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/KeywordsHighlighter.java0000644000175000017500000001070211254437543027374 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters; import java.util.Collection; import java.util.List; import java.util.TreeSet; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Scans for registered keywords Accepted parameters: *
*
keywords
*
Keywords this highlighter recognizes. Can be used multiple times
*
ignoreCase
*
If this element is present the keywords are case insensitive.
*
*/ public class KeywordsHighlighter extends Highlighter { /** * the keywords this highligher accepts */ protected Collection keywords; /** * Ignore case of the keywords. */ protected boolean ignoreCase = false; /** * Optional extra character sequence that defines the start of an identifier */ protected String startChars; /** * Optional extra character sequence that defines the part of an identifier */ protected String partChars; /** * If true, then startChars and partChars are the only characters accepted * for the identifiers */ protected boolean exclusiveChars; @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); ignoreCase = params.isSet("ignoreCase"); exclusiveChars = params.isSet("exclusiveChars"); if (ignoreCase) { keywords = new TreeSet(new IgnoreCaseComparator()); } else { keywords = new TreeSet(); } params.getMutliParams("keyword", keywords); startChars = params.getParam("beginChars"); partChars = params.getParam("partChars"); } protected void appendUnique(StringBuilder buf, char ch) { for (int i = 0; i < buf.length(); ++i) { if (buf.charAt(i) == ch) { return; } } buf.append(ch); } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (isIdentifierStart(in.current()) && (in.prev() == null || !isIdentifierPart(in.prev()))) { return true; } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { while (!in.finished() && isIdentifierPart(in.current())) { in.moveNext(); } if (keywords.contains(in.getMarked())) { out.add(in.markedToStyledBlock(styleName)); return true; } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return "keyword"; } /** * @param ch * @return True if this character is a valid start of an identifier */ protected boolean isIdentifierStart(char ch) { if (startChars != null) { if (startChars.indexOf(ch) != -1) { return true; } if (exclusiveChars) { return false; } } return Character.isJavaIdentifierStart(ch); } /** * @param ch * @return True if this character is a valid part of an identifier */ protected boolean isIdentifierPart(char ch) { if (partChars != null) { if (partChars.indexOf(ch) != -1) { return true; } if (exclusiveChars) { return false; } } return Character.isJavaIdentifierPart(ch); } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/RegexHighlighterEx.java0000644000175000017500000000666011224376646027147 0ustar mathieumathieu/** * */ package net.sf.xslthl.highlighters; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Regular expression highlighter. Accepted parameters: *
*
pattern
*
The regular expression pattern to be matched.
*
flags
*
Flags, see javadoc (use the constant names AS IS)
*
*/ public class RegexHighlighterEx extends Highlighter { protected Pattern pattern; /** * Matcher used to find locations */ protected Matcher matcher; /** * If true this matcher is done */ protected boolean finished; /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#init(net.sf.xslthl.Params) */ @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); int flags = 0; String[] flagString = params.getParam("flags", "").split("[;,]"); for (String flag : flagString) { flag = flag.trim(); if ("CASE_INSENSITIVE".equalsIgnoreCase(flag)) { flags += Pattern.CASE_INSENSITIVE; } else if ("DOTALL".equalsIgnoreCase(flag)) { flags += Pattern.DOTALL; } else if ("MULTILINE".equalsIgnoreCase(flag)) { flags += Pattern.MULTILINE; } else if ("UNICODE_CASE".equalsIgnoreCase(flag)) { flags += Pattern.UNICODE_CASE; } else if ("LITERAL".equalsIgnoreCase(flag)) { flags += Pattern.LITERAL; } else if ("UNIX_LINES".equalsIgnoreCase(flag)) { flags += Pattern.UNIX_LINES; } else if ("COMMENTS".equalsIgnoreCase(flag)) { flags += Pattern.COMMENTS; } else if ("CANON_EQ".equalsIgnoreCase(flag)) { flags += Pattern.CANON_EQ; } } String pat = params.getParam("pattern"); if (params.isSet("pattern")) { try { pattern = Pattern.compile(pat, flags); } catch (PatternSyntaxException e) { throw new HighlighterConfigurationException(e.getMessage(), e); } } if (pattern == null) { throw new HighlighterConfigurationException( "Required parameter 'pattern' is not set."); } } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return null; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#reset() */ @Override public void reset() { matcher = null; finished = false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (matcher == null) { matcher = in.createMatcher(pattern); finished = !matcher.find(); } while (!finished && matcher.start() < in.getPosition()) { finished = !matcher.find(); } if (!finished) { return matcher.start() == in.getPosition(); } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { if (!finished) { in.moveNext(matcher.end() - matcher.start()); out.add(in.markedToStyledBlock(styleName)); finished = !matcher.find(); return true; } return false; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/NestedMultilineCommentHighlighter.java0000644000175000017500000000441211224376646032221 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Just like the multiline comment highlighter, but accepts nesting of comments. */ public class NestedMultilineCommentHighlighter extends MultilineCommentHighlighter { @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); } /* * (non-Javadoc) * * @see * net.sf.xslthl.MultilineCommentHighlighter#highlight(net.sf.xslthl.CharIter * , java.util.List) */ @Override public boolean highlight(CharIter in, List out) { in.moveNext(start.length()); // skip start int depth = 1; while (!in.finished()) { if (in.startsWith(end)) { in.moveNext(end.length()); if (depth == 1) { break; } else { depth--; } } else if (in.startsWith(start)) { depth++; in.moveNext(start.length()); } else { in.moveNext(); } } out.add(in.markedToStyledBlock(styleName)); return true; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/NumberHighlighter.java0000644000175000017500000001237412012002745027005 0ustar mathieumathieu/** * */ package net.sf.xslthl.highlighters; import java.util.ArrayList; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Recognizes numbers. Accepted parameters: *
*
point
*
character used for the decimal point. If not declared no decimal points * are accepted.
*
thousands
*
thousand separator
*
exponent
*
the string used for recognizing the exponent part of a floating point
*
pointStarts
*
a switch, when set the value defined as point can also be used to start a * number. For example ".1234" would also be accepted as a number.
*
prefix
*
required start of a number, can be useful in the hexnumber highlighter to * define how a hexadecimal number is started
*
suffix
*
an optional string that can be found after a number, can be define * multiple times. This is often used to set the "size" of a integer or floating * point.
*
ignoreCase
*
all strings parameters are case insensitive
*
letterNoFollow
*
If set, numbers may not contain a letter at the end. For example: * 123kg will not be seen as a number. This was the default before * version 2.1
*
*/ public class NumberHighlighter extends Highlighter { /** * The decimal point */ protected String decimalPoint; /** * Thousand seperator */ protected String thousandSep; /** * The character to use to start the exponent */ protected String exponent; /** * Opional suffixes */ protected List suffix; /** * Required prefix */ protected String prefix; /** * Ignore case when looking for exponent and flags */ protected boolean ignoreCase; /** * If true a number can start with the decimal point */ protected boolean pointStarts; protected boolean letterNoFollow; /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#init(net.sf.xslthl.Params) */ @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); decimalPoint = params.getParam("point"); thousandSep = params.getParam("thousands"); exponent = params.getParam("exponent"); pointStarts = decimalPoint != null && params.isSet("pointStarts"); ignoreCase = params.isSet("ignoreCase"); suffix = new ArrayList(); params.getMutliParams("suffix", suffix); prefix = params.getParam("prefix"); letterNoFollow = params.isSet("cleanEnd"); } /** * Return true if it is an ascii digit * * @param ch * @return */ protected boolean isDigit(char ch) { return ch >= '0' && ch <= '9'; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return "number"; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (in.getPosition() > 0 && (prefix == null) && (Character.isLetter(in.prev()) || isDigit(in.prev()))) { // If the previous character was a number, then this cannot be the // start of a number. fixes bug #2986341 return false; } if (prefix != null) { return in.startsWith(prefix, ignoreCase) && isDigit(in.next(prefix.length())); } if (pointStarts && in.startsWith(decimalPoint, ignoreCase) && isDigit(in.next(decimalPoint.length()))) { return true; } return isDigit(in.current()); } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { boolean hadPoint = false; boolean hadExponent = false; if (prefix != null && in.startsWith(prefix, ignoreCase)) { in.moveNext(prefix.length()); } if (pointStarts && in.startsWith(decimalPoint, ignoreCase)) { in.moveNext(decimalPoint.length()); hadPoint = true; } while (!in.finished()) { if (!hadPoint) { if (decimalPoint != null && in.startsWith(decimalPoint, ignoreCase)) { hadPoint = true; in.moveNext(decimalPoint.length()); continue; } else if (thousandSep != null && in.startsWith(thousandSep, ignoreCase)) { in.moveNext(thousandSep.length()); continue; } } if (!hadExponent) { if (exponent != null && in.startsWith(exponent, ignoreCase)) { hadPoint = true; hadExponent = true; in.moveNext(exponent.length()); if (in.current().equals('-') || in.current().equals('+')) { in.moveNext(); } continue; } } if (!isDigit(in.current())) { break; } in.moveNext(); } for (String suf : suffix) { if (in.startsWith(suf, ignoreCase)) { in.moveNext(suf.length()); break; } } if (letterNoFollow && (!in.finished() && Character.isLetter(in.current()))) { return false; } out.add(in.markedToStyledBlock(styleName)); return true; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/HeredocHighlighter.java0000644000175000017500000001135712007476631027143 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters; import java.util.HashSet; import java.util.List; import java.util.Set; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Accepts heredoc constructions. Accepted parameters: *
*
start
*
How the heredoc construction starts. Required.
*
quote
*
Allowed quote characters to be used in the identifier name. This * parameter can be used more than once.
*
noWhiteSpace
*
whitespace after start is not allowed.
*
looseTerminator
*
if set the identifier does not have to start on a new line
*
flag
*
Flags that can be put after the 'start'. This parameter can be used more * than once.
*
* See http://en.wikipedia.org/wiki/Heredoc */ public class HeredocHighlighter extends Highlighter { /** * The token that initiates a heredoc construction */ protected String start; /** * quote characters that can be used in the heredoc identifier */ protected Set quoteChar; protected boolean noWhiteSpace; protected boolean looseTerminator; protected boolean indentFlag; protected Set flags; @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); start = params.getParam("start"); if (start == null || start.length() == 0) { throw new HighlighterConfigurationException( "Required parameter 'start' is not set."); } quoteChar = new HashSet(); params.getMutliParams("quote", quoteChar); noWhiteSpace = params.isSet("noWhiteSpace"); looseTerminator = params.isSet("looseTerminator"); flags = new HashSet(); params.getMutliParams("flag", flags); } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (in.startsWith(start)) { if (noWhiteSpace) { return !Character.isWhitespace(in.next(start.length() + 1)); } return true; } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { in.moveNext(start.length()); // skip start // skip flags while (flags.contains(in.current().toString())) { in.moveNext(); } // skip whitespace if (!noWhiteSpace) { while (!in.finished() && Character.isWhitespace(in.current())) { in.moveNext(); } } StringBuilder heredocId = new StringBuilder(); Character quoted = '\0'; // identifier might me quoted if (quoteChar.contains(in.current().toString())) { quoted = in.current(); in.moveNext(); } while (!in.finished() && (Character.isLetterOrDigit(in.current()) || in.current() == '_') && !quoted.equals(in.current())) { heredocId.append(in.current()); in.moveNext(); } if (quoted.equals(in.current())) { in.moveNext(); } if (heredocId.length() == 0) { return false; } int i; do { i = in.indexOf(heredocId.toString()); if (i < 0) { in.moveToEnd(); } else { in.moveNext(i + heredocId.length()); } if (looseTerminator || isNewLine(in.prev(heredocId.length() + 1))) { break; } } while (i != -1); out.add(in.markedToStyledBlock(styleName)); return true; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return "string"; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/AnnotationHighlighter.java0000644000175000017500000000514411224376646027706 0ustar mathieumathieu/** * */ package net.sf.xslthl.highlighters; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Recognizes annotations. Accepted parameters: *
*
start
*
How the annotation starts. Required.
*
end
*
How the annotation ends. Optional.
*
valueStart
*
String used to start the value section of annotations
*
valueEnd
*
String used to end the value section of annotations
*
*/ public class AnnotationHighlighter extends Highlighter { protected String start, end, valueStart, valueEnd; /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#init(net.sf.xslthl.Params) */ @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); start = params.getParam("start"); end = params.getParam("end"); valueStart = params.getParam("valueStart"); valueEnd = params.getParam("valueEnd"); if (start == null || start.length() == 0) { throw new HighlighterConfigurationException( "Required parameter 'start' is not set."); } } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return "annotation"; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (in.startsWith(start)) { return Character.isJavaIdentifierStart(in.next(start.length())); } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { in.moveNext(start.length()); // skip start int valueCnt = 0; boolean hadEnd = false; while (!in.finished()) { if (valueStart != null && in.startsWith(valueStart)) { ++valueCnt; } else if (valueEnd != null && in.startsWith(valueEnd)) { --valueCnt; } else if (valueCnt == 0) { if (end != null && valueCnt == 0 && in.startsWith(end)) { in.moveNext(end.length()); hadEnd = true; break; } else if (end == null && Character.isWhitespace(in.current())) { hadEnd = true; break; } } in.moveNext(); } if (!hadEnd) { return false; } out.add(in.markedToStyledBlock(styleName)); return true; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/WordHighlighter.java0000644000175000017500000000414311224376646026505 0ustar mathieumathieu/** * */ package net.sf.xslthl.highlighters; import java.util.ArrayList; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Highlights the list of elements as they are encounterd. No special * processing. This is a slow highlighter. Accepted parameters: *
*
word
*
The word it recognizes, can be used multiple times.
*
ignoreCase
*
the words are recognized case insensitive
*
*/ public class WordHighlighter extends Highlighter { /** * The words to recognize */ protected List words; /** * If true ingore the case */ protected boolean caseInsensitive; /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#init(net.sf.xslthl.Params) */ @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); words = new ArrayList(); params.getMutliParams("word", words); caseInsensitive = params.isSet("ignoreCase"); } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { for (String string : words) { if (in.startsWith(string, caseInsensitive)) { return true; } } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { // no default style return null; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { for (String string : words) { if (in.startsWith(string, caseInsensitive)) { in.moveNext(string.length()); if (in.finished() || Character.isWhitespace(in.current())) { out.add(in.markedToStyledBlock(styleName)); return true; } } } return false; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/highlighters/OnelineCommentHighlighter.java0000644000175000017500000000751111224376646030510 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl.highlighters; import java.util.List; import net.sf.xslthl.Block; import net.sf.xslthl.CharIter; import net.sf.xslthl.Highlighter; import net.sf.xslthl.HighlighterConfigurationException; import net.sf.xslthl.Params; /** * Single line comments. Accepted parameters: *
*
start
*
How the single line comment starts Required.
*
lineBreakEscape
*
string that can be used to break the line and continue on the next line
*
solitary
*
a switch, if set the comment must not be preceded by non whitespace on * the line
*
*/ public class OnelineCommentHighlighter extends Highlighter { /** * The start of the comment highlighter */ protected String start; /** * String used to escape a newline */ protected String lineBreakEscape; protected boolean solitary; @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); if (params.isSet("start")) { start = params.getParam("start"); lineBreakEscape = params.getParam("lineBreakEscape"); } else { // legacy format start = params.getParam(); } if (start == null || start.length() == 0) { throw new HighlighterConfigurationException( "Required parameter 'start' is not set."); } solitary = params.isSet("solitary"); } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#startsWith(net.sf.xslthl.CharIter) */ @Override public boolean startsWith(CharIter in) { if (in.startsWith(start)) { if (solitary) { int i = 1; while (i < in.getPosition() && Character.isWhitespace(in.prev(i))) { if (isNewLine(in.prev(i))) { return true; } ++i; } return false; } return true; } return false; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#highlight(net.sf.xslthl.CharIter, * java.util.List) */ @Override public boolean highlight(CharIter in, List out) { in.moveNext(start.length()); // skip start int endIndex; do { endIndex = in.indexOf("\n"); int cnt = 1; if (endIndex == -1) { in.moveToEnd(); } else { in.moveNext(endIndex); if (in.prev().equals('\r')) { in.moveNext(-1); ++cnt; } } if (lineBreakEscape == null || lineBreakEscape.length() == 0) { break; } if (!in.startsWith(lineBreakEscape, -1 * lineBreakEscape.length())) { break; } in.moveNext(cnt); } while (endIndex != -1); out.add(in.markedToStyledBlock(styleName)); return true; } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#getDefaultStyle() */ @Override public String getDefaultStyle() { return "comment"; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/FilteredElementIterator.java0000644000175000017500000001234111224407600025474 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2009 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.HashSet; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Set; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * An iterator over the child elements of a given element, filtered by a set of * element names. * * @author Michiel Hendriks */ public class FilteredElementIterator implements Iterator { /** * Defines a filter used by this iterator * * @author Michiel Hendriks */ public interface Acceptor { /** * Accept or reject an element * * @param elm * The current element * @return True if the element is accepted */ boolean accepted(Element elm); } /** * Acceptor that accepts elements based on the tag name */ public static class TagNameAcceptor implements Acceptor { protected Set names; public TagNameAcceptor(Set acceptNames) { if (acceptNames == null) { throw new NullPointerException("Set can not be null"); } names = new HashSet(acceptNames); } /* * (non-Javadoc) * * @see * net.sf.xslthl.FilteredElementIterator.Acceptor#accepted(org.w3c.dom * .Element) */ public boolean accepted(Element elm) { return names.contains(elm.getTagName()); } } /** * The current element */ protected Element base; /** * The current element */ protected Element current; /** * The used acceptor for filtering */ protected Acceptor acceptor; /** * If true a new value should be retrieved */ protected boolean dirty = true; /** * Will be true if the search reached an end */ protected boolean finished; public FilteredElementIterator(Element baseElement, Acceptor filter) { if (baseElement == null) { throw new NullPointerException("Base Element can not be null"); } if (filter == null) { throw new NullPointerException("Acceptor can not be null"); } acceptor = filter; base = baseElement; dirty = true; } /** * Creates a filtered element iterator that accepts elements with a given * tag name * * @param baseElement * @param acceptTagNames */ public FilteredElementIterator(Element baseElement, Set acceptTagNames) { this(baseElement, new TagNameAcceptor(acceptTagNames)); } /* * (non-Javadoc) * * @see java.util.Iterator#hasNext() */ public boolean hasNext() { if (!finished && dirty) { // not finished, and the current value is dirty getNextElement(); } return current != null; } /* * (non-Javadoc) * * @see java.util.Iterator#next() */ public Element next() { if (!finished && dirty) { // if dirty first get a new value getNextElement(); } if (finished) { // no more elements throw new NoSuchElementException(); } dirty = true; return current; } /* * (non-Javadoc) * * @see java.util.Iterator#remove() */ public void remove() { throw new UnsupportedOperationException("Elements can not be removed"); } /** * Get the next valid element */ protected void getNextElement() { assert !finished : "Should not call getNextElements on a finished list"; if (current == null) { current = getAcceptedElement(base.getFirstChild()); } else { current = getAcceptedElement(current.getNextSibling()); } // iteration is finished when the current element is null finished = current == null; dirty = false; } /** * Get the next accepted element. Will continue searching for the next * sibling nodes. * * @param node * The first node to test * @return The accepted element, or null */ protected Element getAcceptedElement(Node node) { while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE && node instanceof Element) { Element result = (Element) node; if (acceptor.accepted(result)) { return result; } } node = node.getNextSibling(); } return null; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/MainHighlighter.java0000644000175000017500000000766211224607742024000 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /** * Main source highlighter. It will call all registered highlighters. */ public class MainHighlighter { protected String id; protected String filename; /** * Normal highlighter */ protected List highlighters = new ArrayList(); /** * */ protected List wholehighlighters = new ArrayList(); public MainHighlighter(String highlighterId, String configFilename) { id = highlighterId; filename = configFilename; } /** * The highlighter identifier * * @return */ public String getId() { return id; } /** * The configuration filename, can be null * * @return */ public String getFilename() { return filename; } public void add(Highlighter h) { if (h instanceof WholeHighlighter) { wholehighlighters.add((WholeHighlighter) h); } else { highlighters.add(h); } } @Deprecated public void addWhole(WholeHighlighter h) { add(h); } /** * Convert the input string into a collection of text blocks * * @param source * @return */ public List highlight(String source) { CharIter in = new CharIter(source); List out = new ArrayList(); if (highlighters.size() > 0) { while (!in.finished()) { boolean found = false; for (Highlighter h : highlighters) { if (h.startsWith(in)) { int pos = in.getPosition(); int oldMark = -2; Block preBlock = null; if (in.isMarked()) { oldMark = in.getMark(); preBlock = in.markedToBlock(); out.add(preBlock); } found = h.highlight(in, out); if (found) { break; } else { // undo last action when it was a false positive in.moveNext(pos - in.getPosition()); if (preBlock != null) { out.remove(preBlock); } if (oldMark != -2) { in.setMark(oldMark); } } } } if (!found) { in.moveNext(); } } } else { in.moveToEnd(); } if (in.isMarked()) { out.add(in.markedToBlock()); } if (wholehighlighters.size() > 0) { for (WholeHighlighter h : wholehighlighters) { List oldout = out; out = new LinkedList(); for (Block b : oldout) { if (b.isStyled() && (h.appliesOnAllStyles() || h .appliesOnStyle(((StyledBlock) b) .getStyle())) || !b.isStyled() && h.appliesOnEmptyStyle()) { h.highlight(new CharIter(b.getText()), out); } else { out.add(b); } } } } for (Highlighter h : highlighters) { h.reset(); } for (WholeHighlighter h : wholehighlighters) { h.reset(); } return out; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/Params.java0000644000175000017500000001025611254436042022145 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.Collection; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Syntax highlighter parameters */ public class Params { public interface ParamsLoader { T load(Params params) throws HighlighterConfigurationException; } protected Element paramElem; public Params(Element paramElem) { this.paramElem = paramElem; } /** * Return the text content for the given element. This is different from the * Element.getTextContect() function in a way that normal text nodes are * trimmed and CDATA is used AS IS * * @param elm * @return */ protected String getTextContent(Node elm) { if (elm == null) { return ""; } StringBuilder sb = new StringBuilder(); NodeList list = elm.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node n = list.item(i); if (sb.length() > 0) { sb.append(' '); } if (n.getNodeType() == Node.CDATA_SECTION_NODE) { sb.append(n.getTextContent()); } else { sb.append(n.getTextContent().trim()); } } return sb.toString(); } /** * Get the current element as value * * @return */ public String getParam() { return getTextContent(paramElem); } /** * Get a single parameter. Returns null when the parameter doesn't exist. * * @param name * @return */ public String getParam(String name) { return getParam(name, null); } /** * Get a single parameter with a default value. * * @param name * @param defaultValue * @return */ public String getParam(String name, String defaultValue) { NodeList nodes = paramElem.getElementsByTagName(name); if (nodes.getLength() == 0) { return defaultValue; } return getTextContent(nodes.item(0)); } /** * @param name * @return */ public Params getParams(String name) { Element elm = (Element) paramElem.getElementsByTagName(name).item(0); if (elm == null) { return null; } return new Params(elm); } /** * Return true if a parameter with the given name exists. * * @param name * @return */ public boolean isSet(String name) { return paramElem.getElementsByTagName(name).getLength() > 0; } /** * Load multiple parameters into a list * * @param name * @param list */ public void getMutliParams(String name, Collection list) { NodeList nodes = paramElem.getElementsByTagName(name); for (int i = 0; i < nodes.getLength(); i++) { Element elem = (Element) nodes.item(i); list.add(getTextContent(elem)); } } /** * Get the parameters using a specialized loader * * @param * @param name * @param list * @param loader * @throws HighlighterConfigurationException */ public void getMultiParams(String name, Collection list, ParamsLoader loader) throws HighlighterConfigurationException { NodeList nodes = paramElem.getElementsByTagName(name); for (int i = 0; i < nodes.getLength(); i++) { Element elem = (Element) nodes.item(i); list.add(loader.load(new Params(elem))); } } } xslthl-2.1.0/src/main/java/net/sf/xslthl/Config.java0000644000175000017500000003426312007471540022132 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.io.File; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import net.sf.xslthl.highlighters.AnnotationHighlighter; import net.sf.xslthl.highlighters.HeredocHighlighter; import net.sf.xslthl.highlighters.HexaDecimalHighlighter; import net.sf.xslthl.highlighters.KeywordsHighlighter; import net.sf.xslthl.highlighters.MultilineCommentHighlighter; import net.sf.xslthl.highlighters.NestedMultilineCommentHighlighter; import net.sf.xslthl.highlighters.NumberHighlighter; import net.sf.xslthl.highlighters.OnelineCommentHighlighter; import net.sf.xslthl.highlighters.RegexHighlighterEx; import net.sf.xslthl.highlighters.StringHighlighter; import net.sf.xslthl.highlighters.WordHighlighter; import net.sf.xslthl.highlighters.XMLHighlighter; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * Contains the Xslthl configuration */ public class Config { /** * System property that defines the path to the configuration file */ public static final String CONFIG_PROPERTY = "xslthl.config"; /** * If set to true be verbose during loading of the configuration * * @deprecated since 2.1 XSLTHL uses the Java logging facility */ @Deprecated public static final String VERBOSE_LOADING_PROPERTY = "xslthl.config.verbose"; /** * The log level for the xslthl logger * * @since 2.1 */ public static final String LOGLEVEL_PROPERTY = "xslthl.loglevel"; /** * Property set to disable external configuration loading */ public static final String NO_EXTERNAL_PROPERTY = "xslthl.noexternal"; /** * Instances per config file */ private static final Map instances = new HashMap(); /** * Registered highlighter classes */ public static final Map> highlighterClasses = new HashMap>(); /** * Prefix used for plug-able highlighters * * @since 2.1 */ public static final String PLUGIN_PREFIX = "java:"; static { // register builtin highlighers highlighterClasses.put("multiline-comment", MultilineCommentHighlighter.class); highlighterClasses.put("nested-multiline-comment", NestedMultilineCommentHighlighter.class); highlighterClasses.put("oneline-comment", OnelineCommentHighlighter.class); highlighterClasses.put("string", StringHighlighter.class); highlighterClasses.put("heredoc", HeredocHighlighter.class); highlighterClasses.put("keywords", KeywordsHighlighter.class); highlighterClasses.put("annotation", AnnotationHighlighter.class); highlighterClasses.put("regex", RegexHighlighterEx.class); highlighterClasses.put("word", WordHighlighter.class); highlighterClasses.put("number", NumberHighlighter.class); highlighterClasses.put("hexnumber", HexaDecimalHighlighter.class); highlighterClasses.put("xml", XMLHighlighter.class); } /** * Prefix to use on created XML elements */ protected String prefix = "http://xslthl.sf.net"; /** * The namespace uri */ protected String uri = "xslthl"; /** * Registered highlighters */ protected Map highlighters = new HashMap(); /** * The logging facility */ protected Logger logger = Logger.getLogger("net.sf.xslthl"); @Deprecated protected boolean verbose; /** * Get the default config * * @return */ public static Config getInstance() { return getInstance(null); } /** * Get the config from a given file * * @param filename * @return */ public static Config getInstance(String filename) { String key = (filename == null) ? "" : filename; if (!instances.containsKey(key)) { Config conf = new Config(filename); instances.put(key, conf); } return instances.get(key); } /** * @return the prefix */ public String getPrefix() { return prefix; } /** * @return the uri */ public String getUri() { return uri; } /** * Get the highlighter for a given language id, URI or filename. * * @param id * @return A highlighter, or null if no highlighter exists */ public MainHighlighter getMainHighlighter(String id) { if (id != null && id.length() > 0 && !highlighters.containsKey(id)) { if (!Boolean.getBoolean(NO_EXTERNAL_PROPERTY)) { // might be a URI String uri = null; try { URI location = new URI(id); if (location.getScheme() != null) { uri = location.toString(); } } catch (URISyntaxException e) { } if (uri == null) { File floc = new File(id); if (floc.getAbsoluteFile().exists()) { uri = floc.getAbsoluteFile().toURI().toString(); } else { // no highlighter found, which is not a major problem // (i.e. fail silently) logger.info(String .format("%s is not an known language id, valid URI, or existing file name", id)); } } if (uri != null) { try { logger.info(String.format( "Loading external highlighter from %s", uri.toString())); MainHighlighter hl = loadHl(id, uri); highlighters.put(id, hl); return hl; } catch (Exception e) { logger.log(Level.SEVERE, String.format( "Unable to load highlighter from %s: %s", id, e.getMessage()), e); } } } } return highlighters.get(id); } /** * Load a language highlighter configuration * * @param filename * @return * @throws Exception */ protected MainHighlighter loadHl(String id, String filename) throws Exception { MainHighlighter main = new MainHighlighter(id, filename); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbf.newDocumentBuilder(); Document doc = builder.parse(filename); Set tagNames = new HashSet(); tagNames.add("highlighter"); tagNames.add("wholehighlighter"); createHighlighters(main, new FilteredElementIterator(doc.getDocumentElement(), tagNames)); return main; } /** * Creates the defined highlighters * * @param main * @param elements */ protected void createHighlighters(MainHighlighter main, Iterator elements) { while (elements.hasNext()) { Element hl = elements.next(); Params params = new Params(hl); String type = hl.getAttribute("type"); try { Class hlClass = highlighterClasses .get(type); if (hlClass == null && type.startsWith(PLUGIN_PREFIX)) { hlClass = loadPlugin(main, type, hl.getAttribute("classpath")); } if (hlClass != null) { Highlighter hlinstance = hlClass.newInstance(); hlinstance.init(params); main.add(hlinstance); } else { logger.severe(String .format("Unknown highlighter: %s", type)); } } catch (HighlighterConfigurationException e) { logger.log(Level.SEVERE, String.format( "Invalid configuration for highlighter %s: %s", type, e.getMessage()), e); } catch (InstantiationException e) { logger.log(Level.SEVERE, String.format( "Error constructing highlighter %s: %s", type, e.getMessage()), e); } catch (IllegalAccessException e) { logger.log(Level.SEVERE, String.format( "IError constructing highlighter %s: %s", type, e.getMessage()), e); } } } /** * Load a plugin highlighter * * @param type * @param classpath * @return The plugin class * @since 2.1 */ protected Class loadPlugin(MainHighlighter main, String type, String classpath) { ClassLoader cl = Config.class.getClassLoader(); if (classpath != null && classpath.length() > 0) { String[] paths = classpath.split(";"); final List urls = new ArrayList(); for (String path : paths) { path = path.trim(); if (path.length() == 0) { continue; } try { URL url; if (main.getFilename() == null) { url = new URL(path); } else { URL base = new URL(main.getFilename()); url = new URL(base, path); } urls.add(url); } catch (MalformedURLException e) { logger.log(Level.WARNING, String.format( "Invalid classpath entry %s: %s", path, e.getMessage()), e); } } if (urls.size() > 0) { final ClassLoader parentCl = cl; PrivilegedAction getCl = new PrivilegedAction() { public URLClassLoader run() { return new URLClassLoader(urls.toArray(new URL[urls .size()]), parentCl); } }; try { cl = AccessController.doPrivileged(getCl); } catch (Exception e) { logger.log(Level.SEVERE, String.format( "Unable to create class loader with urls %s. %s", urls, e.getMessage()), e); return null; } } } try { String className = type.substring(PLUGIN_PREFIX.length()); Class tmp = cl.loadClass(className); if (Highlighter.class.isAssignableFrom(tmp)) { return tmp.asSubclass(Highlighter.class); } else { logger.log( Level.SEVERE, String.format("Class %s is not a subclass of %s", tmp.getName(), Highlighter.class.getName())); } } catch (ClassNotFoundException e) { logger.log( Level.SEVERE, String.format("Unable to resolve highlighter class: %s", e.getMessage()), e); } return null; } protected Config() { this(null); } protected Config(String configFilename) { Level logLevel = Level.WARNING; try { logLevel = Level.parse(System.getProperty(LOGLEVEL_PROPERTY)); } catch (Exception e) { } logger.setLevel(logLevel); logger.info("Initializing xslthl " + Version.getVersion()); loadConfiguration(configFilename); } /** * Load the configuration * * @param configFilename * When null or empty the default system configuration will be * used * @since 2.1 */ protected void loadConfiguration(String configFilename) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbf.newDocumentBuilder(); // Find the configuration filename if (configFilename == null || "".equals(configFilename)) { logger.config("No config file specified, falling back to default behavior"); if (System.getProperty(CONFIG_PROPERTY) != null) { configFilename = System.getProperty(CONFIG_PROPERTY); } else { configFilename = "xslthl-config.xml"; } } logger.info(String.format("Loading Xslthl configuration from %s", configFilename)); Document doc = builder.parse(configFilename); NodeList hls = doc.getDocumentElement().getElementsByTagName( "highlighter"); Map fileMapping = new HashMap(); for (int i = 0; i < hls.getLength(); i++) { // Process the highlighters Element hl = (Element) hls.item(i); String id = hl.getAttribute("id"); if (highlighters.containsKey(id)) { logger.warning(String.format( "Highlighter with id '%s' already exists!", id)); } String filename = hl.getAttribute("file"); String absFilename = new URL(new URL(configFilename), filename) .toString(); if (fileMapping.containsKey(absFilename)) { // no need to load the same file twice. logger.config(String.format( "Reusing loaded highlighter for %s from %s", id, absFilename)); highlighters.put(id, fileMapping.get(absFilename)); continue; } logger.info(String.format("Loading %s highligter from %s", id, absFilename)); try { MainHighlighter mhl = loadHl(id, absFilename); highlighters.put(id, mhl); fileMapping.put(absFilename, mhl); } catch (Exception e) { logger.log(Level.SEVERE, String.format( "Failed to load highlighter from %s: %s", absFilename, e.getMessage()), e); } } // Process the additional settings NodeList prefixNode = doc.getDocumentElement() .getElementsByTagName("namespace"); if (prefixNode.getLength() == 1) { Element e = (Element) prefixNode.item(0); prefix = e.getAttribute("prefix"); uri = e.getAttribute("uri"); } } catch (Exception e) { logger.log(Level.SEVERE, String.format( "Cannot read configuration %s: %s", configFilename, e.getMessage()), e); } if (!highlighters.containsKey("xml")) { // add the built-in XML highlighting if it wasn't overloaded MainHighlighter xml = new MainHighlighter("xml", null); xml.add(new XMLHighlighter()); highlighters.put("xml", xml); } } } xslthl-2.1.0/src/main/java/net/sf/xslthl/ConnectorSaxonB.java0000644000175000017500000001112111224376646023771 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.ArrayList; import java.util.List; import net.sf.saxon.event.Builder; import net.sf.saxon.expr.XPathContext; import net.sf.saxon.om.Axis; import net.sf.saxon.om.AxisIterator; import net.sf.saxon.om.Item; import net.sf.saxon.om.ListIterator; import net.sf.saxon.om.NamePool; import net.sf.saxon.om.NodeInfo; import net.sf.saxon.om.SequenceIterator; import net.sf.saxon.pattern.AnyNodeTest; import net.sf.saxon.type.Type; /** * A new saxon connector to be used with saxon 8.5 and later. */ public class ConnectorSaxonB { private static void blockToSaxon6Node(Block b, Builder builder, NamePool pool, Config config) throws Exception { if (b.isStyled()) { int elemId = pool.allocate(config.prefix, config.uri, ((StyledBlock) b).getStyle()); builder.startElement(elemId, -1, 0, 0); builder.characters(b.getText(), 0, b.getText().length()); builder.endElement(); } else { builder.characters(b.getText(), 0, b.getText().length()); } } /** * Highlight the nodes using the standard configuration file * * @param context * @param hlCode * @param nodes * @return * @throws Exception */ public static SequenceIterator highlight(XPathContext context, String hlCode, SequenceIterator nodes) throws Exception { return highlight(context, hlCode, nodes, null); } /** * highlight the nodes using a specific interface * * @param context * @param hlCode * @param seq * @param configFilename * @return * @throws Exception */ public static SequenceIterator highlight(XPathContext context, String hlCode, SequenceIterator seq, String configFilename) throws Exception { try { Config c = Config.getInstance(configFilename); MainHighlighter hl = c.getMainHighlighter(hlCode); NamePool pool = context.getController().getNamePool(); List resultNodes = new ArrayList(); while (seq.next() != null) { Item itm = seq.current(); if (itm instanceof NodeInfo) { NodeInfo ni = (NodeInfo) itm; SequenceIterator ae = ni.iterateAxis(Axis.CHILD, AnyNodeTest.getInstance()); while (ae.next() != null) { Item itm2 = ae.current(); if (itm2 instanceof NodeInfo) { NodeInfo n2i = (NodeInfo) itm2; if (n2i.getNodeKind() == Type.TEXT) { if (hl != null) { Builder builder = context.getController() .makeBuilder(); builder.open(); builder.startDocument(0); List l = hl.highlight(n2i .getStringValue()); for (Block b : l) { blockToSaxon6Node(b, builder, pool, c); } builder.endDocument(); builder.close(); NodeInfo doc = builder.getCurrentRoot(); AxisIterator elms = doc.iterateAxis( Axis.CHILD, AnyNodeTest .getInstance()); while (elms.next() != null) { resultNodes.add(elms.current()); } } else { resultNodes.add(n2i); } } else { resultNodes.add(n2i); } } else { resultNodes.add(itm2); } } } else { resultNodes.add(itm); } } return new ListIterator(resultNodes); } catch (Exception e) { e.printStackTrace(); return null; } } } xslthl-2.1.0/src/main/java/net/sf/xslthl/HighlighterConfigurationException.java0000644000175000017500000000104211224376646027572 0ustar mathieumathieu/** * */ package net.sf.xslthl; /** * Exception thrown on construction of a highlighter when the configuration is * incomplete */ public class HighlighterConfigurationException extends Exception { private static final long serialVersionUID = -4137958185614779128L; /** * @param arg0 * @param arg1 */ public HighlighterConfigurationException(String arg0, Throwable arg1) { super(arg0, arg1); } /** * @param arg0 */ public HighlighterConfigurationException(String arg0) { super(arg0); } } xslthl-2.1.0/src/main/java/net/sf/xslthl/Version.java0000644000175000017500000000452712007471540022352 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; /** * Version information for xslthl */ public class Version { /** * @return the version string */ public static String getVersion() { return VersionInternal.versionString; } /** * Internal class responsible for loading */ private static class VersionInternal { private static Logger LOG = Logger.getLogger("net.sf.xslthl"); private static String versionString = "undefined"; static { Properties prop = new Properties(); InputStream is = VersionInternal.class .getResourceAsStream("META-INF/maven/net.sf.xslthl/xslthl/pom.properties"); if (is != null) { try { prop.load(is); versionString = prop.getProperty("version", versionString); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to get version information. " + e.getMessage(), e); } finally { try { is.close(); } catch (IOException e) { } } } } } } xslthl-2.1.0/src/main/java/net/sf/xslthl/ConnectorSaxon6.java0000644000175000017500000001155011224376646023763 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import com.icl.saxon.Context; import com.icl.saxon.expr.XPathException; import com.icl.saxon.om.Axis; import com.icl.saxon.om.AxisEnumeration; import com.icl.saxon.om.Builder; import com.icl.saxon.om.DocumentInfo; import com.icl.saxon.om.NamePool; import com.icl.saxon.om.NodeEnumeration; import com.icl.saxon.om.NodeInfo; import com.icl.saxon.pattern.AnyNodeTest; import com.icl.saxon.tree.AttributeCollection; /** * Connector for Saxon 6. For newer saxon versions the ConnectorSaxonB should be * used. */ public class ConnectorSaxon6 { private static void blockToSaxon6Node(Block b, Builder builder, NamePool pool, Config config) throws Exception { if (b.isStyled()) { AttributeCollection emptyAtts = new AttributeCollection(pool); int elemId = pool.allocate(config.prefix, config.uri, ((StyledBlock) b).getStyle()); builder.startElement(elemId, emptyAtts, new int[0], 0); builder.characters(b.getText().toCharArray(), 0, b.getText() .length()); builder.endElement(elemId); } else { builder.characters(b.getText().toCharArray(), 0, b.getText() .length()); } } /** * Highlight the nodes using the standard configuration file * * @param context * @param hlCode * @param nodes * @return * @throws Exception */ public static NodeEnumeration highlight(Context context, String hlCode, NodeEnumeration nodes) throws Exception { return highlight(context, hlCode, nodes, null); } /** * highlight the nodes using a specific interface * * @param context * @param hlCode * @param nodes * @param configFilename * @return * @throws Exception */ public static NodeEnumeration highlight(Context context, String hlCode, NodeEnumeration nodes, String configFilename) throws Exception { try { Config c = Config.getInstance(configFilename); MainHighlighter hl = c.getMainHighlighter(hlCode); NamePool pool = context.getController().getNamePool(); List resultNodes = new ArrayList(); while (nodes.hasMoreElements()) { NodeInfo ni = nodes.nextElement(); AxisEnumeration ae = ni.getEnumeration(Axis.CHILD, AnyNodeTest .getInstance()); while (ae.hasMoreElements()) { NodeInfo n2i = ae.nextElement(); if (n2i.getNodeType() == NodeInfo.TEXT) { if (hl != null) { Builder builder = context.getController() .makeBuilder(); builder.startDocument(); List l = hl.highlight(n2i.getStringValue()); for (Block b : l) { blockToSaxon6Node(b, builder, pool, c); } builder.endDocument(); DocumentInfo doc = builder.getCurrentDocument(); NodeEnumeration elms = doc.getEnumeration( Axis.CHILD, AnyNodeTest.getInstance()); while (elms.hasMoreElements()) { resultNodes.add(elms.nextElement()); } } else { resultNodes.add(n2i); } } else { // deepCopy(builder, pool, n2i); resultNodes.add(n2i); } } } return new NodeEnumerationIterator(resultNodes.iterator()); } catch (Exception e) { e.printStackTrace(); return null; } } static class NodeEnumerationIterator implements NodeEnumeration { protected Iterator it; NodeEnumerationIterator(Iterator useit) { it = useit; } public boolean hasMoreElements() { return it.hasNext(); } public boolean isPeer() { return true; } public boolean isReverseSorted() { return false; } public boolean isSorted() { return true; } public NodeInfo nextElement() throws XPathException { return it.next(); } } } xslthl-2.1.0/src/main/java/net/sf/xslthl/Block.java0000644000175000017500000000401511224376646021762 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; /** * A block of text */ public class Block { /** * The content of this block */ protected String text; public Block(String text) { this.text = text; } /** * @return the text within this block */ public String getText() { return text; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return getText(); } /** * @return true if this block contains style information */ public boolean isStyled() { return false; } /** * @return true if this block as no content * @deprecated Use {@link #isEmpty()} instead */ @Deprecated public boolean empty() { return isEmpty(); } /** * @return true if this block as no content */ public boolean isEmpty() { if (text == null || text.length() == 0) { return true; } return false; } } xslthl-2.1.0/src/main/java/net/sf/xslthl/WholeHighlighter.java0000644000175000017500000000422111224376646024164 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.Collection; import java.util.HashSet; /** * */ public abstract class WholeHighlighter extends Highlighter { private Collection styles = new HashSet(); private boolean emptyStyle = true; private boolean allStyles = false; void loadStyles(Params params) { if (!params.isSet("empty")) { emptyStyle = false; } if (params.isSet("all")) { allStyles = true; return; } params.getMutliParams("style", styles); } boolean appliesOnEmptyStyle() { return emptyStyle; } boolean appliesOnAllStyles() { return allStyles; } boolean appliesOnStyle(String style) { return styles.contains(style); } /* * (non-Javadoc) * * @see net.sf.xslthl.Highlighter#init(net.sf.xslthl.Params) */ @Override public void init(Params params) throws HighlighterConfigurationException { super.init(params); if (params != null && params.isSet("applyOnStyles")) { loadStyles(params.getParams("applyOnStyles")); } } } xslthl-2.1.0/src/main/java/net/sf/xslthl/ConnectorXalan.java0000644000175000017500000001021711224376646023647 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.util.List; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.xalan.extensions.ExpressionContext; import org.apache.xpath.NodeSet; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * XalanConnector for XsltHL. Usage: Add the namespace * xmlns:xhl="xalan://net.sf.xslthl.XalanConnector" then you can * use the function: * xhl:highlight($language, exsl:node-set($content)) or xhl:highlight($language, exsl:node-set($content), 'myConfigFile') * * @author Michiel Hendriks */ public class ConnectorXalan { protected static NodeList highlight(ExpressionContext c, String source, MainHighlighter hl, Config config) throws Exception { NodeSet list = new NodeSet(); List l = hl.highlight(source); for (Block b : l) { Node elm; if (b.isStyled()) { elm = DocumentInstance.doc.createElementNS(config.uri, ((StyledBlock) b).getStyle()); elm.setTextContent(b.getText()); } else { elm = DocumentInstance.doc.createTextNode(b.getText()); } list.addElement(elm); } return list; } /** * highlight the given nodes using the standard configuration * * @param context * @param hlCode * @param nodes * @return */ public static final NodeList highlight(ExpressionContext context, String hlCode, NodeList nodes) { return highlight(context, hlCode, nodes, null); } /** * highlight the given nodes * * @param context * @param hlCode * @param nodes * @param configFilename * @return */ public static final NodeList highlight(ExpressionContext context, String hlCode, NodeList nodes, String configFilename) { try { Config c = Config.getInstance(configFilename); MainHighlighter hl = c.getMainHighlighter(hlCode); NodeSet list = new NodeSet(); for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); NodeList childs = n.getChildNodes(); for (int j = 0; j < childs.getLength(); j++) { Node m = childs.item(j); if (m.getNodeType() == Node.TEXT_NODE) { if (hl != null) { list.addNodes(highlight(context, m.getNodeValue(), hl, c)); } else { list.addNode(DocumentInstance.doc.createTextNode(m .getNodeValue())); } } else { list.addNode(m); } } } return list; } catch (Exception e) { e.printStackTrace(); return null; } } /** * Used for note construction. (lazy loading) */ private static class DocumentInstance { private static final Document doc; static { try { doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } } } } xslthl-2.1.0/src/main/java/net/sf/xslthl/Highlighter.java0000644000175000017500000000730411224410354023153 0ustar mathieumathieu/* * xslthl - XSLT Syntax Highlighting * https://sourceforge.net/projects/xslthl/ * Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * Michal Molhanec * Jirka Kosek * Michiel Hendriks */ package net.sf.xslthl; import java.io.Serializable; import java.util.Comparator; import java.util.List; import java.util.regex.Pattern; /** * Base highlighter. Accepted parameters: *
*
Style
*
The style to use in the generated block. Must be a valid XML name.
*
*/ public abstract class Highlighter { /** * validates a valid XML name (note: ':' is not allowed) * http://www.w3.org/TR/2000/REC-xml-20001006#NT-Letter */ public static final Pattern XMLname = Pattern .compile("[\\p{Ll}\\p{Lu}\\p{Lo}\\p{Lt}\\p{Nl}_][\\p{Ll}\\p{Lu}\\p{Lo}\\p{Lt}\\p{Nl}\\p{Mc}\\p{Me}\\p{Mn}\\p{Lm}\\p{Nd}_.-]*"); public final static class IgnoreCaseComparator implements Comparator, Serializable { private static final long serialVersionUID = -3992873598858412249L; public int compare(String s1, String s2) { return s1.compareToIgnoreCase(s2); } } public final static boolean isNewLine(Character c) { return '\n' == c || '\r' == c; } /** * The name of the style to use */ protected String styleName; /** * Initializer * * @param params * @throws HighlighterConfigurationException */ public void init(Params params) throws HighlighterConfigurationException { if (params == null) { styleName = getDefaultStyle(); } else { styleName = params.getParam("style", getDefaultStyle()); } if (styleName == null || styleName.length() == 0) { throw new HighlighterConfigurationException( "Required parameter 'style' is not set."); } if (StyledBlock.NO_STYLE.equalsIgnoreCase(styleName)) { styleName = StyledBlock.NO_STYLE; } else if (StyledBlock.HIDDEN_STYLE.equalsIgnoreCase(styleName)) { styleName = StyledBlock.HIDDEN_STYLE; } else { if (!XMLname.matcher(styleName).matches()) { throw new HighlighterConfigurationException(String.format( "%s is not a valid XML Name", styleName)); } } } /** * return true if the current character is a possible match for this * highlighter * * @param in * @return */ public boolean startsWith(CharIter in) { return false; } /** * Perform highlighting on the current token stream. Return true when * highlighting was performed, or false in case of a false positive. * * @param in * @param out * @return */ public abstract boolean highlight(CharIter in, List out); /** * The default style name * * @return */ public abstract String getDefaultStyle(); /** * Reset this highlighter to it's initially configured state */ public void reset() { } } xslthl-2.1.0/src/main/resources/0000755000175000017500000000000012135713264016433 5ustar mathieumathieuxslthl-2.1.0/src/site/0000755000175000017500000000000012135713264014441 5ustar mathieumathieuxslthl-2.1.0/src/site/site.xml0000644000175000017500000000063012022171122016110 0ustar mathieumathieu xslthl-2.1.0/src/site/apt/0000755000175000017500000000000012135713264015225 5ustar mathieumathieuxslthl-2.1.0/src/site/apt/index.apt0000644000175000017500000000266312022171122017033 0ustar mathieumathieu --- XSLT syntax highlighting --- XSLT syntax highlighting Xslthl is an implementation of syntax highlighting as an extension module for Java based XSLT processors. So if you have, for example, an article about programming written in {{{http://wiki.docbook.org/topic/DocBook}DocBook}}, code examples can be automatically syntax highlighted when you use {{{http://docbook.sourceforge.net/}DocBook XSL}} to transform the DocBook code to HTML, Rtf, etc. DocBook XSL ships with {{{http://sagehill.net/docbookxsl/SyntaxHighlighting.html}built in support}} for syntax highlighting using xslthl. But xslthl is not limited to be used just with DocBook Xsl, you can use it for anything that used XSLT and one of the supported XSLT processors. More information about how to use xslthl with your own xslt processing can be found on the {{{http://sourceforge.net/apps/mediawiki/xslthl/index.php?title=Usage}wiki}}, just like information about how to configure xslthl to {{{http://sourceforge.net/apps/mediawiki/xslthl/index.php?title=Syntax_Highlighters}support new languages}}. * Supported XSLT Processors Xslthl supports the following Java based XSLT Processors: * {{{http://xml.apache.org/xalan-j/}Apache Xalan-J}} (2.7 and later) * {{{http://saxon.sourceforge.net/}Saxon for Xslt 1}} (6.5, and 7) * {{{http://saxon.sourceforge.net/}Saxon for Xslt 2}} (8.5 and later) xslthl-2.1.0/pom.xml0000644000175000017500000001305312023725725014226 0ustar mathieumathieu 4.0.0 net.sf.xslthl xslthl 2.1.0 XSLT syntax highlighting This is an implementation of syntax highlighting as an extension module for XSLT processors, so if you have e.g. article about programming written in DocBook, code examples can be automatically syntax highlighted during the XSLT processing phase. This version of xslthl provides extensions of the Apache Xalan and Saxon XSLT processors. http://xslthl.sourceforge.net 2005 jar zlib License http://www.spdx.org/licenses/Zlib org.sonatype.oss oss-parent 7 org.codehaus.mojo findbugs-maven-plugin 2.5.2 package check maven-antrun-plugin 1.7 site run maven-assembly-plugin 2.3 src/main/assembly/dist.xml make-assembly package single org.apache.maven.plugins maven-source-plugin 2.2 attach-sources package jar-no-fork org.apache.maven.plugins maven-javadoc-plugin 2.8.1 package jar org.codehaus.mojo findbugs-maven-plugin 2.5.2 org.apache.maven.plugins maven-javadoc-plugin 2.8.1 xalan xalan [2.7,2.8) true saxon saxon [6.5,7.0] true net.sf.saxon saxon [8.5,) true junit junit [4.0,5.0) test scm:svn:https://xslthl.svn.sourceforge.net/svnroot/xslthl/tags/xslthl-2.1.0 scm:svn:https://xslthl.svn.sourceforge.net/svnroot/xslthl/tags/xslthl-2.1.0 http://xslthl.svn.sourceforge.net/viewvc/xslthl/tags/xslthl-2.1.0 sourceforge https://sourceforge.net/tracker/?group_id=153524&atid=788111 mol1111 Michal Molhanec mol1111 at users.sourceforge.net kosek Jirka Kosek kosek at users.sourceforge.net elmuerte Michiel Hendriks elmuerte at users.sourceforge.net release-sign-artifacts performRelease true org.apache.maven.plugins maven-gpg-plugin 1.1 sign-artifacts verify sign xslthl-2.1.0/.settings/0000755000175000017500000000000012135713265014625 5ustar mathieumathieuxslthl-2.1.0/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000006002612007471540021606 0ustar mathieumathieueclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indentation.size=8 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=80 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true xslthl-2.1.0/.settings/org.eclipse.m2e.core.prefs0000644000175000017500000000013212023725561021503 0ustar mathieumathieuactiveProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1 xslthl-2.1.0/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000003225012007471540021271 0ustar mathieumathieueclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_Java Conventions (Customized) formatter_settings_version=12 org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=false sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=false sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true xslthl-2.1.0/.settings/org.eclipse.core.resources.prefs0000644000175000017500000000023312023725561023034 0ustar mathieumathieueclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 encoding/=UTF-8 xslthl-2.1.0/build.xml0000644000175000017500000000454712007460751014537 0ustar mathieumathieu