Hello community,

here is the log from the commit of package libt3highlight for openSUSE:Factory 
checked in at 2019-12-21 12:32:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libt3highlight (Old)
 and      /work/SRC/openSUSE:Factory/.libt3highlight.new.6675 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libt3highlight"

Sat Dec 21 12:32:09 2019 rev:10 rq:758354 version:0.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libt3highlight/libt3highlight.changes    
2019-08-23 11:09:38.246459172 +0200
+++ /work/SRC/openSUSE:Factory/.libt3highlight.new.6675/libt3highlight.changes  
2019-12-21 12:32:42.679401183 +0100
@@ -1,0 +2,9 @@
+Thu Dec 19 23:49:31 UTC 2019 - Jan Engelhardt <[email protected]>
+
+- Update to release 0.5.0
+  * This release adds highlighting scopes, which provides the
+    ability to use different rendering for included languages.
+    For example, it allows using different rendering for keywords
+    in CSS than for keywords in the HTML it is embedded in.
+
+-------------------------------------------------------------------

Old:
----
  libt3highlight-0.4.8.tar.bz2

New:
----
  libt3highlight-0.5.0.tar.bz2
  libt3highlight-0.5.0.tar.bz2.sig
  libt3highlight.keyring

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libt3highlight.spec ++++++
--- /var/tmp/diff_new_pack.7uWkVP/_old  2019-12-21 12:32:43.103401384 +0100
+++ /var/tmp/diff_new_pack.7uWkVP/_new  2019-12-21 12:32:43.103401384 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libt3highlight
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,19 +18,21 @@
 
 Name:           libt3highlight
 %define lname  libt3highlight2
-Version:        0.4.8
+Version:        0.5.0
 Release:        0
 Summary:        The Tilde Toolkit's syntax highlighting library
 License:        GPL-3.0-only
 Group:          Development/Libraries/C and C++
 URL:            https://os.ghalkes.nl/t3/libt3highlight.html
 
-#Git-Clone:    git://github.com/gphalkes/t3highlight
+#Git-Clone:    https://github.com/gphalkes/t3highlight
 Source:         https://os.ghalkes.nl/dist/%name-%version.tar.bz2
+Source2:        https://os.ghalkes.nl/dist/%name-%version.tar.bz2.sig
+Source3:        %name.keyring
 BuildRequires:  fdupes
 BuildRequires:  gettext-tools
 BuildRequires:  libtool
-BuildRequires:  pkgconfig
+BuildRequires:  pkg-config
 BuildRequires:  pkgconfig(libpcre2-8)
 BuildRequires:  pkgconfig(libt3config) >= 0.2.5
 

++++++ libt3highlight-0.4.8.tar.bz2 -> libt3highlight-0.5.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/Changelog 
new/libt3highlight-0.5.0/Changelog
--- old/libt3highlight-0.4.8/Changelog  2019-05-10 09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/Changelog  2019-11-30 18:37:20.000000000 +0100
@@ -1,3 +1,22 @@
+Version 0.5.0:
+    New features:
+    - Introduced optional style scopes. This allows having separate rendering 
of
+      styles for different code types, in particular for embedding one code 
type
+      into another. A good example where this can be useful is for CSS, which 
is
+      often embedded into HTML. Using different rendering of the styles allows
+      visual distinction between the distinct code types in the same file.
+
+    Bug fixes:
+    - Allow comments in CSS documents in all the relevant places.
+
+Version 0.4.9:
+    New features:
+    - Added syntax highlighting for Markdown documents.
+
+    Bug fixes:
+    - Fix Perl highlighting patterns to handle nested variable expansion (e.g.
+      ${$foo}).
+
 Version 0.4.8:
     Bug fixes:
     - Fixed incorrect free on uninitialized pointers when validation of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/config.pkg 
new/libt3highlight-0.5.0/config.pkg
--- old/libt3highlight-0.4.8/config.pkg 2019-05-10 09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/config.pkg 2019-11-30 18:37:20.000000000 +0100
@@ -60,7 +60,7 @@
                error "!! Can not find libt3config. libt3config is required to 
compile libt3highlight."
 
        PKGCONFIG_DESC="Syntax highlighting library"
-       PKGCONFIG_VERSION="0.4.8"
+       PKGCONFIG_VERSION="0.5.0"
        PKGCONFIG_URL="http://os.ghalkes.nl/t3/libt3highlight.html";
        PKGCONFIG_CFLAGS="-I\${includedir}/t3/highlight"
        PKGCONFIG_LIBS="-lt3highlight"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/configure 
new/libt3highlight-0.5.0/configure
--- old/libt3highlight-0.4.8/configure  2019-05-10 09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/configure  2019-11-30 18:37:20.000000000 +0100
@@ -172,6 +172,7 @@
 
 #@INCLUDE_START
 [ "${EXTENSIONS}" = "c libtool pkgconfig verbose_compile pkgconfig_dep gettext 
lfs" ] || error "EXTENSIONS changed after running merge_config. Run 
merge_config again."
+SWITCHES="${SWITCHES} +c99"
 SUFFIXES="${SUFFIXES} .c .o"
 [ -z "${LINKRULE}" ] && LINKRULE='$(CC) $(CFLAGS) $(LDFLAGS) -o $@ .config.o 
$(LDLIBS) $(TESTLIBS)'
 [ -z "${COMPILERULE}" ] && COMPILERULE='$(CC) $(CFLAGS) $(TESTFLAGS) -c -o $@ 
$<'
@@ -224,6 +225,27 @@
        test_link "working C compiler (${CC-${MAKE} default})" || error "No 
working C compiler found. See config.log for errors."
 }
 
