source-highlight
| Revision | 6e877162642954dae192b2e9544622ba2f4f0651 (tree) |
|---|---|
| Time | 2011-04-06 20:15:37 |
| Author | akngw <akngw@user...> |
| Commiter | akngw |
バージョン 3.1.4
| @@ -1,4 +1,4 @@ | ||
| 1 | -# Makefile.in generated by automake 1.11 from Makefile.am. | |
| 1 | +# Makefile.in generated by automake 1.11.1 from Makefile.am. | |
| 2 | 2 | # @configure_input@ |
| 3 | 3 | |
| 4 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | @r{@i{# comments with documentation tags}} |
| 6 | 6 | @b{environment} @t{@i{comment}} @b{start} @t{"///"} @b{begin} |
| 7 | 7 | @b{include} @t{"url.lang"} |
| 8 | - @b{include} @t{"html.lang"} | |
| 8 | + @b{include} @t{"html_simple.lang"} | |
| 9 | 9 | @t{@i{type}} = @t{'@@[[:alpha:]]+'} |
| 10 | 10 | @b{include} @t{"todo.lang"} |
| 11 | 11 | @b{end} |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | @r{@i{# comments with documentation tags}} |
| 16 | 16 | @b{environment} @t{@i{comment}} @b{delim} @t{"/**"} @t{"*/"} @b{multiline} @b{begin} |
| 17 | 17 | @b{include} @t{"url.lang"} |
| 18 | - @b{include} @t{"html.lang"} | |
| 18 | + @b{include} @t{"html_simple.lang"} | |
| 19 | 19 | @t{@i{type}} = @t{'@@[[:alpha:]]+'} |
| 20 | 20 | @b{include} @t{"todo.lang"} |
| 21 | 21 | @b{end} |
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | @t{@i{function}} @b{black} @b{b}; @r{@i{// for function calls and declarations}} |
| 17 | 17 | @t{@i{cbracket}} @b{red}; @r{@i{// for block brackets (e.g. @{, @})}} |
| 18 | 18 | @t{@i{todo}} @b{bg:cyan} @b{b}; @r{@i{// for TODO and FIXME}} |
| 19 | +@t{@i{code}} @b{bg:brightgreen} @b{b}; @r{@i{// for code snippets}} | |
| 19 | 20 | |
| 20 | 21 | @r{@i{//Predefined variables and functions (for instance glsl)}} |
| 21 | 22 | @t{@i{predef_var}} @b{darkblue} ; |
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | <meta name="Author" content="Lorenzo Bettini"><title>GNU Source-highlight - GNU Project - Free Software Foundation (FSF)</title></head> |
| 5 | 5 | <body style="background-color: rgb(255, 255, 255);"> |
| 6 | 6 | <h1><a class="mozTocH1" name="mozTocId593827"></a> |
| 7 | -GNU Source-highlight 3.1.3</h1> | |
| 7 | +GNU Source-highlight 3.1.4</h1> | |
| 8 | 8 | <p>by <a href="http://www.lorenzobettini.it">Lorenzo |
| 9 | 9 | Bettini</a> </p> |
| 10 | 10 | <p>This program, <i>given a source file, produces a |
| @@ -51,29 +51,31 @@ supported | ||
| 51 | 51 | </p> |
| 52 | 52 | <ul> |
| 53 | 53 | <li> <i>Ada</i></li> |
| 54 | -<li> <i>Asm</i> <font color="red">(new)</font></li> | |
| 55 | -<li> <i>Applescript</i> <font color="red">(new)</font></li> | |
| 56 | -<li> <i>Awk</i> <font color="red">(new)</font></li> | |
| 54 | +<li> <i>Asm</i></li> | |
| 55 | +<li> <i>Applescript</i></li> | |
| 56 | +<li> <i>Awk</i></li> | |
| 57 | 57 | <li> <i>Autoconf files</i></li> |
| 58 | -<li> <i>Bat</i> <font color="red">(new)</font></li> | |
| 58 | +<li> <i>Bat</i></li> | |
| 59 | 59 | <li> <i>Bib</i></li> |
| 60 | 60 | <li> <i>Bison</i></li> |
| 61 | 61 | <li> <i>C/C++</i></li> |
| 62 | 62 | <li> <i>C#</i></li> |
| 63 | -<li> <i>Clipper</i> <font color="red">(new)</font></li> | |
| 64 | -<li> <i>Cobol</i> <font color="red">(new)</font></li> | |
| 63 | +<li> <i>CakePhp templates</i> <font color="red">(new)</font></li> | |
| 64 | +<li> <i>Clipper</i></li> | |
| 65 | +<li> <i>Cobol</i></li> | |
| 65 | 66 | <li> <i>Configuration files (generic)</i></li> |
| 66 | 67 | <li> <i>Caml</i></li> |
| 67 | 68 | <li> <i>Changelog</i></li> |
| 68 | 69 | <li> <i>Css</i></li> |
| 69 | -<li> <i>D</i> <font color="red">(new)</font></li> | |
| 70 | +<li> <i>D</i></li> | |
| 70 | 71 | <li> <i>Diff</i></li> |
| 71 | -<li> <i>Erlang</i> <font color="red">(new)</font></li> | |
| 72 | -<li> <i>errors (compiler output)</i> <font color="red">(new)</font></li> | |
| 72 | +<li> <i>Erlang</i></li> | |
| 73 | +<li> <i>errors (compiler output)</i></li> | |
| 73 | 74 | <li> <i>Flex</i></li> |
| 74 | 75 | <li> <i>Fortran</i></li> |
| 75 | 76 | <li> <i>GLSL</i></li> |
| 76 | 77 | <li> <i>Haskell</i></li> |
| 78 | +<li> <i>Haskell literate programming</i> <font color="red">(new)</font></li> | |
| 77 | 79 | <li> <i>Haxe</i></li> |
| 78 | 80 | <li> <i>Html</i></li> |
| 79 | 81 | <li> <i>ini files</i></li> |
| @@ -82,12 +84,13 @@ supported | ||
| 82 | 84 | <li> <i>KDE desktop files</i></li> |
| 83 | 85 | <li> <i>Latex</i></li> |
| 84 | 86 | <li> <i>Ldap files</i></li> |
| 87 | +<li> <i>Lisp</i> <font color="red">(new)</font></li> | |
| 85 | 88 | <li> <i>Logtalk</i></li> |
| 86 | 89 | <li> <i>Log files</i></li> |
| 87 | 90 | <li> <i>lsm files (Linux Software Map)</i></li> |
| 88 | 91 | <li> <i>Lua</i></li> |
| 89 | 92 | <li> <i>Makefile</i></li> |
| 90 | -<li> <i>Manifest</i> <font color="red">(new)</font></li> | |
| 93 | +<li> <i>Manifest</i></li> | |
| 91 | 94 | <li> <i>M4</i></li> |
| 92 | 95 | <li> <i>ML</i></li> |
| 93 | 96 | <li> <i>Oz</i></li> |
| @@ -98,6 +101,7 @@ supported | ||
| 98 | 101 | <li> <i>Postscript</i></li> |
| 99 | 102 | <li> <i>Prolog</i></li> |
| 100 | 103 | <li> <i>Properties files</i></li> |
| 104 | +<li> <i>Protobuf (Google's Protocol Buffers)</i> <font color="red">(new)</font></li> | |
| 101 | 105 | <li> <i>Python</i></li> |
| 102 | 106 | <li> <i>RPM Spec files</i></li> |
| 103 | 107 | <li> <i>Ruby</i></li> |
| @@ -107,7 +111,8 @@ supported | ||
| 107 | 111 | <li> <i>Sql</i></li> |
| 108 | 112 | <li> <i>Tcl</i></li> |
| 109 | 113 | <li> <i>Texinfo</i></li> |
| 110 | -<li> <i>VBscript</i> <font color="red">(new)</font></li> | |
| 114 | +<li> <i>Vala</i> <font color="red">(new)</font></li> | |
| 115 | +<li> <i>VBscript</i></li> | |
| 111 | 116 | <li> <i>XML</i></li> |
| 112 | 117 | <li> <i>XOrg conf files</i></li> |
| 113 | 118 | </ul> |
| @@ -370,6 +375,27 @@ using the source-highlight CGI. | ||
| 370 | 375 | <p><a href="http://code.google.com/p/php-source-highlight/">http://code.google.com/p/php-source-highlight/</a> |
| 371 | 376 | </p> |
| 372 | 377 | </li> |
| 378 | +<li> | |
| 379 | +Roberto Alsina made a partial python binding using SIP so | |
| 380 | +that you can use Source-Highlight-Qt in PyQt programs. | |
| 381 | + | |
| 382 | + <p><a href="http://marave.googlecode.com/svn/trunk/marave/highlight/">http://marave.googlecode.com/svn/trunk/marave/highlight/</a> | |
| 383 | +</p> | |
| 384 | +</li> | |
| 385 | + | |
| 386 | +<li>A perl binding for source-highlight is available at CPAN: | |
| 387 | + | |
| 388 | + <p><a href="http://search.cpan.org/perldoc?Syntax::SourceHighlight">http://search.cpan.org/perldoc?Syntax::SourceHighlight</a> | |
| 389 | +</p> | |
| 390 | +</li> | |
| 391 | + | |
| 392 | + <li><a name="index-Pastebin-36"></a>Danijel Tasov wrote a pastebin service based on | |
| 393 | +perl source-highlight binding: | |
| 394 | + | |
| 395 | + <p><a href="http://pb.rbfh.de">http://pb.rbfh.de</a> | |
| 396 | +</p> | |
| 397 | +</li> | |
| 398 | + | |
| 373 | 399 | </ul> |
| 374 | 400 | <h2><a class="mozTocH2" name="mozTocId477197"></a>Credits</h2> |
| 375 | 401 | See CREDITS for detailed contributions and THANKS for a |
| @@ -27,6 +27,7 @@ cs = csharp.lang | ||
| 27 | 27 | csh = sh.lang |
| 28 | 28 | csharp = csharp.lang |
| 29 | 29 | css = css.lang |
| 30 | +ctp = php.lang | |
| 30 | 31 | d = d.lang |
| 31 | 32 | desktop = desktop.lang |
| 32 | 33 | diff = diff.lang |
| @@ -68,6 +69,8 @@ ldap = ldap.lang | ||
| 68 | 69 | ldif = ldap.lang |
| 69 | 70 | lex = flex.lang |
| 70 | 71 | lgt = logtalk.lang |
| 72 | +lhs = haskell_literate.lang | |
| 73 | +lisp = lisp.lang | |
| 71 | 74 | ll = flex.lang |
| 72 | 75 | log = log.lang |
| 73 | 76 | logtalk = logtalk.lang |
| @@ -98,6 +101,8 @@ postscript = postscript.lang | ||
| 98 | 101 | prg = clipper.lang |
| 99 | 102 | prolog = prolog.lang |
| 100 | 103 | properties = properties.lang |
| 104 | +proto = proto.lang | |
| 105 | +protobuf = proto.lang | |
| 101 | 106 | ps = postscript.lang |
| 102 | 107 | py = python.lang |
| 103 | 108 | python = python.lang |
| @@ -127,6 +132,7 @@ texinfo = texinfo.lang | ||
| 127 | 132 | tk = tcl.lang |
| 128 | 133 | txt = nohilite.lang |
| 129 | 134 | ui = xml.lang |
| 135 | +vala = vala.lang | |
| 130 | 136 | vbs = vbscript.lang |
| 131 | 137 | vbscript = vbscript.lang |
| 132 | 138 | xhtml = xml.lang |
| @@ -1,4 +1,4 @@ | ||
| 1 | -# Makefile.in generated by automake 1.11 from Makefile.am. | |
| 1 | +# Makefile.in generated by automake 1.11.1 from Makefile.am. | |
| 2 | 2 | # @configure_input@ |
| 3 | 3 | |
| 4 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | @r{@i{# comments with documentation tags}} |
| 6 | 6 | @b{environment} @t{@i{comment}} @b{start} @t{"///"} @b{begin} |
| 7 | 7 | @b{include} @t{"url.lang"} |
| 8 | - @b{include} @t{"html.lang"} | |
| 8 | + @b{include} @t{"html_simple.lang"} | |
| 9 | 9 | @t{@i{type}} = @t{'@@[[:alpha:]]+'} |
| 10 | 10 | @b{include} @t{"todo.lang"} |
| 11 | 11 | @b{end} |
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | @r{@i{# comments with documentation tags}} |
| 16 | 16 | @b{environment} @t{@i{comment}} @b{delim} @t{"/**"} @t{"*/"} @b{multiline} @b{begin} |
| 17 | 17 | @b{include} @t{"url.lang"} |
| 18 | - @b{include} @t{"html.lang"} | |
| 18 | + @b{include} @t{"html_simple.lang"} | |
| 19 | 19 | @t{@i{type}} = @t{'@@[[:alpha:]]+'} |
| 20 | 20 | @b{include} @t{"todo.lang"} |
| 21 | 21 | @b{end} |
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | @t{@i{function}} @b{black} @b{b}; @r{@i{// for function calls and declarations}} |
| 17 | 17 | @t{@i{cbracket}} @b{red}; @r{@i{// for block brackets (e.g. @{, @})}} |
| 18 | 18 | @t{@i{todo}} @b{bg:cyan} @b{b}; @r{@i{// for TODO and FIXME}} |
| 19 | +@t{@i{code}} @b{bg:brightgreen} @b{b}; @r{@i{// for code snippets}} | |
| 19 | 20 | |
| 20 | 21 | @r{@i{//Predefined variables and functions (for instance glsl)}} |
| 21 | 22 | @t{@i{predef_var}} @b{darkblue} ; |
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | <meta name="Author" content="Lorenzo Bettini"><title>GNU Source-highlight - GNU Project - Free Software Foundation (FSF)</title></head> |
| 5 | 5 | <body style="background-color: rgb(255, 255, 255);"> |
| 6 | 6 | <h1><a class="mozTocH1" name="mozTocId593827"></a> |
| 7 | -GNU Source-highlight 3.1.3</h1> | |
| 7 | +GNU Source-highlight 3.1.4</h1> | |
| 8 | 8 | <p>by <a href="http://www.lorenzobettini.it">Lorenzo |
| 9 | 9 | Bettini</a> </p> |
| 10 | 10 | <p>This program, <i>given a source file, produces a |
| @@ -51,29 +51,31 @@ supported | ||
| 51 | 51 | </p> |
| 52 | 52 | <ul> |
| 53 | 53 | <li> <i>Ada</i></li> |
| 54 | -<li> <i>Asm</i> <font color="red">(new)</font></li> | |
| 55 | -<li> <i>Applescript</i> <font color="red">(new)</font></li> | |
| 56 | -<li> <i>Awk</i> <font color="red">(new)</font></li> | |
| 54 | +<li> <i>Asm</i></li> | |
| 55 | +<li> <i>Applescript</i></li> | |
| 56 | +<li> <i>Awk</i></li> | |
| 57 | 57 | <li> <i>Autoconf files</i></li> |
| 58 | -<li> <i>Bat</i> <font color="red">(new)</font></li> | |
| 58 | +<li> <i>Bat</i></li> | |
| 59 | 59 | <li> <i>Bib</i></li> |
| 60 | 60 | <li> <i>Bison</i></li> |
| 61 | 61 | <li> <i>C/C++</i></li> |
| 62 | 62 | <li> <i>C#</i></li> |
| 63 | -<li> <i>Clipper</i> <font color="red">(new)</font></li> | |
| 64 | -<li> <i>Cobol</i> <font color="red">(new)</font></li> | |
| 63 | +<li> <i>CakePhp templates</i> <font color="red">(new)</font></li> | |
| 64 | +<li> <i>Clipper</i></li> | |
| 65 | +<li> <i>Cobol</i></li> | |
| 65 | 66 | <li> <i>Configuration files (generic)</i></li> |
| 66 | 67 | <li> <i>Caml</i></li> |
| 67 | 68 | <li> <i>Changelog</i></li> |
| 68 | 69 | <li> <i>Css</i></li> |
| 69 | -<li> <i>D</i> <font color="red">(new)</font></li> | |
| 70 | +<li> <i>D</i></li> | |
| 70 | 71 | <li> <i>Diff</i></li> |
| 71 | -<li> <i>Erlang</i> <font color="red">(new)</font></li> | |
| 72 | -<li> <i>errors (compiler output)</i> <font color="red">(new)</font></li> | |
| 72 | +<li> <i>Erlang</i></li> | |
| 73 | +<li> <i>errors (compiler output)</i></li> | |
| 73 | 74 | <li> <i>Flex</i></li> |
| 74 | 75 | <li> <i>Fortran</i></li> |
| 75 | 76 | <li> <i>GLSL</i></li> |
| 76 | 77 | <li> <i>Haskell</i></li> |
| 78 | +<li> <i>Haskell literate programming</i> <font color="red">(new)</font></li> | |
| 77 | 79 | <li> <i>Haxe</i></li> |
| 78 | 80 | <li> <i>Html</i></li> |
| 79 | 81 | <li> <i>ini files</i></li> |
| @@ -82,12 +84,13 @@ supported | ||
| 82 | 84 | <li> <i>KDE desktop files</i></li> |
| 83 | 85 | <li> <i>Latex</i></li> |
| 84 | 86 | <li> <i>Ldap files</i></li> |
| 87 | +<li> <i>Lisp</i> <font color="red">(new)</font></li> | |
| 85 | 88 | <li> <i>Logtalk</i></li> |
| 86 | 89 | <li> <i>Log files</i></li> |
| 87 | 90 | <li> <i>lsm files (Linux Software Map)</i></li> |
| 88 | 91 | <li> <i>Lua</i></li> |
| 89 | 92 | <li> <i>Makefile</i></li> |
| 90 | -<li> <i>Manifest</i> <font color="red">(new)</font></li> | |
| 93 | +<li> <i>Manifest</i></li> | |
| 91 | 94 | <li> <i>M4</i></li> |
| 92 | 95 | <li> <i>ML</i></li> |
| 93 | 96 | <li> <i>Oz</i></li> |
| @@ -98,6 +101,7 @@ supported | ||
| 98 | 101 | <li> <i>Postscript</i></li> |
| 99 | 102 | <li> <i>Prolog</i></li> |
| 100 | 103 | <li> <i>Properties files</i></li> |
| 104 | +<li> <i>Protobuf (Google's Protocol Buffers)</i> <font color="red">(new)</font></li> | |
| 101 | 105 | <li> <i>Python</i></li> |
| 102 | 106 | <li> <i>RPM Spec files</i></li> |
| 103 | 107 | <li> <i>Ruby</i></li> |
| @@ -107,7 +111,8 @@ supported | ||
| 107 | 111 | <li> <i>Sql</i></li> |
| 108 | 112 | <li> <i>Tcl</i></li> |
| 109 | 113 | <li> <i>Texinfo</i></li> |
| 110 | -<li> <i>VBscript</i> <font color="red">(new)</font></li> | |
| 114 | +<li> <i>Vala</i> <font color="red">(new)</font></li> | |
| 115 | +<li> <i>VBscript</i></li> | |
| 111 | 116 | <li> <i>XML</i></li> |
| 112 | 117 | <li> <i>XOrg conf files</i></li> |
| 113 | 118 | </ul> |
| @@ -370,6 +375,27 @@ using the source-highlight CGI. | ||
| 370 | 375 | <p><a href="http://code.google.com/p/php-source-highlight/">http://code.google.com/p/php-source-highlight/</a> |
| 371 | 376 | </p> |
| 372 | 377 | </li> |
| 378 | +<li> | |
| 379 | +Roberto Alsina made a partial python binding using SIP so | |
| 380 | +that you can use Source-Highlight-Qt in PyQt programs. | |
| 381 | + | |
| 382 | + <p><a href="http://marave.googlecode.com/svn/trunk/marave/highlight/">http://marave.googlecode.com/svn/trunk/marave/highlight/</a> | |
| 383 | +</p> | |
| 384 | +</li> | |
| 385 | + | |
| 386 | +<li>A perl binding for source-highlight is available at CPAN: | |
| 387 | + | |
| 388 | + <p><a href="http://search.cpan.org/perldoc?Syntax::SourceHighlight">http://search.cpan.org/perldoc?Syntax::SourceHighlight</a> | |
| 389 | +</p> | |
| 390 | +</li> | |
| 391 | + | |
| 392 | + <li><a name="index-Pastebin-36"></a>Danijel Tasov wrote a pastebin service based on | |
| 393 | +perl source-highlight binding: | |
| 394 | + | |
| 395 | + <p><a href="http://pb.rbfh.de">http://pb.rbfh.de</a> | |
| 396 | +</p> | |
| 397 | +</li> | |
| 398 | + | |
| 373 | 399 | </ul> |
| 374 | 400 | <h2><a class="mozTocH2" name="mozTocId477197"></a>Credits</h2> |
| 375 | 401 | See CREDITS for detailed contributions and THANKS for a |
| @@ -27,6 +27,7 @@ cs = csharp.lang | ||
| 27 | 27 | csh = sh.lang |
| 28 | 28 | csharp = csharp.lang |
| 29 | 29 | css = css.lang |
| 30 | +ctp = php.lang | |
| 30 | 31 | d = d.lang |
| 31 | 32 | desktop = desktop.lang |
| 32 | 33 | diff = diff.lang |
| @@ -68,6 +69,8 @@ ldap = ldap.lang | ||
| 68 | 69 | ldif = ldap.lang |
| 69 | 70 | lex = flex.lang |
| 70 | 71 | lgt = logtalk.lang |
| 72 | +lhs = haskell_literate.lang | |
| 73 | +lisp = lisp.lang | |
| 71 | 74 | ll = flex.lang |
| 72 | 75 | log = log.lang |
| 73 | 76 | logtalk = logtalk.lang |
| @@ -98,6 +101,8 @@ postscript = postscript.lang | ||
| 98 | 101 | prg = clipper.lang |
| 99 | 102 | prolog = prolog.lang |
| 100 | 103 | properties = properties.lang |
| 104 | +proto = proto.lang | |
| 105 | +protobuf = proto.lang | |
| 101 | 106 | ps = postscript.lang |
| 102 | 107 | py = python.lang |
| 103 | 108 | python = python.lang |
| @@ -127,6 +132,7 @@ texinfo = texinfo.lang | ||
| 127 | 132 | tk = tcl.lang |
| 128 | 133 | txt = nohilite.lang |
| 129 | 134 | ui = xml.lang |
| 135 | +vala = vala.lang | |
| 130 | 136 | vbs = vbscript.lang |
| 131 | 137 | vbscript = vbscript.lang |
| 132 | 138 | xhtml = xml.lang |
| @@ -1,14 +1,14 @@ | ||
| 1 | 1 | <html lang="en"> |
| 2 | 2 | <head> |
| 3 | -<title>GNU Source-highlight Library 3.1.3</title> | |
| 3 | +<title>GNU Source-highlight Library 3.1.4</title> | |
| 4 | 4 | <meta http-equiv="Content-Type" content="text/html"> |
| 5 | -<meta name="description" content="GNU Source-highlight Library 3.1.3"> | |
| 5 | +<meta name="description" content="GNU Source-highlight Library 3.1.4"> | |
| 6 | 6 | <meta name="generator" content="makeinfo 4.13"> |
| 7 | 7 | <link title="Top" rel="top" href="#Top"> |
| 8 | 8 | <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| 9 | 9 | <!-- |
| 10 | 10 | This manual is for GNU Source-highlight Library |
| 11 | -(version 3.1.3, 7 December 2009), | |
| 11 | +(version 3.1.4, 14 May 2010), | |
| 12 | 12 | which given a source file, produces a document with syntax highlighting. |
| 13 | 13 | |
| 14 | 14 | Copyright (C) 2005-2008 Lorenzo Bettini, `http://www.lorenzobettini.it'. |
| @@ -39,7 +39,7 @@ Copyright (C) 2005-2008 Lorenzo Bettini, `http://www.lorenzobettini.it'. | ||
| 39 | 39 | --></style> |
| 40 | 40 | </head> |
| 41 | 41 | <body> |
| 42 | -<h1 class="settitle">GNU Source-highlight Library 3.1.3</h1> | |
| 42 | +<h1 class="settitle">GNU Source-highlight Library 3.1.4</h1> | |
| 43 | 43 | <div class="contents"> |
| 44 | 44 | <h2>Table of Contents</h2> |
| 45 | 45 | <ul> |
| @@ -85,12 +85,12 @@ Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> | ||
| 85 | 85 | <p>GNU Source-highlight, given a source file, produces a document with |
| 86 | 86 | syntax highlighting. |
| 87 | 87 | |
| 88 | - <p>This is Edition 3.1.3 of the Source-highlight Library manual. | |
| 88 | + <p>This is Edition 3.1.4 of the Source-highlight Library manual. | |
| 89 | 89 | |
| 90 | - <p>This file documents GNU Source-highlight Library version 3.1.3. | |
| 90 | + <p>This file documents GNU Source-highlight Library version 3.1.4. | |
| 91 | 91 | |
| 92 | 92 | <p>This manual is for GNU Source-highlight Library |
| 93 | -(version 3.1.3, 7 December 2009), | |
| 93 | +(version 3.1.4, 14 May 2010), | |
| 94 | 94 | which given a source file, produces a document with syntax highlighting. |
| 95 | 95 | |
| 96 | 96 | <p>Copyright © 2005-2008 Lorenzo Bettini, <a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>. |
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | This is ../../doc/source-highlight-lib.info, produced by makeinfo |
| 2 | 2 | version 4.13 from ../../doc/source-highlight-lib.texinfo. |
| 3 | 3 | |
| 4 | -This manual is for GNU Source-highlight Library (version 3.1.3, 7 | |
| 5 | -December 2009), which given a source file, produces a document with | |
| 6 | -syntax highlighting. | |
| 4 | +This manual is for GNU Source-highlight Library (version 3.1.4, 14 May | |
| 5 | +2010), which given a source file, produces a document with syntax | |
| 6 | +highlighting. | |
| 7 | 7 | |
| 8 | 8 | Copyright (C) 2005-2008 Lorenzo Bettini, |
| 9 | 9 | `http://www.lorenzobettini.it'. |
| @@ -34,12 +34,12 @@ GNU Source-highlight Library | ||
| 34 | 34 | GNU Source-highlight, given a source file, produces a document with |
| 35 | 35 | syntax highlighting. |
| 36 | 36 | |
| 37 | - This is Edition 3.1.3 of the Source-highlight Library manual. | |
| 37 | + This is Edition 3.1.4 of the Source-highlight Library manual. | |
| 38 | 38 | |
| 39 | - This file documents GNU Source-highlight Library version 3.1.3. | |
| 39 | + This file documents GNU Source-highlight Library version 3.1.4. | |
| 40 | 40 | |
| 41 | - This manual is for GNU Source-highlight Library (version 3.1.3, | |
| 42 | -7 December 2009), which given a source file, produces a document with | |
| 41 | + This manual is for GNU Source-highlight Library (version 3.1.4, | |
| 42 | +14 May 2010), which given a source file, produces a document with | |
| 43 | 43 | syntax highlighting. |
| 44 | 44 | |
| 45 | 45 | Copyright (C) 2005-2008 Lorenzo Bettini, |
| @@ -997,24 +997,24 @@ Concept Index | ||
| 997 | 997 | |
| 998 | 998 | |
| 999 | 999 | Tag Table: |
| 1000 | -Node: Top1160 | |
| 1001 | -Node: Introduction2703 | |
| 1002 | -Node: Installation3565 | |
| 1003 | -Node: Use of GNU Source-highlight Library4522 | |
| 1004 | -Ref: Use of GNU Source-highlight Library-Footnote-15084 | |
| 1005 | -Node: Using Automake and Autotools5207 | |
| 1006 | -Ref: Using Automake and Autotools-Footnote-17193 | |
| 1007 | -Node: Main Classes7238 | |
| 1008 | -Node: SourceHighlight class8760 | |
| 1009 | -Node: Customizing Formatting11821 | |
| 1010 | -Node: Completely Customized Formatting13495 | |
| 1011 | -Node: Style-based Customized Formatting19422 | |
| 1012 | -Node: Events and Listeners27797 | |
| 1013 | -Node: Settings30182 | |
| 1014 | -Node: Utility functions32292 | |
| 1015 | -Node: Global instances32725 | |
| 1016 | -Node: Problems34116 | |
| 1017 | -Node: Mailing Lists34829 | |
| 1018 | -Node: Concept Index35691 | |
| 1000 | +Node: Top1156 | |
| 1001 | +Node: Introduction2695 | |
| 1002 | +Node: Installation3557 | |
| 1003 | +Node: Use of GNU Source-highlight Library4514 | |
| 1004 | +Ref: Use of GNU Source-highlight Library-Footnote-15076 | |
| 1005 | +Node: Using Automake and Autotools5199 | |
| 1006 | +Ref: Using Automake and Autotools-Footnote-17185 | |
| 1007 | +Node: Main Classes7230 | |
| 1008 | +Node: SourceHighlight class8752 | |
| 1009 | +Node: Customizing Formatting11813 | |
| 1010 | +Node: Completely Customized Formatting13487 | |
| 1011 | +Node: Style-based Customized Formatting19414 | |
| 1012 | +Node: Events and Listeners27789 | |
| 1013 | +Node: Settings30174 | |
| 1014 | +Node: Utility functions32284 | |
| 1015 | +Node: Global instances32717 | |
| 1016 | +Node: Problems34108 | |
| 1017 | +Node: Mailing Lists34821 | |
| 1018 | +Node: Concept Index35683 | |
| 1019 | 1019 | |
| 1020 | 1020 | End Tag Table |
| @@ -1,12 +1,12 @@ | ||
| 1 | -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. | |
| 2 | -.TH SOURCE-HIGHLIGHT "1" "January 2010" "Source-highlight 3.1.3 (library: 3:1:0)" "User Commands" | |
| 1 | +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. | |
| 2 | +.TH SOURCE-HIGHLIGHT "1" "May 2010" "Source-highlight 3.1.4 (library: 3:1:0)" "User Commands" | |
| 3 | 3 | .SH NAME |
| 4 | 4 | Source-highlight \- convert source code to syntax highlighted document |
| 5 | 5 | .SH SYNOPSIS |
| 6 | 6 | .B source-highlight |
| 7 | 7 | [\fIOPTIONS\fR]... \fI< input_file > output_file\fR |
| 8 | 8 | .SH DESCRIPTION |
| 9 | -GNU source\-highlight 3.1.3 | |
| 9 | +GNU source\-highlight 3.1.4 | |
| 10 | 10 | .PP |
| 11 | 11 | Highlight the syntax of a source file (e.g. Java) into a specific format (e.g. |
| 12 | 12 | HTML) |
| @@ -218,7 +218,7 @@ Maintained by Lorenzo Bettini <http://www.lorenzobettini.it> | ||
| 218 | 218 | .SH "REPORTING BUGS" |
| 219 | 219 | Report bugs to <bug\-source\-highlight at gnu.org> |
| 220 | 220 | .SH COPYRIGHT |
| 221 | -Copyright \(co 1999-2008 Lorenzo Bettini <http://www.lorenzobettini.it> | |
| 221 | +Copyright \(co 1999\-2008 Lorenzo Bettini <http://www.lorenzobettini.it> | |
| 222 | 222 | This program comes with ABSOLUTELY NO WARRANTY. |
| 223 | 223 | .br |
| 224 | 224 | This is free software; you may redistribute copies of the program |
| @@ -1,14 +1,14 @@ | ||
| 1 | 1 | <html lang="en"> |
| 2 | 2 | <head> |
| 3 | -<title>GNU Source-highlight 3.1.3</title> | |
| 3 | +<title>GNU Source-highlight 3.1.4</title> | |
| 4 | 4 | <meta http-equiv="Content-Type" content="text/html"> |
| 5 | -<meta name="description" content="GNU Source-highlight 3.1.3"> | |
| 5 | +<meta name="description" content="GNU Source-highlight 3.1.4"> | |
| 6 | 6 | <meta name="generator" content="makeinfo 4.13"> |
| 7 | 7 | <link title="Top" rel="top" href="#Top"> |
| 8 | 8 | <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| 9 | 9 | <!-- |
| 10 | 10 | This manual is for GNU Source-highlight |
| 11 | -(version 3.1.3, 17 December 2009), | |
| 11 | +(version 3.1.4, 14 May 2010), | |
| 12 | 12 | which given a source file, produces a document with syntax highlighting. |
| 13 | 13 | |
| 14 | 14 | Copyright (C) 2005-2008 Lorenzo Bettini, `http://www.lorenzobettini.it'. |
| @@ -39,7 +39,7 @@ Copyright (C) 2005-2008 Lorenzo Bettini, `http://www.lorenzobettini.it'. | ||
| 39 | 39 | --></style> |
| 40 | 40 | </head> |
| 41 | 41 | <body> |
| 42 | -<h1 class="settitle">GNU Source-highlight 3.1.3</h1> | |
| 42 | +<h1 class="settitle">GNU Source-highlight 3.1.4</h1> | |
| 43 | 43 | <div class="contents"> |
| 44 | 44 | <h2>Table of Contents</h2> |
| 45 | 45 | <ul> |
| @@ -162,12 +162,12 @@ Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> | ||
| 162 | 162 | <p>GNU Source-highlight, given a source file, produces a document with |
| 163 | 163 | syntax highlighting. |
| 164 | 164 | |
| 165 | - <p>This is Edition 3.1.3 of the Source-highlight manual. | |
| 165 | + <p>This is Edition 3.1.4 of the Source-highlight manual. | |
| 166 | 166 | |
| 167 | - <p>This file documents GNU Source-highlight version 3.1.3. | |
| 167 | + <p>This file documents GNU Source-highlight version 3.1.4. | |
| 168 | 168 | |
| 169 | 169 | <p>This manual is for GNU Source-highlight |
| 170 | -(version 3.1.3, 17 December 2009), | |
| 170 | +(version 3.1.4, 14 May 2010), | |
| 171 | 171 | which given a source file, produces a document with syntax highlighting. |
| 172 | 172 | |
| 173 | 173 | <p>Copyright © 2005-2008 Lorenzo Bettini, <a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>. |
| @@ -261,7 +261,7 @@ Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a> | ||
| 261 | 261 | <h3 class="section">1.1 Supported languages</h3> |
| 262 | 262 | |
| 263 | 263 | <p>The complete list of languages (indeed, file extensions) natively |
| 264 | -supported by this version of Source-highlight (3.1.3), as | |
| 264 | +supported by this version of Source-highlight (3.1.4), as | |
| 265 | 265 | reported by <code>--lang-list</code>, is the following: |
| 266 | 266 | |
| 267 | 267 | <pre class="example"> C = cpp.lang |
| @@ -293,6 +293,7 @@ reported by <code>--lang-list</code>, is the following: | ||
| 293 | 293 | csh = sh.lang |
| 294 | 294 | csharp = csharp.lang |
| 295 | 295 | css = css.lang |
| 296 | + ctp = php.lang | |
| 296 | 297 | d = d.lang |
| 297 | 298 | desktop = desktop.lang |
| 298 | 299 | diff = diff.lang |
| @@ -334,6 +335,8 @@ reported by <code>--lang-list</code>, is the following: | ||
| 334 | 335 | ldif = ldap.lang |
| 335 | 336 | lex = flex.lang |
| 336 | 337 | lgt = logtalk.lang |
| 338 | + lhs = haskell_literate.lang | |
| 339 | + lisp = lisp.lang | |
| 337 | 340 | ll = flex.lang |
| 338 | 341 | log = log.lang |
| 339 | 342 | logtalk = logtalk.lang |
| @@ -364,6 +367,8 @@ reported by <code>--lang-list</code>, is the following: | ||
| 364 | 367 | prg = clipper.lang |
| 365 | 368 | prolog = prolog.lang |
| 366 | 369 | properties = properties.lang |
| 370 | + proto = proto.lang | |
| 371 | + protobuf = proto.lang | |
| 367 | 372 | ps = postscript.lang |
| 368 | 373 | py = python.lang |
| 369 | 374 | python = python.lang |
| @@ -393,6 +398,7 @@ reported by <code>--lang-list</code>, is the following: | ||
| 393 | 398 | tk = tcl.lang |
| 394 | 399 | txt = nohilite.lang |
| 395 | 400 | ui = xml.lang |
| 401 | + vala = vala.lang | |
| 396 | 402 | vbs = vbscript.lang |
| 397 | 403 | vbscript = vbscript.lang |
| 398 | 404 | xhtml = xml.lang |
| @@ -403,7 +409,7 @@ reported by <code>--lang-list</code>, is the following: | ||
| 403 | 409 | yy = bison.lang |
| 404 | 410 | </pre> |
| 405 | 411 | <p>The complete list of output formats natively supported by this version |
| 406 | -of Source-highlight (3.1.3), as reported by | |
| 412 | +of Source-highlight (3.1.4), as reported by | |
| 407 | 413 | <code>--outlang-list</code>, is the following: |
| 408 | 414 | |
| 409 | 415 | <pre class="example"> docbook = docbook.outlang |
| @@ -645,7 +651,8 @@ formats (e.g., HTML, XHTML, etc.). | ||
| 645 | 651 | |
| 646 | 652 | <p><a href="http://qsrchilite.sourceforge.net">http://qsrchilite.sourceforge.net</a>. |
| 647 | 653 | |
| 648 | - <li><a name="index-SourceHighlightIDE-18"></a><a name="index-KDE-19"></a>SourceHighlightIDE is a small IDE (for KDE) I wrote for developing | |
| 654 | + <li><a name="index-SourceHighlightIDE-18"></a><a name="index-KDE-19"></a>SourceHighlightIDE is a small IDE (based on Qt4 and | |
| 655 | +Source-highlight-qt) I wrote for developing | |
| 649 | 656 | and debugging new language definitions for source-highlight: |
| 650 | 657 | |
| 651 | 658 | <p><a href="http://srchighliteide.sourceforge.net">http://srchighliteide.sourceforge.net</a>. |
| @@ -705,6 +712,20 @@ using the source-highlight CGI. | ||
| 705 | 712 | |
| 706 | 713 | <p><a href="http://code.google.com/p/php-source-highlight/">http://code.google.com/p/php-source-highlight/</a> |
| 707 | 714 | |
| 715 | + <li><a name="index-SIP-32"></a><a name="index-Python-33"></a><a name="index-PyQt-34"></a>Roberto Alsina made a partial python binding using SIP so | |
| 716 | +that you can use Source-Highlight-Qt in PyQt programs. | |
| 717 | + | |
| 718 | + <p><a href="http://marave.googlecode.com/svn/trunk/marave/highlight/">http://marave.googlecode.com/svn/trunk/marave/highlight/</a> | |
| 719 | + | |
| 720 | + <li><a name="index-Perl-35"></a>A perl binding for source-highlight is available at CPAN: | |
| 721 | + | |
| 722 | + <p><a href="http://search.cpan.org/perldoc?Syntax::SourceHighlight">http://search.cpan.org/perldoc?Syntax::SourceHighlight</a> | |
| 723 | + | |
| 724 | + <li><a name="index-Pastebin-36"></a>Danijel Tasov wrote a pastebin service based on | |
| 725 | +perl source-highlight binding: | |
| 726 | + | |
| 727 | + <p><a href="http://pb.rbfh.de">http://pb.rbfh.de</a> | |
| 728 | + | |
| 708 | 729 | </ul> |
| 709 | 730 | |
| 710 | 731 | <div class="node"> |
| @@ -718,7 +739,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 718 | 739 | |
| 719 | 740 | <h2 class="chapter">2 Installation</h2> |
| 720 | 741 | |
| 721 | -<p><a name="index-installation-32"></a> | |
| 742 | +<p><a name="index-installation-37"></a> | |
| 722 | 743 | See the file <samp><span class="file">INSTALL</span></samp> for detailed building and installation |
| 723 | 744 | instructions; anyway if you're used to compiling Linux software that |
| 724 | 745 | comes with sources you may simply follow the usual procedure, i.e., untar |
| @@ -740,7 +761,7 @@ you must be root to run <code>make install</code>. | ||
| 740 | 761 | <p>You may want to run <code>./configure --help</code> to see all the possible |
| 741 | 762 | options that can be passed to the configuration script. |
| 742 | 763 | |
| 743 | - <p><a name="index-directories-33"></a>Files will be installed in the following directories: | |
| 764 | + <p><a name="index-directories-38"></a>Files will be installed in the following directories: | |
| 744 | 765 | |
| 745 | 766 | <dl> |
| 746 | 767 | <dt><code>Executables</code><dd> <code>prefix/bin</code> |
| @@ -755,7 +776,7 @@ but you may change it with <code>--prefix</code> | ||
| 755 | 776 | option to configure. For further <code>configure</code> options, you |
| 756 | 777 | can run <code>configure --help</code>. |
| 757 | 778 | |
| 758 | - <p><a name="index-bash-completion-34"></a>Tiziano Muller wrote a bash completion configuration file for | |
| 779 | + <p><a name="index-bash-completion-39"></a>Tiziano Muller wrote a bash completion configuration file for | |
| 759 | 780 | source-highlight; this will be installed by default in the directory |
| 760 | 781 | <code>sysconfdir/bash_completion.d</code>, where <code>sysconfdir</code> defaults to |
| 761 | 782 | <code>prefix/etc</code>; however, typically, the directory where the bash |
| @@ -764,7 +785,7 @@ completion script searches for configuration file is | ||
| 764 | 785 | this directory with the configuration script command line option |
| 765 | 786 | <code>--with-bash-completion</code>. |
| 766 | 787 | |
| 767 | - <p><a name="index-library-35"></a><a name="index-g_t_0040code_007b_002d_002dwith_002ddoxygen_007d-36"></a><a name="index-doxygen-37"></a>If you want to build and install the API documentation of | |
| 788 | + <p><a name="index-library-40"></a><a name="index-g_t_0040code_007b_002d_002dwith_002ddoxygen_007d-41"></a><a name="index-doxygen-42"></a>If you want to build and install the API documentation of | |
| 768 | 789 | Source-highlight library, you need to run <code>configure</code> with the |
| 769 | 790 | option <code>--with-doxygen</code>, but you need the program <em>Doxygen</em>, |
| 770 | 791 | <a href="http://www.doxygen.org">http://www.doxygen.org</a>, to build the documentation. |
| @@ -774,7 +795,7 @@ The documentation will be installed in the following directory: | ||
| 774 | 795 | <dt><code>Library API documentation</code><dd> <code>prefix/share/doc/source-highlight/api</code> |
| 775 | 796 | </dl> |
| 776 | 797 | |
| 777 | - <p><a name="index-java2html-38"></a><a name="index-cpp2html-39"></a>NOTE: Originally, instead of Source-highlight, there were two | |
| 798 | + <p><a name="index-java2html-43"></a><a name="index-cpp2html-44"></a>NOTE: Originally, instead of Source-highlight, there were two | |
| 778 | 799 | separate programs, namely <em>GNU java2html</em> and <em>GNU cpp2html</em>. |
| 779 | 800 | There are two shell scripts with the same name that will be installed |
| 780 | 801 | together with Source-highlight in order to facilitate the migration |
| @@ -803,25 +824,25 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 803 | 824 | |
| 804 | 825 | <h3 class="section">2.1 Building with qmake</h3> |
| 805 | 826 | |
| 806 | -<p><a name="index-qmake-40"></a> | |
| 827 | +<p><a name="index-qmake-45"></a> | |
| 807 | 828 | Since version 3.1.2, Source-highlight can be built also using |
| 808 | 829 | <code>qmake</code>, the build tool from Qt libraries (<a href="http://qt.nokia.com">http://qt.nokia.com</a>). |
| 809 | 830 | This was made available to build Source-highlight on Windows based systems |
| 810 | 831 | without using a Unix shell, and in particular to build Source-highlight |
| 811 | -<a name="index-MSVC-41"></a>with Microsoft MSVC compiler. You should use this method only if you | |
| 832 | +<a name="index-MSVC-46"></a>with Microsoft MSVC compiler. You should use this method only if you | |
| 812 | 833 | don't have a Unix shell or if you really need to use the MSVC compiler |
| 813 | 834 | (e.g., if you want to build Source-highlight library to be used in MSVC |
| 814 | -based programs. | |
| 815 | -<a name="index-boost-42"></a>You still need the boost regex library, and if you | |
| 835 | +based programs). | |
| 836 | +<a name="index-boost-47"></a>You still need the boost regex library, and if you | |
| 816 | 837 | use MSVC, you can find installation packages for this library at |
| 817 | 838 | <a href="http://www.boostpro.com">http://www.boostpro.com</a>. |
| 818 | 839 | |
| 819 | 840 | <p>This build mechanism is still experimental, and, when using MSVC, only |
| 820 | 841 | a static version of Source-highlight library can be built (not a .dll). |
| 821 | -<a name="index-MinGW-43"></a>You can also use this method if you have the MinGW compiler, | |
| 842 | +<a name="index-MinGW-48"></a>You can also use this method if you have the MinGW compiler, | |
| 822 | 843 | <a href="http://www.mingw.org">http://www.mingw.org</a>, (e.g., |
| 823 | 844 | the one that comes with Qt Windows distribution) and you don't have |
| 824 | -<a name="index-msys-44"></a>Msys (<a href="http://www.mingw.org/wiki/MSYS">http://www.mingw.org/wiki/MSYS</a>). Otherwise, you should | |
| 845 | +<a name="index-msys-49"></a>Msys (<a href="http://www.mingw.org/wiki/MSYS">http://www.mingw.org/wiki/MSYS</a>). Otherwise, you should | |
| 825 | 846 | still use the <code>configure</code> based mechanims. |
| 826 | 847 | |
| 827 | 848 | <p>Using <code>qmake</code>, only a few options can be specified during the building |
| @@ -862,7 +883,7 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 862 | 883 | |
| 863 | 884 | <h3 class="section">2.2 Download</h3> |
| 864 | 885 | |
| 865 | -<p><a name="index-download-45"></a> | |
| 886 | +<p><a name="index-download-50"></a> | |
| 866 | 887 | You can download it from GNU's ftp site: |
| 867 | 888 | <a href="ftp://ftp.gnu.org/gnu/src-highlite">ftp://ftp.gnu.org/gnu/src-highlite</a> or from one of its mirrors (see |
| 868 | 889 | <a href="http://www.gnu.org/prep/ftp.html">http://www.gnu.org/prep/ftp.html</a>). |
| @@ -899,7 +920,7 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 899 | 920 | |
| 900 | 921 | <h3 class="section">2.3 Anonymous Git Checkout</h3> |
| 901 | 922 | |
| 902 | -<p><a name="index-Git-46"></a>This project's git repository can be checked out through the following | |
| 923 | +<p><a name="index-Git-51"></a>This project's git repository can be checked out through the following | |
| 903 | 924 | clone instruction<a rel="footnote" href="#fn-3" name="fnd-3"><sup>3</sup></a>: |
| 904 | 925 | |
| 905 | 926 | <pre class="example"> git clone git://git.savannah.gnu.org/src-highlite.git |
| @@ -929,7 +950,7 @@ first time, you must run the command: | ||
| 929 | 950 | </pre> |
| 930 | 951 | <p class="noindent">This will run the autotools commands in the correct order, and also copy |
| 931 | 952 | possibly missing files. You should have installed recent versions of |
| 932 | -<a name="index-automake-47"></a><a name="index-autoconf-48"></a><a name="index-libtool-49"></a><code>automake</code>, <code>autoconf</code> and <code>libtool</code> in order for this to | |
| 953 | +<a name="index-automake-52"></a><a name="index-autoconf-53"></a><a name="index-libtool-54"></a><code>automake</code>, <code>autoconf</code> and <code>libtool</code> in order for this to | |
| 933 | 954 | succeed. |
| 934 | 955 | |
| 935 | 956 | <div class="node"> |
| @@ -944,8 +965,8 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 944 | 965 | |
| 945 | 966 | <h3 class="section">2.4 What you need to build source-highlight</h3> |
| 946 | 967 | |
| 947 | -<p><a name="index-compilation-requirements-50"></a><a name="index-building-requirements-51"></a> | |
| 948 | -<a name="index-boost-52"></a>Since version 2.0 Source-highlight relies on regular expressions as | |
| 968 | +<p><a name="index-compilation-requirements-55"></a><a name="index-building-requirements-56"></a> | |
| 969 | +<a name="index-boost-57"></a>Since version 2.0 Source-highlight relies on regular expressions as | |
| 949 | 970 | provided by boost (<a href="http://www.boost.org">http://www.boost.org</a>), so you need to install at |
| 950 | 971 | least the regex library from boost. |
| 951 | 972 |
| @@ -968,10 +989,10 @@ and bison (yacc) and flex (lex), and ported under Win32 with Cygwin | ||
| 968 | 989 | C/C++compiler, available at <a href="http://www.cygwin.com">http://www.cygwin.com</a>. |
| 969 | 990 | |
| 970 | 991 | <p>I use the excellent |
| 971 | -<a name="index-automake-53"></a><a name="index-autoconf-54"></a><a name="index-libtool-55"></a>GNU Autoconf<a rel="footnote" href="#fn-4" name="fnd-4"><sup>4</sup></a>, | |
| 992 | +<a name="index-automake-58"></a><a name="index-autoconf-59"></a><a name="index-libtool-60"></a>GNU Autoconf<a rel="footnote" href="#fn-4" name="fnd-4"><sup>4</sup></a>, | |
| 972 | 993 | GNU Automake<a rel="footnote" href="#fn-5" name="fnd-5"><sup>5</sup></a> and |
| 973 | 994 | GNU Libtool<a rel="footnote" href="#fn-6" name="fnd-6"><sup>6</sup></a>. |
| 974 | -<a name="index-gnulib-56"></a>Since version 2.6 I also started to use Gnulib - The GNU Portability | |
| 995 | +<a name="index-gnulib-61"></a>Since version 2.6 I also started to use Gnulib - The GNU Portability | |
| 975 | 996 | Library<a rel="footnote" href="#fn-7" name="fnd-7"><sup>7</sup></a>, “a central |
| 976 | 997 | location for common GNU code, intended to be shared among GNU packages” |
| 977 | 998 | (for instance, I rely on Gnulib for checking for the presence and |
| @@ -1003,7 +1024,7 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 1003 | 1024 | |
| 1004 | 1025 | <h3 class="section">2.5 Tips on installing Boost Regex library</h3> |
| 1005 | 1026 | |
| 1006 | -<p><a name="index-Boost-regex-57"></a> | |
| 1027 | +<p><a name="index-Boost-regex-62"></a> | |
| 1007 | 1028 | If you experience no problem in compiling source-highlight, you can |
| 1008 | 1029 | happily skip this section<a rel="footnote" href="#fn-8" name="fnd-8"><sup>8</sup></a> :-) |
| 1009 | 1030 |
| @@ -1106,7 +1127,7 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 1106 | 1127 | |
| 1107 | 1128 | <h3 class="section">2.6 Patching from a previous version</h3> |
| 1108 | 1129 | |
| 1109 | -<p><a name="index-patching-58"></a> | |
| 1130 | +<p><a name="index-patching-63"></a> | |
| 1110 | 1131 | If you downloaded a patch, say |
| 1111 | 1132 | <samp><span class="file">source-highlight-1.3-1.3.1-patch.gz</span></samp> (i.e., the patch to go from version |
| 1112 | 1133 | 1.3 to version 1.3.1), cd to the directory with sources from the |
| @@ -1151,7 +1172,7 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 1151 | 1172 | |
| 1152 | 1173 | <h3 class="section">2.8 Using source-highlight as a CGI</h3> |
| 1153 | 1174 | |
| 1154 | -<p><a name="index-CGI-59"></a>CGI support was enabled thanks to Robert Wetzel; I haven't tested it | |
| 1175 | +<p><a name="index-CGI-64"></a>CGI support was enabled thanks to Robert Wetzel; I haven't tested it | |
| 1155 | 1176 | personally. If you want to use source-highlight as a CGI program, you |
| 1156 | 1177 | have to use the executable source-highlight-cgi. You can build such |
| 1157 | 1178 | executable by issuing |
| @@ -1171,15 +1192,15 @@ Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | ||
| 1171 | 1192 | |
| 1172 | 1193 | <h3 class="section">2.9 Building .rpm</h3> |
| 1173 | 1194 | |
| 1174 | -<p><a name="index-rpm-60"></a> | |
| 1195 | +<p><a name="index-rpm-65"></a> | |
| 1175 | 1196 | Christian W. Zuckschwerdt added support for building an .rpm and an |
| 1176 | 1197 | .rpm.src. You can issue the following command |
| 1177 | 1198 | |
| 1178 | -<pre class="example"> rpmbuild -tb source-highlight-3.1.3.tar.gz | |
| 1199 | +<pre class="example"> rpmbuild -tb source-highlight-3.1.4.tar.gz | |
| 1179 | 1200 | </pre> |
| 1180 | 1201 | <p>for building an .rpm with binaries and |
| 1181 | 1202 | |
| 1182 | -<pre class="example"> rpmbuild -ts source-highlight-3.1.3.tar.gz | |
| 1203 | +<pre class="example"> rpmbuild -ts source-highlight-3.1.4.tar.gz | |
| 1183 | 1204 | </pre> |
| 1184 | 1205 | <p>for building an .rpm.src with sources. |
| 1185 | 1206 |
| @@ -1194,7 +1215,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 1194 | 1215 | |
| 1195 | 1216 | <h2 class="chapter">3 Copying Conditions</h2> |
| 1196 | 1217 | |
| 1197 | -<p><a name="index-Copying-conditions-61"></a> | |
| 1218 | +<p><a name="index-Copying-conditions-66"></a> | |
| 1198 | 1219 | GNU Source-highlight is free software; you are free to use, share and modify it |
| 1199 | 1220 | under the terms of the GNU General Public License that accompanies this software |
| 1200 | 1221 | (see <samp><span class="file">COPYING</span></samp>). |
| @@ -1213,7 +1234,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 1213 | 1234 | |
| 1214 | 1235 | <h2 class="chapter">4 Simple Usage</h2> |
| 1215 | 1236 | |
| 1216 | -<p><a name="index-sample-62"></a> | |
| 1237 | +<p><a name="index-sample-67"></a> | |
| 1217 | 1238 | Here are some realistic examples of running |
| 1218 | 1239 | <samp><span class="command">source-highlight</span></samp><a rel="footnote" href="#fn-10" name="fnd-10"><sup>10</sup></a>. |
| 1219 | 1240 |
| @@ -1286,7 +1307,7 @@ Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | ||
| 1286 | 1307 | |
| 1287 | 1308 | <h3 class="section">4.1 HTML and XHTML output</h3> |
| 1288 | 1309 | |
| 1289 | -<p><a name="index-HTML-63"></a><a name="index-XHTML-64"></a> | |
| 1310 | +<p><a name="index-HTML-68"></a><a name="index-XHTML-69"></a> | |
| 1290 | 1311 | The default output format for HTML and XHTML uses fixed width fonts by |
| 1291 | 1312 | inserting all the formatted output between <code><tt></code> and <code></tt></code>. |
| 1292 | 1313 | Thus, for instance, specification for fixed width and not fixed width |
| @@ -1313,7 +1334,7 @@ Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | ||
| 1313 | 1334 | |
| 1314 | 1335 | <h3 class="section">4.2 LaTeX output</h3> |
| 1315 | 1336 | |
| 1316 | -<p><a name="index-g_t_0040LaTeX_007b_007d-65"></a> | |
| 1337 | +<p><a name="index-g_t_0040LaTeX_007b_007d-70"></a> | |
| 1317 | 1338 | When using LaTeX output format you can choose between monochromatic |
| 1318 | 1339 | output (by using <code>-f latex</code>) or colored output (by using <code>-f |
| 1319 | 1340 | latexcolor</code>). When using colored output, you need the |
| @@ -1332,7 +1353,7 @@ Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | ||
| 1332 | 1353 | |
| 1333 | 1354 | <h3 class="section">4.3 Texinfo output</h3> |
| 1334 | 1355 | |
| 1335 | -<p><a name="index-Texinfo-66"></a> | |
| 1356 | +<p><a name="index-Texinfo-71"></a> | |
| 1336 | 1357 | When using the Texinfo output format, you may want to use a dedicated |
| 1337 | 1358 | style file, <samp><span class="file">texinfo.style</span></samp>, which comes with the source-highlight |
| 1338 | 1359 | distribution, with the option <code>--style-file</code>. For instance, the |
| @@ -1349,7 +1370,7 @@ Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | ||
| 1349 | 1370 | |
| 1350 | 1371 | <h3 class="section">4.4 DocBook output</h3> |
| 1351 | 1372 | |
| 1352 | -<p><a name="index-DocBook-67"></a> | |
| 1373 | +<p><a name="index-DocBook-72"></a> | |
| 1353 | 1374 | DocBook output is generated using the <code><programlisting></code> tag. If |
| 1354 | 1375 | the <code>--doc</code> command line option is given, an <code><article></code> |
| 1355 | 1376 | document is generated. |
| @@ -1364,7 +1385,7 @@ Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | ||
| 1364 | 1385 | |
| 1365 | 1386 | <h3 class="section">4.5 ANSI color escape sequences</h3> |
| 1366 | 1387 | |
| 1367 | -<p><a name="index-ANSI-color-68"></a> | |
| 1388 | +<p><a name="index-ANSI-color-73"></a> | |
| 1368 | 1389 | If you're using this output format, for instance together with |
| 1369 | 1390 | <code>less</code> (see <a href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>), you may |
| 1370 | 1391 | want to use the <samp><span class="file">esc.style</span></samp>, which comes with the source-highlight |
| @@ -1382,7 +1403,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 1382 | 1403 | |
| 1383 | 1404 | <h2 class="chapter">5 Configuration files</h2> |
| 1384 | 1405 | |
| 1385 | -<p><a name="index-configuration-files-69"></a> | |
| 1406 | +<p><a name="index-configuration-files-74"></a> | |
| 1386 | 1407 | During execution, source-highlight needs some files where it finds |
| 1387 | 1408 | directives on how to recognize the source language (if not specified |
| 1388 | 1409 | explicitly with <code>--src-lang</code> or <code>--lang-def</code>), on which output |
| @@ -1391,7 +1412,7 @@ format to use (if not specified explicitly with <code>--out-format</code> or | ||
| 1391 | 1412 | keywords, comments, etc.), and source and output language definitions. |
| 1392 | 1413 | These files will be explained in the next sections. |
| 1393 | 1414 | |
| 1394 | - <p><a name="index-g_t_0040code_007b_002d_002ddata_002ddir_007d-70"></a>If the directory for such files is not explicitly specified with the | |
| 1415 | + <p><a name="index-g_t_0040code_007b_002d_002ddata_002ddir_007d-75"></a>If the directory for such files is not explicitly specified with the | |
| 1395 | 1416 | command line option <code>--data-dir</code>, these files are searched for in |
| 1396 | 1417 | the following order: |
| 1397 | 1418 |
| @@ -1407,7 +1428,7 @@ still used, but relative to the explicit path name. | ||
| 1407 | 1428 | |
| 1408 | 1429 | <p>In particular, the user can set the value also with the environment |
| 1409 | 1430 | variable |
| 1410 | -<a name="index-g_t_0040code_007bSOURCE_005fHIGHLIGHT_005fDATADIR_007d-71"></a><code>SOURCE_HIGHLIGHT_DATADIR</code> (see also <a href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a>). | |
| 1431 | +<a name="index-g_t_0040code_007bSOURCE_005fHIGHLIGHT_005fDATADIR_007d-76"></a><code>SOURCE_HIGHLIGHT_DATADIR</code> (see also <a href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a>). | |
| 1411 | 1432 | |
| 1412 | 1433 | <p>If you want to be sure about which file is used during the |
| 1413 | 1434 | execution, you can use the command line option <code>--verbose</code>. |
| @@ -1434,14 +1455,14 @@ Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration fil | ||
| 1434 | 1455 | |
| 1435 | 1456 | <h3 class="section">5.1 Output format style</h3> |
| 1436 | 1457 | |
| 1437 | -<p><a name="index-output-style-72"></a><a name="index-default_002estyle-73"></a> | |
| 1458 | +<p><a name="index-output-style-77"></a><a name="index-default_002estyle-78"></a> | |
| 1438 | 1459 | You must specify your options for syntax highlighting in the file |
| 1439 | 1460 | <samp><span class="file">default.style</span></samp><a rel="footnote" href="#fn-11" name="fnd-11"><sup>11</sup></a>. |
| 1440 | 1461 | You can specify formatting options for each element defined |
| 1441 | 1462 | by a language definition file (you can get the list of such elements, |
| 1442 | -<a name="index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-74"></a>by using <code>--show-lang-elements</code>, see <a href="#Listing-Language-Elements">Listing Language Elements</a>). | |
| 1463 | +<a name="index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-79"></a>by using <code>--show-lang-elements</code>, see <a href="#Listing-Language-Elements">Listing Language Elements</a>). | |
| 1443 | 1464 | |
| 1444 | - <p><a name="index-g_t_0040code_007bbgcolor_007d-75"></a><a name="index-background-color-76"></a>Since version 2.6, you can also specify the background color for the | |
| 1465 | + <p><a name="index-g_t_0040code_007bbgcolor_007d-80"></a><a name="index-background-color-81"></a>Since version 2.6, you can also specify the background color for the | |
| 1445 | 1466 | output document, using the keyword <code>bgcolor</code> (this might be visible |
| 1446 | 1467 | only when the <code>--doc</code> command line option is used). |
| 1447 | 1468 |
| @@ -1469,6 +1490,7 @@ is formatted by using the <samp><span class="file">style.lang</span></samp> that | ||
| 1469 | 1490 | <i>function</i> <b>black</b> <b>b</b>; <i>// for function calls and declarations</i> |
| 1470 | 1491 | <i>cbracket</i> <b>red</b>; <i>// for block brackets (e.g. {, })</i> |
| 1471 | 1492 | <i>todo</i> <b>bg:cyan</b> <b>b</b>; <i>// for TODO and FIXME</i> |
| 1493 | + <i>code</i> <b>bg:brightgreen</b> <b>b</b>; <i>// for code snippets</i> | |
| 1472 | 1494 | |
| 1473 | 1495 | <i>//Predefined variables and functions (for instance glsl)</i> |
| 1474 | 1496 | <i>predef_var</i> <b>darkblue</b> ; |
| @@ -1529,7 +1551,7 @@ is formatted by using the <samp><span class="file">style.lang</span></samp> that | ||
| 1529 | 1551 | language definition files that comes with Source-highlight |
| 1530 | 1552 | distribution. |
| 1531 | 1553 | |
| 1532 | - <p><a name="index-g_t_0040code_007b_002d_002dstyle_002dfile_007d-77"></a>You can specify your own file (it doesn't have to be named | |
| 1554 | + <p><a name="index-g_t_0040code_007b_002d_002dstyle_002dfile_007d-82"></a>You can specify your own file (it doesn't have to be named | |
| 1533 | 1555 | <samp><span class="file">default.style</span></samp>) with the command line option |
| 1534 | 1556 | <code>--style-file</code><a rel="footnote" href="#fn-13" name="fnd-13"><sup>13</sup></a>, see |
| 1535 | 1557 | <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a>. |
| @@ -1538,7 +1560,7 @@ distribution. | ||
| 1538 | 1560 | |
| 1539 | 1561 | <pre class="example"> normal darkblue ; |
| 1540 | 1562 | </pre> |
| 1541 | - <p><a name="index-color-78"></a><a name="index-background-color-79"></a>As you might see the syntax of this file is quite straightforward: after | |
| 1563 | + <p><a name="index-color-83"></a><a name="index-background-color-84"></a>As you might see the syntax of this file is quite straightforward: after | |
| 1542 | 1564 | the element (or elements, separated by commas) you can specify the |
| 1543 | 1565 | color, and the background color<a rel="footnote" href="#fn-14" name="fnd-14"><sup>14</sup></a> by using |
| 1544 | 1566 | the prefix <code>bg:</code> (for instance, in the <samp><span class="file">default.style</span></samp> above |
| @@ -1548,7 +1570,7 @@ the background color is specified for the <code>todo</code> element). | ||
| 1548 | 1570 | formats: it is available for XHTML and LaTeX but not for |
| 1549 | 1571 | HTML<a rel="footnote" href="#fn-15" name="fnd-15"><sup>15</sup></a>. |
| 1550 | 1572 | |
| 1551 | - <p><a name="index-bold-80"></a><a name="index-italics-81"></a><a name="index-underline-82"></a><a name="index-fixed-83"></a><a name="index-notfixed-84"></a>Then, you can specify further formatting options such as bold, italics, | |
| 1573 | + <p><a name="index-bold-85"></a><a name="index-italics-86"></a><a name="index-underline-87"></a><a name="index-fixed-88"></a><a name="index-notfixed-89"></a>Then, you can specify further formatting options such as bold, italics, | |
| 1552 | 1574 | etc.; these are the keywords that can be used: |
| 1553 | 1575 | |
| 1554 | 1576 | <pre class="example"> b = bold |
| @@ -1558,7 +1580,7 @@ etc.; these are the keywords that can be used: | ||
| 1558 | 1580 | nf = not fixed |
| 1559 | 1581 | noref = no reference information is generated for these elements |
| 1560 | 1582 | </pre> |
| 1561 | - <p><a name="index-color-85"></a>Since version 2.2, the color specification is not required. For | |
| 1583 | + <p><a name="index-color-90"></a>Since version 2.2, the color specification is not required. For | |
| 1562 | 1584 | instance, the <samp><span class="file">texinfo.style</span></samp> is as follows (we avoid colors for |
| 1563 | 1585 | Texinfo outputs): |
| 1564 | 1586 |
| @@ -1597,7 +1619,7 @@ that comes first is used after the ones that follow. For instance, in | ||
| 1597 | 1619 | the case of HTML, the sequence <code>u, b</code> will lead to the following |
| 1598 | 1620 | formatting: <code><u><b>...</b></u></code>. |
| 1599 | 1621 | |
| 1600 | - <p><a name="index-noref-86"></a>The <code>noref</code> option specifies that for this element reference | |
| 1622 | + <p><a name="index-noref-91"></a>The <code>noref</code> option specifies that for this element reference | |
| 1601 | 1623 | information are not generated (see <a href="#Generating-References">Generating References</a>). For |
| 1602 | 1624 | instance, this is used for the <code>comment</code> element, since we do not |
| 1603 | 1625 | want that elements in a comment are searched for cross-references. |
| @@ -1624,7 +1646,7 @@ source-highlight<a rel="footnote" href="#fn-16" name="fnd-16"><sup>16</sup></a>: | ||
| 1624 | 1646 | darkblue |
| 1625 | 1647 | white |
| 1626 | 1648 | </pre> |
| 1627 | - <p><a name="index-direct-color-scheme-87"></a>You can also use the direct color scheme for the specific output format, | |
| 1649 | + <p><a name="index-direct-color-scheme-92"></a>You can also use the direct color scheme for the specific output format, | |
| 1628 | 1650 | by using double quotes, such as, e.g., <code>"#00FF00"</code> in |
| 1629 | 1651 | HTML<a rel="footnote" href="#fn-17" name="fnd-17"><sup>17</sup></a> or even string colors in double quotes<a rel="footnote" href="#fn-18" name="fnd-18"><sup>18</sup></a>, such as <code>"lightblue"</code>. Of course, the double quotes will be |
| 1630 | 1652 | discarded during the generation. |
| @@ -1677,11 +1699,11 @@ Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration fil | ||
| 1677 | 1699 | |
| 1678 | 1700 | <h3 class="section">5.2 Output format style using CSS</h3> |
| 1679 | 1701 | |
| 1680 | -<p><a name="index-CSS-88"></a>Since version 2.6 you can specify the output format style also using | |
| 1702 | +<p><a name="index-CSS-93"></a>Since version 2.6 you can specify the output format style also using | |
| 1681 | 1703 | a limited CSS syntax. Please, note that this has nothing to do |
| 1682 | 1704 | with output produced by source-highlight using the <code>--css</code> option. |
| 1683 | 1705 | |
| 1684 | - <p><a name="index-g_t_0040code_007b_002d_002dstyle_002dcss_002dfile_007d-89"></a>By using a CSS file as the style file (i.e., passing it to the | |
| 1706 | + <p><a name="index-g_t_0040code_007b_002d_002dstyle_002dcss_002dfile_007d-94"></a>By using a CSS file as the style file (i.e., passing it to the | |
| 1685 | 1707 | <code>--style-css-file</code> command line option) you will only specify the |
| 1686 | 1708 | output format style using the same syntax of CSS. This means that you |
| 1687 | 1709 | can use a css syntax for specifying the output format style |
| @@ -1811,7 +1833,7 @@ following line (comment lines start with <code>#</code>): | ||
| 1811 | 1833 | <p class="noindent">tells that, if the style for an element, say elem1, is not specified in |
| 1812 | 1834 | the style file, then elem1 will have the same style of elem2. |
| 1813 | 1835 | |
| 1814 | - <p><a name="index-style_002edefaults-90"></a>For instance, this is the <samp><span class="file">style.defaults</span></samp> that comes with | |
| 1836 | + <p><a name="index-style_002edefaults-95"></a>For instance, this is the <samp><span class="file">style.defaults</span></samp> that comes with | |
| 1815 | 1837 | Source-highlight: |
| 1816 | 1838 | |
| 1817 | 1839 | <!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> |
| @@ -1836,6 +1858,7 @@ Source-highlight: | ||
| 1836 | 1858 | label = preproc |
| 1837 | 1859 | error = string |
| 1838 | 1860 | warning = type |
| 1861 | + code = preproc | |
| 1839 | 1862 | </pre> |
| 1840 | 1863 | <p class="noindent">In this case the style for the element <code>preproc</code> will default to |
| 1841 | 1864 | the style of the element <code>keyword</code>. |
| @@ -1858,7 +1881,7 @@ Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration fil | ||
| 1858 | 1881 | |
| 1859 | 1882 | <h3 class="section">5.4 Language map</h3> |
| 1860 | 1883 | |
| 1861 | -<p><a name="index-language-map-91"></a> | |
| 1884 | +<p><a name="index-language-map-96"></a> | |
| 1862 | 1885 | This configuration file associates a file extension to a specific |
| 1863 | 1886 | language definition file. You can also use such file extension to |
| 1864 | 1887 | specify the <code>--src-lang</code> option (see <a href="#Simple-Usage">Simple Usage</a>). |
| @@ -1902,7 +1925,7 @@ Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration fil | ||
| 1902 | 1925 | |
| 1903 | 1926 | <h3 class="section">5.6 Output Language map</h3> |
| 1904 | 1927 | |
| 1905 | -<p><a name="index-output-language-map-92"></a> | |
| 1928 | +<p><a name="index-output-language-map-97"></a> | |
| 1906 | 1929 | This configuration file associates an output format to a specific output |
| 1907 | 1930 | language definition file. You can use the name of that output format to |
| 1908 | 1931 | specify the <code>--out-format</code> option (see <a href="#Simple-Usage">Simple Usage</a>). |
| @@ -1979,7 +2002,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 1979 | 2002 | |
| 1980 | 2003 | <h2 class="chapter">6 Invoking <samp><span class="command">source-highlight</span></samp></h2> |
| 1981 | 2004 | |
| 1982 | -<p><a name="index-invoking-93"></a><a name="index-version-94"></a><a name="index-options-95"></a><a name="index-usage-96"></a><a name="index-help-97"></a><a name="index-getting-help-98"></a> | |
| 2005 | +<p><a name="index-invoking-98"></a><a name="index-version-99"></a><a name="index-options-100"></a><a name="index-usage-101"></a><a name="index-help-102"></a><a name="index-getting-help-103"></a> | |
| 1983 | 2006 | The format for running the <samp><span class="command">source-highlight</span></samp> program is: |
| 1984 | 2007 | |
| 1985 | 2008 | <pre class="example"> source-highlight <var>option</var> ... |
| @@ -1994,7 +2017,7 @@ in <a href="#Simple-Usage">Simple Usage</a>). | ||
| 1994 | 2017 | |
| 1995 | 2018 | <!-- Formatting copied from the Texinfo 4.0 manual. --> |
| 1996 | 2019 | <dl> |
| 1997 | -<dt><code>--data-dir</code><dd><a name="index-g_t_0040code_007b_002d_002ddata_002ddir_007d-99"></a>Source-highlight, during the execution, will need some files, such as, | |
| 2020 | +<dt><code>--data-dir</code><dd><a name="index-g_t_0040code_007b_002d_002ddata_002ddir_007d-104"></a>Source-highlight, during the execution, will need some files, such as, | |
| 1998 | 2021 | e.g., language definition files, output format definition files, etc. |
| 1999 | 2022 | These files are installed in <code>prefix/share/source-highlight</code> where |
| 2000 | 2023 | <code>prefix</code> is chosen at compilation time (see See <a href="#Installation">Installation</a>). |
| @@ -2041,7 +2064,7 @@ into the directory where you invoked the command from; if you want the | ||
| 2041 | 2064 | output files to be generated into a different directory you can use this |
| 2042 | 2065 | option. |
| 2043 | 2066 | |
| 2044 | - <br><dt><code>--infer-lang</code><dd><a name="index-language-inference-100"></a><a name="index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-101"></a>Force the inference mechanism for detecting the input language. This is | |
| 2067 | + <br><dt><code>--infer-lang</code><dd><a name="index-language-inference-105"></a><a name="index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-106"></a>Force the inference mechanism for detecting the input language. This is | |
| 2045 | 2068 | detailed in <a href="#How-the-input-language-is-discovered">How the input language is discovered</a>. |
| 2046 | 2069 | |
| 2047 | 2070 | <br><dt><code>--line-number</code><dd>Line numbers will be generated in the output, using the (optional) |
| @@ -2056,7 +2079,7 @@ support this feature (e.g., <code>esc</code>, since it makes no sense in such | ||
| 2056 | 2079 | case). See <a href="#Anchors-and-References">Anchors and References</a> for defining how to generate an |
| 2057 | 2080 | anchor in a specific output language. |
| 2058 | 2081 | |
| 2059 | - <p><a name="index-line-ranges-102"></a><a name="index-range-context-103"></a><a name="index-range-separator-104"></a><br><dt><code>--line-range</code><dt><code>--range-context</code><dt><code>--range-separator</code><dd>Since version 2.11, you can specify multiple line ranges: only the lines | |
| 2082 | + <p><a name="index-line-ranges-107"></a><a name="index-range-context-108"></a><a name="index-range-separator-109"></a><br><dt><code>--line-range</code><dt><code>--range-context</code><dt><code>--range-separator</code><dd>Since version 2.11, you can specify multiple line ranges: only the lines | |
| 2060 | 2083 | in the source that are in these ranges will be output. For instance, by |
| 2061 | 2084 | specifying |
| 2062 | 2085 |
| @@ -2084,7 +2107,7 @@ the examples in <a href="#Line-ranges-_0028with-context_0029">Line ranges (with | ||
| 2084 | 2107 | is preformatted automatically, so, e.g., you don't have to escape |
| 2085 | 2108 | special output characters, such as the { } in texinfo output. |
| 2086 | 2109 | |
| 2087 | - <p><a name="index-regex-ranges-105"></a><br><dt><code>--regex-range</code><dd> | |
| 2110 | + <p><a name="index-regex-ranges-110"></a><br><dt><code>--regex-range</code><dd> | |
| 2088 | 2111 | Ranges can be expressed also using regular expressions, with the command |
| 2089 | 2112 | line option <code>--regex-range</code>. In this case the beginning of the |
| 2090 | 2113 | range will be detected by a line containing (in any point) a string |
| @@ -2103,7 +2126,7 @@ accordingly), otherwise you will get an error. | ||
| 2103 | 2126 | <p>Furthermore, <code>--line-range</code> and <code>--regex-range</code> cannot coexist |
| 2104 | 2127 | in the same command line. |
| 2105 | 2128 | |
| 2106 | - <br><dt><code>--failsafe</code><dd><a name="index-failsafe-106"></a>If no language specification is found, an error will be printed and the | |
| 2129 | + <br><dt><code>--failsafe</code><dd><a name="index-failsafe-111"></a>If no language specification is found, an error will be printed and the | |
| 2107 | 2130 | program exits. With this option, instead, in such situations, the input |
| 2108 | 2131 | is simply formatted in the output format. This is useful when |
| 2109 | 2132 | <samp><span class="command">source-highlight</span></samp> is used with many input files, and it is also |
| @@ -2113,7 +2136,7 @@ suggestion is to always use it when you run source-highlight (and | ||
| 2113 | 2136 | indeed, in the future, this option might become the default one). See |
| 2114 | 2137 | also <a href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>, <a href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a>. |
| 2115 | 2138 | |
| 2116 | - <p><a name="index-default_002elang-107"></a>When using <code>--failsafe</code>, if no input language can be established, | |
| 2139 | + <p><a name="index-default_002elang-112"></a>When using <code>--failsafe</code>, if no input language can be established, | |
| 2117 | 2140 | source-highlight will use the input language definition file |
| 2118 | 2141 | <samp><span class="file">default.lang</span></samp>, which is an empty file. You might want to |
| 2119 | 2142 | customize such file, though. |
| @@ -2177,7 +2200,7 @@ also the lowercase version (the input file may also have no extension at | ||
| 2177 | 2200 | all, but, for instance, a <samp><span class="file">ChangeLog</span></samp> input file will be |
| 2178 | 2201 | highlighted using <samp><span class="file">changelog.lang</span></samp>). |
| 2179 | 2202 | |
| 2180 | - <p><a name="index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-108"></a>Furthermore, this mechanism can be given priority with the command line | |
| 2203 | + <p><a name="index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-113"></a>Furthermore, this mechanism can be given priority with the command line | |
| 2181 | 2204 | option <code>--infer-lang</code>. For instance, this is used in the script |
| 2182 | 2205 | <samp><span class="file">src-hilite-lesspipe.sh</span></samp> (<a href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>) |
| 2183 | 2206 | when running source-highlight, in order to avoid the problem of |
| @@ -2196,7 +2219,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 2196 | 2219 | |
| 2197 | 2220 | <h2 class="chapter">7 Language Definitions</h2> |
| 2198 | 2221 | |
| 2199 | -<p><a name="index-language-definition-109"></a> | |
| 2222 | +<p><a name="index-language-definition-114"></a> | |
| 2200 | 2223 | Since version 2.0 source-highlight uses a specific syntax |
| 2201 | 2224 | to specify source language elements (e.g., keywords, strings, |
| 2202 | 2225 | comments, etc.). Before version 2.0, language elements were scanned |
| @@ -2291,7 +2314,7 @@ where you're forced to use only one mechanism, since the other ones | ||
| 2291 | 2314 | cannot accomplish the required goal. |
| 2292 | 2315 | |
| 2293 | 2316 | |
| 2294 | -<a name="index-g_t_0040code_007b_0022expression_0022_007d-110"></a> | |
| 2317 | +<a name="index-g_t_0040code_007b_0022expression_0022_007d-115"></a> | |
| 2295 | 2318 | <dl><dt><code>"expression"</code><dd> |
| 2296 | 2319 | If you use double quotes (note, <code>"</code> and not <code>``</code> or |
| 2297 | 2320 | <code>''</code>) to specify a regular expression, then basically all the |
| @@ -2311,7 +2334,7 @@ alternatives (<a href="#Simple-definitions">Simple definitions</a>), must be esc | ||
| 2311 | 2334 | character <code>\</code>, e.g., <code>\|</code>. Also the character <code>\</code>, |
| 2312 | 2335 | if it is intended literally, must be escaped, e.g., <code>\\</code>. |
| 2313 | 2336 | |
| 2314 | - <p><a name="index-g_t_0040code_007b_0027expression_0027_007d-111"></a><br><dt><code>'expression'</code><dd> | |
| 2337 | + <p><a name="index-g_t_0040code_007b_0027expression_0027_007d-116"></a><br><dt><code>'expression'</code><dd> | |
| 2315 | 2338 | If you want to enjoy (almost) the full power of regular expressions, you |
| 2316 | 2339 | need to use single quoted strings (<code>'</code>), instead of double quoted |
| 2317 | 2340 | strings. This way, you can specify special characters with their |
| @@ -2336,8 +2359,8 @@ sub-expression). | ||
| 2336 | 2359 | <em>backreferences</em> (see <a href="#Notes-on-regular-expressions">Notes on regular expressions</a>) are not |
| 2337 | 2360 | allowed. |
| 2338 | 2361 | |
| 2339 | - <p><a name="index-g_t_0040code_007b_0060expression_0060_007d-112"></a><br><dt><code>`expression`</code><dd> | |
| 2340 | -<a name="index-marked-subexpressions-113"></a><a name="index-backreference-114"></a><a name="index-backtick-115"></a>This syntax<a rel="footnote" href="#fn-26" name="fnd-26"><sup>26</sup></a> (note the difference, this | |
| 2362 | + <p><a name="index-g_t_0040code_007b_0060expression_0060_007d-117"></a><br><dt><code>`expression`</code><dd> | |
| 2363 | +<a name="index-marked-subexpressions-118"></a><a name="index-backreference-119"></a><a name="index-backtick-120"></a>This syntax<a rel="footnote" href="#fn-26" name="fnd-26"><sup>26</sup></a> (note the difference, this | |
| 2341 | 2364 | one uses the <em>backtick</em> <code>`</code> while the previous one uses |
| 2342 | 2365 | <code>'</code>) for specifying a regular expression was introduced to overcome |
| 2343 | 2366 | the limitations of the other two syntaxes. With this syntax, the marked |
| @@ -2415,7 +2438,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2415 | 2438 | |
| 2416 | 2439 | <h3 class="section">7.2 Simple definitions</h3> |
| 2417 | 2440 | |
| 2418 | -<p><a name="index-simple-language-definition-116"></a> | |
| 2441 | +<p><a name="index-simple-language-definition-121"></a> | |
| 2419 | 2442 | The simplest way to specify language elements is to list the possible |
| 2420 | 2443 | alternatives. This is the case, for instance, for keywords. For |
| 2421 | 2444 | instance, in <samp><span class="file">java.lang</span></samp> you have: |
| @@ -2487,7 +2510,7 @@ definitions. Thus, for instance, the following definition is wrong: | ||
| 2487 | 2510 | <pre class="example"> preproc = "#define" |
| 2488 | 2511 | preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' |
| 2489 | 2512 | </pre> |
| 2490 | - <p><a name="index-nonsensitive-117"></a>Finally, at the end of a list of definitions, one can specify the | |
| 2513 | + <p><a name="index-nonsensitive-122"></a>Finally, at the end of a list of definitions, one can specify the | |
| 2491 | 2514 | keyword <code>nonsensitive</code>; in that case, the specified strings will be |
| 2492 | 2515 | interpreted in a non case sensitive way. For instance, we use this |
| 2493 | 2516 | feature in Pascal language definition, <samp><span class="file">pascal.lang</span></samp> where keywords |
| @@ -2511,7 +2534,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2511 | 2534 | |
| 2512 | 2535 | <h3 class="section">7.3 Line wide definitions</h3> |
| 2513 | 2536 | |
| 2514 | -<p><a name="index-lines-118"></a> | |
| 2537 | +<p><a name="index-lines-123"></a> | |
| 2515 | 2538 | It is often useful to define a language element that affects all the |
| 2516 | 2539 | remaining characters up to the end of the line. For such definitions, |
| 2517 | 2540 | instead of the <code>=</code> you must use the keyword <code>start</code>. For |
| @@ -2535,7 +2558,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2535 | 2558 | |
| 2536 | 2559 | <h3 class="section">7.4 Order of definitions</h3> |
| 2537 | 2560 | |
| 2538 | -<p><a name="index-definition-order-119"></a> | |
| 2561 | +<p><a name="index-definition-order-124"></a> | |
| 2539 | 2562 | It is important to observe that the order of language definitions is |
| 2540 | 2563 | important since it will be used during regular expression matching (this |
| 2541 | 2564 | will be detailed in <a href="#How-source_002dhighlight-works">How source-highlight works</a>). You then have to |
| @@ -2563,7 +2586,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2563 | 2586 | |
| 2564 | 2587 | <h3 class="section">7.5 Delimited definitions</h3> |
| 2565 | 2588 | |
| 2566 | -<p><a name="index-delimited-definitions-120"></a> | |
| 2589 | +<p><a name="index-delimited-definitions-125"></a> | |
| 2567 | 2590 | Many elements are delimited by specific character sequences. |
| 2568 | 2591 | For instance, strings and multiline comments. The syntax for |
| 2569 | 2592 | such an element definition is |
| @@ -2632,7 +2655,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2632 | 2655 | |
| 2633 | 2656 | <h3 class="section">7.6 Variable definitions</h3> |
| 2634 | 2657 | |
| 2635 | -<p><a name="index-variables-121"></a> | |
| 2658 | +<p><a name="index-variables-126"></a> | |
| 2636 | 2659 | It is possible to define variables to be re-used in |
| 2637 | 2660 | many parts in a language definition file. |
| 2638 | 2661 | A variable is defined by using |
| @@ -2664,7 +2687,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2664 | 2687 | |
| 2665 | 2688 | <h3 class="section">7.7 Dynamic Backreferences</h3> |
| 2666 | 2689 | |
| 2667 | -<p><a name="index-dynamic-backreference-122"></a> | |
| 2690 | +<p><a name="index-dynamic-backreference-127"></a> | |
| 2668 | 2691 | With <em>dynamic backreferences</em> you can refer to a string matched by |
| 2669 | 2692 | the regular expression of the first element of a <code>delim</code> |
| 2670 | 2693 | specification<a rel="footnote" href="#fn-29" name="fnd-29"><sup>29</sup></a>. I called these |
| @@ -2739,7 +2762,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2739 | 2762 | |
| 2740 | 2763 | <h3 class="section">7.8 File inclusion</h3> |
| 2741 | 2764 | |
| 2742 | -<p><a name="index-file-inclusion-123"></a> | |
| 2765 | +<p><a name="index-file-inclusion-128"></a> | |
| 2743 | 2766 | It is possible to include other language definition files into another |
| 2744 | 2767 | file. This is inclusion actually physically includes the contents of |
| 2745 | 2768 | the included file into the current file during parsing, at the exact |
| @@ -2776,7 +2799,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 2776 | 2799 | |
| 2777 | 2800 | <h3 class="section">7.9 State/Environment Definitions</h3> |
| 2778 | 2801 | |
| 2779 | -<p><a name="index-states-124"></a><a name="index-environments-125"></a> | |
| 2802 | +<p><a name="index-states-129"></a><a name="index-environments-130"></a> | |
| 2780 | 2803 | Sometimes you want some source element to be highlighted only if they |
| 2781 | 2804 | are surrounded by other elements. Source-highlight language definitions |
| 2782 | 2805 | provides also this feature. |
| @@ -3007,7 +3030,7 @@ with some changes. Typically you <code>include</code> another | ||
| 3007 | 3030 | language definition file and you redefine/substitute some |
| 3008 | 3031 | elements. |
| 3009 | 3032 | |
| 3010 | - <p><a name="index-redef-126"></a>When you use <code>redef</code> you erase all the previous | |
| 3033 | + <p><a name="index-redef-131"></a>When you use <code>redef</code> you erase all the previous | |
| 3011 | 3034 | definitions of that language elements with the new one. |
| 3012 | 3035 | The new language element definition will be placed exactly |
| 3013 | 3036 | in the point of the new definition. |
| @@ -3040,7 +3063,7 @@ In other words the following code | ||
| 3040 | 3063 | <pre class="example"> type = "int" |
| 3041 | 3064 | keyword = "myfoo" |
| 3042 | 3065 | </pre> |
| 3043 | - <p><a name="index-subst-127"></a>If this is not what you want, you can use <code>subst</code>, | |
| 3066 | + <p><a name="index-subst-132"></a>If this is not what you want, you can use <code>subst</code>, | |
| 3044 | 3067 | which is similar to <code>redef</code> apart from that it |
| 3045 | 3068 | replaces the previous first definition of that language |
| 3046 | 3069 | element in the exact point of that first definition |
| @@ -3102,7 +3125,7 @@ matched, since there might be another rule that matches “better”. | ||
| 3102 | 3125 | Now, everything basically reduces to the semantics of that <em>better |
| 3103 | 3126 | match</em>. |
| 3104 | 3127 | |
| 3105 | - <p><a name="index-matching-strategy-128"></a>The strategy used by source-highlight is to select the first matching rule | |
| 3128 | + <p><a name="index-matching-strategy-133"></a>The strategy used by source-highlight is to select the first matching rule | |
| 3106 | 3129 | |
| 3107 | 3130 | <ul> |
| 3108 | 3131 | <li>with empty prefix (or prefix containing only space characters, i.e., |
| @@ -3112,13 +3135,13 @@ spaces or tabs) or | ||
| 3112 | 3135 | |
| 3113 | 3136 | </ul> |
| 3114 | 3137 | |
| 3115 | - <p><a name="index-prefix-129"></a>where the <em>prefix</em> of a matched rule is the part of the examined | |
| 3138 | + <p><a name="index-prefix-134"></a>where the <em>prefix</em> of a matched rule is the part of the examined | |
| 3116 | 3139 | string that did not match<a rel="footnote" href="#fn-33" name="fnd-33"><sup>33</sup></a>. Thus, for instance, if we try to match |
| 3117 | 3140 | the simple regular expression <code>=</code> against the string |
| 3118 | 3141 | |
| 3119 | 3142 | <pre class="example"> i = 10; |
| 3120 | 3143 | </pre> |
| 3121 | - <p><a name="index-suffix-130"></a>then the prefix is <code>i </code>, including the space. Following the | |
| 3144 | + <p><a name="index-suffix-135"></a>then the prefix is <code>i </code>, including the space. Following the | |
| 3122 | 3145 | terminology of regular expression, the remaining part that did not |
| 3123 | 3146 | match, i.e., <code> 10;</code>, is the <em>suffix</em>. When source-highlight |
| 3124 | 3147 | finds a matching rule, according to the above strategy, it formats the |
| @@ -3198,28 +3221,28 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 3198 | 3221 | |
| 3199 | 3222 | <h3 class="section">7.13 Notes on regular expressions</h3> |
| 3200 | 3223 | |
| 3201 | -<p><a name="index-regular-expressions-131"></a> | |
| 3224 | +<p><a name="index-regular-expressions-136"></a> | |
| 3202 | 3225 | Although we refer to Boost documentation for such |
| 3203 | 3226 | syntax<a rel="footnote" href="#fn-34" name="fnd-34"><sup>34</sup></a>, |
| 3204 | 3227 | we want to provide here some explanations of some forms of regular |
| 3205 | 3228 | expressions that might be unknown but that are pretty useful in language |
| 3206 | 3229 | definitions. |
| 3207 | 3230 | |
| 3208 | - <p><a name="index-non_002dmarking-parenthesis-132"></a>Typically, when you need to group sub-expressions with parenthesis, but | |
| 3231 | + <p><a name="index-non_002dmarking-parenthesis-137"></a>Typically, when you need to group sub-expressions with parenthesis, but | |
| 3209 | 3232 | you don't want the parenthesis to spit out another marked |
| 3210 | 3233 | sub-expression, you can use a <em>non-marking parenthesis</em> |
| 3211 | 3234 | <code>(?:expression)</code>. This is not necessary in the language definition |
| 3212 | 3235 | syntax: even though you use standard parenthesis, source-highlight will |
| 3213 | 3236 | transform it into a non-marking parenthesis. |
| 3214 | 3237 | |
| 3215 | - <p><a name="index-marked-subexpressions-133"></a>Source-highlight translates possible <em>marked subexpressions</em>, i.e., | |
| 3238 | + <p><a name="index-marked-subexpressions-138"></a>Source-highlight translates possible <em>marked subexpressions</em>, i.e., | |
| 3216 | 3239 | those enclosed in <code>(</code> and <code>)</code>, into non-marked subexpressions |
| 3217 | 3240 | (i.e., those explained above). Since version 2.7, if you specify the |
| 3218 | 3241 | expression inside <code>`</code> the marked subexpressions are left as such |
| 3219 | 3242 | (see also <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a>). This is useful |
| 3220 | 3243 | for <em>backreferences</em> and <em>conditionals</em>. |
| 3221 | 3244 | |
| 3222 | - <p><a name="index-backreference-134"></a>An escape character followed by a digit n, where n is in the range 1-9, | |
| 3245 | + <p><a name="index-backreference-139"></a>An escape character followed by a digit n, where n is in the range 1-9, | |
| 3223 | 3246 | is a <em>backreference</em> matches the same string that was matched by |
| 3224 | 3247 | sub-expression n. For example the expression <code>^(a*).*\1$</code> will |
| 3225 | 3248 | match the string: <code>aaabbaaa</code> but not the string <code>aaabba</code>. |
| @@ -3235,7 +3258,7 @@ as in the case of Perl's substitution modifiers; thus | ||
| 3235 | 3258 | s#foo#bar#g |
| 3236 | 3259 | s@foo@bar@g |
| 3237 | 3260 | </pre> |
| 3238 | - <p><a name="index-lookahead-asserts-135"></a>A useful regular expression form is the <em>Forward Lookahead Asserts</em> | |
| 3261 | + <p><a name="index-lookahead-asserts-140"></a>A useful regular expression form is the <em>Forward Lookahead Asserts</em> | |
| 3239 | 3262 | that come in two forms, one for positive forward lookahead asserts, and |
| 3240 | 3263 | one for negative lookahead asserts: |
| 3241 | 3264 |
| @@ -3285,7 +3308,7 @@ language definition: | ||
| 3285 | 3308 | </pre> |
| 3286 | 3309 | <p class="noindent">but a cut-and-paste error had its way ;-) |
| 3287 | 3310 | |
| 3288 | - <p><a name="index-lookbehind-asserts-136"></a>You can also use <em>Lookbehind Asserts</em>: | |
| 3311 | + <p><a name="index-lookbehind-asserts-141"></a>You can also use <em>Lookbehind Asserts</em>: | |
| 3289 | 3312 | |
| 3290 | 3313 | <dl> |
| 3291 | 3314 | <dt><code>(?<=pattern)</code><dd> consumes zero characters, only if pattern could be matched against the |
| @@ -3296,7 +3319,7 @@ language definition: | ||
| 3296 | 3319 | length). |
| 3297 | 3320 | </dl> |
| 3298 | 3321 | |
| 3299 | - <p><a name="index-conditional-expressions-137"></a>Another advanced regular expression mechanism is the one of | |
| 3322 | + <p><a name="index-conditional-expressions-142"></a>Another advanced regular expression mechanism is the one of | |
| 3300 | 3323 | <em>conditional expressions</em> |
| 3301 | 3324 | |
| 3302 | 3325 | <dl> |
| @@ -3340,7 +3363,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 3340 | 3363 | |
| 3341 | 3364 | <h3 class="section">7.14 The program <samp><span class="command">check-regexp</span></samp></h3> |
| 3342 | 3365 | |
| 3343 | -<p><a name="index-g_t_0040command_007bcheck_002dregexp_007d-138"></a>Since version 2.7, the source-highlight package comes with a | |
| 3366 | +<p><a name="index-g_t_0040command_007bcheck_002dregexp_007d-143"></a>Since version 2.7, the source-highlight package comes with a | |
| 3344 | 3367 | small additional program, <samp><span class="command">check-regexp</span></samp>, that permits |
| 3345 | 3368 | testing regular expressions on the command line. |
| 3346 | 3369 |
| @@ -3422,7 +3445,7 @@ these. In order to define good output formatting style files you should | ||
| 3422 | 3445 | be aware of each language element defined by a language definition file. |
| 3423 | 3446 | Instead of having to look inside the language definition file itself |
| 3424 | 3447 | (and recursively in each included file) you can use the command line |
| 3425 | -<a name="index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-139"></a>option <code>--show-lang-elements</code><a rel="footnote" href="#fn-37" name="fnd-37"><sup>37</sup></a>, that | |
| 3448 | +<a name="index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-144"></a>option <code>--show-lang-elements</code><a rel="footnote" href="#fn-37" name="fnd-37"><sup>37</sup></a>, that | |
| 3426 | 3449 | simply prints to the standard output all the language elements that |
| 3427 | 3450 | can be highlighted with a specific language definition file. |
| 3428 | 3451 |
| @@ -3505,7 +3528,7 @@ Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definit | ||
| 3505 | 3528 | |
| 3506 | 3529 | <h3 class="section">7.17 Debugging</h3> |
| 3507 | 3530 | |
| 3508 | -<p><a name="index-debug-140"></a> | |
| 3531 | +<p><a name="index-debug-145"></a> | |
| 3509 | 3532 | When writing a language definition file, it is quite useful to be able |
| 3510 | 3533 | to debug it (by using complex regular expressions one may experience |
| 3511 | 3534 | unwanted behaviors). Since version 2.1 the command line option |
| @@ -3894,7 +3917,7 @@ files). In particular the comments definitions: | ||
| 3894 | 3917 | <i># comments with documentation tags</i> |
| 3895 | 3918 | <b>environment</b> <i>comment</i> <b>start</b> <tt>"///"</tt> <b>begin</b> |
| 3896 | 3919 | <b>include</b> <tt>"url.lang"</tt> |
| 3897 | - <b>include</b> <tt>"html.lang"</tt> | |
| 3920 | + <b>include</b> <tt>"html_simple.lang"</tt> | |
| 3898 | 3921 | <i>type</i> = <tt>'@[[:alpha:]]+'</tt> |
| 3899 | 3922 | <b>include</b> <tt>"todo.lang"</tt> |
| 3900 | 3923 | <b>end</b> |
| @@ -3904,7 +3927,7 @@ files). In particular the comments definitions: | ||
| 3904 | 3927 | <i># comments with documentation tags</i> |
| 3905 | 3928 | <b>environment</b> <i>comment</i> <b>delim</b> <tt>"/**"</tt> <tt>"*/"</tt> <b>multiline</b> <b>begin</b> |
| 3906 | 3929 | <b>include</b> <tt>"url.lang"</tt> |
| 3907 | - <b>include</b> <tt>"html.lang"</tt> | |
| 3930 | + <b>include</b> <tt>"html_simple.lang"</tt> | |
| 3908 | 3931 | <i>type</i> = <tt>'@[[:alpha:]]+'</tt> |
| 3909 | 3932 | <b>include</b> <tt>"todo.lang"</tt> |
| 3910 | 3933 | <b>end</b> |
| @@ -4492,7 +4515,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 4492 | 4515 | |
| 4493 | 4516 | <h2 class="chapter">8 Output Language Definitions</h2> |
| 4494 | 4517 | |
| 4495 | -<p><a name="index-output-language-definition-141"></a> | |
| 4518 | +<p><a name="index-output-language-definition-146"></a> | |
| 4496 | 4519 | Since version 2.1 source-highlight uses a specific syntax to specify |
| 4497 | 4520 | output formats (e.g., how to format in HTML, LaTeX, etc.). Before |
| 4498 | 4521 | version 2.1, in order to add a new output format, many C++ classes had |
| @@ -4580,7 +4603,7 @@ Up: <a rel="up" accesskey="u" href="#Output-Language-Definitions">Output La | ||
| 4580 | 4603 | |
| 4581 | 4604 | <h3 class="section">8.2 Text styles</h3> |
| 4582 | 4605 | |
| 4583 | -<p><a name="index-bold-142"></a><a name="index-italics-143"></a><a name="index-underline-144"></a><a name="index-fixed-145"></a><a name="index-notfixed-146"></a> | |
| 4606 | +<p><a name="index-bold-147"></a><a name="index-italics-148"></a><a name="index-underline-149"></a><a name="index-fixed-150"></a><a name="index-notfixed-151"></a> | |
| 4584 | 4607 | These are the text styles that one can define: |
| 4585 | 4608 | |
| 4586 | 4609 | <pre class="example"> bold |
| @@ -4598,7 +4621,7 @@ format style, <a href="#Output-format-style">Output format style</a>. | ||
| 4598 | 4621 | italics "<i>$text</i>" |
| 4599 | 4622 | underline "<u>$text</u>" |
| 4600 | 4623 | </pre> |
| 4601 | - <p><a name="index-g_t_0024text-147"></a>Inside a definition you use the special variable <code>$text</code> to specify | |
| 4624 | + <p><a name="index-g_t_0024text-152"></a>Inside a definition you use the special variable <code>$text</code> to specify | |
| 4602 | 4625 | where the actual text to be formatted has to be inserted. For instance, |
| 4603 | 4626 | the definition of <code>bold</code> above says that if you need to format the |
| 4604 | 4627 | keyword <code>class</code> in bold in HTML, the following text will be |
| @@ -4623,13 +4646,13 @@ Up: <a rel="up" accesskey="u" href="#Output-Language-Definitions">Output La | ||
| 4623 | 4646 | |
| 4624 | 4647 | <h3 class="section">8.3 Colors</h3> |
| 4625 | 4648 | |
| 4626 | -<p><a name="index-colors-148"></a><a name="index-g_t_0024style-149"></a> | |
| 4649 | +<p><a name="index-colors-153"></a><a name="index-g_t_0024style-154"></a> | |
| 4627 | 4650 | The definition for using colors during formatting requires |
| 4628 | 4651 | the definition for the <code>color</code> style |
| 4629 | 4652 | |
| 4630 | 4653 | <pre class="example"> color "..." |
| 4631 | 4654 | </pre> |
| 4632 | - <p><a name="index-background-color-150"></a>and for the <code>bgcolor</code> style<a rel="footnote" href="#fn-44" name="fnd-44"><sup>44</sup></a>: | |
| 4655 | + <p><a name="index-background-color-155"></a>and for the <code>bgcolor</code> style<a rel="footnote" href="#fn-44" name="fnd-44"><sup>44</sup></a>: | |
| 4633 | 4656 | |
| 4634 | 4657 | <pre class="example"> bgcolor "..." |
| 4635 | 4658 | </pre> |
| @@ -4730,7 +4753,7 @@ Up: <a rel="up" accesskey="u" href="#Output-Language-Definitions">Output La | ||
| 4730 | 4753 | |
| 4731 | 4754 | <h3 class="section">8.4 Anchors and References</h3> |
| 4732 | 4755 | |
| 4733 | -<p><a name="index-g_t_0024linenum-151"></a> | |
| 4756 | +<p><a name="index-g_t_0024linenum-156"></a> | |
| 4734 | 4757 | When using the command line option <code>--line-number-ref</code> |
| 4735 | 4758 | (<a href="#Invoking-source_002dhighlight">Invoking source-highlight</a>) an anchor is generated in the output |
| 4736 | 4759 | file for each line numbering. The style of the anchor is defined by the |
| @@ -4743,7 +4766,7 @@ with the actual text. | ||
| 4743 | 4766 | |
| 4744 | 4767 | <pre class="example"> anchor "<a name=\"$linenum\">$text</a>" |
| 4745 | 4768 | </pre> |
| 4746 | - <p><a name="index-g_t_0024infile-152"></a><a name="index-g_t_0024infilename-153"></a><a name="index-g_t_0024outfile-154"></a>Since version 2.2 source-highlight can also generate references to | |
| 4769 | + <p><a name="index-g_t_0024infile-157"></a><a name="index-g_t_0024infilename-158"></a><a name="index-g_t_0024outfile-159"></a>Since version 2.2 source-highlight can also generate references to | |
| 4747 | 4770 | several elements (e.g., variables, class definitions, etc.), |
| 4748 | 4771 | <a href="#Generating-References">Generating References</a>. Also in this case the definition |
| 4749 | 4772 | <code>anchor</code> is used; furthermore, the definition of <code>reference</code> |
| @@ -4801,7 +4824,7 @@ definitions of <code>anchor</code> and <code>reference</code> as you see fit. S | ||
| 4801 | 4824 | examples of outputs with references in Texinfo are shown in |
| 4802 | 4825 | <a href="#Examples">Examples</a>. |
| 4803 | 4826 | |
| 4804 | - <p><a name="index-inline_005freference-155"></a><a name="index-postline_005freference-156"></a><a name="index-postdoc_005freference-157"></a>Indeed, one can use three more definitions for <code>reference</code> that | |
| 4827 | + <p><a name="index-inline_005freference-160"></a><a name="index-postline_005freference-161"></a><a name="index-postdoc_005freference-162"></a>Indeed, one can use three more definitions for <code>reference</code> that | |
| 4805 | 4828 | corresponds to the three arguments that can be passed to |
| 4806 | 4829 | <code>--gen-references</code> command line option (<a href="#Generating-References">Generating References</a>): <code>inline_reference</code>, <code>postline_reference</code> and |
| 4807 | 4830 | <code>postdoc_reference</code>. If one of this not defined, then the same |
| @@ -4825,7 +4848,7 @@ Up: <a rel="up" accesskey="u" href="#Output-Language-Definitions">Output La | ||
| 4825 | 4848 | |
| 4826 | 4849 | <h3 class="section">8.5 One style</h3> |
| 4827 | 4850 | |
| 4828 | -<p><a name="index-one-style-158"></a> | |
| 4851 | +<p><a name="index-one-style-163"></a> | |
| 4829 | 4852 | If the output format you are defining does not have a specific style |
| 4830 | 4853 | for bold, italics, ... and for colors you can simply use the definition |
| 4831 | 4854 | <code>onestyle</code>, where you can use both <code>$style</code> and <code>$text</code>. |
| @@ -4862,7 +4885,7 @@ Up: <a rel="up" accesskey="u" href="#Output-Language-Definitions">Output La | ||
| 4862 | 4885 | |
| 4863 | 4886 | <h3 class="section">8.6 Style template</h3> |
| 4864 | 4887 | |
| 4865 | -<p><a name="index-style-template-159"></a><a name="index-style-separator-160"></a> | |
| 4888 | +<p><a name="index-style-template-164"></a><a name="index-style-separator-165"></a> | |
| 4866 | 4889 | Some output formats are based on a unique template that where the other |
| 4867 | 4890 | styles are composed; during composition the styles can be separated with |
| 4868 | 4891 | a specific separator: |
| @@ -4996,13 +5019,13 @@ Up: <a rel="up" accesskey="u" href="#Output-Language-Definitions">Output La | ||
| 4996 | 5019 | |
| 4997 | 5020 | <p>You can define the beginning and the end of an output file, with |
| 4998 | 5021 | |
| 4999 | - <p><a name="index-doctemplate-161"></a> | |
| 5022 | + <p><a name="index-doctemplate-166"></a> | |
| 5000 | 5023 | <pre class="example"> doctemplate |
| 5001 | 5024 | "...beginning..." |
| 5002 | 5025 | "...end..." |
| 5003 | 5026 | end |
| 5004 | 5027 | </pre> |
| 5005 | - <p><a name="index-nodoctemplate-162"></a> | |
| 5028 | + <p><a name="index-nodoctemplate-167"></a> | |
| 5006 | 5029 | <pre class="example"> nodoctemplate |
| 5007 | 5030 | "...beginning..." |
| 5008 | 5031 | "...end..." |
| @@ -5215,7 +5238,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 5215 | 5238 | |
| 5216 | 5239 | <h2 class="chapter">9 Generating References</h2> |
| 5217 | 5240 | |
| 5218 | -<p><a name="index-reference-163"></a><a name="index-anchor-164"></a><a name="index-ctags-165"></a> | |
| 5241 | +<p><a name="index-reference-168"></a><a name="index-anchor-169"></a><a name="index-ctags-170"></a> | |
| 5219 | 5242 | Since version 2.2 Source-highlight also produces references to fields, |
| 5220 | 5243 | variables, etc. In order to do this it relies on the program |
| 5221 | 5244 | <em>Exuberant Ctags</em>, by Darren Hiebert, available at |
| @@ -5583,7 +5606,7 @@ Up: <a rel="up" accesskey="u" href="#Examples">Examples</a> | ||
| 5583 | 5606 | |
| 5584 | 5607 | <h3 class="section">10.3 Line ranges</h3> |
| 5585 | 5608 | |
| 5586 | -<p><a name="index-line-ranges-166"></a>This is an example that uses <code>--line-range</code> command line | |
| 5609 | +<p><a name="index-line-ranges-171"></a>This is an example that uses <code>--line-range</code> command line | |
| 5587 | 5610 | option on the input file shown in See <a href="#Simple-example">Simple example</a>: |
| 5588 | 5611 | |
| 5589 | 5612 | <pre class="example"> source-highlight -f texinfo -i test.java -n \ |
| @@ -5624,7 +5647,7 @@ Up: <a rel="up" accesskey="u" href="#Examples">Examples</a> | ||
| 5624 | 5647 | |
| 5625 | 5648 | <h3 class="section">10.4 Line ranges (with context)</h3> |
| 5626 | 5649 | |
| 5627 | -<p><a name="index-line-ranges-167"></a><a name="index-range-context-168"></a><a name="index-range-separator-169"></a>This is an example that uses the command line option <code>--line-range</code> | |
| 5650 | +<p><a name="index-line-ranges-172"></a><a name="index-range-context-173"></a><a name="index-range-separator-174"></a>This is an example that uses the command line option <code>--line-range</code> | |
| 5628 | 5651 | together with the <code>--range-context</code> and <code>--range-separator</code>: |
| 5629 | 5652 | |
| 5630 | 5653 | <pre class="example"> source-highlight -f texinfo -i test.java -n \ |
| @@ -5679,7 +5702,7 @@ Up: <a rel="up" accesskey="u" href="#Examples">Examples</a> | ||
| 5679 | 5702 | |
| 5680 | 5703 | <h3 class="section">10.5 Regex ranges</h3> |
| 5681 | 5704 | |
| 5682 | -<p><a name="index-regex-ranges-170"></a>Ranges can be expressed also using regular expressions, with the command | |
| 5705 | +<p><a name="index-regex-ranges-175"></a>Ranges can be expressed also using regular expressions, with the command | |
| 5683 | 5706 | line option <code>--regex-range</code>. In this case the beginning of the |
| 5684 | 5707 | range will be detected by a line containing (in any point) a string |
| 5685 | 5708 | matching the specified regular expression; the end will be detected by a |
| @@ -5790,7 +5813,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 5790 | 5813 | |
| 5791 | 5814 | <h2 class="chapter">11 Reporting Bugs</h2> |
| 5792 | 5815 | |
| 5793 | -<p><a name="index-bugs-171"></a><a name="index-problems-172"></a> | |
| 5816 | +<p><a name="index-bugs-176"></a><a name="index-problems-177"></a> | |
| 5794 | 5817 | If you find a bug in <samp><span class="command">source-highlight</span></samp>, please send electronic |
| 5795 | 5818 | mail to |
| 5796 | 5819 |
| @@ -5816,7 +5839,7 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 5816 | 5839 | |
| 5817 | 5840 | <h2 class="chapter">12 Mailing Lists</h2> |
| 5818 | 5841 | |
| 5819 | -<p><a name="index-mailing-list-173"></a> | |
| 5842 | +<p><a name="index-mailing-list-178"></a> | |
| 5820 | 5843 | The following mailing lists are available: |
| 5821 | 5844 | |
| 5822 | 5845 | <p><code>help-source-highlight at gnu dot org</code> |
| @@ -5849,178 +5872,183 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a> | ||
| 5849 | 5872 | |
| 5850 | 5873 | <h2 class="unnumbered">Concept Index</h2> |
| 5851 | 5874 | |
| 5852 | -<p><a name="index-tail-recursion-174"></a> | |
| 5875 | +<p><a name="index-tail-recursion-179"></a> | |
| 5853 | 5876 | |
| 5854 | 5877 | <ul class="index-cp" compact> |
| 5855 | -<li><a href="#index-g_t_0040code_007b_0022expression_0022_007d-110"><code>"expression"</code></a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5856 | -<li><a href="#index-g_t_0024infile-152">$infile</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5857 | -<li><a href="#index-g_t_0024infilename-153">$infilename</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5858 | -<li><a href="#index-g_t_0024linenum-151">$linenum</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5859 | -<li><a href="#index-g_t_0024outfile-154">$outfile</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5860 | -<li><a href="#index-g_t_0024style-149">$style</a>: <a href="#Colors">Colors</a></li> | |
| 5861 | -<li><a href="#index-g_t_0024text-147">$text</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5862 | -<li><a href="#index-g_t_0040code_007b_0027expression_0027_007d-111"><code>'expression'</code></a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5863 | -<li><a href="#index-g_t_0040code_007b_002d_002ddata_002ddir_007d-99"><code>--data-dir</code></a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5864 | -<li><a href="#index-g_t_0040code_007b_002d_002ddata_002ddir_007d-70"><code>--data-dir</code></a>: <a href="#Configuration-files">Configuration files</a></li> | |
| 5878 | +<li><a href="#index-g_t_0040code_007b_0022expression_0022_007d-115"><code>"expression"</code></a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5879 | +<li><a href="#index-g_t_0024infile-157">$infile</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5880 | +<li><a href="#index-g_t_0024infilename-158">$infilename</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5881 | +<li><a href="#index-g_t_0024linenum-156">$linenum</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5882 | +<li><a href="#index-g_t_0024outfile-159">$outfile</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5883 | +<li><a href="#index-g_t_0024style-154">$style</a>: <a href="#Colors">Colors</a></li> | |
| 5884 | +<li><a href="#index-g_t_0024text-152">$text</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5885 | +<li><a href="#index-g_t_0040code_007b_0027expression_0027_007d-116"><code>'expression'</code></a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5886 | +<li><a href="#index-g_t_0040code_007b_002d_002ddata_002ddir_007d-104"><code>--data-dir</code></a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5887 | +<li><a href="#index-g_t_0040code_007b_002d_002ddata_002ddir_007d-75"><code>--data-dir</code></a>: <a href="#Configuration-files">Configuration files</a></li> | |
| 5865 | 5888 | <li><a href="#index-g_t_0040code_007b_002d_002ddata_002ddir_007d-6"><code>--data-dir</code></a>: <a href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a></li> |
| 5866 | -<li><a href="#index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-108"><code>--infer-lang</code></a>: <a href="#How-the-input-language-is-discovered">How the input language is discovered</a></li> | |
| 5867 | -<li><a href="#index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-101"><code>--infer-lang</code></a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5889 | +<li><a href="#index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-113"><code>--infer-lang</code></a>: <a href="#How-the-input-language-is-discovered">How the input language is discovered</a></li> | |
| 5890 | +<li><a href="#index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-106"><code>--infer-lang</code></a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5868 | 5891 | <li><a href="#index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-10"><code>--infer-lang</code></a>: <a href="#Perl">Perl</a></li> |
| 5869 | -<li><a href="#index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-139"><code>--show-lang-elements</code></a>: <a href="#Listing-Language-Elements">Listing Language Elements</a></li> | |
| 5870 | -<li><a href="#index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-74"><code>--show-lang-elements</code></a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5871 | -<li><a href="#index-g_t_0040code_007b_002d_002dstyle_002dcss_002dfile_007d-89"><code>--style-css-file</code></a>: <a href="#Output-format-style-using-CSS">Output format style using CSS</a></li> | |
| 5872 | -<li><a href="#index-g_t_0040code_007b_002d_002dstyle_002dfile_007d-77"><code>--style-file</code></a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5873 | -<li><a href="#index-g_t_0040code_007b_002d_002dwith_002ddoxygen_007d-36"><code>--with-doxygen</code></a>: <a href="#Installation">Installation</a></li> | |
| 5874 | -<li><a href="#index-g_t_0040code_007b_0060expression_0060_007d-112"><code>`expression`</code></a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5875 | -<li><a href="#index-anchor-164">anchor</a>: <a href="#Generating-References">Generating References</a></li> | |
| 5876 | -<li><a href="#index-ANSI-color-68">ANSI color</a>: <a href="#ANSI-color-escape-sequences">ANSI color escape sequences</a></li> | |
| 5892 | +<li><a href="#index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-144"><code>--show-lang-elements</code></a>: <a href="#Listing-Language-Elements">Listing Language Elements</a></li> | |
| 5893 | +<li><a href="#index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-79"><code>--show-lang-elements</code></a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5894 | +<li><a href="#index-g_t_0040code_007b_002d_002dstyle_002dcss_002dfile_007d-94"><code>--style-css-file</code></a>: <a href="#Output-format-style-using-CSS">Output format style using CSS</a></li> | |
| 5895 | +<li><a href="#index-g_t_0040code_007b_002d_002dstyle_002dfile_007d-82"><code>--style-file</code></a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5896 | +<li><a href="#index-g_t_0040code_007b_002d_002dwith_002ddoxygen_007d-41"><code>--with-doxygen</code></a>: <a href="#Installation">Installation</a></li> | |
| 5897 | +<li><a href="#index-g_t_0040code_007b_0060expression_0060_007d-117"><code>`expression`</code></a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5898 | +<li><a href="#index-anchor-169">anchor</a>: <a href="#Generating-References">Generating References</a></li> | |
| 5899 | +<li><a href="#index-ANSI-color-73">ANSI color</a>: <a href="#ANSI-color-escape-sequences">ANSI color escape sequences</a></li> | |
| 5877 | 5900 | <li><a href="#index-Apache-25">Apache</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5878 | -<li><a href="#index-autoconf-54">autoconf</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5879 | -<li><a href="#index-autoconf-48">autoconf</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5880 | -<li><a href="#index-automake-53">automake</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5881 | -<li><a href="#index-automake-47">automake</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5882 | -<li><a href="#index-background-color-150">background color</a>: <a href="#Colors">Colors</a></li> | |
| 5883 | -<li><a href="#index-background-color-76">background color</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5884 | -<li><a href="#index-backreference-134">backreference</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5885 | -<li><a href="#index-backreference-114">backreference</a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5886 | -<li><a href="#index-backtick-115">backtick</a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5887 | -<li><a href="#index-bash-completion-34">bash completion</a>: <a href="#Installation">Installation</a></li> | |
| 5888 | -<li><a href="#index-g_t_0040code_007bbgcolor_007d-75"><code>bgcolor</code></a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5889 | -<li><a href="#index-bold-142">bold</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5890 | -<li><a href="#index-bold-80">bold</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5891 | -<li><a href="#index-boost-52">boost</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5892 | -<li><a href="#index-boost-42">boost</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5893 | -<li><a href="#index-Boost-regex-57">Boost regex</a>: <a href="#Tips-on-installing-Boost-Regex-library">Tips on installing Boost Regex library</a></li> | |
| 5894 | -<li><a href="#index-bugs-171">bugs</a>: <a href="#Problems">Problems</a></li> | |
| 5895 | -<li><a href="#index-building-requirements-51">building requirements</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5896 | -<li><a href="#index-CGI-59">CGI</a>: <a href="#Using-source_002dhighlight-as-a-CGI">Using source-highlight as a CGI</a></li> | |
| 5897 | -<li><a href="#index-g_t_0040command_007bcheck_002dregexp_007d-138"><samp><span class="command">check-regexp</span></samp></a>: <a href="#The-program-check_002dregexp">The program check-regexp</a></li> | |
| 5901 | +<li><a href="#index-autoconf-59">autoconf</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5902 | +<li><a href="#index-autoconf-53">autoconf</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5903 | +<li><a href="#index-automake-58">automake</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5904 | +<li><a href="#index-automake-52">automake</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5905 | +<li><a href="#index-background-color-155">background color</a>: <a href="#Colors">Colors</a></li> | |
| 5906 | +<li><a href="#index-background-color-81">background color</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5907 | +<li><a href="#index-backreference-139">backreference</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5908 | +<li><a href="#index-backreference-119">backreference</a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5909 | +<li><a href="#index-backtick-120">backtick</a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5910 | +<li><a href="#index-bash-completion-39">bash completion</a>: <a href="#Installation">Installation</a></li> | |
| 5911 | +<li><a href="#index-g_t_0040code_007bbgcolor_007d-80"><code>bgcolor</code></a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5912 | +<li><a href="#index-bold-147">bold</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5913 | +<li><a href="#index-bold-85">bold</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5914 | +<li><a href="#index-boost-57">boost</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5915 | +<li><a href="#index-boost-47">boost</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5916 | +<li><a href="#index-Boost-regex-62">Boost regex</a>: <a href="#Tips-on-installing-Boost-Regex-library">Tips on installing Boost Regex library</a></li> | |
| 5917 | +<li><a href="#index-bugs-176">bugs</a>: <a href="#Problems">Problems</a></li> | |
| 5918 | +<li><a href="#index-building-requirements-56">building requirements</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5919 | +<li><a href="#index-CGI-64">CGI</a>: <a href="#Using-source_002dhighlight-as-a-CGI">Using source-highlight as a CGI</a></li> | |
| 5920 | +<li><a href="#index-g_t_0040command_007bcheck_002dregexp_007d-143"><samp><span class="command">check-regexp</span></samp></a>: <a href="#The-program-check_002dregexp">The program check-regexp</a></li> | |
| 5898 | 5921 | <li><a href="#index-code2blog-24">code2blog</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5899 | -<li><a href="#index-color-78">color</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5900 | -<li><a href="#index-colors-148">colors</a>: <a href="#Colors">Colors</a></li> | |
| 5901 | -<li><a href="#index-compilation-requirements-50">compilation requirements</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5902 | -<li><a href="#index-conditional-expressions-137">conditional expressions</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5903 | -<li><a href="#index-configuration-files-69">configuration files</a>: <a href="#Configuration-files">Configuration files</a></li> | |
| 5904 | -<li><a href="#index-Copying-conditions-61">Copying conditions</a>: <a href="#Copying">Copying</a></li> | |
| 5905 | -<li><a href="#index-cpp2html-39">cpp2html</a>: <a href="#Installation">Installation</a></li> | |
| 5906 | -<li><a href="#index-CSS-88">CSS</a>: <a href="#Output-format-style-using-CSS">Output format style using CSS</a></li> | |
| 5907 | -<li><a href="#index-ctags-165">ctags</a>: <a href="#Generating-References">Generating References</a></li> | |
| 5908 | -<li><a href="#index-debug-140">debug</a>: <a href="#Debugging">Debugging</a></li> | |
| 5909 | -<li><a href="#index-default_002elang-107">default.lang</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5922 | +<li><a href="#index-color-83">color</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5923 | +<li><a href="#index-colors-153">colors</a>: <a href="#Colors">Colors</a></li> | |
| 5924 | +<li><a href="#index-compilation-requirements-55">compilation requirements</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5925 | +<li><a href="#index-conditional-expressions-142">conditional expressions</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5926 | +<li><a href="#index-configuration-files-74">configuration files</a>: <a href="#Configuration-files">Configuration files</a></li> | |
| 5927 | +<li><a href="#index-Copying-conditions-66">Copying conditions</a>: <a href="#Copying">Copying</a></li> | |
| 5928 | +<li><a href="#index-cpp2html-44">cpp2html</a>: <a href="#Installation">Installation</a></li> | |
| 5929 | +<li><a href="#index-CSS-93">CSS</a>: <a href="#Output-format-style-using-CSS">Output format style using CSS</a></li> | |
| 5930 | +<li><a href="#index-ctags-170">ctags</a>: <a href="#Generating-References">Generating References</a></li> | |
| 5931 | +<li><a href="#index-debug-145">debug</a>: <a href="#Debugging">Debugging</a></li> | |
| 5932 | +<li><a href="#index-default_002elang-112">default.lang</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5910 | 5933 | <li><a href="#index-default_002elang-13">default.lang</a>: <a href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a></li> |
| 5911 | -<li><a href="#index-default_002estyle-73">default.style</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5912 | -<li><a href="#index-definition-order-119">definition order</a>: <a href="#Order-of-definitions">Order of definitions</a></li> | |
| 5913 | -<li><a href="#index-delimited-definitions-120">delimited definitions</a>: <a href="#Delimited-definitions">Delimited definitions</a></li> | |
| 5914 | -<li><a href="#index-direct-color-scheme-87">direct color scheme</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5915 | -<li><a href="#index-directories-33">directories</a>: <a href="#Installation">Installation</a></li> | |
| 5916 | -<li><a href="#index-DocBook-67">DocBook</a>: <a href="#DocBook-output">DocBook output</a></li> | |
| 5917 | -<li><a href="#index-doctemplate-161">doctemplate</a>: <a href="#Document-template">Document template</a></li> | |
| 5918 | -<li><a href="#index-download-45">download</a>: <a href="#Download">Download</a></li> | |
| 5919 | -<li><a href="#index-doxygen-37">doxygen</a>: <a href="#Installation">Installation</a></li> | |
| 5920 | -<li><a href="#index-dynamic-backreference-122">dynamic backreference</a>: <a href="#Dynamic-Backreferences">Dynamic Backreferences</a></li> | |
| 5921 | -<li><a href="#index-environments-125">environments</a>: <a href="#State_002fEnvironment-Definitions">State/Environment Definitions</a></li> | |
| 5922 | -<li><a href="#index-failsafe-106">failsafe</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5934 | +<li><a href="#index-default_002estyle-78">default.style</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5935 | +<li><a href="#index-definition-order-124">definition order</a>: <a href="#Order-of-definitions">Order of definitions</a></li> | |
| 5936 | +<li><a href="#index-delimited-definitions-125">delimited definitions</a>: <a href="#Delimited-definitions">Delimited definitions</a></li> | |
| 5937 | +<li><a href="#index-direct-color-scheme-92">direct color scheme</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5938 | +<li><a href="#index-directories-38">directories</a>: <a href="#Installation">Installation</a></li> | |
| 5939 | +<li><a href="#index-DocBook-72">DocBook</a>: <a href="#DocBook-output">DocBook output</a></li> | |
| 5940 | +<li><a href="#index-doctemplate-166">doctemplate</a>: <a href="#Document-template">Document template</a></li> | |
| 5941 | +<li><a href="#index-download-50">download</a>: <a href="#Download">Download</a></li> | |
| 5942 | +<li><a href="#index-doxygen-42">doxygen</a>: <a href="#Installation">Installation</a></li> | |
| 5943 | +<li><a href="#index-dynamic-backreference-127">dynamic backreference</a>: <a href="#Dynamic-Backreferences">Dynamic Backreferences</a></li> | |
| 5944 | +<li><a href="#index-environments-130">environments</a>: <a href="#State_002fEnvironment-Definitions">State/Environment Definitions</a></li> | |
| 5945 | +<li><a href="#index-failsafe-111">failsafe</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5923 | 5946 | <li><a href="#index-failsafe-12">failsafe</a>: <a href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a></li> |
| 5924 | 5947 | <li><a href="#index-features-2">features</a>: <a href="#Introduction">Introduction</a></li> |
| 5925 | -<li><a href="#index-file-inclusion-123">file inclusion</a>: <a href="#File-inclusion">File inclusion</a></li> | |
| 5948 | +<li><a href="#index-file-inclusion-128">file inclusion</a>: <a href="#File-inclusion">File inclusion</a></li> | |
| 5926 | 5949 | <li><a href="#index-Firefox-27">Firefox</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5927 | -<li><a href="#index-fixed-145">fixed</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5928 | -<li><a href="#index-fixed-83">fixed</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5950 | +<li><a href="#index-fixed-150">fixed</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5951 | +<li><a href="#index-fixed-88">fixed</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5929 | 5952 | <li><a href="#index-Fortran-8">Fortran</a>: <a href="#Fortran">Fortran</a></li> |
| 5930 | -<li><a href="#index-getting-help-98">getting help</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5931 | -<li><a href="#index-Git-46">Git</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5932 | -<li><a href="#index-gnulib-56">gnulib</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5933 | -<li><a href="#index-help-97">help</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5934 | -<li><a href="#index-HTML-63">HTML</a>: <a href="#HTML-and-XHTML-output">HTML and XHTML output</a></li> | |
| 5953 | +<li><a href="#index-getting-help-103">getting help</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5954 | +<li><a href="#index-Git-51">Git</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5955 | +<li><a href="#index-gnulib-61">gnulib</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5956 | +<li><a href="#index-help-102">help</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5957 | +<li><a href="#index-HTML-68">HTML</a>: <a href="#HTML-and-XHTML-output">HTML and XHTML output</a></li> | |
| 5935 | 5958 | <li><a href="#index-Ikiwiki-29">Ikiwiki</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5936 | -<li><a href="#index-inline_005freference-155">inline_reference</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5937 | -<li><a href="#index-installation-32">installation</a>: <a href="#Installation">Installation</a></li> | |
| 5959 | +<li><a href="#index-inline_005freference-160">inline_reference</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5960 | +<li><a href="#index-installation-37">installation</a>: <a href="#Installation">Installation</a></li> | |
| 5938 | 5961 | <li><a href="#index-introduction-1">introduction</a>: <a href="#Introduction">Introduction</a></li> |
| 5939 | -<li><a href="#index-invoking-93">invoking</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5940 | -<li><a href="#index-italics-143">italics</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5941 | -<li><a href="#index-italics-81">italics</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5942 | -<li><a href="#index-java2html-38">java2html</a>: <a href="#Installation">Installation</a></li> | |
| 5962 | +<li><a href="#index-invoking-98">invoking</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5963 | +<li><a href="#index-italics-148">italics</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5964 | +<li><a href="#index-italics-86">italics</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5965 | +<li><a href="#index-java2html-43">java2html</a>: <a href="#Installation">Installation</a></li> | |
| 5943 | 5966 | <li><a href="#index-java2html-22">java2html</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5944 | 5967 | <li><a href="#index-KDE-19">KDE</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5945 | 5968 | <li><a href="#index-Ksrc2highlight-20">Ksrc2highlight</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5946 | -<li><a href="#index-language-definition-109">language definition</a>: <a href="#Language-Definitions">Language Definitions</a></li> | |
| 5947 | -<li><a href="#index-language-inference-100">language inference</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5948 | -<li><a href="#index-language-map-91">language map</a>: <a href="#Language-map">Language map</a></li> | |
| 5949 | -<li><a href="#index-g_t_0040LaTeX_007b_007d-65">LaTeX</a>: <a href="#LaTeX-output">LaTeX output</a></li> | |
| 5950 | -<li><a href="#index-library-35">library</a>: <a href="#Installation">Installation</a></li> | |
| 5969 | +<li><a href="#index-language-definition-114">language definition</a>: <a href="#Language-Definitions">Language Definitions</a></li> | |
| 5970 | +<li><a href="#index-language-inference-105">language inference</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5971 | +<li><a href="#index-language-map-96">language map</a>: <a href="#Language-map">Language map</a></li> | |
| 5972 | +<li><a href="#index-g_t_0040LaTeX_007b_007d-70">LaTeX</a>: <a href="#LaTeX-output">LaTeX output</a></li> | |
| 5973 | +<li><a href="#index-library-40">library</a>: <a href="#Installation">Installation</a></li> | |
| 5951 | 5974 | <li><a href="#index-library-3">library</a>: <a href="#Introduction">Introduction</a></li> |
| 5952 | -<li><a href="#index-libtool-55">libtool</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5953 | -<li><a href="#index-libtool-49">libtool</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5954 | -<li><a href="#index-line-ranges-167">line ranges</a>: <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a></li> | |
| 5955 | -<li><a href="#index-line-ranges-166">line ranges</a>: <a href="#Line-ranges">Line ranges</a></li> | |
| 5956 | -<li><a href="#index-line-ranges-102">line ranges</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5957 | -<li><a href="#index-lines-118">lines</a>: <a href="#Line-wide-definitions">Line wide definitions</a></li> | |
| 5958 | -<li><a href="#index-lookahead-asserts-135">lookahead asserts</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5959 | -<li><a href="#index-lookbehind-asserts-136">lookbehind asserts</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5960 | -<li><a href="#index-mailing-list-173">mailing list</a>: <a href="#Mailing-Lists">Mailing Lists</a></li> | |
| 5961 | -<li><a href="#index-marked-subexpressions-133">marked subexpressions</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5962 | -<li><a href="#index-marked-subexpressions-113">marked subexpressions</a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5963 | -<li><a href="#index-matching-strategy-128">matching strategy</a>: <a href="#How-source_002dhighlight-works">How source-highlight works</a></li> | |
| 5964 | -<li><a href="#index-MinGW-43">MinGW</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5965 | -<li><a href="#index-MSVC-41">MSVC</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5966 | -<li><a href="#index-msys-44">msys</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5967 | -<li><a href="#index-nodoctemplate-162">nodoctemplate</a>: <a href="#Document-template">Document template</a></li> | |
| 5975 | +<li><a href="#index-libtool-60">libtool</a>: <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a></li> | |
| 5976 | +<li><a href="#index-libtool-54">libtool</a>: <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a></li> | |
| 5977 | +<li><a href="#index-line-ranges-172">line ranges</a>: <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a></li> | |
| 5978 | +<li><a href="#index-line-ranges-171">line ranges</a>: <a href="#Line-ranges">Line ranges</a></li> | |
| 5979 | +<li><a href="#index-line-ranges-107">line ranges</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5980 | +<li><a href="#index-lines-123">lines</a>: <a href="#Line-wide-definitions">Line wide definitions</a></li> | |
| 5981 | +<li><a href="#index-lookahead-asserts-140">lookahead asserts</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5982 | +<li><a href="#index-lookbehind-asserts-141">lookbehind asserts</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5983 | +<li><a href="#index-mailing-list-178">mailing list</a>: <a href="#Mailing-Lists">Mailing Lists</a></li> | |
| 5984 | +<li><a href="#index-marked-subexpressions-138">marked subexpressions</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5985 | +<li><a href="#index-marked-subexpressions-118">marked subexpressions</a>: <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a></li> | |
| 5986 | +<li><a href="#index-matching-strategy-133">matching strategy</a>: <a href="#How-source_002dhighlight-works">How source-highlight works</a></li> | |
| 5987 | +<li><a href="#index-MinGW-48">MinGW</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5988 | +<li><a href="#index-MSVC-46">MSVC</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5989 | +<li><a href="#index-msys-49">msys</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5990 | +<li><a href="#index-nodoctemplate-167">nodoctemplate</a>: <a href="#Document-template">Document template</a></li> | |
| 5968 | 5991 | <li><a href="#index-nohilite_002elang-11">nohilite.lang</a>: <a href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a></li> |
| 5969 | -<li><a href="#index-non_002dmarking-parenthesis-132">non-marking parenthesis</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5970 | -<li><a href="#index-nonsensitive-117">nonsensitive</a>: <a href="#Simple-definitions">Simple definitions</a></li> | |
| 5971 | -<li><a href="#index-noref-86">noref</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5972 | -<li><a href="#index-notfixed-146">notfixed</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5973 | -<li><a href="#index-notfixed-84">notfixed</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5974 | -<li><a href="#index-one-style-158">one style</a>: <a href="#One-style">One style</a></li> | |
| 5975 | -<li><a href="#index-options-95">options</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5976 | -<li><a href="#index-output-language-definition-141">output language definition</a>: <a href="#Output-Language-Definitions">Output Language Definitions</a></li> | |
| 5977 | -<li><a href="#index-output-language-map-92">output language map</a>: <a href="#Output-Language-map">Output Language map</a></li> | |
| 5978 | -<li><a href="#index-output-style-72">output style</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5979 | -<li><a href="#index-patching-58">patching</a>: <a href="#Patching-from-a-previous-version">Patching from a previous version</a></li> | |
| 5992 | +<li><a href="#index-non_002dmarking-parenthesis-137">non-marking parenthesis</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5993 | +<li><a href="#index-nonsensitive-122">nonsensitive</a>: <a href="#Simple-definitions">Simple definitions</a></li> | |
| 5994 | +<li><a href="#index-noref-91">noref</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5995 | +<li><a href="#index-notfixed-151">notfixed</a>: <a href="#Text-styles">Text styles</a></li> | |
| 5996 | +<li><a href="#index-notfixed-89">notfixed</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 5997 | +<li><a href="#index-one-style-163">one style</a>: <a href="#One-style">One style</a></li> | |
| 5998 | +<li><a href="#index-options-100">options</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5999 | +<li><a href="#index-output-language-definition-146">output language definition</a>: <a href="#Output-Language-Definitions">Output Language Definitions</a></li> | |
| 6000 | +<li><a href="#index-output-language-map-97">output language map</a>: <a href="#Output-Language-map">Output Language map</a></li> | |
| 6001 | +<li><a href="#index-output-style-77">output style</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 6002 | +<li><a href="#index-Pastebin-36">Pastebin</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> | |
| 6003 | +<li><a href="#index-patching-63">patching</a>: <a href="#Patching-from-a-previous-version">Patching from a previous version</a></li> | |
| 6004 | +<li><a href="#index-Perl-35">Perl</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> | |
| 5980 | 6005 | <li><a href="#index-Perl-9">Perl</a>: <a href="#Perl">Perl</a></li> |
| 5981 | 6006 | <li><a href="#index-Php-31">Php</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5982 | -<li><a href="#index-postdoc_005freference-157">postdoc_reference</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5983 | -<li><a href="#index-postline_005freference-156">postline_reference</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 5984 | -<li><a href="#index-prefix-129">prefix</a>: <a href="#How-source_002dhighlight-works">How source-highlight works</a></li> | |
| 5985 | -<li><a href="#index-problems-172">problems</a>: <a href="#Problems">Problems</a></li> | |
| 5986 | -<li><a href="#index-qmake-40">qmake</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 6007 | +<li><a href="#index-postdoc_005freference-162">postdoc_reference</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 6008 | +<li><a href="#index-postline_005freference-161">postline_reference</a>: <a href="#Anchors-and-References">Anchors and References</a></li> | |
| 6009 | +<li><a href="#index-prefix-134">prefix</a>: <a href="#How-source_002dhighlight-works">How source-highlight works</a></li> | |
| 6010 | +<li><a href="#index-problems-177">problems</a>: <a href="#Problems">Problems</a></li> | |
| 6011 | +<li><a href="#index-PyQt-34">PyQt</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> | |
| 6012 | +<li><a href="#index-Python-33">Python</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> | |
| 6013 | +<li><a href="#index-qmake-45">qmake</a>: <a href="#Building-with-qmake">Building with qmake</a></li> | |
| 5987 | 6014 | <li><a href="#index-QSource_002dHighlight-16">QSource-Highlight</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5988 | 6015 | <li><a href="#index-Qt-15">Qt</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5989 | -<li><a href="#index-range-context-168">range context</a>: <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a></li> | |
| 5990 | -<li><a href="#index-range-context-103">range context</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5991 | -<li><a href="#index-range-separator-169">range separator</a>: <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a></li> | |
| 5992 | -<li><a href="#index-range-separator-104">range separator</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 6016 | +<li><a href="#index-range-context-173">range context</a>: <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a></li> | |
| 6017 | +<li><a href="#index-range-context-108">range context</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 6018 | +<li><a href="#index-range-separator-174">range separator</a>: <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a></li> | |
| 6019 | +<li><a href="#index-range-separator-109">range separator</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5993 | 6020 | <li><a href="#index-RapidWeaver-26">RapidWeaver</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 5994 | -<li><a href="#index-redef-126">redef</a>: <a href="#Redefinitions-and-Substitutions">Redefinitions and Substitutions</a></li> | |
| 5995 | -<li><a href="#index-reference-163">reference</a>: <a href="#Generating-References">Generating References</a></li> | |
| 5996 | -<li><a href="#index-regex-ranges-170">regex ranges</a>: <a href="#Regex-ranges">Regex ranges</a></li> | |
| 5997 | -<li><a href="#index-regex-ranges-105">regex ranges</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 5998 | -<li><a href="#index-regular-expressions-131">regular expressions</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 5999 | -<li><a href="#index-rpm-60">rpm</a>: <a href="#Building-_002erpm">Building .rpm</a></li> | |
| 6000 | -<li><a href="#index-sample-62">sample</a>: <a href="#Simple-Usage">Simple Usage</a></li> | |
| 6021 | +<li><a href="#index-redef-131">redef</a>: <a href="#Redefinitions-and-Substitutions">Redefinitions and Substitutions</a></li> | |
| 6022 | +<li><a href="#index-reference-168">reference</a>: <a href="#Generating-References">Generating References</a></li> | |
| 6023 | +<li><a href="#index-regex-ranges-175">regex ranges</a>: <a href="#Regex-ranges">Regex ranges</a></li> | |
| 6024 | +<li><a href="#index-regex-ranges-110">regex ranges</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 6025 | +<li><a href="#index-regular-expressions-136">regular expressions</a>: <a href="#Notes-on-regular-expressions">Notes on regular expressions</a></li> | |
| 6026 | +<li><a href="#index-rpm-65">rpm</a>: <a href="#Building-_002erpm">Building .rpm</a></li> | |
| 6027 | +<li><a href="#index-sample-67">sample</a>: <a href="#Simple-Usage">Simple Usage</a></li> | |
| 6001 | 6028 | <li><a href="#index-SHJS-23">SHJS</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 6002 | -<li><a href="#index-simple-language-definition-116">simple language definition</a>: <a href="#Simple-definitions">Simple definitions</a></li> | |
| 6029 | +<li><a href="#index-simple-language-definition-121">simple language definition</a>: <a href="#Simple-definitions">Simple definitions</a></li> | |
| 6030 | +<li><a href="#index-SIP-32">SIP</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> | |
| 6003 | 6031 | <li><a href="#index-Source_002dHighlight_002dQt-14">Source-Highlight-Qt</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 6004 | 6032 | <li><a href="#index-source_002dhighlight_002dsettings-4">source-highlight-settings</a>: <a href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a></li> |
| 6005 | 6033 | <li><a href="#index-source_002dhighlight_002econf-5">source-highlight.conf</a>: <a href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a></li> |
| 6006 | -<li><a href="#index-g_t_0040code_007bSOURCE_005fHIGHLIGHT_005fDATADIR_007d-71"><code>SOURCE_HIGHLIGHT_DATADIR</code></a>: <a href="#Configuration-files">Configuration files</a></li> | |
| 6034 | +<li><a href="#index-g_t_0040code_007bSOURCE_005fHIGHLIGHT_005fDATADIR_007d-76"><code>SOURCE_HIGHLIGHT_DATADIR</code></a>: <a href="#Configuration-files">Configuration files</a></li> | |
| 6007 | 6035 | <li><a href="#index-g_t_0040code_007bSOURCE_005fHIGHLIGHT_005fDATADIR_007d-7"><code>SOURCE_HIGHLIGHT_DATADIR</code></a>: <a href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a></li> |
| 6008 | 6036 | <li><a href="#index-SourceHighlightIDE-18">SourceHighlightIDE</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 6009 | -<li><a href="#index-states-124">states</a>: <a href="#State_002fEnvironment-Definitions">State/Environment Definitions</a></li> | |
| 6010 | -<li><a href="#index-style-separator-160">style separator</a>: <a href="#Style-template">Style template</a></li> | |
| 6011 | -<li><a href="#index-style-template-159">style template</a>: <a href="#Style-template">Style template</a></li> | |
| 6012 | -<li><a href="#index-style_002edefaults-90">style.defaults</a>: <a href="#Default-Styles">Default Styles</a></li> | |
| 6013 | -<li><a href="#index-subst-127">subst</a>: <a href="#Redefinitions-and-Substitutions">Redefinitions and Substitutions</a></li> | |
| 6014 | -<li><a href="#index-suffix-130">suffix</a>: <a href="#How-source_002dhighlight-works">How source-highlight works</a></li> | |
| 6015 | -<li><a href="#index-tail-recursion-174">tail recursion</a>: <a href="#Concept-Index">Concept Index</a></li> | |
| 6016 | -<li><a href="#index-Texinfo-66">Texinfo</a>: <a href="#Texinfo-output">Texinfo output</a></li> | |
| 6017 | -<li><a href="#index-underline-144">underline</a>: <a href="#Text-styles">Text styles</a></li> | |
| 6018 | -<li><a href="#index-underline-82">underline</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 6019 | -<li><a href="#index-usage-96">usage</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 6020 | -<li><a href="#index-variables-121">variables</a>: <a href="#Variable-definitions">Variable definitions</a></li> | |
| 6021 | -<li><a href="#index-version-94">version</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 6037 | +<li><a href="#index-states-129">states</a>: <a href="#State_002fEnvironment-Definitions">State/Environment Definitions</a></li> | |
| 6038 | +<li><a href="#index-style-separator-165">style separator</a>: <a href="#Style-template">Style template</a></li> | |
| 6039 | +<li><a href="#index-style-template-164">style template</a>: <a href="#Style-template">Style template</a></li> | |
| 6040 | +<li><a href="#index-style_002edefaults-95">style.defaults</a>: <a href="#Default-Styles">Default Styles</a></li> | |
| 6041 | +<li><a href="#index-subst-132">subst</a>: <a href="#Redefinitions-and-Substitutions">Redefinitions and Substitutions</a></li> | |
| 6042 | +<li><a href="#index-suffix-135">suffix</a>: <a href="#How-source_002dhighlight-works">How source-highlight works</a></li> | |
| 6043 | +<li><a href="#index-tail-recursion-179">tail recursion</a>: <a href="#Concept-Index">Concept Index</a></li> | |
| 6044 | +<li><a href="#index-Texinfo-71">Texinfo</a>: <a href="#Texinfo-output">Texinfo output</a></li> | |
| 6045 | +<li><a href="#index-underline-149">underline</a>: <a href="#Text-styles">Text styles</a></li> | |
| 6046 | +<li><a href="#index-underline-87">underline</a>: <a href="#Output-format-style">Output format style</a></li> | |
| 6047 | +<li><a href="#index-usage-101">usage</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 6048 | +<li><a href="#index-variables-126">variables</a>: <a href="#Variable-definitions">Variable definitions</a></li> | |
| 6049 | +<li><a href="#index-version-99">version</a>: <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a></li> | |
| 6022 | 6050 | <li><a href="#index-Wiki-28">Wiki</a>: <a href="#Related-Software-and-Links">Related Software and Links</a></li> |
| 6023 | -<li><a href="#index-XHTML-64">XHTML</a>: <a href="#HTML-and-XHTML-output">HTML and XHTML output</a></li> | |
| 6051 | +<li><a href="#index-XHTML-69">XHTML</a>: <a href="#HTML-and-XHTML-output">HTML and XHTML output</a></li> | |
| 6024 | 6052 | </ul> |
| 6025 | 6053 | <div class="shortcontents"> |
| 6026 | 6054 | <h2>Short Contents</h2> |
| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | This is ../../doc/source-highlight.info, produced by makeinfo version |
| 2 | 2 | 4.13 from ../../doc/source-highlight.texinfo. |
| 3 | 3 | |
| 4 | -This manual is for GNU Source-highlight (version 3.1.3, 17 December | |
| 5 | -2009), which given a source file, produces a document with syntax | |
| 6 | -highlighting. | |
| 4 | +This manual is for GNU Source-highlight (version 3.1.4, 14 May 2010), | |
| 5 | +which given a source file, produces a document with syntax highlighting. | |
| 7 | 6 | |
| 8 | 7 | Copyright (C) 2005-2008 Lorenzo Bettini, |
| 9 | 8 | `http://www.lorenzobettini.it'. |
| @@ -34,13 +33,12 @@ GNU Source-highlight | ||
| 34 | 33 | GNU Source-highlight, given a source file, produces a document with |
| 35 | 34 | syntax highlighting. |
| 36 | 35 | |
| 37 | - This is Edition 3.1.3 of the Source-highlight manual. | |
| 36 | + This is Edition 3.1.4 of the Source-highlight manual. | |
| 38 | 37 | |
| 39 | - This file documents GNU Source-highlight version 3.1.3. | |
| 38 | + This file documents GNU Source-highlight version 3.1.4. | |
| 40 | 39 | |
| 41 | - This manual is for GNU Source-highlight (version 3.1.3, 17 December | |
| 42 | -2009), which given a source file, produces a document with syntax | |
| 43 | -highlighting. | |
| 40 | + This manual is for GNU Source-highlight (version 3.1.4, 14 May 2010), | |
| 41 | +which given a source file, produces a document with syntax highlighting. | |
| 44 | 42 | |
| 45 | 43 | Copyright (C) 2005-2008 Lorenzo Bettini, |
| 46 | 44 | `http://www.lorenzobettini.it'. |
| @@ -116,7 +114,7 @@ File: source-highlight.info, Node: Supported languages, Next: The program sour | ||
| 116 | 114 | ======================= |
| 117 | 115 | |
| 118 | 116 | The complete list of languages (indeed, file extensions) natively |
| 119 | -supported by this version of Source-highlight (3.1.3), as reported by | |
| 117 | +supported by this version of Source-highlight (3.1.4), as reported by | |
| 120 | 118 | `--lang-list', is the following: |
| 121 | 119 | |
| 122 | 120 | C = cpp.lang |
| @@ -148,6 +146,7 @@ supported by this version of Source-highlight (3.1.3), as reported by | ||
| 148 | 146 | csh = sh.lang |
| 149 | 147 | csharp = csharp.lang |
| 150 | 148 | css = css.lang |
| 149 | + ctp = php.lang | |
| 151 | 150 | d = d.lang |
| 152 | 151 | desktop = desktop.lang |
| 153 | 152 | diff = diff.lang |
| @@ -189,6 +188,8 @@ supported by this version of Source-highlight (3.1.3), as reported by | ||
| 189 | 188 | ldif = ldap.lang |
| 190 | 189 | lex = flex.lang |
| 191 | 190 | lgt = logtalk.lang |
| 191 | + lhs = haskell_literate.lang | |
| 192 | + lisp = lisp.lang | |
| 192 | 193 | ll = flex.lang |
| 193 | 194 | log = log.lang |
| 194 | 195 | logtalk = logtalk.lang |
| @@ -219,6 +220,8 @@ supported by this version of Source-highlight (3.1.3), as reported by | ||
| 219 | 220 | prg = clipper.lang |
| 220 | 221 | prolog = prolog.lang |
| 221 | 222 | properties = properties.lang |
| 223 | + proto = proto.lang | |
| 224 | + protobuf = proto.lang | |
| 222 | 225 | ps = postscript.lang |
| 223 | 226 | py = python.lang |
| 224 | 227 | python = python.lang |
| @@ -248,6 +251,7 @@ supported by this version of Source-highlight (3.1.3), as reported by | ||
| 248 | 251 | tk = tcl.lang |
| 249 | 252 | txt = nohilite.lang |
| 250 | 253 | ui = xml.lang |
| 254 | + vala = vala.lang | |
| 251 | 255 | vbs = vbscript.lang |
| 252 | 256 | vbscript = vbscript.lang |
| 253 | 257 | xhtml = xml.lang |
| @@ -258,7 +262,7 @@ supported by this version of Source-highlight (3.1.3), as reported by | ||
| 258 | 262 | yy = bison.lang |
| 259 | 263 | |
| 260 | 264 | The complete list of output formats natively supported by this |
| 261 | -version of Source-highlight (3.1.3), as reported by `--outlang-list', | |
| 265 | +version of Source-highlight (3.1.4), as reported by `--outlang-list', | |
| 262 | 266 | is the following: |
| 263 | 267 | |
| 264 | 268 | docbook = docbook.outlang |
| @@ -478,8 +482,9 @@ files): | ||
| 478 | 482 | |
| 479 | 483 | `http://qsrchilite.sourceforge.net'. |
| 480 | 484 | |
| 481 | - * SourceHighlightIDE is a small IDE (for KDE) I wrote for developing | |
| 482 | - and debugging new language definitions for source-highlight: | |
| 485 | + * SourceHighlightIDE is a small IDE (based on Qt4 and | |
| 486 | + Source-highlight-qt) I wrote for developing and debugging new | |
| 487 | + language definitions for source-highlight: | |
| 483 | 488 | |
| 484 | 489 | `http://srchighliteide.sourceforge.net'. |
| 485 | 490 |
| @@ -540,6 +545,20 @@ files): | ||
| 540 | 545 | |
| 541 | 546 | `http://code.google.com/p/php-source-highlight/' |
| 542 | 547 | |
| 548 | + * Roberto Alsina made a partial python binding using SIP so that you | |
| 549 | + can use Source-Highlight-Qt in PyQt programs. | |
| 550 | + | |
| 551 | + `http://marave.googlecode.com/svn/trunk/marave/highlight/' | |
| 552 | + | |
| 553 | + * A perl binding for source-highlight is available at CPAN: | |
| 554 | + | |
| 555 | + `http://search.cpan.org/perldoc?Syntax::SourceHighlight' | |
| 556 | + | |
| 557 | + * Danijel Tasov wrote a pastebin service based on perl | |
| 558 | + source-highlight binding: | |
| 559 | + | |
| 560 | + `http://pb.rbfh.de' | |
| 561 | + | |
| 543 | 562 | |
| 544 | 563 | |
| 545 | 564 | File: source-highlight.info, Node: Installation, Next: Copying, Prev: Introduction, Up: Top |
| @@ -638,8 +657,8 @@ without using a Unix shell, and in particular to build Source-highlight with | ||
| 638 | 657 | Microsoft MSVC compiler. You should use this method only if you don't |
| 639 | 658 | have a Unix shell or if you really need to use the MSVC compiler (e.g., |
| 640 | 659 | if you want to build Source-highlight library to be used in MSVC based |
| 641 | -programs. You still need the boost regex library, and if you use MSVC, | |
| 642 | -you can find installation packages for this library at | |
| 660 | +programs). You still need the boost regex library, and if you use | |
| 661 | +MSVC, you can find installation packages for this library at | |
| 643 | 662 | `http://www.boostpro.com'. |
| 644 | 663 | |
| 645 | 664 | This build mechanism is still experimental, and, when using MSVC, |
| @@ -975,11 +994,11 @@ File: source-highlight.info, Node: Building .rpm, Prev: Using source-highlight | ||
| 975 | 994 | Christian W. Zuckschwerdt added support for building an .rpm and an |
| 976 | 995 | .rpm.src. You can issue the following command |
| 977 | 996 | |
| 978 | - rpmbuild -tb source-highlight-3.1.3.tar.gz | |
| 997 | + rpmbuild -tb source-highlight-3.1.4.tar.gz | |
| 979 | 998 | |
| 980 | 999 | for building an .rpm with binaries and |
| 981 | 1000 | |
| 982 | - rpmbuild -ts source-highlight-3.1.3.tar.gz | |
| 1001 | + rpmbuild -ts source-highlight-3.1.4.tar.gz | |
| 983 | 1002 | |
| 984 | 1003 | for building an .rpm.src with sources. |
| 985 | 1004 |
| @@ -1220,6 +1239,7 @@ on Language Definitions::): | ||
| 1220 | 1239 | function black b; // for function calls and declarations |
| 1221 | 1240 | cbracket red; // for block brackets (e.g. {, }) |
| 1222 | 1241 | todo bg:cyan b; // for TODO and FIXME |
| 1242 | + code bg:brightgreen b; // for code snippets | |
| 1223 | 1243 | |
| 1224 | 1244 | //Predefined variables and functions (for instance glsl) |
| 1225 | 1245 | predef_var darkblue ; |
| @@ -1588,6 +1608,7 @@ Source-highlight: | ||
| 1588 | 1608 | label = preproc |
| 1589 | 1609 | error = string |
| 1590 | 1610 | warning = type |
| 1611 | + code = preproc | |
| 1591 | 1612 | |
| 1592 | 1613 | In this case the style for the element `preproc' will default to the |
| 1593 | 1614 | style of the element `keyword'. |
| @@ -3586,7 +3607,7 @@ In particular the comments definitions: | ||
| 3586 | 3607 | # comments with documentation tags |
| 3587 | 3608 | environment comment start "///" begin |
| 3588 | 3609 | include "url.lang" |
| 3589 | - include "html.lang" | |
| 3610 | + include "html_simple.lang" | |
| 3590 | 3611 | type = '@[[:alpha:]]+' |
| 3591 | 3612 | include "todo.lang" |
| 3592 | 3613 | end |
| @@ -3596,7 +3617,7 @@ In particular the comments definitions: | ||
| 3596 | 3617 | # comments with documentation tags |
| 3597 | 3618 | environment comment delim "/**" "*/" multiline begin |
| 3598 | 3619 | include "url.lang" |
| 3599 | - include "html.lang" | |
| 3620 | + include "html_simple.lang" | |
| 3600 | 3621 | type = '@[[:alpha:]]+' |
| 3601 | 3622 | include "todo.lang" |
| 3602 | 3623 | end |
| @@ -5408,7 +5429,7 @@ Concept Index | ||
| 5408 | 5429 | * --show-lang-elements: Output format style. (line 9) |
| 5409 | 5430 | * --style-css-file: Output format style using CSS. |
| 5410 | 5431 | (line 10) |
| 5411 | -* --style-file: Output format style. (line 98) | |
| 5432 | +* --style-file: Output format style. (line 99) | |
| 5412 | 5433 | * --with-doxygen: Installation. (line 57) |
| 5413 | 5434 | * `expression`: Ways of specifying regular expressions. |
| 5414 | 5435 | (line 59) |
| @@ -5417,7 +5438,7 @@ Concept Index | ||
| 5417 | 5438 | * ANSI color: ANSI color escape sequences. |
| 5418 | 5439 | (line 6) |
| 5419 | 5440 | * Apache: Related Software and Links. |
| 5420 | - (line 62) | |
| 5441 | + (line 63) | |
| 5421 | 5442 | * autoconf <1>: What you need to build source-highlight. |
| 5422 | 5443 | (line 28) |
| 5423 | 5444 | * autoconf: Anonymous Git Checkout. |
| @@ -5437,7 +5458,7 @@ Concept Index | ||
| 5437 | 5458 | * bash completion: Installation. (line 48) |
| 5438 | 5459 | * bgcolor: Output format style. (line 12) |
| 5439 | 5460 | * bold <1>: Text styles. (line 6) |
| 5440 | -* bold: Output format style. (line 115) | |
| 5461 | +* bold: Output format style. (line 116) | |
| 5441 | 5462 | * boost <1>: What you need to build source-highlight. |
| 5442 | 5463 | (line 6) |
| 5443 | 5464 | * boost: Building with qmake. (line 13) |
| @@ -5451,8 +5472,8 @@ Concept Index | ||
| 5451 | 5472 | * check-regexp: The program check-regexp. |
| 5452 | 5473 | (line 6) |
| 5453 | 5474 | * code2blog: Related Software and Links. |
| 5454 | - (line 57) | |
| 5455 | -* color: Output format style. (line 106) | |
| 5475 | + (line 58) | |
| 5476 | +* color: Output format style. (line 107) | |
| 5456 | 5477 | * colors: Colors. (line 6) |
| 5457 | 5478 | * compilation requirements: What you need to build source-highlight. |
| 5458 | 5479 | (line 6) |
| @@ -5475,7 +5496,7 @@ Concept Index | ||
| 5475 | 5496 | (line 6) |
| 5476 | 5497 | * delimited definitions: Delimited definitions. |
| 5477 | 5498 | (line 6) |
| 5478 | -* direct color scheme: Output format style. (line 190) | |
| 5499 | +* direct color scheme: Output format style. (line 191) | |
| 5479 | 5500 | * directories: Installation. (line 27) |
| 5480 | 5501 | * DocBook: DocBook output. (line 6) |
| 5481 | 5502 | * doctemplate: Document template. (line 8) |
| @@ -5492,9 +5513,9 @@ Concept Index | ||
| 5492 | 5513 | * features: Introduction. (line 6) |
| 5493 | 5514 | * file inclusion: File inclusion. (line 6) |
| 5494 | 5515 | * Firefox: Related Software and Links. |
| 5495 | - (line 75) | |
| 5516 | + (line 76) | |
| 5496 | 5517 | * fixed <1>: Text styles. (line 6) |
| 5497 | -* fixed: Output format style. (line 115) | |
| 5518 | +* fixed: Output format style. (line 116) | |
| 5498 | 5519 | * Fortran: Fortran. (line 6) |
| 5499 | 5520 | * getting help: Invoking source-highlight. |
| 5500 | 5521 | (line 6) |
| @@ -5507,7 +5528,7 @@ Concept Index | ||
| 5507 | 5528 | * HTML: HTML and XHTML output. |
| 5508 | 5529 | (line 6) |
| 5509 | 5530 | * Ikiwiki: Related Software and Links. |
| 5510 | - (line 80) | |
| 5531 | + (line 81) | |
| 5511 | 5532 | * inline_reference: Anchors and References. |
| 5512 | 5533 | (line 72) |
| 5513 | 5534 | * installation: Installation. (line 6) |
| @@ -5515,14 +5536,14 @@ Concept Index | ||
| 5515 | 5536 | * invoking: Invoking source-highlight. |
| 5516 | 5537 | (line 6) |
| 5517 | 5538 | * italics <1>: Text styles. (line 6) |
| 5518 | -* italics: Output format style. (line 115) | |
| 5539 | +* italics: Output format style. (line 116) | |
| 5519 | 5540 | * java2html <1>: Installation. (line 66) |
| 5520 | 5541 | * java2html: Related Software and Links. |
| 5521 | - (line 41) | |
| 5542 | + (line 42) | |
| 5522 | 5543 | * KDE: Related Software and Links. |
| 5523 | 5544 | (line 30) |
| 5524 | 5545 | * Ksrc2highlight: Related Software and Links. |
| 5525 | - (line 35) | |
| 5546 | + (line 36) | |
| 5526 | 5547 | * language definition: Language Definitions. |
| 5527 | 5548 | (line 6) |
| 5528 | 5549 | * language inference: Invoking source-highlight. |
| @@ -5562,9 +5583,9 @@ Concept Index | ||
| 5562 | 5583 | * non-marking parenthesis: Notes on regular expressions. |
| 5563 | 5584 | (line 11) |
| 5564 | 5585 | * nonsensitive: Simple definitions. (line 76) |
| 5565 | -* noref: Output format style. (line 163) | |
| 5586 | +* noref: Output format style. (line 164) | |
| 5566 | 5587 | * notfixed <1>: Text styles. (line 6) |
| 5567 | -* notfixed: Output format style. (line 115) | |
| 5588 | +* notfixed: Output format style. (line 116) | |
| 5568 | 5589 | * one style: One style. (line 6) |
| 5569 | 5590 | * options: Invoking source-highlight. |
| 5570 | 5591 | (line 6) |
| @@ -5572,11 +5593,15 @@ Concept Index | ||
| 5572 | 5593 | (line 6) |
| 5573 | 5594 | * output language map: Output Language map. (line 6) |
| 5574 | 5595 | * output style: Output format style. (line 6) |
| 5596 | +* Pastebin: Related Software and Links. | |
| 5597 | + (line 102) | |
| 5575 | 5598 | * patching: Patching from a previous version. |
| 5576 | 5599 | (line 6) |
| 5600 | +* Perl <1>: Related Software and Links. | |
| 5601 | + (line 98) | |
| 5577 | 5602 | * Perl: Perl. (line 6) |
| 5578 | 5603 | * Php: Related Software and Links. |
| 5579 | - (line 86) | |
| 5604 | + (line 87) | |
| 5580 | 5605 | * postdoc_reference: Anchors and References. |
| 5581 | 5606 | (line 72) |
| 5582 | 5607 | * postline_reference: Anchors and References. |
| @@ -5584,6 +5609,10 @@ Concept Index | ||
| 5584 | 5609 | * prefix: How source-highlight works. |
| 5585 | 5610 | (line 32) |
| 5586 | 5611 | * problems: Problems. (line 6) |
| 5612 | +* PyQt: Related Software and Links. | |
| 5613 | + (line 93) | |
| 5614 | +* Python: Related Software and Links. | |
| 5615 | + (line 93) | |
| 5587 | 5616 | * qmake: Building with qmake. (line 6) |
| 5588 | 5617 | * QSource-Highlight: Related Software and Links. |
| 5589 | 5618 | (line 19) |
| @@ -5598,7 +5627,7 @@ Concept Index | ||
| 5598 | 5627 | * range separator: Invoking source-highlight. |
| 5599 | 5628 | (line 102) |
| 5600 | 5629 | * RapidWeaver: Related Software and Links. |
| 5601 | - (line 68) | |
| 5630 | + (line 69) | |
| 5602 | 5631 | * redef: Redefinitions and Substitutions. |
| 5603 | 5632 | (line 11) |
| 5604 | 5633 | * reference: Generating References. |
| @@ -5611,8 +5640,10 @@ Concept Index | ||
| 5611 | 5640 | * rpm: Building .rpm. (line 6) |
| 5612 | 5641 | * sample: Simple Usage. (line 6) |
| 5613 | 5642 | * SHJS: Related Software and Links. |
| 5614 | - (line 50) | |
| 5643 | + (line 51) | |
| 5615 | 5644 | * simple language definition: Simple definitions. (line 6) |
| 5645 | +* SIP: Related Software and Links. | |
| 5646 | + (line 93) | |
| 5616 | 5647 | * Source-Highlight-Qt: Related Software and Links. |
| 5617 | 5648 | (line 11) |
| 5618 | 5649 | * source-highlight-settings: The program source-highlight-settings. |
| @@ -5636,7 +5667,7 @@ Concept Index | ||
| 5636 | 5667 | * tail recursion: Concept Index. (line 6) |
| 5637 | 5668 | * Texinfo: Texinfo output. (line 6) |
| 5638 | 5669 | * underline <1>: Text styles. (line 6) |
| 5639 | -* underline: Output format style. (line 115) | |
| 5670 | +* underline: Output format style. (line 116) | |
| 5640 | 5671 | * usage: Invoking source-highlight. |
| 5641 | 5672 | (line 6) |
| 5642 | 5673 | * variables: Variable definitions. |
| @@ -5644,160 +5675,160 @@ Concept Index | ||
| 5644 | 5675 | * version: Invoking source-highlight. |
| 5645 | 5676 | (line 6) |
| 5646 | 5677 | * Wiki: Related Software and Links. |
| 5647 | - (line 80) | |
| 5678 | + (line 81) | |
| 5648 | 5679 | * XHTML: HTML and XHTML output. |
| 5649 | 5680 | (line 6) |
| 5650 | 5681 | |
| 5651 | 5682 | |
| 5652 | 5683 | |
| 5653 | 5684 | Tag Table: |
| 5654 | -Node: Top1133 | |
| 5655 | -Node: Introduction3056 | |
| 5656 | -Node: Supported languages4630 | |
| 5657 | -Ref: Supported languages-Footnote-19499 | |
| 5658 | -Node: The program source-highlight-settings9672 | |
| 5659 | -Node: Notes on some languages10629 | |
| 5660 | -Node: Fortran11186 | |
| 5661 | -Node: Perl11907 | |
| 5662 | -Node: Using source-highlight as a simple formatter12979 | |
| 5663 | -Ref: Using source-highlight as a simple formatter-Footnote-116275 | |
| 5664 | -Node: Related Software and Links16400 | |
| 5665 | -Node: Installation19988 | |
| 5666 | -Node: Building with qmake22910 | |
| 5667 | -Node: Download25252 | |
| 5668 | -Node: Anonymous Git Checkout26715 | |
| 5669 | -Ref: Anonymous Git Checkout-Footnote-128141 | |
| 5670 | -Node: What you need to build source-highlight28263 | |
| 5671 | -Ref: What you need to build source-highlight-Footnote-130517 | |
| 5672 | -Ref: What you need to build source-highlight-Footnote-230564 | |
| 5673 | -Ref: What you need to build source-highlight-Footnote-330611 | |
| 5674 | -Ref: What you need to build source-highlight-Footnote-430657 | |
| 5675 | -Node: Tips on installing Boost Regex library30702 | |
| 5676 | -Ref: Tips on installing Boost Regex library-Footnote-135103 | |
| 5677 | -Ref: Tips on installing Boost Regex library-Footnote-235250 | |
| 5678 | -Node: Patching from a previous version35417 | |
| 5679 | -Node: Using source-highlight with less36060 | |
| 5680 | -Node: Using source-highlight as a CGI36717 | |
| 5681 | -Node: Building .rpm37232 | |
| 5682 | -Node: Copying37681 | |
| 5683 | -Node: Simple Usage38107 | |
| 5684 | -Ref: Simple Usage-Footnote-140693 | |
| 5685 | -Node: HTML and XHTML output40860 | |
| 5686 | -Node: LaTeX output41879 | |
| 5687 | -Node: Texinfo output42392 | |
| 5688 | -Node: DocBook output42814 | |
| 5689 | -Node: ANSI color escape sequences43132 | |
| 5690 | -Node: Configuration files43602 | |
| 5691 | -Node: Output format style45300 | |
| 5692 | -Ref: Output format style-Footnote-152318 | |
| 5693 | -Ref: Output format style-Footnote-252466 | |
| 5694 | -Ref: Output format style-Footnote-352493 | |
| 5695 | -Ref: Output format style-Footnote-452659 | |
| 5696 | -Ref: Output format style-Footnote-552686 | |
| 5697 | -Ref: Output format style-Footnote-652780 | |
| 5698 | -Ref: Output format style-Footnote-752848 | |
| 5699 | -Ref: Output format style-Footnote-852914 | |
| 5700 | -Node: Output format style using CSS52941 | |
| 5701 | -Node: Default Styles57457 | |
| 5702 | -Ref: Default Styles-Footnote-159112 | |
| 5703 | -Node: Language map59139 | |
| 5704 | -Node: Language definition files60032 | |
| 5705 | -Ref: Language definition files-Footnote-160600 | |
| 5706 | -Node: Output Language map60697 | |
| 5707 | -Node: Output Language definition files61819 | |
| 5708 | -Ref: Output Language definition files-Footnote-162622 | |
| 5709 | -Node: Developing your own definition files62723 | |
| 5710 | -Node: Invoking source-highlight63555 | |
| 5711 | -Ref: Invoking source-highlight-Footnote-171627 | |
| 5712 | -Ref: Invoking source-highlight-Footnote-271784 | |
| 5713 | -Node: How the input language is discovered71846 | |
| 5714 | -Ref: How the input language is discovered-Footnote-173892 | |
| 5715 | -Ref: How the input language is discovered-Footnote-273919 | |
| 5716 | -Node: Language Definitions73948 | |
| 5717 | -Node: Ways of specifying regular expressions77678 | |
| 5718 | -Ref: Ways of specifying regular expressions-Footnote-182479 | |
| 5719 | -Ref: Ways of specifying regular expressions-Footnote-282506 | |
| 5720 | -Node: Simple definitions82871 | |
| 5721 | -Node: Line wide definitions87212 | |
| 5722 | -Node: Order of definitions87913 | |
| 5723 | -Node: Delimited definitions88695 | |
| 5724 | -Ref: Delimited definitions-Footnote-191119 | |
| 5725 | -Node: Variable definitions91450 | |
| 5726 | -Node: Dynamic Backreferences92331 | |
| 5727 | -Ref: Dynamic Backreferences-Footnote-195037 | |
| 5728 | -Ref: Dynamic Backreferences-Footnote-295063 | |
| 5729 | -Node: File inclusion95192 | |
| 5730 | -Node: State/Environment Definitions96385 | |
| 5731 | -Node: Explicit subexpressions with names101933 | |
| 5732 | -Node: Redefinitions and Substitutions105632 | |
| 5733 | -Ref: Redefinitions and Substitutions-Footnote-1108290 | |
| 5734 | -Node: How source-highlight works108340 | |
| 5735 | -Ref: How source-highlight works-Footnote-1112318 | |
| 5736 | -Ref: How source-highlight works-Footnote-2112534 | |
| 5737 | -Node: Notes on regular expressions112595 | |
| 5738 | -Ref: Notes on regular expressions-Footnote-1117371 | |
| 5739 | -Ref: Notes on regular expressions-Footnote-2117429 | |
| 5740 | -Ref: Notes on regular expressions-Footnote-3117483 | |
| 5741 | -Node: The program check-regexp117705 | |
| 5742 | -Node: Listing Language Elements120033 | |
| 5743 | -Ref: Listing Language Elements-Footnote-1121449 | |
| 5744 | -Node: Concluding Remarks121476 | |
| 5745 | -Node: Debugging122554 | |
| 5746 | -Ref: Debugging-Footnote-1132581 | |
| 5747 | -Ref: Debugging-Footnote-2132708 | |
| 5748 | -Node: Tutorials on Language Definitions132813 | |
| 5749 | -Node: Highlighting C/C++ and C#135178 | |
| 5750 | -Ref: Highlighting C/C++ and C#-Footnote-1143940 | |
| 5751 | -Ref: Highlighting C/C++ and C#-Footnote-2144130 | |
| 5752 | -Ref: Highlighting C/C++ and C#-Footnote-3144218 | |
| 5753 | -Ref: Highlighting C/C++ and C#-Footnote-4144343 | |
| 5754 | -Node: Highlighting Diff files144640 | |
| 5755 | -Node: Pseudo semantic analysis151238 | |
| 5756 | -Node: Output Language Definitions156413 | |
| 5757 | -Node: File extension158763 | |
| 5758 | -Node: Text styles159384 | |
| 5759 | -Node: Colors160701 | |
| 5760 | -Ref: Colors-Footnote-1163942 | |
| 5761 | -Node: Anchors and References163969 | |
| 5762 | -Node: One style168166 | |
| 5763 | -Node: Style template169454 | |
| 5764 | -Node: Line prefix170236 | |
| 5765 | -Ref: Line prefix-Footnote-1170956 | |
| 5766 | -Node: String translation171222 | |
| 5767 | -Ref: String translation-Footnote-1173536 | |
| 5768 | -Ref: String translation-Footnote-2173563 | |
| 5769 | -Node: Document template173612 | |
| 5770 | -Ref: Document template-Footnote-1176722 | |
| 5771 | -Ref: Document template-Footnote-2176904 | |
| 5772 | -Node: Generating HTML output176931 | |
| 5773 | -Ref: Generating HTML output-Footnote-1179551 | |
| 5774 | -Node: Generating References179639 | |
| 5775 | -Ref: Generating References-Footnote-1183074 | |
| 5776 | -Node: Examples183132 | |
| 5777 | -Node: Simple example183680 | |
| 5778 | -Node: References186012 | |
| 5779 | -Ref: test.h:16187202 | |
| 5780 | -Ref: test.h:18187239 | |
| 5781 | -Ref: test.h:20187280 | |
| 5782 | -Ref: test.h:26187441 | |
| 5783 | -Ref: test.h:28187503 | |
| 5784 | -Ref: test.h:29187580 | |
| 5785 | -Ref: test.h:35187825 | |
| 5786 | -Ref: test.h:40188144 | |
| 5787 | -Ref: test.h:46188804 | |
| 5788 | -Ref: test.h:47188861 | |
| 5789 | -Ref: test.h:48188916 | |
| 5790 | -Ref: test.h:54189419 | |
| 5791 | -Ref: test.h:63189951 | |
| 5792 | -Ref: test.h:65190113 | |
| 5793 | -Ref: test.h:68190239 | |
| 5794 | -Ref: test.h:70190473 | |
| 5795 | -Ref: test.h:76190972 | |
| 5796 | -Node: Line ranges191751 | |
| 5797 | -Node: Line ranges (with context)192752 | |
| 5798 | -Node: Regex ranges194422 | |
| 5799 | -Node: Problems198250 | |
| 5800 | -Node: Mailing Lists198953 | |
| 5801 | -Node: Concept Index199813 | |
| 5685 | +Node: Top1128 | |
| 5686 | +Node: Introduction3046 | |
| 5687 | +Node: Supported languages4620 | |
| 5688 | +Ref: Supported languages-Footnote-19637 | |
| 5689 | +Node: The program source-highlight-settings9810 | |
| 5690 | +Node: Notes on some languages10767 | |
| 5691 | +Node: Fortran11324 | |
| 5692 | +Node: Perl12045 | |
| 5693 | +Node: Using source-highlight as a simple formatter13117 | |
| 5694 | +Ref: Using source-highlight as a simple formatter-Footnote-116413 | |
| 5695 | +Node: Related Software and Links16538 | |
| 5696 | +Node: Installation20592 | |
| 5697 | +Node: Building with qmake23514 | |
| 5698 | +Node: Download25857 | |
| 5699 | +Node: Anonymous Git Checkout27320 | |
| 5700 | +Ref: Anonymous Git Checkout-Footnote-128746 | |
| 5701 | +Node: What you need to build source-highlight28868 | |
| 5702 | +Ref: What you need to build source-highlight-Footnote-131122 | |
| 5703 | +Ref: What you need to build source-highlight-Footnote-231169 | |
| 5704 | +Ref: What you need to build source-highlight-Footnote-331216 | |
| 5705 | +Ref: What you need to build source-highlight-Footnote-431262 | |
| 5706 | +Node: Tips on installing Boost Regex library31307 | |
| 5707 | +Ref: Tips on installing Boost Regex library-Footnote-135708 | |
| 5708 | +Ref: Tips on installing Boost Regex library-Footnote-235855 | |
| 5709 | +Node: Patching from a previous version36022 | |
| 5710 | +Node: Using source-highlight with less36665 | |
| 5711 | +Node: Using source-highlight as a CGI37322 | |
| 5712 | +Node: Building .rpm37837 | |
| 5713 | +Node: Copying38286 | |
| 5714 | +Node: Simple Usage38712 | |
| 5715 | +Ref: Simple Usage-Footnote-141298 | |
| 5716 | +Node: HTML and XHTML output41465 | |
| 5717 | +Node: LaTeX output42484 | |
| 5718 | +Node: Texinfo output42997 | |
| 5719 | +Node: DocBook output43419 | |
| 5720 | +Node: ANSI color escape sequences43737 | |
| 5721 | +Node: Configuration files44207 | |
| 5722 | +Node: Output format style45905 | |
| 5723 | +Ref: Output format style-Footnote-152972 | |
| 5724 | +Ref: Output format style-Footnote-253120 | |
| 5725 | +Ref: Output format style-Footnote-353147 | |
| 5726 | +Ref: Output format style-Footnote-453313 | |
| 5727 | +Ref: Output format style-Footnote-553340 | |
| 5728 | +Ref: Output format style-Footnote-653434 | |
| 5729 | +Ref: Output format style-Footnote-753502 | |
| 5730 | +Ref: Output format style-Footnote-853568 | |
| 5731 | +Node: Output format style using CSS53595 | |
| 5732 | +Node: Default Styles58111 | |
| 5733 | +Ref: Default Styles-Footnote-159786 | |
| 5734 | +Node: Language map59813 | |
| 5735 | +Node: Language definition files60706 | |
| 5736 | +Ref: Language definition files-Footnote-161274 | |
| 5737 | +Node: Output Language map61371 | |
| 5738 | +Node: Output Language definition files62493 | |
| 5739 | +Ref: Output Language definition files-Footnote-163296 | |
| 5740 | +Node: Developing your own definition files63397 | |
| 5741 | +Node: Invoking source-highlight64229 | |
| 5742 | +Ref: Invoking source-highlight-Footnote-172301 | |
| 5743 | +Ref: Invoking source-highlight-Footnote-272458 | |
| 5744 | +Node: How the input language is discovered72520 | |
| 5745 | +Ref: How the input language is discovered-Footnote-174566 | |
| 5746 | +Ref: How the input language is discovered-Footnote-274593 | |
| 5747 | +Node: Language Definitions74622 | |
| 5748 | +Node: Ways of specifying regular expressions78352 | |
| 5749 | +Ref: Ways of specifying regular expressions-Footnote-183153 | |
| 5750 | +Ref: Ways of specifying regular expressions-Footnote-283180 | |
| 5751 | +Node: Simple definitions83545 | |
| 5752 | +Node: Line wide definitions87886 | |
| 5753 | +Node: Order of definitions88587 | |
| 5754 | +Node: Delimited definitions89369 | |
| 5755 | +Ref: Delimited definitions-Footnote-191793 | |
| 5756 | +Node: Variable definitions92124 | |
| 5757 | +Node: Dynamic Backreferences93005 | |
| 5758 | +Ref: Dynamic Backreferences-Footnote-195711 | |
| 5759 | +Ref: Dynamic Backreferences-Footnote-295737 | |
| 5760 | +Node: File inclusion95866 | |
| 5761 | +Node: State/Environment Definitions97059 | |
| 5762 | +Node: Explicit subexpressions with names102607 | |
| 5763 | +Node: Redefinitions and Substitutions106306 | |
| 5764 | +Ref: Redefinitions and Substitutions-Footnote-1108964 | |
| 5765 | +Node: How source-highlight works109014 | |
| 5766 | +Ref: How source-highlight works-Footnote-1112992 | |
| 5767 | +Ref: How source-highlight works-Footnote-2113208 | |
| 5768 | +Node: Notes on regular expressions113269 | |
| 5769 | +Ref: Notes on regular expressions-Footnote-1118045 | |
| 5770 | +Ref: Notes on regular expressions-Footnote-2118103 | |
| 5771 | +Ref: Notes on regular expressions-Footnote-3118157 | |
| 5772 | +Node: The program check-regexp118379 | |
| 5773 | +Node: Listing Language Elements120707 | |
| 5774 | +Ref: Listing Language Elements-Footnote-1122123 | |
| 5775 | +Node: Concluding Remarks122150 | |
| 5776 | +Node: Debugging123228 | |
| 5777 | +Ref: Debugging-Footnote-1133255 | |
| 5778 | +Ref: Debugging-Footnote-2133382 | |
| 5779 | +Node: Tutorials on Language Definitions133487 | |
| 5780 | +Node: Highlighting C/C++ and C#135852 | |
| 5781 | +Ref: Highlighting C/C++ and C#-Footnote-1144628 | |
| 5782 | +Ref: Highlighting C/C++ and C#-Footnote-2144818 | |
| 5783 | +Ref: Highlighting C/C++ and C#-Footnote-3144906 | |
| 5784 | +Ref: Highlighting C/C++ and C#-Footnote-4145031 | |
| 5785 | +Node: Highlighting Diff files145328 | |
| 5786 | +Node: Pseudo semantic analysis151926 | |
| 5787 | +Node: Output Language Definitions157101 | |
| 5788 | +Node: File extension159451 | |
| 5789 | +Node: Text styles160072 | |
| 5790 | +Node: Colors161389 | |
| 5791 | +Ref: Colors-Footnote-1164630 | |
| 5792 | +Node: Anchors and References164657 | |
| 5793 | +Node: One style168854 | |
| 5794 | +Node: Style template170142 | |
| 5795 | +Node: Line prefix170924 | |
| 5796 | +Ref: Line prefix-Footnote-1171644 | |
| 5797 | +Node: String translation171910 | |
| 5798 | +Ref: String translation-Footnote-1174224 | |
| 5799 | +Ref: String translation-Footnote-2174251 | |
| 5800 | +Node: Document template174300 | |
| 5801 | +Ref: Document template-Footnote-1177410 | |
| 5802 | +Ref: Document template-Footnote-2177592 | |
| 5803 | +Node: Generating HTML output177619 | |
| 5804 | +Ref: Generating HTML output-Footnote-1180239 | |
| 5805 | +Node: Generating References180327 | |
| 5806 | +Ref: Generating References-Footnote-1183762 | |
| 5807 | +Node: Examples183820 | |
| 5808 | +Node: Simple example184368 | |
| 5809 | +Node: References186700 | |
| 5810 | +Ref: test.h:16187890 | |
| 5811 | +Ref: test.h:18187927 | |
| 5812 | +Ref: test.h:20187968 | |
| 5813 | +Ref: test.h:26188129 | |
| 5814 | +Ref: test.h:28188191 | |
| 5815 | +Ref: test.h:29188268 | |
| 5816 | +Ref: test.h:35188513 | |
| 5817 | +Ref: test.h:40188832 | |
| 5818 | +Ref: test.h:46189492 | |
| 5819 | +Ref: test.h:47189549 | |
| 5820 | +Ref: test.h:48189604 | |
| 5821 | +Ref: test.h:54190107 | |
| 5822 | +Ref: test.h:63190639 | |
| 5823 | +Ref: test.h:65190801 | |
| 5824 | +Ref: test.h:68190927 | |
| 5825 | +Ref: test.h:70191161 | |
| 5826 | +Ref: test.h:76191660 | |
| 5827 | +Node: Line ranges192439 | |
| 5828 | +Node: Line ranges (with context)193440 | |
| 5829 | +Node: Regex ranges195110 | |
| 5830 | +Node: Problems198938 | |
| 5831 | +Node: Mailing Lists199641 | |
| 5832 | +Node: Concept Index200501 | |
| 5802 | 5833 | |
| 5803 | 5834 | End Tag Table |
| @@ -330,7 +330,8 @@ formats (e.g., HTML, XHTML, etc.). | ||
| 330 | 330 | @item |
| 331 | 331 | @cindex SourceHighlightIDE |
| 332 | 332 | @cindex KDE |
| 333 | -SourceHighlightIDE is a small IDE (for KDE) I wrote for developing | |
| 333 | +SourceHighlightIDE is a small IDE (based on Qt4 and | |
| 334 | +Source-highlight-qt) I wrote for developing | |
| 334 | 335 | and debugging new language definitions for source-highlight: |
| 335 | 336 | |
| 336 | 337 | @uref{http://srchighliteide.sourceforge.net}. |
| @@ -412,6 +413,27 @@ using the source-highlight CGI. | ||
| 412 | 413 | |
| 413 | 414 | @uref{http://code.google.com/p/php-source-highlight/} |
| 414 | 415 | |
| 416 | +@item | |
| 417 | +@cindex SIP | |
| 418 | +@cindex Python | |
| 419 | +@cindex PyQt | |
| 420 | +Roberto Alsina made a partial python binding using SIP so | |
| 421 | +that you can use Source-Highlight-Qt in PyQt programs. | |
| 422 | + | |
| 423 | +@uref{http://marave.googlecode.com/svn/trunk/marave/highlight/} | |
| 424 | + | |
| 425 | +@item | |
| 426 | +@cindex Perl | |
| 427 | +A perl binding for source-highlight is available at CPAN: | |
| 428 | + | |
| 429 | +@uref{http://search.cpan.org/perldoc?Syntax::SourceHighlight} | |
| 430 | + | |
| 431 | +@item | |
| 432 | +@cindex Pastebin | |
| 433 | +Danijel Tasov wrote a pastebin service based on | |
| 434 | +perl source-highlight binding: | |
| 435 | + | |
| 436 | +@uref{http://pb.rbfh.de} | |
| 415 | 437 | |
| 416 | 438 | @end itemize |
| 417 | 439 |
| @@ -522,7 +544,7 @@ without using a Unix shell, and in particular to build @value{srchilite} | ||
| 522 | 544 | with Microsoft MSVC compiler. You should use this method only if you |
| 523 | 545 | don't have a Unix shell or if you really need to use the MSVC compiler |
| 524 | 546 | (e.g., if you want to build @value{srchilitelib} to be used in MSVC |
| 525 | -based programs. | |
| 547 | +based programs). | |
| 526 | 548 | @cindex boost |
| 527 | 549 | You still need the boost regex library, and if you |
| 528 | 550 | use MSVC, you can find installation packages for this library at |
| @@ -1,4 +1,4 @@ | ||
| 1 | -@set UPDATED 7 December 2009 | |
| 2 | -@set UPDATED-MONTH December 2009 | |
| 3 | -@set EDITION 3.1.3 | |
| 4 | -@set VERSION 3.1.3 | |
| 1 | +@set UPDATED 14 May 2010 | |
| 2 | +@set UPDATED-MONTH May 2010 | |
| 3 | +@set EDITION 3.1.4 | |
| 4 | +@set VERSION 3.1.4 |
| @@ -1,4 +1,4 @@ | ||
| 1 | -@set UPDATED 17 December 2009 | |
| 2 | -@set UPDATED-MONTH December 2009 | |
| 3 | -@set EDITION 3.1.3 | |
| 4 | -@set VERSION 3.1.3 | |
| 1 | +@set UPDATED 14 May 2010 | |
| 2 | +@set UPDATED-MONTH May 2010 | |
| 3 | +@set EDITION 3.1.4 | |
| 4 | +@set VERSION 3.1.4 |
| @@ -21,4 +21,5 @@ path = regexp | ||
| 21 | 21 | label = preproc |
| 22 | 22 | error = string |
| 23 | 23 | warning = type |
| 24 | +code = preproc | |
| 24 | 25 | @end example |
| \ No newline at end of file |
| @@ -1,4 +1,4 @@ | ||
| 1 | -@set UPDATED 7 December 2009 | |
| 2 | -@set UPDATED-MONTH December 2009 | |
| 3 | -@set EDITION 3.1.3 | |
| 4 | -@set VERSION 3.1.3 | |
| 1 | +@set UPDATED 14 May 2010 | |
| 2 | +@set UPDATED-MONTH May 2010 | |
| 3 | +@set EDITION 3.1.4 | |
| 4 | +@set VERSION 3.1.4 |
| @@ -1,4 +1,4 @@ | ||
| 1 | -@set UPDATED 17 December 2009 | |
| 2 | -@set UPDATED-MONTH December 2009 | |
| 3 | -@set EDITION 3.1.3 | |
| 4 | -@set VERSION 3.1.3 | |
| 1 | +@set UPDATED 14 May 2010 | |
| 2 | +@set UPDATED-MONTH May 2010 | |
| 3 | +@set EDITION 3.1.4 | |
| 4 | +@set VERSION 3.1.4 |
| @@ -1,14 +1,14 @@ | ||
| 1 | 1 | <html lang="en"> |
| 2 | 2 | <head> |
| 3 | -<title>GNU Source-highlight Library 3.1.3</title> | |
| 3 | +<title>GNU Source-highlight Library 3.1.4</title> | |
| 4 | 4 | <meta http-equiv="Content-Type" content="text/html"> |
| 5 | -<meta name="description" content="GNU Source-highlight Library 3.1.3"> | |
| 5 | +<meta name="description" content="GNU Source-highlight Library 3.1.4"> | |
| 6 | 6 | <meta name="generator" content="makeinfo 4.13"> |
| 7 | 7 | <link title="Top" rel="top" href="#Top"> |
| 8 | 8 | <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| 9 | 9 | <!-- |
| 10 | 10 | This manual is for GNU Source-highlight Library |
| 11 | -(version 3.1.3, 7 December 2009), | |
| 11 | +(version 3.1.4, 14 May 2010), | |
| 12 | 12 | which given a source file, produces a document with syntax highlighting. |
| 13 | 13 | |
| 14 | 14 | Copyright (C) 2005-2008 Lorenzo Bettini, `http://www.lorenzobettini.it'. |
| @@ -39,7 +39,7 @@ Copyright (C) 2005-2008 Lorenzo Bettini, `http://www.lorenzobettini.it'. | ||
| 39 | 39 | --></style> |
| 40 | 40 | </head> |
| 41 | 41 | <body> |
| 42 | -<h1 class="settitle">GNU Source-highlight Library 3.1.3</h1> | |
| 42 | +<h1 class="settitle">GNU Source-highlight Library 3.1.4</h1> | |
| 43 | 43 | <div class="contents"> |
| 44 | 44 | <h2>Table of Contents</h2> |
| 45 | 45 | <ul> |
| @@ -85,12 +85,12 @@ Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> | ||
| 85 | 85 | <p>GNU Source-highlight, given a source file, produces a document with |
| 86 | 86 | syntax highlighting. |
| 87 | 87 | |
| 88 | - <p>This is Edition 3.1.3 of the Source-highlight Library manual. | |
| 88 | + <p>This is Edition 3.1.4 of the Source-highlight Library manual. | |
| 89 | 89 | |
| 90 | - <p>This file documents GNU Source-highlight Library version 3.1.3. | |
| 90 | + <p>This file documents GNU Source-highlight Library version 3.1.4. | |
| 91 | 91 | |
| 92 | 92 | <p>This manual is for GNU Source-highlight Library |
| 93 | -(version 3.1.3, 7 December 2009), | |
| 93 | +(version 3.1.4, 14 May 2010), | |
| 94 | 94 | which given a source file, produces a document with syntax highlighting. |
| 95 | 95 | |
| 96 | 96 | <p>Copyright © 2005-2008 Lorenzo Bettini, <a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>. |
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | This is ../../doc/source-highlight-lib.info, produced by makeinfo |
| 2 | 2 | version 4.13 from ../../doc/source-highlight-lib.texinfo. |
| 3 | 3 | |
| 4 | -This manual is for GNU Source-highlight Library (version 3.1.3, 7 | |
| 5 | -December 2009), which given a source file, produces a document with | |
| 6 | -syntax highlighting. | |
| 4 | +This manual is for GNU Source-highlight Library (version 3.1.4, 14 May | |
| 5 | +2010), which given a source file, produces a document with syntax | |
| 6 | +highlighting. | |
| 7 | 7 | |
| 8 | 8 | Copyright (C) 2005-2008 Lorenzo Bettini, |
| 9 | 9 | `http://www.lorenzobettini.it'. |
| @@ -34,12 +34,12 @@ GNU Source-highlight Library | ||
| 34 | 34 | GNU Source-highlight, given a source file, produces a document with |
| 35 | 35 | syntax highlighting. |
| 36 | 36 | |
| 37 | - This is Edition 3.1.3 of the Source-highlight Library manual. | |
| 37 | + This is Edition 3.1.4 of the Source-highlight Library manual. | |
| 38 | 38 | |
| 39 | - This file documents GNU Source-highlight Library version 3.1.3. | |
| 39 | + This file documents GNU Source-highlight Library version 3.1.4. | |
| 40 | 40 | |
| 41 | - This manual is for GNU Source-highlight Library (version 3.1.3, | |
| 42 | -7 December 2009), which given a source file, produces a document with | |
| 41 | + This manual is for GNU Source-highlight Library (version 3.1.4, | |
| 42 | +14 May 2010), which given a source file, produces a document with | |
| 43 | 43 | syntax highlighting. |
| 44 | 44 | |
| 45 | 45 | Copyright (C) 2005-2008 Lorenzo Bettini, |
| @@ -997,24 +997,24 @@ Concept Index | ||
| 997 | 997 | |
| 998 | 998 | |
| 999 | 999 | Tag Table: |
| 1000 | -Node: Top1160 | |
| 1001 | -Node: Introduction2703 | |
| 1002 | -Node: Installation3565 | |
| 1003 | -Node: Use of GNU Source-highlight Library4522 | |
| 1004 | -Ref: Use of GNU Source-highlight Library-Footnote-15084 | |
| 1005 | -Node: Using Automake and Autotools5207 | |
| 1006 | -Ref: Using Automake and Autotools-Footnote-17193 | |
| 1007 | -Node: Main Classes7238 | |
| 1008 | -Node: SourceHighlight class8760 | |
| 1009 | -Node: Customizing Formatting11821 | |
| 1010 | -Node: Completely Customized Formatting13495 | |
| 1011 | -Node: Style-based Customized Formatting19422 | |
| 1012 | -Node: Events and Listeners27797 | |
| 1013 | -Node: Settings30182 | |
| 1014 | -Node: Utility functions32292 | |
| 1015 | -Node: Global instances32725 | |
| 1016 | -Node: Problems34116 | |
| 1017 | -Node: Mailing Lists34829 | |
| 1018 | -Node: Concept Index35691 | |
| 1000 | +Node: Top1156 | |
| 1001 | +Node: Introduction2695 | |
| 1002 | +Node: Installation3557 | |
| 1003 | +Node: Use of GNU Source-highlight Library4514 | |
| 1004 | +Ref: Use of GNU Source-highlight Library-Footnote-15076 | |
| 1005 | +Node: Using Automake and Autotools5199 | |
| 1006 | +Ref: Using Automake and Autotools-Footnote-17185 | |
| 1007 | +Node: Main Classes7230 | |
| 1008 | +Node: SourceHighlight class8752 | |
| 1009 | +Node: Customizing Formatting11813 | |
| 1010 | +Node: Completely Customized Formatting13487 | |
| 1011 | +Node: Style-based Customized Formatting19414 | |
| 1012 | +Node: Events and Listeners27789 | |
| 1013 | +Node: Settings30174 | |
| 1014 | +Node: Utility functions32284 | |
| 1015 | +Node: Global instances32717 | |
| 1016 | +Node: Problems34108 | |
| 1017 | +Node: Mailing Lists34821 | |
| 1018 | +Node: Concept Index35683 | |
| 1019 | 1019 | |
| 1020 | 1020 | End Tag Table |
| @@ -1,12 +1,12 @@ | ||
| 1 | -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. | |
| 2 | -.TH SOURCE-HIGHLIGHT "1" "January 2010" "Source-highlight 3.1.3 (library: 3:1:0)" "User Commands" | |
| 1 | +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. | |
| 2 | +.TH SOURCE-HIGHLIGHT "1" "May 2010" "Source-highlight 3.1.4 (library: 3:1:0)" "User Commands" | |
| 3 | 3 | .SH NAME |
| 4 | 4 | Source-highlight \- convert source code to syntax highlighted document |
| 5 | 5 | .SH SYNOPSIS |
| 6 | 6 | .B source-highlight |
| 7 | 7 | [\fIOPTIONS\fR]... \fI< input_file > output_file\fR |
| 8 | 8 | .SH DESCRIPTION |
| 9 | -GNU source\-highlight 3.1.3 | |
| 9 | +GNU source\-highlight 3.1.4 | |
| 10 | 10 | .PP |
| 11 | 11 | Highlight the syntax of a source file (e.g. Java) into a specific format (e.g. |
| 12 | 12 | HTML) |
| @@ -218,7 +218,7 @@ Maintained by Lorenzo Bettini <http://www.lorenzobettini.it> | ||
| 218 | 218 | .SH "REPORTING BUGS" |
| 219 | 219 | Report bugs to <bug\-source\-highlight at gnu.org> |
| 220 | 220 | .SH COPYRIGHT |
| 221 | -Copyright \(co 1999-2008 Lorenzo Bettini <http://www.lorenzobettini.it> | |
| 221 | +Copyright \(co 1999\-2008 Lorenzo Bettini <http://www.lorenzobettini.it> | |
| 222 | 222 | This program comes with ABSOLUTELY NO WARRANTY. |
| 223 | 223 | .br |
| 224 | 224 | This is free software; you may redistribute copies of the program |
| @@ -1,6738 +1,6253 @@ | ||
| 1 | -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> | |
| 2 | -<html> | |
| 3 | -<!-- This manual is for GNU Source-highlight | |
| 4 | -(version 3.1.3, 17 December 2009), | |
| 1 | +<html lang="en"> | |
| 2 | +<head> | |
| 3 | +<title>GNU Source-highlight 3.1.4</title> | |
| 4 | +<meta http-equiv="Content-Type" content="text/html"> | |
| 5 | +<meta name="description" content="GNU Source-highlight 3.1.4"> | |
| 6 | +<meta name="generator" content="makeinfo 4.13"> | |
| 7 | +<link title="Top" rel="top" href="#Top"> | |
| 8 | +<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> | |
| 9 | +<!-- | |
| 10 | +This manual is for GNU Source-highlight | |
| 11 | +(version 3.1.4, 14 May 2010), | |
| 5 | 12 | which given a source file, produces a document with syntax highlighting. |
| 6 | 13 | |
| 14 | +Copyright (C) 2005-2008 Lorenzo Bettini, `http://www.lorenzobettini.it'. | |
| 15 | + | |
| 16 | + Permission is granted to copy, distribute and/or modify this | |
| 17 | + document under the terms of the GNU Free Documentation License, | |
| 18 | + Version 1.1 or any later version published by the Free Software | |
| 19 | + Foundation; with no Invariant Sections, with the Front-Cover Texts | |
| 20 | + being "A GNU Manual," and with the Back-Cover Texts as in (a) | |
| 21 | + below. A copy of the license is included in the section entitled | |
| 22 | + "GNU Free Documentation License." | |
| 23 | + | |
| 24 | + (a) The FSF's Back-Cover Text is: "You have freedom to copy and | |
| 25 | + modify this GNU Manual, like GNU software. Copies published by | |
| 26 | + the Free Software Foundation raise funds for GNU development." | |
| 27 | + --> | |
| 28 | +<meta http-equiv="Content-Style-Type" content="text/css"> | |
| 29 | +<style type="text/css"><!-- | |
| 30 | + pre.display { font-family:inherit } | |
| 31 | + pre.format { font-family:inherit } | |
| 32 | + pre.smalldisplay { font-family:inherit; font-size:smaller } | |
| 33 | + pre.smallformat { font-family:inherit; font-size:smaller } | |
| 34 | + pre.smallexample { font-size:smaller } | |
| 35 | + pre.smalllisp { font-size:smaller } | |
| 36 | + span.sc { font-variant:small-caps } | |
| 37 | + span.roman { font-family:serif; font-weight:normal; } | |
| 38 | + span.sansserif { font-family:sans-serif; font-weight:normal; } | |
| 39 | +--></style> | |
| 40 | +</head> | |
| 41 | +<body> | |
| 42 | +<h1 class="settitle">GNU Source-highlight 3.1.4</h1> | |
| 43 | + <div class="contents"> | |
| 44 | +<h2>Table of Contents</h2> | |
| 45 | +<ul> | |
| 46 | +<li><a name="toc_Top" href="#Top">GNU Source-highlight</a> | |
| 47 | +<li><a name="toc_Introduction" href="#Introduction">1 Introduction</a> | |
| 48 | +<ul> | |
| 49 | +<li><a href="#Supported-languages">1.1 Supported languages</a> | |
| 50 | +<li><a href="#The-program-source_002dhighlight_002dsettings">1.2 The program <code>source-highlight-settings</code></a> | |
| 51 | +<li><a href="#Notes-on-some-languages">1.3 Notes on some languages</a> | |
| 52 | +<ul> | |
| 53 | +<li><a href="#Fortran">1.3.1 Fortran</a> | |
| 54 | +<li><a href="#Perl">1.3.2 Perl</a> | |
| 55 | +</li></ul> | |
| 56 | +<li><a href="#Using-source_002dhighlight-as-a-simple-formatter">1.4 Using source-highlight as a simple formatter</a> | |
| 57 | +<li><a href="#Related-Software-and-Links">1.5 Related Software and Links</a> | |
| 58 | +</li></ul> | |
| 59 | +<li><a name="toc_Installation" href="#Installation">2 Installation</a> | |
| 60 | +<ul> | |
| 61 | +<li><a href="#Building-with-qmake">2.1 Building with qmake</a> | |
| 62 | +<li><a href="#Download">2.2 Download</a> | |
| 63 | +<li><a href="#Anonymous-Git-Checkout">2.3 Anonymous Git Checkout</a> | |
| 64 | +<li><a href="#What-you-need-to-build-source_002dhighlight">2.4 What you need to build source-highlight</a> | |
| 65 | +<li><a href="#Tips-on-installing-Boost-Regex-library">2.5 Tips on installing Boost Regex library</a> | |
| 66 | +<li><a href="#Patching-from-a-previous-version">2.6 Patching from a previous version</a> | |
| 67 | +<li><a href="#Using-source_002dhighlight-with-less">2.7 Using source-highlight with less</a> | |
| 68 | +<li><a href="#Using-source_002dhighlight-as-a-CGI">2.8 Using source-highlight as a CGI</a> | |
| 69 | +<li><a href="#Building-_002erpm">2.9 Building .rpm</a> | |
| 70 | +</li></ul> | |
| 71 | +<li><a name="toc_Copying" href="#Copying">3 Copying Conditions</a> | |
| 72 | +<li><a name="toc_Simple-Usage" href="#Simple-Usage">4 Simple Usage</a> | |
| 73 | +<ul> | |
| 74 | +<li><a href="#HTML-and-XHTML-output">4.1 HTML and XHTML output</a> | |
| 75 | +<li><a href="#LaTeX-output">4.2 LaTeX output</a> | |
| 76 | +<li><a href="#Texinfo-output">4.3 Texinfo output</a> | |
| 77 | +<li><a href="#DocBook-output">4.4 DocBook output</a> | |
| 78 | +<li><a href="#ANSI-color-escape-sequences">4.5 ANSI color escape sequences</a> | |
| 79 | +</li></ul> | |
| 80 | +<li><a name="toc_Configuration-files" href="#Configuration-files">5 Configuration files</a> | |
| 81 | +<ul> | |
| 82 | +<li><a href="#Output-format-style">5.1 Output format style</a> | |
| 83 | +<li><a href="#Output-format-style-using-CSS">5.2 Output format style using CSS</a> | |
| 84 | +<li><a href="#Default-Styles">5.3 Default Styles</a> | |
| 85 | +<li><a href="#Language-map">5.4 Language map</a> | |
| 86 | +<li><a href="#Language-definition-files">5.5 Language definition files</a> | |
| 87 | +<li><a href="#Output-Language-map">5.6 Output Language map</a> | |
| 88 | +<li><a href="#Output-Language-definition-files">5.7 Output Language definition files</a> | |
| 89 | +<li><a href="#Developing-your-own-definition-files">5.8 Developing your own definition files</a> | |
| 90 | +</li></ul> | |
| 91 | +<li><a name="toc_Invoking-source_002dhighlight" href="#Invoking-source_002dhighlight">6 Invoking <samp><span class="command">source-highlight</span></samp></a> | |
| 92 | +<ul> | |
| 93 | +<li><a href="#How-the-input-language-is-discovered">6.1 How the input language is discovered</a> | |
| 94 | +</li></ul> | |
| 95 | +<li><a name="toc_Language-Definitions" href="#Language-Definitions">7 Language Definitions</a> | |
| 96 | +<ul> | |
| 97 | +<li><a href="#Ways-of-specifying-regular-expressions">7.1 Ways of specifying regular expressions</a> | |
| 98 | +<li><a href="#Simple-definitions">7.2 Simple definitions</a> | |
| 99 | +<li><a href="#Line-wide-definitions">7.3 Line wide definitions</a> | |
| 100 | +<li><a href="#Order-of-definitions">7.4 Order of definitions</a> | |
| 101 | +<li><a href="#Delimited-definitions">7.5 Delimited definitions</a> | |
| 102 | +<li><a href="#Variable-definitions">7.6 Variable definitions</a> | |
| 103 | +<li><a href="#Dynamic-Backreferences">7.7 Dynamic Backreferences</a> | |
| 104 | +<li><a href="#File-inclusion">7.8 File inclusion</a> | |
| 105 | +<li><a href="#State_002fEnvironment-Definitions">7.9 State/Environment Definitions</a> | |
| 106 | +<li><a href="#Explicit-subexpressions-with-names">7.10 Explicit subexpressions with names</a> | |
| 107 | +<li><a href="#Redefinitions-and-Substitutions">7.11 Redefinitions and Substitutions</a> | |
| 108 | +<li><a href="#How-source_002dhighlight-works">7.12 How source-highlight works</a> | |
| 109 | +<li><a href="#Notes-on-regular-expressions">7.13 Notes on regular expressions</a> | |
| 110 | +<li><a href="#The-program-check_002dregexp">7.14 The program <samp><span class="command">check-regexp</span></samp></a> | |
| 111 | +<li><a href="#Listing-Language-Elements">7.15 Listing Language Elements</a> | |
| 112 | +<li><a href="#Concluding-Remarks">7.16 Concluding Remarks</a> | |
| 113 | +<li><a href="#Debugging">7.17 Debugging</a> | |
| 114 | +<li><a href="#Tutorials-on-Language-Definitions">7.18 Tutorials on Language Definitions</a> | |
| 115 | +<ul> | |
| 116 | +<li><a href="#Highlighting-C_002fC_002b_002b-and-C_0023">7.18.1 Highlighting C/C++ and C#</a> | |
| 117 | +<li><a href="#Highlighting-Diff-files">7.18.2 Highlighting Diff files</a> | |
| 118 | +<li><a href="#Pseudo-semantic-analysis">7.18.3 Pseudo semantic analysis</a> | |
| 119 | +</li></ul> | |
| 120 | +</li></ul> | |
| 121 | +<li><a name="toc_Output-Language-Definitions" href="#Output-Language-Definitions">8 Output Language Definitions</a> | |
| 122 | +<ul> | |
| 123 | +<li><a href="#File-extension">8.1 File extension</a> | |
| 124 | +<li><a href="#Text-styles">8.2 Text styles</a> | |
| 125 | +<li><a href="#Colors">8.3 Colors</a> | |
| 126 | +<li><a href="#Anchors-and-References">8.4 Anchors and References</a> | |
| 127 | +<li><a href="#One-style">8.5 One style</a> | |
| 128 | +<li><a href="#Style-template">8.6 Style template</a> | |
| 129 | +<li><a href="#Line-prefix">8.7 Line prefix</a> | |
| 130 | +<li><a href="#String-translation">8.8 String translation</a> | |
| 131 | +<li><a href="#Document-template">8.9 Document template</a> | |
| 132 | +<li><a href="#Generating-HTML-output">8.10 Generating HTML output</a> | |
| 133 | +</li></ul> | |
| 134 | +<li><a name="toc_Generating-References" href="#Generating-References">9 Generating References</a> | |
| 135 | +<li><a name="toc_Examples" href="#Examples">10 Examples</a> | |
| 136 | +<ul> | |
| 137 | +<li><a href="#Simple-example">10.1 Simple example</a> | |
| 138 | +<li><a href="#References">10.2 References</a> | |
| 139 | +<li><a href="#Line-ranges">10.3 Line ranges</a> | |
| 140 | +<li><a href="#Line-ranges-_0028with-context_0029">10.4 Line ranges (with context)</a> | |
| 141 | +<li><a href="#Regex-ranges">10.5 Regex ranges</a> | |
| 142 | +</li></ul> | |
| 143 | +<li><a name="toc_Problems" href="#Problems">11 Reporting Bugs</a> | |
| 144 | +<li><a name="toc_Mailing-Lists" href="#Mailing-Lists">12 Mailing Lists</a> | |
| 145 | +<li><a name="toc_Concept-Index" href="#Concept-Index">Concept Index</a> | |
| 146 | +</li></ul> | |
| 147 | +</div> | |
| 7 | 148 | |
| 8 | -Copyright C 2005-2008 Lorenzo Bettini, http://www.lorenzobettini.it. | |
| 9 | - | |
| 10 | -Copyright C 2010 KINUGAWA Akihito (Japanese translation). | |
| 11 | 149 | |
| 12 | 150 | |
| 13 | -Permission is granted to copy, distribute and/or modify this document | |
| 14 | -under the terms of the GNU Free Documentation License, Version 1.1 or | |
| 15 | -any later version published by the Free Software Foundation; with no | |
| 16 | -Invariant Sections, with the Front-Cover Texts being "A GNU Manual," | |
| 17 | -and with the Back-Cover Texts as in (a) below. A copy of the | |
| 18 | -license is included in the section entitled "GNU Free Documentation | |
| 19 | -License." | |
| 151 | +<div class="node"> | |
| 152 | +<a name="Top"></a> | |
| 153 | +<p><hr> | |
| 154 | +Next: <a rel="next" accesskey="n" href="#Introduction">Introduction</a>, | |
| 155 | +Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, | |
| 156 | +Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> | |
| 20 | 157 | |
| 21 | -(a) The FSF's Back-Cover Text is: "You have freedom to copy and modify | |
| 22 | -this GNU Manual, like GNU software. Copies published by the Free | |
| 23 | -Software Foundation raise funds for GNU development." | |
| 158 | +</div> | |
| 24 | 159 | |
| 25 | - --> | |
| 26 | -<!-- Created on March, 13 2010 by texi2html 1.78 --> | |
| 27 | -<!-- | |
| 28 | -Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) | |
| 29 | - Karl Berry <karl@freefriends.org> | |
| 30 | - Olaf Bachmann <obachman@mathematik.uni-kl.de> | |
| 31 | - and many others. | |
| 32 | -Maintained by: Many creative people. | |
| 33 | -Send bugs and suggestions to <texi2html-bug@nongnu.org> | |
| 34 | - | |
| 35 | ---> | |
| 36 | -<head> | |
| 37 | -<title>GNU Source-highlight 3.1.3</title> | |
| 38 | - | |
| 39 | -<meta name="description" content="GNU Source-highlight 3.1.3"> | |
| 40 | -<meta name="keywords" content="GNU Source-highlight 3.1.3"> | |
| 41 | -<meta name="resource-type" content="document"> | |
| 42 | -<meta name="distribution" content="global"> | |
| 43 | -<meta name="Generator" content="texi2html 1.78"> | |
| 44 | -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 45 | -<style type="text/css"> | |
| 46 | -<!-- | |
| 47 | -a.summary-letter {text-decoration: none} | |
| 48 | -pre.display {font-family: serif} | |
| 49 | -pre.format {font-family: serif} | |
| 50 | -pre.menu-comment {font-family: serif} | |
| 51 | -pre.menu-preformatted {font-family: serif} | |
| 52 | -pre.smalldisplay {font-family: serif; font-size: smaller} | |
| 53 | -pre.smallexample {font-size: smaller} | |
| 54 | -pre.smallformat {font-family: serif; font-size: smaller} | |
| 55 | -pre.smalllisp {font-size: smaller} | |
| 56 | -span.roman {font-family:serif; font-weight:normal;} | |
| 57 | -span.sansserif {font-family:sans-serif; font-weight:normal;} | |
| 58 | -ul.toc {list-style: none} | |
| 59 | ---> | |
| 60 | -</style> | |
| 160 | +<h2 class="unnumbered">GNU Source-highlight</h2> | |
| 61 | 161 | |
| 162 | +<p>GNU Source-highlight, given a source file, produces a document with | |
| 163 | +syntax highlighting. | |
| 62 | 164 | |
| 63 | -</head> | |
| 165 | + <p>This is Edition 3.1.4 of the Source-highlight manual. | |
| 64 | 166 | |
| 65 | -<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> | |
| 167 | + <p>This file documents GNU Source-highlight version 3.1.4. | |
| 66 | 168 | |
| 67 | -<a name="Top"></a> | |
| 68 | -<a name="SEC_Top"></a> | |
| 69 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 70 | -<tr><td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 71 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 72 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 73 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 74 | -</tr></table> | |
| 75 | -<h1 class="settitle">GNU Source-highlight</h1> | |
| 76 | - | |
| 77 | -<p>GNU Source-highlightは、入力したソースファイルからシンタックスを強調したドキュメントを生成する。 | |
| 78 | -</p> | |
| 79 | -<p>このドキュメントは、Source-highlightマニュアルの3.1.3エディションである。 | |
| 80 | -</p> | |
| 81 | -<p>このファイルは、GNU Source-highlightバージョン3.1.3について記述している。 | |
| 82 | -</p> | |
| 83 | -<p>This manual is for GNU Source-highlight | |
| 84 | -(version 3.1.3, 17 December 2009), | |
| 169 | + <p>This manual is for GNU Source-highlight | |
| 170 | +(version 3.1.4, 14 May 2010), | |
| 85 | 171 | which given a source file, produces a document with syntax highlighting. |
| 86 | -</p> | |
| 87 | -<ul class="toc"> | |
| 88 | -<li> | |
| 89 | -Copyright © 2005-2008 Lorenzo Bettini, <a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>. | |
| 90 | -</li><li> | |
| 91 | -Copyright © 2010 KINUGAWA Akihito (Japanese translation). | |
| 92 | -</li></ul> | |
| 93 | 172 | |
| 94 | -<blockquote><p>Permission is granted to copy, distribute and/or modify this document | |
| 173 | + <p>Copyright © 2005-2008 Lorenzo Bettini, <a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>. | |
| 174 | + | |
| 175 | + <blockquote> | |
| 176 | +Permission is granted to copy, distribute and/or modify this document | |
| 95 | 177 | under the terms of the GNU Free Documentation License, Version 1.1 or |
| 96 | 178 | any later version published by the Free Software Foundation; with no |
| 97 | 179 | Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” |
| 98 | 180 | and with the Back-Cover Texts as in (a) below. A copy of the |
| 99 | 181 | license is included in the section entitled “GNU Free Documentation |
| 100 | 182 | License.” |
| 101 | -</p> | |
| 102 | -<p>(a) The FSF's Back-Cover Text is: “You have freedom to copy and modify | |
| 183 | + | |
| 184 | + <p>(a) The FSF's Back-Cover Text is: “You have freedom to copy and modify | |
| 103 | 185 | this GNU Manual, like GNU software. Copies published by the Free |
| 104 | 186 | Software Foundation raise funds for GNU development.” |
| 105 | -</p></blockquote> | |
| 106 | - | |
| 107 | - | |
| 108 | -<table class="menu" border="0" cellspacing="0"> | |
| 109 | -<tr><td align="left" valign="top"><a href="#SEC1">1. 導入</a></td><td> </td><td align="left" valign="top"> 目的 | |
| 110 | -</td></tr> | |
| 111 | -<tr><td align="left" valign="top"><a href="#SEC9">2. インストール</a></td><td> </td><td align="left" valign="top"> ダウンロードとインストール | |
| 112 | -</td></tr> | |
| 113 | -<tr><td align="left" valign="top"><a href="#SEC19">3. Copying Conditions</a></td><td> </td><td align="left" valign="top"> ライセンスについて | |
| 114 | -</td></tr> | |
| 115 | -<tr><td align="left" valign="top"><a href="#SEC20">4. 簡単な使い方</a></td><td> </td><td align="left" valign="top"> 非常に基本的な使い方 | |
| 116 | -</td></tr> | |
| 117 | -<tr><td align="left" valign="top"><a href="#SEC26">5. 設定ファイル</a></td><td> </td><td align="left" valign="top"> 実行に必要なファイル | |
| 118 | -</td></tr> | |
| 119 | -<tr><td align="left" valign="top"><a href="#SEC35">6. <code>source-highlight</code>の起動</a></td><td> </td><td align="left" valign="top"> <code>source-highlight</code>の実行方法 | |
| 120 | -</td></tr> | |
| 121 | -<tr><td align="left" valign="top"><a href="#SEC37">7. 言語の定義</a></td><td> </td><td align="left" valign="top"> 入力言語の定義方法 | |
| 122 | -</td></tr> | |
| 123 | -<tr><td align="left" valign="top"><a href="#SEC59">8. 出力言語の定義</a></td><td> </td><td align="left" valign="top"> 出力フォーマットの定義方法 | |
| 124 | -</td></tr> | |
| 125 | -<tr><td align="left" valign="top"><a href="#SEC70">9. リファレンスの生成</a></td><td> </td><td align="left" valign="top"> アンカーとクロスリファレンス | |
| 126 | -</td></tr> | |
| 127 | -<tr><td align="left" valign="top"><a href="#SEC71">10. 例</a></td><td> </td><td align="left" valign="top"> 出力例 | |
| 128 | -</td></tr> | |
| 129 | -<tr><td align="left" valign="top"><a href="#SEC77">11. バグ報告</a></td><td> </td><td align="left" valign="top"></td></tr> | |
| 130 | -<tr><td align="left" valign="top"><a href="#SEC78">12. メーリングリスト</a></td><td> </td><td align="left" valign="top"> | |
| 131 | -</td></tr> | |
| 132 | -<tr><td align="left" valign="top"><a href="#SEC79">Concept Index</a></td><td> </td><td align="left" valign="top"> Index of concepts. | |
| 133 | -</td></tr> | |
| 134 | -</table> | |
| 135 | - | |
| 136 | -<hr size="1"> | |
| 137 | -<a name="g_t_5c0e_5165"></a> | |
| 138 | -<a name="SEC1"></a> | |
| 139 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 140 | -<tr><td valign="middle" align="left">[<a href="#SEC_Top" title="Previous section in reading order"> < </a>]</td> | |
| 141 | -<td valign="middle" align="left">[<a href="#SEC2" title="Next section in reading order"> > </a>]</td> | |
| 142 | -<td valign="middle" align="left"> </td> | |
| 143 | -<td valign="middle" align="left">[ << ]</td> | |
| 144 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Up section"> Up </a>]</td> | |
| 145 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 146 | -<td valign="middle" align="left"> </td> | |
| 147 | -<td valign="middle" align="left"> </td> | |
| 148 | -<td valign="middle" align="left"> </td> | |
| 149 | -<td valign="middle" align="left"> </td> | |
| 150 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 151 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 152 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 153 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 154 | -</tr></table> | |
| 155 | -<h1 class="chapter"> 1. 導入 </h1> | |
| 156 | - | |
| 157 | - | |
| 158 | -<p>GNU Source-highlightは、入力したソースファイルからシンタックスが強調されたドキュメントを生成する。 | |
| 159 | -色やスタイルについては、設定ファイルを使ったり、コマンドラインで指定する何らかのオプションを使うことで指定することができる(ボールド、イタリック、下線)。 | |
| 160 | -</p> | |
| 161 | -<p>このプログラムはすでに多数の言語(たとえば、C++、Java、Perlなど)と多数のファイルフォーマット(たとえば、ログファイル、ChangeLogなど)、そして、複数の出力フォーマット(たとえば、HTML、ANSIカラーエスケープシーケンス、LaTeXなど)を認識している。 | |
| 162 | -バージョン2.0からは、後でこのマニュアルで説明する簡単なシンタックスを使って自分自身で入力ソースとなる言語を記述することができる(<a href="#SEC37">言語の定義</a>)。 | |
| 163 | -バージョン2.1からは、後でこのマニュアルで説明する簡単なシンタックスを使って自分自身で出力フォーマットの言語を記述することができる(<a href="#SEC59">出力言語の定義</a>)。 | |
| 164 | -バージョン2.2からは、<em>ctags</em>プログラム(<a href="http://ctags.sourceforge.net">http://ctags.sourceforge.net</a>)に頼る形ではあるが、クロスリファレンス(たとえば、変数名やフィールド名になどに対するもの)を生成することができるようになった(<a href="#SEC70">リファレンスの生成</a>)。 | |
| 165 | -</p> | |
| 166 | -<a name="IDX1"></a> | |
| 167 | -<p>バージョン3.0からは、GNU Source-highlightがC++ライブラリも提供するようになった。 | |
| 168 | -これは、C++プログラマが自分のプログラムにハイライトの機能を追加できるようにするためのものだ。 | |
| 169 | -See <a href="source-highlight-info.html#g_t_5c0e_5165">(source-highlight-info)導入</a> | |
| 170 | -</p> | |
| 171 | -<table class="menu" border="0" cellspacing="0"> | |
| 172 | -<tr><td align="left" valign="top"><a href="#SEC2">1.1 サポートしている言語</a></td><td> </td><td align="left" valign="top"> | |
| 173 | -</td></tr> | |
| 174 | -<tr><td align="left" valign="top"><a href="#SEC3">1.2 <code>source-highlight-settings</code>プログラム</a></td><td> </td><td align="left" valign="top"> | |
| 175 | -</td></tr> | |
| 176 | -<tr><td align="left" valign="top"><a href="#SEC4">1.3 いくつかの言語についての注意</a></td><td> </td><td align="left" valign="top"> | |
| 177 | -</td></tr> | |
| 178 | -<tr><td align="left" valign="top"><a href="#SEC7">1.4 簡単なフォーマッタとしてのsource-highlightの使用</a></td><td> </td><td align="left" valign="top"> | |
| 179 | -</td></tr> | |
| 180 | -<tr><td align="left" valign="top"><a href="#SEC8">1.5 関連するソフトウェアとリンク</a></td><td> </td><td align="left" valign="top"> | |
| 181 | -</td></tr> | |
| 182 | -</table> | |
| 183 | - | |
| 184 | -<hr size="6"> | |
| 185 | -<a name="g_t_30b5_30dd_30fc_30c8_3057_3066_3044_308b_8a00_8a9e"></a> | |
| 186 | -<a name="SEC2"></a> | |
| 187 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 188 | -<tr><td valign="middle" align="left">[<a href="#SEC1" title="Previous section in reading order"> < </a>]</td> | |
| 189 | -<td valign="middle" align="left">[<a href="#SEC3" title="Next section in reading order"> > </a>]</td> | |
| 190 | -<td valign="middle" align="left"> </td> | |
| 191 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 192 | -<td valign="middle" align="left">[<a href="#SEC1" title="Up section"> Up </a>]</td> | |
| 193 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 194 | -<td valign="middle" align="left"> </td> | |
| 195 | -<td valign="middle" align="left"> </td> | |
| 196 | -<td valign="middle" align="left"> </td> | |
| 197 | -<td valign="middle" align="left"> </td> | |
| 198 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 199 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 200 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 201 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 202 | -</tr></table> | |
| 203 | -<h2 class="section"> 1.1 サポートしている言語 </h2> | |
| 204 | - | |
| 205 | -<p>Source-highlight(3.1.3)で本来サポートされている言語(要するにファイルの拡張子)の完全なリストは、<code>--lang-list</code>で報告されるものと同じであるが、以下のものである。 | |
| 206 | -</p> | |
| 207 | -<table><tr><td> </td><td><pre class="example">C = cpp.lang | |
| 208 | -H = cpp.lang | |
| 209 | -ac = m4.lang | |
| 210 | -ada = ada.lang | |
| 211 | -adb = ada.lang | |
| 212 | -am = makefile.lang | |
| 213 | -applescript = applescript.lang | |
| 214 | -asm = asm.lang | |
| 215 | -autoconf = m4.lang | |
| 216 | -awk = awk.lang | |
| 217 | -bash = sh.lang | |
| 218 | -bat = bat.lang | |
| 219 | -batch = bat.lang | |
| 220 | -bib = bib.lang | |
| 221 | -bison = bison.lang | |
| 222 | -c = c.lang | |
| 223 | -caml = caml.lang | |
| 224 | -cbl = cobol.lang | |
| 225 | -cc = cpp.lang | |
| 226 | -changelog = changelog.lang | |
| 227 | -clipper = clipper.lang | |
| 228 | -cls = latex.lang | |
| 229 | -cobol = cobol.lang | |
| 230 | -conf = conf.lang | |
| 231 | -cpp = cpp.lang | |
| 232 | -cs = csharp.lang | |
| 233 | -csh = sh.lang | |
| 234 | -csharp = csharp.lang | |
| 235 | -css = css.lang | |
| 236 | -d = d.lang | |
| 237 | -desktop = desktop.lang | |
| 238 | -diff = diff.lang | |
| 239 | -dmd = d.lang | |
| 240 | -docbook = xml.lang | |
| 241 | -dtx = latex.lang | |
| 242 | -eps = postscript.lang | |
| 243 | -erl = erlang.lang | |
| 244 | -erlang = erlang.lang | |
| 245 | -errors = errors.lang | |
| 246 | -fixed-fortran = fixed-fortran.lang | |
| 247 | -flex = flex.lang | |
| 248 | -fortran = fortran.lang | |
| 249 | -free-fortran = fortran.lang | |
| 250 | -glsl = glsl.lang | |
| 251 | -h = cpp.lang | |
| 252 | -haskell = haskell.lang | |
| 253 | -haxe = haxe.lang | |
| 254 | -hh = cpp.lang | |
| 255 | -hpp = cpp.lang | |
| 256 | -hs = haskell.lang | |
| 257 | -htm = html.lang | |
| 258 | -html = html.lang | |
| 259 | -hx = haxe.lang | |
| 260 | -in = makefile.lang | |
| 261 | -ini = desktop.lang | |
| 262 | -java = java.lang | |
| 263 | -javascript = javascript.lang | |
| 264 | -js = javascript.lang | |
| 265 | -kcfg = xml.lang | |
| 266 | -kdevelop = xml.lang | |
| 267 | -kidl = xml.lang | |
| 268 | -ksh = sh.lang | |
| 269 | -l = flex.lang | |
| 270 | -lang = langdef.lang | |
| 271 | -langdef = langdef.lang | |
| 272 | -latex = latex.lang | |
| 273 | -ldap = ldap.lang | |
| 274 | -ldif = ldap.lang | |
| 275 | -lex = flex.lang | |
| 276 | -lgt = logtalk.lang | |
| 277 | -ll = flex.lang | |
| 278 | -log = log.lang | |
| 279 | -logtalk = logtalk.lang | |
| 280 | -lsm = lsm.lang | |
| 281 | -lua = lua.lang | |
| 282 | -m4 = m4.lang | |
| 283 | -makefile = makefile.lang | |
| 284 | -manifest = manifest.lang | |
| 285 | -mf = manifest.lang | |
| 286 | -ml = caml.lang | |
| 287 | -mli = caml.lang | |
| 288 | -moc = cpp.lang | |
| 289 | -outlang = outlang.lang | |
| 290 | -oz = oz.lang | |
| 291 | -pas = pascal.lang | |
| 292 | -pascal = pascal.lang | |
| 293 | -patch = diff.lang | |
| 294 | -pc = pc.lang | |
| 295 | -perl = perl.lang | |
| 296 | -php = php.lang | |
| 297 | -php3 = php.lang | |
| 298 | -php4 = php.lang | |
| 299 | -php5 = php.lang | |
| 300 | -pkgconfig = pc.lang | |
| 301 | -pl = prolog.lang | |
| 302 | -pm = perl.lang | |
| 303 | -postscript = postscript.lang | |
| 304 | -prg = clipper.lang | |
| 305 | -prolog = prolog.lang | |
| 306 | -properties = properties.lang | |
| 307 | -ps = postscript.lang | |
| 308 | -py = python.lang | |
| 309 | -python = python.lang | |
| 310 | -rb = ruby.lang | |
| 311 | -rc = xml.lang | |
| 312 | -ruby = ruby.lang | |
| 313 | -s = asm.lang | |
| 314 | -scala = scala.lang | |
| 315 | -scpt = applescript.lang | |
| 316 | -sh = sh.lang | |
| 317 | -shell = sh.lang | |
| 318 | -sig = sml.lang | |
| 319 | -sl = slang.lang | |
| 320 | -slang = slang.lang | |
| 321 | -slsh = slang.lang | |
| 322 | -sml = sml.lang | |
| 323 | -spec = spec.lang | |
| 324 | -sql = sql.lang | |
| 325 | -sty = latex.lang | |
| 326 | -style = style.lang | |
| 327 | -syslog = log.lang | |
| 328 | -tcl = tcl.lang | |
| 329 | -tcsh = sh.lang | |
| 330 | -tex = latex.lang | |
| 331 | -texi = texinfo.lang | |
| 332 | -texinfo = texinfo.lang | |
| 333 | -tk = tcl.lang | |
| 334 | -txt = nohilite.lang | |
| 335 | -ui = xml.lang | |
| 336 | -vbs = vbscript.lang | |
| 337 | -vbscript = vbscript.lang | |
| 338 | -xhtml = xml.lang | |
| 339 | -xml = xml.lang | |
| 340 | -xorg = xorg.lang | |
| 341 | -y = bison.lang | |
| 342 | -yacc = bison.lang | |
| 343 | -yy = bison.lang | |
| 344 | -</pre></td></tr></table> | |
| 345 | - | |
| 346 | -<p>Source-highlight(3.1.3)で本来サポートされている出力フォーマットの完全なリストは、<code>--outlang-list</code>で報告されるものと同じであるが、以下のものである。 | |
| 347 | -</p> | |
| 348 | -<table><tr><td> </td><td><pre class="example">docbook = docbook.outlang | |
| 349 | -esc = esc.outlang | |
| 350 | -html = html.outlang | |
| 351 | -html-css = htmlcss.outlang | |
| 352 | -htmltable = htmltable.outlang | |
| 353 | -javadoc = javadoc.outlang | |
| 354 | -latex = latex.outlang | |
| 355 | -latexcolor = latexcolor.outlang | |
| 356 | -texinfo = texinfo.outlang | |
| 357 | -xhtml = xhtml.outlang | |
| 358 | -xhtml-css = xhtmlcss.outlang | |
| 359 | -xhtmltable = xhtmltable.outlang | |
| 360 | -</pre></td></tr></table> | |
| 361 | - | |
| 362 | -<p><code>-css</code>と後ろに付いているものについては、<a href="#SEC32">出力言語マップ</a>で説明する<a name="DOCF1" href="#FOOT1">(1)</a>。 | |
| 363 | -</p> | |
| 364 | -<p>留意しおいてほしいのだが、私は、個人的には、こういった言語の定義を全てテストしているわけではない。 | |
| 365 | -実のところ、定義ファイルが文法的に正しいことは(コマンドラインオプションの<code>--check-lang</code>と<code>--check-outlang</code>を使って <a href="#SEC35"><code>source-highlight</code>の起動</a>)チェックしているが、それらの定義がその言語のシンタックスを本当に遵守しているかは確かめてはいない(たとえば、インターネットで情報を探して言語の定義を作り上げたものがあるが、私がその言語でプログラムを書いた経験はなかったりする)。 | |
| 366 | -なので、的確ではない言語の定義があったならば教えてほしい。 | |
| 367 | -そしてまた、‘<tt>test</tt>’ディレクトリに入っていない言語のプログラム例を持っている場合は、それを私に送ってほしい。 | |
| 368 | -そうすれば、そのテストスイートに入れることができる。 | |
| 369 | -</p> | |
| 370 | -<hr size="6"> | |
| 371 | -<a name="source_002dhighlight_002dsettings_30d7_30ed_30b0_30e9_30e0"></a> | |
| 372 | -<a name="SEC3"></a> | |
| 373 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 374 | -<tr><td valign="middle" align="left">[<a href="#SEC2" title="Previous section in reading order"> < </a>]</td> | |
| 375 | -<td valign="middle" align="left">[<a href="#SEC4" title="Next section in reading order"> > </a>]</td> | |
| 376 | -<td valign="middle" align="left"> </td> | |
| 377 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 378 | -<td valign="middle" align="left">[<a href="#SEC1" title="Up section"> Up </a>]</td> | |
| 379 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 380 | -<td valign="middle" align="left"> </td> | |
| 381 | -<td valign="middle" align="left"> </td> | |
| 382 | -<td valign="middle" align="left"> </td> | |
| 383 | -<td valign="middle" align="left"> </td> | |
| 384 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 385 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 386 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 387 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 388 | -</tr></table> | |
| 389 | -<h2 class="section"> 1.2 <code>source-highlight-settings</code>プログラム </h2> | |
| 390 | - | |
| 391 | -<p>バージョン3.0から、GNU Source-highlightには、<code>source-highlight-settings</code>というプログラムも入っている。 | |
| 392 | -これは、source-highlightがその言語の定義ファイルやその他の設定ファイルが見つけられるかどうかをチェックして、念の為、ユーザのホームディレクトリの中の設定ファイルに正しい設定を格納するのに使われる。 | |
| 393 | -</p> | |
| 394 | -<a name="IDX2"></a> | |
| 395 | -<p>特に、この格納された設定ファイルは‘<tt>source-highlight.conf</tt>’というもので、‘<tt>$HOME/.source-highlight/</tt>’の中に収められる。 | |
| 396 | -</p> | |
| 397 | -<a name="IDX3"></a> | |
| 398 | -<p>差し当たり、このファイルには<code>--data-dir</code>のためのデフォルト値が格納される。 | |
| 399 | -</p> | |
| 400 | -<p>ユーザは、 | |
| 401 | -<a name="IDX4"></a> | |
| 402 | -<code>SOURCE_HIGHLIGHT_DATADIR</code>環境変数を使って、いつでもこの設定ファイルの内容と、ハードコードされているデフォルト値をオーバーライドしてよい。 | |
| 403 | -</p> | |
| 404 | -<hr size="6"> | |
| 405 | -<a name="g_t_3044_304f_3064_304b_306e_8a00_8a9e_306b_3064_3044_3066_306e_6ce8_610f"></a> | |
| 406 | -<a name="SEC4"></a> | |
| 407 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 408 | -<tr><td valign="middle" align="left">[<a href="#SEC3" title="Previous section in reading order"> < </a>]</td> | |
| 409 | -<td valign="middle" align="left">[<a href="#SEC5" title="Next section in reading order"> > </a>]</td> | |
| 410 | -<td valign="middle" align="left"> </td> | |
| 411 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 412 | -<td valign="middle" align="left">[<a href="#SEC1" title="Up section"> Up </a>]</td> | |
| 413 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 414 | -<td valign="middle" align="left"> </td> | |
| 415 | -<td valign="middle" align="left"> </td> | |
| 416 | -<td valign="middle" align="left"> </td> | |
| 417 | -<td valign="middle" align="left"> </td> | |
| 418 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 419 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 420 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 421 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 422 | -</tr></table> | |
| 423 | -<h2 class="section"> 1.3 いくつかの言語についての注意 </h2> | |
| 424 | - | |
| 425 | -<p>このセクションでは、特定の言語のハイライティングについて細部に触れるつもりだ。 | |
| 426 | -これらのノートは、ハイライティングされる言語が、コマンドラインでのさらなる指定が必要な「方言」を持つような場合に役に立つかもしれない(たとえば、特定の方言を選択するためなど)。 | |
| 427 | -</p> | |
| 428 | -<table class="menu" border="0" cellspacing="0"> | |
| 429 | -<tr><td align="left" valign="top"><a href="#SEC5">1.3.1 Fortran</a></td><td> </td><td align="left" valign="top"> | |
| 430 | -</td></tr> | |
| 431 | -<tr><td align="left" valign="top"><a href="#SEC6">1.3.2 Perl</a></td><td> </td><td align="left" valign="top"> | |
| 432 | -</td></tr> | |
| 433 | -</table> | |
| 434 | - | |
| 435 | -<hr size="6"> | |
| 187 | +</blockquote> | |
| 188 | + | |
| 189 | +<!-- All the nodes can be updated using the EMACS command --> | |
| 190 | +<!-- texinfo-every-node-update, which is normally bound to C-c C-u C-e. --> | |
| 191 | +<!-- @node Top, Introduction, (dir), (dir) --> | |
| 192 | +<!-- All the menus can be updated with the EMACS command --> | |
| 193 | +<!-- texinfo-all-menus-update, which is normally bound to C-c C-u C-a. --> | |
| 194 | +<ul class="menu"> | |
| 195 | +<li><a accesskey="1" href="#Introduction">Introduction</a>: What's it for? | |
| 196 | +<li><a accesskey="2" href="#Installation">Installation</a>: Download and installation | |
| 197 | +<li><a accesskey="3" href="#Copying">Copying</a>: Licence issues | |
| 198 | +<li><a accesskey="4" href="#Simple-Usage">Simple Usage</a>: Very basic usage | |
| 199 | +<li><a accesskey="5" href="#Configuration-files">Configuration files</a>: Files needed for execution | |
| 200 | +<li><a accesskey="6" href="#Invoking-source_002dhighlight">Invoking source-highlight</a>: How to run <samp><span class="command">source-highlight</span></samp>. | |
| 201 | +<li><a accesskey="7" href="#Language-Definitions">Language Definitions</a>: How to define an input language | |
| 202 | +<li><a accesskey="8" href="#Output-Language-Definitions">Output Language Definitions</a>: How to define an output format | |
| 203 | +<li><a accesskey="9" href="#Generating-References">Generating References</a>: Anchors and cross references | |
| 204 | +<li><a href="#Examples">Examples</a>: Some output examples | |
| 205 | +<li><a href="#Problems">Problems</a>: Reporting bugs. | |
| 206 | +<li><a href="#Mailing-Lists">Mailing Lists</a> | |
| 207 | +<li><a href="#Concept-Index">Concept Index</a>: Index of concepts. | |
| 208 | +</ul> | |
| 209 | + | |
| 210 | +<div class="node"> | |
| 211 | +<a name="Introduction"></a> | |
| 212 | +<p><hr> | |
| 213 | +Next: <a rel="next" accesskey="n" href="#Installation">Installation</a>, | |
| 214 | +Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>, | |
| 215 | +Up: <a rel="up" accesskey="u" href="#Top">Top</a> | |
| 216 | + | |
| 217 | +</div> | |
| 218 | + | |
| 219 | +<h2 class="chapter">1 Introduction</h2> | |
| 220 | + | |
| 221 | +<p><a name="index-introduction-1"></a><a name="index-features-2"></a> | |
| 222 | +GNU Source-highlight, given a source file, produces a document with | |
| 223 | +syntax highlighting. The colors and the styles can be specified (bold, | |
| 224 | +italics, underline) by means of a configuration file, and some other | |
| 225 | +options can be specified at the command line. | |
| 226 | + | |
| 227 | + <p>The program already recognizes many programming languages (e.g., C++, | |
| 228 | +Java, Perl, etc.) and file formats (e.g., log files, ChangeLog, etc.), | |
| 229 | +and some output formats (e.g., HTML, ANSI color escape sequences, | |
| 230 | +LaTeX, etc.). Since version 2.0, it allows you to specify your own | |
| 231 | +input source language via a simple syntax described later in this manual | |
| 232 | +(<a href="#Language-Definitions">Language Definitions</a>). Since version 2.1, it allows you to | |
| 233 | +specify your own output format language via a simple syntax described | |
| 234 | +later in this manual (<a href="#Output-Language-Definitions">Output Language Definitions</a>). Since version | |
| 235 | +2.2, it is able to generate cross references (e.g., to variable names, | |
| 236 | +field names, etc.) by relying on the program <em>ctags</em>, | |
| 237 | +<a href="http://ctags.sourceforge.net">http://ctags.sourceforge.net</a> (<a href="#Generating-References">Generating References</a>). | |
| 238 | + | |
| 239 | + <p><a name="index-library-3"></a>Since version 3.0, GNU Source-highlight also provides a C++ library | |
| 240 | +(which is used by the main program itself), that can be used | |
| 241 | +by C++ programmers to add highlighting functionalities to their | |
| 242 | +programs. see <a href="source-highlight-info.html#Introduction">Introduction</a>. | |
| 243 | + | |
| 244 | +<ul class="menu"> | |
| 245 | +<li><a accesskey="1" href="#Supported-languages">Supported languages</a> | |
| 246 | +<li><a accesskey="2" href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a> | |
| 247 | +<li><a accesskey="3" href="#Notes-on-some-languages">Notes on some languages</a> | |
| 248 | +<li><a accesskey="4" href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a> | |
| 249 | +<li><a accesskey="5" href="#Related-Software-and-Links">Related Software and Links</a> | |
| 250 | +</ul> | |
| 251 | + | |
| 252 | +<div class="node"> | |
| 253 | +<a name="Supported-languages"></a> | |
| 254 | +<p><hr> | |
| 255 | +Next: <a rel="next" accesskey="n" href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a>, | |
| 256 | +Previous: <a rel="previous" accesskey="p" href="#Introduction">Introduction</a>, | |
| 257 | +Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a> | |
| 258 | + | |
| 259 | +</div> | |
| 260 | + | |
| 261 | +<h3 class="section">1.1 Supported languages</h3> | |
| 262 | + | |
| 263 | +<p>The complete list of languages (indeed, file extensions) natively | |
| 264 | +supported by this version of Source-highlight (3.1.4), as | |
| 265 | +reported by <code>--lang-list</code>, is the following: | |
| 266 | + | |
| 267 | +<pre class="example"> C = cpp.lang | |
| 268 | + H = cpp.lang | |
| 269 | + ac = m4.lang | |
| 270 | + ada = ada.lang | |
| 271 | + adb = ada.lang | |
| 272 | + am = makefile.lang | |
| 273 | + applescript = applescript.lang | |
| 274 | + asm = asm.lang | |
| 275 | + autoconf = m4.lang | |
| 276 | + awk = awk.lang | |
| 277 | + bash = sh.lang | |
| 278 | + bat = bat.lang | |
| 279 | + batch = bat.lang | |
| 280 | + bib = bib.lang | |
| 281 | + bison = bison.lang | |
| 282 | + c = c.lang | |
| 283 | + caml = caml.lang | |
| 284 | + cbl = cobol.lang | |
| 285 | + cc = cpp.lang | |
| 286 | + changelog = changelog.lang | |
| 287 | + clipper = clipper.lang | |
| 288 | + cls = latex.lang | |
| 289 | + cobol = cobol.lang | |
| 290 | + conf = conf.lang | |
| 291 | + cpp = cpp.lang | |
| 292 | + cs = csharp.lang | |
| 293 | + csh = sh.lang | |
| 294 | + csharp = csharp.lang | |
| 295 | + css = css.lang | |
| 296 | + ctp = php.lang | |
| 297 | + d = d.lang | |
| 298 | + desktop = desktop.lang | |
| 299 | + diff = diff.lang | |
| 300 | + dmd = d.lang | |
| 301 | + docbook = xml.lang | |
| 302 | + dtx = latex.lang | |
| 303 | + eps = postscript.lang | |
| 304 | + erl = erlang.lang | |
| 305 | + erlang = erlang.lang | |
| 306 | + errors = errors.lang | |
| 307 | + fixed-fortran = fixed-fortran.lang | |
| 308 | + flex = flex.lang | |
| 309 | + fortran = fortran.lang | |
| 310 | + free-fortran = fortran.lang | |
| 311 | + glsl = glsl.lang | |
| 312 | + h = cpp.lang | |
| 313 | + haskell = haskell.lang | |
| 314 | + haxe = haxe.lang | |
| 315 | + hh = cpp.lang | |
| 316 | + hpp = cpp.lang | |
| 317 | + hs = haskell.lang | |
| 318 | + htm = html.lang | |
| 319 | + html = html.lang | |
| 320 | + hx = haxe.lang | |
| 321 | + in = makefile.lang | |
| 322 | + ini = desktop.lang | |
| 323 | + java = java.lang | |
| 324 | + javascript = javascript.lang | |
| 325 | + js = javascript.lang | |
| 326 | + kcfg = xml.lang | |
| 327 | + kdevelop = xml.lang | |
| 328 | + kidl = xml.lang | |
| 329 | + ksh = sh.lang | |
| 330 | + l = flex.lang | |
| 331 | + lang = langdef.lang | |
| 332 | + langdef = langdef.lang | |
| 333 | + latex = latex.lang | |
| 334 | + ldap = ldap.lang | |
| 335 | + ldif = ldap.lang | |
| 336 | + lex = flex.lang | |
| 337 | + lgt = logtalk.lang | |
| 338 | + lhs = haskell_literate.lang | |
| 339 | + lisp = lisp.lang | |
| 340 | + ll = flex.lang | |
| 341 | + log = log.lang | |
| 342 | + logtalk = logtalk.lang | |
| 343 | + lsm = lsm.lang | |
| 344 | + lua = lua.lang | |
| 345 | + m4 = m4.lang | |
| 346 | + makefile = makefile.lang | |
| 347 | + manifest = manifest.lang | |
| 348 | + mf = manifest.lang | |
| 349 | + ml = caml.lang | |
| 350 | + mli = caml.lang | |
| 351 | + moc = cpp.lang | |
| 352 | + outlang = outlang.lang | |
| 353 | + oz = oz.lang | |
| 354 | + pas = pascal.lang | |
| 355 | + pascal = pascal.lang | |
| 356 | + patch = diff.lang | |
| 357 | + pc = pc.lang | |
| 358 | + perl = perl.lang | |
| 359 | + php = php.lang | |
| 360 | + php3 = php.lang | |
| 361 | + php4 = php.lang | |
| 362 | + php5 = php.lang | |
| 363 | + pkgconfig = pc.lang | |
| 364 | + pl = prolog.lang | |
| 365 | + pm = perl.lang | |
| 366 | + postscript = postscript.lang | |
| 367 | + prg = clipper.lang | |
| 368 | + prolog = prolog.lang | |
| 369 | + properties = properties.lang | |
| 370 | + proto = proto.lang | |
| 371 | + protobuf = proto.lang | |
| 372 | + ps = postscript.lang | |
| 373 | + py = python.lang | |
| 374 | + python = python.lang | |
| 375 | + rb = ruby.lang | |
| 376 | + rc = xml.lang | |
| 377 | + ruby = ruby.lang | |
| 378 | + s = asm.lang | |
| 379 | + scala = scala.lang | |
| 380 | + scpt = applescript.lang | |
| 381 | + sh = sh.lang | |
| 382 | + shell = sh.lang | |
| 383 | + sig = sml.lang | |
| 384 | + sl = slang.lang | |
| 385 | + slang = slang.lang | |
| 386 | + slsh = slang.lang | |
| 387 | + sml = sml.lang | |
| 388 | + spec = spec.lang | |
| 389 | + sql = sql.lang | |
| 390 | + sty = latex.lang | |
| 391 | + style = style.lang | |
| 392 | + syslog = log.lang | |
| 393 | + tcl = tcl.lang | |
| 394 | + tcsh = sh.lang | |
| 395 | + tex = latex.lang | |
| 396 | + texi = texinfo.lang | |
| 397 | + texinfo = texinfo.lang | |
| 398 | + tk = tcl.lang | |
| 399 | + txt = nohilite.lang | |
| 400 | + ui = xml.lang | |
| 401 | + vala = vala.lang | |
| 402 | + vbs = vbscript.lang | |
| 403 | + vbscript = vbscript.lang | |
| 404 | + xhtml = xml.lang | |
| 405 | + xml = xml.lang | |
| 406 | + xorg = xorg.lang | |
| 407 | + y = bison.lang | |
| 408 | + yacc = bison.lang | |
| 409 | + yy = bison.lang | |
| 410 | +</pre> | |
| 411 | + <p>The complete list of output formats natively supported by this version | |
| 412 | +of Source-highlight (3.1.4), as reported by | |
| 413 | +<code>--outlang-list</code>, is the following: | |
| 414 | + | |
| 415 | +<pre class="example"> docbook = docbook.outlang | |
| 416 | + esc = esc.outlang | |
| 417 | + html = html.outlang | |
| 418 | + html-css = htmlcss.outlang | |
| 419 | + htmltable = htmltable.outlang | |
| 420 | + javadoc = javadoc.outlang | |
| 421 | + latex = latex.outlang | |
| 422 | + latexcolor = latexcolor.outlang | |
| 423 | + texinfo = texinfo.outlang | |
| 424 | + xhtml = xhtml.outlang | |
| 425 | + xhtml-css = xhtmlcss.outlang | |
| 426 | + xhtmltable = xhtmltable.outlang | |
| 427 | +</pre> | |
| 428 | + <p class="noindent">The meaning of the suffix <code>-css</code> is explained in <a href="#Output-Language-map">Output Language map</a><a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>. | |
| 429 | + | |
| 430 | + <p>Please, keep in mind, that I haven't tested personally all these | |
| 431 | +language definitions: I actually checked that the definition files are | |
| 432 | +syntactically correct (with the command line option <code>--check-lang</code> | |
| 433 | +and <code>--check-outlang</code>, <a href="#Invoking-source_002dhighlight">Invoking source-highlight</a>), but I'm | |
| 434 | +not sure their definition actually respects that language syntax (e.g., | |
| 435 | +I've put up together some language definitions by searching for | |
| 436 | +information in the Internet, but I've never programmed in that | |
| 437 | +language). So, if you find that a language definition is not precise, | |
| 438 | +please let me know. Moreover, if you have a program example in a | |
| 439 | +language that's not included in the <samp><span class="file">tests</span></samp> directory, please send | |
| 440 | +it to me so that I can include it in the test suite. | |
| 441 | + | |
| 442 | +<div class="node"> | |
| 443 | +<a name="The-program-source-highlight-settings"></a> | |
| 444 | +<a name="The-program-source_002dhighlight_002dsettings"></a> | |
| 445 | +<p><hr> | |
| 446 | +Next: <a rel="next" accesskey="n" href="#Notes-on-some-languages">Notes on some languages</a>, | |
| 447 | +Previous: <a rel="previous" accesskey="p" href="#Supported-languages">Supported languages</a>, | |
| 448 | +Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a> | |
| 449 | + | |
| 450 | +</div> | |
| 451 | + | |
| 452 | +<h3 class="section">1.2 The program <code>source-highlight-settings</code></h3> | |
| 453 | + | |
| 454 | +<p><a name="index-source_002dhighlight_002dsettings-4"></a>Since version 3.0, GNU Source-highlight includes also the program | |
| 455 | +<code>source-highlight-settings</code>, which can be used to check whether | |
| 456 | +source-highlight will be able find its language definition files, and | |
| 457 | +other configuration files, and in case, to store the correct settings in | |
| 458 | +a configuration file, in the user home directory. | |
| 459 | + | |
| 460 | + <p><a name="index-source_002dhighlight_002econf-5"></a>In particular, the stored configuration file will be called | |
| 461 | +<samp><span class="file">source-highlight.conf</span></samp> and stored in | |
| 462 | +<samp><span class="file">$HOME/.source-highlight/</span></samp>. | |
| 463 | + | |
| 464 | + <p><a name="index-g_t_0040code_007b_002d_002ddata_002ddir_007d-6"></a>For the moment, this file only stores the default value for | |
| 465 | +the <code>--data-dir</code> option. | |
| 466 | + | |
| 467 | + <p>The user can always override the contents of this configuration file, | |
| 468 | +and the default hardcoded value, by using the environment variable | |
| 469 | +<a name="index-g_t_0040code_007bSOURCE_005fHIGHLIGHT_005fDATADIR_007d-7"></a><code>SOURCE_HIGHLIGHT_DATADIR</code>. | |
| 470 | + | |
| 471 | +<div class="node"> | |
| 472 | +<a name="Notes-on-some-languages"></a> | |
| 473 | +<p><hr> | |
| 474 | +Next: <a rel="next" accesskey="n" href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a>, | |
| 475 | +Previous: <a rel="previous" accesskey="p" href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a>, | |
| 476 | +Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a> | |
| 477 | + | |
| 478 | +</div> | |
| 479 | + | |
| 480 | +<h3 class="section">1.3 Notes on some languages</h3> | |
| 481 | + | |
| 482 | +<p>In this section I'd like to go into details on the highlighting of some | |
| 483 | +specific programming languages. These notes might be useful when the | |
| 484 | +highlighted language has some “dialects” that might require some | |
| 485 | +further specification at the command line (e.g., to select a specific | |
| 486 | +dialect). | |
| 487 | + | |
| 488 | +<ul class="menu"> | |
| 489 | +<li><a accesskey="1" href="#Fortran">Fortran</a> | |
| 490 | +<li><a accesskey="2" href="#Perl">Perl</a> | |
| 491 | +</ul> | |
| 492 | + | |
| 493 | +<div class="node"> | |
| 436 | 494 | <a name="Fortran"></a> |
| 437 | -<a name="SEC5"></a> | |
| 438 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 439 | -<tr><td valign="middle" align="left">[<a href="#SEC4" title="Previous section in reading order"> < </a>]</td> | |
| 440 | -<td valign="middle" align="left">[<a href="#SEC6" title="Next section in reading order"> > </a>]</td> | |
| 441 | -<td valign="middle" align="left"> </td> | |
| 442 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 443 | -<td valign="middle" align="left">[<a href="#SEC4" title="Up section"> Up </a>]</td> | |
| 444 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 445 | -<td valign="middle" align="left"> </td> | |
| 446 | -<td valign="middle" align="left"> </td> | |
| 447 | -<td valign="middle" align="left"> </td> | |
| 448 | -<td valign="middle" align="left"> </td> | |
| 449 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 450 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 451 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 452 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 453 | -</tr></table> | |
| 454 | -<h3 class="subsection"> 1.3.1 Fortran </h3> | |
| 455 | - | |
| 456 | -<p>Toby Whiteが私に説明したように、Fortranは別々の「フレイバー」に分かれた状態になっている。 | |
| 457 | -ソースファイル内でのカラムの位置によって意味が変わってしまう文字がある固定フォーマットと、そういうことの無いフリーフォーマットである。 | |
| 458 | -たとえば、前者は、<code>*</code>と<code>c</code>によってコマンドライン(訳注:コメント行の間違い?)が開始されるが、それはその文字が最初のカラムで指定されたときだけだ(一方、フリーフォーマットではこういうことは無い)。 | |
| 459 | -</p> | |
| 460 | -<p>デフォルトでは、Fortranファイルはフリーフォマットを想定している。 | |
| 461 | -固定フォーマットが使いたい場合には、<code>--src-lang</code>というコマンドラインオプションで<code>fortran-fixed</code>を指定する必要がある。 | |
| 462 | -</p> | |
| 463 | -<hr size="6"> | |
| 495 | +<p><hr> | |
| 496 | +Next: <a rel="next" accesskey="n" href="#Perl">Perl</a>, | |
| 497 | +Previous: <a rel="previous" accesskey="p" href="#Notes-on-some-languages">Notes on some languages</a>, | |
| 498 | +Up: <a rel="up" accesskey="u" href="#Notes-on-some-languages">Notes on some languages</a> | |
| 499 | + | |
| 500 | +</div> | |
| 501 | + | |
| 502 | +<h4 class="subsection">1.3.1 Fortran</h4> | |
| 503 | + | |
| 504 | +<p><a name="index-Fortran-8"></a>As Toby White explained to me, Fortran comes into different “flavors”: | |
| 505 | +a fixed-format, where some characters have a different semantics | |
| 506 | +depending on their column position in the source file, and a free-format | |
| 507 | +where this is not true. For instance, in the former, <code>*</code> and | |
| 508 | +<code>c</code> start a command line, but only if they are specified in the | |
| 509 | +first column (while this is not true in the free-format). | |
| 510 | + | |
| 511 | + <p>By default, the free-format is assumed for Fortran files; if you want to | |
| 512 | +use the fixed-format, you need to specify <code>fortran-fixed</code> at | |
| 513 | +the <code>--src-lang</code> command line option. | |
| 514 | + | |
| 515 | +<div class="node"> | |
| 464 | 516 | <a name="Perl"></a> |
| 465 | -<a name="SEC6"></a> | |
| 466 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 467 | -<tr><td valign="middle" align="left">[<a href="#SEC5" title="Previous section in reading order"> < </a>]</td> | |
| 468 | -<td valign="middle" align="left">[<a href="#SEC7" title="Next section in reading order"> > </a>]</td> | |
| 469 | -<td valign="middle" align="left"> </td> | |
| 470 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 471 | -<td valign="middle" align="left">[<a href="#SEC4" title="Up section"> Up </a>]</td> | |
| 472 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 473 | -<td valign="middle" align="left"> </td> | |
| 474 | -<td valign="middle" align="left"> </td> | |
| 475 | -<td valign="middle" align="left"> </td> | |
| 476 | -<td valign="middle" align="left"> </td> | |
| 477 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 478 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 479 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 480 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 481 | -</tr></table> | |
| 482 | -<h3 class="subsection"> 1.3.2 Perl </h3> | |
| 483 | - | |
| 484 | -<p>Perlの文法形式、特にその正規表現の仕様は、かなり悪夢だ;-) | |
| 485 | -‘<tt>perl.lang</tt>’の中で可能な限り記述してみたが、特定の正規表現で正しくハイライトされないものがあるかもしれない。 | |
| 486 | -実は私はPerlでプログラムを書いたことがないので、あなたのPerlプログラムで正しくハイライトされていない部分があるのならば、Perlのハイライトを改善できるように私に連絡するのを躊躇わないでほしい。 | |
| 487 | -</p> | |
| 488 | -<a name="IDX5"></a> | |
| 489 | -<p>そしてまた、Perlファイルの標準的な拡張子は<code>.pl</code>だけれども、Prologの言語定義がsource-highlightに実装されたのがPerlよりも早かったために、デフォルトでは、この拡張子はPrologファイルに割り当てられている。 | |
| 490 | -しかし、<code>--infer-lang</code>というコマンドラインオプションを使えば、source-highlightに、入力ファイルの最初の行を調べて言語を検出させるようにすることができる(<a href="#SEC36">入力言語の検出方法</a>)。 | |
| 491 | -Perlのハイライティングであることを明示的に指定するのに、<code>--src-lang=perl</code>というコマンドライン指定を使ってもよい。 | |
| 492 | -</p> | |
| 493 | -<hr size="6"> | |
| 494 | -<a name="g_t_7c21_5358_306a_30d5_30a9_30fc_30de_30c3_30bf_3068_3057_3066_306esource_002dhighlight_306e_4f7f_7528"></a> | |
| 495 | -<a name="SEC7"></a> | |
| 496 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 497 | -<tr><td valign="middle" align="left">[<a href="#SEC6" title="Previous section in reading order"> < </a>]</td> | |
| 498 | -<td valign="middle" align="left">[<a href="#SEC8" title="Next section in reading order"> > </a>]</td> | |
| 499 | -<td valign="middle" align="left"> </td> | |
| 500 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 501 | -<td valign="middle" align="left">[<a href="#SEC1" title="Up section"> Up </a>]</td> | |
| 502 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 503 | -<td valign="middle" align="left"> </td> | |
| 504 | -<td valign="middle" align="left"> </td> | |
| 505 | -<td valign="middle" align="left"> </td> | |
| 506 | -<td valign="middle" align="left"> </td> | |
| 507 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 508 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 509 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 510 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 511 | -</tr></table> | |
| 512 | -<h2 class="section"> 1.4 簡単なフォーマッタとしてのsource-highlightの使用 </h2> | |
| 513 | - | |
| 514 | -<p>source-highlightを入力ファイルの簡単なフォーマッタとして使うこともできる。 | |
| 515 | -すなわち、ハイライティングをさせずに使うこともできる<a name="DOCF2" href="#FOOT2">(2)</a>。 | |
| 516 | -</p> | |
| 517 | -<a name="IDX6"></a> | |
| 518 | -<p>これを実現するには、コマンドラインオプションの<code>--lang-def</code>を使って、入力ソースに対する言語定義ファイルとして、‘<tt>nohilite.lang</tt>’を指定する(<a href="#SEC35"><code>source-highlight</code>の起動</a>)。 | |
| 519 | -その言語定義は空なので、ハイライティングは実行されない。 | |
| 520 | -だが、source-highlightは入力ファイルを指定された出力フォーマットに変換する。 | |
| 521 | -<a href="#SEC2">サポートしている言語</a>にある入力言語の関連付けにおいて、‘<tt>nohilite.lang</tt>’がtxtファイルと関連付けられていることに注意してほしい。 | |
| 522 | -</p> | |
| 523 | -<p>たとえば、これによって、テキストファイルをHTMLやLaTeXに変換したいような場合にsource-highlightが使えるようになる。 | |
| 524 | -出力の際、事実、source-highlightは、出力フォーマットにおいて特別な意味を持つ文字があっても正しくそれらの文字を生成するだろう。 | |
| 525 | -</p> | |
| 526 | -<p>For instance, in this Texinfo manual, | |
| 517 | +<p><hr> | |
| 518 | +Previous: <a rel="previous" accesskey="p" href="#Fortran">Fortran</a>, | |
| 519 | +Up: <a rel="up" accesskey="u" href="#Notes-on-some-languages">Notes on some languages</a> | |
| 520 | + | |
| 521 | +</div> | |
| 522 | + | |
| 523 | +<h4 class="subsection">1.3.2 Perl</h4> | |
| 524 | + | |
| 525 | +<p><a name="index-Perl-9"></a>Perl syntax forms, especially its regular expression specifications, are | |
| 526 | +quite a nightmare ;-) I tried to specify as much as possible in the | |
| 527 | +<samp><span class="file">perl.lang</span></samp> but some particular regular expressions might not be | |
| 528 | +highlighted correctly. Actually, I never programmed in Perl, so, if you | |
| 529 | +see that some parts of your Perl programs are not highlighted correctly, | |
| 530 | +please do not hesitate to contact me, so that I can improve Perl | |
| 531 | +highlighting. | |
| 532 | + | |
| 533 | + <p><a name="index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-10"></a>Moreover, although the standard extension for Perl files is <code>.pl</code>, | |
| 534 | +since the Prolog language definition was implemented in source-highlight | |
| 535 | +before Perl, this extension is assigned, by default, to Prolog files. | |
| 536 | +However, you can use <code>--infer-lang</code> command line option, so that | |
| 537 | +source-highlight can try to detect the language by inspecting the first | |
| 538 | +lines of the input file (<a href="#How-the-input-language-is-discovered">How the input language is discovered</a>); | |
| 539 | +you can also use <code>--src-lang=perl</code> command line specification to | |
| 540 | +explicitly require Perl highlighting. | |
| 541 | + | |
| 542 | +<div class="node"> | |
| 543 | +<a name="Using-source-highlight-as-a-simple-formatter"></a> | |
| 544 | +<a name="Using-source_002dhighlight-as-a-simple-formatter"></a> | |
| 545 | +<p><hr> | |
| 546 | +Next: <a rel="next" accesskey="n" href="#Related-Software-and-Links">Related Software and Links</a>, | |
| 547 | +Previous: <a rel="previous" accesskey="p" href="#Notes-on-some-languages">Notes on some languages</a>, | |
| 548 | +Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a> | |
| 549 | + | |
| 550 | +</div> | |
| 551 | + | |
| 552 | +<h3 class="section">1.4 Using source-highlight as a simple formatter</h3> | |
| 553 | + | |
| 554 | +<p>You can also use source-highlight as a simple formatter of input file, | |
| 555 | +i.e., without performing any highlighting<a rel="footnote" href="#fn-2" name="fnd-2"><sup>2</sup></a>. | |
| 556 | + | |
| 557 | + <p><a name="index-nohilite_002elang-11"></a>You can achieve this by using, as the language definition file for input | |
| 558 | +sources the file <samp><span class="file">nohilite.lang</span></samp>, using the command line option | |
| 559 | +<code>--lang-def</code> (<a href="#Invoking-source_002dhighlight">Invoking source-highlight</a>). Since that | |
| 560 | +language definition is empty, no highlighting will be performed; | |
| 561 | +however, source-highlight will transform the input file in the output | |
| 562 | +format. Note, in the input language associations in <a href="#Supported-languages">Supported languages</a>, that <samp><span class="file">nohilite.lang</span></samp> is also associated to txt files. | |
| 563 | + | |
| 564 | + <p>This, for instance, makes source-highlight useful in cases you want to | |
| 565 | +transform a text file into HTML or LaTeX. During the output, in | |
| 566 | +fact, source-highlight will correctly generate characters that have a | |
| 567 | +specific meanings in the output format. | |
| 568 | + | |
| 569 | + <p>For instance, in this Texinfo manual, | |
| 527 | 570 | if I want to insert a @ or a { |
| 528 | 571 | I have to “escape” them to make them appear literally |
| 529 | -since they have a special meaning in Texinfo. | |
| 530 | -The same holds, e.g., | |
| 531 | -for <code><</code>, <code>></code> or <code>&</code> in HTML. | |
| 532 | -If you use source-highlight, | |
| 533 | -it will take care of this, automatically for you. | |
| 534 | -これが上のセンテンスのTexinfoソースだ: | |
| 535 | -</p> | |
| 536 | -<table><tr><td> </td><td><pre class="example">For instance, in this Texinfo manual, | |
| 537 | -if I want to insert a @@ or a @{ | |
| 538 | -I have to ``escape'' them to make them appear literally | |
| 539 | -since they have a special meaning in Texinfo. | |
| 540 | -The same holds, e.g., | |
| 541 | -for @code{<}, @code{>} or @code{&} in HTML. | |
| 542 | -If you use source-highlight, | |
| 543 | -it will take care of this, automatically for you. | |
| 544 | -</pre></td></tr></table> | |
| 545 | -<p>これは、source-highlightによってハイライト無しの単純なテキストファイルとして処理されたものだ。 | |
| 546 | -しかし、Texinfoでフォーマットされていたので、必要なエスケープ処理が自動的に実行された。 | |
| 547 | -このように、コードとその結果を同じドキュメントの中に簡単に挿入できる(ここでの例のように)。 | |
| 548 | -</p> | |
| 549 | -<p>これは実際にsource-highlightが実行したフォーマットだ。 | |
| 550 | -コメントを除いて、これが、手作業でやる場合に基本的に自分で書かなければならないことである: | |
| 551 | -</p> | |
| 552 | -<table><tr><td> </td><td><pre class="example">@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite | |
| 553 | -@example | |
| 554 | -For instance, in this Texinfo manual, | |
| 555 | -if I want to insert a @@@@ or a @@@{ | |
| 556 | -I have to ``escape'' them to make them appear literally | |
| 557 | -since they have a special meaning in Texinfo. | |
| 558 | -The same holds, e.g., | |
| 559 | -for @@code@{<@}, @@code@{>@} or @@code@{&@} in HTML. | |
| 572 | +since they have a special meaning in Texinfo. | |
| 573 | +The same holds, e.g., | |
| 574 | +for <code><</code>, <code>></code> or <code>&</code> in HTML. | |
| 560 | 575 | If you use source-highlight, |
| 561 | -it will take care of this, automatically for you. | |
| 562 | -@end example | |
| 563 | -</pre></td></tr></table> | |
| 564 | -<a name="IDX7"></a> | |
| 565 | -<p>特定の入力言語をsource-highlightが処理しない場合に、さらに<code>--failsafe</code>オプションを使うことができ(<a href="#SEC35"><code>source-highlight</code>の起動</a>)、そしてその場合はハイライトは実行されないが、source-highlightは入力ファイルを出力フォーマットに変換する。 | |
| 566 | -</p> | |
| 567 | -<a name="IDX8"></a> | |
| 568 | -<p>だが、入力言語が確認できなかった場合には、‘<tt>default.lang</tt>’が使われる。 | |
| 569 | -これは空の言語定義ファイルだが、これをカスタマイズしたいと考えることもあるかもしれない。 | |
| 570 | -</p> | |
| 571 | -<hr size="6"> | |
| 572 | -<a name="g_t_95a2_9023_3059_308b_30bd_30d5_30c8_30a6_30a7_30a2_3068_30ea_30f3_30af"></a> | |
| 573 | -<a name="SEC8"></a> | |
| 574 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 575 | -<tr><td valign="middle" align="left">[<a href="#SEC7" title="Previous section in reading order"> < </a>]</td> | |
| 576 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next section in reading order"> > </a>]</td> | |
| 577 | -<td valign="middle" align="left"> </td> | |
| 578 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 579 | -<td valign="middle" align="left">[<a href="#SEC1" title="Up section"> Up </a>]</td> | |
| 580 | -<td valign="middle" align="left">[<a href="#SEC9" title="Next chapter"> >> </a>]</td> | |
| 581 | -<td valign="middle" align="left"> </td> | |
| 582 | -<td valign="middle" align="left"> </td> | |
| 583 | -<td valign="middle" align="left"> </td> | |
| 584 | -<td valign="middle" align="left"> </td> | |
| 585 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 586 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 587 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 588 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 589 | -</tr></table> | |
| 590 | -<h2 class="section"> 1.5 関連するソフトウェアとリンク </h2> | |
| 591 | - | |
| 592 | -<p>ここに、バックエンドとして使ったり(つまりsource-highlightへのインターフェイスを用意している)、その特徴の一部を使ったり(たとえば、定義ファイル)という意味において、source-highlightと関連しているソフトウェアを挙げていく: | |
| 593 | -</p> | |
| 594 | -<ul class="toc"> | |
| 595 | -<li> | |
| 596 | -<a name="IDX9"></a> | |
| 597 | -<a name="IDX10"></a> | |
| 598 | -Source-highlight-qtは、GNU Source-Highlightライブラリに依存して、Qtドキュメントの中でシンタックスのハイライティングを実行するためのライブラリである。 | |
| 599 | -このライブラリは、qtの抽象クラスのQSyntaxHighlighterの実装を提供していて、Qt3とQt4の両方に対応している。 | |
| 600 | - | |
| 601 | -<p><a href="http://srchiliteqt.sourceforge.net">http://srchiliteqt.sourceforge.net</a>. | |
| 602 | -</p> | |
| 603 | -</li><li> | |
| 604 | -<a name="IDX11"></a> | |
| 605 | -<a name="IDX12"></a> | |
| 606 | -QSource-Highlightは、GNU Source-HighlightのQt4フロントエンドだ(Source-Highlight-Qtライブラリに依存している)。 | |
| 607 | -コードをオンザフライでハイライトすることができ、source-highlightがサポートしている全てのフォーマットでハイライトされた出力を得ることができる(たとえば、HTML、LaTeX、Texinfoなど)。 | |
| 608 | -それから、フォーマットされた出力をコピーし、それをペーストできる(たとえば、ブログなどに)。 | |
| 609 | -またファイルに保存することもできる。 | |
| 610 | -いくつかの出力フォーマット(たとえば、HTML、XHTMLなど)については、ハイライトされた出力のプレビューを見ることができる。 | |
| 611 | - | |
| 612 | -<p><a href="http://qsrchilite.sourceforge.net">http://qsrchilite.sourceforge.net</a>. | |
| 613 | -</p> | |
| 614 | -</li><li> | |
| 615 | -<a name="IDX13"></a> | |
| 616 | -<a name="IDX14"></a> | |
| 617 | -SourceHighlightIDEは、新たなsource-highlight用の言語定義を開発したりデバッグしたりするために私が書いた小さなIDE(KDE用)だ。 | |
| 618 | - | |
| 619 | -<p><a href="http://srchighliteide.sourceforge.net">http://srchighliteide.sourceforge.net</a>. | |
| 620 | -</p> | |
| 621 | -</li><li> | |
| 622 | -<a name="IDX15"></a> | |
| 623 | -<a name="IDX16"></a> | |
| 624 | -Martin Gebertがsource-highlightプログラムのKDEインターフェイスを実装した(彼は素晴しい仕事をしてくれた)。 | |
| 625 | -<em>Ksrc2highlight</em>というものだ。 | |
| 626 | -試してみたい場合は以下: | |
| 627 | - | |
| 628 | -<p><a href="http://www.mgebert.de/Ksrc2highlight">http://www.mgebert.de/Ksrc2highlight</a>. | |
| 629 | -</p> | |
| 630 | -</li><li> | |
| 631 | -<a name="IDX17"></a> | |
| 632 | -java2htmlのJavaバージョンもある。 | |
| 633 | -以下のところにある。 | |
| 634 | - | |
| 635 | -<p><a href="http://www.generationjava.com/projects/Java2Html.shtml">http://www.generationjava.com/projects/Java2Html.shtml</a>. | |
| 636 | -</p> | |
| 637 | -</li><li> | |
| 638 | -このウェブサイトはオンラインでハイライティングをするためのsource-highlightのインターフェイスを提供している。 | |
| 639 | - | |
| 640 | -<p><a href="http://www.alaide.com/outils_colorsyntaxe.php">http://www.alaide.com/outils_colorsyntaxe.php</a> | |
| 641 | -</p> | |
| 642 | -</li><li> | |
| 643 | -<a name="IDX18"></a> | |
| 644 | -SHJSは、HTMLドキュメントの中でソースコード片をハイライトするJavaScriptプログラムだ。 | |
| 645 | -SHJSを使ったドキュメントはウェブブラウザによってクライアントサイドでハイライトされる。 | |
| 646 | -SHJSはSource-highlightの言語定義を使用している。 | |
| 647 | - | |
| 648 | -<p><a href="http://shjs.sourceforge.net">http://shjs.sourceforge.net</a> | |
| 649 | -</p> | |
| 650 | -</li><li> | |
| 651 | -<a name="IDX19"></a> | |
| 652 | -Code2blogは、source-highlightのpyGTKフロントエンドで、ソースコードをHTMLへ簡単に変換するためのものだ。 | |
| 653 | - | |
| 654 | -<p><a href="http://code.google.com/p/code2blog">http://code.google.com/p/code2blog</a> | |
| 655 | -</p> | |
| 656 | -</li><li> | |
| 657 | -<a name="IDX20"></a> | |
| 658 | -Andy Buckleyは、source-highlightのラッパを書いた。 | |
| 659 | -これは、ウェブページの中でソースコードをオンザフライにハイライティングするApacheフィルタとして使うことができる。 | |
| 660 | - | |
| 661 | -<p><a href="http://www.insectnation.org/projects/filter-src-highlight">http://www.insectnation.org/projects/filter-src-highlight</a> | |
| 662 | -</p> | |
| 663 | -</li><li> | |
| 664 | -<a name="IDX21"></a> | |
| 665 | -Roger Nilssonは、RapidWeaverというOSX用のポピュラーなウェブデザインアプリケーションで使えるsource-highlightのフロントエンドを書いた。 | |
| 666 | -このフロントエンドはHigh-Lightと言うもので、RapidWeaverの内部で、ユーザが簡単にシンタックスが色付けされたコードを追加することができるようにするものだ。 | |
| 667 | - | |
| 668 | -<p><a href="http://nilrogsplace.se/webdesign/rapidweaver/plugins/high-light/index_en.html">http://nilrogsplace.se/webdesign/rapidweaver/plugins/high-light/index_en.html</a> | |
| 669 | -</p> | |
| 670 | -</li><li> | |
| 671 | -<a name="IDX22"></a> | |
| 672 | -Mauricio Zepedaは、自動的にファイルをハイライトしてFirefoxでそれを表示するスクリプトについて、彼のブログに記事を書いた。 | |
| 673 | - | |
| 674 | -<p><a href="http://chillorb.com/?p=122">http://chillorb.com/?p=122</a> | |
| 675 | -</p> | |
| 676 | -</li><li> | |
| 677 | -<a name="IDX23"></a> | |
| 678 | -<a name="IDX24"></a> | |
| 679 | -Jason Blevinsは、ソースコード片やファイル全体のシンタックスハイライティングを有効にするIkiwiki用のプラグインを作成した。 | |
| 680 | - | |
| 681 | -<p><a href="http://jblevins.org/projects/ikiwiki/code">http://jblevins.org/projects/ikiwiki/code</a> | |
| 682 | -</p> | |
| 683 | -</li><li> | |
| 684 | -<a name="IDX25"></a> | |
| 685 | -<a name="IDX26"></a> | |
| 686 | -Pascal Bleserは、プロセスを生成したり、source-highlightのCGIを使うのではなく、PHPから直接GNU source-highlightライブラリを使うPHP拡張を作成した。 | |
| 687 | - | |
| 688 | -<p><a href="http://code.google.com/p/php-source-highlight/">http://code.google.com/p/php-source-highlight/</a> | |
| 689 | -</p> | |
| 576 | +it will take care of this, automatically for you. | |
| 577 | +This is the Texinfo source of the above sentence: | |
| 578 | + | |
| 579 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 580 | +<pre class="example"> For instance, in this Texinfo manual, | |
| 581 | + if I want to insert a @@ or a @{ | |
| 582 | + I have to ``escape'' them to make them appear literally | |
| 583 | + since they have a special meaning in Texinfo. | |
| 584 | + The same holds, e.g., | |
| 585 | + for @code{<}, @code{>} or @code{&} in HTML. | |
| 586 | + If you use source-highlight, | |
| 587 | + it will take care of this, automatically for you. | |
| 588 | +</pre> | |
| 589 | + <p class="noindent">This was processed by source-highlight as a simple text file, without no | |
| 590 | +highlighting; however since it was formatted in Texinfo, all the | |
| 591 | +necessary escaping was automatically performed. This way, it is very | |
| 592 | +easy to insert, in the same document, a code, and its result (as in this | |
| 593 | +example). | |
| 594 | + | |
| 595 | + <p>This is actually the formatting performed by source-highlight; except | |
| 596 | +for the comment, this is basically what you should have written yourself | |
| 597 | +to do all the escaping stuff manually: | |
| 598 | + | |
| 599 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 600 | +<pre class="example"> @c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite | |
| 601 | + @example | |
| 602 | + For instance, in this Texinfo manual, | |
| 603 | + if I want to insert a @@@@ or a @@@{ | |
| 604 | + I have to ``escape'' them to make them appear literally | |
| 605 | + since they have a special meaning in Texinfo. | |
| 606 | + The same holds, e.g., | |
| 607 | + for @@code@{<@}, @@code@{>@} or @@code@{&@} in HTML. | |
| 608 | + If you use source-highlight, | |
| 609 | + it will take care of this, automatically for you. | |
| 610 | + @end example | |
| 611 | +</pre> | |
| 612 | + <p><a name="index-failsafe-12"></a>In case source-highlight does not handle a specific input language, you | |
| 613 | +can still use the option <code>--failsafe</code> (<a href="#Invoking-source_002dhighlight">Invoking source-highlight</a>) and also in that case no highlighting will be | |
| 614 | +performed, but source-highlight will transform the input file in the | |
| 615 | +output format. | |
| 616 | + | |
| 617 | + <p><a name="index-default_002elang-13"></a>Note, however, that if the input language cannot be established, the | |
| 618 | +<samp><span class="file">default.lang</span></samp> will be used: an empty language definition file | |
| 619 | +which you might want to customize. | |
| 620 | + | |
| 621 | +<div class="node"> | |
| 622 | +<a name="Related-Software-and-Links"></a> | |
| 623 | +<p><hr> | |
| 624 | +Previous: <a rel="previous" accesskey="p" href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a>, | |
| 625 | +Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a> | |
| 690 | 626 | |
| 691 | -</li></ul> | |
| 627 | +</div> | |
| 628 | + | |
| 629 | +<h3 class="section">1.5 Related Software and Links</h3> | |
| 630 | + | |
| 631 | +<p>Here we list some software related to source-highlight in the sense that | |
| 632 | +it uses it as a backend (i.e., provides an interface to | |
| 633 | +source-highlight) or it uses some of its features (e.g., definition | |
| 634 | +files): | |
| 635 | + | |
| 636 | + <ul> | |
| 637 | +<li><a name="index-Source_002dHighlight_002dQt-14"></a><a name="index-Qt-15"></a>Source-highlight-qt is a library for performing syntax highlighting in | |
| 638 | +Qt documents by relying on GNU Source-Highlight library. This library | |
| 639 | +provides an implementation of the qt abstract class QSyntaxHighlighter | |
| 640 | +class, and it deals both with Qt3 and Qt4. | |
| 641 | + | |
| 642 | + <p><a href="http://srchiliteqt.sourceforge.net">http://srchiliteqt.sourceforge.net</a>. | |
| 643 | + | |
| 644 | + <li><a name="index-QSource_002dHighlight-16"></a><a name="index-Qt-17"></a>QSource-Highlight is a Qt4 front-end for GNU Source-Highlight (it relies | |
| 645 | +on the library Source-Highlight-Qt). You can highlight your code on the | |
| 646 | +fly, and have the highlighted output in all the formats supported by | |
| 647 | +source-highlight (e.g., HTML, LaTeX, Texinfo, etc.). You can then copy | |
| 648 | +the formatted output and paste it (e.g., in your blog), or save it to a | |
| 649 | +file. A preview of the highlighted output is available for some output | |
| 650 | +formats (e.g., HTML, XHTML, etc.). | |
| 651 | + | |
| 652 | + <p><a href="http://qsrchilite.sourceforge.net">http://qsrchilite.sourceforge.net</a>. | |
| 653 | + | |
| 654 | + <li><a name="index-SourceHighlightIDE-18"></a><a name="index-KDE-19"></a>SourceHighlightIDE is a small IDE (based on Qt4 and | |
| 655 | +Source-highlight-qt) I wrote for developing | |
| 656 | +and debugging new language definitions for source-highlight: | |
| 657 | + | |
| 658 | + <p><a href="http://srchighliteide.sourceforge.net">http://srchighliteide.sourceforge.net</a>. | |
| 659 | + | |
| 660 | + <li><a name="index-Ksrc2highlight-20"></a><a name="index-KDE-21"></a>Martin Gebert implemented a KDE interface to source-highlight programs | |
| 661 | +(and he did a wonderful job!), and it is called <em>Ksrc2highlight</em>; | |
| 662 | +if you want to test it: | |
| 663 | + | |
| 664 | + <p><a href="http://www.mgebert.de/Ksrc2highlight">http://www.mgebert.de/Ksrc2highlight</a>. | |
| 665 | + | |
| 666 | + <li><a name="index-java2html-22"></a>There's also a Java version of java2html, you can find it at | |
| 667 | + | |
| 668 | + <p><a href="http://www.generationjava.com/projects/Java2Html.shtml">http://www.generationjava.com/projects/Java2Html.shtml</a>. | |
| 669 | + | |
| 670 | + <li>This web site provides a web interface to source-highlight | |
| 671 | +so that you can highlight your code on-line: | |
| 672 | + | |
| 673 | + <p><a href="http://www.alaide.com/outils_colorsyntaxe.php">http://www.alaide.com/outils_colorsyntaxe.php</a> | |
| 674 | + | |
| 675 | + <li><a name="index-SHJS-23"></a>SHJS is a JavaScript program that highlights source code passages in | |
| 676 | +HTML documents. Documents using SHJS are highlighted on the client side | |
| 677 | +by the web browser. SHJS uses language definitions from | |
| 678 | +Source-highlight. | |
| 679 | + | |
| 680 | + <p><a href="http://shjs.sourceforge.net">http://shjs.sourceforge.net</a> | |
| 681 | + | |
| 682 | + <li><a name="index-code2blog-24"></a>Code2blog is a pyGTK front-end to source-highlight for easy conversion | |
| 683 | +from source code to HTML. | |
| 684 | + | |
| 685 | + <p><a href="http://code.google.com/p/code2blog">http://code.google.com/p/code2blog</a> | |
| 686 | + | |
| 687 | + <li><a name="index-Apache-25"></a>Andy Buckley wrote a wrapper around source-highlight, which can be used | |
| 688 | +as an Apache filter to highlight source code in Web pages on the fly. | |
| 689 | + | |
| 690 | + <p><a href="http://www.insectnation.org/projects/filter-src-highlight">http://www.insectnation.org/projects/filter-src-highlight</a> | |
| 691 | + | |
| 692 | + <li><a name="index-RapidWeaver-26"></a>Roger Nilsson wrote a frontend for source-highlight that is used in a | |
| 693 | +popular webdesign app for OSX called RapidWeaver. The frontend is called | |
| 694 | +High-Light and allows users to easily add syntax-colored code inside | |
| 695 | +RapidWeaver. | |
| 696 | + | |
| 697 | + <p><a href="http://nilrogsplace.se/webdesign/rapidweaver/plugins/high-light/index_en.html">http://nilrogsplace.se/webdesign/rapidweaver/plugins/high-light/index_en.html</a> | |
| 698 | + | |
| 699 | + <li><a name="index-Firefox-27"></a>Mauricio Zepeda published in his blog an article with a script | |
| 700 | +to automatically highlight a file and show it in Firefox: | |
| 701 | + | |
| 702 | + <p><a href="http://chillorb.com/?p=122">http://chillorb.com/?p=122</a> | |
| 703 | + | |
| 704 | + <li><a name="index-Wiki-28"></a><a name="index-Ikiwiki-29"></a>Jason Blevins made a plugin for Ikiwiki that enables syntax highlighting | |
| 705 | +of source code fragments and whole files via source-highlight. | |
| 706 | + | |
| 707 | + <p><a href="http://jblevins.org/projects/ikiwiki/code">http://jblevins.org/projects/ikiwiki/code</a> | |
| 708 | + | |
| 709 | + <li><a name="index-Wiki-30"></a><a name="index-Php-31"></a>Pascal Bleser created a PHP extension that uses the GNU source-highlight | |
| 710 | +library directly from PHP, instead of relying on spawning a process or | |
| 711 | +using the source-highlight CGI. | |
| 712 | + | |
| 713 | + <p><a href="http://code.google.com/p/php-source-highlight/">http://code.google.com/p/php-source-highlight/</a> | |
| 714 | + | |
| 715 | + <li><a name="index-SIP-32"></a><a name="index-Python-33"></a><a name="index-PyQt-34"></a>Roberto Alsina made a partial python binding using SIP so | |
| 716 | +that you can use Source-Highlight-Qt in PyQt programs. | |
| 717 | + | |
| 718 | + <p><a href="http://marave.googlecode.com/svn/trunk/marave/highlight/">http://marave.googlecode.com/svn/trunk/marave/highlight/</a> | |
| 719 | + | |
| 720 | + <li><a name="index-Perl-35"></a>A perl binding for source-highlight is available at CPAN: | |
| 721 | + | |
| 722 | + <p><a href="http://search.cpan.org/perldoc?Syntax::SourceHighlight">http://search.cpan.org/perldoc?Syntax::SourceHighlight</a> | |
| 723 | + | |
| 724 | + <li><a name="index-Pastebin-36"></a>Danijel Tasov wrote a pastebin service based on | |
| 725 | +perl source-highlight binding: | |
| 726 | + | |
| 727 | + <p><a href="http://pb.rbfh.de">http://pb.rbfh.de</a> | |
| 728 | + | |
| 729 | + </ul> | |
| 730 | + | |
| 731 | +<div class="node"> | |
| 732 | +<a name="Installation"></a> | |
| 733 | +<p><hr> | |
| 734 | +Next: <a rel="next" accesskey="n" href="#Copying">Copying</a>, | |
| 735 | +Previous: <a rel="previous" accesskey="p" href="#Introduction">Introduction</a>, | |
| 736 | +Up: <a rel="up" accesskey="u" href="#Top">Top</a> | |
| 692 | 737 | |
| 738 | +</div> | |
| 693 | 739 | |
| 694 | -<hr size="6"> | |
| 695 | -<a name="g_t_30a4_30f3_30b9_30c8_30fc_30eb"></a> | |
| 696 | -<a name="SEC9"></a> | |
| 697 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 698 | -<tr><td valign="middle" align="left">[<a href="#SEC8" title="Previous section in reading order"> < </a>]</td> | |
| 699 | -<td valign="middle" align="left">[<a href="#SEC10" title="Next section in reading order"> > </a>]</td> | |
| 700 | -<td valign="middle" align="left"> </td> | |
| 701 | -<td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 702 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Up section"> Up </a>]</td> | |
| 703 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 704 | -<td valign="middle" align="left"> </td> | |
| 705 | -<td valign="middle" align="left"> </td> | |
| 706 | -<td valign="middle" align="left"> </td> | |
| 707 | -<td valign="middle" align="left"> </td> | |
| 708 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 709 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 710 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 711 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 712 | -</tr></table> | |
| 713 | -<h1 class="chapter"> 2. インストール </h1> | |
| 714 | - | |
| 715 | -<p>ビルドやインストールの詳細については‘<tt>INSTALL</tt>’を見てほしい。 | |
| 716 | -そもそも、ソースで入手したLinuxソフトウェアをコンパイルするのに慣れているのであれば、いつもの手順を単に辿ればよい。 | |
| 717 | -すなわち、ディレクトリにダウンロードしたファイルをuntarして、それから以下のようにする: | |
| 718 | -</p> | |
| 719 | -<table><tr><td> </td><td><pre class="example">cd <source code main directory> | |
| 720 | -./configure | |
| 721 | -make | |
| 722 | -make install | |
| 723 | -</pre></td></tr></table> | |
| 724 | - | |
| 725 | -<p>しかし、これを実行する前には、source-highlightをビルドするのに必要なものが全てそろっているかチェックしてほしい。 | |
| 726 | -<a href="#SEC13">source-highlightのビルドに必要なもの</a> | |
| 727 | -</p> | |
| 728 | -<p>注意:./configureの<code>--prefix</code>オプションで違うインストールディレクトリを指定した(たとえば、<code>./configure --prefix=<your home></code>)のでない限り、<code>make install</code>の実行にはrootになっている必要がある。 | |
| 729 | -</p> | |
| 730 | -<p>configureスクリプトに渡すことのできるオプションが全て見るのには、<code>./configure --help</code>を実行してほしい。 | |
| 731 | -</p> | |
| 732 | -<a name="IDX27"></a> | |
| 733 | - | |
| 734 | -<p>各ファイルは以下のディレクトリへインストールされる: | |
| 735 | -</p> | |
| 736 | -<dl compact="compact"> | |
| 737 | -<dt> <code>実行ファイル</code></dt> | |
| 738 | -<dd><p> <code>prefix/bin</code> | |
| 739 | -</p></dd> | |
| 740 | -<dt> <code>ドキュメントと出力例</code></dt> | |
| 741 | -<dd><p> <code>prefix/share/doc/source-highlight</code> | |
| 742 | -</p></dd> | |
| 743 | -<dt> <code>ライブラリの例</code></dt> | |
| 744 | -<dd><p> <code>prefix/share/doc/source-highlight/examples</code> | |
| 745 | -</p></dd> | |
| 746 | -<dt> <code>ライブラリAPIのドキュメンテーション</code></dt> | |
| 747 | -<dd><p> <code>prefix/share/doc/source-highlight/api</code> | |
| 748 | -</p></dd> | |
| 749 | -<dt> <code>設定ファイル</code></dt> | |
| 750 | -<dd><p> <code>prefix/share/source-highlight</code> | |
| 751 | -</p></dd> | |
| 740 | +<h2 class="chapter">2 Installation</h2> | |
| 741 | + | |
| 742 | +<p><a name="index-installation-37"></a> | |
| 743 | +See the file <samp><span class="file">INSTALL</span></samp> for detailed building and installation | |
| 744 | +instructions; anyway if you're used to compiling Linux software that | |
| 745 | +comes with sources you may simply follow the usual procedure, i.e., untar | |
| 746 | +the file you downloaded in a directory and then: | |
| 747 | + | |
| 748 | +<pre class="example"> cd <source code main directory> | |
| 749 | + ./configure | |
| 750 | + make | |
| 751 | + make install | |
| 752 | +</pre> | |
| 753 | + <p>However, before you do this, please check that you have everything that | |
| 754 | +is needed to build source-highlight, <a href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a>. | |
| 755 | + | |
| 756 | + <p>Note: unless you specify a different install directory by | |
| 757 | +<code>--prefix</code> option of | |
| 758 | +configure (e.g. <code>./configure --prefix=<your home></code>), | |
| 759 | +you must be root to run <code>make install</code>. | |
| 760 | + | |
| 761 | + <p>You may want to run <code>./configure --help</code> to see all the possible | |
| 762 | +options that can be passed to the configuration script. | |
| 763 | + | |
| 764 | + <p><a name="index-directories-38"></a>Files will be installed in the following directories: | |
| 765 | + | |
| 766 | + <dl> | |
| 767 | +<dt><code>Executables</code><dd> <code>prefix/bin</code> | |
| 768 | +<br><dt><code>docs and output examples</code><dd> <code>prefix/share/doc/source-highlight</code> | |
| 769 | +<br><dt><code>library examples</code><dd> <code>prefix/share/doc/source-highlight/examples</code> | |
| 770 | +<br><dt><code>library API documentation</code><dd> <code>prefix/share/doc/source-highlight/api</code> | |
| 771 | +<br><dt><code>conf files</code><dd> <code>prefix/share/source-highlight</code> | |
| 752 | 772 | </dl> |
| 753 | 773 | |
| 754 | -<p>prefixのデフォルト値は<code>/usr/local</code>だが、configureの<code>--prefix</code>オプションで変更してもよい。 | |
| 755 | -<code>configure</code>のオプションについてさらに詳しくは、<code>configure --help</code>を実行してほしい。 | |
| 756 | -</p> | |
| 757 | -<a name="IDX28"></a> | |
| 758 | -<p>Tiziano Mullerは、source-highlight用のbashの補完用の設定ファイルを書いた。 | |
| 759 | -これは<code>sysconfdir/bash_completion.d</code>というディレクトリにデフォルトでインストールされる。 | |
| 760 | -<code>sysconfdir</code>はデフォルトで<code>prefix/etc</code>になっている。 | |
| 761 | -しかし通常、bashの補完スクリプトが設定ファイルを探すディレクトリは、<code>/etc/bash_completion.d</code>だ。 | |
| 762 | -なので、configureスクリプトのコマンドラインオプションの<code>--with-bash-completion</code>を使うことで、このディレクトリを明示的に指定することをお勧めする。 | |
| 763 | -</p> | |
| 764 | -<a name="IDX29"></a> | |
| 765 | -<a name="IDX30"></a> | |
| 766 | -<a name="IDX31"></a> | |
| 767 | -<p>Source-highlightライブラリのAPIドキュメンテーションをビルドしてインストールしたい場合には、<code>--with-doxygen</code>というオプションを付けて<code>configure</code>を実行する必要があるが、このドキュメンテーションをビルドするのに<em>Doxygen</em> <a href="http://www.doxygen.org">http://www.doxygen.org</a>というプログラムが必要となる。 | |
| 768 | -ドキュメンテーションは次のディレクトリにインストールされる。 | |
| 769 | -</p> | |
| 770 | -<dl compact="compact"> | |
| 771 | -<dt> <code>ライブラリAPIドキュメンテーション</code></dt> | |
| 772 | -<dd><p> <code>prefix/share/doc/source-highlight/api</code> | |
| 773 | -</p></dd> | |
| 774 | + <p>Default value for prefix is <code>/usr/local</code> | |
| 775 | +but you may change it with <code>--prefix</code> | |
| 776 | +option to configure. For further <code>configure</code> options, you | |
| 777 | +can run <code>configure --help</code>. | |
| 778 | + | |
| 779 | + <p><a name="index-bash-completion-39"></a>Tiziano Muller wrote a bash completion configuration file for | |
| 780 | +source-highlight; this will be installed by default in the directory | |
| 781 | +<code>sysconfdir/bash_completion.d</code>, where <code>sysconfdir</code> defaults to | |
| 782 | +<code>prefix/etc</code>; however, typically, the directory where the bash | |
| 783 | +completion script searches for configuration file is | |
| 784 | +<code>/etc/bash_completion.d</code>. Thus, we suggest you explicitly specify | |
| 785 | +this directory with the configuration script command line option | |
| 786 | +<code>--with-bash-completion</code>. | |
| 787 | + | |
| 788 | + <p><a name="index-library-40"></a><a name="index-g_t_0040code_007b_002d_002dwith_002ddoxygen_007d-41"></a><a name="index-doxygen-42"></a>If you want to build and install the API documentation of | |
| 789 | +Source-highlight library, you need to run <code>configure</code> with the | |
| 790 | +option <code>--with-doxygen</code>, but you need the program <em>Doxygen</em>, | |
| 791 | +<a href="http://www.doxygen.org">http://www.doxygen.org</a>, to build the documentation. | |
| 792 | +The documentation will be installed in the following directory: | |
| 793 | + | |
| 794 | + <dl> | |
| 795 | +<dt><code>Library API documentation</code><dd> <code>prefix/share/doc/source-highlight/api</code> | |
| 774 | 796 | </dl> |
| 775 | 797 | |
| 798 | + <p><a name="index-java2html-43"></a><a name="index-cpp2html-44"></a>NOTE: Originally, instead of Source-highlight, there were two | |
| 799 | +separate programs, namely <em>GNU java2html</em> and <em>GNU cpp2html</em>. | |
| 800 | +There are two shell scripts with the same name that will be installed | |
| 801 | +together with Source-highlight in order to facilitate the migration | |
| 802 | +(however their use is not advised and it is deprecated). | |
| 803 | + | |
| 804 | +<ul class="menu"> | |
| 805 | +<li><a accesskey="1" href="#Building-with-qmake">Building with qmake</a> | |
| 806 | +<li><a accesskey="2" href="#Download">Download</a> | |
| 807 | +<li><a accesskey="3" href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a> | |
| 808 | +<li><a accesskey="4" href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a> | |
| 809 | +<li><a accesskey="5" href="#Tips-on-installing-Boost-Regex-library">Tips on installing Boost Regex library</a> | |
| 810 | +<li><a accesskey="6" href="#Patching-from-a-previous-version">Patching from a previous version</a> | |
| 811 | +<li><a accesskey="7" href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a> | |
| 812 | +<li><a accesskey="8" href="#Using-source_002dhighlight-as-a-CGI">Using source-highlight as a CGI</a> | |
| 813 | +<li><a accesskey="9" href="#Building-_002erpm">Building .rpm</a> | |
| 814 | +</ul> | |
| 815 | + | |
| 816 | +<div class="node"> | |
| 817 | +<a name="Building-with-qmake"></a> | |
| 818 | +<p><hr> | |
| 819 | +Next: <a rel="next" accesskey="n" href="#Download">Download</a>, | |
| 820 | +Previous: <a rel="previous" accesskey="p" href="#Installation">Installation</a>, | |
| 821 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 822 | + | |
| 823 | +</div> | |
| 776 | 824 | |
| 777 | -<a name="IDX32"></a> | |
| 778 | -<a name="IDX33"></a> | |
| 779 | -<p>注意:もともとは、Source-highlightではなく、<em>GNU java2html</em>と<em>GNU cpp2html</em>という名前の、二つの別個のプログラムであった。 | |
| 780 | -移行を容易にするために、Source-highlightと一緒に同名のシェルスクリプトが二つインストールされる(しかし、それを使うのはお勧めしない。deprecatedだ)。 | |
| 781 | -</p> | |
| 782 | -<table class="menu" border="0" cellspacing="0"> | |
| 783 | -<tr><td align="left" valign="top"><a href="#SEC10">2.1 qmakeでのビルド</a></td><td> </td><td align="left" valign="top"> | |
| 784 | -</td></tr> | |
| 785 | -<tr><td align="left" valign="top"><a href="#SEC11">2.2 ダウンロード</a></td><td> </td><td align="left" valign="top"> | |
| 786 | -</td></tr> | |
| 787 | -<tr><td align="left" valign="top"><a href="#SEC12">2.3 Anonymous Git Checkout</a></td><td> </td><td align="left" valign="top"> | |
| 788 | -</td></tr> | |
| 789 | -<tr><td align="left" valign="top"><a href="#SEC13">2.4 source-highlightのビルドに必要なもの</a></td><td> </td><td align="left" valign="top"> | |
| 790 | -</td></tr> | |
| 791 | -<tr><td align="left" valign="top"><a href="#SEC14">2.5 Boost Regexライブラリのインストールに関するTips</a></td><td> </td><td align="left" valign="top"> | |
| 792 | -</td></tr> | |
| 793 | -<tr><td align="left" valign="top"><a href="#SEC15">2.6 前のバージョンからのパッチ</a></td><td> </td><td align="left" valign="top"> | |
| 794 | -</td></tr> | |
| 795 | -<tr><td align="left" valign="top"><a href="#SEC16">2.7 lessでのsource-highlightの使用</a></td><td> </td><td align="left" valign="top"> | |
| 796 | -</td></tr> | |
| 797 | -<tr><td align="left" valign="top"><a href="#SEC17">2.8 source-highlightのCGIとして使用</a></td><td> </td><td align="left" valign="top"> | |
| 798 | -</td></tr> | |
| 799 | -<tr><td align="left" valign="top"><a href="#SEC18">2.9 .rpmのビルド</a></td><td> </td><td align="left" valign="top"> | |
| 800 | -</td></tr> | |
| 801 | -</table> | |
| 802 | - | |
| 803 | -<hr size="6"> | |
| 804 | -<a name="qmake_3067_306e_30d3_30eb_30c9"></a> | |
| 805 | -<a name="SEC10"></a> | |
| 806 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 807 | -<tr><td valign="middle" align="left">[<a href="#SEC9" title="Previous section in reading order"> < </a>]</td> | |
| 808 | -<td valign="middle" align="left">[<a href="#SEC11" title="Next section in reading order"> > </a>]</td> | |
| 809 | -<td valign="middle" align="left"> </td> | |
| 810 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 811 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 812 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 813 | -<td valign="middle" align="left"> </td> | |
| 814 | -<td valign="middle" align="left"> </td> | |
| 815 | -<td valign="middle" align="left"> </td> | |
| 816 | -<td valign="middle" align="left"> </td> | |
| 817 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 818 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 819 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 820 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 821 | -</tr></table> | |
| 822 | -<h2 class="section"> 2.1 qmakeでのビルド </h2> | |
| 823 | - | |
| 824 | -<p>バージョン3.1.2からは、Qtライブラリ(<a href="http://qt.nokia.com">http://qt.nokia.com</a>)のビルドツールである<code>qmake</code>を使ってもSource-highlightをビルドすることができるようになった。 | |
| 825 | -これにより、Unixシェルを持たないWindowsベースのシステム上でもSource-highlightをビルドできるようになり、特に、 | |
| 826 | -<a name="IDX34"></a> | |
| 827 | -Microsoft MSVCコンパイラでもSource-highlightがビルドできるようになった。 | |
| 828 | -このやり方はUnixシェルが無かったり、あるいは、MSVCコンパイラを本当に使う必要がある場合にだけ使うべきだ(たとえば、MSVCベースのプログラムで使うのにSource-highlight libraryをビルドしたい場合)。(訳注:原文に閉じカッコが見当たらないのでここに入れてみた) | |
| 829 | -<a name="IDX35"></a> | |
| 830 | -さらにboost regexライブラリも必要で、MSVCを使う場合は、このライブラリのインストールパッケージが<a href="http://www.boostpro.com">http://www.boostpro.com</a>で手に入る。 | |
| 831 | -</p> | |
| 832 | -<p>このビルドメカニズムはまだ実験的なもので、MSVCを使うときには、Source-highlight libraryの静的バージョンだけをビルドできる(.dllではない)。 | |
| 833 | -<a name="IDX36"></a> | |
| 834 | -また、MinGWコンパイラ(<a href="http://www.mingw.org">http://www.mingw.org</a>)があって(たとえば、QtのWindowsディストリビューションと一緒に来るものがある)、 | |
| 835 | -<a name="IDX37"></a> | |
| 836 | -Msys(<a href="http://www.mingw.org/wiki/MSYS">http://www.mingw.org/wiki/MSYS</a>)が無いような場合には、この方法を使うこともできる。 | |
| 837 | -そうなければ、やはり<code>configure</code>ベースのメカニズムを使うべきだ。 | |
| 838 | -</p> | |
| 839 | -<p><code>qmake</code>を使うとき、ビルドの際に指定できるオプション(おまけにqmakeを使うときには普通使うもの)が少しあって、これらのオプションは環境変数を使ってだけ指定することができる: | |
| 840 | -</p> | |
| 841 | -<dl compact="compact"> | |
| 842 | -<dt> <code>BOOST_REGEX</code></dt> | |
| 843 | -<dd><p>デフォルトでは、<code>boost_regex</code>がboostライブラリをリンクするのに使われる(つまり<code>-lboost_regex</code>))。 | |
| 844 | -boost regexライブラリが違う名前になっている場合は、この環境変数を使って名前を指定しなければならない。 | |
| 845 | -たとえば、<code>libboost_regex-mt.lib</code>や<code>boost_regex-mt.dll</code>という名前のライブラリファイルの場合は、この変数を<code>boost_regex-mt</code>にセットしなければならない。 | |
| 846 | -</p></dd> | |
| 847 | -<dt> <code>INCPATH</code></dt> | |
| 848 | -<dd><p>boostヘッダファイルのパスを指定する。 | |
| 849 | -</p></dd> | |
| 850 | -<dt> <code>LIBS</code></dt> | |
| 851 | -<dd><p>boost libファイルのパスを指定する。 | |
| 852 | -</p></dd> | |
| 825 | +<h3 class="section">2.1 Building with qmake</h3> | |
| 826 | + | |
| 827 | +<p><a name="index-qmake-45"></a> | |
| 828 | +Since version 3.1.2, Source-highlight can be built also using | |
| 829 | +<code>qmake</code>, the build tool from Qt libraries (<a href="http://qt.nokia.com">http://qt.nokia.com</a>). | |
| 830 | +This was made available to build Source-highlight on Windows based systems | |
| 831 | +without using a Unix shell, and in particular to build Source-highlight | |
| 832 | +<a name="index-MSVC-46"></a>with Microsoft MSVC compiler. You should use this method only if you | |
| 833 | +don't have a Unix shell or if you really need to use the MSVC compiler | |
| 834 | +(e.g., if you want to build Source-highlight library to be used in MSVC | |
| 835 | +based programs). | |
| 836 | +<a name="index-boost-47"></a>You still need the boost regex library, and if you | |
| 837 | +use MSVC, you can find installation packages for this library at | |
| 838 | +<a href="http://www.boostpro.com">http://www.boostpro.com</a>. | |
| 839 | + | |
| 840 | + <p>This build mechanism is still experimental, and, when using MSVC, only | |
| 841 | +a static version of Source-highlight library can be built (not a .dll). | |
| 842 | +<a name="index-MinGW-48"></a>You can also use this method if you have the MinGW compiler, | |
| 843 | +<a href="http://www.mingw.org">http://www.mingw.org</a>, (e.g., | |
| 844 | +the one that comes with Qt Windows distribution) and you don't have | |
| 845 | +<a name="index-msys-49"></a>Msys (<a href="http://www.mingw.org/wiki/MSYS">http://www.mingw.org/wiki/MSYS</a>). Otherwise, you should | |
| 846 | +still use the <code>configure</code> based mechanims. | |
| 847 | + | |
| 848 | + <p>Using <code>qmake</code>, only a few options can be specified during the building | |
| 849 | +(besides the ones you usually use with qmake), and these options can | |
| 850 | +be specified only using environment variables: | |
| 851 | + | |
| 852 | + <dl> | |
| 853 | +<dt><code>BOOST_REGEX</code><dd>By default, <code>boost_regex</code> will be used to link the boost library | |
| 854 | +(i.e., <code>-lboost_regex</code>); if your boost regex library has a different | |
| 855 | +name you must specify this name using this environment variable; e.g., | |
| 856 | +if the library file is called <code>libboost_regex-mt.lib</code> or | |
| 857 | +<code>boost_regex-mt.dll</code> you must set this variable to | |
| 858 | +<code>boost_regex-mt</code>. | |
| 859 | +<br><dt><code>INCPATH</code><dd>Specify the path of the boost header files. | |
| 860 | +<br><dt><code>LIBS</code><dd>Specify the path of the boost lib files. | |
| 853 | 861 | </dl> |
| 854 | 862 | |
| 855 | -<p>boostライブラリのインクルードパスとライブラリパスの指定は、システムパスディクレトリにそれらが無いのであれば、完全にあなたが<code>INCPATH</code>と<code>LIBS</code>を使って決めることだいうことを考慮に入れておいてほしい。 | |
| 856 | -</p> | |
| 857 | -<p>また、qmakeを実行するときには、<code>-recursive</code>というオプションを常に使うということを覚えていてほしい。 | |
| 858 | -</p> | |
| 859 | -<p>次に、<code>make install</code>を実行したい場合には、<code>INSTALL_ROOT</code>変数を使って、インストールするパスのプリフィックスを指定することができる。 | |
| 860 | -そうしない場合はパスはルートディレクトリである。 | |
| 861 | -</p> | |
| 862 | -<hr size="6"> | |
| 863 | -<a name="g_t_30c0_30a6_30f3_30ed_30fc_30c9"></a> | |
| 864 | -<a name="SEC11"></a> | |
| 865 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 866 | -<tr><td valign="middle" align="left">[<a href="#SEC10" title="Previous section in reading order"> < </a>]</td> | |
| 867 | -<td valign="middle" align="left">[<a href="#SEC12" title="Next section in reading order"> > </a>]</td> | |
| 868 | -<td valign="middle" align="left"> </td> | |
| 869 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 870 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 871 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 872 | -<td valign="middle" align="left"> </td> | |
| 873 | -<td valign="middle" align="left"> </td> | |
| 874 | -<td valign="middle" align="left"> </td> | |
| 875 | -<td valign="middle" align="left"> </td> | |
| 876 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 877 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 878 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 879 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 880 | -</tr></table> | |
| 881 | -<h2 class="section"> 2.2 ダウンロード </h2> | |
| 882 | - | |
| 883 | -<p>GNUのftpサイト:<a href="ftp://ftp.gnu.org/gnu/src-highlite">ftp://ftp.gnu.org/gnu/src-highlite</a>や、そのミラーサイト(<a href="http://www.gnu.org/prep/ftp.html">http://www.gnu.org/prep/ftp.html</a>を見よ)のいずれかからダウンロードすることができる。 | |
| 884 | -</p> | |
| 885 | -<p>私はWindowsバイナリをもう配布しない。 | |
| 886 | -<a href="http://www.cygwin.com">http://www.cygwin.com</a>から入手できるCygnus C/C++コンパイラでビルドが可能だからだ。 | |
| 887 | -しかし、そういったコンパイラをダウンロードしたくなかったり、Boost Regexライブラリについて問題を感じているような場合には(<a href="#SEC14">Boost Regexライブラリのインストールに関するTips</a>を参照のこと。留意してほしいのだが、これらのライブラリがインストールされていなくて、使用しているC/C++コンパイラのディストリビューションにビルド済みのパッケージが用意されていなければ、ソースからBoostライブラリをビルドするのにいくらか時間がかかるかもしれない。数時間かかることも考えられる)、メールで直接そういったバイナリを私にリクエストしてもよい(メールアドレスは私のホームページを見てほしい)。 | |
| 888 | -喜んでお送りするつもりだ。 | |
| 889 | -Source-highlightのMS-Windowsポートの一つが<a href="http://gnuwin32.sourceforge.net">http://gnuwin32.sourceforge.net</a>から入手できる。 | |
| 890 | -しかし、私はそれらのバイナリを個人的にメンテナンスしていないし、古くなっているかもしれない。 | |
| 891 | -</p> | |
| 892 | -<p>アーカイブはGNU gpg(<a href="http://www.gnupg.org">http://www.gnupg.org</a>)を使って私がデジタル署名している。 | |
| 893 | -私のGPGのパブリックキーは私のホームページ(<a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>)で見つけられる。 | |
| 894 | -</p> | |
| 895 | -<p>個別のリリースのもが利用可能であれば、パッチも入手できる(以前のバージョンからのパッチについては後述)。 | |
| 896 | -</p> | |
| 897 | -<hr size="6"> | |
| 898 | -<a name="Git_306e_533f_540d_30c1_30a7_30c3_30af_30a2_30a6_30c8"></a> | |
| 899 | -<a name="SEC12"></a> | |
| 900 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 901 | -<tr><td valign="middle" align="left">[<a href="#SEC11" title="Previous section in reading order"> < </a>]</td> | |
| 902 | -<td valign="middle" align="left">[<a href="#SEC13" title="Next section in reading order"> > </a>]</td> | |
| 903 | -<td valign="middle" align="left"> </td> | |
| 904 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 905 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 906 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 907 | -<td valign="middle" align="left"> </td> | |
| 908 | -<td valign="middle" align="left"> </td> | |
| 909 | -<td valign="middle" align="left"> </td> | |
| 910 | -<td valign="middle" align="left"> </td> | |
| 911 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 912 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 913 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 914 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 915 | -</tr></table> | |
| 916 | -<h2 class="section"> 2.3 Anonymous Git Checkout </h2> | |
| 917 | - | |
| 918 | -<p>このプロジェクトのgitリポジトリは、以下のクローン化の手順を通してチェックアウトすることができる<a name="DOCF3" href="#FOOT3">(3)</a>: | |
| 919 | -</p> | |
| 920 | -<table><tr><td> </td><td><pre class="example">git clone git://git.savannah.gnu.org/src-highlite.git | |
| 921 | -</pre></td></tr></table> | |
| 922 | - | |
| 923 | -<p>詳しい手順については次のアドレスで見つけられる: | |
| 924 | -</p> | |
| 925 | -<p><a href="http://savannah.gnu.org/projects/src-highlite">http://savannah.gnu.org/projects/src-highlite</a>. | |
| 926 | -</p> | |
| 927 | -<p>そして、gitリポジトリは次のアドレスでオンラインで見ることもできる: | |
| 928 | -</p> | |
| 929 | -<p><a href="http://git.savannah.gnu.org/cgit/src-highlite.git">http://git.savannah.gnu.org/cgit/src-highlite.git</a>. | |
| 930 | -</p> | |
| 931 | -<p>このように、Source-highlightの最新の開発ソースを手に入れられるが、それは不安定なものかもしれないことに注意してほしい。 | |
| 932 | -このプログラムを修正したり拡張したりする場合には、この方法がベストである。 | |
| 933 | -パッチを私に送るのに、そのパッチは、Gitリポジトリの最新のソースに対するものであるべきだ。 | |
| 934 | -</p> | |
| 935 | -<p>反対に、指定したリリースのソースをgitを通して入手したい場合、たとえばバージョンX.Y.Zならば、rel_X_Y_Zというタグを指定しなければならない。 | |
| 936 | -</p> | |
| 937 | -<p>Gitリポジトリから手に入れたソースをコンパイルするとき、<code>configure</code>や<code>make</code>コマンドを初めて実行する前に次のコマンドを実行しなければならない: | |
| 938 | -</p> | |
| 939 | -<table><tr><td> </td><td><pre class="example">autoreconf -i | |
| 940 | -</pre></td></tr></table> | |
| 941 | - | |
| 942 | -<p>これによってautotoolsのコマンドが正しい順番に実行され、ひょっとしたら欠けているかもしれないファイルもコピーしてくれるだろう。 | |
| 943 | -これを成功させるためには、 | |
| 944 | -<a name="IDX38"></a> | |
| 945 | -<a name="IDX39"></a> | |
| 946 | -<a name="IDX40"></a> | |
| 947 | -<code>automake</code>と<code>autoconf</code>、<code>libtool</code>の最近のバージョンがインストールされていたほうがよい。 | |
| 948 | -</p> | |
| 949 | -<hr size="6"> | |
| 950 | -<a name="source_002dhighlight_306e_30d3_30eb_30c9_306b_5fc5_8981_306a_3082_306e"></a> | |
| 951 | -<a name="SEC13"></a> | |
| 952 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 953 | -<tr><td valign="middle" align="left">[<a href="#SEC12" title="Previous section in reading order"> < </a>]</td> | |
| 954 | -<td valign="middle" align="left">[<a href="#SEC14" title="Next section in reading order"> > </a>]</td> | |
| 955 | -<td valign="middle" align="left"> </td> | |
| 956 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 957 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 958 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 959 | -<td valign="middle" align="left"> </td> | |
| 960 | -<td valign="middle" align="left"> </td> | |
| 961 | -<td valign="middle" align="left"> </td> | |
| 962 | -<td valign="middle" align="left"> </td> | |
| 963 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 964 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 965 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 966 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 967 | -</tr></table> | |
| 968 | -<h2 class="section"> 2.4 source-highlightのビルドに必要なもの </h2> | |
| 969 | - | |
| 970 | - | |
| 971 | -<p>バージョン2.0から、Source-highlightは、boost (<a href="http://www.boost.org">http://www.boost.org</a>)が提供している正規表現に依存しているので、最低でもboostのregexライブラリをインストールする必要がある。 | |
| 972 | -</p> | |
| 973 | -<p>ほとんどのGNU/Linuxディストリビューションでは、コンパイルされた状態ですでにこのライブラリが用意されている。 | |
| 974 | -使用しているディストリビューションのパッケージを使うならば、boostライブラリの開発パッケージも必ずインストールしてほしい。 | |
| 975 | -</p> | |
| 976 | -<p>Boost Regexライブラリのインストールに問題がある場合や、このライブラリのためにsource-highlightのコンパイルに問題がある場合には、<a href="#SEC14">Boost Regexライブラリのインストールに関するTips</a>を見てほしい。 | |
| 977 | -</p> | |
| 978 | -<p>(たくさん違うバージョンを使っているため)特定のバージョンのBoost regexライブラリを使いたい場合には、configureの<code>--with-boost-regex</code>オプションを使って特定のサフィックスを指定することができる。 | |
| 979 | -たとえば次のようになる。 | |
| 980 | -</p> | |
| 981 | -<table><tr><td> </td><td><pre class="example">./configure --with-boost-regex=boost_regex-gcc-1_31 | |
| 982 | -</pre></td></tr></table> | |
| 983 | - | |
| 984 | -<p>Source-highlightはGNU/Linuxのもとで、gcc (C++)とbison (yacc)、flex (lex)を利用して開発され、<a href="http://www.cygwin.com">http://www.cygwin.com</a>から入手できるCygwin C/C++コンパイラでWin32に移植された。 | |
| 985 | -</p> | |
| 986 | -<p>私は | |
| 987 | -<a name="IDX41"></a> | |
| 988 | -<a name="IDX42"></a> | |
| 989 | -<a name="IDX43"></a> | |
| 990 | -GNU Autoconf<a name="DOCF4" href="#FOOT4">(4)</a>とGNU Automake<a name="DOCF5" href="#FOOT5">(5)</a>、そしてGNU Libtool<a name="DOCF6" href="#FOOT6">(6)</a>という素晴しいソフトウェアを使っている。 | |
| 991 | -<a name="IDX44"></a> | |
| 992 | -バージョン2.6から、Gnulib - GNU Portablility Library<a name="DOCF7" href="#FOOT7">(7)</a>も使い初めた。 | |
| 993 | -これは「GNUのパッケージ間で共有するための、GNUの共通コードの中心の位置」だ(例を挙げると、<code>getopt_long</code>関数の存在と正しさのチェックをするのにGnulibに頼っている)。 | |
| 994 | -</p> | |
| 995 | -<p>最後に、私はコマンドラインの解析のため、<em>GNU gengetopt</em>(<a href="http://www.gnu.org/software/gengetopt">http://www.gnu.org/software/gengetopt</a>)を使った。 | |
| 996 | -</p> | |
| 997 | -<p>動的オーバーロードを許す<em>doublecpp</em>(<a href="http://doublecpp.sourceforge.net">http://doublecpp.sourceforge.net</a>)も使い始めた。 | |
| 998 | -</p> | |
| 999 | -<p>実際、boost regexライブラリは別にすると、source-highlightの開発をしたいと思わないかぎり、source-highlightをビルドするのに上に挙げたその他のツールは必要ではない(確かに私は前述したツールを使って生成した出力ソースを提供している)。 | |
| 1000 | -</p> | |
| 1001 | -<p>しかし、Gitからソースを取得したのならば、他のツールがいくつか必要となる。 | |
| 1002 | -<a href="#SEC12">Anonymous Git Checkout</a>を参照してほしい。 | |
| 1003 | -</p> | |
| 1004 | -<hr size="6"> | |
| 1005 | -<a name="Boost-Regex_30e9_30a4_30d6_30e9_30ea_306e_30a4_30f3_30b9_30c8_30fc_30eb_306b_95a2_3059_308bTips"></a> | |
| 1006 | -<a name="SEC14"></a> | |
| 1007 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1008 | -<tr><td valign="middle" align="left">[<a href="#SEC13" title="Previous section in reading order"> < </a>]</td> | |
| 1009 | -<td valign="middle" align="left">[<a href="#SEC15" title="Next section in reading order"> > </a>]</td> | |
| 1010 | -<td valign="middle" align="left"> </td> | |
| 1011 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1012 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 1013 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 1014 | -<td valign="middle" align="left"> </td> | |
| 1015 | -<td valign="middle" align="left"> </td> | |
| 1016 | -<td valign="middle" align="left"> </td> | |
| 1017 | -<td valign="middle" align="left"> </td> | |
| 1018 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1019 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1020 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1021 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1022 | -</tr></table> | |
| 1023 | -<h2 class="section"> 2.5 Boost Regexライブラリのインストールに関するTips </h2> | |
| 1024 | - | |
| 1025 | - | |
| 1026 | -<p>source-highlightのコンパイルに何の問題もなければ、幸運にもこのセクションは飛ばしてかまわない<a name="DOCF8" href="#FOOT8">(8)</a>。:-) | |
| 1027 | -</p> | |
| 1028 | -<p>このセクションを書いたのは、Boost Regexライブラリをソースからインストールした後の問題を報告してくるユーザが多数いるからだ。 | |
| 1029 | -このライブラリが既に正しくインストールされている場合ですら、source-highlightのコンパイルで問題が起きるユーザも他にいる(特にcygwinを使っているwindowsユーザ)。 | |
| 1030 | -Boost Regexライブラリのインストールや使用に対して、このセクションがいくらかの光を照らしてくれることを期待している。 | |
| 1031 | -このセクションは、Boostライブラリのコンパイルの仕方を説明するものではないことに注意してほしい(<a href="http://www.boost.org">http://www.boost.org</a>で見つけられるドキュメンテーションはよく出来ている)。 | |
| 1032 | -このセクションは、Boostライブラリのインストールが成功した後でさえ、source-highlightのコンパイルに問題が発生する場合に、事態をどのように調整するかを説明する。 | |
| 1033 | -</p> | |
| 1034 | -<p>まず最初、使用しているディストリビューションがBoost regexライブラリのパッケージを用意している場合、boostライブラリの開発パッケージも必ずインストールしてほしい。 | |
| 1035 | -つまり、それらのパッケージが、ライブラリを使ってプログラムをコンパイルするのに必要なヘッダファイルも提供しているからだ。 | |
| 1036 | -たとえば、私のDebianシステムの場合、<code>libboost-regex</code>パッケージのほかに、<code>libboost-regex-dev</code>パッケージをインストールしなければならなかった。 | |
| 1037 | -</p> | |
| 1038 | -<p>使用しているディストリビューションがこういったパッケージを提供していない場合、そのときは、<a href="http://www.boost.org">http://www.boost.org</a>からBoostライブラリのソースをダウンロードして、コンパイルとインストールの手順を辿らなければならない。 | |
| 1039 | -しかし、(C++コンパイラのインクルードパスに‘<tt>/usr/local/include</tt>’が既に含まれていなければ)インストールのプリフィックスを、デフォルトのプリフィックス‘<tt>/usr/local</tt>’に頼るのではなく、‘<tt>/usr</tt>’に指定しておくことをお勧めする。 | |
| 1040 | -これによって、source-highlightをコンパイルするのが簡単になるからだ。 | |
| 1041 | -‘<tt>/usr/include</tt>’は普通、コンパイル時にC++がヘッダファイルを探索する場所になっているのでこれをお勧めする。 | |
| 1042 | -</p> | |
| 1043 | -<p>Boost Regexライブラリをコンパイルしてインストールするのに成功したり、あるいはディストリビューションのパッケージをインストールても、まだsource-highlightのコンパイルに問題が起きる場合には、次に説明する事柄を簡単に調整する必要がある。 | |
| 1044 | -</p> | |
| 1045 | -<p>まず、source-highlightの<code>./configure</code>コマンドが次のように報告する場合だ: | |
| 1046 | -</p> | |
| 1047 | -<table><tr><td> </td><td><pre class="example">ERROR! Boost::regex library not installed. | |
| 1048 | -</pre></td></tr></table> | |
| 1049 | - | |
| 1050 | -<p>このとき、コンパイラがこのライブラリのヘッダファイルを見つけられないでいる。 | |
| 1051 | -こういう場合は、‘<tt>/usr/include/boost</tt>’ディレクトリが実際に存在するかどうかを確認してほしい。 | |
| 1052 | -もし無ければ、インストールしたライブラリのバージョンに応じて、恐らく似たような名前のディレクトリが見つかるだろう(たとえば‘<tt>/usr/include/boost-1_33/boost)。 | |
| 1053 | -そのときは、次のようにシンボリックリンクを作成するだけでよい: | |
| 1054 | -</tt></p> | |
| 1055 | -<table><tr><td> </td><td><pre class="example"><tt>ln -s /usr/include/boost-1_33/boost /usr/include/boost | |
| 1056 | -</tt></pre></td></tr></table> | |
| 1057 | - | |
| 1058 | -<p><tt>代わりに、source-highlightのconfigureを次のように実行してもよい: | |
| 1059 | -</tt></p> | |
| 1060 | -<table><tr><td> </td><td><pre class="example"><tt>./configure CXXFLAGS=-I/usr/include/boost-1_33/ | |
| 1061 | -</tt></pre></td></tr></table> | |
| 1062 | - | |
| 1063 | -<p><tt>さらに、source-highlightの<code>./configure</code>が次のような別のエラーを出す場合だ: | |
| 1064 | -</tt></p> | |
| 1065 | -<table><tr><td> </td><td><pre class="example"><tt>ERROR! Boost::regex library is installed, but you | |
| 1066 | -must specify the suffix with --with-boost-regex at configure | |
| 1067 | -for instance, --with-boost-regex=boost_regex-gcc-1_31 | |
| 1068 | -</tt></pre></td></tr></table> | |
| 1069 | - | |
| 1070 | -<p><tt>このとき、修正しなければならないことが他にまだある。 | |
| 1071 | -インストールしたBoost Regexライブラリの正確なファイル名を調べなければならない。 | |
| 1072 | -これは次のコマンドを使えばよい: | |
| 1073 | -</tt></p> | |
| 1074 | -<table><tr><td> </td><td><pre class="example"><tt>$ ls -l /usr/lib/libboost_regex* | |
| 1075 | -</tt></pre></td></tr></table> | |
| 1076 | - | |
| 1077 | -<p><tt>例えば、私のcygwinをインストールした環境の一つでは次のように報告される: | |
| 1078 | -</tt></p> | |
| 1079 | -<table><tr><td> </td><td><pre class="example"><tt>-rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.a | |
| 1080 | --rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.a | |
| 1081 | --rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.so | |
| 1082 | --rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.so | |
| 1083 | -</tt></pre></td></tr></table> | |
| 1084 | - | |
| 1085 | -<p><tt>これで、source-highlightの次のようにconfigureコマンドを正しく実行する情報が揃った: | |
| 1086 | -</tt></p> | |
| 1087 | -<table><tr><td> </td><td><pre class="example"><tt>./configure --with-boost-regex=boost_regex-gcc-mt-s-1_33 | |
| 1088 | -</tt></pre></td></tr></table> | |
| 1089 | - | |
| 1090 | -<p><tt>あるいは、1番目の問題を2番目の方法<a name="DOCF9" href="#FOOT9">(9)</a>で解決した場合には次のようになる: | |
| 1091 | -</tt></p> | |
| 1092 | -<table><tr><td> </td><td><pre class="example"><tt>./configure CXXFLAGS=-I/usr/include/boost-1_33/ \ | |
| 1093 | - --with-boost-regex=boost_regex-gcc-mt-s-1_33 | |
| 1094 | -</tt></pre></td></tr></table> | |
| 1095 | - | |
| 1096 | -<p><tt>もちろん、ファイルをインストールしたBoost Regexライブラリの名前に応じてこのコマンドを修正しなければならない。 | |
| 1097 | -</tt></p> | |
| 1098 | -<p><tt>問題が起きていた多数のユーザが、この手順でsource-highlightをなんとかコンパイルできるようになった。 | |
| 1099 | -依然問題を抱えているならば私にメールを送ってほしい。 | |
| 1100 | -</tt></p> | |
| 1101 | -<hr size="6"> | |
| 1102 | -<a name="g_t_524d_306e_30d0_30fc_30b8_30e7_30f3_304b_3089_306e_30d1_30c3_30c1"></a> | |
| 1103 | -<a name="SEC15"></a> | |
| 1104 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1105 | -<tr><td valign="middle" align="left">[<a href="#SEC14" title="Previous section in reading order"> < </a>]</td> | |
| 1106 | -<td valign="middle" align="left">[<a href="#SEC16" title="Next section in reading order"> > </a>]</td> | |
| 1107 | -<td valign="middle" align="left"> </td> | |
| 1108 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1109 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 1110 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 1111 | -<td valign="middle" align="left"> </td> | |
| 1112 | -<td valign="middle" align="left"> </td> | |
| 1113 | -<td valign="middle" align="left"> </td> | |
| 1114 | -<td valign="middle" align="left"> </td> | |
| 1115 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1116 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1117 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1118 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1119 | -</tr></table> | |
| 1120 | -<h2 class="section"> 2.6 前のバージョンからのパッチ </h2> | |
| 1121 | - | |
| 1122 | -<p><tt>パッチを一つ、たとえば‘<tt>source-highlight-1.3-1.3.1-patch.gz</tt>’(すなわち、バージョン1.3からバージョン1.3.1へのパッチ)をダウンロードした場合、前のバージョン(source-highlight-1.3)のソースのディレクトリへcdして、次のようにタイプする: | |
| 1123 | -</tt></p> | |
| 1124 | -<table><tr><td> </td><td><pre class="example"><tt>gunzip -cd ../source-highlight-1.3-1.3.1.patch.gz | patch -p1 | |
| 1125 | -</tt></pre></td></tr></table> | |
| 1126 | - | |
| 1127 | -<p><tt>そして、コンパイルの手順をリスタートする(既にconfigureを実行しているならば、ただmakeをすればいいはずだ)。 | |
| 1128 | -</tt></p> | |
| 1129 | -<hr size="6"> | |
| 1130 | -<a name="less_3067_306esource_002dhighlight_306e_4f7f_7528"></a> | |
| 1131 | -<a name="SEC16"></a> | |
| 1132 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1133 | -<tr><td valign="middle" align="left">[<a href="#SEC15" title="Previous section in reading order"> < </a>]</td> | |
| 1134 | -<td valign="middle" align="left">[<a href="#SEC17" title="Next section in reading order"> > </a>]</td> | |
| 1135 | -<td valign="middle" align="left"> </td> | |
| 1136 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1137 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 1138 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 1139 | -<td valign="middle" align="left"> </td> | |
| 1140 | -<td valign="middle" align="left"> </td> | |
| 1141 | -<td valign="middle" align="left"> </td> | |
| 1142 | -<td valign="middle" align="left"> </td> | |
| 1143 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1144 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1145 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1146 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1147 | -</tr></table> | |
| 1148 | -<h2 class="section"> 2.7 lessでのsource-highlightの使用 </h2> | |
| 1149 | - | |
| 1150 | -<p><tt>これはKonstantine Serebrianyが提案したことだ。 | |
| 1151 | -‘<tt>src-hilite-lesspipe.sh</tt>’というスクリプトがsource-highlightと一緒にインストールされるだろう。 | |
| 1152 | -次に挙げる環境変数を使うことができる。 | |
| 1153 | -</tt></p> | |
| 1154 | -<table><tr><td> </td><td><pre class="example"><tt>export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s" | |
| 1155 | -export LESS=' -R ' | |
| 1156 | -</tt></pre></td></tr></table> | |
| 1157 | - | |
| 1158 | -<p><tt>このようにすれば、ファイルをlessを使ってブラウズするとき、それがsource-highlightによって処理されるソースファイルであれば、自動的にハイライトされる。 | |
| 1159 | -</tt></p> | |
| 1160 | -<hr size="6"> | |
| 1161 | -<a name="source_002dhighlight_306eCGI_3068_3057_3066_4f7f_7528"></a> | |
| 1162 | -<a name="SEC17"></a> | |
| 1163 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1164 | -<tr><td valign="middle" align="left">[<a href="#SEC16" title="Previous section in reading order"> < </a>]</td> | |
| 1165 | -<td valign="middle" align="left">[<a href="#SEC18" title="Next section in reading order"> > </a>]</td> | |
| 1166 | -<td valign="middle" align="left"> </td> | |
| 1167 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1168 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 1169 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 1170 | -<td valign="middle" align="left"> </td> | |
| 1171 | -<td valign="middle" align="left"> </td> | |
| 1172 | -<td valign="middle" align="left"> </td> | |
| 1173 | -<td valign="middle" align="left"> </td> | |
| 1174 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1175 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1176 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1177 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1178 | -</tr></table> | |
| 1179 | -<h2 class="section"> 2.8 source-highlightのCGIとして使用 </h2> | |
| 1180 | - | |
| 1181 | -<p><tt>Robert WetzelのおかげでCGIサポートが可能になった。 | |
| 1182 | -私は個人的にはこれをテストしていない。 | |
| 1183 | -source-highlightをCGIプログラムのように使いたい場合には、source-highlight-cgiという実行ファイルを使わなければならない。 | |
| 1184 | -このような実行ファイルは次のコマンドを実行すればビルドできる。 | |
| 1185 | -</tt></p> | |
| 1186 | -<table><tr><td> </td><td><pre class="example"><tt>make source-highlight-cgi | |
| 1187 | -</tt></pre></td></tr></table> | |
| 1188 | - | |
| 1189 | -<p><tt>これは‘<tt>src</tt>’ディレクトリで実行する。 | |
| 1190 | -</tt></p> | |
| 1191 | - | |
| 1192 | -<hr size="6"> | |
| 1193 | -<a name="g_t_002erpm_306e_30d3_30eb_30c9"></a> | |
| 1194 | -<a name="SEC18"></a> | |
| 1195 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1196 | -<tr><td valign="middle" align="left">[<a href="#SEC17" title="Previous section in reading order"> < </a>]</td> | |
| 1197 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next section in reading order"> > </a>]</td> | |
| 1198 | -<td valign="middle" align="left"> </td> | |
| 1199 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1200 | -<td valign="middle" align="left">[<a href="#SEC9" title="Up section"> Up </a>]</td> | |
| 1201 | -<td valign="middle" align="left">[<a href="#SEC19" title="Next chapter"> >> </a>]</td> | |
| 1202 | -<td valign="middle" align="left"> </td> | |
| 1203 | -<td valign="middle" align="left"> </td> | |
| 1204 | -<td valign="middle" align="left"> </td> | |
| 1205 | -<td valign="middle" align="left"> </td> | |
| 1206 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1207 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1208 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1209 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1210 | -</tr></table> | |
| 1211 | -<h2 class="section"> 2.9 .rpmのビルド </h2> | |
| 1212 | - | |
| 1213 | -<p><tt>Christian W. Zuckschwerdtが.rpmと.rpm.srcをビルドするサポートを追加した。 | |
| 1214 | -バイナリの入った.rpmをビルドするには次のコマンドを実行すればよい: | |
| 1215 | -</tt></p> | |
| 1216 | -<table><tr><td> </td><td><pre class="example"><tt>rpmbuild -tb source-highlight-3.1.3.tar.gz | |
| 1217 | -</tt></pre></td></tr></table> | |
| 1218 | - | |
| 1219 | -<p><tt>そしてソースの入った.rpm.srcをビルドするには次のようにする: | |
| 1220 | -</tt></p> | |
| 1221 | -<table><tr><td> </td><td><pre class="example"><tt>rpmbuild -ts source-highlight-3.1.3.tar.gz | |
| 1222 | -</tt></pre></td></tr></table> | |
| 1223 | - | |
| 1224 | - | |
| 1225 | -<hr size="6"> | |
| 863 | + <p>Please, take into consideration that specifying the boost library | |
| 864 | +include and library paths is completely up to you, using | |
| 865 | +<code>INCPATH</code> and <code>LIBS</code>, if they're not in the system | |
| 866 | +path directories. | |
| 867 | + | |
| 868 | + <p>Also remember to always use the option <code>-recursive</code> when running | |
| 869 | +qmake. | |
| 870 | + | |
| 871 | + <p>If you then want to run <code>make install</code>, you can use the | |
| 872 | +variable <code>INSTALL_ROOT</code> to prefix the installation path, which, | |
| 873 | +otherwise, is the root directory. | |
| 874 | + | |
| 875 | +<div class="node"> | |
| 876 | +<a name="Download"></a> | |
| 877 | +<p><hr> | |
| 878 | +Next: <a rel="next" accesskey="n" href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a>, | |
| 879 | +Previous: <a rel="previous" accesskey="p" href="#Building-with-qmake">Building with qmake</a>, | |
| 880 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 881 | + | |
| 882 | +</div> | |
| 883 | + | |
| 884 | +<h3 class="section">2.2 Download</h3> | |
| 885 | + | |
| 886 | +<p><a name="index-download-50"></a> | |
| 887 | +You can download it from GNU's ftp site: | |
| 888 | +<a href="ftp://ftp.gnu.org/gnu/src-highlite">ftp://ftp.gnu.org/gnu/src-highlite</a> or from one of its mirrors (see | |
| 889 | +<a href="http://www.gnu.org/prep/ftp.html">http://www.gnu.org/prep/ftp.html</a>). | |
| 890 | + | |
| 891 | + <p>I do not distribute Windows binaries anymore; since, they can be built | |
| 892 | +by using Cygnus C/C++ compiler, available at | |
| 893 | +<a href="http://www.cygwin.com">http://www.cygwin.com</a>. However, if you don't feel like | |
| 894 | +downloading such compiler or you experience problems with the Boost | |
| 895 | +Regex library (see also <a href="#Tips-on-installing-Boost-Regex-library">Tips on installing Boost Regex library</a>; | |
| 896 | +please also keep in mind that if you don't have these libraries | |
| 897 | +installed, and your C/C++ compiler distribution does not provide a | |
| 898 | +prebuilt package, it might take some time, even hours, to build the | |
| 899 | +Boost libraries from sources), you can request such binaries directly to | |
| 900 | +me, by e-mail (find my e-mail at my home page) and I'll be happy to send | |
| 901 | +them to you. An MS-Windows port of Source-highlight is available from | |
| 902 | +<a href="http://gnuwin32.sourceforge.net">http://gnuwin32.sourceforge.net</a>; however, I don't maintain those | |
| 903 | +binaries personally, and they might be out of date. | |
| 904 | + | |
| 905 | + <p>Archives are digitally signed by me (Lorenzo Bettini) with GNU gpg | |
| 906 | +(<a href="http://www.gnupg.org">http://www.gnupg.org</a>). My GPG public key can be found at my home | |
| 907 | +page (<a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>). | |
| 908 | + | |
| 909 | + <p>You can also get the patches, if they are available for a particular | |
| 910 | +release (see below for patching from a previous version). | |
| 911 | + | |
| 912 | +<div class="node"> | |
| 913 | +<a name="Anonymous-Git-Checkout"></a> | |
| 914 | +<p><hr> | |
| 915 | +Next: <a rel="next" accesskey="n" href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a>, | |
| 916 | +Previous: <a rel="previous" accesskey="p" href="#Download">Download</a>, | |
| 917 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 918 | + | |
| 919 | +</div> | |
| 920 | + | |
| 921 | +<h3 class="section">2.3 Anonymous Git Checkout</h3> | |
| 922 | + | |
| 923 | +<p><a name="index-Git-51"></a>This project's git repository can be checked out through the following | |
| 924 | +clone instruction<a rel="footnote" href="#fn-3" name="fnd-3"><sup>3</sup></a>: | |
| 925 | + | |
| 926 | +<pre class="example"> git clone git://git.savannah.gnu.org/src-highlite.git | |
| 927 | +</pre> | |
| 928 | + <p>Further instructions can be found at the address: | |
| 929 | + | |
| 930 | + <p><a href="http://savannah.gnu.org/projects/src-highlite">http://savannah.gnu.org/projects/src-highlite</a>. | |
| 931 | + | |
| 932 | + <p>And the git repository can also browsed on-line at | |
| 933 | + | |
| 934 | + <p><a href="http://git.savannah.gnu.org/cgit/src-highlite.git">http://git.savannah.gnu.org/cgit/src-highlite.git</a>. | |
| 935 | + | |
| 936 | + <p>Please note that this way you will get the latest development sources | |
| 937 | +of Source-highlight, which may also be unstable. This solution is the | |
| 938 | +best if you intend to correct/extend this program: you should send me | |
| 939 | +patches against the latest git repository sources. | |
| 940 | + | |
| 941 | + <p>If, on the contrary, you want to get the sources of a given release, | |
| 942 | +through git, say, e.g., version X.Y.Z, you must specify the tag | |
| 943 | +<code>rel_X_Y_Z</code>. | |
| 944 | + | |
| 945 | + <p>When you compile the sources that you get from the git repository, | |
| 946 | +before running the <code>configure</code> and <code>make</code> commands, for the | |
| 947 | +first time, you must run the command: | |
| 948 | + | |
| 949 | +<pre class="example"> autoreconf -i | |
| 950 | +</pre> | |
| 951 | + <p class="noindent">This will run the autotools commands in the correct order, and also copy | |
| 952 | +possibly missing files. You should have installed recent versions of | |
| 953 | +<a name="index-automake-52"></a><a name="index-autoconf-53"></a><a name="index-libtool-54"></a><code>automake</code>, <code>autoconf</code> and <code>libtool</code> in order for this to | |
| 954 | +succeed. | |
| 955 | + | |
| 956 | +<div class="node"> | |
| 957 | +<a name="What-you-need-to-build-source-highlight"></a> | |
| 958 | +<a name="What-you-need-to-build-source_002dhighlight"></a> | |
| 959 | +<p><hr> | |
| 960 | +Next: <a rel="next" accesskey="n" href="#Tips-on-installing-Boost-Regex-library">Tips on installing Boost Regex library</a>, | |
| 961 | +Previous: <a rel="previous" accesskey="p" href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a>, | |
| 962 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 963 | + | |
| 964 | +</div> | |
| 965 | + | |
| 966 | +<h3 class="section">2.4 What you need to build source-highlight</h3> | |
| 967 | + | |
| 968 | +<p><a name="index-compilation-requirements-55"></a><a name="index-building-requirements-56"></a> | |
| 969 | +<a name="index-boost-57"></a>Since version 2.0 Source-highlight relies on regular expressions as | |
| 970 | +provided by boost (<a href="http://www.boost.org">http://www.boost.org</a>), so you need to install at | |
| 971 | +least the regex library from boost. | |
| 972 | + | |
| 973 | + <p>Most GNU/Linux distributions provide this library already in a compiled | |
| 974 | +form. If you use your distribution packages, please be sure to install | |
| 975 | +also the development package of the boost libraries. | |
| 976 | + | |
| 977 | + <p>If you experience problems in installing Boost Regex library, or in | |
| 978 | +compiling source-highlight because of this library, please take a look | |
| 979 | +at <a href="#Tips-on-installing-Boost-Regex-library">Tips on installing Boost Regex library</a>. | |
| 980 | + | |
| 981 | + <p>If you want to use a specific version of the Boost regex library | |
| 982 | +(because you have many versions of it), you can use the configure option | |
| 983 | +<code>--with-boost-regex</code> to specify a particular suffix. For instance, | |
| 984 | + | |
| 985 | +<pre class="example"> ./configure --with-boost-regex=boost_regex-gcc-1_31 | |
| 986 | +</pre> | |
| 987 | + <p>Source-highlight has been developed under GNU/Linux, using gcc (C++), | |
| 988 | +and bison (yacc) and flex (lex), and ported under Win32 with Cygwin | |
| 989 | +C/C++compiler, available at <a href="http://www.cygwin.com">http://www.cygwin.com</a>. | |
| 990 | + | |
| 991 | + <p>I use the excellent | |
| 992 | +<a name="index-automake-58"></a><a name="index-autoconf-59"></a><a name="index-libtool-60"></a>GNU Autoconf<a rel="footnote" href="#fn-4" name="fnd-4"><sup>4</sup></a>, | |
| 993 | +GNU Automake<a rel="footnote" href="#fn-5" name="fnd-5"><sup>5</sup></a> and | |
| 994 | +GNU Libtool<a rel="footnote" href="#fn-6" name="fnd-6"><sup>6</sup></a>. | |
| 995 | +<a name="index-gnulib-61"></a>Since version 2.6 I also started to use Gnulib - The GNU Portability | |
| 996 | +Library<a rel="footnote" href="#fn-7" name="fnd-7"><sup>7</sup></a>, “a central | |
| 997 | +location for common GNU code, intended to be shared among GNU packages” | |
| 998 | +(for instance, I rely on Gnulib for checking for the presence and | |
| 999 | +correctness of <code>getopt_long</code> function). | |
| 1000 | + | |
| 1001 | + <p>Finally I used <em>GNU gengetopt</em> | |
| 1002 | +(<a href="http://www.gnu.org/software/gengetopt">http://www.gnu.org/software/gengetopt</a>), for command line parsing. | |
| 1003 | + | |
| 1004 | + <p>I started to use also <em>doublecpp</em> | |
| 1005 | +(<a href="http://doublecpp.sourceforge.net">http://doublecpp.sourceforge.net</a>) that permits achieving dynamic | |
| 1006 | +overloading. | |
| 1007 | + | |
| 1008 | + <p>Actually, apart from the boost regex library, you don't need the other | |
| 1009 | +tools above to build source-highlight (indeed I provide the output | |
| 1010 | +sources generated by the above mentioned tools), unless you want to | |
| 1011 | +develop source-highlight. | |
| 1012 | + | |
| 1013 | + <p>However, if you obtained sources through Git, you need some other tools, | |
| 1014 | +see <a href="#Anonymous-Git-Checkout">Anonymous Git Checkout</a>. | |
| 1015 | + | |
| 1016 | +<div class="node"> | |
| 1017 | +<a name="Tips-on-installing-Boost-Regex-library"></a> | |
| 1018 | +<p><hr> | |
| 1019 | +Next: <a rel="next" accesskey="n" href="#Patching-from-a-previous-version">Patching from a previous version</a>, | |
| 1020 | +Previous: <a rel="previous" accesskey="p" href="#What-you-need-to-build-source_002dhighlight">What you need to build source-highlight</a>, | |
| 1021 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 1022 | + | |
| 1023 | +</div> | |
| 1024 | + | |
| 1025 | +<h3 class="section">2.5 Tips on installing Boost Regex library</h3> | |
| 1026 | + | |
| 1027 | +<p><a name="index-Boost-regex-62"></a> | |
| 1028 | +If you experience no problem in compiling source-highlight, you can | |
| 1029 | +happily skip this section<a rel="footnote" href="#fn-8" name="fnd-8"><sup>8</sup></a> :-) | |
| 1030 | + | |
| 1031 | + <p>I created this section because many users reported some problems after | |
| 1032 | +installing Boost Regex library from sources; other users had problems in | |
| 1033 | +compiling source-highlight even if this library was already correctly | |
| 1034 | +installed (especially windows users, using cygwin). I hope this section | |
| 1035 | +sheds some light in installing/using the Boost Regex library. Please, | |
| 1036 | +note that this section does not explain how to compile the Boost | |
| 1037 | +libraries (the documentation you'll find on <a href="http://www.boost.org">http://www.boost.org</a> | |
| 1038 | +is well done); it explains how to tweak things if you have problems in | |
| 1039 | +compiling source-highlight even after a successful installation of Boost | |
| 1040 | +libraries. | |
| 1041 | + | |
| 1042 | + <p>First of all, if your distribution provides packages for the Boost regex | |
| 1043 | +library, please be sure to install also the development package of the | |
| 1044 | +boost libraries, i.e., those providing also the header files needed to | |
| 1045 | +compile a program using these libraries. For instance, on my Debian | |
| 1046 | +system I had to install the package <code>libboost-regex-dev</code>, besides | |
| 1047 | +the package <code>libboost-regex</code>. | |
| 1048 | + | |
| 1049 | + <p>If your distribution does not provide these packages then you have to | |
| 1050 | +download the sources of Boost libraries from <a href="http://www.boost.org">http://www.boost.org</a> | |
| 1051 | +and follow the instructions for compilation and installation. However, | |
| 1052 | +I suggest you specify <samp><span class="file">/usr</span></samp> as prefix for installation, instead of | |
| 1053 | +relying on the default prefix <samp><span class="file">/usr/local</span></samp> (unless | |
| 1054 | +<samp><span class="file">/usr/local/include</span></samp> is already in the inclusion path of your C++ | |
| 1055 | +compiler), since this will make things easier when compiling | |
| 1056 | +source-highlight. I suggest this, since <samp><span class="file">/usr/include</span></samp> is usually | |
| 1057 | +the place where C++ searches for header files during compilation. | |
| 1058 | + | |
| 1059 | + <p>If you successfully compiled and installed the Boost Regex library, or | |
| 1060 | +you installed the package from your distribution, but you STILL | |
| 1061 | +experience problems in compiling source-highlight, then you simply have | |
| 1062 | +to adjust some things as described in the following. | |
| 1063 | + | |
| 1064 | + <p>If the <code>./configure</code> command of source-highlight reports this | |
| 1065 | +error: | |
| 1066 | + | |
| 1067 | +<pre class="example"> ERROR! Boost::regex library not installed. | |
| 1068 | +</pre> | |
| 1069 | + <p class="noindent">then, the compiler cannot find the header files for this library. In | |
| 1070 | +this case, check that the directory <samp><span class="file">/usr/include/boost</span></samp> actually | |
| 1071 | +exists; if it does not, then probably you'll find a similar directory, | |
| 1072 | +e.g., <samp><span class="file">/usr/include/boost-1_33/boost</span></samp>, depending on the version of | |
| 1073 | +the library you have installed. Then, all you have to do is to create a | |
| 1074 | +symbolic link as follows: | |
| 1075 | + | |
| 1076 | +<pre class="example"> ln -s /usr/include/boost-1_33/boost /usr/include/boost | |
| 1077 | +</pre> | |
| 1078 | + <p class="noindent">Alternatively, you might run source-highlight's configure as follows: | |
| 1079 | + | |
| 1080 | +<pre class="example"> ./configure CXXFLAGS=-I/usr/include/boost-1_33/ | |
| 1081 | +</pre> | |
| 1082 | + <p>If then <code>./configure</code> command of source-highlight reports this | |
| 1083 | +other error: | |
| 1084 | + | |
| 1085 | +<pre class="example"> ERROR! Boost::regex library is installed, but you | |
| 1086 | + must specify the suffix with --with-boost-regex at configure | |
| 1087 | + for instance, --with-boost-regex=boost_regex-gcc-1_31 | |
| 1088 | +</pre> | |
| 1089 | + <p class="noindent">then, there's still another thing to fix: you must find out the exact | |
| 1090 | +names of the files of your installed Boost Regex libraries; you can do | |
| 1091 | +this by using the command: | |
| 1092 | + | |
| 1093 | +<pre class="example"> $ ls -l /usr/lib/libboost_regex* | |
| 1094 | +</pre> | |
| 1095 | + <p class="noindent">that, for instance, on one of my cygwin installation reports: | |
| 1096 | + | |
| 1097 | +<pre class="example"> -rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.a | |
| 1098 | + -rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.a | |
| 1099 | + -rwxr-x---+ Nov 9 23:29 /usr/lib/libboost_regex-gcc-mt-s-1_33.so | |
| 1100 | + -rwxr-x---+ Nov 22 09:22 /usr/lib/libboost_regex-gcc-mt-s.so | |
| 1101 | +</pre> | |
| 1102 | + <p class="noindent">Now, you have all the information to correctly run the | |
| 1103 | +source-highlight's configure command: | |
| 1104 | + | |
| 1105 | +<pre class="example"> ./configure --with-boost-regex=boost_regex-gcc-mt-s-1_33 | |
| 1106 | +</pre> | |
| 1107 | + <p class="noindent">or, if you solved the first problem in the second way<a rel="footnote" href="#fn-9" name="fnd-9"><sup>9</sup></a>, | |
| 1108 | + | |
| 1109 | +<pre class="example"> ./configure CXXFLAGS=-I/usr/include/boost-1_33/ \ | |
| 1110 | + --with-boost-regex=boost_regex-gcc-mt-s-1_33 | |
| 1111 | +</pre> | |
| 1112 | + <p>Of course, you have to modify this command according to the names of | |
| 1113 | +your Boost Regex library installed files. | |
| 1114 | + | |
| 1115 | + <p>These instructions managed to let many users, who were experiencing | |
| 1116 | +problems, to compile source-highlight If you still have problems, please | |
| 1117 | +send me an e-mail. | |
| 1118 | + | |
| 1119 | +<div class="node"> | |
| 1120 | +<a name="Patching-from-a-previous-version"></a> | |
| 1121 | +<p><hr> | |
| 1122 | +Next: <a rel="next" accesskey="n" href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>, | |
| 1123 | +Previous: <a rel="previous" accesskey="p" href="#Tips-on-installing-Boost-Regex-library">Tips on installing Boost Regex library</a>, | |
| 1124 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 1125 | + | |
| 1126 | +</div> | |
| 1127 | + | |
| 1128 | +<h3 class="section">2.6 Patching from a previous version</h3> | |
| 1129 | + | |
| 1130 | +<p><a name="index-patching-63"></a> | |
| 1131 | +If you downloaded a patch, say | |
| 1132 | +<samp><span class="file">source-highlight-1.3-1.3.1-patch.gz</span></samp> (i.e., the patch to go from version | |
| 1133 | +1.3 to version 1.3.1), cd to the directory with sources from the | |
| 1134 | +previous version (source-highlight-1.3) and type: | |
| 1135 | + | |
| 1136 | +<pre class="example"> gunzip -cd ../source-highlight-1.3-1.3.1.patch.gz | patch -p1 | |
| 1137 | +</pre> | |
| 1138 | + <p>and restart the compilation process (if you had already run configure a | |
| 1139 | +simple make should do). | |
| 1140 | + | |
| 1141 | +<div class="node"> | |
| 1142 | +<a name="Using-source-highlight-with-less"></a> | |
| 1143 | +<a name="Using-source_002dhighlight-with-less"></a> | |
| 1144 | +<p><hr> | |
| 1145 | +Next: <a rel="next" accesskey="n" href="#Using-source_002dhighlight-as-a-CGI">Using source-highlight as a CGI</a>, | |
| 1146 | +Previous: <a rel="previous" accesskey="p" href="#Patching-from-a-previous-version">Patching from a previous version</a>, | |
| 1147 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 1148 | + | |
| 1149 | +</div> | |
| 1150 | + | |
| 1151 | +<h3 class="section">2.7 Using source-highlight with less</h3> | |
| 1152 | + | |
| 1153 | +<p>This was suggested by Konstantine Serebriany. The script | |
| 1154 | +<samp><span class="file">src-hilite-lesspipe.sh</span></samp> will be installed together with | |
| 1155 | +source-highlight. You can use the following environment variables: | |
| 1156 | + | |
| 1157 | +<pre class="example"> export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s" | |
| 1158 | + export LESS=' -R ' | |
| 1159 | +</pre> | |
| 1160 | + <p>This way, when you use less to browse a file, if it is a source file | |
| 1161 | +handled by source-highlight, it will be automatically highlighted. | |
| 1162 | + | |
| 1163 | +<div class="node"> | |
| 1164 | +<a name="Using-source-highlight-as-a-CGI"></a> | |
| 1165 | +<a name="Using-source_002dhighlight-as-a-CGI"></a> | |
| 1166 | +<p><hr> | |
| 1167 | +Next: <a rel="next" accesskey="n" href="#Building-_002erpm">Building .rpm</a>, | |
| 1168 | +Previous: <a rel="previous" accesskey="p" href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>, | |
| 1169 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 1170 | + | |
| 1171 | +</div> | |
| 1172 | + | |
| 1173 | +<h3 class="section">2.8 Using source-highlight as a CGI</h3> | |
| 1174 | + | |
| 1175 | +<p><a name="index-CGI-64"></a>CGI support was enabled thanks to Robert Wetzel; I haven't tested it | |
| 1176 | +personally. If you want to use source-highlight as a CGI program, you | |
| 1177 | +have to use the executable source-highlight-cgi. You can build such | |
| 1178 | +executable by issuing | |
| 1179 | + | |
| 1180 | +<pre class="example"> make source-highlight-cgi | |
| 1181 | +</pre> | |
| 1182 | + <p class="noindent">in the <samp><span class="file">src</span></samp> directory. | |
| 1183 | + | |
| 1184 | +<div class="node"> | |
| 1185 | +<a name="Building-.rpm"></a> | |
| 1186 | +<a name="Building-_002erpm"></a> | |
| 1187 | +<p><hr> | |
| 1188 | +Previous: <a rel="previous" accesskey="p" href="#Using-source_002dhighlight-as-a-CGI">Using source-highlight as a CGI</a>, | |
| 1189 | +Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> | |
| 1190 | + | |
| 1191 | +</div> | |
| 1192 | + | |
| 1193 | +<h3 class="section">2.9 Building .rpm</h3> | |
| 1194 | + | |
| 1195 | +<p><a name="index-rpm-65"></a> | |
| 1196 | +Christian W. Zuckschwerdt added support for building an .rpm and an | |
| 1197 | +.rpm.src. You can issue the following command | |
| 1198 | + | |
| 1199 | +<pre class="example"> rpmbuild -tb source-highlight-3.1.4.tar.gz | |
| 1200 | +</pre> | |
| 1201 | + <p>for building an .rpm with binaries and | |
| 1202 | + | |
| 1203 | +<pre class="example"> rpmbuild -ts source-highlight-3.1.4.tar.gz | |
| 1204 | +</pre> | |
| 1205 | + <p>for building an .rpm.src with sources. | |
| 1206 | + | |
| 1207 | +<div class="node"> | |
| 1226 | 1208 | <a name="Copying"></a> |
| 1227 | -<a name="SEC19"></a> | |
| 1228 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1229 | -<tr><td valign="middle" align="left">[<a href="#SEC18" title="Previous section in reading order"> < </a>]</td> | |
| 1230 | -<td valign="middle" align="left">[<a href="#SEC20" title="Next section in reading order"> > </a>]</td> | |
| 1231 | -<td valign="middle" align="left"> </td> | |
| 1232 | -<td valign="middle" align="left">[<a href="#SEC9" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1233 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Up section"> Up </a>]</td> | |
| 1234 | -<td valign="middle" align="left">[<a href="#SEC20" title="Next chapter"> >> </a>]</td> | |
| 1235 | -<td valign="middle" align="left"> </td> | |
| 1236 | -<td valign="middle" align="left"> </td> | |
| 1237 | -<td valign="middle" align="left"> </td> | |
| 1238 | -<td valign="middle" align="left"> </td> | |
| 1239 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1240 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1241 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1242 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1243 | -</tr></table> | |
| 1244 | -<h1 class="chapter"> 3. Copying Conditions </h1> | |
| 1245 | - | |
| 1246 | -<p><tt>GNU Source-highlight is free software; you are free to use, share and modify it | |
| 1209 | +<p><hr> | |
| 1210 | +Next: <a rel="next" accesskey="n" href="#Simple-Usage">Simple Usage</a>, | |
| 1211 | +Previous: <a rel="previous" accesskey="p" href="#Installation">Installation</a>, | |
| 1212 | +Up: <a rel="up" accesskey="u" href="#Top">Top</a> | |
| 1213 | + | |
| 1214 | +</div> | |
| 1215 | + | |
| 1216 | +<h2 class="chapter">3 Copying Conditions</h2> | |
| 1217 | + | |
| 1218 | +<p><a name="index-Copying-conditions-66"></a> | |
| 1219 | +GNU Source-highlight is free software; you are free to use, share and modify it | |
| 1247 | 1220 | under the terms of the GNU General Public License that accompanies this software |
| 1248 | -(see ‘<tt>COPYING</tt>’). | |
| 1249 | -</tt></p> | |
| 1250 | -<p><tt>GNU <code>source-highlight</code> was written and | |
| 1221 | +(see <samp><span class="file">COPYING</span></samp>). | |
| 1222 | + | |
| 1223 | + <p>GNU <samp><span class="command">source-highlight</span></samp> was written and | |
| 1251 | 1224 | maintained by Lorenzo Bettini <a href="http://www.lorenzobettini.it">http://www.lorenzobettini.it</a>. |
| 1252 | -</tt></p> | |
| 1253 | -<hr size="6"> | |
| 1254 | -<a name="g_t_7c21_5358_306a_4f7f_3044_65b9"></a> | |
| 1255 | -<a name="SEC20"></a> | |
| 1256 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1257 | -<tr><td valign="middle" align="left">[<a href="#SEC19" title="Previous section in reading order"> < </a>]</td> | |
| 1258 | -<td valign="middle" align="left">[<a href="#SEC21" title="Next section in reading order"> > </a>]</td> | |
| 1259 | -<td valign="middle" align="left"> </td> | |
| 1260 | -<td valign="middle" align="left">[<a href="#SEC19" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1261 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Up section"> Up </a>]</td> | |
| 1262 | -<td valign="middle" align="left">[<a href="#SEC26" title="Next chapter"> >> </a>]</td> | |
| 1263 | -<td valign="middle" align="left"> </td> | |
| 1264 | -<td valign="middle" align="left"> </td> | |
| 1265 | -<td valign="middle" align="left"> </td> | |
| 1266 | -<td valign="middle" align="left"> </td> | |
| 1267 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1268 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1269 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1270 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1271 | -</tr></table> | |
| 1272 | -<h1 class="chapter"> 4. 簡単な使い方 </h1> | |
| 1273 | - | |
| 1274 | -<p><tt>ここで、<code>source-highlight</code>実行する実際的な例を示す<a name="DOCF10" href="#FOOT10">(10)</a>。 | |
| 1275 | -</tt></p> | |
| 1276 | -<p><tt>Source-highlightは、ソースコードの字面だけを解析するので、そのプログラムソースが正しく書かれていることが前提となっている。 | |
| 1277 | -</tt></p> | |
| 1278 | -<p><tt>source-highlightの実行方法を示す(この例ではC/C++の入力ファイルを使うが、それ以外のsource-highlightの入力言語に対しても有効である): | |
| 1279 | -</tt></p> | |
| 1280 | -<table><tr><td> </td><td><pre class="example"><tt>source-highlight --src-lang cpp --out-format html \ | |
| 1281 | - --input <var><C++ file></var> \ | |
| 1282 | - --output <var><html file></var> \ | |
| 1283 | - --style-file <var><style file></var> \ | |
| 1284 | - <var>options</var> | |
| 1285 | -</tt></pre></td></tr></table> | |
| 1286 | - | |
| 1287 | -<p><tt>入力ファイルについては、<code>-i (--input)</code>オプションと標準入力のリダイレクトとは別に、単にコマンドラインに複数のファイルを指定することができ、正規表現を使ってもよい(たとえば、‘<tt>*.java</tt>’)。 | |
| 1288 | -この場合には、出力ファイルの名前は、ソースファイルの名前に.<ext>を追加して作られる。 | |
| 1289 | -この<ext>の部分は、指定された出力フォーマットに応じて選択される拡張しだ(この例では.htmlになる)。 | |
| 1290 | -style file(<a href="#SEC27">出力フォーマットスタイル</a>)には、指定言語の各部のフォーマット方法についての情報を入れる(キーワードを青のボールドで、など)。 | |
| 1291 | -</tt></p> | |
| 1292 | -<p><tt>重要:上述の二つの起動モード、<code>-i (--input)</code>と<code>-o (--output)</code>を使う(標準入出力のリダイレクトに置き換えることも可能)か、あるいは<code>-i (--input)</code>を使わずに一つ以上のファイル名を指定するか、どちらか一つを選ばなければならない。 | |
| 1293 | -これらを混ぜて使うとエラーとなるだろう: | |
| 1294 | -</tt></p> | |
| 1295 | -<table><tr><td> </td><td><pre class="example"><tt>source-highlight -o main.html main.cpp | |
| 1296 | -Please, use one of the two syntaxes for invocation: | |
| 1297 | -source-highlight [OPTIONS]... -i input_file -o output_file | |
| 1298 | -source-highlight [OPTIONS]... [FILES]... | |
| 1299 | -</tt></pre></td></tr></table> | |
| 1300 | - | |
| 1301 | -<p><tt><code>STDOUT</code>という文字列が<code>-o (--output)</code>オプションとして渡された場合、出力は標準出力に強制される。 | |
| 1302 | -</tt></p> | |
| 1303 | -<p><tt><code>-s (--src-lang)</code>が指定されていなければ、ソース言語は、入力ファイルの拡張子もしくはファイル名自体から推定される(小文字のバージョンを使うかもしれない(訳注:えーと?後でも出てくるが、どういう意味だろう。ファイル名を小文字にした名前の言語定義ファイルを使うこともあるとか...そういう意味かな?))。 | |
| 1304 | -これは、もちろん、標準入力のリダイレクトでは働かない。 | |
| 1305 | -詳細については、<a href="#SEC36">入力言語の検出方法</a>を参照してほしい。 | |
| 1306 | -</tt></p> | |
| 1307 | -<p><tt><code>-f (--out-format)</code>が指定されていない場合、出力はHTMLで生成される。 | |
| 1308 | -</tt></p> | |
| 1309 | -<p><tt><code>--style-file</code>が指定されていなければ、配布物に含まれている‘<tt>default.style</tt>’が使われる(詳細は<a href="#SEC27">出力フォーマットスタイル</a>を参照していほしい)。 | |
| 1310 | -</tt></p> | |
| 1311 | -<table class="menu" border="0" cellspacing="0"> | |
| 1312 | -<tr><td align="left" valign="top"><a href="#SEC21">4.1 HTMLの出力とXHTMLの出力</a></td><td> </td><td align="left" valign="top"> | |
| 1313 | -</td></tr> | |
| 1314 | -<tr><td align="left" valign="top"><a href="#SEC22">4.2 LaTeXの出力</a></td><td> </td><td align="left" valign="top"> | |
| 1315 | -</td></tr> | |
| 1316 | -<tr><td align="left" valign="top"><a href="#SEC23">4.3 Texinfoの出力</a></td><td> </td><td align="left" valign="top"> | |
| 1317 | -</td></tr> | |
| 1318 | -<tr><td align="left" valign="top"><a href="#SEC24">4.4 DocBookの出力</a></td><td> </td><td align="left" valign="top"> | |
| 1319 | -</td></tr> | |
| 1320 | -<tr><td align="left" valign="top"><a href="#SEC25">4.5 ANSIカラーエスケープシーケンス</a></td><td> </td><td align="left" valign="top"> | |
| 1321 | -</td></tr> | |
| 1322 | -</table> | |
| 1323 | - | |
| 1324 | -<hr size="6"> | |
| 1325 | -<a name="HTML_306e_51fa_529b_3068XHTML_306e_51fa_529b"></a> | |
| 1326 | -<a name="SEC21"></a> | |
| 1327 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1328 | -<tr><td valign="middle" align="left">[<a href="#SEC20" title="Previous section in reading order"> < </a>]</td> | |
| 1329 | -<td valign="middle" align="left">[<a href="#SEC22" title="Next section in reading order"> > </a>]</td> | |
| 1330 | -<td valign="middle" align="left"> </td> | |
| 1331 | -<td valign="middle" align="left">[<a href="#SEC20" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1332 | -<td valign="middle" align="left">[<a href="#SEC20" title="Up section"> Up </a>]</td> | |
| 1333 | -<td valign="middle" align="left">[<a href="#SEC26" title="Next chapter"> >> </a>]</td> | |
| 1334 | -<td valign="middle" align="left"> </td> | |
| 1335 | -<td valign="middle" align="left"> </td> | |
| 1336 | -<td valign="middle" align="left"> </td> | |
| 1337 | -<td valign="middle" align="left"> </td> | |
| 1338 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1339 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1340 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1341 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1342 | -</tr></table> | |
| 1343 | -<h2 class="section"> 4.1 HTMLの出力とXHTMLの出力 </h2> | |
| 1344 | - | |
| 1345 | -<p><tt>HTMLとXHTMLのデフォルトの出力フォーマットでは、フォーマットされた出力全部が<code><tt></code>と<code></tt></code>の間に挟まれて、等幅フォントが使われるようになる。 | |
| 1346 | -なので、たとえば、等幅あるいは非等幅の指定(<a href="#SEC27">出力フォーマットスタイル</a>を参照)というのは効果が無い。 | |
| 1347 | -文字は全て等幅になる。 | |
| 1348 | -このデフォルトの動作が相応わしくなくて、デフォルトで等幅フォントにしたくない場合には(そのままということ。たとえばLaTeX出力)、コマンドラインの引数<code>--outlang-def</code>で、‘<tt>html_notfixed.outlang</tt>’というファイルを使うことができる。 | |
| 1349 | -XHTMLの出力については、それに対応して、‘<tt>xhtml_notfixed.outlang</tt>’というファイルがある。 | |
| 1350 | -</tt></p> | |
| 1351 | -<p><tt>さらに、‘<tt>htmltable.outlang</tt>’というファイルが、HTMLテーブルに括られたHTMLを出力するのに使われる(スタイルファイルで指定すれば背景色も使用する)。 | |
| 1352 | -‘<tt>xhtmltable.outlang</tt>’というファイルがXHTMLの出力に対して同じことをするものだ。 | |
| 1353 | -</tt></p> | |
| 1354 | -<hr size="6"> | |
| 1355 | -<a name="LaTeX_306e_51fa_529b"></a> | |
| 1356 | -<a name="SEC22"></a> | |
| 1357 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1358 | -<tr><td valign="middle" align="left">[<a href="#SEC21" title="Previous section in reading order"> < </a>]</td> | |
| 1359 | -<td valign="middle" align="left">[<a href="#SEC23" title="Next section in reading order"> > </a>]</td> | |
| 1360 | -<td valign="middle" align="left"> </td> | |
| 1361 | -<td valign="middle" align="left">[<a href="#SEC20" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1362 | -<td valign="middle" align="left">[<a href="#SEC20" title="Up section"> Up </a>]</td> | |
| 1363 | -<td valign="middle" align="left">[<a href="#SEC26" title="Next chapter"> >> </a>]</td> | |
| 1364 | -<td valign="middle" align="left"> </td> | |
| 1365 | -<td valign="middle" align="left"> </td> | |
| 1366 | -<td valign="middle" align="left"> </td> | |
| 1367 | -<td valign="middle" align="left"> </td> | |
| 1368 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1369 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1370 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1371 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1372 | -</tr></table> | |
| 1373 | -<h2 class="section"> 4.2 LaTeXの出力 </h2> | |
| 1374 | - | |
| 1375 | -<p><tt>LaTeXの出力フォーマットを使うときには、単色の出力(<code>-f latex</code>を使う)と色付きの出力(<code>-f latexcolor</code>を使う)とを選択することができる。 | |
| 1376 | -色付きの出力の場合には、{color</tt>’パッケージが必要だ(さらに、使用しているシステムになければならない)。 | |
| 1377 | -もちろん、自分自身のLaTeX出力フォーマットを自由に定義できる。 | |
| 1378 | -<a href="#SEC59">出力言語の定義</a>を参照してほしい。 | |
| 1379 | -</p> | |
| 1380 | -<hr size="6"> | |
| 1381 | -<a name="Texinfo_306e_51fa_529b"></a> | |
| 1382 | -<a name="SEC23"></a> | |
| 1383 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1384 | -<tr><td valign="middle" align="left">[<a href="#SEC22" title="Previous section in reading order"> < </a>]</td> | |
| 1385 | -<td valign="middle" align="left">[<a href="#SEC24" title="Next section in reading order"> > </a>]</td> | |
| 1386 | -<td valign="middle" align="left"> </td> | |
| 1387 | -<td valign="middle" align="left">[<a href="#SEC20" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1388 | -<td valign="middle" align="left">[<a href="#SEC20" title="Up section"> Up </a>]</td> | |
| 1389 | -<td valign="middle" align="left">[<a href="#SEC26" title="Next chapter"> >> </a>]</td> | |
| 1390 | -<td valign="middle" align="left"> </td> | |
| 1391 | -<td valign="middle" align="left"> </td> | |
| 1392 | -<td valign="middle" align="left"> </td> | |
| 1393 | -<td valign="middle" align="left"> </td> | |
| 1394 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1395 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1396 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1397 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1398 | -</tr></table> | |
| 1399 | -<h2 class="section"> 4.3 Texinfoの出力 </h2> | |
| 1400 | - | |
| 1401 | -<p>Texinfoの出力フォーマットを使うときには、<code>--style-file</code>オプションを使って、source-highlightの配布物に入って献呈されているスタイルファイル、‘<tt>texinfo.style</tt>’を使ってもよい。 | |
| 1402 | -たとえば、<a href="#SEC71">例</a>にある例はこのスタイルファイルでフォーマットされている。 | |
| 1403 | -</p> | |
| 1404 | -<hr size="6"> | |
| 1405 | -<a name="DocBook_306e_51fa_529b"></a> | |
| 1406 | -<a name="SEC24"></a> | |
| 1407 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1408 | -<tr><td valign="middle" align="left">[<a href="#SEC23" title="Previous section in reading order"> < </a>]</td> | |
| 1409 | -<td valign="middle" align="left">[<a href="#SEC25" title="Next section in reading order"> > </a>]</td> | |
| 1410 | -<td valign="middle" align="left"> </td> | |
| 1411 | -<td valign="middle" align="left">[<a href="#SEC20" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1412 | -<td valign="middle" align="left">[<a href="#SEC20" title="Up section"> Up </a>]</td> | |
| 1413 | -<td valign="middle" align="left">[<a href="#SEC26" title="Next chapter"> >> </a>]</td> | |
| 1414 | -<td valign="middle" align="left"> </td> | |
| 1415 | -<td valign="middle" align="left"> </td> | |
| 1416 | -<td valign="middle" align="left"> </td> | |
| 1417 | -<td valign="middle" align="left"> </td> | |
| 1418 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1419 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1420 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1421 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1422 | -</tr></table> | |
| 1423 | -<h2 class="section"> 4.4 DocBookの出力 </h2> | |
| 1424 | - | |
| 1425 | -<p>DocBookの出力は<code><programlisting></code>タグを使って生成される。 | |
| 1426 | -もし、<code>--doc</code>というコマンドラインオプションが指定されれば、<code><article></code>ドキュメントが生成される。 | |
| 1427 | -</p> | |
| 1428 | -<hr size="6"> | |
| 1429 | -<a name="ANSI_30ab_30e9_30fc_30a8_30b9_30b1_30fc_30d7_30b7_30fc_30b1_30f3_30b9"></a> | |
| 1430 | -<a name="SEC25"></a> | |
| 1431 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1432 | -<tr><td valign="middle" align="left">[<a href="#SEC24" title="Previous section in reading order"> < </a>]</td> | |
| 1433 | -<td valign="middle" align="left">[<a href="#SEC26" title="Next section in reading order"> > </a>]</td> | |
| 1434 | -<td valign="middle" align="left"> </td> | |
| 1435 | -<td valign="middle" align="left">[<a href="#SEC20" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1436 | -<td valign="middle" align="left">[<a href="#SEC20" title="Up section"> Up </a>]</td> | |
| 1437 | -<td valign="middle" align="left">[<a href="#SEC26" title="Next chapter"> >> </a>]</td> | |
| 1438 | -<td valign="middle" align="left"> </td> | |
| 1439 | -<td valign="middle" align="left"> </td> | |
| 1440 | -<td valign="middle" align="left"> </td> | |
| 1441 | -<td valign="middle" align="left"> </td> | |
| 1442 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1443 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1444 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1445 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1446 | -</tr></table> | |
| 1447 | -<h2 class="section"> 4.5 ANSIカラーエスケープシーケンス </h2> | |
| 1448 | - | |
| 1449 | -<p>この出力フォーマットを、たとえば、<code>less</code>と一緒に使っているならば(<a href="#SEC16">lessでのsource-highlightの使用</a>)、<code>--style-file</code>オプションで、source-highlightの配布物に入れられている‘<tt>esc.style</tt>’を使ってもよい。 | |
| 1450 | -これにより、楽しい色付きの出力が得られる。 | |
| 1451 | -</p> | |
| 1452 | -<hr size="6"> | |
| 1453 | -<a name="g_t_8a2d_5b9a_30d5_30a1_30a4_30eb"></a> | |
| 1454 | -<a name="SEC26"></a> | |
| 1455 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1456 | -<tr><td valign="middle" align="left">[<a href="#SEC25" title="Previous section in reading order"> < </a>]</td> | |
| 1457 | -<td valign="middle" align="left">[<a href="#SEC27" title="Next section in reading order"> > </a>]</td> | |
| 1458 | -<td valign="middle" align="left"> </td> | |
| 1459 | -<td valign="middle" align="left">[<a href="#SEC20" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1460 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Up section"> Up </a>]</td> | |
| 1461 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 1462 | -<td valign="middle" align="left"> </td> | |
| 1463 | -<td valign="middle" align="left"> </td> | |
| 1464 | -<td valign="middle" align="left"> </td> | |
| 1465 | -<td valign="middle" align="left"> </td> | |
| 1466 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1467 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1468 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1469 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1470 | -</tr></table> | |
| 1471 | -<h1 class="chapter"> 5. 設定ファイル </h1> | |
| 1472 | - | |
| 1473 | -<p>実行の際、source-highlightはいくつかのファイルを必要としていて、そのようなファイルで、ソース言語を認識する方法(<code>--src-lang</code>や<code>--lang-def</code>で明示的に指定されていない場合)、あるいは、使用する出力フォーマットをどれにするか(<code>--out-format</code>や<code>--outlang-def</code>で明示的に指定されていない場合)、ソースの各要素をフォーマットする方法(たとえば、キーワードとかコメントとか)、そして、ソース言語の定義や出力言語の定義といったことの指示を見つけることになる。 | |
| 1474 | -これらのファイルについては次のセクションで説明する。 | |
| 1475 | -</p> | |
| 1476 | -<a name="IDX45"></a> | |
| 1477 | -<p>もし、そういったファイルのディレクトリが<code>--data-dir</code>というコマンドラインオプションで明示されていなければ、次の順でこれらのファイルを探す: | |
| 1478 | -</p> | |
| 1479 | -<ul class="toc"> | |
| 1480 | -<li> | |
| 1481 | -カレントディレクトリ | |
| 1482 | -</li><li> | |
| 1483 | -設定ファイルのインストールディレクトリ。 | |
| 1484 | -<a href="#SEC9">インストール</a>を参照(このディレクトリは、コンパイル時にsource-highlightにハードコードされていることを覚えていてほしい)。 | |
| 1485 | -</li><li> | |
| 1486 | -source-highlightコマンドが明示的なパス名を付けて指定された場合、インストールディレクトリが依然使用されるが、その明示したパス名に対して相対的である(訳注:イマイチ理解していない)。 | |
| 1487 | -</li></ul> | |
| 1488 | 1225 | |
| 1489 | -<p>とくに、ユーザは、環境変数 | |
| 1490 | -<a name="IDX46"></a> | |
| 1491 | -<code>SOURCE_HIGHLIGHT_DATADIR</code>でも値をセットすることができる(<a href="#SEC3"><code>source-highlight-settings</code>プログラム</a>も参照)。 | |
| 1492 | -</p> | |
| 1493 | -<p>実行の際にどのファイルが使われているかを確認したいときは、<code>--verbose</code>オプションを使うことができる。 | |
| 1494 | -</p> | |
| 1495 | -<table class="menu" border="0" cellspacing="0"> | |
| 1496 | -<tr><td align="left" valign="top"><a href="#SEC27">5.1 出力フォーマットスタイル</a></td><td> </td><td align="left" valign="top"> | |
| 1497 | -</td></tr> | |
| 1498 | -<tr><td align="left" valign="top"><a href="#SEC28">5.2 CSSを使用した出力フォーマットスタイル</a></td><td> </td><td align="left" valign="top"> | |
| 1499 | -</td></tr> | |
| 1500 | -<tr><td align="left" valign="top"><a href="#SEC29">5.3 デフォルトのスタイル</a></td><td> </td><td align="left" valign="top"> | |
| 1501 | -</td></tr> | |
| 1502 | -<tr><td align="left" valign="top"><a href="#SEC30">5.4 言語マップ</a></td><td> </td><td align="left" valign="top"> | |
| 1503 | -</td></tr> | |
| 1504 | -<tr><td align="left" valign="top"><a href="#SEC31">5.5 言語の定義ファイル</a></td><td> </td><td align="left" valign="top"> | |
| 1505 | -</td></tr> | |
| 1506 | -<tr><td align="left" valign="top"><a href="#SEC32">5.6 出力言語マップ</a></td><td> </td><td align="left" valign="top"> | |
| 1507 | -</td></tr> | |
| 1508 | -<tr><td align="left" valign="top"><a href="#SEC33">5.7 出力言語の定義ファイル</a></td><td> </td><td align="left" valign="top"> | |
| 1509 | -</td></tr> | |
| 1510 | -<tr><td align="left" valign="top"><a href="#SEC34">5.8 独自定義ファイルの開発</a></td><td> </td><td align="left" valign="top"> | |
| 1511 | -</td></tr> | |
| 1512 | -</table> | |
| 1513 | - | |
| 1514 | -<hr size="6"> | |
| 1515 | -<a name="g_t_51fa_529b_30d5_30a9_30fc_30de_30c3_30c8_30b9_30bf_30a4_30eb"></a> | |
| 1516 | -<a name="SEC27"></a> | |
| 1517 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1518 | -<tr><td valign="middle" align="left">[<a href="#SEC26" title="Previous section in reading order"> < </a>]</td> | |
| 1519 | -<td valign="middle" align="left">[<a href="#SEC28" title="Next section in reading order"> > </a>]</td> | |
| 1520 | -<td valign="middle" align="left"> </td> | |
| 1521 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1522 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 1523 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 1524 | -<td valign="middle" align="left"> </td> | |
| 1525 | -<td valign="middle" align="left"> </td> | |
| 1526 | -<td valign="middle" align="left"> </td> | |
| 1527 | -<td valign="middle" align="left"> </td> | |
| 1528 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1529 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1530 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1531 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1532 | -</tr></table> | |
| 1533 | -<h2 class="section"> 5.1 出力フォーマットスタイル </h2> | |
| 1534 | - | |
| 1535 | -<p>‘<tt>default.style</tt>’というファイルにシンタックスハイライティングのオプションを指定しなければならない<a name="DOCF11" href="#FOOT11">(11)</a>。 | |
| 1536 | -言語定義のファイルで定義された各要素について、フォーマッティングのオプションを指定することができる(その要素のリストは、 | |
| 1537 | -<a name="IDX47"></a> | |
| 1538 | -<code>--show-lang-elements</code>を使うと得られる)。 | |
| 1539 | -<a href="#SEC52">言語エレメントの一覧</a>を参照してほしい。 | |
| 1540 | -</p> | |
| 1541 | -<a name="IDX48"></a> | |
| 1542 | -<a name="IDX49"></a> | |
| 1543 | -<p>バージョン2.6から、出力ドキュメントの背景色も指定できる。 | |
| 1544 | -これには<code>bgcolor</code>というキーワードを使う(<code>--doc</code>というコマンドラインオプションが使われたときだけ目にできるかもしれない)。 | |
| 1545 | -</p> | |
| 1546 | -<p>多数のエレメントが、同じフォーマッティングオプションを共有している場合、同じ行に、これらのエレメントをカンマで分割して指定することができる<a name="DOCF12" href="#FOOT12">(12)</a>。 | |
| 1547 | -</p> | |
| 1548 | -<p>ここに、この配布物と一緒に入っている‘<tt>default.style</tt>’がある(これは、<a href="#SEC55">言語定義のチュートリアル</a>で示されている‘<tt>style.lang</tt>’を使ってフォーマットされている): | |
| 1549 | -</p> | |
| 1550 | -<table><tr><td> </td><td><pre class="example"><b>bgcolor</b> <tt>"white"</tt>; <span class="roman"><i>// the background color for documents</i></span> | |
| 1551 | -<tt><i>context</i></tt> <b>gray</b>; <span class="roman"><i>// the color for context lines (when specified with line ranges)</i></span> | |
| 1552 | - | |
| 1553 | -<tt><i>keyword</i></tt> <b>blue</b> <b>b</b> ; <span class="roman"><i>// for language keywords</i></span> | |
| 1554 | -<tt><i>type</i></tt> <b>darkgreen</b> ; <span class="roman"><i>// for basic types</i></span> | |
| 1555 | -<tt><i>usertype</i></tt> <b>teal</b> ; <span class="roman"><i>// for user defined types</i></span> | |
| 1556 | -<tt><i>string</i></tt> <b>red</b> <b>f</b> ; <span class="roman"><i>// for strings and chars</i></span> | |
| 1557 | -<tt><i>regexp</i></tt> <b>orange</b> <b>f</b> ; <span class="roman"><i>// for strings and chars</i></span> | |
| 1558 | -<tt><i>specialchar</i></tt> <b>pink</b> <b>f</b> ; <span class="roman"><i>// for special chars, e.g., \n, \t, \\</i></span> | |
| 1559 | -<tt><i>comment</i></tt> <b>brown</b> <b>i</b>, <b>noref</b>; <span class="roman"><i>// for comments</i></span> | |
| 1560 | -<tt><i>number</i></tt> <b>purple</b> ; <span class="roman"><i>// for literal numbers</i></span> | |
| 1561 | -<tt><i>preproc</i></tt> <b>darkblue</b> <b>b</b> ; <span class="roman"><i>// for preproc directives (e.g. #include, import)</i></span> | |
| 1562 | -<tt><i>symbol</i></tt> <b>darkred</b> ; <span class="roman"><i>// for simbols (e.g. <, >, +)</i></span> | |
| 1563 | -<tt><i>function</i></tt> <b>black</b> <b>b</b>; <span class="roman"><i>// for function calls and declarations</i></span> | |
| 1564 | -<tt><i>cbracket</i></tt> <b>red</b>; <span class="roman"><i>// for block brackets (e.g. {, })</i></span> | |
| 1565 | -<tt><i>todo</i></tt> <b>bg:cyan</b> <b>b</b>; <span class="roman"><i>// for TODO and FIXME</i></span> | |
| 1566 | - | |
| 1567 | -<span class="roman"><i>//Predefined variables and functions (for instance glsl)</i></span> | |
| 1568 | -<tt><i>predef_var</i></tt> <b>darkblue</b> ; | |
| 1569 | -<tt><i>predef_func</i></tt> <b>darkblue</b> <b>b</b> ; | |
| 1570 | - | |
| 1571 | -<span class="roman"><i>// for OOP</i></span> | |
| 1572 | -<tt><i>classname</i></tt> <b>teal</b> ; <span class="roman"><i>// for class names, e.g., in Java and C++</i></span> | |
| 1573 | - | |
| 1574 | -<span class="roman"><i>// line numbers</i></span> | |
| 1575 | -<b>linenum</b> <b>black</b> <b>f</b>; | |
| 1576 | - | |
| 1577 | -<span class="roman"><i>// Internet related</i></span> | |
| 1578 | -<tt><i>url</i></tt> <b>blue</b> <b>u</b>, <b>f</b>; | |
| 1579 | - | |
| 1580 | -<span class="roman"><i>// other elements for ChangeLog and Log files</i></span> | |
| 1581 | -<tt><i>date</i></tt> <b>blue</b> <b>b</b> ; | |
| 1582 | -<tt><i>time</i></tt>, <tt><i>file</i></tt> <b>darkblue</b> <b>b</b> ; | |
| 1583 | -<tt><i>ip</i></tt>, <tt><i>name</i></tt> <b>darkgreen</b> ; | |
| 1584 | - | |
| 1585 | -<span class="roman"><i>// for Prolog, Perl...</i></span> | |
| 1586 | -<tt><i>variable</i></tt> <b>darkgreen</b> ; | |
| 1587 | - | |
| 1588 | -<span class="roman"><i>// explicit for Latex</i></span> | |
| 1589 | -<tt><i>italics</i></tt> <b>darkgreen</b> <b>i</b>; | |
| 1590 | -<tt><i>bold</i></tt> <b>darkgreen</b> <b>b</b>; | |
| 1591 | -<tt><i>underline</i></tt> <b>darkgreen</b> <b>u</b>; | |
| 1592 | -<tt><i>fixed</i></tt> <b>green</b> <b>f</b>; | |
| 1593 | -<tt><i>argument</i></tt> <b>darkgreen</b>; | |
| 1594 | -<tt><i>optionalargument</i></tt> <b>purple</b>; | |
| 1595 | -<tt><i>math</i></tt> <b>orange</b>; | |
| 1596 | -<tt><i>bibtex</i></tt> <b>blue</b>; | |
| 1597 | - | |
| 1598 | -<span class="roman"><i>// for diffs</i></span> | |
| 1599 | -<tt><i>oldfile</i></tt> <b>orange</b>; | |
| 1600 | -<tt><i>newfile</i></tt> <b>darkgreen</b>; | |
| 1601 | -<tt><i>difflines</i></tt> <b>blue</b>; | |
| 1602 | - | |
| 1603 | -<span class="roman"><i>// for css</i></span> | |
| 1604 | -<tt><i>selector</i></tt> <b>purple</b>; | |
| 1605 | -<tt><i>property</i></tt> <b>blue</b>; | |
| 1606 | -<tt><i>value</i></tt> <b>darkgreen</b> <b>i</b>; | |
| 1607 | - | |
| 1608 | -<span class="roman"><i>// for oz</i></span> | |
| 1609 | -<tt><i>atom</i></tt> <b>orange</b>; | |
| 1610 | -<tt><i>meta</i></tt> <b>i</b>; | |
| 1611 | - | |
| 1612 | -<span class="roman"><i>// for file system</i></span> | |
| 1613 | -<tt><i>path</i></tt> <b>orange</b>; | |
| 1614 | - | |
| 1615 | -<span class="roman"><i>// for C (or other language) labels</i></span> | |
| 1616 | -<tt><i>label</i></tt> <b>teal</b> <b>b</b>; | |
| 1617 | - | |
| 1618 | -<span class="roman"><i>// for errors</i></span> | |
| 1619 | -<tt><i>error</i></tt> <b>purple</b>; | |
| 1620 | -<tt><i>warning</i></tt> <b>darkgreen</b>; | |
| 1621 | -</pre></td></tr></table> | |
| 1622 | -<p>このファイルは、Source-highlightの配布物に一緒に入っている言語定義で定義されているほとんどのエレメントについてスタイル定義を試みている。 | |
| 1623 | -</p> | |
| 1624 | -<a name="IDX50"></a> | |
| 1625 | -<p>コマンドラインオプションの<code>--style-file</code>で、独自のファイルを指定することもできる(‘<tt>default.style</tt>’という名前である必要はない)<a name="DOCF13" href="#FOOT13">(13)</a>。 | |
| 1626 | -<a href="#SEC35"><code>source-highlight</code>の起動</a>を参照してほしい。 | |
| 1627 | -</p> | |
| 1628 | -<p>次の行を追加するとノーマルテキストの色を指定することもできる。 | |
| 1629 | -</p> | |
| 1630 | -<table><tr><td> </td><td><pre class="example">normal darkblue ; | |
| 1631 | -</pre></td></tr></table> | |
| 1632 | - | |
| 1633 | -<a name="IDX51"></a> | |
| 1634 | -<a name="IDX52"></a> | |
| 1635 | -<p>ご覧のように、このファイルのシンタックスはかなり素直だ。 | |
| 1636 | -エレメント(あるいはカンマで区切られた複数のエレメント)の後に色を指定できる。 | |
| 1637 | -<code>bg:</code>というプリフィックスを使えば背景色<a name="DOCF14" href="#FOOT14">(14)</a>も指定できる(一例として、前述の‘<tt>default.style</tt>’では<code>todo</code>エレメントに背景色が指定されている)。 | |
| 1638 | -</p> | |
| 1639 | -<p>背景色は出力フォーマットの全てで利用できるわけではないことに注意してほしい。 | |
| 1640 | -XHTMLやLaTeXでは利用できるが、HTML<a name="DOCF15" href="#FOOT15">(15)</a>ではそうではない。 | |
| 1641 | -</p> | |
| 1642 | -<a name="IDX53"></a> | |
| 1643 | -<a name="IDX54"></a> | |
| 1644 | -<a name="IDX55"></a> | |
| 1645 | -<a name="IDX56"></a> | |
| 1646 | -<a name="IDX57"></a> | |
| 1647 | -<p>それから、ボールドやイタリックなどのような、それ以上のフォーマティングオプションを指定することができる。 | |
| 1648 | -以下が使用できるキーワードだ: | |
| 1649 | -</p> | |
| 1650 | -<table><tr><td> </td><td><pre class="example">b = bold | |
| 1651 | -i = italics | |
| 1652 | -u = underline | |
| 1653 | -f = fixed | |
| 1654 | -nf = not fixed | |
| 1655 | -noref = no reference information is generated for these elements | |
| 1656 | -</pre></td></tr></table> | |
| 1657 | - | |
| 1658 | -<a name="IDX58"></a> | |
| 1659 | -<p>バージョン2.2からは、色の指定が不要になった。 | |
| 1660 | -たとえば、‘<tt>texinfo.style</tt>’を次に示す(Texinfoの出力に対して色を使っていない): | |
| 1661 | -</p> | |
| 1662 | -<table><tr><td> </td><td><pre class="example"><tt><i>keyword</i></tt>, <tt><i>type</i></tt> <b>b</b> ; | |
| 1663 | -<tt><i>variable</i></tt> <b>f</b>, <b>i</b> ; | |
| 1664 | -<tt><i>string</i></tt> <b>f</b> ; | |
| 1665 | -<tt><i>regexp</i></tt> <b>f</b> ; | |
| 1666 | -<tt><i>comment</i></tt> <b>nf</b>, <b>i</b>, <b>noref</b> ; | |
| 1667 | -<tt><i>preproc</i></tt> <b>b</b> ; | |
| 1668 | - | |
| 1669 | -<span class="roman"><i>// line numbers</i></span> | |
| 1670 | -<b>linenum</b> <b>f</b>; | |
| 1671 | - | |
| 1672 | -<span class="roman"><i>// Internet related</i></span> | |
| 1673 | -<tt><i>url</i></tt> <b>f</b>; | |
| 1674 | - | |
| 1675 | -<span class="roman"><i>// for diffs</i></span> | |
| 1676 | -<tt><i>oldfile</i></tt>, <tt><i>newfile</i></tt> <b>i</b>; | |
| 1677 | -<tt><i>difflines</i></tt> <b>b</b>; | |
| 1678 | - | |
| 1679 | -<span class="roman"><i>// for css</i></span> | |
| 1680 | -<tt><i>selector</i></tt>, <tt><i>property</i></tt> <b>b</b>; | |
| 1681 | -<tt><i>value</i></tt> <b>i</b>; | |
| 1682 | -</pre></td></tr></table> | |
| 1683 | -<p>これらのオプションはカンマ区切りで複数指定してもよい。 | |
| 1684 | -たとえば次のようになる。 | |
| 1685 | -</p> | |
| 1686 | -<table><tr><td> </td><td><pre class="example">keyword blue u, b ; | |
| 1687 | -</pre></td></tr></table> | |
| 1688 | - | |
| 1689 | -<p>覚えていてほしいのだが、この場合では、指定されたオプションの順序は、その出力が生成されるときにも保持される。 | |
| 1690 | -たとえば、指定された出力フォーマットによって、<code>u, b</code>いう並びと、<code>b, u</code>という並びとでは、異なった結果をもたらすかもしれないということだ。 | |
| 1691 | -とくに、1番目に指定されたスタイルは、その後に指定されたスタイルの後に使われる。 | |
| 1692 | -たとえば、HTMLの場合、<code>u, b</code>という並びは、<code><u><b>...</b></u></code>というフォーマット結果を生む。 | |
| 1693 | -</p> | |
| 1694 | -<a name="IDX59"></a> | |
| 1695 | -<p><code>noref</code>オプションは、このエレメントについて、リファレンス情報が生成されないというとを指定する(<a href="#SEC70">リファレンスの生成</a>を参照)。 | |
| 1696 | -たとえば、これは<code>comment</code>エレメントに対して使われる。 | |
| 1697 | -コメント内のエレメントについてクロスリファレンスを探索したいとは思わないからだ。 | |
| 1698 | -</p> | |
| 1699 | -<p>以下は、source-highlightが処理可能な色の論理名である<a name="DOCF16" href="#FOOT16">(16)</a>: | |
| 1700 | -</p> | |
| 1701 | -<table><tr><td> </td><td><pre class="example">black | |
| 1702 | -red | |
| 1703 | -darkred | |
| 1704 | -brown | |
| 1705 | -yellow | |
| 1706 | -cyan | |
| 1707 | -blue | |
| 1708 | -pink | |
| 1709 | -purple | |
| 1710 | -orange | |
| 1711 | -brightorange | |
| 1712 | -green | |
| 1713 | -brightgreen | |
| 1714 | -darkgreen | |
| 1715 | -teal | |
| 1716 | -gray | |
| 1717 | -darkblue | |
| 1718 | -white | |
| 1719 | -</pre></td></tr></table> | |
| 1720 | - | |
| 1721 | -<a name="IDX60"></a> | |
| 1722 | -<p>二重引用符を用いれば、指定した出力フォーマットのカラースキームを直接使うこともできる。 | |
| 1723 | -たとえばHTMLにおける<code>"#00FF00"</code><a name="DOCF17" href="#FOOT17">(17)</a>、あるいは、<code>"lightblue"</code>のように、二重引用符で括られた文字列の色名すら使うことができる<a name="DOCF18" href="#FOOT18">(18)</a>。 | |
| 1724 | -もちろん、生成の際、二重引用符は取り除かれる。 | |
| 1725 | -</p> | |
| 1726 | -<p>たとえば、次のものは‘<tt>tests</tt>’ディレクトリで使われている‘<tt>syslog.style</tt>’である。 | |
| 1727 | -これは、カラースキームを直接使用している。 | |
| 1728 | -</p> | |
| 1729 | -<table><tr><td> </td><td><pre class="example"><tt><i>date</i></tt>, <tt><i>keyword</i></tt> <b>yellow</b> <b>b</b> ; | |
| 1730 | -<tt><i>time</i></tt> <tt>"#9999FF"</tt> ; | |
| 1731 | -<tt><i>ip</i></tt> <tt>"lightblue"</tt> <b>b</b> ; | |
| 1732 | - | |
| 1733 | -<tt><i>type</i></tt> <b>cyan</b> <b>b</b> ; | |
| 1734 | -<tt><i>string</i></tt> <tt>"brown"</tt> <b>b</b> ; | |
| 1735 | -<tt><i>comment</i></tt> <b>teal</b> ; | |
| 1736 | -<tt><i>number</i></tt> <b>red</b> ; | |
| 1737 | -<tt><i>preproc</i></tt> <b>cyan</b> ; | |
| 1738 | -<tt><i>symbol</i></tt> <b>green</b> ; | |
| 1739 | -<tt><i>function</i></tt> <tt>"#CC66CC"</tt> <b>b</b> ; | |
| 1740 | -<tt><i>cbracket</i></tt> <b>green</b> <b>b</b> ; | |
| 1741 | -<tt><i>twonumbers</i></tt> <b>green</b> <b>b</b> ; | |
| 1742 | -<tt><i>port</i></tt> <b>green</b> <b>b</b> ; | |
| 1743 | -<tt><i>webmethod</i></tt> <b>teal</b> ; | |
| 1744 | - | |
| 1745 | -<span class="roman"><i>// foo option</i></span> | |
| 1746 | -<tt><i>foo</i></tt> <b>red</b> <b>b</b> ; <span class="roman"><i>// foo entry</i></span> | |
| 1747 | - | |
| 1748 | - | |
| 1749 | -</pre></td></tr></table> | |
| 1750 | -<p>カラースキームを直接使用する場合には、source-highlightは変換を何も実行せず、指定されたカラースキームをそのまま出力することに注意してほしい。 | |
| 1751 | -たとえば、<code>"brown"</code>という指定は、<code>brown</code>とは違う。 | |
| 1752 | -前者はそのまま出力されるだろうが、後者は、出力フォーマットの対応する色へと変換される(HTMLについては見た目の結果は同じになりそうだ)。 | |
| 1753 | -</p> | |
| 1754 | -<p>指定された出力フォーマットによって処理されるカラースキームの文字列の指定はあなた次第である。 | |
| 1755 | -ゆえに、別々の出力フォーマットの間では、直接カラースキームを指定することはポータブルではないかもしれない。 | |
| 1756 | -たとえば、<code>"#00FF00"</code>はHTMLでは有効だが、LaTeXではそうではない。 | |
| 1757 | -</p> | |
| 1758 | -<hr size="6"> | |
| 1759 | -<a name="CSS_3092_4f7f_7528_3057_305f_51fa_529b_30d5_30a9_30fc_30de_30c3_30c8_30b9_30bf_30a4_30eb"></a> | |
| 1760 | -<a name="SEC28"></a> | |
| 1761 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1762 | -<tr><td valign="middle" align="left">[<a href="#SEC27" title="Previous section in reading order"> < </a>]</td> | |
| 1763 | -<td valign="middle" align="left">[<a href="#SEC29" title="Next section in reading order"> > </a>]</td> | |
| 1764 | -<td valign="middle" align="left"> </td> | |
| 1765 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1766 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 1767 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 1768 | -<td valign="middle" align="left"> </td> | |
| 1769 | -<td valign="middle" align="left"> </td> | |
| 1770 | -<td valign="middle" align="left"> </td> | |
| 1771 | -<td valign="middle" align="left"> </td> | |
| 1772 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1773 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1774 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1775 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1776 | -</tr></table> | |
| 1777 | -<h2 class="section"> 5.2 CSSを使用した出力フォーマットスタイル </h2> | |
| 1778 | - | |
| 1779 | -<p>バージョン2.6からは、制限されたCSSのシンタックスを使って出力フォーマットスタイルを指定できるようになった。 | |
| 1780 | -これは、<code>--css</code>オプションを使ってsource-highlightが生成する出力とは無関係であることに注意してほしい。 | |
| 1781 | -</p> | |
| 1782 | -<a name="IDX61"></a> | |
| 1783 | -<p>CSSファイルをスタイルファイルとして使うことで(すなわち、<code>--style-css-file</code>というコマンドラインオプションをへ渡すことで)、CSSと同じシンタックスを使って出力フォーマットスタイルだけを指定する。 | |
| 1784 | -これはつまり、実際の出力とは関係無く出力フォーマットスタイルに対してCSSのシンタックスを使えるということだ(これが出力フォーマットスタイルの目的)。 | |
| 1785 | -なので、LaTeXの場合についても出力フォーマットスタイルとしてCSSファイルを使うことができる(ちょうどsource-highlightの出力フォーマットスタイルで行なうように。<a href="#SEC27">出力フォーマットスタイル</a>)。 | |
| 1786 | -</p> | |
| 1787 | -<p>この機能は基本的にコードの再利用のために用意されている。 | |
| 1788 | -CSSファイルを使って出力フォーマットスタイルを指定してから、同じCSSファイルを他のHTMLページの実際のスタイルシートとして使うことができる(あるいは、<code>-css</code>オプションを指定してsource-highlightで生成した出力ファイルでさえも使える)。 | |
| 1789 | -</p> | |
| 1790 | -<p>この機能はかなり原始的なものなので、CSSのシンタックスを制限したサブセットしか認識しない。 | |
| 1791 | -とくに、セレクタは常にCSSのクラスセレクタとして扱うので、必ずドットから始めなければならない。 | |
| 1792 | -<code>/* */</code>のコメントは処理される。 | |
| 1793 | -source-highlightが処理しないプロパティ(と、その値)は単に(そして静かに)取り除かれる。 | |
| 1794 | -</p> | |
| 1795 | -<p>次のものは、スタイルフォーマットの指定としてsource-highlightが正しく処理するCSSの指定の例である: | |
| 1796 | -</p> | |
| 1797 | -<table><tr><td> </td><td><pre class="example">body { | |
| 1798 | - <b>background-color:</b> <<i>color</i> <i>specification</i>>; | |
| 1799 | - } | |
| 1800 | - | |
| 1801 | -<b>.selector</b> { | |
| 1802 | - <b>color:</b> <<i>color</i> <i>specification</i>>; | |
| 1803 | - <b>background-color:</b> <<i>color</i> <i>specification</i>>; | |
| 1804 | - <b>font-weight:</b> <i>bold</i>; <span class="roman"><i>/* this is a comment */</i></span> | |
| 1805 | - <b>font-family:</b> <i>monospace</i>; | |
| 1806 | - <b>font-style:</b> <i>italic</i>; | |
| 1807 | - <b>text-decoration:</b> <i>underline</i>; | |
| 1808 | - } | |
| 1809 | -</pre></td></tr></table> | |
| 1810 | -<p>最後に、次のものが、<a href="#SEC27">出力フォーマットスタイル</a>で提示された‘<tt>default.style</tt>’に対応する‘<tt>default.css</tt>’である: | |
| 1811 | -</p> | |
| 1812 | -<table><tr><td> </td><td><pre class="example">body { <b>background-color:</b> <i>white</i>; } | |
| 1813 | - | |
| 1814 | -<span class="roman"><i>/* the color for context lines (when specified with line ranges) */</i></span> | |
| 1815 | -<b>.context</b> { <b>color:</b> <i>gray</i>; } | |
| 1816 | - | |
| 1817 | -<b>.keyword</b> { <b>color:</b> <i>blue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1818 | -<b>.type</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1819 | -<b>.usertype</b>, <b>.classname</b> { <b>color:</b> <i>teal</i>; } | |
| 1820 | -<b>.string</b> { <b>color:</b> <i>red</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1821 | -<b>.regexp</b> { <b>color:</b> <i>orange</i>; } | |
| 1822 | -<b>.specialchar</b> { <b>color:</b> <i>pink</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1823 | -<b>.comment</b> { <b>color:</b> <i>brown</i>; <b>font-style:</b> <i>italic</i>; } | |
| 1824 | -<b>.number</b> { <b>color:</b> <i>purple</i>; } | |
| 1825 | -<b>.preproc</b> { <b>color:</b> <i>darkblue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1826 | -<b>.symbol</b> { <b>color:</b> <i>darkred</i>; } | |
| 1827 | -<b>.function</b> { <b>color:</b> <i>black</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1828 | -<b>.cbracket</b> { <b>color:</b> <i>red</i>; } | |
| 1829 | -<b>.todo</b> { <b>font-weight:</b> <i>bold</i>; <b>background-color:</b> <i>cyan</i>; } | |
| 1830 | - | |
| 1831 | -<span class="roman"><i>/* line numbers */</i></span> | |
| 1832 | -<b>.linenum</b> { <b>color:</b> <i>black</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1833 | - | |
| 1834 | -<span class="roman"><i>/* Internet related */</i></span> | |
| 1835 | -<b>.url</b> { <b>color:</b> <i>blue</i>; <b>text-decoration:</b> <i>underline</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1836 | - | |
| 1837 | -<span class="roman"><i>/* other elements for ChangeLog and Log files */</i></span> | |
| 1838 | -<b>.date</b> { <b>color:</b> <i>blue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1839 | -<b>.time</b>, <b>.file</b> { <b>color:</b> <i>darkblue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1840 | -<b>.ip</b>, <b>.name</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1841 | - | |
| 1842 | -<span class="roman"><i>/* for Prolog, Perl */</i></span> | |
| 1843 | -<b>.variable</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1844 | -<b>.italics</b> { <b>color:</b> <i>darkgreen</i>; <b>font-style:</b> <i>italic</i>; } | |
| 1845 | -<b>.bold</b> { <b>color:</b> <i>darkgreen</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1846 | - | |
| 1847 | -<span class="roman"><i>/* for LaTeX */</i></span> | |
| 1848 | -<b>.underline</b> { <b>color:</b> <i>darkgreen</i>; <b>text-decoration:</b> <i>underline</i>; } | |
| 1849 | -<b>.fixed</b> { <b>color:</b> <i>green</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1850 | -<b>.argument</b>, <b>.optionalargument</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1851 | -<b>.math</b> { <b>color:</b> <i>orange</i>; } | |
| 1852 | -<b>.bibtex</b> { <b>color:</b> <i>blue</i>; } | |
| 1853 | - | |
| 1854 | -<span class="roman"><i>/* for diffs */</i></span> | |
| 1855 | -<b>.oldfile</b> { <b>color:</b> <i>orange</i>; } | |
| 1856 | -<b>.newfile</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1857 | -<b>.difflines</b> { <b>color:</b> <i>blue</i>; } | |
| 1858 | - | |
| 1859 | -<span class="roman"><i>/* for css */</i></span> | |
| 1860 | -<b>.selector</b> { <b>color:</b> <i>purple</i>; } | |
| 1861 | -<b>.property</b> { <b>color:</b> <i>blue</i>; } | |
| 1862 | -<b>.value</b> { <b>color:</b> <i>darkgreen</i>; <b>font-style:</b> <i>italic</i>; } | |
| 1863 | - | |
| 1864 | -<span class="roman"><i>/* for Oz */</i></span> | |
| 1865 | -<b>.atom</b> { <b>color:</b> <i>orange</i>; } | |
| 1866 | -<b>.meta</b> { <b>font-style:</b> <i>italic</i>; } | |
| 1867 | - | |
| 1868 | -</pre></td></tr></table> | |
| 1869 | -<p>このファイルを<code>--style-css-file</code>というコマンドラインオプションに渡して、出力ファイルを生成すれば、‘<tt>default.style</tt>’を使った場合と同じ結果が得られるだろう。 | |
| 1870 | -</p> | |
| 1871 | -<p>source-highlightには、HTMLドキュメントの標準的なCSSファイルとしても、あるいは、<code>--style-css-file</code>へ渡すスタイルファイルとしても使える沢山のCSSファイルが付属している。 | |
| 1872 | -ドキュメンテーションのインストールディレクトリの中に‘<tt>style_examples.html</tt>’というファイルがある。 | |
| 1873 | -これは多数の出力例を示すもので、それぞれ別々のCSSスタイルを使ったものだ。 | |
| 1874 | -</p> | |
| 1875 | -<hr size="6"> | |
| 1876 | -<a name="g_t_30c7_30d5_30a9_30eb_30c8_306e_30b9_30bf_30a4_30eb"></a> | |
| 1877 | -<a name="SEC29"></a> | |
| 1878 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1879 | -<tr><td valign="middle" align="left">[<a href="#SEC28" title="Previous section in reading order"> < </a>]</td> | |
| 1880 | -<td valign="middle" align="left">[<a href="#SEC30" title="Next section in reading order"> > </a>]</td> | |
| 1881 | -<td valign="middle" align="left"> </td> | |
| 1882 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1883 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 1884 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 1885 | -<td valign="middle" align="left"> </td> | |
| 1886 | -<td valign="middle" align="left"> </td> | |
| 1887 | -<td valign="middle" align="left"> </td> | |
| 1888 | -<td valign="middle" align="left"> </td> | |
| 1889 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1890 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1891 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1892 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1893 | -</tr></table> | |
| 1894 | -<h2 class="section"> 5.3 デフォルトのスタイル </h2> | |
| 1895 | - | |
| 1896 | -<p>次のファイル<a name="DOCF19" href="#FOOT19">(19)</a>(デフォルトファイルは‘<tt>style.defaults</tt>’)は、スタイルファイルの中で、出力スタイルが指定されていない言語エレメントのデフォルトスタイルのリストだ。 | |
| 1897 | -特に次の行を見てほしい(コメント行は<code>#</code>で始まる): | |
| 1898 | -</p> | |
| 1899 | -<table><tr><td> </td><td><pre class="example">elem1 = elem2 | |
| 1900 | -</pre></td></tr></table> | |
| 1901 | - | |
| 1902 | -<p>この行は、エレメント、ここではelem1に対するスタイルが、スタイルファイルで指定されていない場合、elem1がelem2と同じスタイルを持つということを示している。 | |
| 1903 | -</p> | |
| 1904 | -<a name="IDX62"></a> | |
| 1905 | -<p>たとえば、次のものはsource-highlightに付いている‘<tt>style.defaults</tt>’だ: | |
| 1906 | -</p> | |
| 1907 | -<table><tr><td> </td><td><pre class="example"># defaults for styles | |
| 1908 | -# the format is: | |
| 1909 | -# elem1 = elem2 | |
| 1910 | -# meaning that if the style for elem1 is not specified, | |
| 1911 | -# then it will have the same style as elem2 | |
| 1912 | - | |
| 1913 | -classname = normal | |
| 1914 | -usertype = normal | |
| 1915 | -preproc = keyword | |
| 1916 | -section = function | |
| 1917 | -paren = cbracket | |
| 1918 | -attribute = type | |
| 1919 | -value = string | |
| 1920 | -predef_var = type | |
| 1921 | -predef_func = function | |
| 1922 | -atom = regexp | |
| 1923 | -meta = function | |
| 1924 | -path = regexp | |
| 1925 | -label = preproc | |
| 1926 | -error = string | |
| 1927 | -warning = type | |
| 1928 | -</pre></td></tr></table> | |
| 1929 | -<p>この場合、<code>preproc</code>エレメントのスタイルが<code>keyword</code>エレメントのスタイルをデフォルトとする。 | |
| 1930 | -</p> | |
| 1931 | -<p>このファイルは、独自のスタイルファイルを作成して、そのスタイルの中で、同じ出力スタイルを持つエレメントのスタイルを全て指定したくないような場合に便利だ(たとえば、デフォルトのスタイルでは、<code>preproc</code>エレメントはkeywordとは違うフォーマットがされるが、独自にスタイルを指定するのに、そのスタイルを指定していなければ、<code>preproc</code>エレメントは<code>keyword</code>と同じようにフォーマットされる)。 | |
| 1932 | -</p> | |
| 1933 | -<hr size="6"> | |
| 1934 | -<a name="g_t_8a00_8a9e_30de_30c3_30d7"></a> | |
| 1935 | -<a name="SEC30"></a> | |
| 1936 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1937 | -<tr><td valign="middle" align="left">[<a href="#SEC29" title="Previous section in reading order"> < </a>]</td> | |
| 1938 | -<td valign="middle" align="left">[<a href="#SEC31" title="Next section in reading order"> > </a>]</td> | |
| 1939 | -<td valign="middle" align="left"> </td> | |
| 1940 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1941 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 1942 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 1943 | -<td valign="middle" align="left"> </td> | |
| 1944 | -<td valign="middle" align="left"> </td> | |
| 1945 | -<td valign="middle" align="left"> </td> | |
| 1946 | -<td valign="middle" align="left"> </td> | |
| 1947 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1948 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1949 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1950 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1951 | -</tr></table> | |
| 1952 | -<h2 class="section"> 5.4 言語マップ </h2> | |
| 1953 | - | |
| 1954 | -<p>この設定ファイルは、特定の言語定義ファイルに拡張子を関連付けている。 | |
| 1955 | -そのようなファイルの拡張子を使って、<code>--src-lang</code>オプションを指定することもできる(<a href="#SEC20">簡単な使い方</a>を参照)。 | |
| 1956 | -source-highlightは、‘<tt>lang.map</tt>’と呼ばれる、そういったファイルが付属している。 | |
| 1957 | -</p> | |
| 1958 | -<p>もちろん、このファイルの設定は、独自の言語マップファイルを書いて、コマンドラインオプションの<code>--lang-map</code>でそのファイルを指定すれば、オーバーライドすることもできる。 | |
| 1959 | -さらに、上で説明したように、カレントディレクトリに‘<tt>lang.map</tt>’が存在すれば、そのバージョンが使用される。 | |
| 1960 | -そのファイルのフォーマットは極めてシンプルだ(コメント行は<code>#</code>で始まる): | |
| 1961 | -</p> | |
| 1962 | -<table><tr><td> </td><td><pre class="example">extension = language definition file | |
| 1963 | -</pre></td></tr></table> | |
| 1964 | - | |
| 1965 | -<p>デフォルトの言語定義ファイルは<a href="#SEC1">導入</a>の中で示されている。 | |
| 1966 | -</p> | |
| 1967 | -<hr size="6"> | |
| 1968 | -<a name="g_t_8a00_8a9e_306e_5b9a_7fa9_30d5_30a1_30a4_30eb"></a> | |
| 1969 | -<a name="SEC31"></a> | |
| 1970 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1971 | -<tr><td valign="middle" align="left">[<a href="#SEC30" title="Previous section in reading order"> < </a>]</td> | |
| 1972 | -<td valign="middle" align="left">[<a href="#SEC32" title="Next section in reading order"> > </a>]</td> | |
| 1973 | -<td valign="middle" align="left"> </td> | |
| 1974 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 1975 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 1976 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 1977 | -<td valign="middle" align="left"> </td> | |
| 1978 | -<td valign="middle" align="left"> </td> | |
| 1979 | -<td valign="middle" align="left"> </td> | |
| 1980 | -<td valign="middle" align="left"> </td> | |
| 1981 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 1982 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 1983 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 1984 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 1985 | -</tr></table> | |
| 1986 | -<h2 class="section"> 5.5 言語の定義ファイル </h2> | |
| 1987 | - | |
| 1988 | -<p>これらのファイルは、ソースのハイライトされるべきエレメントを指定するものなので、source-highlightにとって極めて重要なものだ。 | |
| 1989 | -これらのファイルはまた、source-highlightが扱わない言語を処理するために独自の言語定義ファイルを指定できるようにもする<a name="DOCF20" href="#FOOT20">(20)</a>。 | |
| 1990 | -これらのファイルのシンタックスは<a href="#SEC37">言語の定義</a>で説明されている。 | |
| 1991 | -</p> | |
| 1992 | -<hr size="6"> | |
| 1993 | -<a name="g_t_51fa_529b_8a00_8a9e_30de_30c3_30d7"></a> | |
| 1994 | -<a name="SEC32"></a> | |
| 1995 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 1996 | -<tr><td valign="middle" align="left">[<a href="#SEC31" title="Previous section in reading order"> < </a>]</td> | |
| 1997 | -<td valign="middle" align="left">[<a href="#SEC33" title="Next section in reading order"> > </a>]</td> | |
| 1998 | -<td valign="middle" align="left"> </td> | |
| 1999 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2000 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 2001 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 2002 | -<td valign="middle" align="left"> </td> | |
| 2003 | -<td valign="middle" align="left"> </td> | |
| 2004 | -<td valign="middle" align="left"> </td> | |
| 2005 | -<td valign="middle" align="left"> </td> | |
| 2006 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2007 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2008 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2009 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2010 | -</tr></table> | |
| 2011 | -<h2 class="section"> 5.6 出力言語マップ </h2> | |
| 2012 | - | |
| 2013 | -<p>この設定ファイルは出力フォーマットを特定の出力言語の定義ファイルと関連付けるものだ。 | |
| 2014 | -出力フォーマットの名前を使って、<code>--out-format</code>オプションを指定することができる(<a href="#SEC20">簡単な使い方</a>を参照)。 | |
| 2015 | -Source-highlightには、そのような‘<tt>outlang.map</tt>’と呼ばれるファイルが付属している。 | |
| 2016 | -</p> | |
| 2017 | -<p>もちろん、このファイルの設定は、独自の言語マップを書いて、そういったファイルをコマンドラインオプションの<code>--outlang-map</code>で指定すれば、オーバーライドすることができる。 | |
| 2018 | -さらに、上で述べたように、‘<tt>outlang.map</tt>’というファイルがカレントディレクトリに存在すれば、そのバージョンが使われる。 | |
| 2019 | -そういったファイルのフォーマットは極めてシンプルだ: | |
| 2020 | -</p> | |
| 2021 | -<table><tr><td> </td><td><pre class="example">output format name = language definition file | |
| 2022 | -</pre></td></tr></table> | |
| 2023 | - | |
| 2024 | -<p>デフォルトの言語定義ファイルは<a href="#SEC1">導入</a>で示されている。 | |
| 2025 | -</p> | |
| 2026 | -<p>とくに、出力言語マップの出力フォーマットの名前には、付け方がある。 | |
| 2027 | -<code>-css</code>サフィックスが付いているものは、<code>--css</code>というコマンドラインオプションが指定されたときに使われるものだ。 | |
| 2028 | -</p> | |
| 2029 | -<hr size="6"> | |
| 2030 | -<a name="g_t_51fa_529b_8a00_8a9e_306e_5b9a_7fa9_30d5_30a1_30a4_30eb"></a> | |
| 2031 | -<a name="SEC33"></a> | |
| 2032 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2033 | -<tr><td valign="middle" align="left">[<a href="#SEC32" title="Previous section in reading order"> < </a>]</td> | |
| 2034 | -<td valign="middle" align="left">[<a href="#SEC34" title="Next section in reading order"> > </a>]</td> | |
| 2035 | -<td valign="middle" align="left"> </td> | |
| 2036 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2037 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 2038 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 2039 | -<td valign="middle" align="left"> </td> | |
| 2040 | -<td valign="middle" align="left"> </td> | |
| 2041 | -<td valign="middle" align="left"> </td> | |
| 2042 | -<td valign="middle" align="left"> </td> | |
| 2043 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2044 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2045 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2046 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2047 | -</tr></table> | |
| 2048 | -<h2 class="section"> 5.7 出力言語の定義ファイル </h2> | |
| 2049 | - | |
| 2050 | -<p>これらのファイルは、ソースのエレメントがどのようにハイライトされるかを指定するものなので、source-highlightにとって極めて重要だ。 | |
| 2051 | -これらのファイルはまた、source-highlightが扱わない出力フォーマットを処理するための独自の出力フォーマットの定義を指定することもできるようにする<a name="DOCF21" href="#FOOT21">(21)</a>。 | |
| 2052 | -こういったファイルのシンタックスは<a href="#SEC59">出力言語の定義</a>で説明されている。 | |
| 2053 | -</p> | |
| 2054 | -<p>これらのファイルはsource-highlightの配布物の一部であるが、次の場所から自由にダウンロードすることもできる: | |
| 2055 | -</p> | |
| 2056 | -<p><a href="http://www.gnu.org/software/src-highlite/outlang_files/">http://www.gnu.org/software/src-highlite/outlang_files/</a> | |
| 2057 | -</p> | |
| 2058 | -<hr size="6"> | |
| 2059 | -<a name="g_t_72ec_81ea_5b9a_7fa9_30d5_30a1_30a4_30eb_306e_958b_767a"></a> | |
| 2060 | -<a name="SEC34"></a> | |
| 2061 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2062 | -<tr><td valign="middle" align="left">[<a href="#SEC33" title="Previous section in reading order"> < </a>]</td> | |
| 2063 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next section in reading order"> > </a>]</td> | |
| 2064 | -<td valign="middle" align="left"> </td> | |
| 2065 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2066 | -<td valign="middle" align="left">[<a href="#SEC26" title="Up section"> Up </a>]</td> | |
| 2067 | -<td valign="middle" align="left">[<a href="#SEC35" title="Next chapter"> >> </a>]</td> | |
| 2068 | -<td valign="middle" align="left"> </td> | |
| 2069 | -<td valign="middle" align="left"> </td> | |
| 2070 | -<td valign="middle" align="left"> </td> | |
| 2071 | -<td valign="middle" align="left"> </td> | |
| 2072 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2073 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2074 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2075 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2076 | -</tr></table> | |
| 2077 | -<h2 class="section"> 5.8 独自定義ファイルの開発 </h2> | |
| 2078 | - | |
| 2079 | -<p>新しい言語定義を書いたり、既存の言語定義を訂正修正して、それを私に送ってくれるようにお勧めしたい。 | |
| 2080 | -そうすれば、source-highlightの配布物にそれらを追加することができる。 | |
| 2081 | -</p> | |
| 2082 | -<p>これらのファイルにはさらなる説明が必要なので(しかし、source-highlightの通常の使用には必要ではない)、複数のパート<a href="#SEC37">言語の定義</a>と<a href="#SEC59">出力言語の定義</a>で丁寧に説明する。 | |
| 2083 | -</p> | |
| 2084 | -<p>これらのファイルはsource-highlightの配布物の一部であるが、次の場所から自由にダウンロードすることもできる: | |
| 2085 | -</p> | |
| 2086 | -<p><a href="http://www.gnu.org/software/src-highlite/lang_files/">http://www.gnu.org/software/src-highlite/lang_files/</a> | |
| 2087 | -</p> | |
| 2088 | - | |
| 2089 | -<hr size="6"> | |
| 2090 | -<a name="source_002dhighlight_306e_8d77_52d5"></a> | |
| 2091 | -<a name="SEC35"></a> | |
| 2092 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2093 | -<tr><td valign="middle" align="left">[<a href="#SEC34" title="Previous section in reading order"> < </a>]</td> | |
| 2094 | -<td valign="middle" align="left">[<a href="#SEC36" title="Next section in reading order"> > </a>]</td> | |
| 2095 | -<td valign="middle" align="left"> </td> | |
| 2096 | -<td valign="middle" align="left">[<a href="#SEC26" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2097 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Up section"> Up </a>]</td> | |
| 2098 | -<td valign="middle" align="left">[<a href="#SEC37" title="Next chapter"> >> </a>]</td> | |
| 2099 | -<td valign="middle" align="left"> </td> | |
| 2100 | -<td valign="middle" align="left"> </td> | |
| 2101 | -<td valign="middle" align="left"> </td> | |
| 2102 | -<td valign="middle" align="left"> </td> | |
| 2103 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2104 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2105 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2106 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2107 | -</tr></table> | |
| 2108 | -<h1 class="chapter"> 6. <code>source-highlight</code>の起動 </h1> | |
| 2109 | - | |
| 2110 | -<p><code>source-highlight</code>プログラムを実行する形式は次のようになる: | |
| 2111 | -</p> | |
| 2112 | -<table><tr><td> </td><td><pre class="example">source-highlight <var>option</var> … | |
| 2113 | -</pre></td></tr></table> | |
| 2114 | - | |
| 2115 | -<p><code>source-highlight</code>は、<code>source-highlight --detailed-help</code>の出力で表示されるが、次のようなオプションをサポートしている: | |
| 2116 | -</p> | |
| 2117 | - | |
| 2118 | -<p>いくつかのオプションについて詳細に説明しよう(<code>--help</code>の出力自体から明らかなはずなものや、<a href="#SEC20">簡単な使い方</a>で既に説明済みのものは除く)。 | |
| 2119 | -</p> | |
| 2120 | -<dl compact="compact"> | |
| 2121 | -<dt> <code>--data-dir</code></dt> | |
| 2122 | -<dd><a name="IDX63"></a> | |
| 2123 | - | |
| 2124 | -<p>Source-highlightは、その実行の際、いくつかのファイル、たとえば、言語定義ファイル、出力フォーマットの定義ファイルなどを必要とする。 | |
| 2125 | -これらのファイルは<code>prefix/share/source-highlight</code>にインストールされる(<code>prefix</code>はコンパイル時に選択される。See section <a href="#SEC9">インストール</a>参照)。 | |
| 2126 | -なので、source-highlightは必要とするファイルを全て自由に見つけられるはずだ。 | |
| 2127 | -しかし、この設定をオーバーライドしたい、たとえば、独自の言語定義ファイルがあるとか、単に、コンパイル時に使用したディレクトリとは違う場所に、使うsource-highlightのバイナリがあるなどの場合、コマンドラインオプションの<code>--data-dir</code>を使うことができる。 | |
| 2128 | -</p> | |
| 2129 | -</dd> | |
| 2130 | -<dt> <code>--doc</code></dt> | |
| 2131 | -<dt> <code>-d</code></dt> | |
| 2132 | -<dd> | |
| 2133 | -<p>スタンドアロンの出力ドキュメント(すなわち、他のドキュメントにインクルードされるとは考えられていない出力ドキュメント)が欲しい場合には、このオプションを指定する(そうでない場合には、他のドキュメントにペーストできるテキストが得られるだけだ)。 | |
| 2134 | -このオプションを選択して、<code>--title</code>を指定しない場合には、タイトルとしてソースファイル名が使用される。 | |
| 2135 | -</p> | |
| 2136 | -</dd> | |
| 2137 | -<dt> <code>--no-doc</code></dt> | |
| 2138 | -<dd><p>前述の<code>--doc</code>オプションは、実際には他のコマンドラインオプション(たとえば<code>--css</code>)で暗黙のうちに指定される。 | |
| 2139 | -これをしたくない場合には(たとえば、グローバルなスタイルシートを持っている既存のドキュメントに出力をインクルードしたいなどの場合)、<code>--no-doc</code>を使うことでこれを無効にできる。 | |
| 2140 | -</p> | |
| 2141 | -</dd> | |
| 2142 | -<dt> <code>--css</code></dt> | |
| 2143 | -<dt> <code>-c</code></dt> | |
| 2144 | -<dd><p>出力ドキュメントに対してスタイルシートファイルを指定する(たとえばHTMLに対する‘<tt>.css</tt>’<a name="DOCF22" href="#FOOT22">(22)</a>)。 | |
| 2145 | -source-highlightはこのファイルは使わないことに注意してほしい。 | |
| 2146 | -出力ファイルが生成されるときにこのファイルの名前を単に使って、出力ファイルがこのファイルをスタイルシートとして使うということを指定する(たとえば、生成されたHTMLがCSSファイルとしてこのファイルに依存する場合)。 | |
| 2147 | -</p> | |
| 2148 | -</dd> | |
| 2149 | -<dt> <code>--tab</code></dt> | |
| 2150 | -<dt> <code>-t</code></dt> | |
| 2151 | -<dd><p>このオプションを使えば、タブ文字が指定された数の空白文字に変換される(タブ位置は保存される)。 | |
| 2152 | -このオプションは、行番号を生成するときには自動的に選択される。 | |
| 2153 | -</p> | |
| 2154 | -</dd> | |
| 2155 | -<dt> <code>--style-file</code></dt> | |
| 2156 | -<dt> <code>--style-css-file</code></dt> | |
| 2157 | -<dd><p>source-highlightが出力を生成する(たとえば、フォーマットする)のに使用するファイルを指定する(たとえば、言語の各エレメントの色やスタイル)。 | |
| 2158 | -これらのファイルの形式については<a href="#SEC27">出力フォーマットスタイル</a>と<a href="#SEC28">CSSを使用した出力フォーマットスタイル</a>にそれぞれ詳しく述べられている。 | |
| 2159 | -</p> | |
| 2160 | -</dd> | |
| 2161 | -<dt> <code>--style-defaults</code></dt> | |
| 2162 | -<dd><p>スタイルファイルにスタイルの指定が無いエレメントのデフォルトのスタイルが入ったファイルを指定する(さらに詳しくは<a href="#SEC29">デフォルトのスタイル</a>を参照)。 | |
| 2163 | -</p> | |
| 2164 | -</dd> | |
| 2165 | -<dt> <code>--output-dir</code></dt> | |
| 2166 | -<dd><p>source-highlightには複数の入力ファイルを渡すことができる(<a href="#SEC20">簡単な使い方</a>を参照)。 | |
| 2167 | -この場合出力ファイルの名前は指定できない。 | |
| 2168 | -そういう場合には、コマンドを起動したディレクトリの中に出力ファイルが自動的に生成される。 | |
| 2169 | -異なるディレクトリに出力ファイルを生成したい場合に、このオプションを使うことができる。 | |
| 2170 | -</p> | |
| 2171 | -</dd> | |
| 2172 | -<dt> <code>--infer-lang</code></dt> | |
| 2173 | -<dd><a name="IDX64"></a> | |
| 2174 | -<a name="IDX65"></a> | |
| 2175 | -<p>入力言語を検出する推定メカニズムを強制する。 | |
| 2176 | -これは<a href="#SEC36">入力言語の検出方法</a>に詳述する。 | |
| 2177 | -</p> | |
| 2178 | -</dd> | |
| 2179 | -<dt> <code>--line-number</code></dt> | |
| 2180 | -<dd><p>指定されたパディング文字を使って(オプショナル)、出力に行番号を生成する<a name="DOCF23" href="#FOOT23">(23)</a>(デフォルトのパディング文字は<code>0</code>)。 | |
| 2181 | -</p> | |
| 2182 | -</dd> | |
| 2183 | -<dt> <code>--line-number-ref</code></dt> | |
| 2184 | -<dd><p><code>--line-number</code>と同様このオプションは出力行全てに番号を振り、それに加えて各行にアンカーを生成する。 | |
| 2185 | -アンカーは指定されたプリフィックス(デフォルトは<code>line</code>)と行番号からなる(たとえば<code>line25</code>)。 | |
| 2186 | -例えば、多数のファイルを処理する場合、プリフィックスとしてファイル名を使ってもよい。 | |
| 2187 | -出力言語によってはこの機能がサポートされないものもあることに注意してほしい(たとえば<code>esc</code>だ。そういう場合には意味を成さない)。 | |
| 2188 | -指定された出力言語でアンカーをどのように生成するかを定義することについては<a href="#SEC63">アンカーとリファレンス</a>を参照してほしい。 | |
| 2189 | -</p> | |
| 2190 | -<a name="IDX66"></a> | |
| 2191 | -<a name="IDX67"></a> | |
| 2192 | -<a name="IDX68"></a> | |
| 2193 | -</dd> | |
| 2194 | -<dt> <code>--line-range</code></dt> | |
| 2195 | -<dt> <code>--range-context</code></dt> | |
| 2196 | -<dt> <code>--range-separator</code></dt> | |
| 2197 | -<dd><p>バージョン2.11から、複数行の範囲を指定できるようになった。 | |
| 2198 | -ソースのうち、この範囲に収まる行だけが出力される。 | |
| 2199 | -たとえば、次のように指定された場合だ。 | |
| 2200 | -</p> | |
| 2201 | -<table><tr><td> </td><td><pre class="example">--line-range="-5","10","20-25","50-" | |
| 2202 | -</pre></td></tr></table> | |
| 2203 | - | |
| 2204 | -<p>この場合は、最初の5行、10行目、20行目から25行目まで、50行目から入力の最後まで、の各行が出力される(<a href="#SEC74">行による範囲指定</a>にある例も見てほしい)。 | |
| 2205 | -</p> | |
| 2206 | -<p><code>--line-range</code>とともに、<code>--range-context</code>も指定できる。 | |
| 2207 | -これは、範囲に入っている行の前後に追加して表示される行数である(すなわち挟んでいる“context”)。 | |
| 2208 | -これらの行はハイライトされず、<code>context</code>のスタイルに応じて表示される。 | |
| 2209 | -例として、前の例を広げる。 | |
| 2210 | -</p> | |
| 2211 | -<table><tr><td> </td><td><pre class="example">--line-range="-5","10","20-25","50-" --range-context=1 | |
| 2212 | -</pre></td></tr></table> | |
| 2213 | - | |
| 2214 | -<p>これによって、6行目、9行目、11行目、19行目、26行目、49行目の各行も出力される(<a href="#SEC75">行による範囲指定(コンテキスト付き)</a>の例も参照)。 | |
| 2215 | -</p> | |
| 2216 | -<p>最後に、<code>--range-separator</code>を使って、範囲と範囲の間に表示される、範囲セパレータ行の文字列を指定することができる(<a href="#SEC75">行による範囲指定(コンテキスト付き)</a>の例も参照)。 | |
| 2217 | -セパレータの文字列は自動的に実行されるので、たとえば、texinfo出力における{ }のような特殊な出力文字をエスケープする必要はない。 | |
| 2218 | -</p> | |
| 2219 | -<a name="IDX69"></a> | |
| 2220 | -</dd> | |
| 2221 | -<dt> <code>--regex-range</code></dt> | |
| 2222 | -<dd> | |
| 2223 | -<p>範囲は、正規表現を使って表わすこともできる。 | |
| 2224 | -これにはコマンドラインオプション<code>--regex-range</code>を使う。 | |
| 2225 | -この場合、範囲の開始は、指定された正規表現とマッチする文字列(任意の位置で)含む行で検出される。 | |
| 2226 | -範囲の終了は、その範囲を開始したのと同じ正規表現のマッチする文字列を含む行で検出される。 | |
| 2227 | -この機能は、(たとえば、まさにこのマニュアルのように)ソースコードの中でアドホックなやり方で(たとえば、コメントのパターンを指定する)、範囲を区切られた指定した場所だけを見せるようにして、コードをドキュメントにしたい場合に非常に便利だ | |
| 2228 | -See section <a href="#SEC76">正規表現による範囲指定</a> | |
| 2229 | -。 | |
| 2230 | -指定された文字列(このオプションは複数回指定してもよい)は、有効な正規表現でなければならい(なので、特殊な文字はそれなりにエスケープしなければならない)。 | |
| 2231 | -そうでなければ、エラーとなる。 | |
| 2232 | -</p> | |
| 2233 | -<p>また、<code>--line-range</code>と<code>--regex-range</code>は同じコマンドラインに共存することはできない。 | |
| 2234 | -</p> | |
| 2235 | -</dd> | |
| 2236 | -<dt> <code>--failsafe</code></dt> | |
| 2237 | -<dd><a name="IDX70"></a> | |
| 2238 | -<p>言語の指定が見つからない場合、エラーが表示されプログラムは終了する。 | |
| 2239 | -このオプションを使えば、その代わりに、そういう状況では、入力が出力フォーマットに単にフォーマットされる。 | |
| 2240 | -これは、<code>source-highlight</code>が多数の入力ファイルでもって使われるときに便利である。 | |
| 2241 | -また、‘<tt>src-hilite-lesspipe.sh</tt>’スクリプトでも使用される。 | |
| 2242 | -実のところ、このオプションを常には使うべきではないということに対する良い理由を私は見つけられなかった。 | |
| 2243 | -なので、source-highlightを実行するときにはいつもこれを使うことをお勧めする(そして確かに、将来このオプションはデフォルトになるかもしれない)。 | |
| 2244 | -<a href="#SEC16">lessでのsource-highlightの使用</a>と<a href="#SEC7">簡単なフォーマッタとしてのsource-highlightの使用</a>も見てほしい。 | |
| 2245 | -</p> | |
| 2246 | -<a name="IDX71"></a> | |
| 2247 | -<p><code>--failsafe</code>を使うとき、入力言語がはっきりしない場合には、source-highlightは‘<tt>default.lang</tt>’という入力言語の定義ファイルを使う。 | |
| 2248 | -これは空のファイルである。 | |
| 2249 | -そういったファイルはカスタマイズしてもかまわない。 | |
| 2250 | -</p> | |
| 2251 | -</dd> | |
| 2252 | -<dt> <code>--debug-lang</code></dt> | |
| 2253 | -<dt> <code>--show-regex</code></dt> | |
| 2254 | -<dd><p>言語定義ファイルをデバッグできるようにする。 | |
| 2255 | -<a href="#SEC54">デバッギング</a> | |
| 2256 | -</p> | |
| 2257 | -</dd> | |
| 2258 | -</dl> | |
| 1226 | +<div class="node"> | |
| 1227 | +<a name="Simple-Usage"></a> | |
| 1228 | +<p><hr> | |
| 1229 | +Next: <a rel="next" accesskey="n" href="#Configuration-files">Configuration files</a>, | |
| 1230 | +Previous: <a rel="previous" accesskey="p" href="#Copying">Copying</a>, | |
| 1231 | +Up: <a rel="up" accesskey="u" href="#Top">Top</a> | |
| 2259 | 1232 | |
| 2260 | -<p>リファレンスを処理するコマンドラインオプションは、<a href="#SEC70">リファレンスの生成</a>の中でさらに詳しく説明されている。 | |
| 2261 | -</p> | |
| 2262 | -<table class="menu" border="0" cellspacing="0"> | |
| 2263 | -<tr><td align="left" valign="top"><a href="#SEC36">6.1 入力言語の検出方法</a></td><td> </td><td align="left" valign="top"> | |
| 2264 | -</td></tr> | |
| 2265 | -</table> | |
| 2266 | - | |
| 2267 | -<hr size="6"> | |
| 2268 | -<a name="g_t_5165_529b_8a00_8a9e_306e_691c_51fa_65b9_6cd5"></a> | |
| 2269 | -<a name="SEC36"></a> | |
| 2270 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2271 | -<tr><td valign="middle" align="left">[<a href="#SEC35" title="Previous section in reading order"> < </a>]</td> | |
| 2272 | -<td valign="middle" align="left">[<a href="#SEC37" title="Next section in reading order"> > </a>]</td> | |
| 2273 | -<td valign="middle" align="left"> </td> | |
| 2274 | -<td valign="middle" align="left">[<a href="#SEC35" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2275 | -<td valign="middle" align="left">[<a href="#SEC35" title="Up section"> Up </a>]</td> | |
| 2276 | -<td valign="middle" align="left">[<a href="#SEC37" title="Next chapter"> >> </a>]</td> | |
| 2277 | -<td valign="middle" align="left"> </td> | |
| 2278 | -<td valign="middle" align="left"> </td> | |
| 2279 | -<td valign="middle" align="left"> </td> | |
| 2280 | -<td valign="middle" align="left"> </td> | |
| 2281 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2282 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2283 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2284 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2285 | -</tr></table> | |
| 2286 | -<h2 class="section"> 6.1 入力言語の検出方法 </h2> | |
| 2287 | - | |
| 2288 | -<p>既に述べたように(<a href="#SEC20">簡単な使い方</a>)、source-highlightは、<code>--src-lang</code>オプションや<code>--lang-def</code>オプションで指定された言語に応じて、あるいは入力ファイルの拡張子を使うことによって、言語定義ファイルを使用する。 | |
| 2289 | -</p> | |
| 2290 | -<p>バージョン2.5からは、source-highlightは、入力言語を推定するための推定メカニズムを使うことができる。 | |
| 2291 | -今のところ、“sha-bang”メカニズムに基づくスクリプト言語の検出ができる。 | |
| 2292 | -すなわち、スクリプトの最初の行に、たとえば次のような行を含んでいる場合だ。 | |
| 2293 | -</p> | |
| 2294 | -<table><tr><td> </td><td><pre class="example">#!/bin/sh | |
| 2295 | -</pre></td></tr></table> | |
| 2296 | - | |
| 2297 | -<p><code>env</code>プログラムを使って指定されたスクリプト言語を検出する<a name="DOCF24" href="#FOOT24">(24)</a>: | |
| 2298 | -</p> | |
| 2299 | -<table><tr><td> </td><td><pre class="example">#!/usr/bin/env perl | |
| 2300 | -</pre></td></tr></table> | |
| 2301 | - | |
| 2302 | -<p><code>-*- lang -*-</code>という形式を使ったEmacsのメジャーモードの宣言する、Emacsの慣習を認識する。 | |
| 2303 | -</p> | |
| 2304 | -<p>また一例として、以下のように始まるスクリプトの場合だ: | |
| 2305 | -</p> | |
| 2306 | -<table><tr><td> </td><td><pre class="example">#!/bin/bash | |
| 2307 | -# -*- Tcl -*- | |
| 2308 | -</pre></td></tr></table> | |
| 2309 | - | |
| 2310 | -<p>この場合は、bashスクリプトではなく、Tclスクリプトとして解釈される。 | |
| 2311 | -</p> | |
| 2312 | -<p>最後に、<code><?</code>という記述(たとえば、<code><?php</code>や<code><?xml</code>)と<code><!doctype</code>(この場合xmlファイルだと推定される)を認識する<a name="DOCF25" href="#FOOT25">(25)</a>。 | |
| 2313 | -</p> | |
| 2314 | -<p>この推定メカニズムは、デフォルトで、入力言語が明示的に指定されていないか、あるいは、入力ファイルの拡張子やファイル名そのもの(小文字の場合もあるかもしれない)を使って言語マップで見つけられない場合に実行される(入力ファイルが拡張子を全く持たない場合もあるかもしれないが、たとえば、‘<tt>ChangeLog</tt>’という入力ファイルは‘<tt>changelog.lang</tt>’を使ってハイライトされる)。 | |
| 2315 | -</p> | |
| 2316 | -<a name="IDX72"></a> | |
| 2317 | -<p>加えて、このメカニズムは、<code>--infer-lang</code>というコマンドラインオプションで優先されるようになる。 | |
| 2318 | -たとえば、source-hiliteを実行するときに、PerlスクリプトをPrologスクリプトとしてフォーマットするという問題を避けるために(‘<tt>.pl</tt>’という拡張子が言語マップファイルでPrologプログラムに関連付けられているため)、‘<tt>src-hilite-lesspipe.sh</tt>’スクリプトで使われている。 | |
| 2319 | -</p> | |
| 2320 | -<hr size="6"> | |
| 2321 | -<a name="g_t_8a00_8a9e_306e_5b9a_7fa9"></a> | |
| 2322 | -<a name="SEC37"></a> | |
| 2323 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2324 | -<tr><td valign="middle" align="left">[<a href="#SEC36" title="Previous section in reading order"> < </a>]</td> | |
| 2325 | -<td valign="middle" align="left">[<a href="#SEC38" title="Next section in reading order"> > </a>]</td> | |
| 2326 | -<td valign="middle" align="left"> </td> | |
| 2327 | -<td valign="middle" align="left">[<a href="#SEC35" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2328 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Up section"> Up </a>]</td> | |
| 2329 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2330 | -<td valign="middle" align="left"> </td> | |
| 2331 | -<td valign="middle" align="left"> </td> | |
| 2332 | -<td valign="middle" align="left"> </td> | |
| 2333 | -<td valign="middle" align="left"> </td> | |
| 2334 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2335 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2336 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2337 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2338 | -</tr></table> | |
| 2339 | -<h1 class="chapter"> 7. 言語の定義 </h1> | |
| 2340 | - | |
| 2341 | -<p>バージョン2.0から、source-highlightはソース言語のエレメント(たとえば、キーワード、文字列、コメントなど)を指定するのに固有のシンタックスを使用する。 | |
| 2342 | -バージョン2.0以前では、言語のエレメントはFlexを通してスキャンされていた。 | |
| 2343 | -このため、新たな言語を処理するのに新しくflexファイルを書かなければならないことが障害となっていた。 | |
| 2344 | -さらに悪いことに、新しい言語は「動的」に追加することができず、source-highlightプログラム全部を再度コンパイルしなければならなかった。 | |
| 2345 | -</p> | |
| 2346 | -<p>今はそれに代わり、言語のエレメントは(願わくば)簡単なシンタックスを使って、ファイルに記述され、動的にロードされる。 | |
| 2347 | -そして、これらの定義は、内部的には、エレメントをハイライトするのに使うための正規表現をオンザフライに生成するのに使われる(<a href="#SEC49">source-highlightの仕組み</a>も参照してほしい)。 | |
| 2348 | -詳しく言うと、使用している正規表現は、Boostライブラリが提供しているものだ(<a href="#SEC9">インストール</a>を見よ)。 | |
| 2349 | -なので、言語の定義ファイルを書く場合には、正規表現を確実に使う必要がある。 | |
| 2350 | -しかし、怖がる必要はない。 | |
| 2351 | -言語のほとんどでは、難しい正規表現を扱う必要は決して無いだろうし、言語のキーワード(たとえば、“if”とか“while”など。<a href="#SEC39">簡単な定義</a>)を指定することもできる。 | |
| 2352 | -さらに、区切られた言語エレメントの場合、デリミタを除いて正規表現を書く必要は無いだろう(<a href="#SEC42">delim定義</a>)。 | |
| 2353 | -しかし、もっとややこしい正規表現を多用する必要のある言語の定義もあるかもしれない(たとえば一つ挙げるとPerlである)。 | |
| 2354 | -</p> | |
| 2355 | -<p>もちろん、Boost regexライブラリの正規表現を使う。 | |
| 2356 | -そのシンタックスについてはBoostのドキュメンテーション(<a href="http://www.boost.org/libs/regex/doc/syntax.html">http://www.boost.org/libs/regex/doc/syntax.html</a>)を参照するが、<a href="#SEC50">正規表現に関する注意</a>の中で、正規表現を扱ったことの無い人にとって助けとなるかもしれない、正規表現に関する注意を用意した。 | |
| 2357 | -デフォルトでは、Boost regexライブラリはPerlの正規表現シンタックスを使う。 | |
| 2358 | -現状、これがsource-highlightのサポートしている唯一のシンタックスである。 | |
| 2359 | -</p> | |
| 2360 | -<p>ここで、そのシンタックスを多くの例に依りながら詳細に見ていく。 | |
| 2361 | -これにより、既存の言語定義を簡単に修正して、新しいものを作ることができるようになる。 | |
| 2362 | -これらのファイルは通常‘<tt>.lang</tt>’という拡張子を持つ。 | |
| 2363 | -</p> | |
| 2364 | -<p>各定義は基本的に、一つの正規表現を一つの言語エレメントに関連付け、その言語エレメントに対して名前を定義している。 | |
| 2365 | -その名前は、そのエレメントをハイライトするときに、特定のスタイル(ボールド、色など)と関連付けるのに使われる。 | |
| 2366 | -言語定義のシンタックスで使われているキーワードと同じ名前を使うことはできない(たとえば、後で出てくる<code>start</code>は、予約語である)。 | |
| 2367 | -</p> | |
| 2368 | -<p><code>#</code>を使ってコメントを書くこともできる。 | |
| 2369 | -その行のその文字以降の部分はコメントとして解釈される。 | |
| 2370 | -</p> | |
| 2371 | -<p>Source-highlightは、入力ファイルの各行を別々にスキャンする。 | |
| 2372 | -なので、new line文字にマッチしようとする正規表現は失敗する運命にある。 | |
| 2373 | -しかし、言語定義のシンタックスは、複数行を処理するための手段を用意している(<a href="#SEC42">delim定義</a>と<a href="#SEC46">state/environment定義</a>を見よ)。 | |
| 2374 | -</p> | |
| 2375 | -<table class="menu" border="0" cellspacing="0"> | |
| 2376 | -<tr><td align="left" valign="top"><a href="#SEC38">7.1 正規表現の指定方法</a></td><td> </td><td align="left" valign="top"> | |
| 2377 | -</td></tr> | |
| 2378 | -<tr><td align="left" valign="top"><a href="#SEC39">7.2 簡単な定義</a></td><td> </td><td align="left" valign="top"> | |
| 2379 | -</td></tr> | |
| 2380 | -<tr><td align="left" valign="top"><a href="#SEC40">7.3 ラインワイド定義</a></td><td> </td><td align="left" valign="top"> | |
| 2381 | -</td></tr> | |
| 2382 | -<tr><td align="left" valign="top"><a href="#SEC41">7.4 定義の順序</a></td><td> </td><td align="left" valign="top"> | |
| 2383 | -</td></tr> | |
| 2384 | -<tr><td align="left" valign="top"><a href="#SEC42">7.5 delim定義</a></td><td> </td><td align="left" valign="top"> | |
| 2385 | -</td></tr> | |
| 2386 | -<tr><td align="left" valign="top"><a href="#SEC43">7.6 変数定義</a></td><td> </td><td align="left" valign="top"> | |
| 2387 | -</td></tr> | |
| 2388 | -<tr><td align="left" valign="top"><a href="#SEC44">7.7 動的後方参照</a></td><td> </td><td align="left" valign="top"> | |
| 2389 | -</td></tr> | |
| 2390 | -<tr><td align="left" valign="top"><a href="#SEC45">7.8 ファイルのインクルード</a></td><td> </td><td align="left" valign="top"> Include the contents of another file | |
| 2391 | -</td></tr> | |
| 2392 | -<tr><td align="left" valign="top"><a href="#SEC46">7.9 state/environment定義</a></td><td> </td><td align="left" valign="top"> | |
| 2393 | -</td></tr> | |
| 2394 | -<tr><td align="left" valign="top"><a href="#SEC47">7.10 名前を使った明示的な部分表現</a></td><td> </td><td align="left" valign="top"> | |
| 2395 | -</td></tr> | |
| 2396 | -<tr><td align="left" valign="top"><a href="#SEC48">7.11 再定義と置換</a></td><td> </td><td align="left" valign="top"> | |
| 2397 | -</td></tr> | |
| 2398 | -<tr><td align="left" valign="top"><a href="#SEC49">7.12 source-highlightの仕組み</a></td><td> </td><td align="left" valign="top"> | |
| 2399 | -</td></tr> | |
| 2400 | -<tr><td align="left" valign="top"><a href="#SEC50">7.13 正規表現に関する注意</a></td><td> </td><td align="left" valign="top"> | |
| 2401 | -</td></tr> | |
| 2402 | -<tr><td align="left" valign="top"><a href="#SEC51">7.14 The program <code>check-regexp</code></a></td><td> </td><td align="left" valign="top"> | |
| 2403 | -</td></tr> | |
| 2404 | -<tr><td align="left" valign="top"><a href="#SEC52">7.15 言語エレメントの一覧</a></td><td> </td><td align="left" valign="top"> | |
| 2405 | -</td></tr> | |
| 2406 | -<tr><td align="left" valign="top"><a href="#SEC53">7.16 まとめの所見</a></td><td> </td><td align="left" valign="top"> | |
| 2407 | -</td></tr> | |
| 2408 | -<tr><td align="left" valign="top"><a href="#SEC54">7.17 デバッギング</a></td><td> </td><td align="left" valign="top"> Debug a language definition file | |
| 2409 | -</td></tr> | |
| 2410 | -<tr><td align="left" valign="top"><a href="#SEC55">7.18 言語定義のチュートリアル</a></td><td> </td><td align="left" valign="top"> | |
| 2411 | -</td></tr> | |
| 2412 | -</table> | |
| 2413 | - | |
| 2414 | -<hr size="6"> | |
| 2415 | -<a name="g_t_6b63_898f_8868_73fe_306e_6307_5b9a_65b9_6cd5"></a> | |
| 2416 | -<a name="SEC38"></a> | |
| 2417 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2418 | -<tr><td valign="middle" align="left">[<a href="#SEC37" title="Previous section in reading order"> < </a>]</td> | |
| 2419 | -<td valign="middle" align="left">[<a href="#SEC39" title="Next section in reading order"> > </a>]</td> | |
| 2420 | -<td valign="middle" align="left"> </td> | |
| 2421 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2422 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2423 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2424 | -<td valign="middle" align="left"> </td> | |
| 2425 | -<td valign="middle" align="left"> </td> | |
| 2426 | -<td valign="middle" align="left"> </td> | |
| 2427 | -<td valign="middle" align="left"> </td> | |
| 2428 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2429 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2430 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2431 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2432 | -</tr></table> | |
| 2433 | -<h2 class="section"> 7.1 正規表現の指定方法 </h2> | |
| 2434 | - | |
| 2435 | -<p>言語定義のシンタックスの詳細に入る前に、正規表現の文字列を指定する三つの方法について説明することは極めて大切なことだ。 | |
| 2436 | -この三つの方法は、基本的に正規表現の特殊文字を扱う方法の違いである。 | |
| 2437 | -たとえばカッコとかがそうである。 | |
| 2438 | -このため、一つの仕組みが他のものよりもパワフルな場合があるのだが、これについてはもう少し注意も必要だろう。 | |
| 2439 | -加えて、他のものが要求されるゴールへ至ることができないために、一つの仕組みだけしか使えないような状況も起こりうる。 | |
| 2440 | -</p> | |
| 2441 | -<dl compact="compact"> | |
| 2442 | -<dd><a name="IDX73"></a> | |
| 2443 | -</dd> | |
| 2444 | -<dt> <code>"expression"</code></dt> | |
| 2445 | -<dd> | |
| 2446 | -<p>二重引用符(<code>"</code>である。<code>``</code>でも<code>''</code>でもないことに注意)を使って正規表現を指定する場合、基本的に、オルターネーションシンボルつまりパイプシンボル<code>|</code>以外の全ての文字がそのまま字面通り解釈されので、自動的にエスケープされる(たとえば、ドット<code>.</code>は、正規表現のワイルドカードではなく、文字<code>.</code>として解釈される)。 | |
| 2447 | -例として次のように指定した場合を考える。 | |
| 2448 | -</p> | |
| 2449 | -<table><tr><td> </td><td><pre class="example">"my(regular)ex.pre$$ion{*}" | |
| 2450 | -</pre></td></tr></table> | |
| 2451 | - | |
| 2452 | -<p>この場合、source-highlightは自動的に次のように変換する。 | |
| 2453 | -</p> | |
| 2454 | -<table><tr><td> </td><td><pre class="example">my\(regular\)ex\.pre\$\$ion\{\*\} | |
| 2455 | -</pre></td></tr></table> | |
| 2456 | - | |
| 2457 | - | |
| 2458 | -<p>二つの選択肢を分けるという意味を持たせない限り、<code>|</code>という特殊文字は、<code>\</code>文字でエスケープしなければならない。 | |
| 2459 | -たとえば、<code>\|</code>のようになる。 | |
| 2460 | -また、文字<code>\</code>も文字通りの意味を持たせるためには、<code>\\</code>のようにエスケープしなければならない。 | |
| 2461 | -</p> | |
| 2462 | -<a name="IDX74"></a> | |
| 2463 | -</dd> | |
| 2464 | -<dt> <code>'expression'</code></dt> | |
| 2465 | -<dd> | |
| 2466 | -<p>正規表現のフルパワーを享受したいのならば、二重引用符の代わりに、一重引用符(<code>'</code>)の文字列を使う必要がある。 | |
| 2467 | -これを使えば、特殊な文字を、その特殊な意味として指定することができるようになる。 | |
| 2468 | -</p> | |
| 2469 | -<p>しかし、マークされた部分表現は、自動的にマークされていない部分表現に変換される。 | |
| 2470 | -すなわち、まとまりの<code>(...)</code>という表現の部分は、<code>(?:...)</code>というように変形される(<a href="#SEC50">正規表現に関する注意</a>で説明しているように、<code>(?:...)</code>は、正規表現の一部をその字面通りにグループ化する。 | |
| 2471 | -その際、マークされた部分表現は生成されない)。(訳注:いわゆる正規表現メモリのことを言っているのだと思う) | |
| 2472 | -</p> | |
| 2473 | -<p>なので、例えば、次のように指定した場合を考える: | |
| 2474 | -</p> | |
| 2475 | -<table><tr><td> </td><td><pre class="example">'my(regular)ex.pre$ion*' | |
| 2476 | -</pre></td></tr></table> | |
| 2477 | - | |
| 2478 | -<p>この場合、source-highlightは自動的にこれを次のように変形する: | |
| 2479 | -</p> | |
| 2480 | -<table><tr><td> </td><td><pre class="example">my(?:regular)ex.pre$ion* | |
| 2481 | -</pre></td></tr></table> | |
| 2482 | - | |
| 2483 | -<p>マークされた部分表現はこのシンタックスでは指定することができないので、<em>後方参照</em>は許されていない(<a href="#SEC50">正規表現に関する注意</a>を参照)。 | |
| 2484 | -</p> | |
| 2485 | -<a name="IDX75"></a> | |
| 2486 | -</dd> | |
| 2487 | -<dt> <code>`expression`</code></dt> | |
| 2488 | -<dd> | |
| 2489 | -<a name="IDX76"></a> | |
| 2490 | -<a name="IDX77"></a> | |
| 2491 | -<a name="IDX78"></a> | |
| 2492 | -<p>正規表現を指定するための、このシンタックス<a name="DOCF26" href="#FOOT26">(26)</a>(このシンタックスではバッククォート<code>`</code>を使っている。前のシンタックスは<code>'</code>を使っている。その違いに注意)は、他の二つのシンタックスの制限を克服するために導入された。 | |
| 2493 | -このシンタックスを使うと、マークされた部分表現は変形されないので、<em>後方参照</em>や<em>条件</em>のような、マークされた部分表現に依存した正規表現の仕組みを利用することができる(<a href="#SEC50">正規表現に関する注意</a>を参照)。 | |
| 2494 | -</p> | |
| 2495 | -<p>このシンタックスは、例えば、Perlの正規表現のように、あるプログラミング言語の特定のプログラム部分をハイライトすることに対しても極めて重要だ。 | |
| 2496 | -Perlの正規表現は、(たとえば、置換の式において)多くの形式で表現されうる。 | |
| 2497 | -具体的に言うと、置換される部分と置換する部分を分ける、英数字以外の任意の文字が可能なセパレータである<a name="DOCF27" href="#FOOT27">(27)</a>。 | |
| 2498 | -例を挙げる: | |
| 2499 | -</p> | |
| 2500 | -<table><tr><td> </td><td><pre class="example">s/foo/bar/g | |
| 2501 | -s|foo|bar|g | |
| 2502 | -s#foo#bar#g | |
| 2503 | -s@foo@bar@g | |
| 2504 | -</pre></td></tr></table> | |
| 2505 | - | |
| 2506 | -<p>このシンタックスと後方参照を使うと、一つの言語エレメントを定義して、これらの複数の表現を処理することが簡単にできるようになる(可能性のある非英数字を全て列挙することはない): | |
| 2507 | -</p> | |
| 2508 | -<table><tr><td> </td><td><pre class="example">regexp = `s([^[:alnum:][:blank:]]).*\1.*\1[ixsmogce]*` | |
| 2509 | -</pre></td></tr></table> | |
| 2510 | - | |
| 2511 | -</dd> | |
| 2512 | -</dl> | |
| 1233 | +</div> | |
| 2513 | 1234 | |
| 2514 | -<p>バージョン2.11からは、正規表現の指定全てで、改行文字を入れられるようになった。 | |
| 2515 | -改行は単に無視される。 | |
| 2516 | -なので、たとえば、次のファイルを見てほしい: | |
| 2517 | -</p> | |
| 2518 | -<table><tr><td> </td><td><pre class="example"><span class="roman"><i># test_newlines.lang</i></span> | |
| 2519 | -<span class="roman"><i># test that newlines in expressions are simply discarded</i></span> | |
| 2520 | - | |
| 2521 | -<tt><i>keyword</i></tt> = <tt>"foo</tt> | |
| 2522 | -<tt>|</tt> | |
| 2523 | -<tt>lang"</tt> | |
| 2524 | - | |
| 2525 | -(<tt><i>keyword</i></tt>,<tt><i>normal</i></tt>,<tt><i>classname</i></tt>) = | |
| 2526 | - <tt>`(\<struct)</tt> | |
| 2527 | -<tt>([[:blank:]]+)</tt> | |
| 2528 | -<tt>([[:alnum:]_]+)`</tt> | |
| 2529 | - | |
| 2530 | -<tt><i>preproc</i></tt> = <tt>'^[[:blank:]]*</tt> | |
| 2531 | -<tt>#([[:blank:]]*</tt> | |
| 2532 | -<tt>[[:word:]]*)'</tt> | |
| 2533 | -</pre></td></tr></table> | |
| 2534 | -<p>このファイルは次のファイルと同等だ。 | |
| 2535 | -and the file: | |
| 2536 | -</p> | |
| 2537 | -<table><tr><td> </td><td><pre class="example"><span class="roman"><i># test_nonewlines.lang</i></span> | |
| 2538 | -<span class="roman"><i># test that newlines in expressions are simply discarded</i></span> | |
| 2539 | -<span class="roman"><i># see the corresponding test_newlines.lang</i></span> | |
| 2540 | - | |
| 2541 | -<tt><i>keyword</i></tt> = <tt>"foo|lang"</tt> | |
| 2542 | - | |
| 2543 | -(<tt><i>keyword</i></tt>,<tt><i>normal</i></tt>,<tt><i>classname</i></tt>) = <tt>`(\<struct)([[:blank:]]+)([[:alnum:]_]+)`</tt> | |
| 2544 | - | |
| 2545 | -<tt><i>preproc</i></tt> = <tt>'^[[:blank:]]*#([[:blank:]]*[[:word:]]*)'</tt> | |
| 2546 | -</pre></td></tr></table> | |
| 2547 | -<p>しかし、前者が間違い無く読み易い。 | |
| 2548 | -</p> | |
| 2549 | -<p>だが注意してほしいのだが、正規表現中の空白文字は無視されない。 | |
| 2550 | -</p> | |
| 2551 | -<hr size="6"> | |
| 2552 | -<a name="g_t_7c21_5358_306a_5b9a_7fa9"></a> | |
| 2553 | -<a name="SEC39"></a> | |
| 2554 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2555 | -<tr><td valign="middle" align="left">[<a href="#SEC38" title="Previous section in reading order"> < </a>]</td> | |
| 2556 | -<td valign="middle" align="left">[<a href="#SEC40" title="Next section in reading order"> > </a>]</td> | |
| 2557 | -<td valign="middle" align="left"> </td> | |
| 2558 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2559 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2560 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2561 | -<td valign="middle" align="left"> </td> | |
| 2562 | -<td valign="middle" align="left"> </td> | |
| 2563 | -<td valign="middle" align="left"> </td> | |
| 2564 | -<td valign="middle" align="left"> </td> | |
| 2565 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2566 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2567 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2568 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2569 | -</tr></table> | |
| 2570 | -<h2 class="section"> 7.2 簡単な定義 </h2> | |
| 2571 | - | |
| 2572 | -<p>言語のエレメントを記述する最も簡単な方法は、可能性のあるものをリストにすることだ。 | |
| 2573 | -たとえば、これはキーワードの場合だ。 | |
| 2574 | -例を挙げると、‘<tt>java.lang</tt>’は次のようになっている: | |
| 2575 | -</p> | |
| 2576 | -<table><tr><td> </td><td><pre class="example">keyword = "abstract|assert|break|case|catch|class|const", | |
| 2577 | - "continue|default|do|else|extends|false|final", | |
| 2578 | - "finally|for|goto|if|implements|instanceof|interface" | |
| 2579 | -keyword = "native|new|null|private|protected|public|return", | |
| 2580 | - "static|strictfp|super|switch|synchronized|throw", | |
| 2581 | - "throws|true|this|transient|try|volatile|while" | |
| 2582 | -</pre></td></tr></table> | |
| 2583 | - | |
| 2584 | - | |
| 2585 | -<p>引用された定義はカンマで分けることができる。 | |
| 2586 | -代わりに、引用された定義の内部では、選択肢はパイプシンボル<code>|</code>で分けられる。 | |
| 2587 | -上の定義は、keywordという言語エレメントを定義するものだ。 | |
| 2588 | -ソースファイルの中でエレメントが一つ見つかるごとに、そのエレメントは、出力フォーマットスタイルファイルにある同名の、そのエレメントに対するスタイルでハイライトされる(例で示されているエレメントは全て、source-highlightedと一緒に配布されている言語定義ファイルから取られたもので、その各エレメントにはスタイルが存在していることに注意してほしい)。 | |
| 2589 | -出力フォーマットスタイルファイルで、そのようなエレメントが指定されていない場合には、単にハイライトされない(実際は、<code>normal</code>というスタイルでハイライトされる。<a href="#SEC26">設定ファイル</a>を参照)(なのでタイポには注意を払ってほしい :-))。 | |
| 2590 | -</p> | |
| 2591 | -<p>上の例から、言語の定義が累積的であることにお気付きかもしれない。 | |
| 2592 | -つまり、2番目の<code>keyword</code>の定義は最初のものを置き換えるものではない。 | |
| 2593 | -(実際には、場合によって、言語のエレメントを再定義したいと思うこともあるだろう。 | |
| 2594 | -これは<a href="#SEC48">再定義と置換</a>で説明するように可能だ。) | |
| 2595 | -</p> | |
| 2596 | -<p>二重引用符に括られて指定されたワードは、ソースファイルにおいて正確にマッチしなければならず、また独立して存在しなければならない(空白以外のもので挟まれていてはいけない)。 | |
| 2597 | -なので、たとえば<code>class</code>という文字列は、キーワードとしてマッチするが、<code>my_class</code>の部分文字列<code>class</code>にはキーワードとしてはマッチしない。 | |
| 2598 | -正規表現の点から言うと、二重引用符に括られた単純な定義における<code>class</code>というような文字列は、<code>\<(class)\></code>というようなものを意図している。 | |
| 2599 | -</p> | |
| 2600 | -<p>特殊な文字は<code>\</code>という文字でエスケープしなければならない。 | |
| 2601 | -なので例えば、<code>|</code>という文字を指定したい場合、これは通常、二重引用符で括られた文字列の中で選択肢を分割するものとして使われるのだが、これは<code>\|</code>というように指定しなければならない。 | |
| 2602 | -</p> | |
| 2603 | -<p><a href="#SEC38">正規表現の指定方法</a>で述べているように、二重引用符で括られた定義は、字面のまま解釈される(ゆえに、たとえばドット<code>.</code>は、正規表現におけるワイルドカードとしてではなく、文字<code>.</code>として解釈される)。 | |
| 2604 | -言語のあるオルタナティブを記述するのに(訳注:to specify a language alternative)正規表現のフルパワーを享受したい場合には、二重引用符の文字列の代わりに、一重引用符(<code>'</code>)の文字列か、あるいはバッククォート(<code>`</code>)で括られた文字列を使わなければならない。 | |
| 2605 | -</p> | |
| 2606 | -<p>たとえば、次のものは、C/C++におけるプリプロセッサの定義だ: | |
| 2607 | -</p> | |
| 2608 | -<table><tr><td> </td><td><pre class="example">preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' | |
| 2609 | -</pre></td></tr></table> | |
| 2610 | - | |
| 2611 | -<p>上で説明されているように、<code>'class'</code>という定義は、<code>"class"</code>とは違うということに注意してほしい。 | |
| 2612 | -なので、たとえば、<code>'class'</code>は、<code>my_class</code>の中の<code>class</code>という部分表現にもマッチする。 | |
| 2613 | -</p> | |
| 2614 | -<p>加えて、二重引用符の文字列と一重引用符の文字列を同じリストに記述することは許されていない。 | |
| 2615 | -そういうリストの定義は分割する必要がある。 | |
| 2616 | -ゆえに、たとえば、以下の定義は間違いだ: | |
| 2617 | -</p> | |
| 2618 | -<table><tr><td> </td><td><pre class="example">preproc = "#define",'^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' | |
| 2619 | -</pre></td></tr></table> | |
| 2620 | - | |
| 2621 | -<p>一方で、次のものは正しい: | |
| 2622 | -</p> | |
| 2623 | -<table><tr><td> </td><td><pre class="example">preproc = "#define" | |
| 2624 | -preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' | |
| 2625 | -</pre></td></tr></table> | |
| 2626 | - | |
| 2627 | -<a name="IDX79"></a> | |
| 2628 | -<p>最後に、定義のリストの最後において、<code>nonsensitive</code>というキーワードを記述してもよい。 | |
| 2629 | -その場合、記述された文字列は大文字小文字を区別しないものとして解釈される。 | |
| 2630 | -たとえば、この機能はPascal言語の定義で使用している。 | |
| 2631 | -‘<tt>pascal.lang</tt>’では、キーワードは大文字小文字を区別せずに解析される: | |
| 2632 | -</p> | |
| 2633 | -<table><tr><td> </td><td><pre class="example">keyword = "alfa|and|array|begin|case|const|div", | |
| 2634 | - "do|downto|else|end|false|file|for|function|get|goto|if|in", | |
| 2635 | - "label|mod|new|not|of|or|pack|packed|page|program", | |
| 2636 | - "put|procedure|read|readln|record|repeat|reset|rewrite|set", | |
| 2637 | - "text|then|to|true|type|unpack|until|var|while|with|writeln|write" | |
| 2638 | - nonsensitive | |
| 2639 | -</pre></td></tr></table> | |
| 2640 | - | |
| 2641 | -<hr size="6"> | |
| 2642 | -<a name="g_t_30e9_30a4_30f3_30ef_30a4_30c9_5b9a_7fa9"></a> | |
| 2643 | -<a name="SEC40"></a> | |
| 2644 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2645 | -<tr><td valign="middle" align="left">[<a href="#SEC39" title="Previous section in reading order"> < </a>]</td> | |
| 2646 | -<td valign="middle" align="left">[<a href="#SEC41" title="Next section in reading order"> > </a>]</td> | |
| 2647 | -<td valign="middle" align="left"> </td> | |
| 2648 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2649 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2650 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2651 | -<td valign="middle" align="left"> </td> | |
| 2652 | -<td valign="middle" align="left"> </td> | |
| 2653 | -<td valign="middle" align="left"> </td> | |
| 2654 | -<td valign="middle" align="left"> </td> | |
| 2655 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2656 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2657 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2658 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2659 | -</tr></table> | |
| 2660 | -<h2 class="section"> 7.3 ラインワイド定義 </h2> | |
| 2661 | - | |
| 2662 | -<p>行末に至るまで残りの文字全てに影響する言語のエレメントを定義するのは、大変便利だ。 | |
| 2663 | -そういう定義には、<code>=</code>の代わりに、<code>start</code>というキーワードを使わなければならない。 | |
| 2664 | -たとえば、次のものは、C++における一行コメントの定義である: | |
| 2665 | -</p> | |
| 2666 | -<table><tr><td> </td><td><pre class="example">comment start "//" | |
| 2667 | -</pre></td></tr></table> | |
| 2668 | - | |
| 2669 | -<p>これは、ソースファイルの中で二つの文字<code>//</code>に遭遇すると、これらの文字から行末までの全てが<code>comment</code>というスタイルによってハイライトされるということを意味している。 | |
| 2670 | -</p> | |
| 2671 | -<hr size="6"> | |
| 2672 | -<a name="g_t_5b9a_7fa9_306e_9806_5e8f"></a> | |
| 2673 | -<a name="SEC41"></a> | |
| 2674 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2675 | -<tr><td valign="middle" align="left">[<a href="#SEC40" title="Previous section in reading order"> < </a>]</td> | |
| 2676 | -<td valign="middle" align="left">[<a href="#SEC42" title="Next section in reading order"> > </a>]</td> | |
| 2677 | -<td valign="middle" align="left"> </td> | |
| 2678 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2679 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2680 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2681 | -<td valign="middle" align="left"> </td> | |
| 2682 | -<td valign="middle" align="left"> </td> | |
| 2683 | -<td valign="middle" align="left"> </td> | |
| 2684 | -<td valign="middle" align="left"> </td> | |
| 2685 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2686 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2687 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2688 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2689 | -</tr></table> | |
| 2690 | -<h2 class="section"> 7.4 定義の順序 </h2> | |
| 2691 | - | |
| 2692 | -<p>言語の定義の順序が重要であるということを知るのは重要だ。 | |
| 2693 | -その順序が正規表現のマッチングの間に使用されるからだ(このことは<a href="#SEC49">source-highlightの仕組み</a>に詳述するつもりだ)。 | |
| 2694 | -それから、同じ文字で始まる定義があるならば、最も長い式をまずそのファイルの中で記述しなければならないということを確認しなければならない。 | |
| 2695 | -たとえば、次のように書いたとする: | |
| 2696 | -</p> | |
| 2697 | -<table><tr><td> </td><td><pre class="example">symbol = "/" | |
| 2698 | -comment start "//" | |
| 2699 | -</pre></td></tr></table> | |
| 2700 | - | |
| 2701 | -<p>最初の式は、常に最初にマッチさせられる。 | |
| 2702 | -そして2番目の式は決してマッチしない。 | |
| 2703 | -正しい順序は次のようになる: | |
| 2704 | -</p> | |
| 2705 | -<table><tr><td> </td><td><pre class="example">comment start "//" | |
| 2706 | -symbol = "/" | |
| 2707 | -</pre></td></tr></table> | |
| 2708 | - | |
| 2709 | -<hr size="6"> | |
| 2710 | -<a name="delim_5b9a_7fa9"></a> | |
| 2711 | -<a name="SEC42"></a> | |
| 2712 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2713 | -<tr><td valign="middle" align="left">[<a href="#SEC41" title="Previous section in reading order"> < </a>]</td> | |
| 2714 | -<td valign="middle" align="left">[<a href="#SEC43" title="Next section in reading order"> > </a>]</td> | |
| 2715 | -<td valign="middle" align="left"> </td> | |
| 2716 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2717 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2718 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2719 | -<td valign="middle" align="left"> </td> | |
| 2720 | -<td valign="middle" align="left"> </td> | |
| 2721 | -<td valign="middle" align="left"> </td> | |
| 2722 | -<td valign="middle" align="left"> </td> | |
| 2723 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2724 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2725 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2726 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2727 | -</tr></table> | |
| 2728 | -<h2 class="section"> 7.5 delim定義 </h2> | |
| 2729 | - | |
| 2730 | -<p>多くのエレメントは特定の文字の並びで区切られている。 | |
| 2731 | -たとえば文字列や複数行のコメントである。 | |
| 2732 | -こういうエレメントの定義のシンタックスは次のようになる: | |
| 2733 | -</p> | |
| 2734 | -<table><tr><td> </td><td><pre class="example"><name> delim <left delimited> <right delimiter> \ | |
| 2735 | - {escape <escape character>} \ | |
| 2736 | - {multiline} {nested} | |
| 2737 | -</pre></td></tr></table> | |
| 2738 | - | |
| 2739 | -<p><code>escape</code>ステートメントは、そのエレメントの内部にある区切り子の一つに前置させるエスケープ用の文字を指定するものだ。 | |
| 2740 | -これはオプショナルである。 | |
| 2741 | -</p> | |
| 2742 | -<p>たとえば、Cライクな文字列の定義は次のようになる: | |
| 2743 | -</p> | |
| 2744 | -<table><tr><td> </td><td><pre class="example">string delim "\"" "\"" escape "\\" | |
| 2745 | -</pre></td></tr></table> | |
| 2746 | - | |
| 2747 | -<p><code>\</code>は定義における特殊文字なので、エスケープしなければならないことに注意してほしい。 | |
| 2748 | -<code>escape</code>の指定が省略されると、Cの文字列<code>"write \"hello\" string"</code>は間違ってハイライトされてしまっていただろう(<code>"write \"</code>という文字列と、通常の文字並びの<code>hello\</code>、そして文字列の<code>" string"</code>というようにハイライトされてしまっていた)。 | |
| 2749 | -</p> | |
| 2750 | -<p><code>multiline</code>というオプションは、そのエレメントが複数行に渡ることがあるというとを記述するものだ。 | |
| 2751 | -たとえば、PHPの文字列の定義は次のようになる: | |
| 2752 | -</p> | |
| 2753 | -<table><tr><td> </td><td><pre class="example">string delim "\"" "\"" escape "\\" multiline | |
| 2754 | -</pre></td></tr></table> | |
| 2755 | - | |
| 2756 | -<p><code>nested</code>というオプションは、区切りの文字が複数あった可能性をカウントして、(スタックを使って)対応する複数の(区切り文字の)出現をマッチさせるように指示するものだ。 | |
| 2757 | -たとえば、ネストしているCライクな複数行コメントをハイライトしたいのならば(Ed Kellyが正しく指摘したように、Cスタイルのコメントはネストしない。数年間C++とJavaを使っていて、コメントというのはネストするとずっと思っていたことを遺憾に思う :-) そういう理由で、source-highlightの前のバージョンの配布物では、Cスタイルのコメントは(間違って)ネストされるように定義されていた。フィードバックをくれたEdに感謝する)、次のような定義が使えるだろう。 | |
| 2758 | -</p> | |
| 2759 | -<table><tr><td> </td><td><pre class="example">comment delim "/*" "*/" multiline nested | |
| 2760 | -</pre></td></tr></table> | |
| 2761 | - | |
| 2762 | -<p><code>nested</code>が使われなかったとしたら、以下に示すネストされたコメントの閉じる<code>*/</code>がこのコメントを終了させてしまうだろう(そして2番目の<code>*</code>はコメントとしてはハイライトされないだろう): | |
| 2763 | -</p> | |
| 2764 | -<table><tr><td> </td><td><pre class="example">/* | |
| 2765 | - This is a /* nested comment */ | |
| 2766 | -*/ | |
| 2767 | -</pre></td></tr></table> | |
| 2768 | - | |
| 2769 | -<p>区切り子で区切られた言語のエレメントがネストできるようにするには、その開始と終了のエレメントが異なっていなければならない。 | |
| 2770 | -なので、例えば以下の定義は正しくない: | |
| 2771 | -</p> | |
| 2772 | -<table><tr><td> </td><td><pre class="example">string delim "\"" "\"" nested # WRONG! | |
| 2773 | -</pre></td></tr></table> | |
| 2774 | - | |
| 2775 | -<p>上で述べたように、定義は累積的であり、そして文法的に異なった形式を使ったときですら累積的だ。 | |
| 2776 | -従って、例えば、C++スタイルのコメントの完全な定義は次のようになる(実際、Cスタイルのコメントの定義はもっとややこしい。‘<tt>c_comment.lang</tt>’というファイルを見てほしい): | |
| 2777 | -</p> | |
| 2778 | -<table><tr><td> </td><td><pre class="example">comment start "//" | |
| 2779 | -comment delim "/*" "*/" multiline | |
| 2780 | -</pre></td></tr></table> | |
| 2781 | - | |
| 2782 | -<hr size="6"> | |
| 2783 | -<a name="g_t_5909_6570_5b9a_7fa9"></a> | |
| 2784 | -<a name="SEC43"></a> | |
| 2785 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2786 | -<tr><td valign="middle" align="left">[<a href="#SEC42" title="Previous section in reading order"> < </a>]</td> | |
| 2787 | -<td valign="middle" align="left">[<a href="#SEC44" title="Next section in reading order"> > </a>]</td> | |
| 2788 | -<td valign="middle" align="left"> </td> | |
| 2789 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2790 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2791 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2792 | -<td valign="middle" align="left"> </td> | |
| 2793 | -<td valign="middle" align="left"> </td> | |
| 2794 | -<td valign="middle" align="left"> </td> | |
| 2795 | -<td valign="middle" align="left"> </td> | |
| 2796 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2797 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2798 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2799 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2800 | -</tr></table> | |
| 2801 | -<h2 class="section"> 7.6 変数定義 </h2> | |
| 2802 | - | |
| 2803 | -<p>言語定義ファイルの中の多くの場所で再利用されるように変数を定義することが可能だ。 | |
| 2804 | -変数は次のように定義される。 | |
| 2805 | -</p> | |
| 2806 | -<p><code>vardef</code> <name of the variable> <code>=</code> <list of definitions> | |
| 2807 | -</p> | |
| 2808 | -<p>一度定義すると、その変数名の前に<code>$</code>というシンボルを付けることで使うことができる。 | |
| 2809 | -例えば次のようになる。 | |
| 2810 | -</p> | |
| 2811 | -<table><tr><td> </td><td><pre class="example">vardef FUNCTION = '(?:[[:alpha:]]|_)[[:word:]]*(?=[[:blank:]]*\()' | |
| 2812 | -function = $FUNCTION | |
| 2813 | -</pre></td></tr></table> | |
| 2814 | - | |
| 2815 | -<p>大文字にしたのは単に読み易さの為だけだ。 | |
| 2816 | -</p> | |
| 2817 | -<p>変数と式を連結することも可能で、さらなる変数の定義の内部で変数を再利用することもできる: | |
| 2818 | -</p> | |
| 2819 | -<table><tr><td> </td><td><pre class="example">vardef basic_time = '[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}' | |
| 2820 | -vardef time = '\<' + $basic_time + '\>' | |
| 2821 | -</pre></td></tr></table> | |
| 2822 | - | |
| 2823 | -<hr size="6"> | |
| 2824 | -<a name="g_t_52d5_7684_5f8c_65b9_53c2_7167"></a> | |
| 2825 | -<a name="SEC44"></a> | |
| 2826 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2827 | -<tr><td valign="middle" align="left">[<a href="#SEC43" title="Previous section in reading order"> < </a>]</td> | |
| 2828 | -<td valign="middle" align="left">[<a href="#SEC45" title="Next section in reading order"> > </a>]</td> | |
| 2829 | -<td valign="middle" align="left"> </td> | |
| 2830 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2831 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2832 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2833 | -<td valign="middle" align="left"> </td> | |
| 2834 | -<td valign="middle" align="left"> </td> | |
| 2835 | -<td valign="middle" align="left"> </td> | |
| 2836 | -<td valign="middle" align="left"> </td> | |
| 2837 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2838 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2839 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2840 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2841 | -</tr></table> | |
| 2842 | -<h2 class="section"> 7.7 動的後方参照 </h2> | |
| 2843 | - | |
| 2844 | -<p><em>動的後方参照</em>を使うと、<code>delim</code>指定の最初のエレメントの正規表現によってマッチした文字列を参照することができる(バージョン2.8から)。 | |
| 2845 | -私はこの後方参照のことを、正規表現シンタックスの後方参照によってそれらを区別するために、ダイナミックと呼んだ(<a href="#SEC38">正規表現の指定方法</a>を参照)。 | |
| 2846 | -右側のデリミタ(区切り子)が左側のデリミタによってマッチした部分表現に依存しているような場合にこれは極めて重要である。 | |
| 2847 | -たとえば、Luaのコメントは<code>--[[ comment ]]</code>や<code>--[=[ comment ]=]</code>の形になるが、<code>--[=[ comment ]]</code>や<code>--[[ comment ]=]</code>のどちらでもない(さらに言えば、ネストしてもよい)<a name="DOCF28" href="#FOOT28">(28)</a>。 | |
| 2848 | -従って、右側のエレメントの正規表現は、左側のエレメントのものに依存している。 | |
| 2849 | -</p> | |
| 2850 | -<p>動的後方参照は変数に似ている(<a href="#SEC43">変数定義</a>)が、宣言は無く、次のような形をしている。 | |
| 2851 | -</p> | |
| 2852 | -<table><tr><td> </td><td><pre class="example">@{number} | |
| 2853 | -</pre></td></tr></table> | |
| 2854 | - | |
| 2855 | -<p>ここで、<code>number</code>は左側のデリミタにおけるマークされた部分表現の番号だ(source-highlightは、そういったマークされた部分表現が左側のデリミタに存在することを実際に確認する)。 | |
| 2856 | -</p> | |
| 2857 | -<p>たとえば、これがLuaのコメントの定義だ(‘<tt>lua.lang</tt>’も見よ): | |
| 2858 | -</p> | |
| 2859 | -<table><tr><td> </td><td><pre class="example">environment comment delim `--\[(=*)\[` "]" + @{1} + "]" | |
| 2860 | - multiline nested begin | |
| 2861 | - include "url.lang" | |
| 2862 | - ... | |
| 2863 | -end | |
| 2864 | -</pre></td></tr></table> | |
| 2865 | - | |
| 2866 | -<p>左側のデリミタが、マークされた部分表現としてオプショナルな<code>=</code>とどのようにマッチして、右側のデリミタが@{1}によってそれをどのように参照するかを注意してほしい。 | |
| 2867 | -</p> | |
| 2868 | -<p>source-highlightは、動的後方参照の置き換えの際に、起こりうる特殊文字のエスケープの面倒を見る。 | |
| 2869 | -たとえば、次に示すようなdelimエレメントで、<code>[^[:alnum:]]</code>という部分表現が<code>|</code>とマッチしたために、@{1}を<code>|</code>に置き換えなければならないとしよう: | |
| 2870 | -</p> | |
| 2871 | -<table><tr><td> </td><td><pre class="example">comment delim `([^[:alnum:]])` @{1} | |
| 2872 | -</pre></td></tr></table> | |
| 2873 | - | |
| 2874 | -<p><code>|</code>は正規表現のシンタックスにおいて特別な文字なので、source-highlightは、<code>@{1}</code>を実際には<code>\|</code>と置き換える。 | |
| 2875 | -</p> | |
| 2876 | -<p>重要:右側のデリミタは、その左側のデリミタの部分表現を参照できるだけである。 | |
| 2877 | -そのため、ネストされたdelimエレメントの定義の場合(たとえばstateやenvironmentで。<a href="#SEC46">state/environment定義</a>を参照)、左側のデリミタはバインダとして振舞い、外側のdelimエレメントで定義されている起こりうる部分表現を隠す。 | |
| 2878 | -</p> | |
| 2879 | -<p>後方参照でネストしている区切り子で区切られたエレメントに正しくマッチすることは大変重要なことだ。 | |
| 2880 | -source-highlightはこのLuaのネストした(そして文法上は正しい)コメントを正しく認識する: | |
| 2881 | -</p> | |
| 2882 | -<table><tr><td> </td><td><pre class="example">--[[ | |
| 2883 | - first level comment | |
| 2884 | - --[=[ | |
| 2885 | - second level | |
| 2886 | - --[[ | |
| 2887 | - third level | |
| 2888 | - ]] | |
| 2889 | - ]=] | |
| 2890 | -]] | |
| 2891 | -</pre></td></tr></table> | |
| 2892 | - | |
| 2893 | -<hr size="6"> | |
| 2894 | -<a name="g_t_30d5_30a1_30a4_30eb_306e_30a4_30f3_30af_30eb_30fc_30c9"></a> | |
| 2895 | -<a name="SEC45"></a> | |
| 2896 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2897 | -<tr><td valign="middle" align="left">[<a href="#SEC44" title="Previous section in reading order"> < </a>]</td> | |
| 2898 | -<td valign="middle" align="left">[<a href="#SEC46" title="Next section in reading order"> > </a>]</td> | |
| 2899 | -<td valign="middle" align="left"> </td> | |
| 2900 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2901 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2902 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2903 | -<td valign="middle" align="left"> </td> | |
| 2904 | -<td valign="middle" align="left"> </td> | |
| 2905 | -<td valign="middle" align="left"> </td> | |
| 2906 | -<td valign="middle" align="left"> </td> | |
| 2907 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2908 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2909 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2910 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2911 | -</tr></table> | |
| 2912 | -<h2 class="section"> 7.8 ファイルのインクルード </h2> | |
| 2913 | - | |
| 2914 | -<p>言語定義ファイルを、別のファイルにインクルードすることができる。 | |
| 2915 | -これは、インクルードが起きたちょうどその場所で、解析中の現在のファイルの中にインクルードされるファイルの内容を実際に物理的にインクルードする(ちょうどC/C++における<code>#include</code>のようなもの)。 | |
| 2916 | -これは、多数のファイルで定義を再利用するのに役に立つ。 | |
| 2917 | -たとえば、c++のコメントの定義は‘<tt>c_comment.lang</tt>’というファイルで記述されていて、このファイルはJavaやC++の定義ファイルでインクルードされている。 | |
| 2918 | -同じことは、numberやfunctionでも行われている。 | |
| 2919 | -例を挙げると、‘<tt>java.lang</tt>’ファイルには以下に示すincludeの指示が含まれている: | |
| 2920 | -</p> | |
| 2921 | -<table><tr><td> </td><td><pre class="example">include "c_comment.lang" | |
| 2922 | - | |
| 2923 | -include "number.lang" | |
| 2924 | - | |
| 2925 | -keywords ... | |
| 2926 | - | |
| 2927 | -include "function.lang" | |
| 2928 | -</pre></td></tr></table> | |
| 2929 | - | |
| 2930 | -<p>定義の順序が重要であるので、インクルードの順序が重要であることに注意してほしい。 | |
| 2931 | -たとえば、キーワードの定義よりも前に関数の定義がインクルードされると、<code>if (exp)</code>というセンテンスは関数呼び出しとしてハイライトされるだろう(<a href="#SEC41">定義の順序</a>と<a href="#SEC49">source-highlightの仕組み</a>を参照)。 | |
| 2932 | -</p> | |
| 2933 | -<hr size="6"> | |
| 2934 | -<a name="state_002fenvironment_5b9a_7fa9"></a> | |
| 2935 | -<a name="SEC46"></a> | |
| 2936 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 2937 | -<tr><td valign="middle" align="left">[<a href="#SEC45" title="Previous section in reading order"> < </a>]</td> | |
| 2938 | -<td valign="middle" align="left">[<a href="#SEC47" title="Next section in reading order"> > </a>]</td> | |
| 2939 | -<td valign="middle" align="left"> </td> | |
| 2940 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 2941 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 2942 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 2943 | -<td valign="middle" align="left"> </td> | |
| 2944 | -<td valign="middle" align="left"> </td> | |
| 2945 | -<td valign="middle" align="left"> </td> | |
| 2946 | -<td valign="middle" align="left"> </td> | |
| 2947 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 2948 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 2949 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 2950 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 2951 | -</tr></table> | |
| 2952 | -<h2 class="section"> 7.9 state/environment定義 </h2> | |
| 2953 | - | |
| 2954 | -<p>他のエレメントに挟まれている場合にだけ、あるソースエレメントをハイライトしたいということが時折ある。 | |
| 2955 | -source-highlightedの言語定義では、この機能も用意している。 | |
| 2956 | -</p> | |
| 2957 | -<table><tr><td> </td><td><pre class="example">state|environment <standard definition> begin | |
| 2958 | - <other definitions> | |
| 2959 | -end | |
| 2960 | -</pre></td></tr></table> | |
| 2961 | - | |
| 2962 | -<p>この構造は再帰的だ(なので、state/environmentの定義は別のstate/environmentの内部で使うことができる)。 | |
| 2963 | -state/environmentの意味は、state/environmentを定義している定義がマッチした場合にだけ、<code>begin ... end</code>の内部の定義がマッチするということである。 | |
| 2964 | -しかし、state/environmentに入ったとき、そのstate/environmentの外側で指定されている定義はマッチしない。 | |
| 2965 | -<code>state</code>と<code>environment</code>の違いは、後者においては、ソース言語の通常の部分(つまり、どの定義にもマッチしない部分)は、そのenvironmentを定義している定義のスタイルに応じてハイライトされるということだ。 | |
| 2966 | -</p> | |
| 2967 | -<p>例として次に示すのは、複数行のネスト可能なCのコメントで、コメントの内側にURLやメールアドレスが表われたときだけ、それらをハイライトする(ファイルのインクルードを使っているので注意してほしい): | |
| 2968 | -</p> | |
| 2969 | -<table><tr><td> </td><td><pre class="example">environment comment delim "/*" "*/" multiline nested begin | |
| 2970 | - include "url.lang" | |
| 2971 | -end | |
| 2972 | -</pre></td></tr></table> | |
| 2973 | - | |
| 2974 | -<p>コメントの内側の他の部分は全部commentのスタイルでフォーマットされなければならないため<code>environment</code>を使用しているので留意してほしい。 | |
| 2975 | -</p> | |
| 2976 | -<p>プログラミング言語の定義については、state/environmentを避けられるが(コメント内のURLとか、Javasocのコメント内のドキュメンテーションタグのように、特定の環境の内部だけでその一部分をハイライトできるようになるが)、ログやChangeLogファイルのようなファイルをハイライトするのにはかなり重要である。 | |
| 2977 | -エレメントが特定の位置に表われたときにハイライトしなければならないからだ。 | |
| 2978 | -たとえば、ChangeLogの場合(‘<tt>changelog.lang</tt>’を参照)、日付や名前、メール、URL(‘<tt>url.lang</tt>’から取った)をハイライトするのにstateを使っている: | |
| 2979 | -</p> | |
| 2980 | -<table><tr><td> </td><td><pre class="example">state date start '[[:digit:]]{2,4}-?[[:digit:]]{2}-?[[:digit:]]{2}' begin | |
| 2981 | - include "url.lang" | |
| 2982 | - name = '([[:word:]]|[[:punct:]])+' | |
| 2983 | -end | |
| 2984 | -</pre></td></tr></table> | |
| 2985 | - | |
| 2986 | -<p>(訳注:ぐだぐだです) | |
| 2987 | -state/environmentの内部に現われる定義は、その環境で定義される式と同じスコープを持つ。 | |
| 2988 | -これによって、<code>start</code>と<code>delim</code>の定義にとっては意味がある一方で、簡単な定義にとっては合理的でないかもしれない(つまり、取り得る式を単にリストするものなど)。 | |
| 2989 | -事実、こういう場合そのような式はスコープを定義しない。 | |
| 2990 | -そのような定義にとって、state/environmentの意味は、その選択肢の一つとマッチングしたあとにstate/environmentが開始するということだ。 | |
| 2991 | -そしてそれはどこで終わるのだろうか。 | |
| 2992 | -この場合環境を明示的に終了しなければならない。 | |
| 2993 | -たとえば、state/environmentの内部にいる場合、ある言語定義がキーワード<code>exit</code>にぶつかったときにも、その環境を抜け出す(脱出するstateの数を指定することもできる)。 | |
| 2994 | -<code>exitall</code>を使えば環境を全部抜けることもできる。 | |
| 2995 | -たとえば、以下に示す定義は、ウェブメソッドが後に続く空でない文字列をハイライトにする: | |
| 2996 | -</p> | |
| 2997 | -<table><tr><td> </td><td><pre class="example">vardef non_empty = '[^[:blank:]]+' | |
| 2998 | - | |
| 2999 | -state webmethod = "OPTIONS|GET|HEAD|POST|PUT|DELETE", | |
| 3000 | - "TRACE|CONNECT|PROPFIND|MKCOL|COPY|MOVE|LOCK|UNLOCK" begin | |
| 3001 | - string = $non_empty exit | |
| 3002 | -end | |
| 3003 | -</pre></td></tr></table> | |
| 3004 | - | |
| 3005 | -<p>このような進んだ機能が必要な場合にはいつでも、いくつかのログファイル(アクセスログ、Apacheのログなど)のハイライトを定義している‘<tt>log.lang</tt>’定義ファイルを見てもらったらよい。 | |
| 3006 | -さらに、明示的な名前付きの部分式で十分なような場合、上述の例がその一つなのだが、そういう場合があるかもしれない。 | |
| 3007 | -</p> | |
| 3008 | -<p>このセクションを面白い例で締め括ろう。 | |
| 3009 | -M4ファイルにおけるコメントは、<code>dnl</code>というキーワードで始まる(行末まで)。 | |
| 3010 | -たとえば、次のようになる。 | |
| 3011 | -</p> | |
| 3012 | -<table><tr><td> </td><td><pre class="example">dnl @synopsis AC_CTAGS_FLAGS | |
| 3013 | -</pre></td></tr></table> | |
| 3014 | - | |
| 3015 | -<p>さて、<code>dnl</code>をキーワードとしてハイライトし、残りの部分をコメントとしてハイライトしたい場合、environmentに簡単に頼ることはできない。 | |
| 3016 | -その行全体を同じスタイルでハイライトしてしまうからだ。 | |
| 3017 | -加えて、<code>@</code>で始まるエレメントを違うようにハイライトしたいので、実はstateが必要となる(これは前述の例にあるC++のコメントの場合のようにコメントの内部でURLをハイライトすることもできる)。 | |
| 3018 | -なので、stateでenvironmentをシミュレートする必要がある。 | |
| 3019 | -M4の例の場合次のようにする(‘<tt>m4.lang</tt>’ファイルを見よ)。 | |
| 3020 | -</p> | |
| 3021 | -<table><tr><td> </td><td><pre class="example">state keyword start "dnl" begin | |
| 3022 | - # avoid spaces in front of urls or @[[:alpha:]]+ be captured as prefixes | |
| 3023 | - comment = '[[:blank:]]+' | |
| 3024 | - include "url.lang" | |
| 3025 | - include "html.lang" | |
| 3026 | - type = '@[[:alpha:]]+' | |
| 3027 | - # everything else is a comment | |
| 3028 | - comment = '.+' | |
| 3029 | -end | |
| 3030 | -</pre></td></tr></table> | |
| 3031 | - | |
| 3032 | -<p>一度このstateに入ると、単独の空白文字が全てコメントとしてハイライトされる。 | |
| 3033 | -次に、URLと@エレメントに対するルールがあって、それから、他の全てがコメントとしてハイライトされる(<code>.+</code> )。 | |
| 3034 | -</p> | |
| 3035 | -<p>単に次に示す定義をするのが、よりスマートな方法ではないかと考える人もいるかもしれない(after all, why bothering highlighting spaces as comments)。 | |
| 3036 | -</p> | |
| 3037 | -<table><tr><td> </td><td><pre class="example">state keyword start "dnl" begin | |
| 3038 | - include "url.lang" | |
| 3039 | - include "html.lang" | |
| 3040 | - type = '@[[:alpha:]]+' | |
| 3041 | - comment = '.+' | |
| 3042 | -end | |
| 3043 | -</pre></td></tr></table> | |
| 3044 | - | |
| 3045 | -<p>さて、この定義によって、マッチしたURLや@エレメントの前にある空白は、プリフィックスであると考えられて、normalとしてハイライトされるだろう。 | |
| 3046 | -これは、source-highlightがマッチするルールを探す方法に原因がある。 | |
| 3047 | -詳細については、<a href="#SEC49">source-highlightの仕組み</a>を参照する。 | |
| 3048 | -</p> | |
| 3049 | -<hr size="6"> | |
| 3050 | -<a name="g_t_540d_524d_3092_4f7f_3063_305f_660e_793a_7684_306a_90e8_5206_8868_73fe"></a> | |
| 3051 | -<a name="SEC47"></a> | |
| 3052 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 3053 | -<tr><td valign="middle" align="left">[<a href="#SEC46" title="Previous section in reading order"> < </a>]</td> | |
| 3054 | -<td valign="middle" align="left">[<a href="#SEC48" title="Next section in reading order"> > </a>]</td> | |
| 3055 | -<td valign="middle" align="left"> </td> | |
| 3056 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 3057 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 3058 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 3059 | -<td valign="middle" align="left"> </td> | |
| 3060 | -<td valign="middle" align="left"> </td> | |
| 3061 | -<td valign="middle" align="left"> </td> | |
| 3062 | -<td valign="middle" align="left"> </td> | |
| 3063 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 3064 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 3065 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 3066 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 3067 | -</tr></table> | |
| 3068 | -<h2 class="section"> 7.10 名前を使った明示的な部分表現 </h2> | |
| 3069 | - | |
| 3070 | -<p>よく、同じ正規表現の中でプログラムの二つのエレメントを記述する必要がある。 | |
| 3071 | -それらが密接な関係があるからだが、それらを違うようにハイライトする必要がある場合もある。 | |
| 3072 | -</p> | |
| 3073 | -<p>たとえば、クラス(あるいはインターフェイス)の定義中のクラス名(あるいはインターフェイス名)をハイライトしたいことがあるかもしれない(たとえばJavaなど)。 | |
| 3074 | -従って、<code>class</code>キーワードが前置きされて、識別子がその後に続くことを利用することができる。 | |
| 3075 | -</p> | |
| 3076 | -<p>一つ定義を示す。 | |
| 3077 | -</p> | |
| 3078 | -<table><tr><td> </td><td><pre class="example">keyword = '(\<(?:class|interface))([[:blank:]]+)([$[:alnum:]]+)' | |
| 3079 | -</pre></td></tr></table> | |
| 3080 | - | |
| 3081 | -<p>このような定義は、良い結果をもたらさない。 | |
| 3082 | -というのも、クラスの名前がキーワードとしてハイライトされてしまうからだ。 | |
| 3083 | -これは望んでいたことではないかもしれない。 | |
| 3084 | -たとえば、クラス名は<code>type</code>としてハイライトされるべきなど。 | |
| 3085 | -</p> | |
| 3086 | -<p>バージョン2.6までは、これを行なう方法はstateかenvironmentを使うことだけだった(<a href="#SEC46">state/environment定義</a>)が、これを書くのはかなり難しくなりがちである。 | |
| 3087 | -</p> | |
| 3088 | -<p>バージョン2.7から、マークされた部分表現を使って正規表現を記述し、それらをそれぞれ特定の言語エレメントにバインドすることができるようになった(正規表現は<code>`</code>で括られる必要がある。<a href="#SEC38">正規表現の指定方法</a>を参照)。 | |
| 3089 | -</p> | |
| 3090 | -<table><tr><td> </td><td><pre class="example">(elem1,...,elemn) = `(subexp1)(...)(subexpn)` | |
| 3091 | -</pre></td></tr></table> | |
| 3092 | - | |
| 3093 | -<p>さあ、このシンタックスを使えば、前出のゴールに辿り着ける。 | |
| 3094 | -</p> | |
| 3095 | -<table><tr><td> </td><td><pre class="example">(keyword,normal,type) = | |
| 3096 | - `(\<(?:class|interface))([[:blank:]]+)([$[:alnum:]]+)` | |
| 3097 | -</pre></td></tr></table> | |
| 3098 | - | |
| 3099 | -<p>このようにすれば、<code>class</code>(あるいは<code>interface</code>)はキーワードとしてハイライトされ、間を分けるブランクの文字は<code>normal</code>としてフォーマットされ、そして、クラス名は<code>type</code>としてフォーマットされる。 | |
| 3100 | -</p> | |
| 3101 | -<p>エレメントの名前の数は、正規表現中の部分表現の数と等しくなければならない。 | |
| 3102 | -さらに、少なくとも現在のバージョンでは、その正規表現の中にはマークされた部分表現だけしか入れられず(部分表現の外には文字が無い)、部分表現をネストすることもできない。 | |
| 3103 | -</p> | |
| 3104 | -<p>従って次のような記述は正しくない。 | |
| 3105 | -</p> | |
| 3106 | -<table><tr><td> </td><td><pre class="example">(keyword,symbol) = `(...)(...)(...)` # number of elements doesn't match | |
| 3107 | -(keyword,symbol) = `(...(...)...)(...)` # contains nested subexpressions | |
| 3108 | -(keyword,symbol) = `...(...)...(...)` # outside characters | |
| 3109 | -</pre></td></tr></table> | |
| 3110 | - | |
| 3111 | -<p>このメカニズムでは、ある状況において、正規表現をもっとコンパクトに、そして恐らくもっと読み易いやり方で表記することを許している。 | |
| 3112 | -たとえば、次に示すようなChangeLogの各部をハイライトする場合を考える(オプショナルな<code>*</code>はシンボルとして、オプショナルなファイル名とカッコ内に記述されたエレメントは<code>file</code>エレメントとして、そして残りの部分は<code>normal</code>でハイライトする)。 | |
| 3113 | -</p> | |
| 3114 | -<table><tr><td> </td><td><pre class="example"> * src/Makefile.am (source_highlight_SOURCES): correctly include | |
| 3115 | - changelog_scanner.ll | |
| 3116 | - | |
| 3117 | - * this is a comment without a file name | |
| 3118 | -</pre></td></tr></table> | |
| 3119 | - | |
| 3120 | -<p>バージョン2.6以前は、次の二つの言語定義を使っていた。 | |
| 3121 | -</p> | |
| 3122 | -<table><tr><td> </td><td><pre class="example">state symbol start '^(?:[[:blank:]]+)\*[[:blank:]]+' begin | |
| 3123 | - state file start '[^:]+\:' begin | |
| 3124 | - normal start '.' | |
| 3125 | - end | |
| 3126 | -end | |
| 3127 | - | |
| 3128 | -state normal start '^(?:[[:blank:]]+)' begin | |
| 3129 | - state file start '[^:]+\:' begin | |
| 3130 | - normal start '.' | |
| 3131 | - end | |
| 3132 | -end | |
| 3133 | -</pre></td></tr></table> | |
| 3134 | - | |
| 3135 | -<p>これを書いてしまった後に読むのは大変だ。 | |
| 3136 | -さて今は、もっと簡単に書くことができる(‘<tt>changelog.lang</tt>’を見よ)。 | |
| 3137 | -</p> | |
| 3138 | -<table><tr><td> </td><td><pre class="example">(normal,symbol,normal,file)= | |
| 3139 | - `(^[[:blank:]]+)(\*)([[:blank:]]+)((?:[^:]+\:)?)` | |
| 3140 | -(normal,file)= `(^[[:blank:]]+)((?:[^:]+\:)?)` | |
| 3141 | -</pre></td></tr></table> | |
| 3142 | - | |
| 3143 | -<p>名前の付きの明示的な部分表現を使った言語エレメントの定義は複数のエレメントからできていて、それゆえ複数のフォーマットスタイルから成っているので、environmentを開始するのに使うことはできない(デフォルトのエレメントは何なのだろう?)。 | |
| 3144 | -一方、上で見たように、stateを開始するのには使うことができる。 | |
| 3145 | -</p> | |
| 3146 | -<hr size="6"> | |
| 3147 | -<a name="g_t_518d_5b9a_7fa9_3068_7f6e_63db"></a> | |
| 3148 | -<a name="SEC48"></a> | |
| 3149 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 3150 | -<tr><td valign="middle" align="left">[<a href="#SEC47" title="Previous section in reading order"> < </a>]</td> | |
| 3151 | -<td valign="middle" align="left">[<a href="#SEC49" title="Next section in reading order"> > </a>]</td> | |
| 3152 | -<td valign="middle" align="left"> </td> | |
| 3153 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 3154 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 3155 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 3156 | -<td valign="middle" align="left"> </td> | |
| 3157 | -<td valign="middle" align="left"> </td> | |
| 3158 | -<td valign="middle" align="left"> </td> | |
| 3159 | -<td valign="middle" align="left"> </td> | |
| 3160 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 3161 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 3162 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 3163 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 3164 | -</tr></table> | |
| 3165 | -<h2 class="section"> 7.11 再定義と置換 </h2> | |
| 3166 | - | |
| 3167 | -<p>この二つの機能は、既存の言語定義にいくらかの変更加えて再利用することによって言語を定義したい場合に便利だ。 | |
| 3168 | -通常だと、他の言語定義ファイルを<code>include</code>して、いくつかの要素について再定義と置き換えを行なう。 | |
| 3169 | -</p> | |
| 3170 | -<a name="IDX80"></a> | |
| 3171 | -<p><code>redef</code>を使うと、その言語エレメントの元の定義を新しい定義で消してしまう。 | |
| 3172 | -その新しい言語定義は、まさにその定義の位置に配置される。 | |
| 3173 | -たとえば、<code>caml</code>言語の定義を再利用することで<code>sml</code>言語を定義するようなときにこの機能を使う。 | |
| 3174 | -この二つの言語はキーワードだけが違う<a name="DOCF29" href="#FOOT29">(29)</a>。 | |
| 3175 | -事実、‘<tt>sml.lang</tt>’の中身は次のように要約できる。 | |
| 3176 | -</p> | |
| 3177 | -<table><tr><td> </td><td><pre class="example">include "caml.lang" | |
| 3178 | - | |
| 3179 | -redef keyword = "abstraction|abstype|and|andalso..." | |
| 3180 | - | |
| 3181 | -redef type = "int|byte|boolean|char|long|float|double|short|void" | |
| 3182 | -</pre></td></tr></table> | |
| 3183 | - | |
| 3184 | -<p>この新しい言語エレメントの定義は、再定義されたちょうどその位置に現われるので、そのような正規表現は、それよりも前のもの(インクルードされるファイルにあるもの)がマッチしなかったときだけマッチするということを意味している。 | |
| 3185 | -これによって、望まない結果が生じるケースもある(<code>sml</code>のケースは違うけれども)。 | |
| 3186 | -言い換えてみよう。次のコードを見てほしい。 | |
| 3187 | -</p> | |
| 3188 | -<table><tr><td> </td><td><pre class="example">keyword = "foo" | |
| 3189 | -keyword = "bar" | |
| 3190 | -type = "int" | |
| 3191 | -redef keyword = "myfoo" | |
| 3192 | -</pre></td></tr></table> | |
| 3193 | - | |
| 3194 | -<p>このコードはさらに次のコードと等価である。 | |
| 3195 | -</p> | |
| 3196 | -<table><tr><td> </td><td><pre class="example">type = "int" | |
| 3197 | -keyword = "myfoo" | |
| 3198 | -</pre></td></tr></table> | |
| 3199 | - | |
| 3200 | -<a name="IDX81"></a> | |
| 3201 | -<p>これが必要なものではないのなら、<code>subst</code>を使うことができる。 | |
| 3202 | -これは<code>redef</code>と似ているが、言語エレメントの前の最初の定義を、その最初の定義のちょうどその位置で置き換えてしまうということが異なる(他の可能な限りの定義は単に消去される)。 | |
| 3203 | -次のコードを見てほしい。 | |
| 3204 | -</p> | |
| 3205 | -<table><tr><td> </td><td><pre class="example">keyword = "foo" | |
| 3206 | -keyword = "bar" | |
| 3207 | -type = "int" | |
| 3208 | -subst keyword = "myfoo" | |
| 3209 | -</pre></td></tr></table> | |
| 3210 | - | |
| 3211 | -<p>これはすなわち、さらに次のコードと等価である。 | |
| 3212 | -</p> | |
| 3213 | -<table><tr><td> </td><td><pre class="example">keyword = "myfoo" | |
| 3214 | -type = "int" | |
| 3215 | -</pre></td></tr></table> | |
| 3216 | - | |
| 3217 | -<p>要求にぴったりと合うのがどちらなのかを決めるのはあなた次第だ。 | |
| 3218 | -この機能で、<code>java</code>を元にして<code>javascript</code>を定義してもよい。 | |
| 3219 | -</p> | |
| 3220 | -<table><tr><td> </td><td><pre class="example">include "java.lang" | |
| 3221 | - | |
| 3222 | -subst keyword = "abstract|break|case|catch|class|if..." | |
| 3223 | -</pre></td></tr></table> | |
| 3224 | - | |
| 3225 | -<p>ここで、<code>redef</code>は、<code>if (exp)</code>が関数呼び出しとしてハイライトされてしまうという望まない振舞いをしてしまう。 | |
| 3226 | -これはfunctionエレメントの定義が<code>if</code>をキーワードとして再定義するものより先に来て(そして先にマッチして)しまうからだ。 | |
| 3227 | -もう一つ別の例を挙げると、C/C++の言語定義を再利用したC#の言語定義である(<a href="#SEC56">C/C++とC#のハイライティング</a>)。 | |
| 3228 | -</p> | |
| 3229 | -<hr size="6"> | |
| 3230 | -<a name="source_002dhighlight_306e_4ed5_7d44_307f"></a> | |
| 3231 | -<a name="SEC49"></a> | |
| 3232 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 3233 | -<tr><td valign="middle" align="left">[<a href="#SEC48" title="Previous section in reading order"> < </a>]</td> | |
| 3234 | -<td valign="middle" align="left">[<a href="#SEC50" title="Next section in reading order"> > </a>]</td> | |
| 3235 | -<td valign="middle" align="left"> </td> | |
| 3236 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 3237 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 3238 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 3239 | -<td valign="middle" align="left"> </td> | |
| 3240 | -<td valign="middle" align="left"> </td> | |
| 3241 | -<td valign="middle" align="left"> </td> | |
| 3242 | -<td valign="middle" align="left"> </td> | |
| 3243 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 3244 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 3245 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 3246 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 3247 | -</tr></table> | |
| 3248 | -<h2 class="section"> 7.12 source-highlightの仕組み </h2> | |
| 3249 | - | |
| 3250 | -<p><a href="#SEC37">言語の定義</a>の冒頭で少し書いたように、source-highlightは言語の定義ファイルにある定義を使って、入力ファイルのトークンをハイライトするのに使う正規表現を内部的にオンザフライに生成する。 | |
| 3251 | -ここで、言語定義ファイルを正しく書く方法を理解するのに重要となる内部の詳細について述べる<a name="DOCF30" href="#FOOT30">(30)</a>。 | |
| 3252 | -</p> | |
| 3253 | -<p>まず、各エレメントの定義ごとに、source-highlightがハイライトのためのルールを作る(同じ言語エレメントに該当するものでもそのようにする)。 | |
| 3254 | -従って、各言語エレメントのファイルはハイライトのためのルールのリストに対応する。 | |
| 3255 | -source-highlightは、入力ファイルの各行について、その行全体を(もっと正しく言うと、その行のまだハイライトされていない部分を)これらのルール全てに対してマッチしてみる。 | |
| 3256 | -ハイライトのためのルールが一つマッチしたらすぐに止めるわけではない。 | |
| 3257 | -「ベター」にマッチする別のルールがあるかもしれないからだ。 | |
| 3258 | -ここで、全てというのは基本的に<em>ベターマッチ</em>という意味に帰着する。 | |
| 3259 | -</p> | |
| 3260 | -<a name="IDX82"></a> | |
| 3261 | -<p>source-highlightが使う戦略は、次の状態の最初にマッチしたルールを選択するということだ。 | |
| 3262 | -</p> | |
| 3263 | -<ul class="toc"> | |
| 3264 | -<li> | |
| 3265 | -空のプリフィックス(あるいは空白の文字、すなわちスペースやタブだけを含むプリフィックス)を伴う | |
| 3266 | - | |
| 3267 | -</li><li> | |
| 3268 | -最小のプリフィックスを伴う | |
| 1235 | +<h2 class="chapter">4 Simple Usage</h2> | |
| 1236 | + | |
| 1237 | +<p><a name="index-sample-67"></a> | |
| 1238 | +Here are some realistic examples of running | |
| 1239 | +<samp><span class="command">source-highlight</span></samp><a rel="footnote" href="#fn-10" name="fnd-10"><sup>10</sup></a>. | |
| 1240 | + | |
| 1241 | + <p>Source-highlight only does a lexical analysis of the source code, so the | |
| 1242 | +program source is assumed to be correct! | |
| 1243 | + | |
| 1244 | + <p>Here's how to run source-highlight (for this example we will use | |
| 1245 | +C/C++ input files, but this is valid also for other source-highlight | |
| 1246 | +input languages): | |
| 1247 | + | |
| 1248 | +<pre class="example"> source-highlight --src-lang cpp --out-format html \ | |
| 1249 | + --input <var><C++ file></var> \ | |
| 1250 | + --output <var><html file></var> \ | |
| 1251 | + --style-file <var><style file></var> \ | |
| 1252 | + <var>options</var> | |
| 1253 | +</pre> | |
| 1254 | + <p>For input files, apart from the <code>-i (--input)</code> option and the | |
| 1255 | +standard input redirection, you can simply specify some files at the | |
| 1256 | +command line and also use regular expressions (for instance | |
| 1257 | +<samp><span class="file">*.java</span></samp>). In this case the name for the output files will be | |
| 1258 | +formed using the name of the source file with a .<ext> appended, where | |
| 1259 | +<ext> is the extension chosen according to the output format specified | |
| 1260 | +(in this example it would be .html). The style file | |
| 1261 | +(<a href="#Output-format-style">Output format style</a>) | |
| 1262 | +contains information on how to format specific language parts | |
| 1263 | +(e.g., keywords in blue and boldface, etc.). | |
| 1264 | + | |
| 1265 | + <p>IMPORTANT: you must choose one of the above two invocation modes: either | |
| 1266 | +you use <code>-i (--input)</code>, <code>-o (--output)</code> (possibly replacing | |
| 1267 | +them with standard input/output redirection), or you specify one or many | |
| 1268 | +files without <code>-i (--input)</code>; if you try to mix them you'll get an | |
| 1269 | +error: | |
| 1270 | + | |
| 1271 | +<pre class="example"> source-highlight -o main.html main.cpp | |
| 1272 | + Please, use one of the two syntaxes for invocation: | |
| 1273 | + source-highlight [OPTIONS]... -i input_file -o output_file | |
| 1274 | + source-highlight [OPTIONS]... [FILES]... | |
| 1275 | +</pre> | |
| 1276 | + <p>If <code>STDOUT</code> string is passed as <code>-o (--output)</code> option, then | |
| 1277 | +the output is forced to the standard output anyway. | |
| 1278 | + | |
| 1279 | + <p>If <code>-s (--src-lang)</code> is not specified, the source language is | |
| 1280 | +inferred by the extension of the input file or from the file name itself | |
| 1281 | +(possibly using also lower case versions); this, of course, does not | |
| 1282 | +work with standard input redirection. For further details, see <a href="#How-the-input-language-is-discovered">How the input language is discovered</a>. | |
| 1283 | + | |
| 1284 | + <p>If <code>-f (--out-format)</code> is not specified, the output will be | |
| 1285 | +produced in HTML. | |
| 1286 | + | |
| 1287 | + <p>If <code>--style-file</code> is not specified, the <samp><span class="file">default.style</span></samp>, which | |
| 1288 | +is included in the distribution, will be used (see <a href="#Output-format-style">Output format style</a> | |
| 1289 | +for further information). | |
| 1290 | + | |
| 1291 | +<ul class="menu"> | |
| 1292 | +<li><a accesskey="1" href="#HTML-and-XHTML-output">HTML and XHTML output</a> | |
| 1293 | +<li><a accesskey="2" href="#LaTeX-output">LaTeX output</a> | |
| 1294 | +<li><a accesskey="3" href="#Texinfo-output">Texinfo output</a> | |
| 1295 | +<li><a accesskey="4" href="#DocBook-output">DocBook output</a> | |
| 1296 | +<li><a accesskey="5" href="#ANSI-color-escape-sequences">ANSI color escape sequences</a> | |
| 1297 | +</ul> | |
| 3269 | 1298 | |
| 3270 | -</li></ul> | |
| 1299 | +<div class="node"> | |
| 1300 | +<a name="HTML-and-XHTML-output"></a> | |
| 1301 | +<p><hr> | |
| 1302 | +Next: <a rel="next" accesskey="n" href="#LaTeX-output">LaTeX output</a>, | |
| 1303 | +Previous: <a rel="previous" accesskey="p" href="#Simple-Usage">Simple Usage</a>, | |
| 1304 | +Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | |
| 1305 | + | |
| 1306 | +</div> | |
| 1307 | + | |
| 1308 | +<h3 class="section">4.1 HTML and XHTML output</h3> | |
| 1309 | + | |
| 1310 | +<p><a name="index-HTML-68"></a><a name="index-XHTML-69"></a> | |
| 1311 | +The default output format for HTML and XHTML uses fixed width fonts by | |
| 1312 | +inserting all the formatted output between <code><tt></code> and <code></tt></code>. | |
| 1313 | +Thus, for instance, specification for fixed width and not fixed width | |
| 1314 | +(see <a href="#Output-format-style">Output format style</a>) will have no effect: every character | |
| 1315 | +will have fixed width. If you don't like this default behavior and | |
| 1316 | +would like to have not fixed fonts by default (as it happens, e.g., with | |
| 1317 | +LaTeX output) you can use the file <samp><span class="file">html_notfixed.outlang</span></samp> with | |
| 1318 | +the command line argument <code>--outlang-def</code>. For XHTML output, the | |
| 1319 | +corresponding file is <samp><span class="file">xhtml_notfixed.outlang</span></samp> | |
| 1320 | + | |
| 1321 | + <p>Furthermore, the file <samp><span class="file">htmltable.outlang</span></samp> can be used to generate | |
| 1322 | +HTML output enclosed in an HTML table (which will use also a background | |
| 1323 | +color if specified in the style file). The file | |
| 1324 | +<samp><span class="file">xhtmltable.outlang</span></samp> does the same but for XHTML output. | |
| 1325 | + | |
| 1326 | +<div class="node"> | |
| 1327 | +<a name="LaTeX-output"></a> | |
| 1328 | +<p><hr> | |
| 1329 | +Next: <a rel="next" accesskey="n" href="#Texinfo-output">Texinfo output</a>, | |
| 1330 | +Previous: <a rel="previous" accesskey="p" href="#HTML-and-XHTML-output">HTML and XHTML output</a>, | |
| 1331 | +Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | |
| 1332 | + | |
| 1333 | +</div> | |
| 1334 | + | |
| 1335 | +<h3 class="section">4.2 LaTeX output</h3> | |
| 1336 | + | |
| 1337 | +<p><a name="index-g_t_0040LaTeX_007b_007d-70"></a> | |
| 1338 | +When using LaTeX output format you can choose between monochromatic | |
| 1339 | +output (by using <code>-f latex</code>) or colored output (by using <code>-f | |
| 1340 | +latexcolor</code>). When using colored output, you need the | |
| 1341 | +<code>color</code> package (again this should be present in your system). | |
| 1342 | +Of course, you are free to define your own LaTeX output format, | |
| 1343 | +see <a href="#Output-Language-Definitions">Output Language Definitions</a>. | |
| 1344 | + | |
| 1345 | +<div class="node"> | |
| 1346 | +<a name="Texinfo-output"></a> | |
| 1347 | +<p><hr> | |
| 1348 | +Next: <a rel="next" accesskey="n" href="#DocBook-output">DocBook output</a>, | |
| 1349 | +Previous: <a rel="previous" accesskey="p" href="#LaTeX-output">LaTeX output</a>, | |
| 1350 | +Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | |
| 1351 | + | |
| 1352 | +</div> | |
| 1353 | + | |
| 1354 | +<h3 class="section">4.3 Texinfo output</h3> | |
| 1355 | + | |
| 1356 | +<p><a name="index-Texinfo-71"></a> | |
| 1357 | +When using the Texinfo output format, you may want to use a dedicated | |
| 1358 | +style file, <samp><span class="file">texinfo.style</span></samp>, which comes with the source-highlight | |
| 1359 | +distribution, with the option <code>--style-file</code>. For instance, the | |
| 1360 | +example in <a href="#Examples">Examples</a> is formatted with this style file. | |
| 1361 | + | |
| 1362 | +<div class="node"> | |
| 1363 | +<a name="DocBook-output"></a> | |
| 1364 | +<p><hr> | |
| 1365 | +Next: <a rel="next" accesskey="n" href="#ANSI-color-escape-sequences">ANSI color escape sequences</a>, | |
| 1366 | +Previous: <a rel="previous" accesskey="p" href="#Texinfo-output">Texinfo output</a>, | |
| 1367 | +Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | |
| 1368 | + | |
| 1369 | +</div> | |
| 1370 | + | |
| 1371 | +<h3 class="section">4.4 DocBook output</h3> | |
| 1372 | + | |
| 1373 | +<p><a name="index-DocBook-72"></a> | |
| 1374 | +DocBook output is generated using the <code><programlisting></code> tag. If | |
| 1375 | +the <code>--doc</code> command line option is given, an <code><article></code> | |
| 1376 | +document is generated. | |
| 1377 | + | |
| 1378 | +<div class="node"> | |
| 1379 | +<a name="ANSI-color-escape-sequences"></a> | |
| 1380 | +<p><hr> | |
| 1381 | +Previous: <a rel="previous" accesskey="p" href="#DocBook-output">DocBook output</a>, | |
| 1382 | +Up: <a rel="up" accesskey="u" href="#Simple-Usage">Simple Usage</a> | |
| 1383 | + | |
| 1384 | +</div> | |
| 1385 | + | |
| 1386 | +<h3 class="section">4.5 ANSI color escape sequences</h3> | |
| 1387 | + | |
| 1388 | +<p><a name="index-ANSI-color-73"></a> | |
| 1389 | +If you're using this output format, for instance together with | |
| 1390 | +<code>less</code> (see <a href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>), you may | |
| 1391 | +want to use the <samp><span class="file">esc.style</span></samp>, which comes with the source-highlight | |
| 1392 | +distribution, with the option <code>--style-file</code>. This should | |
| 1393 | +result in a more pleasant coloring output. | |
| 1394 | + | |
| 1395 | +<div class="node"> | |
| 1396 | +<a name="Configuration-files"></a> | |
| 1397 | +<p><hr> | |
| 1398 | +Next: <a rel="next" accesskey="n" href="#Invoking-source_002dhighlight">Invoking source-highlight</a>, | |
| 1399 | +Previous: <a rel="previous" accesskey="p" href="#Simple-Usage">Simple Usage</a>, | |
| 1400 | +Up: <a rel="up" accesskey="u" href="#Top">Top</a> | |
| 1401 | + | |
| 1402 | +</div> | |
| 1403 | + | |
| 1404 | +<h2 class="chapter">5 Configuration files</h2> | |
| 1405 | + | |
| 1406 | +<p><a name="index-configuration-files-74"></a> | |
| 1407 | +During execution, source-highlight needs some files where it finds | |
| 1408 | +directives on how to recognize the source language (if not specified | |
| 1409 | +explicitly with <code>--src-lang</code> or <code>--lang-def</code>), on which output | |
| 1410 | +format to use (if not specified explicitly with <code>--out-format</code> or | |
| 1411 | +<code>--outlang-def</code>), on how to format specific source elements (e.g., | |
| 1412 | +keywords, comments, etc.), and source and output language definitions. | |
| 1413 | +These files will be explained in the next sections. | |
| 1414 | + | |
| 1415 | + <p><a name="index-g_t_0040code_007b_002d_002ddata_002ddir_007d-75"></a>If the directory for such files is not explicitly specified with the | |
| 1416 | +command line option <code>--data-dir</code>, these files are searched for in | |
| 1417 | +the following order: | |
| 1418 | + | |
| 1419 | + <ul> | |
| 1420 | +<li>the current directory; | |
| 1421 | +<li>the installation directory for conf files, see <a href="#Installation">Installation</a> | |
| 1422 | +(please keep in mind that this directory is hard-coded into | |
| 1423 | +source-highlight during compilation). | |
| 1424 | +<li>if the source-highlight command is specified with an | |
| 1425 | +explicit path name, the installation directory name is | |
| 1426 | +still used, but relative to the explicit path name. | |
| 1427 | +</ul> | |
| 1428 | + | |
| 1429 | + <p>In particular, the user can set the value also with the environment | |
| 1430 | +variable | |
| 1431 | +<a name="index-g_t_0040code_007bSOURCE_005fHIGHLIGHT_005fDATADIR_007d-76"></a><code>SOURCE_HIGHLIGHT_DATADIR</code> (see also <a href="#The-program-source_002dhighlight_002dsettings">The program source-highlight-settings</a>). | |
| 1432 | + | |
| 1433 | + <p>If you want to be sure about which file is used during the | |
| 1434 | +execution, you can use the command line option <code>--verbose</code>. | |
| 1435 | + | |
| 1436 | +<ul class="menu"> | |
| 1437 | +<li><a accesskey="1" href="#Output-format-style">Output format style</a> | |
| 1438 | +<li><a accesskey="2" href="#Output-format-style-using-CSS">Output format style using CSS</a> | |
| 1439 | +<li><a accesskey="3" href="#Default-Styles">Default Styles</a> | |
| 1440 | +<li><a accesskey="4" href="#Language-map">Language map</a> | |
| 1441 | +<li><a accesskey="5" href="#Language-definition-files">Language definition files</a> | |
| 1442 | +<li><a accesskey="6" href="#Output-Language-map">Output Language map</a> | |
| 1443 | +<li><a accesskey="7" href="#Output-Language-definition-files">Output Language definition files</a> | |
| 1444 | +<li><a accesskey="8" href="#Developing-your-own-definition-files">Developing your own definition files</a> | |
| 1445 | +</ul> | |
| 1446 | + | |
| 1447 | +<div class="node"> | |
| 1448 | +<a name="Output-format-style"></a> | |
| 1449 | +<p><hr> | |
| 1450 | +Next: <a rel="next" accesskey="n" href="#Output-format-style-using-CSS">Output format style using CSS</a>, | |
| 1451 | +Previous: <a rel="previous" accesskey="p" href="#Configuration-files">Configuration files</a>, | |
| 1452 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1453 | + | |
| 1454 | +</div> | |
| 1455 | + | |
| 1456 | +<h3 class="section">5.1 Output format style</h3> | |
| 1457 | + | |
| 1458 | +<p><a name="index-output-style-77"></a><a name="index-default_002estyle-78"></a> | |
| 1459 | +You must specify your options for syntax highlighting in the file | |
| 1460 | +<samp><span class="file">default.style</span></samp><a rel="footnote" href="#fn-11" name="fnd-11"><sup>11</sup></a>. | |
| 1461 | +You can specify formatting options for each element defined | |
| 1462 | +by a language definition file (you can get the list of such elements, | |
| 1463 | +<a name="index-g_t_0040code_007b_002d_002dshow_002dlang_002delements_007d-79"></a>by using <code>--show-lang-elements</code>, see <a href="#Listing-Language-Elements">Listing Language Elements</a>). | |
| 1464 | + | |
| 1465 | + <p><a name="index-g_t_0040code_007bbgcolor_007d-80"></a><a name="index-background-color-81"></a>Since version 2.6, you can also specify the background color for the | |
| 1466 | +output document, using the keyword <code>bgcolor</code> (this might be visible | |
| 1467 | +only when the <code>--doc</code> command line option is used). | |
| 1468 | + | |
| 1469 | + <p>If many elements share the same formatting options, you can specify | |
| 1470 | +these elements in the same line, separated by a comma<a rel="footnote" href="#fn-12" name="fnd-12"><sup>12</sup></a>. | |
| 1471 | + | |
| 1472 | + <p>Here's the <samp><span class="file">default.style</span></samp> that comes with this distribution (this | |
| 1473 | +is formatted by using the <samp><span class="file">style.lang</span></samp> that is shown in | |
| 1474 | +<a href="#Tutorials-on-Language-Definitions">Tutorials on Language Definitions</a>): | |
| 1475 | + | |
| 1476 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 1477 | +<pre class="example"> <b>bgcolor</b> <tt>"white"</tt>; <i>// the background color for documents</i> | |
| 1478 | + <i>context</i> <b>gray</b>; <i>// the color for context lines (when specified with line ranges)</i> | |
| 1479 | + | |
| 1480 | + <i>keyword</i> <b>blue</b> <b>b</b> ; <i>// for language keywords</i> | |
| 1481 | + <i>type</i> <b>darkgreen</b> ; <i>// for basic types</i> | |
| 1482 | + <i>usertype</i> <b>teal</b> ; <i>// for user defined types</i> | |
| 1483 | + <i>string</i> <b>red</b> <b>f</b> ; <i>// for strings and chars</i> | |
| 1484 | + <i>regexp</i> <b>orange</b> <b>f</b> ; <i>// for strings and chars</i> | |
| 1485 | + <i>specialchar</i> <b>pink</b> <b>f</b> ; <i>// for special chars, e.g., \n, \t, \\</i> | |
| 1486 | + <i>comment</i> <b>brown</b> <b>i</b>, <b>noref</b>; <i>// for comments</i> | |
| 1487 | + <i>number</i> <b>purple</b> ; <i>// for literal numbers</i> | |
| 1488 | + <i>preproc</i> <b>darkblue</b> <b>b</b> ; <i>// for preproc directives (e.g. #include, import)</i> | |
| 1489 | + <i>symbol</i> <b>darkred</b> ; <i>// for simbols (e.g. <, >, +)</i> | |
| 1490 | + <i>function</i> <b>black</b> <b>b</b>; <i>// for function calls and declarations</i> | |
| 1491 | + <i>cbracket</i> <b>red</b>; <i>// for block brackets (e.g. {, })</i> | |
| 1492 | + <i>todo</i> <b>bg:cyan</b> <b>b</b>; <i>// for TODO and FIXME</i> | |
| 1493 | + <i>code</i> <b>bg:brightgreen</b> <b>b</b>; <i>// for code snippets</i> | |
| 1494 | + | |
| 1495 | + <i>//Predefined variables and functions (for instance glsl)</i> | |
| 1496 | + <i>predef_var</i> <b>darkblue</b> ; | |
| 1497 | + <i>predef_func</i> <b>darkblue</b> <b>b</b> ; | |
| 1498 | + | |
| 1499 | + <i>// for OOP</i> | |
| 1500 | + <i>classname</i> <b>teal</b> ; <i>// for class names, e.g., in Java and C++</i> | |
| 1501 | + | |
| 1502 | + <i>// line numbers</i> | |
| 1503 | + <b>linenum</b> <b>black</b> <b>f</b>; | |
| 1504 | + | |
| 1505 | + <i>// Internet related</i> | |
| 1506 | + <i>url</i> <b>blue</b> <b>u</b>, <b>f</b>; | |
| 1507 | + | |
| 1508 | + <i>// other elements for ChangeLog and Log files</i> | |
| 1509 | + <i>date</i> <b>blue</b> <b>b</b> ; | |
| 1510 | + <i>time</i>, <i>file</i> <b>darkblue</b> <b>b</b> ; | |
| 1511 | + <i>ip</i>, <i>name</i> <b>darkgreen</b> ; | |
| 1512 | + | |
| 1513 | + <i>// for Prolog, Perl...</i> | |
| 1514 | + <i>variable</i> <b>darkgreen</b> ; | |
| 1515 | + | |
| 1516 | + <i>// explicit for Latex</i> | |
| 1517 | + <i>italics</i> <b>darkgreen</b> <b>i</b>; | |
| 1518 | + <i>bold</i> <b>darkgreen</b> <b>b</b>; | |
| 1519 | + <i>underline</i> <b>darkgreen</b> <b>u</b>; | |
| 1520 | + <i>fixed</i> <b>green</b> <b>f</b>; | |
| 1521 | + <i>argument</i> <b>darkgreen</b>; | |
| 1522 | + <i>optionalargument</i> <b>purple</b>; | |
| 1523 | + <i>math</i> <b>orange</b>; | |
| 1524 | + <i>bibtex</i> <b>blue</b>; | |
| 1525 | + | |
| 1526 | + <i>// for diffs</i> | |
| 1527 | + <i>oldfile</i> <b>orange</b>; | |
| 1528 | + <i>newfile</i> <b>darkgreen</b>; | |
| 1529 | + <i>difflines</i> <b>blue</b>; | |
| 1530 | + | |
| 1531 | + <i>// for css</i> | |
| 1532 | + <i>selector</i> <b>purple</b>; | |
| 1533 | + <i>property</i> <b>blue</b>; | |
| 1534 | + <i>value</i> <b>darkgreen</b> <b>i</b>; | |
| 1535 | + | |
| 1536 | + <i>// for oz</i> | |
| 1537 | + <i>atom</i> <b>orange</b>; | |
| 1538 | + <i>meta</i> <b>i</b>; | |
| 1539 | + | |
| 1540 | + <i>// for file system</i> | |
| 1541 | + <i>path</i> <b>orange</b>; | |
| 1542 | + | |
| 1543 | + <i>// for C (or other language) labels</i> | |
| 1544 | + <i>label</i> <b>teal</b> <b>b</b>; | |
| 1545 | + | |
| 1546 | + <i>// for errors</i> | |
| 1547 | + <i>error</i> <b>purple</b>; | |
| 1548 | + <i>warning</i> <b>darkgreen</b>; | |
| 1549 | +</pre> | |
| 1550 | + <p>This file tries to define a style for most elements defined in the | |
| 1551 | +language definition files that comes with Source-highlight | |
| 1552 | +distribution. | |
| 1553 | + | |
| 1554 | + <p><a name="index-g_t_0040code_007b_002d_002dstyle_002dfile_007d-82"></a>You can specify your own file (it doesn't have to be named | |
| 1555 | +<samp><span class="file">default.style</span></samp>) with the command line option | |
| 1556 | +<code>--style-file</code><a rel="footnote" href="#fn-13" name="fnd-13"><sup>13</sup></a>, see | |
| 1557 | +<a href="#Invoking-source_002dhighlight">Invoking source-highlight</a>. | |
| 1558 | + | |
| 1559 | + <p>You can also specify the color of normal text by adding this line | |
| 1560 | + | |
| 1561 | +<pre class="example"> normal darkblue ; | |
| 1562 | +</pre> | |
| 1563 | + <p><a name="index-color-83"></a><a name="index-background-color-84"></a>As you might see the syntax of this file is quite straightforward: after | |
| 1564 | +the element (or elements, separated by commas) you can specify the | |
| 1565 | +color, and the background color<a rel="footnote" href="#fn-14" name="fnd-14"><sup>14</sup></a> by using | |
| 1566 | +the prefix <code>bg:</code> (for instance, in the <samp><span class="file">default.style</span></samp> above | |
| 1567 | +the background color is specified for the <code>todo</code> element). | |
| 1568 | + | |
| 1569 | + <p>Note that the background color might not be available for all output | |
| 1570 | +formats: it is available for XHTML and LaTeX but not for | |
| 1571 | +HTML<a rel="footnote" href="#fn-15" name="fnd-15"><sup>15</sup></a>. | |
| 1572 | + | |
| 1573 | + <p><a name="index-bold-85"></a><a name="index-italics-86"></a><a name="index-underline-87"></a><a name="index-fixed-88"></a><a name="index-notfixed-89"></a>Then, you can specify further formatting options such as bold, italics, | |
| 1574 | +etc.; these are the keywords that can be used: | |
| 1575 | + | |
| 1576 | +<pre class="example"> b = bold | |
| 1577 | + i = italics | |
| 1578 | + u = underline | |
| 1579 | + f = fixed | |
| 1580 | + nf = not fixed | |
| 1581 | + noref = no reference information is generated for these elements | |
| 1582 | +</pre> | |
| 1583 | + <p><a name="index-color-90"></a>Since version 2.2, the color specification is not required. For | |
| 1584 | +instance, the <samp><span class="file">texinfo.style</span></samp> is as follows (we avoid colors for | |
| 1585 | +Texinfo outputs): | |
| 1586 | + | |
| 1587 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 1588 | +<pre class="example"> <i>keyword</i>, <i>type</i> <b>b</b> ; | |
| 1589 | + <i>variable</i> <b>f</b>, <b>i</b> ; | |
| 1590 | + <i>string</i> <b>f</b> ; | |
| 1591 | + <i>regexp</i> <b>f</b> ; | |
| 1592 | + <i>comment</i> <b>nf</b>, <b>i</b>, <b>noref</b> ; | |
| 1593 | + <i>preproc</i> <b>b</b> ; | |
| 1594 | + | |
| 1595 | + <i>// line numbers</i> | |
| 1596 | + <b>linenum</b> <b>f</b>; | |
| 1597 | + | |
| 1598 | + <i>// Internet related</i> | |
| 1599 | + <i>url</i> <b>f</b>; | |
| 1600 | + | |
| 1601 | + <i>// for diffs</i> | |
| 1602 | + <i>oldfile</i>, <i>newfile</i> <b>i</b>; | |
| 1603 | + <i>difflines</i> <b>b</b>; | |
| 1604 | + | |
| 1605 | + <i>// for css</i> | |
| 1606 | + <i>selector</i>, <i>property</i> <b>b</b>; | |
| 1607 | + <i>value</i> <b>i</b>; | |
| 1608 | +</pre> | |
| 1609 | + <p>You may also specify more than on of these options separated by commas, | |
| 1610 | +e.g. | |
| 1611 | + | |
| 1612 | +<pre class="example"> keyword blue u, b ; | |
| 1613 | +</pre> | |
| 1614 | + <p class="noindent">Please keep in mind that in this case the order of these specified | |
| 1615 | +options is kept during the generation of the output; for instance, | |
| 1616 | +depending on the specific output format, the sequences <code>u, b</code> and | |
| 1617 | +<code>b, u</code> may lead to different results. In particular, the style | |
| 1618 | +that comes first is used after the ones that follow. For instance, in | |
| 1619 | +the case of HTML, the sequence <code>u, b</code> will lead to the following | |
| 1620 | +formatting: <code><u><b>...</b></u></code>. | |
| 1621 | + | |
| 1622 | + <p><a name="index-noref-91"></a>The <code>noref</code> option specifies that for this element reference | |
| 1623 | +information are not generated (see <a href="#Generating-References">Generating References</a>). For | |
| 1624 | +instance, this is used for the <code>comment</code> element, since we do not | |
| 1625 | +want that elements in a comment are searched for cross-references. | |
| 1626 | + | |
| 1627 | + <p>These are all possible color logical names handled by | |
| 1628 | +source-highlight<a rel="footnote" href="#fn-16" name="fnd-16"><sup>16</sup></a>: | |
| 1629 | + | |
| 1630 | +<pre class="example"> black | |
| 1631 | + red | |
| 1632 | + darkred | |
| 1633 | + brown | |
| 1634 | + yellow | |
| 1635 | + cyan | |
| 1636 | + blue | |
| 1637 | + pink | |
| 1638 | + purple | |
| 1639 | + orange | |
| 1640 | + brightorange | |
| 1641 | + green | |
| 1642 | + brightgreen | |
| 1643 | + darkgreen | |
| 1644 | + teal | |
| 1645 | + gray | |
| 1646 | + darkblue | |
| 1647 | + white | |
| 1648 | +</pre> | |
| 1649 | + <p><a name="index-direct-color-scheme-92"></a>You can also use the direct color scheme for the specific output format, | |
| 1650 | +by using double quotes, such as, e.g., <code>"#00FF00"</code> in | |
| 1651 | +HTML<a rel="footnote" href="#fn-17" name="fnd-17"><sup>17</sup></a> or even string colors in double quotes<a rel="footnote" href="#fn-18" name="fnd-18"><sup>18</sup></a>, such as <code>"lightblue"</code>. Of course, the double quotes will be | |
| 1652 | +discarded during the generation. | |
| 1653 | + | |
| 1654 | + <p>For instance, this is the <samp><span class="file">syslog.style</span></samp> used in the <samp><span class="file">tests</span></samp> | |
| 1655 | +directory. This uses direct color schemes. | |
| 1656 | + | |
| 1657 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 1658 | +<pre class="example"> <i>date</i>, <i>keyword</i> <b>yellow</b> <b>b</b> ; | |
| 1659 | + <i>time</i> <tt>"#9999FF"</tt> ; | |
| 1660 | + <i>ip</i> <tt>"lightblue"</tt> <b>b</b> ; | |
| 1661 | + | |
| 1662 | + <i>type</i> <b>cyan</b> <b>b</b> ; | |
| 1663 | + <i>string</i> <tt>"brown"</tt> <b>b</b> ; | |
| 1664 | + <i>comment</i> <b>teal</b> ; | |
| 1665 | + <i>number</i> <b>red</b> ; | |
| 1666 | + <i>preproc</i> <b>cyan</b> ; | |
| 1667 | + <i>symbol</i> <b>green</b> ; | |
| 1668 | + <i>function</i> <tt>"#CC66CC"</tt> <b>b</b> ; | |
| 1669 | + <i>cbracket</i> <b>green</b> <b>b</b> ; | |
| 1670 | + <i>twonumbers</i> <b>green</b> <b>b</b> ; | |
| 1671 | + <i>port</i> <b>green</b> <b>b</b> ; | |
| 1672 | + <i>webmethod</i> <b>teal</b> ; | |
| 1673 | + | |
| 1674 | + <i>// foo option</i> | |
| 1675 | + <i>foo</i> <b>red</b> <b>b</b> ; <i>// foo entry</i> | |
| 1676 | + | |
| 1677 | + | |
| 1678 | +</pre> | |
| 1679 | + <p>Note that, if you use direct color schemes, source-highlight will | |
| 1680 | +perform no transformation, and will output exactly the color scheme you | |
| 1681 | +specified. For instance, the specification <code>"brown"</code> is different | |
| 1682 | +from <code>brown</code>: the former will be output as it is, while the latter | |
| 1683 | +will be translated in the corresponding color of the output format (for | |
| 1684 | +HTML the visible result is likely to be the same). | |
| 1685 | + | |
| 1686 | + <p>It is up to you to specify a color scheme string that is handled by the | |
| 1687 | +specific output format. Thus, direct color schemes might not be | |
| 1688 | +portable in different output formats; for instance, <code>"#00FF00"</code> is | |
| 1689 | +valid in HTML but not in LaTeX. | |
| 1690 | + | |
| 1691 | +<div class="node"> | |
| 1692 | +<a name="Output-format-style-using-CSS"></a> | |
| 1693 | +<p><hr> | |
| 1694 | +Next: <a rel="next" accesskey="n" href="#Default-Styles">Default Styles</a>, | |
| 1695 | +Previous: <a rel="previous" accesskey="p" href="#Output-format-style">Output format style</a>, | |
| 1696 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1697 | + | |
| 1698 | +</div> | |
| 1699 | + | |
| 1700 | +<h3 class="section">5.2 Output format style using CSS</h3> | |
| 1701 | + | |
| 1702 | +<p><a name="index-CSS-93"></a>Since version 2.6 you can specify the output format style also using | |
| 1703 | +a limited CSS syntax. Please, note that this has nothing to do | |
| 1704 | +with output produced by source-highlight using the <code>--css</code> option. | |
| 1705 | + | |
| 1706 | + <p><a name="index-g_t_0040code_007b_002d_002dstyle_002dcss_002dfile_007d-94"></a>By using a CSS file as the style file (i.e., passing it to the | |
| 1707 | +<code>--style-css-file</code> command line option) you will only specify the | |
| 1708 | +output format style using the same syntax of CSS. This means that you | |
| 1709 | +can use a css syntax for specifying the output format style | |
| 1710 | +independently from the actual output (this is what the output format | |
| 1711 | +style is for). Thus, you can use a css file as the output format style | |
| 1712 | +also for LaTeX output (just like you would do with a source-highlight | |
| 1713 | +output format style, <a href="#Output-format-style">Output format style</a>). | |
| 1714 | + | |
| 1715 | + <p>This feature is provided basically for code re-use: you can specify the | |
| 1716 | +output format style using a css file, and then re-use the same css file | |
| 1717 | +as the actual style sheet of other HTML pages (or even output files | |
| 1718 | +produced by source-highlight using the <code>--css</code> option). | |
| 1719 | + | |
| 1720 | + <p>Note that this feature is quite primordial, so only a limited subset | |
| 1721 | +of CSS syntax is recognized. In particular, selectors are always | |
| 1722 | +intended as CSS class selectors, so they must start with a dot. | |
| 1723 | +<code>/* */</code> comments are handled. Properties (and their values) not | |
| 1724 | +handled by source-highlight are simply (and silently) discarded). | |
| 1725 | + | |
| 1726 | + <p>This is an example of CSS specification handled correctly by | |
| 1727 | +source-highlight as a style format specification: | |
| 1728 | + | |
| 1729 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 1730 | +<pre class="example"> body { | |
| 1731 | + <b>background-color:</b> <<i>color</i> <i>specification</i>>; | |
| 1732 | + } | |
| 1733 | + | |
| 1734 | + <b>.selector</b> { | |
| 1735 | + <b>color:</b> <<i>color</i> <i>specification</i>>; | |
| 1736 | + <b>background-color:</b> <<i>color</i> <i>specification</i>>; | |
| 1737 | + <b>font-weight:</b> <i>bold</i>; <i>/* this is a comment */</i> | |
| 1738 | + <b>font-family:</b> <i>monospace</i>; | |
| 1739 | + <b>font-style:</b> <i>italic</i>; | |
| 1740 | + <b>text-decoration:</b> <i>underline</i>; | |
| 1741 | + } | |
| 1742 | +</pre> | |
| 1743 | + <p>Finally, this is the <samp><span class="file">default.css</span></samp> that corresponds to | |
| 1744 | +<samp><span class="file">default.style</span></samp> presented in <a href="#Output-format-style">Output format style</a>: | |
| 1745 | + | |
| 1746 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 1747 | +<pre class="example"> body { <b>background-color:</b> <i>white</i>; } | |
| 1748 | + | |
| 1749 | + <i>/* the color for context lines (when specified with line ranges) */</i> | |
| 1750 | + <b>.context</b> { <b>color:</b> <i>gray</i>; } | |
| 1751 | + | |
| 1752 | + <b>.keyword</b> { <b>color:</b> <i>blue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1753 | + <b>.type</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1754 | + <b>.usertype</b>, <b>.classname</b> { <b>color:</b> <i>teal</i>; } | |
| 1755 | + <b>.string</b> { <b>color:</b> <i>red</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1756 | + <b>.regexp</b> { <b>color:</b> <i>orange</i>; } | |
| 1757 | + <b>.specialchar</b> { <b>color:</b> <i>pink</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1758 | + <b>.comment</b> { <b>color:</b> <i>brown</i>; <b>font-style:</b> <i>italic</i>; } | |
| 1759 | + <b>.number</b> { <b>color:</b> <i>purple</i>; } | |
| 1760 | + <b>.preproc</b> { <b>color:</b> <i>darkblue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1761 | + <b>.symbol</b> { <b>color:</b> <i>darkred</i>; } | |
| 1762 | + <b>.function</b> { <b>color:</b> <i>black</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1763 | + <b>.cbracket</b> { <b>color:</b> <i>red</i>; } | |
| 1764 | + <b>.todo</b> { <b>font-weight:</b> <i>bold</i>; <b>background-color:</b> <i>cyan</i>; } | |
| 1765 | + | |
| 1766 | + <i>/* line numbers */</i> | |
| 1767 | + <b>.linenum</b> { <b>color:</b> <i>black</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1768 | + | |
| 1769 | + <i>/* Internet related */</i> | |
| 1770 | + <b>.url</b> { <b>color:</b> <i>blue</i>; <b>text-decoration:</b> <i>underline</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1771 | + | |
| 1772 | + <i>/* other elements for ChangeLog and Log files */</i> | |
| 1773 | + <b>.date</b> { <b>color:</b> <i>blue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1774 | + <b>.time</b>, <b>.file</b> { <b>color:</b> <i>darkblue</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1775 | + <b>.ip</b>, <b>.name</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1776 | + | |
| 1777 | + <i>/* for Prolog, Perl */</i> | |
| 1778 | + <b>.variable</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1779 | + <b>.italics</b> { <b>color:</b> <i>darkgreen</i>; <b>font-style:</b> <i>italic</i>; } | |
| 1780 | + <b>.bold</b> { <b>color:</b> <i>darkgreen</i>; <b>font-weight:</b> <i>bold</i>; } | |
| 1781 | + | |
| 1782 | + <i>/* for LaTeX */</i> | |
| 1783 | + <b>.underline</b> { <b>color:</b> <i>darkgreen</i>; <b>text-decoration:</b> <i>underline</i>; } | |
| 1784 | + <b>.fixed</b> { <b>color:</b> <i>green</i>; <b>font-family:</b> <i>monospace</i>; } | |
| 1785 | + <b>.argument</b>, <b>.optionalargument</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1786 | + <b>.math</b> { <b>color:</b> <i>orange</i>; } | |
| 1787 | + <b>.bibtex</b> { <b>color:</b> <i>blue</i>; } | |
| 1788 | + | |
| 1789 | + <i>/* for diffs */</i> | |
| 1790 | + <b>.oldfile</b> { <b>color:</b> <i>orange</i>; } | |
| 1791 | + <b>.newfile</b> { <b>color:</b> <i>darkgreen</i>; } | |
| 1792 | + <b>.difflines</b> { <b>color:</b> <i>blue</i>; } | |
| 1793 | + | |
| 1794 | + <i>/* for css */</i> | |
| 1795 | + <b>.selector</b> { <b>color:</b> <i>purple</i>; } | |
| 1796 | + <b>.property</b> { <b>color:</b> <i>blue</i>; } | |
| 1797 | + <b>.value</b> { <b>color:</b> <i>darkgreen</i>; <b>font-style:</b> <i>italic</i>; } | |
| 1798 | + | |
| 1799 | + <i>/* for Oz */</i> | |
| 1800 | + <b>.atom</b> { <b>color:</b> <i>orange</i>; } | |
| 1801 | + <b>.meta</b> { <b>font-style:</b> <i>italic</i>; } | |
| 1802 | + | |
| 1803 | +</pre> | |
| 1804 | + <p>If you pass this file to the <code>--style-css-file</code> command line option | |
| 1805 | +and you produce an output file, you will get the same result of using | |
| 1806 | +<samp><span class="file">default.style</span></samp>. | |
| 1807 | + | |
| 1808 | + <p>Source-highlight comes with a lot of CSS files that can be used either | |
| 1809 | +as standard CSS files for HTML documents, or as style files to pass to | |
| 1810 | +<code>--style-css-file</code>. In the documentation installation directory | |
| 1811 | +(see <a href="#Installation">Installation</a>) you will find the file | |
| 1812 | +<samp><span class="file">style_examples.html</span></samp> which shows many output examples, each one | |
| 1813 | +with a different CSS style. | |
| 1814 | + | |
| 1815 | +<div class="node"> | |
| 1816 | +<a name="Default-Styles"></a> | |
| 1817 | +<p><hr> | |
| 1818 | +Next: <a rel="next" accesskey="n" href="#Language-map">Language map</a>, | |
| 1819 | +Previous: <a rel="previous" accesskey="p" href="#Output-format-style-using-CSS">Output format style using CSS</a>, | |
| 1820 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1821 | + | |
| 1822 | +</div> | |
| 1823 | + | |
| 1824 | +<h3 class="section">5.3 Default Styles</h3> | |
| 1825 | + | |
| 1826 | +<p>This file<a rel="footnote" href="#fn-19" name="fnd-19"><sup>19</sup></a> (the default file is | |
| 1827 | +<samp><span class="file">style.defaults</span></samp>) lists the default style for a language element | |
| 1828 | +whose output style is not specified in the style file; in particular the | |
| 1829 | +following line (comment lines start with <code>#</code>): | |
| 1830 | + | |
| 1831 | +<pre class="example"> elem1 = elem2 | |
| 1832 | +</pre> | |
| 1833 | + <p class="noindent">tells that, if the style for an element, say elem1, is not specified in | |
| 1834 | +the style file, then elem1 will have the same style of elem2. | |
| 1835 | + | |
| 1836 | + <p><a name="index-style_002edefaults-95"></a>For instance, this is the <samp><span class="file">style.defaults</span></samp> that comes with | |
| 1837 | +Source-highlight: | |
| 1838 | + | |
| 1839 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 1840 | +<pre class="example"> # defaults for styles | |
| 1841 | + # the format is: | |
| 1842 | + # elem1 = elem2 | |
| 1843 | + # meaning that if the style for elem1 is not specified, | |
| 1844 | + # then it will have the same style as elem2 | |
| 1845 | + | |
| 1846 | + classname = normal | |
| 1847 | + usertype = normal | |
| 1848 | + preproc = keyword | |
| 1849 | + section = function | |
| 1850 | + paren = cbracket | |
| 1851 | + attribute = type | |
| 1852 | + value = string | |
| 1853 | + predef_var = type | |
| 1854 | + predef_func = function | |
| 1855 | + atom = regexp | |
| 1856 | + meta = function | |
| 1857 | + path = regexp | |
| 1858 | + label = preproc | |
| 1859 | + error = string | |
| 1860 | + warning = type | |
| 1861 | + code = preproc | |
| 1862 | +</pre> | |
| 1863 | + <p class="noindent">In this case the style for the element <code>preproc</code> will default to | |
| 1864 | +the style of the element <code>keyword</code>. | |
| 1865 | + | |
| 1866 | + <p>This file is useful when you want to create your own style file and you | |
| 1867 | +don't want to specify styles for all the elements that will have the | |
| 1868 | +same output style in your style (e.g., the default style formats | |
| 1869 | +<code>preproc</code> elements differently from keywords, but if in your style | |
| 1870 | +you don't specify a style for it, a <code>preproc</code> element will still be | |
| 1871 | +formatted as a <code>keyword</code>). | |
| 1872 | + | |
| 1873 | +<div class="node"> | |
| 1874 | +<a name="Language-map"></a> | |
| 1875 | +<p><hr> | |
| 1876 | +Next: <a rel="next" accesskey="n" href="#Language-definition-files">Language definition files</a>, | |
| 1877 | +Previous: <a rel="previous" accesskey="p" href="#Default-Styles">Default Styles</a>, | |
| 1878 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1879 | + | |
| 1880 | +</div> | |
| 1881 | + | |
| 1882 | +<h3 class="section">5.4 Language map</h3> | |
| 1883 | + | |
| 1884 | +<p><a name="index-language-map-96"></a> | |
| 1885 | +This configuration file associates a file extension to a specific | |
| 1886 | +language definition file. You can also use such file extension to | |
| 1887 | +specify the <code>--src-lang</code> option (see <a href="#Simple-Usage">Simple Usage</a>). | |
| 1888 | +Source-highlight comes with such a file, called <samp><span class="file">lang.map</span></samp>. | |
| 1889 | + | |
| 1890 | + <p>Of course, you can override the settings of this file by writing your | |
| 1891 | +own language map file and specify such file with the command line option | |
| 1892 | +<code>--lang-map</code>). Moreover, as explained above, if a file | |
| 1893 | +<samp><span class="file">lang.map</span></samp> is present in the current directory, such version will | |
| 1894 | +be used. The format of such file is quite simple (comment lines start | |
| 1895 | +with <code>#</code>): | |
| 1896 | + | |
| 1897 | +<pre class="example"> extension = language definition file | |
| 1898 | +</pre> | |
| 1899 | + <p>The default language definition file is shown in <a href="#Introduction">Introduction</a>. | |
| 1900 | + | |
| 1901 | +<div class="node"> | |
| 1902 | +<a name="Language-definition-files"></a> | |
| 1903 | +<p><hr> | |
| 1904 | +Next: <a rel="next" accesskey="n" href="#Output-Language-map">Output Language map</a>, | |
| 1905 | +Previous: <a rel="previous" accesskey="p" href="#Language-map">Language map</a>, | |
| 1906 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1907 | + | |
| 1908 | +</div> | |
| 1909 | + | |
| 1910 | +<h3 class="section">5.5 Language definition files</h3> | |
| 1911 | + | |
| 1912 | +<p>These files are crucial for source-highlight since they specify the | |
| 1913 | +source elements that have to be highlighted. These files also allow to | |
| 1914 | +specify your own language definitions in order to deal with a language | |
| 1915 | +that is not handled by source-highlight<a rel="footnote" href="#fn-20" name="fnd-20"><sup>20</sup></a>. The syntax for these files is explained in <a href="#Language-Definitions">Language Definitions</a>. | |
| 1916 | + | |
| 1917 | +<div class="node"> | |
| 1918 | +<a name="Output-Language-map"></a> | |
| 1919 | +<p><hr> | |
| 1920 | +Next: <a rel="next" accesskey="n" href="#Output-Language-definition-files">Output Language definition files</a>, | |
| 1921 | +Previous: <a rel="previous" accesskey="p" href="#Language-definition-files">Language definition files</a>, | |
| 1922 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1923 | + | |
| 1924 | +</div> | |
| 1925 | + | |
| 1926 | +<h3 class="section">5.6 Output Language map</h3> | |
| 1927 | + | |
| 1928 | +<p><a name="index-output-language-map-97"></a> | |
| 1929 | +This configuration file associates an output format to a specific output | |
| 1930 | +language definition file. You can use the name of that output format to | |
| 1931 | +specify the <code>--out-format</code> option (see <a href="#Simple-Usage">Simple Usage</a>). | |
| 1932 | +Source-highlight comes with such a file, called <samp><span class="file">outlang.map</span></samp>. | |
| 1933 | + | |
| 1934 | + <p>Of course, you can override the settings of this file by | |
| 1935 | +writing your own output language map file and specify such file | |
| 1936 | +with the command line option <code>--outlang-map</code>). | |
| 1937 | +Moreover, as explained above, if a file <samp><span class="file">outlang.map</span></samp> | |
| 1938 | +is present in the current directory, such version will be used. | |
| 1939 | +The format of such file is quite simple: | |
| 1940 | + | |
| 1941 | +<pre class="example"> output format name = language definition file | |
| 1942 | +</pre> | |
| 1943 | + <p>The default language definition file is shown in <a href="#Introduction">Introduction</a>. | |
| 1944 | + | |
| 1945 | + <p>In particular, there is a convention for the output format name in the | |
| 1946 | +output language map: the one with <code>-css</code> suffix is the one used | |
| 1947 | +when <code>--css</code> command line option is given | |
| 3271 | 1948 | |
| 3272 | -<a name="IDX83"></a> | |
| 3273 | -<p>ここでマッチしたルールにおける<em>プリフィックス</em>というのは、検査済みの文字列の、マッチしなかった部分である<a name="DOCF31" href="#FOOT31">(31)</a>。 | |
| 3274 | -従って、たとえば、次の文字列に対して<code>=</code>という簡単な正規表現をマッチさせてみる。 | |
| 3275 | -</p> | |
| 3276 | -<table><tr><td> </td><td><pre class="example">i = 10; | |
| 3277 | -</pre></td></tr></table> | |
| 3278 | - | |
| 3279 | -<a name="IDX84"></a> | |
| 3280 | -<p>このとき、プリフィックスはスペースを含んだ<code>i </code>となる。 | |
| 3281 | -正規表現の用語に従えば、残りのマッチしなかった部分、すなわち<code> 10;</code>は<em>サフィックス</em>という。 | |
| 3282 | -source-highlightが、上で述べた戦略でマッチするルールを見つけると、マッチされた部分をフォーマットし(プリフィックスは<code>normal</code>でフォーマットし)、サフィックスの部分からマッチするルールの探索を再開する。 | |
| 3283 | -そしてこれがその行全体を処理するまで続く。 | |
| 3284 | -</p> | |
| 3285 | -<p>例を用いて、もう少し詳しくこの戦略を説明したい。 | |
| 3286 | -次に示す言語定義ファイルを考えてみよう。 | |
| 3287 | -</p> | |
| 3288 | -<table><tr><td> </td><td><pre class="example"><span class="roman"><i># an example for explaining the strategy of source-highlight</i></span> | |
| 3289 | -<tt><i>type</i></tt> = <tt>"int"</tt> | |
| 3290 | -<tt><i>keyword</i></tt> = <tt>"null"</tt> | |
| 3291 | -<tt><i>symbol</i></tt> = <tt>"="</tt> | |
| 3292 | -</pre></td></tr></table> | |
| 3293 | -<p>そして、次の行をハイライトさせる。 | |
| 3294 | -</p> | |
| 3295 | -<table><tr><td> </td><td><pre class="example">int i = null | |
| 3296 | -</pre></td></tr></table> | |
| 3297 | - | |
| 3298 | -<p>source-highlightは以下のステップを実行する。 | |
| 3299 | -</p> | |
| 3300 | -<ol> | |
| 3301 | -<li> | |
| 3302 | -最初のマッチするルールは<code>type</code>のためのものだ。 | |
| 3303 | -空のプリフィックスなのでこれ以上見る必要はない。 | |
| 3304 | -<code>int</code>は<code>type</code>としてハイライトされる。 | |
| 3305 | -処理すべき残りの部分は<code> i = null</code>となっている。 | |
| 3306 | - | |
| 3307 | -</li><li> | |
| 3308 | -最初にマッチするルールは<code>keyword</code>に対するものだ。 | |
| 3309 | -プリフィックスは<code> i = </code>である。 | |
| 3310 | -このプリフィックスは空でない(あるいはスペースだけを含むわけではない)ので他のルールを検査する。 | |
| 3311 | - | |
| 3312 | -</li><li> | |
| 3313 | -次にマッチするルールは<code>symbol</code>に対するものだ。 | |
| 3314 | -プリフィックスは<code> i </code>である。 | |
| 3315 | -このプリフィックスは<code>keyword</code>のときよりも小さい。 | |
| 3316 | -他にもうマッチするルールはないので、<code>symbol</code>に対するものがベターだ。 | |
| 3317 | -<code>=</code>がsymbolとしてハイライトされる。 | |
| 3318 | -処理すべき残りの部分は<code> null</code>となっている。 | |
| 3319 | - | |
| 3320 | -</li><li> | |
| 3321 | -最初にマッチするルールは<code>keyword</code>に対するものだ。 | |
| 3322 | -プリフィックスは空白だけなので、これ以上見る必要はない。 | |
| 3323 | -<code>null</code>が<code>keyword</code>としてハイライトされる。 | |
| 3324 | - | |
| 3325 | -</li></ol> | |
| 3326 | - | |
| 3327 | -<p>以下の言語定義を示してこのセクションを終える。 | |
| 3328 | -この言語定義は、ハイライトの戦略について述べたことをまとめたものだ。 | |
| 3329 | -</p> | |
| 3330 | -<table><tr><td> </td><td><pre class="example"><tt><i>keyword</i></tt> = <tt>"if|class"</tt> | |
| 3331 | - | |
| 3332 | -<tt><i>type</i></tt> = <tt>'int'</tt> | |
| 3333 | - | |
| 3334 | -<tt><i>comment</i></tt> <b>delim</b> <tt>"/*"</tt> <tt>"*/"</tt> | |
| 3335 | - | |
| 3336 | -<span class="roman"><i># thus this won't catch "/* */ /" as a regexp,</i></span> | |
| 3337 | -<span class="roman"><i># since comment elem definition comes first</i></span> | |
| 3338 | -<tt><i>regexp</i></tt> = <tt>'/.*/.*/'</tt> | |
| 3339 | - | |
| 3340 | -<span class="roman"><i># this won't match if ( ) as a function,</i></span> | |
| 3341 | -<span class="roman"><i># since keyword elem definition comes first</i></span> | |
| 3342 | -<tt><i>function</i></tt> = <tt>'([[:alpha:]]|_)[[:word:]]*[[:blank:]]*\(*[[:blank:]]*\)'</tt> | |
| 3343 | - | |
| 3344 | -<span class="roman"><i># the following order is conceptually wrong,</i></span> | |
| 3345 | -<span class="roman"><i># since "//" won't be highlighted as a comment, but as two symbols</i></span> | |
| 3346 | -<tt><i>symbol</i></tt> = <tt>"/"</tt> | |
| 3347 | -<tt><i>comment</i></tt> <b>start</b> <tt>"//"</tt> | |
| 3348 | -</pre></td></tr></table> | |
| 3349 | - | |
| 3350 | -<hr size="6"> | |
| 3351 | -<a name="g_t_6b63_898f_8868_73fe_306b_95a2_3059_308b_6ce8_610f"></a> | |
| 3352 | -<a name="SEC50"></a> | |
| 3353 | -<table cellpadding="1" cellspacing="1" border="0"> | |
| 3354 | -<tr><td valign="middle" align="left">[<a href="#SEC49" title="Previous section in reading order"> < </a>]</td> | |
| 3355 | -<td valign="middle" align="left">[<a href="#SEC51" title="Next section in reading order"> > </a>]</td> | |
| 3356 | -<td valign="middle" align="left"> </td> | |
| 3357 | -<td valign="middle" align="left">[<a href="#SEC37" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
| 3358 | -<td valign="middle" align="left">[<a href="#SEC37" title="Up section"> Up </a>]</td> | |
| 3359 | -<td valign="middle" align="left">[<a href="#SEC59" title="Next chapter"> >> </a>]</td> | |
| 3360 | -<td valign="middle" align="left"> </td> | |
| 3361 | -<td valign="middle" align="left"> </td> | |
| 3362 | -<td valign="middle" align="left"> </td> | |
| 3363 | -<td valign="middle" align="left"> </td> | |
| 3364 | -<td valign="middle" align="left">[<a href="#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
| 3365 | -<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
| 3366 | -<td valign="middle" align="left">[<a href="#SEC79" title="Index">Index</a>]</td> | |
| 3367 | -<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td> | |
| 3368 | -</tr></table> | |
| 3369 | -<h2 class="section"> 7.13 正規表現に関する注意 </h2> | |
| 3370 | - | |
| 3371 | -<p>Boostのシンタックスを知るのにはBoostのドキュメンテーション(<a href="http://www.boost.org/libs/regex/doc/syntax.html">http://www.boost.org/libs/regex/doc/syntax.html</a>)を見るわけですが、ここで、あまり知られていないかもしれないが言語の定義に非常に便利な正規表現の形式についていくらか説明をしようと思う。 | |
| 3372 | -</p> | |
| 3373 | -<a name="IDX85"></a> | |
| 3374 | -<p>カッコを使って正規表現の一部をグループ化する必要はあるが、マークされた部分表現を余分に吐き出させたくないようなときは、通常、<em>マークしないカッコ</em><code>(?:expression)</code>を使うことができる。 | |
| 3375 | -これは、言語定義のシンタックスには必要ではない。 | |
| 3376 | -たとえ普通のカッコを使ったとしても、source-highlightはマークしないカッコへそれを変形してしまう。 | |
| 3377 | -</p> | |
| 3378 | -<a name="IDX86"></a> | |
| 3379 | -<p>source-highlightは、<em>マークされた部分表現</em>、すなわち<code>(</code>と<code>)</code>に括られたものを、マークしない部分表現(つまり上で説明したもの)に変換する。 | |
| 3380 | -バージョン2.7から、<code>`</code>の内側に正規表現を書いた場合には、そのマークされた部分表現はそのまま残される(<a href="#SEC38">正規表現の指定方法</a>も参照してほしい)。 | |
| 3381 | -これは、<em>後方参照</em>や<em>条件</em>のときに便利だ。 | |
| 3382 | -</p> | |
| 3383 | -<a name="IDX87"></a> | |
| 3384 | -<p>エスケープ文字の後ろに1から9の範囲の数字nが付いたものは<em>後方参照</em>で、n番目の部分表現にマッチしたのと同じ文字列にマッチするものだ。 | |
| 3385 | -たとえば、<code>^(a*).*\1$</code>という表記は、<code>aaabbaaa</code>という文字列にはマッチするが、<code>aaabba</code>にはマッチしない。 | |
| 3386 | -後方参照は、Perlの置換指示子のような場合に、コンパクトな言語エレメントを書くのに役立つ。 | |
| 3387 | -なので、次のような場合を考える。 | |
| 3388 | -</p> | |
| 3389 | -<table><tr><td> </td><td><pre class="example">regexp = `s([^[:alnum:][:blank:]]).*\1.*\1[ixsmogce]*` | |
| 3390 | -</pre></td></tr></table> | |
| 3391 | - | |
| 3392 | -<p>これは次の形式の全てにマッチする。 | |
| 3393 | -</p> | |
| 3394 | -<table><tr><td> </td><td><pre class="example">s/foo/bar/g | |
| 3395 | -s|foo|bar|g | |
| 3396 | -s#foo#bar#g | |
| 3397 | -s@foo@bar@g | |
| 3398 | -</pre></td></tr></table> | |
| 3399 | - | |
| 3400 | -<a name="IDX88"></a> | |
| 3401 | -<p>正規表現の形式で便利なのが、<em>前方先読み表明(Forward Lookahead Asserts)</em>だ。 | |
| 3402 | -これには二つの形式があって、一つは肯定的先読み表明そしてもう一つが否定的先読み表明である。 | |
| 3403 | -</p> | |
| 3404 | -<dl compact="compact"> | |
| 3405 | -<dt> <code>(?=abc)</code> </dt> | |
| 3406 | -<dd><p>“abc”という表現が後に続く場合にだけゼロ文字にマッチする。(訳注:ゼロ文字にマッチするというのは、要するに、この表現自体何らかの個別の文字にマッチしたり文字を捕捉したりすることはなく、ゼロの幅であるということです) | |
| 3407 | -</p></dd> | |
| 3408 | -<dt> <code>(?!abc)</code> </dt> | |
| 3409 | -<dd><p>“abc”という表現が後に続かない場合にだけゼロ文字にマッチする。 | |
| 3410 | -</p></dd> | |
| 1949 | +<div class="node"> | |
| 1950 | +<a name="Output-Language-definition-files"></a> | |
| 1951 | +<p><hr> | |
| 1952 | +Next: <a rel="next" accesskey="n" href="#Developing-your-own-definition-files">Developing your own definition files</a>, | |
| 1953 | +Previous: <a rel="previous" accesskey="p" href="#Output-Language-map">Output Language map</a>, | |
| 1954 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1955 | + | |
| 1956 | +</div> | |
| 1957 | + | |
| 1958 | +<h3 class="section">5.7 Output Language definition files</h3> | |
| 1959 | + | |
| 1960 | +<p>These files are crucial for source-highlight since they specify how the | |
| 1961 | +source elements are highlighted. These files also allow to specify | |
| 1962 | +your own output format definitions in order to deal with an output | |
| 1963 | +format that is not handled by source-highlight<a rel="footnote" href="#fn-21" name="fnd-21"><sup>21</sup></a>. The syntax for these files is explained in <a href="#Output-Language-Definitions">Output Language Definitions</a>. | |
| 1964 | + | |
| 1965 | + <p>These files are part of source-highlight distribution, but they can | |
| 1966 | +also be downloaded, independently, from here: | |
| 1967 | + | |
| 1968 | + <p><a href="http://www.gnu.org/software/src-highlite/outlang_files/">http://www.gnu.org/software/src-highlite/outlang_files/</a> | |
| 1969 | + | |
| 1970 | +<div class="node"> | |
| 1971 | +<a name="Developing-your-own-definition-files"></a> | |
| 1972 | +<p><hr> | |
| 1973 | +Previous: <a rel="previous" accesskey="p" href="#Output-Language-definition-files">Output Language definition files</a>, | |
| 1974 | +Up: <a rel="up" accesskey="u" href="#Configuration-files">Configuration files</a> | |
| 1975 | + | |
| 1976 | +</div> | |
| 1977 | + | |
| 1978 | +<h3 class="section">5.8 Developing your own definition files</h3> | |
| 1979 | + | |
| 1980 | +<p>I encourage those who write new language definitions or correct/modify | |
| 1981 | +existing language definitions to send them to me so that they can be | |
| 1982 | +added to the source-highlight distribution! | |
| 1983 | + | |
| 1984 | + <p>Since these files require more explanations (that, however, are not | |
| 1985 | +necessary to the standard usage of source-highlight), they are carefully | |
| 1986 | +explained in separate parts: <a href="#Language-Definitions">Language Definitions</a> and <a href="#Output-Language-Definitions">Output Language Definitions</a>. | |
| 1987 | + | |
| 1988 | + <p>These files are part of source-highlight distribution, but they can | |
| 1989 | +also be downloaded, independently, from here: | |
| 1990 | + | |
| 1991 | + <p><a href="http://www.gnu.org/software/src-highlite/lang_files/">http://www.gnu.org/software/src-highlite/lang_files/</a> | |
| 1992 | + | |
| 1993 | +<div class="node"> | |
| 1994 | +<a name="Invoking-source-highlight"></a> | |
| 1995 | +<a name="Invoking-source_002dhighlight"></a> | |
| 1996 | +<p><hr> | |
| 1997 | +Next: <a rel="next" accesskey="n" href="#Language-Definitions">Language Definitions</a>, | |
| 1998 | +Previous: <a rel="previous" accesskey="p" href="#Configuration-files">Configuration files</a>, | |
| 1999 | +Up: <a rel="up" accesskey="u" href="#Top">Top</a> | |
| 2000 | + | |
| 2001 | +</div> | |
| 2002 | + | |
| 2003 | +<h2 class="chapter">6 Invoking <samp><span class="command">source-highlight</span></samp></h2> | |
| 2004 | + | |
| 2005 | +<p><a name="index-invoking-98"></a><a name="index-version-99"></a><a name="index-options-100"></a><a name="index-usage-101"></a><a name="index-help-102"></a><a name="index-getting-help-103"></a> | |
| 2006 | +The format for running the <samp><span class="command">source-highlight</span></samp> program is: | |
| 2007 | + | |
| 2008 | +<pre class="example"> source-highlight <var>option</var> ... | |
| 2009 | +</pre> | |
| 2010 | + <p><code>source-highlight</code> supports the following options, shown by | |
| 2011 | +the output of <code>source-highlight --detailed-help</code>: | |
| 2012 | + | |
| 2013 | +<pre class="smallexample"></pre> | |
| 2014 | + <p>Let us explain some options in details (apart from those that should be | |
| 2015 | +clear from the <code>--help</code> output itself, and those already explained | |
| 2016 | +in <a href="#Simple-Usage">Simple Usage</a>). | |
| 2017 | + | |
| 2018 | +<!-- Formatting copied from the Texinfo 4.0 manual. --> | |
| 2019 | + <dl> | |
| 2020 | +<dt><code>--data-dir</code><dd><a name="index-g_t_0040code_007b_002d_002ddata_002ddir_007d-104"></a>Source-highlight, during the execution, will need some files, such as, | |
| 2021 | +e.g., language definition files, output format definition files, etc. | |
| 2022 | +These files are installed in <code>prefix/share/source-highlight</code> where | |
| 2023 | +<code>prefix</code> is chosen at compilation time (see See <a href="#Installation">Installation</a>). | |
| 2024 | +Thus, source-highlight should be able to find all the files it needs | |
| 2025 | +independently. However, if you want to override this setting, e.g., | |
| 2026 | +because you have your own language definition files, or simply because | |
| 2027 | +you installed a possible source-highlight binary in a different | |
| 2028 | +directory from the one used during the compilation, you can use the | |
| 2029 | +command line option <code>--data-dir</code>. | |
| 2030 | + | |
| 2031 | + <br><dt><code>--doc</code><dt><code>-d</code><dd>If you want a stand alone output document (i.e., an output file that is | |
| 2032 | +not thought to be included in another document), specify this option | |
| 2033 | +(otherwise you just get some text that you can paste into another | |
| 2034 | +document). If you choose this option and do not provide a | |
| 2035 | +<code>--title</code>, the your source file name will be used as the title. | |
| 2036 | + | |
| 2037 | + <br><dt><code>--no-doc</code><dd>The <code>--doc</code> option above is actually implied by other command line | |
| 2038 | +options (e.g., <code>--css</code>). If you do not want this (e.g., you want | |
| 2039 | +to include the output in an existing document containing the global | |
| 2040 | +style sheet), you can disable this by using <code>--no-doc</code>. | |
| 2041 | + | |
| 2042 | + <br><dt><code>--css</code><dt><code>-c</code><dd>Specify the style sheet file (e.g., a <samp><span class="file">.css</span></samp> for HTML<a rel="footnote" href="#fn-22" name="fnd-22"><sup>22</sup></a>) for the output document. Note that source-highlight | |
| 2043 | +will not use this file: it will simply use this file name when | |
| 2044 | +generating the output file, so to specify that the output file uses this | |
| 2045 | +file as the style sheet (e.g., if the generated HTML relies on this file | |
| 2046 | +as the CSS file). | |
| 2047 | + | |
| 2048 | + <br><dt><code>--tab</code><dt><code>-t</code><dd>With this options, tab characters will be converted into specified | |
| 2049 | +number of space characters (tabulation points will be preserved). This | |
| 2050 | +option is automatically selected when generating line numbers. | |
| 2051 | + | |
| 2052 | + <br><dt><code>--style-file</code><dt><code>--style-css-file</code><dd>Specify the file that source-highlight will use to produce (i.e., | |
| 2053 | +format) the output (e.g., colors and other styles for each language | |
| 2054 | +element). The formats of these files are detailed in <a href="#Output-format-style">Output format style</a> and in <a href="#Output-format-style-using-CSS">Output format style using CSS</a>, respectively. | |
| 2055 | + | |
| 2056 | + <br><dt><code>--style-defaults</code><dd>Specify the file that contains the default styles for elements | |
| 2057 | +whose styles are not found in the style file (see <a href="#Default-Styles">Default Styles</a> for | |
| 2058 | +further details). | |
| 2059 | + | |
| 2060 | + <br><dt><code>--output-dir</code><dd>You can pass to source-highlight more than one input file (see | |
| 2061 | +<a href="#Simple-Usage">Simple Usage</a>). In this case you cannot specify the output file | |
| 2062 | +name. In such cases the output files will be automatically generated | |
| 2063 | +into the directory where you invoked the command from; if you want the | |
| 2064 | +output files to be generated into a different directory you can use this | |
| 2065 | +option. | |
| 2066 | + | |
| 2067 | + <br><dt><code>--infer-lang</code><dd><a name="index-language-inference-105"></a><a name="index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-106"></a>Force the inference mechanism for detecting the input language. This is | |
| 2068 | +detailed in <a href="#How-the-input-language-is-discovered">How the input language is discovered</a>. | |
| 2069 | + | |
| 2070 | + <br><dt><code>--line-number</code><dd>Line numbers will be generated in the output, using the (optional) | |
| 2071 | +specified padding character<a rel="footnote" href="#fn-23" name="fnd-23"><sup>23</sup></a> (the default padding character is <code>0</code>). | |
| 2072 | + | |
| 2073 | + <br><dt><code>--line-number-ref</code><dd>As <code>--line-number</code>, this option numbers all the output lines, and, | |
| 2074 | +additionally, generates an anchor for each line. The anchor consists of | |
| 2075 | +the specified prefix (default is <code>line</code>) and the line number (e.g., | |
| 2076 | +<code>line25</code>). For instance, as prefix, if you deal with many files, | |
| 2077 | +you can use the file name. Note that some output languages might not | |
| 2078 | +support this feature (e.g., <code>esc</code>, since it makes no sense in such | |
| 2079 | +case). See <a href="#Anchors-and-References">Anchors and References</a> for defining how to generate an | |
| 2080 | +anchor in a specific output language. | |
| 2081 | + | |
| 2082 | + <p><a name="index-line-ranges-107"></a><a name="index-range-context-108"></a><a name="index-range-separator-109"></a><br><dt><code>--line-range</code><dt><code>--range-context</code><dt><code>--range-separator</code><dd>Since version 2.11, you can specify multiple line ranges: only the lines | |
| 2083 | +in the source that are in these ranges will be output. For instance, by | |
| 2084 | +specifying | |
| 2085 | + | |
| 2086 | + <pre class="example"> --line-range="-5","10","20-25","50-" | |
| 2087 | +</pre> | |
| 2088 | + <p>Only the following lines will be output: the first 5 lines, line 10, | |
| 2089 | +lines 20 to 25 and from line 50 to the end of input. (See also the | |
| 2090 | +examples in <a href="#Line-ranges">Line ranges</a>). | |
| 2091 | + | |
| 2092 | + <p>Together with <code>--line-range</code>, you can also specify | |
| 2093 | +<code>--range-context</code>: this is the number of lines that will be printed | |
| 2094 | +before and after the lines of a range (i.e., the surrounding | |
| 2095 | +“context”). These lines will not be highlighted: they will be printed | |
| 2096 | +according to the style <code>context</code>. For instance, extending the | |
| 2097 | +previous example, | |
| 2098 | + | |
| 2099 | + <pre class="example"> --line-range="-5","10","20-25","50-" --range-context=1 | |
| 2100 | +</pre> | |
| 2101 | + <p>Also the following lines will be output: 6, 9, 11, 19, 26, 49. (See | |
| 2102 | +also the examples in <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a>). | |
| 2103 | + | |
| 2104 | + <p>Finally, you can specify a range separator line string with | |
| 2105 | +<code>--range-separator</code> that will be printed between ranges (See also | |
| 2106 | +the examples in <a href="#Line-ranges-_0028with-context_0029">Line ranges (with context)</a>). The separator string | |
| 2107 | +is preformatted automatically, so, e.g., you don't have to escape | |
| 2108 | +special output characters, such as the { } in texinfo output. | |
| 2109 | + | |
| 2110 | + <p><a name="index-regex-ranges-110"></a><br><dt><code>--regex-range</code><dd> | |
| 2111 | +Ranges can be expressed also using regular expressions, with the command | |
| 2112 | +line option <code>--regex-range</code>. In this case the beginning of the | |
| 2113 | +range will be detected by a line containing (in any point) a string | |
| 2114 | +matching the specified regular expression; the end will be detected by a | |
| 2115 | +line containing a string matching the same regular expression that | |
| 2116 | +started the range. This feature is very useful when we want to document | |
| 2117 | +some code (e.g., in this very manual) by showing only specific parts, | |
| 2118 | +that are delimited in a ad-hoc way in the source code (e.g., with | |
| 2119 | +specific comment patterns). You can see some usage examples | |
| 2120 | +in See <a href="#Regex-ranges">Regex ranges</a>. | |
| 2121 | + | |
| 2122 | + <p>The specified strings (this option accepts multiple occurrences) must be | |
| 2123 | +valid regular expressions (thus you must escape special characters | |
| 2124 | +accordingly), otherwise you will get an error. | |
| 2125 | + | |
| 2126 | + <p>Furthermore, <code>--line-range</code> and <code>--regex-range</code> cannot coexist | |
| 2127 | +in the same command line. | |
| 2128 | + | |
| 2129 | + <br><dt><code>--failsafe</code><dd><a name="index-failsafe-111"></a>If no language specification is found, an error will be printed and the | |
| 2130 | +program exits. With this option, instead, in such situations, the input | |
| 2131 | +is simply formatted in the output format. This is useful when | |
| 2132 | +<samp><span class="command">source-highlight</span></samp> is used with many input files, and it is also | |
| 2133 | +used in the <samp><span class="file">src-hilite-lesspipe.sh</span></samp> script. Actually I failed to | |
| 2134 | +find a good reason why one should not always use this option. So my | |
| 2135 | +suggestion is to always use it when you run source-highlight (and | |
| 2136 | +indeed, in the future, this option might become the default one). See | |
| 2137 | +also <a href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>, <a href="#Using-source_002dhighlight-as-a-simple-formatter">Using source-highlight as a simple formatter</a>. | |
| 2138 | + | |
| 2139 | + <p><a name="index-default_002elang-112"></a>When using <code>--failsafe</code>, if no input language can be established, | |
| 2140 | +source-highlight will use the input language definition file | |
| 2141 | +<samp><span class="file">default.lang</span></samp>, which is an empty file. You might want to | |
| 2142 | +customize such file, though. | |
| 2143 | + | |
| 2144 | + <br><dt><code>--debug-lang</code><br><dt><code>--show-regex</code><dd>Allows to debug a language definition file, <a href="#Debugging">Debugging</a>. | |
| 2145 | + | |
| 2146 | + </dl> | |
| 2147 | + | |
| 2148 | + <p>The other command line options dealing with references are explained in | |
| 2149 | +more details in <a href="#Generating-References">Generating References</a>. | |
| 2150 | + | |
| 2151 | +<ul class="menu"> | |
| 2152 | +<li><a accesskey="1" href="#How-the-input-language-is-discovered">How the input language is discovered</a> | |
| 2153 | +</ul> | |
| 2154 | + | |
| 2155 | +<div class="node"> | |
| 2156 | +<a name="How-the-input-language-is-discovered"></a> | |
| 2157 | +<p><hr> | |
| 2158 | +Previous: <a rel="previous" accesskey="p" href="#Invoking-source_002dhighlight">Invoking source-highlight</a>, | |
| 2159 | +Up: <a rel="up" accesskey="u" href="#Invoking-source_002dhighlight">Invoking source-highlight</a> | |
| 2160 | + | |
| 2161 | +</div> | |
| 2162 | + | |
| 2163 | +<h3 class="section">6.1 How the input language is discovered</h3> | |
| 2164 | + | |
| 2165 | +<p>As already explained, <a href="#Simple-Usage">Simple Usage</a>, source-highlight uses a | |
| 2166 | +language definition file according the language specified with the | |
| 2167 | +option <code>--src-lang</code>, or <code>--lang-def</code>, or by using the input | |
| 2168 | +file extension. | |
| 2169 | + | |
| 2170 | + <p>Since version 2.5, source-highlight can use an inference mechanism to | |
| 2171 | +deduce the input language. For the moment, it can detect script | |
| 2172 | +languages based on the “sha-bang” mechanism, i.e., when the first line | |
| 2173 | +of a script contains a line such as, e.g., | |
| 2174 | + | |
| 2175 | +<pre class="example"> #!/bin/sh | |
| 2176 | +</pre> | |
| 2177 | + <p>It detects script languages specified by using the <code>env</code> | |
| 2178 | +program<a rel="footnote" href="#fn-24" name="fnd-24"><sup>24</sup></a>: | |
| 2179 | + | |
| 2180 | +<pre class="example"> #!/usr/bin/env perl | |
| 2181 | +</pre> | |
| 2182 | + <p>It recognizes the Emacs convention, of declaring the Emacs | |
| 2183 | +major mode using the format <code>-*- lang -*-</code>. | |
| 2184 | + | |
| 2185 | + <p>For instance, a script starting as the following one: | |
| 2186 | + | |
| 2187 | +<pre class="example"> #!/bin/bash | |
| 2188 | + # -*- Tcl -*- | |
| 2189 | +</pre> | |
| 2190 | + <p class="noindent">will be interpreted as a Tcl script, and not as bash script. | |
| 2191 | + | |
| 2192 | + <p>Finally, it recognizes <code><?</code> specifications (e.g., | |
| 2193 | +<code><?php</code> and <code><?xml</code>) and <code><!doctype</code> (in that case, | |
| 2194 | +it infers it is an xml file)<a rel="footnote" href="#fn-25" name="fnd-25"><sup>25</sup></a>. | |
| 2195 | + | |
| 2196 | + <p>This inference mechanism is performed, by default, in case the input | |
| 2197 | +language is neither explicitly specified nor found in the language map | |
| 2198 | +file by using the input file extension or the filename itself, possibly | |
| 2199 | +also the lowercase version (the input file may also have no extension at | |
| 2200 | +all, but, for instance, a <samp><span class="file">ChangeLog</span></samp> input file will be | |
| 2201 | +highlighted using <samp><span class="file">changelog.lang</span></samp>). | |
| 2202 | + | |
| 2203 | + <p><a name="index-g_t_0040code_007b_002d_002dinfer_002dlang_007d-113"></a>Furthermore, this mechanism can be given priority with the command line | |
| 2204 | +option <code>--infer-lang</code>. For instance, this is used in the script | |
| 2205 | +<samp><span class="file">src-hilite-lesspipe.sh</span></samp> (<a href="#Using-source_002dhighlight-with-less">Using source-highlight with less</a>) | |
| 2206 | +when running source-highlight, in order to avoid the problem of | |
| 2207 | +formatting a Perl script as a Prolog program (since the extension | |
| 2208 | +<samp><span class="file">.pl</span></samp> is associated to Prolog programs in the language map file, | |
| 2209 | +<a href="#Perl">Perl</a>). | |
| 2210 | + | |
| 2211 | +<div class="node"> | |
| 2212 | +<a name="Language-Definitions"></a> | |
| 2213 | +<p><hr> | |
| 2214 | +Next: <a rel="next" accesskey="n" href="#Output-Language-Definitions">Output Language Definitions</a>, | |
| 2215 | +Previous: <a rel="previous" accesskey="p" href="#Invoking-source_002dhighlight">Invoking source-highlight</a>, | |
| 2216 | +Up: <a rel="up" accesskey="u" href="#Top">Top</a> | |
| 2217 | + | |
| 2218 | +</div> | |
| 2219 | + | |
| 2220 | +<h2 class="chapter">7 Language Definitions</h2> | |
| 2221 | + | |
| 2222 | +<p><a name="index-language-definition-114"></a> | |
| 2223 | +Since version 2.0 source-highlight uses a specific syntax | |
| 2224 | +to specify source language elements (e.g., keywords, strings, | |
| 2225 | +comments, etc.). Before version 2.0, language elements were scanned | |
| 2226 | +through Flex. This had the drawback of writing a new flex file | |
| 2227 | +to deal with a new language; even worse, a new language could | |
| 2228 | +not be added “dynamically”: you had to recompile the whole | |
| 2229 | +source-highlight program. | |
| 2230 | + | |
| 2231 | + <p>Instead, now, language elements are specified in a file, loaded | |
| 2232 | +dynamically, through a (hopefully) simple syntax. Then, these | |
| 2233 | +definitions are used internally to create, on-the-fly, regular | |
| 2234 | +expressions that are used to highlight the elements (see also <a href="#How-source_002dhighlight-works">How source-highlight works</a>). In particular, we use the regular expressions | |
| 2235 | +provided by the Boost library (see <a href="#Installation">Installation</a>). Thus, when | |
| 2236 | +writing a language definition file you will surely have to deal with | |
| 2237 | +regular expressions. Don't be scared: for most of the languages you may | |
| 2238 | +never have to deal with difficult regular expressions, and you can also | |
| 2239 | +specify language keywords (such as, e.g., “if”, “while”, etc., see | |
| 2240 | +<a href="#Simple-definitions">Simple definitions</a>); moreover, for defining delimited language | |
| 2241 | +elements you will not have to write a regular expression, but just the | |
| 2242 | +delimiters (see <a href="#Delimited-definitions">Delimited definitions</a>). However, there might be | |
| 2243 | +some language definitions that may require heavy use of more involved | |
| 2244 | +regular expressions (e.g., Perl, just to mention one). | |
| 2245 | + | |
| 2246 | + <p>Of course, we use the Boost regex library regular expression syntax. We | |
| 2247 | +refer to Boost documentation for such syntax, | |
| 2248 | +<a href="http://www.boost.org/libs/regex/doc/syntax.html">http://www.boost.org/libs/regex/doc/syntax.html</a>, however, in | |
| 2249 | +<a href="#Notes-on-regular-expressions">Notes on regular expressions</a>, we provide some notes on regular | |
| 2250 | +expressions that might be helpful for those who never dealt with them. | |
| 2251 | +By default, Boost regex library uses Perl regular expression syntax, | |
| 2252 | +and, at the moment, this is the only syntax supported by | |
| 2253 | +source-highlight. | |
| 2254 | + | |
| 2255 | + <p>Here, we see such syntax in details, by relying on many examples. This | |
| 2256 | +allows a user to easily modify an existing language definition and | |
| 2257 | +create a new one. These files have, typically, extension <samp><span class="file">.lang</span></samp>. | |
| 2258 | + | |
| 2259 | + <p>Each definition basically associates a regular expression to a language | |
| 2260 | +element and defines a name for the language element. Such name will be | |
| 2261 | +used to associate a particular style (e.g., bold face, color, etc.) when | |
| 2262 | +highlighting such elements. You cannot use names that are the same | |
| 2263 | +of keywords used in the language definition syntax (e.g., <code>start</code>, | |
| 2264 | +as shown later, is a reserved word). | |
| 2265 | + | |
| 2266 | + <p>Comments can be given by using <code>#</code>; the rest of the line is | |
| 2267 | +considered as a comment. | |
| 2268 | + | |
| 2269 | + <p>Source-highlight will scan each line of the input file separately. So a | |
| 2270 | +regular expression that tries to match new line characters is destined | |
| 2271 | +to fail. However, the language definition syntax provides means to deal | |
| 2272 | +with multiple lines (see <a href="#Delimited-definitions">Delimited definitions</a> and | |
| 2273 | +<a href="#State_002fEnvironment-Definitions">State/Environment Definitions</a>). | |
| 2274 | + | |
| 2275 | +<ul class="menu"> | |
| 2276 | +<li><a accesskey="1" href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a> | |
| 2277 | +<li><a accesskey="2" href="#Simple-definitions">Simple definitions</a> | |
| 2278 | +<li><a accesskey="3" href="#Line-wide-definitions">Line wide definitions</a> | |
| 2279 | +<li><a accesskey="4" href="#Order-of-definitions">Order of definitions</a> | |
| 2280 | +<li><a accesskey="5" href="#Delimited-definitions">Delimited definitions</a> | |
| 2281 | +<li><a accesskey="6" href="#Variable-definitions">Variable definitions</a> | |
| 2282 | +<li><a accesskey="7" href="#Dynamic-Backreferences">Dynamic Backreferences</a> | |
| 2283 | +<li><a accesskey="8" href="#File-inclusion">File inclusion</a>: Include the contents of another file | |
| 2284 | +<li><a accesskey="9" href="#State_002fEnvironment-Definitions">State/Environment Definitions</a> | |
| 2285 | +<li><a href="#Explicit-subexpressions-with-names">Explicit subexpressions with names</a> | |
| 2286 | +<li><a href="#Redefinitions-and-Substitutions">Redefinitions and Substitutions</a> | |
| 2287 | +<li><a href="#How-source_002dhighlight-works">How source-highlight works</a> | |
| 2288 | +<li><a href="#Notes-on-regular-expressions">Notes on regular expressions</a> | |
| 2289 | +<li><a href="#The-program-check_002dregexp">The program check-regexp</a> | |
| 2290 | +<li><a href="#Listing-Language-Elements">Listing Language Elements</a> | |
| 2291 | +<li><a href="#Concluding-Remarks">Concluding Remarks</a> | |
| 2292 | +<li><a href="#Debugging">Debugging</a>: Debug a language definition file | |
| 2293 | +<li><a href="#Tutorials-on-Language-Definitions">Tutorials on Language Definitions</a> | |
| 2294 | +</ul> | |
| 2295 | + | |
| 2296 | +<div class="node"> | |
| 2297 | +<a name="Ways-of-specifying-regular-expressions"></a> | |
| 2298 | +<p><hr> | |
| 2299 | +Next: <a rel="next" accesskey="n" href="#Simple-definitions">Simple definitions</a>, | |
| 2300 | +Previous: <a rel="previous" accesskey="p" href="#Language-Definitions">Language Definitions</a>, | |
| 2301 | +Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definitions</a> | |
| 2302 | + | |
| 2303 | +</div> | |
| 2304 | + | |
| 2305 | +<h3 class="section">7.1 Ways of specifying regular expressions</h3> | |
| 2306 | + | |
| 2307 | +<p>Before getting into details of language definition syntax, it is crucial | |
| 2308 | +to describe the 3 possible ways of specifying a regular expression | |
| 2309 | +string. These 3 different ways, basically differ in the way they handle | |
| 2310 | +regular expression special characters, such, e.g., parenthesis. For | |
| 2311 | +this reason, one mechanism can be more powerful than another one, but it | |
| 2312 | +could also require more attention; furthermore, there can be situations | |
| 2313 | +where you're forced to use only one mechanism, since the other ones | |
| 2314 | +cannot accomplish the required goal. | |
| 2315 | + | |
| 2316 | + | |
| 2317 | +<a name="index-g_t_0040code_007b_0022expression_0022_007d-115"></a> | |
| 2318 | +<dl><dt><code>"expression"</code><dd> | |
| 2319 | +If you use double quotes (note, <code>"</code> and not <code>``</code> or | |
| 2320 | +<code>''</code>) to specify a regular expression, then basically all the | |
| 2321 | +characters, but the alternation symbol, i.e., the pipe symbol <code>|</code>, | |
| 2322 | +are considered literally, and thus will be automatically escaped (e.g., | |
| 2323 | +a dot <code>.</code> is interpreted as the character <code>.</code> not as the | |
| 2324 | +regular expression wild card). Thus, for instance, if you specify | |
| 2325 | + | |
| 2326 | + <pre class="example"> "my(regular)ex.pre$$ion{*}" | |
| 2327 | +</pre> | |
| 2328 | + <p class="noindent">source-highlight will automatically transform it into | |
| 2329 | + | |
| 2330 | + <pre class="example"> my\(regular\)ex\.pre\$\$ion\{\*\} | |
| 2331 | +</pre> | |
| 2332 | + <p>The special character <code>|</code>, unless it is meant to separate two | |
| 2333 | +alternatives (<a href="#Simple-definitions">Simple definitions</a>), must be escaped with the | |
| 2334 | +character <code>\</code>, e.g., <code>\|</code>. Also the character <code>\</code>, | |
| 2335 | +if it is intended literally, must be escaped, e.g., <code>\\</code>. | |
| 2336 | + | |
| 2337 | + <p><a name="index-g_t_0040code_007b_0027expression_0027_007d-116"></a><br><dt><code>'expression'</code><dd> | |
| 2338 | +If you want to enjoy (almost) the full power of regular expressions, you | |
| 2339 | +need to use single quoted strings (<code>'</code>), instead of double quoted | |
| 2340 | +strings. This way, you can specify special characters with their | |
| 2341 | +intended meaning. | |
| 2342 | + | |
| 2343 | + <p>However, marked subexpressions are automatically transformed in non | |
| 2344 | +marked subexpressions, i.e., the parts in the expression of the shape | |
| 2345 | +<code>(...)</code> will be transformed into <code>(?:...)</code> (as explained in | |
| 2346 | +<a href="#Notes-on-regular-expressions">Notes on regular expressions</a>, <code>(?:...)</code> lexically groups | |
| 2347 | +part of a regular expression, without generating a marked | |
| 2348 | +sub-expression). | |
| 2349 | + | |
| 2350 | + <p>Thus, for instance, if you specify | |
| 2351 | + | |
| 2352 | + <pre class="example"> 'my(regular)ex.pre$ion*' | |
| 2353 | +</pre> | |
| 2354 | + <p class="noindent">source-highlight will automatically transform it into | |
| 2355 | + | |
| 2356 | + <pre class="example"> my(?:regular)ex.pre$ion* | |
| 2357 | +</pre> | |
| 2358 | + <p>Since marked subexpressions cannot be specified with this syntax, then | |
| 2359 | +<em>backreferences</em> (see <a href="#Notes-on-regular-expressions">Notes on regular expressions</a>) are not | |
| 2360 | +allowed. | |
| 2361 | + | |
| 2362 | + <p><a name="index-g_t_0040code_007b_0060expression_0060_007d-117"></a><br><dt><code>`expression`</code><dd> | |
| 2363 | +<a name="index-marked-subexpressions-118"></a><a name="index-backreference-119"></a><a name="index-backtick-120"></a>This syntax<a rel="footnote" href="#fn-26" name="fnd-26"><sup>26</sup></a> (note the difference, this | |
| 2364 | +one uses the <em>backtick</em> <code>`</code> while the previous one uses | |
| 2365 | +<code>'</code>) for specifying a regular expression was introduced to overcome | |
| 2366 | +the limitations of the other two syntaxes. With this syntax, the marked | |
| 2367 | +subexpressions are not transformed, and so you can use regular | |
| 2368 | +expressions mechanisms that rely on marked subexpressions, such as | |
| 2369 | +<em>backreferences</em> and <em>conditionals</em> (see <a href="#Notes-on-regular-expressions">Notes on regular expressions</a>). | |
| 2370 | + | |
| 2371 | + <p>This syntax is also crucial for highlighting specific program parts of | |
| 2372 | +some programming languages, such as, e.g., Perl regular expressions | |
| 2373 | +(e.g., in substitution expressions) that can be expressed in many forms, | |
| 2374 | +in particular, separators for the part to be replaced and the part to | |
| 2375 | +replace which can be any non alphanumerical characters<a rel="footnote" href="#fn-27" name="fnd-27"><sup>27</sup></a>, | |
| 2376 | +for instance, | |
| 2377 | + | |
| 2378 | + <pre class="example"> s/foo/bar/g | |
| 2379 | + s|foo|bar|g | |
| 2380 | + s#foo#bar#g | |
| 2381 | + s@foo@bar@g | |
| 2382 | +</pre> | |
| 2383 | + <p>Using this syntax, and backreferences, we can easily define a single | |
| 2384 | +language element to deal with these expressions (without specifying all | |
| 2385 | +the cases for each possible non alphanumerical character): | |
| 2386 | + | |
| 2387 | + <pre class="example"> regexp = `s([^[:alnum:][:blank:]]).*\1.*\1[ixsmogce]*` | |
| 2388 | +</pre> | |
| 2389 | + </dl> | |
| 2390 | + | |
| 2391 | + <p>Since version 2.11, in all kinds of regular expression specification, you | |
| 2392 | +can insert newline characters, which will simply be ignored. Thus, | |
| 2393 | +e.g., the file: | |
| 2394 | + | |
| 2395 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 2396 | +<pre class="example"> <i># test_newlines.lang</i> | |
| 2397 | + <i># test that newlines in expressions are simply discarded</i> | |
| 2398 | + | |
| 2399 | + <i>keyword</i> = <tt>"foo</tt> | |
| 2400 | + <tt>|</tt> | |
| 2401 | + <tt>lang"</tt> | |
| 2402 | + | |
| 2403 | + (<i>keyword</i>,<i>normal</i>,<i>classname</i>) = | |
| 2404 | + <tt>`(\<struct)</tt> | |
| 2405 | + <tt>([[:blank:]]+)</tt> | |
| 2406 | + <tt>([[:alnum:]_]+)`</tt> | |
| 2407 | + | |
| 2408 | + <i>preproc</i> = <tt>'^[[:blank:]]*</tt> | |
| 2409 | + <tt>#([[:blank:]]*</tt> | |
| 2410 | + <tt>[[:word:]]*)'</tt> | |
| 2411 | +</pre> | |
| 2412 | + <p class="noindent">and the file: | |
| 2413 | + | |
| 2414 | +<!-- Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite --> | |
| 2415 | +<pre class="example"> <i># test_nonewlines.lang</i> | |
| 2416 | + <i># test that newlines in expressions are simply discarded</i> | |
| 2417 | + <i># see the corresponding test_newlines.lang</i> | |
| 2418 | + | |
| 2419 | + <i>keyword</i> = <tt>"foo|lang"</tt> | |
| 2420 | + | |
| 2421 | + (<i>keyword</i>,<i>normal</i>,<i>classname</i>) = <tt>`(\<struct)([[:blank:]]+)([[:alnum:]_]+)`</tt> | |
| 2422 | + | |
| 2423 | + <i>preproc</i> = <tt>'^[[:blank:]]*#([[:blank:]]*[[:word:]]*)'</tt> | |
| 2424 | +</pre> | |
| 2425 | + <p class="noindent">are equivalent. However, the former is surely more readable. | |
| 2426 | + | |
| 2427 | + <p>Note however, that space characters are NOT ignored in regular expression | |
| 2428 | +definitions. | |
| 2429 | + | |
| 2430 | +<div class="node"> | |
| 2431 | +<a name="Simple-definitions"></a> | |
| 2432 | +<p><hr> | |
| 2433 | +Next: <a rel="next" accesskey="n" href="#Line-wide-definitions">Line wide definitions</a>, | |
| 2434 | +Previous: <a rel="previous" accesskey="p" href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a>, | |
| 2435 | +Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definitions</a> | |
| 2436 | + | |
| 2437 | +</div> | |
| 2438 | + | |
| 2439 | +<h3 class="section">7.2 Simple definitions</h3> | |
| 2440 | + | |
| 2441 | +<p><a name="index-simple-language-definition-121"></a> | |
| 2442 | +The simplest way to specify language elements is to list the possible | |
| 2443 | +alternatives. This is the case, for instance, for keywords. For | |
| 2444 | +instance, in <samp><span class="file">java.lang</span></samp> you have: | |
| 2445 | + | |
| 2446 | +<pre class="example"> keyword = "abstract|assert|break|case|catch|class|const", | |
| 2447 | + "continue|default|do|else|extends|false|final", | |
| 2448 | + "finally|for|goto|if|implements|instanceof|interface" | |
| 2449 | + keyword = "native|new|null|private|protected|public|return", | |
| 2450 | + "static|strictfp|super|switch|synchronized|throw", | |
| 2451 | + "throws|true|this|transient|try|volatile|while" | |
| 2452 | +</pre> | |
| 2453 | + <p>You can separate quoted definitions with commas. Alternatively, within | |
| 2454 | +a quoted definition, alternatives can be separated with the pipe symbol | |
| 2455 | +<code>|</code>. The above definition defines the language element | |
| 2456 | +<code>keyword</code>. Each time an element is found in the source file, it is | |
| 2457 | +highlighted with the style for the element with the same name in the | |
| 2458 | +output format style file (note that all elements shown in the example | |
| 2459 | +are taken from the language definition files that come with | |
| 2460 | +source-highlight and there is a style for each of such elements, see | |
| 2461 | +<a href="#Configuration-files">Configuration files</a>). If such an element is not specified in the | |
| 2462 | +output format style file, it is simply not highlighted (actually, it is | |
| 2463 | +highlighted with style <code>normal</code>, <a href="#Configuration-files">Configuration files</a>) (so pay | |
| 2464 | +attention to typos :-). | |
| 2465 | + | |
| 2466 | + <p>From the above example you may have noted that language element | |
| 2467 | +definitions are cumulative, so the second <code>keyword</code> definition does | |
| 2468 | +not replace the first one. (Indeed, in some cases you may want to | |
| 2469 | +actually redefine a language element; this is possible as explained in | |
| 2470 | +<a href="#Redefinitions-and-Substitutions">Redefinitions and Substitutions</a>). | |
| 2471 | + | |
| 2472 | + <p>Note that words specified in double quotes have to match exactly in a | |
| 2473 | +source file, and they must be isolated (not surrounded by anything but | |
| 2474 | +spaces). Thus for instance <code>class</code> is matched as a keyword, but in | |
| 2475 | +<code>my_class</code> the substring <code>class</code> is not matched as keyword. | |
| 2476 | +From the point of view of regular expressions a string such as | |
| 2477 | +<code>class</code> in a double quote simple definition is intended as | |
| 2478 | +<code>\<(class)\></code>. | |
| 2479 | + | |
| 2480 | + <p>Special characters have to be escaped with the character <code>\</code>. So | |
| 2481 | +for instance if you want to specify the character <code>|</code>, which is | |
| 2482 | +normally used to separate alternatives in double quoted strings, you | |
| 2483 | +have to specify <code>\|</code>. | |
| 2484 | + | |
| 2485 | + <p>As explained in <a href="#Ways-of-specifying-regular-expressions">Ways of specifying regular expressions</a>, | |
| 2486 | +definitions in double quotes are interpreted literally (thus, e.g., a | |
| 2487 | +dot <code>.</code> is interpreted as the character <code>.</code> not as the regular | |
| 2488 | +expression wild card). If you want to enjoy the full power of regular | |
| 2489 | +expressions to specify a language alternative, you have to use single | |
| 2490 | +quoted strings (<code>'</code>), instead of double quoted strings, or strings | |
| 2491 | +quoted with backticks (<code>`</code>). | |
| 2492 | + | |
| 2493 | + <p>For instance, the following is the definition for a preprocessor | |
| 2494 | +directive in C/C++: | |
| 2495 | + | |
| 2496 | +<pre class="example"> preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' | |
| 2497 | +</pre> | |
| 2498 | + <p>Note that the definition <code>'class'</code> is different from | |
| 2499 | +<code>"class"</code>, as explained above. Thus, for instance <code>'class'</code> | |
| 2500 | +matches also the sub-expression <code>class</code> inside <code>my_class</code>. | |
| 2501 | + | |
| 2502 | + <p>Furthermore, you are not allowed to specify, in the same list, double | |
| 2503 | +quoted strings and single quoted strings: you need to split such list | |
| 2504 | +definitions. Thus, for instance, the following definition is wrong: | |
| 2505 | + | |
| 2506 | +<pre class="example"> preproc = "#define",'^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' | |
| 2507 | +</pre> | |
| 2508 | + <p>while the following one is correct: | |
| 2509 | + | |
| 2510 | +<pre class="example"> preproc = "#define" | |
| 2511 | + preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' | |
| 2512 | +</pre> | |
| 2513 | + <p><a name="index-nonsensitive-122"></a>Finally, at the end of a list of definitions, one can specify the | |
| 2514 | +keyword <code>nonsensitive</code>; in that case, the specified strings will be | |
| 2515 | +interpreted in a non case sensitive way. For instance, we use this | |
| 2516 | +feature in Pascal language definition, <samp><span class="file">pascal.lang</span></samp> where keywords | |
| 2517 | +are parsed in a non sensitive way: | |
| 2518 | + | |
| 2519 | +<pre class="example"> keyword = "alfa|and|array|begin|case|const|div", | |
| 2520 | + "do|downto|else|end|false|file|for|function|get|goto|if|in", | |
| 2521 | + "label|mod|new|not|of|or|pack|packed|page|program", | |
| 2522 | + "put|procedure|read|readln|record|repeat|reset|rewrite|set", | |
| 2523 | + "text|then|to|true|type|unpack|until|var|while|with|writeln|write" | |
| 2524 | + nonsensitive | |
| 2525 | +</pre> | |
| 2526 | + <div class="node"> | |
| 2527 | +<a name="Line-wide-definitions"></a> | |
| 2528 | +<p><hr> | |
| 2529 | +Next: <a rel="next" accesskey="n" href="#Order-of-definitions">Order of definitions</a>, | |
| 2530 | +Previous: <a rel="previous" accesskey="p" href="#Simple-definitions">Simple definitions</a>, | |
| 2531 | +Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definitions</a> | |
| 2532 | + | |
| 2533 | +</div> | |
| 2534 | + | |
| 2535 | +<h3 class="section">7.3 Line wide definitions</h3> | |
| 2536 | + | |
| 2537 | +<p><a name="index-lines-123"></a> | |
| 2538 | +It is often useful to define a language element that affects all the | |
| 2539 | +remaining characters up to the end of the line. For such definitions, | |
| 2540 | +instead of the <code>=</code> you must use the keyword <code>start</code>. For | |
| 2541 | +instance, the following is the definition of a single line comment in | |
| 2542 | +C++: | |
| 2543 | + | |
| 2544 | +<pre class="example"> comment start "//" | |
| 2545 | +</pre> | |
| 2546 | + <p>This means that when the two characters <code>//</code> are encountered in the | |
| 2547 | +source file, everything from these characters on, up to the end of | |
| 2548 | +the line, will be highlighted according to the style <code>comment</code>. | |
| 2549 | + | |
| 2550 | +<div class="node"> | |
| 2551 | +<a name="Order-of-definitions"></a> | |
| 2552 | +<p><hr> | |
| 2553 | +Next: <a rel="next" accesskey="n" href="#Delimited-definitions">Delimited definitions</a>, | |
| 2554 | +Previous: <a rel="previous" accesskey="p" href="#Line-wide-definitions">Line wide definitions</a>, | |
| 2555 | +Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definitions</a> | |
| 2556 | + | |
| 2557 | +</div> | |
| 2558 | + | |
| 2559 | +<h3 class="section">7.4 Order of definitions</h3> | |
| 2560 | + | |
| 2561 | +<p><a name="index-definition-order-124"></a> | |
| 2562 | +It is important to observe that the order of language definitions is | |
| 2563 | +important since it will be used during regular expression matching (this | |
| 2564 | +will be detailed in <a href="#How-source_002dhighlight-works">How source-highlight works</a>). You then have to | |
| 2565 | +make sure that, if there are definitions that start with same | |
| 2566 | +characters, the longest expression is specified first in the file. For | |
| 2567 | +instance if you write | |
| 2568 | + | |
| 2569 | +<pre class="example"> symbol = "/" | |
| 2570 | + comment start "//" | |
| 2571 | +</pre> | |
| 2572 | + <p>The first expression will always be matched first, and the | |
| 2573 | +second expression will never be matched. The right order is | |
| 2574 | + | |
| 2575 | +<pre class="example"> comment start "//" | |
| 2576 | + symbol = "/" | |
| 2577 | +</pre> | |
| 2578 | + <div class="node"> | |
| 2579 | +<a name="Delimited-definitions"></a> | |
| 2580 | +<p><hr> | |
| 2581 | +Next: <a rel="next" accesskey="n" href="#Variable-definitions">Variable definitions</a>, | |
| 2582 | +Previous: <a rel="previous" accesskey="p" href="#Order-of-definitions">Order of definitions</a>, | |
| 2583 | +Up: <a rel="up" accesskey="u" href="#Language-Definitions">Language Definitions</a> | |
| 2584 | + | |
| 2585 | +</div> | |
| 2586 | + | |
| 2587 | +<h3 class="section">7.5 Delimited definitions</h3> | |
| 2588 | + | |
| 2589 | +<p><a name="index-delimited-definitions-125"></a> | |
| 2590 | +Many elements are delimited by specific character sequences. | |
| 2591 | +For instance, strings and multiline comments. The syntax for | |
| 2592 | +such an element definition is | |
| 2593 | + | |
| 2594 | +<pre class="example"> <name> delim <left delimited> <right delimiter> \ | |
| 2595 | + {escape <escape character>} \ | |
| 2596 | + {multiline} {nested} | |
| 2597 | +</pre> | |
| 2598 | + <p>The <code>escape</code> statement specifies the escape character that may | |
| 2599 | +precede one of the |
Part of diff was cut off due to size limit. Use your local client to view the full diff.