+has_support_c99() {
+       if [ "no" = "${with_c99}" ] ; then
+               return
+       fi
+       clean_c
+       cat > .config.c <<EOF
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
+#error Not a C99 compiler
+#endif
+int main(int argc, char *argv[]) {
+       return 0;
+}
+EOF
+       if test_link "C99 support in ${CC} as default" ; then
+               C99=1
+       elif test_link "C99 support in ${CC} with -std=c99" CFLAGS="$CFLAGS 
-std=c99" ; then
+               CFLAGS="${CFLAGS} -std=c99"
+               C99=1
+       fi
+}
+
 sed_rules_c() {
        insert CFLAGS "${CFLAGS}"
        [ -n "${CC}" ] && insert CC "${CC}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/man/t3highlight.1 
new/libt3highlight-0.5.0/man/t3highlight.1
--- old/libt3highlight-0.4.8/man/t3highlight.1  2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/man/t3highlight.1  2019-11-30 18:37:20.000000000 
+0100
@@ -1,6 +1,6 @@
 .\" Generated by manscript from t3highlight.1.txt
-.TH "T3HIGHLIGHT" "1" "2013/03/21" "Version 0.4.8" "Soure highlighter"
-.hw /usr/share/doc/libt3key-0.4.8 http://os.ghalkes.nl/t3/libt3key.html
+.TH "T3HIGHLIGHT" "1" "2013/03/21" "Version 0.5.0" "Soure highlighter"
+.hw /usr/share/doc/libt3key-0.5.0 http://os.ghalkes.nl/t3/libt3key.html
 .SH NAME
 t3highlight \- create syntax highlighted document from source file.
 .SH SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/c.lang 
new/libt3highlight-0.5.0/src/data/c.lang
--- old/libt3highlight-0.4.8/src/data/c.lang    2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/c.lang    2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/c.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/conf.lang 
new/libt3highlight-0.5.0/src/data/conf.lang
--- old/libt3highlight-0.4.8/src/data/conf.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/conf.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,23 +1,31 @@
-format = 1
+format = 3
 
 %include = "def/generic.lang"
 
-# The #-style comments are frequently used
-%highlight { use = "hash-comment" }
+%define {
+  style-scope = "conf"
 
-# Ini style comments
-%highlight {
-       start = "^\s*;"
-       end = "$"
-       style = "comment"
-}
+  conf {
+    # The #-style comments are frequently used
+    %highlight { use = "hash-comment" }
+
+    # Ini style comments
+    %highlight {
+       start = "^\s*;"
+       end = "$"
+       style = "comment"
+    }
+
+    # Ini style headings
+    %highlight {
+       regex = "^\s*\[[^]]+\]"
+       style = "keyword"
+    }
 
-# Ini style headings
-%highlight {
-       regex = "^\s*\[[^]]+\]"
-       style = "keyword"
+    # Generic C-style strings
+    %highlight { use = "dqs-wce" }
+    %highlight { use = "sqs-wce" }
+  }
 }
 
-# Generic C-style strings
-%highlight { use = "dqs-wce" }
-%highlight { use = "sqs-wce" }
+%highlight { use = "conf" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/css.lang 
new/libt3highlight-0.5.0/src/data/css.lang
--- old/libt3highlight-0.4.8/src/data/css.lang  2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/css.lang  2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/css.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/cxx.lang 
new/libt3highlight-0.5.0/src/data/cxx.lang
--- old/libt3highlight-0.4.8/src/data/cxx.lang  2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/cxx.lang  2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/cxx.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/c.lang 
new/libt3highlight-0.5.0/src/data/def/c.lang
--- old/libt3highlight-0.4.8/src/data/def/c.lang        2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/c.lang        2019-11-30 
18:37:20.000000000 +0100
@@ -1,6 +1,8 @@
 %include = "def/c-base.lang"
 
 %define {
+       style-scope = "c"
+
        c-keywords {
                %highlight {
                        regex = 
'\b(?:auto|break|case|char|const|continue|default|do|double|else|' +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/css.lang 
new/libt3highlight-0.5.0/src/data/def/css.lang
--- old/libt3highlight-0.4.8/src/data/def/css.lang      2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/css.lang      2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "css"
+
        css-comment {
                %highlight {
                        start = '/\*'
@@ -44,7 +46,6 @@
                        style = "string"
                }
        }
-
        css-value {
                %highlight {
                        start = ':'
@@ -65,10 +66,10 @@
                        end = ';|(?=})'
                        exit = 2
                }
+               %highlight { use = "css-comment" }
        }
 
        css {
-
                %highlight {
                        regex = 
'(?i)(?<![_a-z\d\240-\377-])(?:import|page|media|charset)(?![_a-z\d\240-\377-])'
                        style = "keyword"
@@ -92,7 +93,6 @@
 
                %highlight { use = "css-elements" }
 
-
                %highlight {
                        start = '{'
                        %highlight {
@@ -123,7 +123,10 @@
                                %highlight { use = "css-value" }
                                delim-style = "error"
                        }
+                       %highlight { use = "css-comment" }
                        end = '}'
                }
+
+               %highlight { use = "css-comment" }
        }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/cxx.lang 
new/libt3highlight-0.5.0/src/data/def/cxx.lang
--- old/libt3highlight-0.4.8/src/data/def/cxx.lang      2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/cxx.lang      2019-11-30 
18:37:20.000000000 +0100
@@ -1,6 +1,8 @@
 %include = "def/c-base.lang"
 
 %define {
+       style-scope = "c++"
+
        cxx-keywords {
                %highlight {
                        regex = 
'\b(?:and_eq|and|alignas|alignof|asm|auto|bitand|bitor|bool|' +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/html.lang 
new/libt3highlight-0.5.0/src/data/def/html.lang
--- old/libt3highlight-0.4.8/src/data/def/html.lang     2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/html.lang     2019-11-30 
18:37:20.000000000 +0100
@@ -7,6 +7,8 @@
 %include = "def/css.lang"
 
 %define {
+       style-scope = "html"
+
        html-bare-escape {
                %highlight {
                        regex = 
'&(?:A(?:Elig|acute|circ|grave|lpha|ring|tilde|uml)|Beta|C(?:' +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/java.lang 
new/libt3highlight-0.5.0/src/data/def/java.lang
--- old/libt3highlight-0.4.8/src/data/def/java.lang     2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/java.lang     2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "java"
+
        java-escape {
                %highlight {
                        regex = 
'\\(?:u[0-9a-fA-F]{4}|[0-3][0-7]{2}|[0-7]{1,2}|[btnfr"''\\])'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/javascript.lang 
new/libt3highlight-0.5.0/src/data/def/javascript.lang
--- old/libt3highlight-0.4.8/src/data/def/javascript.lang       2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/javascript.lang       2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "javascript"
+
        javascript-string-escape {
                %highlight {
                        regex = 
'\\(?:[''"\\bfnrtv]|x[\da-fA-F]{2}|u[\da-fA-F]{4})'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/make.lang 
new/libt3highlight-0.5.0/src/data/def/make.lang
--- old/libt3highlight-0.4.8/src/data/def/make.lang     2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/make.lang     2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "make"
+
        make-functions {
                %highlight {
                        regex = 
'(?<=\$[{(])(?:patsubst|subst|strip|findstring|filter(?:-out)|' +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/markdown.lang 
new/libt3highlight-0.5.0/src/data/def/markdown.lang
--- old/libt3highlight-0.4.8/src/data/def/markdown.lang 1970-01-01 
01:00:00.000000000 +0100
+++ new/libt3highlight-0.5.0/src/data/def/markdown.lang 2019-11-30 
18:37:20.000000000 +0100
@@ -0,0 +1,126 @@
+%include = "def/html.lang"
+
+# NOTE: this does not support headings by underline, as by the time we can
+# recognize that something is a heading (i.e. when the === or --- is detected),
+# there is no way to highlight the text on the previous line anymore.
+
+%define {
+       style-scope = "markdown"
+
+  markdown-block-quote {
+    %highlight {
+      start = "^>(?:\s*>)*\s*"
+      %on-entry {
+        # Match things that normally match only at the beginning of a line.
+        # However, these must only be matched immediately after the block quote
+        # markers.
+
+        # Headings
+        %highlight {
+          start = "#"
+          end = "$"
+          exit = 2
+          style = "misc"
+        }
+        # List
+        %highlight {
+          regex = "(?:[*+-]|\d+\.)\s"
+          style = "keyword"
+          exit = 2
+        }
+        # Horizontal rules
+        %highlight {
+          regex = "([-*_])(?:\s*\1){2,}\s*$"
+          style = "misc"
+        }
+        # End on anything that doesn't match the above
+        end = "(?=.)|$"
+      }
+      %highlight { use = "markdown" }
+      style = "comment"
+      end = "$"
+    }
+  }
+
+
+  markdown {
+    # Headings
+    %highlight {
+      start = "^#"
+      end = "$"
+      style = "misc"
+    }
+    %highlight { use = "markdown-block-quote" }
+    # Escaped emphasis characters
+    %highlight {
+      regex = "\\[*_]"
+    }
+    %highlight {
+      regex = "<"
+    }
+    # Emphasis
+    %highlight {
+      regex = "\*[^\s*](:?[^*]*[^\s*])?\*"
+      style = "number"
+    }
+    # Emphasis
+    %highlight {
+      regex = "_[^\s_](:?[^_]*[^\s_])?_"
+      style = "number"
+    }
+    # Double emphasis
+    %highlight {
+      regex = "\*\*[^\s*](:?[^*]*[^\s*])?\*\*"
+      style = "misc"
+    }
+    # Double emphasis
+    %highlight {
+      regex = "__[^\s_](:?[^_]*[^\s_])?__"
+      style = "variable"
+    }
+    # List
+    %highlight {
+      regex = "^\s{0,3}(?:[*+-]|\d+\.)\s"
+      style = "keyword"
+    }
+    # Code
+    %highlight {
+      start = "(?<delim>`+)"
+      extract = "delim"
+      end = "(?&delim)"
+      style = "comment-keyword"
+    }
+    # Horizontal rules
+    %highlight {
+      regex = "^\s*([-*_])(?:\s*\1){2,}\s*$"
+      style = "misc"
+    }
+    # External links
+    %highlight {
+      regex = "!?\[[^]]+\]\([^)]+\)"
+      style = "string"
+    }
+    # Internal links
+    %highlight {
+      regex = "!?\[[^]]+\] ?\[[^]]*\]"
+      style = "string"
+    }
+    # Internal link definition
+    %highlight {
+      regex = "\[[^]]+\]:"
+      style = "string"
+    }
+    # Automatic links
+    %highlight {
+      regex = "<(?:[a-z]+://[a-z.]+(?::\d+)?(?:/\S+)?|[^\s@]+@[^\s@]+)>"
+      style = "string"
+    }
+    # Unmatched _ or *
+    %highlight {
+      regex = "[_*]{1,2}"
+      style = "error"
+    }
+
+    %highlight { use = 'html' }
+  }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/mathml.lang 
new/libt3highlight-0.5.0/src/data/def/mathml.lang
--- old/libt3highlight-0.4.8/src/data/def/mathml.lang   2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/mathml.lang   2019-11-30 
18:37:20.000000000 +0100
@@ -1,6 +1,8 @@
 %include = "def/xml.lang"
 
 %define {
+       style-scope = "mathml"
+
        mathml-named-attributes {
                %highlight {
                        regex = 
'(?<![\w:-])(?:a(?:c(?:cent(?:under)?|tiontype)|l(?:ign(?:m' +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/perl.lang 
new/libt3highlight-0.5.0/src/data/def/perl.lang
--- old/libt3highlight-0.4.8/src/data/def/perl.lang     2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/perl.lang     2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "perl"
+
        perl-comment {
                %highlight {
                        start = '#'
@@ -94,6 +96,20 @@
                }
        }
 
+  perl-var {
+               %highlight {
+                       regex = 
"(?:\$#?|@|%|\*)(?:[a-zA-Z_]\w*(?:(?:(?:::)+|(?:::)*'+)[a-zA-Z_]\w*)*|" +
+                               
"(?:(?:(?:::)+|(?:::)*'+)[a-zA-Z_]\w*)+|[^\s\w^{]|\^_\w+|\^[^\s])"
+                       style = "variable"
+               }
+               %highlight {
+                       start = "(?:\$#?|@|%|\*)\{"
+      %highlight { use = "perl-var" }
+                       end = "\}"
+                       style = "variable"
+               }
+  }
+
        perl-base {
                %highlight { use = "perl-comment" }
                %highlight {
@@ -122,10 +138,7 @@
                        style = "keyword"
                }
 
-               %highlight {
-                       regex = 
"(?:\$#?|@|%|\*)(?:[a-zA-Z_]\w*(?:(?:::|')[a-zA-Z_]\w*)*|[^\s\w^]|\^_\w+|\^[^\s]|\{\^\w+\})"
-                       style = "variable"
-               }
+    %highlight { use = "perl-var" }
 
                %highlight {
                        regex = 
'(?<![^-+\W])(?:0[xX][0-9a-fA-F][0-9a-fA-F_]*|0b[01][01_]*|\d[\d_]*)\b'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/php.lang 
new/libt3highlight-0.5.0/src/data/def/php.lang
--- old/libt3highlight-0.4.8/src/data/def/php.lang      2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/php.lang      2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "php"
+
        php-string-escape {
                %highlight {
                        regex = 
'\\(?:[nrtvef\$"]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2}|u\{[0-9a-f]{1,6}\})'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/python.lang 
new/libt3highlight-0.5.0/src/data/def/python.lang
--- old/libt3highlight-0.4.8/src/data/def/python.lang   2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/python.lang   2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "python"
+
        python-unknown-string-escape {
                %highlight {
                        regex = '\\.'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/ruby.lang 
new/libt3highlight-0.5.0/src/data/def/ruby.lang
--- old/libt3highlight-0.4.8/src/data/def/ruby.lang     2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/ruby.lang     2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "ruby"
+
        ruby-unknown-string-escape {
                %highlight {
                        regex = '\\.'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/sh.lang 
new/libt3highlight-0.5.0/src/data/def/sh.lang
--- old/libt3highlight-0.4.8/src/data/def/sh.lang       2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/sh.lang       2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,6 @@
 %define {
+       style-scope = "shell"
+
        sh-string {
                %highlight {
                        start = "'"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/svg.lang 
new/libt3highlight-0.5.0/src/data/def/svg.lang
--- old/libt3highlight-0.4.8/src/data/def/svg.lang      2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/svg.lang      2019-11-30 
18:37:20.000000000 +0100
@@ -1,6 +1,8 @@
 %include = "def/xml.lang"
 
 %define {
+       style-scope = "svg"
+
        svg-named-attributes {
                %highlight {
                        regex = 
'(?<![\w:-])(?:a(?:cc(?:ent-height|umulate)|dditive|l(?:' +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/def/xml.lang 
new/libt3highlight-0.5.0/src/data/def/xml.lang
--- old/libt3highlight-0.4.8/src/data/def/xml.lang      2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/def/xml.lang      2019-11-30 
18:37:20.000000000 +0100
@@ -36,6 +36,9 @@
                        style = 'comment'
                }
        }
+}
+%define {
+       style-scope = "xml"
 
        xml {
                %highlight { use = "xml-comment" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/diff.lang 
new/libt3highlight-0.5.0/src/data/diff.lang
--- old/libt3highlight-0.4.8/src/data/diff.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/diff.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %define {
        context-diff {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/group.lang 
new/libt3highlight-0.5.0/src/data/group.lang
--- old/libt3highlight-0.4.8/src/data/group.lang        2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/group.lang        2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %define {
        non-matching {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/html.lang 
new/libt3highlight-0.5.0/src/data/html.lang
--- old/libt3highlight-0.4.8/src/data/html.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/html.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/html.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/java.lang 
new/libt3highlight-0.5.0/src/data/java.lang
--- old/libt3highlight-0.4.8/src/data/java.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/java.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/java.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/javascript.lang 
new/libt3highlight-0.5.0/src/data/javascript.lang
--- old/libt3highlight-0.4.8/src/data/javascript.lang   2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/javascript.lang   2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/javascript.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/lang.lang 
new/libt3highlight-0.5.0/src/data/lang.lang
--- old/libt3highlight-0.4.8/src/data/lang.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/lang.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,26 +1,35 @@
-format = 1
+format = 3
 
 %include = "def/generic.lang"
-%highlight { use = "hash-comment" }
 
-%highlight {
-       regex = 
'(?<![\w-])(?:%include|%highlight|%define|start|end|regex|use|style|' +
-               
'delim-style|nested|%on-entry|exit|extract|true|false|yes|no|format|name)(?![\w-])'
-       style = "keyword"
-}
-%highlight {
-       start = '"'
-       %highlight {
-               regex = '""'
-       }
-       end = '"|$'
-       style = "string"
-}
-%highlight {
-       start = "'"
-       %highlight {
-               regex = "''"
-       }
-       end = "'|$"
-       style = "string"
+%define {
+  style-scope = "lang"
+
+  lang {
+    %highlight { use = "hash-comment" }
+
+    %highlight {
+       regex = 
'(?<![\w-])(?:%include|%highlight|%define|start|end|regex|use|style|' +
+               
'delim-style|nested|%on-entry|exit|extract|true|false|yes|no|format|name)(?![\w-])'
+       style = "keyword"
+    }
+    %highlight {
+       start = '"'
+       %highlight {
+               regex = '""'
+       }
+       end = '"|$'
+       style = "string"
+    }
+    %highlight {
+       start = "'"
+       %highlight {
+               regex = "''"
+       }
+       end = "'|$"
+       style = "string"
+    }
+  }
 }
+
+%highlight { use = "lang" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/lang.map 
new/libt3highlight-0.5.0/src/data/lang.map
--- old/libt3highlight-0.4.8/src/data/lang.map  2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/lang.map  2019-11-30 18:37:20.000000000 
+0100
@@ -140,6 +140,12 @@
        file-regex = "\.php$"
        lang-file = "php.lang"
 }
+%lang {
+  name = "Markdown"
+  name-regex = "^(?i)markdown$"
+  file-regex = "\.md$"
+  lang-file = "markdown.lang"
+}
 # This definition should be last, because it matches for any file in /etc
 %lang {
        name = "Configuration file"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/llgen.lang 
new/libt3highlight-0.5.0/src/data/llgen.lang
--- old/libt3highlight-0.4.8/src/data/llgen.lang        2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/llgen.lang        2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/cxx.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/make.lang 
new/libt3highlight-0.5.0/src/data/make.lang
--- old/libt3highlight-0.4.8/src/data/make.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/make.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/make.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/markdown.lang 
new/libt3highlight-0.5.0/src/data/markdown.lang
--- old/libt3highlight-0.4.8/src/data/markdown.lang     1970-01-01 
01:00:00.000000000 +0100
+++ new/libt3highlight-0.5.0/src/data/markdown.lang     2019-11-30 
18:37:20.000000000 +0100
@@ -0,0 +1,5 @@
+format = 3
+
+%include = "def/markdown.lang"
+
+%highlight { use = "markdown" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/mathml.lang 
new/libt3highlight-0.5.0/src/data/mathml.lang
--- old/libt3highlight-0.4.8/src/data/mathml.lang       2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/mathml.lang       2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/mathml.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/passwd.lang 
new/libt3highlight-0.5.0/src/data/passwd.lang
--- old/libt3highlight-0.4.8/src/data/passwd.lang       2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/passwd.lang       2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %define {
        non-matching {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/perl.lang 
new/libt3highlight-0.5.0/src/data/perl.lang
--- old/libt3highlight-0.4.8/src/data/perl.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/perl.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/perl.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/php.lang 
new/libt3highlight-0.5.0/src/data/php.lang
--- old/libt3highlight-0.4.8/src/data/php.lang  2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/php.lang  2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 2
+format = 3
 
 %include = "def/php.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/python.lang 
new/libt3highlight-0.5.0/src/data/python.lang
--- old/libt3highlight-0.4.8/src/data/python.lang       2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/python.lang       2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/python.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/python3.lang 
new/libt3highlight-0.5.0/src/data/python3.lang
--- old/libt3highlight-0.4.8/src/data/python3.lang      2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/python3.lang      2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/python.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/ruby.lang 
new/libt3highlight-0.5.0/src/data/ruby.lang
--- old/libt3highlight-0.4.8/src/data/ruby.lang 2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/ruby.lang 2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/ruby.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/sh.lang 
new/libt3highlight-0.5.0/src/data/sh.lang
--- old/libt3highlight-0.4.8/src/data/sh.lang   2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/sh.lang   2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 2
+format = 3
 
 %include = "def/sh.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/shadow.lang 
new/libt3highlight-0.5.0/src/data/shadow.lang
--- old/libt3highlight-0.4.8/src/data/shadow.lang       2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src/data/shadow.lang       2019-11-30 
18:37:20.000000000 +0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %define {
        non-matching {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/svg.lang 
new/libt3highlight-0.5.0/src/data/svg.lang
--- old/libt3highlight-0.4.8/src/data/svg.lang  2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/svg.lang  2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/svg.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/data/xml.lang 
new/libt3highlight-0.5.0/src/data/xml.lang
--- old/libt3highlight-0.4.8/src/data/xml.lang  2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/data/xml.lang  2019-11-30 18:37:20.000000000 
+0100
@@ -1,4 +1,4 @@
-format = 1
+format = 3
 
 %include = "def/xml.lang"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/highlight.c 
new/libt3highlight-0.5.0/src/highlight.c
--- old/libt3highlight-0.4.8/src/highlight.c    2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/highlight.c    2019-11-30 18:37:20.000000000 
+0100
@@ -37,10 +37,40 @@
 #include "syntax.bytes"
 };
 
+static const char syntax_v3_schema[] = {
+#include "syntax_v3.bytes"
+};
+
 static t3_bool init_state(highlight_context_t *context, const t3_config_t 
*highlights,
                           pattern_idx_t idx);
 static void free_state(state_t *state);
 
+static int do_map_style(highlight_context_t *context, const char *style) {
+  size_t style_at_scope_len;
+  char *style_at_scope;
+  int style_at_scope_result;
+
+  if ((context->flags & T3_HIGHLIGHT_USE_SCOPE) && context->scope != NULL) {
+    size_t style_len = strlen(style);
+    size_t scope_len = strlen(context->scope);
+    style_at_scope_len = style_len + 1 + scope_len + 1;
+    style_at_scope = malloc(style_at_scope_len);
+    if (style_at_scope != NULL) {
+      memcpy(style_at_scope, style, style_len);
+      memcpy(style_at_scope + style_len, "@", 1);
+      memcpy(style_at_scope + style_len + 1, context->scope, scope_len);
+      style_at_scope[style_at_scope_len - 1] = 0;
+
+      style_at_scope_result = context->map_style(context->map_style_data, 
style_at_scope);
+      free(style_at_scope);
+      if (style_at_scope_result != 0) {
+        return style_at_scope_result;
+      }
+    }
+  }
+  return context->map_style(context->map_style_data, style);
+}
+
 t3_highlight_t *t3_highlight_new(t3_config_t *syntax, int (*map_style)(void *, 
const char *),
                                  void *map_style_data, int flags, 
t3_highlight_error_t *error) {
   t3_highlight_t *result = NULL;
@@ -49,15 +79,30 @@
   t3_config_error_t local_error;
   highlight_context_t context;
 
+  int format;
+  const char *schema_text;
+  size_t schema_size;
+
   /* Sanatize flags */
-  flags &= T3_HIGHLIGHT_UTF8_NOCHECK | T3_HIGHLIGHT_USE_PATH | 
T3_HIGHLIGHT_VERBOSE_ERROR;
+  flags &= T3_HIGHLIGHT_UTF8_NOCHECK | T3_HIGHLIGHT_USE_PATH | 
T3_HIGHLIGHT_VERBOSE_ERROR |
+           T3_HIGHLIGHT_USE_SCOPE;
+
+  format = t3_config_get_int(t3_config_get(syntax, "format"));
+  if (format < 3) {
+    schema_text = syntax_schema;
+    schema_size = sizeof(syntax_schema);
+  } else {
+    schema_text = syntax_v3_schema;
+    schema_size = sizeof(syntax_v3_schema);
+  }
 
   /* Validate the syntax using the schema. */
-  if ((schema = t3_config_read_schema_buffer(syntax_schema, 
sizeof(syntax_schema), &local_error,
-                                             NULL)) == NULL) {
+  if ((schema = t3_config_read_schema_buffer(schema_text, schema_size, 
&local_error, NULL)) ==
+      NULL) {
     if (error != NULL) {
       error->error =
           local_error.error != T3_ERR_OUT_OF_MEMORY ? T3_ERR_INTERNAL : 
local_error.error;
+      error->extra = NULL;
     }
     return NULL;
   }
@@ -111,6 +156,7 @@
   context.syntax = syntax;
   context.flags = flags;
   context.error = error;
+  context.scope = NULL;
 
   VECTOR_INIT(context.use_map);
   if (!init_state(&context, highlights, 0)) {
@@ -166,10 +212,6 @@
   return t3_true;
 }
 
-static t3_bool match_name(const t3_config_t *config, const void *data) {
-  return t3_config_get(config, (const char *)data) != NULL;
-}
-
 static t3_bool add_delim_highlight(highlight_context_t *context, t3_config_t 
*regex,
                                    pattern_idx_t next_state, pattern_t 
*pattern) {
   pattern_t new_pattern;
@@ -321,12 +363,11 @@
 
     if ((style = t3_config_get(on_entry, "style")) != NULL) {
       parent_pattern.attribute_idx = style_attr_idx =
-          context->map_style(context->map_style_data, 
t3_config_get_string(style));
+          do_map_style(context, t3_config_get_string(style));
     }
 
     if ((style = t3_config_get(on_entry, "delim-style")) != NULL) {
-      parent_pattern.attribute_idx =
-          context->map_style(context->map_style_data, 
t3_config_get_string(style));
+      parent_pattern.attribute_idx = do_map_style(context, 
t3_config_get_string(style));
     }
 
     if (!VECTOR_RESERVE(context->highlight->states)) {
@@ -364,16 +405,23 @@
 static t3_bool map_use(highlight_context_t *context, const t3_config_t *use,
                        pattern_idx_t *mapped_state) {
   size_t i;
-
-  t3_config_t *definition =
-      t3_config_get(t3_config_find(t3_config_get(context->syntax, "define"), 
match_name,
-                                   t3_config_get_string(use), NULL),
-                    t3_config_get_string(use));
+  t3_config_t *define;
+  t3_config_t *definition = NULL;
+  const char *retrieved_scope;
+  const char *saved_scope;
+  const char *use_str = t3_config_get_string(use);
+
+  for (define = t3_config_get(t3_config_get(context->syntax, "define"), NULL); 
define != NULL;
+       define = t3_config_get_next(define)) {
+    definition = t3_config_get(define, use_str);
+    if (definition != NULL) {
+      break;
+    }
+  }
 
   if (definition == NULL) {
     _t3_highlight_set_error(context->error, T3_ERR_UNDEFINED_USE, 
t3_config_get_line_number(use),
-                            t3_config_get_file_name(use), 
t3_config_get_string(use),
-                            context->flags);
+                            t3_config_get_file_name(use), use_str, 
context->flags);
     goto return_error;
   }
 
@@ -403,9 +451,15 @@
     }
     VECTOR_LAST(context->highlight->states) = null_state;
 
+    saved_scope = context->scope;
+    retrieved_scope = t3_config_get_string(t3_config_get(define, 
"style-scope"));
+    if (retrieved_scope != NULL) {
+      context->scope = retrieved_scope[0] == 0 ? NULL : retrieved_scope;
+    }
     if (!init_state(context, t3_config_get(definition, "highlight"), 
*mapped_state)) {
       return t3_false;
     }
+    context->scope = saved_scope;
   } else {
     *mapped_state = context->use_map.data[i].state;
   }
@@ -426,7 +480,7 @@
        highlights = t3_config_get_next(highlights)) {
     style_attr_idx = (style = t3_config_get(highlights, "style")) == NULL
                          ? context->highlight->states.data[idx].attribute_idx
-                         : context->map_style(context->map_style_data, 
t3_config_get_string(style));
+                         : do_map_style(context, t3_config_get_string(style));
 
     pattern.regex = NULL;
     pattern.extra = NULL;
@@ -441,10 +495,9 @@
     } else if ((regex = t3_config_get(highlights, "start")) != NULL) {
       t3_config_t *sub_highlights;
 
-      pattern.attribute_idx =
-          (style = t3_config_get(highlights, "delim-style")) == NULL
-              ? style_attr_idx
-              : context->map_style(context->map_style_data, 
t3_config_get_string(style));
+      pattern.attribute_idx = (style = t3_config_get(highlights, 
"delim-style")) == NULL
+                                  ? style_attr_idx
+                                  : do_map_style(context, 
t3_config_get_string(style));
 
       if (!_t3_compile_highlight(t3_config_get_string(regex), &pattern.regex, 
regex, context->flags,
                                  context->error)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/highlight.h 
new/libt3highlight-0.5.0/src/highlight.h
--- old/libt3highlight-0.4.8/src/highlight.h    2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/highlight.h    2019-11-30 18:37:20.000000000 
+0100
@@ -38,7 +38,7 @@
     The value 0 is an invalid value which should be replaced by the script
     that builds the release package.
 */
-#define T3_HIGHLIGHT_VERSION 0x000408
+#define T3_HIGHLIGHT_VERSION 0x000500
 
 /** @name Error codes (libt3highlight specific) */
 /*@{*/
@@ -65,9 +65,9 @@
 /** Assume the text to be highlighted is valid UTF-8.
 
     Be very careful using this flag: using this flag when the input is not
-    valid UTF-8, it may crash your program! For a definition of what is
-    considered valid UTF-8, see the PCRE documentation. At the time of writing
-    it refers to RFC 3629.
+    valid UTF-8 may crash your program! For a definition of what is considered
+    valid UTF-8, see the PCRE documentation. At the time of writing it refers
+    to RFC 3629.
 
     If the input is guaranteed to be valid UTF-8, using this flag will provide
     a performance benefit.
@@ -77,6 +77,13 @@
 #define T3_HIGHLIGHT_USE_PATH (1 << 2)
 /** Use verbose error reporting. */
 #define T3_HIGHLIGHT_VERBOSE_ERROR (1 << 3)
+/** Use scopes for mapping styles.
+
+    When scopes are in use, the @c map_style callback to ::t3_highlight_load 
will first be called
+    with @c style\@scope. If that returns 0, @c map_style will be called with 
@c style. Otherwise,
+    the result of the first call will be used as the mapped style.
+*/
+#define T3_HIGHLIGHT_USE_SCOPE (1 << 4)
 /*@}*/
 
 /** @struct t3_highlight_t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/internal.h 
new/libt3highlight-0.5.0/src/internal.h
--- old/libt3highlight-0.4.8/src/internal.h     2019-05-10 09:35:30.000000000 
+0200
+++ new/libt3highlight-0.5.0/src/internal.h     2019-11-30 18:37:20.000000000 
+0100
@@ -116,6 +116,7 @@
   int flags;
   VECTOR(use_mapping_t) use_map;
   t3_highlight_error_t *error;
+  const char *scope;
 } highlight_context_t;
 
 typedef struct {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/syntax_v3.bytes 
new/libt3highlight-0.5.0/src/syntax_v3.bytes
--- old/libt3highlight-0.4.8/src/syntax_v3.bytes        1970-01-01 
01:00:00.000000000 +0100
+++ new/libt3highlight-0.5.0/src/syntax_v3.bytes        2019-11-30 
18:37:20.000000000 +0100
@@ -0,0 +1,136 @@
+ 0x74, 0x79, 0x70, 0x65, 0x73, 0x20, 0x7b, 0x0a, 0x68, 0x69, 0x67, 0x68, 0x6c, 
0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 
0x65, 0x63, 0x74,
+ 0x69, 0x6f, 0x6e, 0x22, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x2d, 
0x6b, 0x65, 0x79,
+ 0x73, 0x20, 0x7b, 0x0a, 0x72, 0x65, 0x67, 0x65, 0x78, 0x20, 0x7b, 0x0a, 0x74, 
0x79, 0x70, 0x65,
+ 0x20, 0x3d, 0x20, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x7d, 
0x0a, 0x73, 0x74,
+ 0x61, 0x72, 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 
0x22, 0x73, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x7d, 0x0a, 0x65, 0x6e, 0x64, 0x20, 0x7b, 
0x0a, 0x74, 0x79,
+ 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 
0x0a, 0x7d, 0x0a,
+ 0x65, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 
0x65, 0x20, 0x3d,
+ 0x20, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x7d, 0x0a, 0x73, 
0x74, 0x79, 0x6c,
+ 0x65, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 
0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x22, 0x0a, 0x7d, 0x0a, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 
0x68, 0x74, 0x20,
+ 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x6c, 0x69, 0x73, 
0x74, 0x22, 0x0a,
+ 0x69, 0x74, 0x65, 0x6d, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 
0x68, 0x69, 0x67,
+ 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x22, 0x0a, 0x7d, 0x0a, 0x64, 0x65, 0x6c, 
0x69, 0x6d, 0x2d,
+ 0x73, 0x74, 0x79, 0x6c, 0x65, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 
0x3d, 0x20, 0x22,
+ 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x7d, 0x0a, 0x75, 0x73, 0x65, 
0x20, 0x7b, 0x0a,
+ 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 
0x67, 0x22, 0x0a,
+ 0x7d, 0x0a, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x7b, 0x0a, 0x74, 0x79, 
0x70, 0x65, 0x20,
+ 0x3d, 0x20, 0x22, 0x62, 0x6f, 0x6f, 0x6c, 0x22, 0x0a, 0x7d, 0x0a, 0x65, 0x78, 
0x69, 0x74, 0x20,
+ 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x69, 0x6e, 0x74, 
0x22, 0x0a, 0x25,
+ 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x20, 0x3d, 0x20, 
0x22, 0x7b, 0x65,
+ 0x78, 0x69, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6d, 0x75, 0x73, 
0x74, 0x20, 0x62,
+ 0x65, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6e, 0x20, 0x31, 0x20, 0x61, 
0x6e, 0x64, 0x20,
+ 0x31, 0x30, 0x30, 0x30, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 
0x65, 0x7d, 0x20,
+ 0x25, 0x20, 0x3e, 0x3d, 0x20, 0x31, 0x20, 0x26, 0x20, 0x25, 0x20, 0x3c, 0x3d, 
0x20, 0x31, 0x30,
+ 0x30, 0x30, 0x22, 0x0a, 0x7d, 0x0a, 0x6f, 0x6e, 0x2d, 0x65, 0x6e, 0x74, 0x72, 
0x79, 0x20, 0x7b,
+ 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x6c, 0x69, 0x73, 0x74, 
0x22, 0x0a, 0x69,
+ 0x74, 0x65, 0x6d, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x6f, 
0x6e, 0x2d, 0x65,
+ 0x6e, 0x74, 0x72, 0x79, 0x22, 0x0a, 0x7d, 0x0a, 0x7d, 0x0a, 0x25, 0x63, 0x6f, 
0x6e, 0x73, 0x74,
+ 0x72, 0x61, 0x69, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x7b, 0x68, 0x69, 0x67, 
0x68, 0x6c, 0x69,
+ 0x67, 0x68, 0x74, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x69, 0x6e, 0x63, 0x6c, 
0x75, 0x64, 0x65,
+ 0x20, 0x65, 0x78, 0x61, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20, 
0x6f, 0x66, 0x20,
+ 0x27, 0x72, 0x65, 0x67, 0x65, 0x78, 0x27, 0x2c, 0x20, 0x27, 0x73, 0x74, 0x61, 
0x72, 0x74, 0x27,
+ 0x20, 0x6f, 0x72, 0x20, 0x27, 0x75, 0x73, 0x65, 0x27, 0x7d, 0x20, 0x23, 0x28, 
0x72, 0x65, 0x67,
+ 0x65, 0x78, 0x2c, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2c, 0x20, 0x75, 0x73, 
0x65, 0x29, 0x20,
+ 0x3d, 0x20, 0x31, 0x22, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 
0x69, 0x6e, 0x74,
+ 0x20, 0x3d, 0x20, 0x22, 0x7b, 0x27, 0x65, 0x6e, 0x64, 0x27, 0x20, 0x63, 0x61, 
0x6e, 0x20, 0x6f,
+ 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x20, 0x74, 0x6f, 0x67, 
0x65, 0x74, 0x68,
+ 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x27, 0x73, 0x74, 0x61, 0x72, 
0x74, 0x27, 0x7d,
+ 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x7c, 0x20, 0x21, 0x65, 0x6e, 0x64, 
0x22, 0x0a, 0x25,
+ 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x20, 0x3d, 0x20, 
0x22, 0x7b, 0x27,
+ 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x27, 0x20, 0x63, 0x61, 
0x6e, 0x20, 0x6f,
+ 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x20, 0x74, 0x6f, 0x67, 
0x65, 0x74, 0x68,
+ 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x27, 0x73, 0x74, 0x61, 0x72, 
0x74, 0x27, 0x7d,
+ 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x7c, 0x20, 0x21, 0x68, 0x69, 0x67, 
0x68, 0x6c, 0x69,
+ 0x67, 0x68, 0x74, 0x22, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 
0x69, 0x6e, 0x74,
+ 0x20, 0x3d, 0x20, 0x22, 0x7b, 0x27, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x27, 0x20, 
0x69, 0x73, 0x20,
+ 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x77, 0x68, 
0x65, 0x6e, 0x20,
+ 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x27, 0x73, 0x74, 0x61, 0x72, 0x74, 
0x27, 0x20, 0x6f,
+ 0x72, 0x20, 0x27, 0x72, 0x65, 0x67, 0x65, 0x78, 0x27, 0x20, 0x69, 0x73, 0x20, 
0x75, 0x73, 0x65,
+ 0x64, 0x7d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x7c, 0x20, 0x72, 0x65, 
0x67, 0x65, 0x78,
+ 0x20, 0x7c, 0x20, 0x21, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x22, 0x0a, 0x25, 0x63, 
0x6f, 0x6e, 0x73,
+ 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x7b, 0x27, 0x64, 
0x65, 0x6c, 0x69,
+ 0x6d, 0x2d, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x27, 0x20, 0x63, 0x61, 0x6e, 0x20, 
0x6f, 0x6c, 0x79,
+ 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x20, 0x74, 0x6f, 0x67, 0x65, 0x74, 0x68, 
0x65, 0x72, 0x20,
+ 0x77, 0x69, 0x74, 0x68, 0x20, 0x27, 0x73, 0x74, 0x61, 0x72, 0x74, 0x27, 0x7d, 
0x20, 0x73, 0x74,
+ 0x61, 0x72, 0x74, 0x20, 0x7c, 0x20, 0x21, 0x64, 0x65, 0x6c, 0x69, 0x6d, 0x2d, 
0x73, 0x74, 0x79,
+ 0x6c, 0x65, 0x22, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 
0x6e, 0x74, 0x20,
+ 0x3d, 0x20, 0x22, 0x7b, 0x27, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x27, 0x20, 
0x63, 0x61, 0x6e,
+ 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x20, 0x74, 
0x6f, 0x67, 0x65,
+ 0x74, 0x68, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x27, 0x73, 0x74, 
0x61, 0x72, 0x74,
+ 0x27, 0x7d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x7c, 0x20, 0x21, 0x6e, 
0x65, 0x73, 0x74,
+ 0x65, 0x64, 0x22, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 
0x6e, 0x74, 0x20,
+ 0x3d, 0x20, 0x22, 0x7b, 0x27, 0x65, 0x78, 0x74, 0x72, 0x61, 0x63, 0x74, 0x27, 
0x20, 0x63, 0x61,
+ 0x6e, 0x20, 0x6f, 0x6c, 0x79, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x20, 0x74, 
0x6f, 0x67, 0x65,
+ 0x74, 0x68, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x27, 0x73, 0x74, 
0x61, 0x72, 0x74,
+ 0x27, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x27, 0x65, 0x6e, 0x64, 0x27, 0x7d, 0x20, 
0x28, 0x73, 0x74,
+ 0x61, 0x72, 0x74, 0x20, 0x26, 0x20, 0x65, 0x6e, 0x64, 0x29, 0x20, 0x7c, 0x20, 
0x21, 0x65, 0x78,
+ 0x74, 0x72, 0x61, 0x63, 0x74, 0x22, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 
0x72, 0x61, 0x69,
+ 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x7b, 0x27, 0x6f, 0x6e, 0x2d, 0x65, 0x6e, 
0x74, 0x72, 0x79,
+ 0x27, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x63, 
0x63, 0x75, 0x72,
+ 0x20, 0x74, 0x6f, 0x67, 0x65, 0x74, 0x68, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 
0x68, 0x20, 0x27,
+ 0x73, 0x74, 0x61, 0x72, 0x74, 0x27, 0x7d, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 
0x20, 0x7c, 0x20,
+ 0x21, 0x6f, 0x6e, 0x2d, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x0a, 0x25, 0x63, 
0x6f, 0x6e, 0x73,
+ 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x22, 0x7b, 0x27, 0x65, 
0x78, 0x69, 0x74,
+ 0x27, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x63, 
0x63, 0x75, 0x72,
+ 0x20, 0x74, 0x6f, 0x67, 0x74, 0x68, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 
0x20, 0x27, 0x72,
+ 0x65, 0x67, 0x65, 0x78, 0x27, 0x20, 0x6f, 0x72, 0x20, 0x27, 0x65, 0x6e, 0x64, 
0x27, 0x7d, 0x20,
+ 0x72, 0x65, 0x67, 0x65, 0x78, 0x20, 0x7c, 0x20, 0x65, 0x6e, 0x64, 0x20, 0x7c, 
0x20, 0x21, 0x65,
+ 0x78, 0x69, 0x74, 0x22, 0x0a, 0x7d, 0x0a, 0x6f, 0x6e, 0x2d, 0x65, 0x6e, 0x74, 
0x72, 0x79, 0x20,
+ 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 0x65, 0x63, 
0x74, 0x69, 0x6f,
+ 0x6e, 0x22, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x2d, 0x6b, 0x65, 
0x79, 0x73, 0x20,
+ 0x7b, 0x0a, 0x65, 0x6e, 0x64, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 
0x3d, 0x20, 0x22,
+ 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x7d, 0x0a, 0x73, 0x74, 0x79, 
0x6c, 0x65, 0x20,
+ 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 0x74, 0x72, 
0x69, 0x6e, 0x67,
+ 0x22, 0x0a, 0x7d, 0x0a, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 
0x20, 0x7b, 0x0a,
+ 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x6c, 0x69, 0x73, 0x74, 0x22, 
0x0a, 0x69, 0x74,
+ 0x65, 0x6d, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x68, 0x69, 
0x67, 0x68, 0x6c,
+ 0x69, 0x67, 0x68, 0x74, 0x22, 0x0a, 0x7d, 0x0a, 0x64, 0x65, 0x6c, 0x69, 0x6d, 
0x2d, 0x73, 0x74,
+ 0x79, 0x6c, 0x65, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 
0x22, 0x73, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x7d, 0x0a, 0x75, 0x73, 0x65, 0x20, 0x7b, 
0x0a, 0x74, 0x79,
+ 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 
0x0a, 0x7d, 0x0a,
+ 0x65, 0x78, 0x69, 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 
0x20, 0x22, 0x69,
+ 0x6e, 0x74, 0x22, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 
0x6e, 0x74, 0x20,
+ 0x3d, 0x20, 0x22, 0x7b, 0x65, 0x78, 0x69, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x75, 
0x65, 0x20, 0x6d,
+ 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 
0x6e, 0x20, 0x31,
+ 0x20, 0x61, 0x6e, 0x64, 0x20, 0x31, 0x30, 0x30, 0x30, 0x20, 0x69, 0x6e, 0x63, 
0x6c, 0x75, 0x73,
+ 0x69, 0x76, 0x65, 0x7d, 0x20, 0x25, 0x20, 0x3e, 0x3d, 0x20, 0x31, 0x20, 0x26, 
0x20, 0x25, 0x20,
+ 0x3c, 0x3d, 0x20, 0x31, 0x30, 0x30, 0x30, 0x22, 0x0a, 0x7d, 0x0a, 0x7d, 0x0a, 
0x7d, 0x0a, 0x64,
+ 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x7b, 0x0a, 0x74, 
0x79, 0x70, 0x65,
+ 0x20, 0x3d, 0x20, 0x22, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x0a, 
0x61, 0x6c, 0x6c,
+ 0x6f, 0x77, 0x65, 0x64, 0x2d, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x7b, 0x0a, 0x68, 
0x69, 0x67, 0x68,
+ 0x6c, 0x69, 0x67, 0x68, 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 
0x3d, 0x20, 0x22,
+ 0x6c, 0x69, 0x73, 0x74, 0x22, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x2d, 0x74, 0x79, 
0x70, 0x65, 0x20,
+ 0x3d, 0x20, 0x22, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x22, 
0x0a, 0x7d, 0x0a,
+ 0x7d, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 
0x20, 0x3d, 0x20,
+ 0x22, 0x7b, 0x61, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 
0x6e, 0x20, 0x6d,
+ 0x75, 0x73, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x61, 0x20, 0x27, 0x68, 
0x69, 0x67, 0x68,
+ 0x6c, 0x69, 0x67, 0x68, 0x74, 0x27, 0x7d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x6c, 
0x69, 0x67, 0x68,
+ 0x74, 0x22, 0x0a, 0x7d, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x7b, 
0x0a, 0x74, 0x79,
+ 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 
0x22, 0x0a, 0x61,
+ 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x2d, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x7b, 
0x0a, 0x73, 0x74,
+ 0x79, 0x6c, 0x65, 0x2d, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x20, 0x7b, 0x0a, 0x74, 
0x79, 0x70, 0x65,
+ 0x20, 0x3d, 0x20, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x0a, 0x7d, 
0x0a, 0x7d, 0x0a,
+ 0x69, 0x74, 0x65, 0x6d, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 
0x64, 0x65, 0x66,
+ 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x0a, 0x7d, 0x0a, 0x7d, 0x0a, 
0x61, 0x6c, 0x6c,
+ 0x6f, 0x77, 0x65, 0x64, 0x2d, 0x6b, 0x65, 0x79, 0x73, 0x20, 0x7b, 0x0a, 0x66, 
0x6f, 0x72, 0x6d,
+ 0x61, 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x22, 
0x69, 0x6e, 0x74,
+ 0x22, 0x0a, 0x25, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 
0x20, 0x3d, 0x20,
+ 0x22, 0x7b, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 
0x69, 0x6f, 0x6e,
+ 0x20, 0x75, 0x6e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x7d, 
0x20, 0x25, 0x20,
+ 0x3d, 0x20, 0x33, 0x22, 0x0a, 0x7d, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x2d, 
0x65, 0x6d, 0x70,
+ 0x74, 0x79, 0x2d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 
0x70, 0x65, 0x20,
+ 0x3d, 0x20, 0x22, 0x62, 0x6f, 0x6f, 0x6c, 0x22, 0x0a, 0x7d, 0x0a, 0x68, 0x69, 
0x67, 0x68, 0x6c,
+ 0x69, 0x67, 0x68, 0x74, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 
0x20, 0x22, 0x6c,
+ 0x69, 0x73, 0x74, 0x22, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x2d, 0x74, 0x79, 0x70, 
0x65, 0x20, 0x3d,
+ 0x20, 0x22, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x22, 0x0a, 
0x7d, 0x0a, 0x64,
+ 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x7b, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x20, 
0x3d, 0x20, 0x22,
+ 0x6c, 0x69, 0x73, 0x74, 0x22, 0x0a, 0x69, 0x74, 0x65, 0x6d, 0x2d, 0x74, 0x79, 
0x70, 0x65, 0x20,
+ 0x3d, 0x20, 0x22, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x22, 0x0a, 0x7d, 0x0a, 
0x7d, 0x0a, 0x25,
+ 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x20, 0x3d, 0x20, 
0x22, 0x7b, 0x27,
+ 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x27, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x27, 
0x68, 0x69, 0x67,
+ 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x27, 0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 
0x65, 0x71, 0x75,
+ 0x69, 0x72, 0x65, 0x64, 0x7d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 
0x68, 0x74, 0x20,
+ 0x26, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x0a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src/syntax_v3.schema 
new/libt3highlight-0.5.0/src/syntax_v3.schema
--- old/libt3highlight-0.4.8/src/syntax_v3.schema       1970-01-01 
01:00:00.000000000 +0100
+++ new/libt3highlight-0.5.0/src/syntax_v3.schema       2019-11-30 
18:37:20.000000000 +0100
@@ -0,0 +1,132 @@
+# Copyright (C) 2011-2012,2019 G.P. Halkes
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3, as
+# published by the Free Software Foundation.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Schema for syntax-highlighting definition files for libt3highlight
+
+types {
+       highlight {
+               type = "section"
+               allowed-keys {
+                       regex {
+                               type = "string"
+                       }
+                       start {
+                               type = "string"
+                       }
+                       end {
+                               type = "string"
+                       }
+                       extract {
+                               type = "string"
+                       }
+                       style {
+                               type = "string"
+                       }
+                       highlight {
+                               type = "list"
+                               item-type = "highlight"
+                       }
+                       delim-style {
+                               type = "string"
+                       }
+                       use {
+                               type = "string"
+                       }
+                       nested {
+                               type = "bool"
+                       }
+                       exit {
+                               type = "int"
+                               %constraint = "{exit value must be between 1 
and 1000 inclusive} % >= 1 & % <= 1000"
+                       }
+                       on-entry {
+                               type = "list"
+                               item-type = "on-entry"
+                       }
+               }
+               %constraint = "{highlight must include exactly one of 'regex', 
'start' or 'use'} #(regex, start, use) = 1"
+               %constraint = "{'end' can only occur together with 'start'} 
start | !end"
+               %constraint = "{'highlight' can only occur together with 
'start'} start | !highlight"
+               %constraint = "{'style' is only valid when either 'start' or 
'regex' is used} start | regex | !style"
+               %constraint = "{'delim-style' can oly occur together with 
'start'} start | !delim-style"
+               %constraint = "{'nested' can only occur together with 'start'} 
start | !nested"
+               %constraint = "{'extract' can oly occur together with 'start' 
and 'end'} (start & end) | !extract"
+               %constraint = "{'on-entry' can only occur together with 
'start'} start | !on-entry"
+               %constraint = "{'exit' can only occur togther with 'regex' or 
'end'} regex | end | !exit"
+       }
+
+       on-entry {
+               type = "section"
+               allowed-keys {
+                       end {
+                               type = "string"
+                       }
+                       style {
+                               type = "string"
+                       }
+                       highlight {
+                               type = "list"
+                               item-type = "highlight"
+                       }
+                       delim-style {
+                               type = "string"
+                       }
+                       use {
+                               type = "string"
+                       }
+                       exit {
+                               type = "int"
+                               %constraint = "{exit value must be between 1 
and 1000 inclusive} % >= 1 & % <= 1000"
+                       }
+               }
+       }
+
+       definition {
+               type = "section"
+               allowed-keys {
+                       highlight {
+                               type = "list"
+                               item-type = "highlight"
+                       }
+               }
+               %constraint = "{a definition must have a 'highlight'} highlight"
+       }
+       define {
+               type = "section"
+               allowed-keys {
+                       style-scope {
+                               type = "string"
+                       }
+               }
+               item-type = "definition"
+       }
+}
+
+allowed-keys {
+       format {
+               type = "int"
+               %constraint = "{format version unsupported} % = 3"
+       }
+       allow-empty-start {
+               type = "bool"
+       }
+       highlight {
+               type = "list"
+               item-type = "highlight"
+       }
+       define {
+               type = "list"
+               item-type = "define"
+       }
+}
+%constraint = "{'format' and 'highlight' are required} highlight & format"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libt3highlight-0.4.8/src.util/t3highlight.c 
new/libt3highlight-0.5.0/src.util/t3highlight.c
--- old/libt3highlight-0.4.8/src.util/t3highlight.c     2019-05-10 
09:35:30.000000000 +0200
+++ new/libt3highlight-0.5.0/src.util/t3highlight.c     2019-11-30 
18:37:20.000000000 +0100
@@ -113,13 +113,13 @@
     OPTION('l', "language", REQUIRED_ARG)
       if (option_language != NULL || option_language_file != NULL) {
         fatal(_("Only one language option allowed\n"));
-}
+      }
       option_language = optArg;
     END_OPTION
     LONG_OPTION("language-file", REQUIRED_ARG)
       if (option_language != NULL || option_language_file != NULL) {
         fatal(_("Only one language option allowed\n"));
-}
+      }
       option_language_file = optArg;
     END_OPTION
     OPTION('L', "list", NO_ARG)
@@ -133,13 +133,13 @@
                 t3_highlight_strerror(error.error));
         } else {
           fatal(_("Error loading highlight listing: %s\n"), 
t3_highlight_strerror(error.error));
-}
+        }
       }
 
       printf(_("Available languages:\n"));
       for (i = 0; list[i].name != NULL; i++) {
         printf("  %s\n", list[i].name);
-}
+      }
 
       t3_highlight_free_list(list);
 
@@ -151,19 +151,19 @@
     OPTION('s', "style", REQUIRED_ARG)
       if (option_style != NULL) {
         fatal("Error: only one style option allowed\n");
-}
+      }
       if ((option_style = malloc(strlen(optArg) + 7)) == NULL) {
         fatal("Out of memory");
-}
+      }
       strcpy(option_style, optArg);
       if (strchr(option_style, '/') == NULL) {
         strcat(option_style, ".style");
-}
+      }
     END_OPTION
     OPTION('h', "help", NO_ARG)
       printf("Usage: t3highlight [<options>] [<file>]\n"
         "  -d<type>,--document-type=<type> Output using document type <type>\n"
-          "  -D,--list-document-types        List the document types for the 
current style\n"
+        "  -D,--list-document-types        List the document types for the 
current style\n"
         "  -l<lang>,--language=<lang>      Highlight using language <lang>\n"
         "  --language-file=<file>          Load highlighting description file 
<file>\n"
         "  -L,--list                       List available languages and 
styles\n"
@@ -183,12 +183,12 @@
       char *value;
       if ((value = strchr(optArg, '=')) == NULL) {
         fatal("-t/--tag argument must be <name>=<value>\n");
-}
+      }
       *value = 0;
       value++;
       if (!set_tag(optArg, value)) {
         fatal(_("Duplicate tag specified\n"));
-}
+      }
     END_OPTION
     DOUBLE_DASH
       NO_MORE_OPTIONS;
@@ -198,7 +198,7 @@
   NO_OPTION
     if (option_input != NULL) {
       fatal(_("Error: only one input file allowed\n"));
-}
+    }
     option_input = optcurrent;
   END_OPTIONS
 


Reply via email to