Files
macports-ports/print/enscript/files/patch-ruby_syntax.diff
Wataru Kimura c38a1d7947 print/enscript: 1.6.4_3
- homepage was moved
	- support ruby syntax
	- import a security patch from freebsd

git-svn-id: https://svn.macports.org/repository/macports/trunk/dports@54115 d073be05-634f-4543-b044-5fe20cf6d1d6
2009-07-21 16:11:32 +00:00

254 lines
6.0 KiB
Diff

diff -uNr ../enscript-1.6.4.mp_patched/states/hl/Makefile.in ./states/hl/Makefile.in
--- ../enscript-1.6.4.mp_patched/states/hl/Makefile.in 2009-07-22 00:44:57.000000000 +0900
+++ ./states/hl/Makefile.in 2009-07-22 00:46:44.000000000 +0900
@@ -188,9 +188,9 @@
diffs.st diffu.st elisp.st fortran.st fortran_pp.st haskell.st html.st \
idl.st inf.st java.st javascript.st ksh.st m4.st mail.st makefile.st \
matlab.st nroff.st objc.st outline.st pascal.st passthrough.st perl.st \
-postscript.st python.st pyrex.st rfc.st scheme.st sh.st skill.st \
-sql.st states.st synopsys.st tcl.st tcsh.st tex.st vba.st verilog.st \
-vhdl.st vrml.st wmlscript.st zsh.st
+postscript.st python.st pyrex.st ruby.st rfc.st scheme.st sh.st \
+skill.st sql.st states.st synopsys.st tcl.st tcsh.st tex.st vba.st \
+verilog.st vhdl.st vrml.st wmlscript.st zsh.st
states = $(misc) $(styles) $(languages) $(highlightings)
diff -uNr ../enscript-1.6.4.mp_patched/states/hl/enscript.st ./states/hl/enscript.st
--- ../enscript-1.6.4.mp_patched/states/hl/enscript.st 2003-03-05 17:31:31.000000000 +0900
+++ ./states/hl/enscript.st 2009-07-22 00:54:38.000000000 +0900
@@ -489,6 +489,7 @@
/\.idl$/ idl;
/\.(hs|lhs|gs|lgs)$/ haskell;
/\.(pm|pl)$/ perl;
+ /\.(rb|rbw)$/ ruby;
/\.(eps|EPS|ps|PS)$/ postscript;
/\.py$/ python;
/\.pyx$/ pyrex;
@@ -530,6 +531,8 @@
/-\*- [Ii][Dd][Ll] -\*-/ idl;
/-\*- [Pp][Ee][Rr][Ll] -\*-/ perl;
/^#![ \t]*\/.*\/perl/ perl;
+ /-\*- [Rr][Uu][Bb][Yy] -\*-/ ruby;
+ /^#![ \t]*\/.*\/(env )?ruby/ ruby;
/^From:/ mail;
/^#![ \t]*(\/usr)?\/bin\/[ngmt]?awk/ awk;
/^#![ \t]*(\/usr)?\/bin\/sh/ sh;
diff -uNr ../enscript-1.6.4.mp_patched/states/hl/ruby.st ./states/hl/ruby.st
--- ../enscript-1.6.4.mp_patched/states/hl/ruby.st 1970-01-01 09:00:00.000000000 +0900
+++ ./states/hl/ruby.st 2009-07-22 00:45:47.000000000 +0900
@@ -0,0 +1,213 @@
+/**
+ * Name: ruby
+ * Description: Ruby programming language.
+ * Author: Mike Wilson
+ */
+
+state ruby_comment
+{
+ /\*\\\// {
+ language_print ($0);
+ return;
+ }
+ LANGUAGE_SPECIALS {
+ language_print ($0);
+ }
+}
+
+state ruby_dquot_string
+{
+ /\\\\./ {
+ language_print ($0);
+ }
+ /\"/ {
+ language_print ($0);
+ return;
+ }
+ LANGUAGE_SPECIALS {
+ language_print ($0);
+ }
+}
+
+state ruby_quot_string
+{
+ /\\\\./ {
+ language_print ($0);
+ }
+ /[\']/ {
+ language_print ($0);
+ return;
+ }
+ LANGUAGE_SPECIALS {
+ language_print ($0);
+ }
+}
+
+state ruby_bquot_string
+{
+ /\\\\./ {
+ language_print ($0);
+ }
+ /`/ {
+ language_print ($0);
+ return;
+ }
+ LANGUAGE_SPECIALS {
+ language_print ($0);
+ }
+}
+
+state ruby
+{
+ BEGIN {
+ header ();
+ }
+ END {
+ trailer ();
+ }
+
+ /* Comments. */
+ /#[^{].*$/ {
+ comment_face (true);
+ language_print ($0);
+ comment_face (false);
+ }
+
+ /* Ignore escaped quote marks */
+ /\\\"/ {
+ language_print ($0);
+ }
+ /\\\'/ {
+ language_print ($0);
+ }
+ /\\\`/ {
+ language_print ($0);
+ }
+
+ /* In cgi files, JavaScript might be imbedded, so we need to look out
+ * for the JavaScript comments, because they might contain something
+ * we don't like, like a contraction (don't, won't, etc.)
+ * We won't put them in comment face, because they are not ruby
+ * comments.
+ */
+ /\/\// {
+ language_print ($0);
+ call (eat_one_line);
+ }
+
+ /* String constants. */
+ /\"/ {
+ string_face (true);
+ language_print ($0);
+ call (ruby_dquot_string);
+ string_face (false);
+ }
+ /[\']/ {
+ string_face (true);
+ language_print ($0);
+ call (ruby_quot_string);
+ string_face (false);
+ }
+
+ /* Backquoted command string */
+ /`/ {
+ string_face (true);
+ language_print ($0);
+ call (ruby_bquot_string);
+ string_face (false);
+ }
+
+ /* Variables globals and instance */
+ /[$@]\w+/ {
+ variable_name_face (true);
+ language_print ($0);
+ variable_name_face (false);
+ }
+
+ /* Variables class variable */
+ /@@\w+/ {
+ variable_name_face (true);
+ language_print ($0);
+ variable_name_face (false);
+ }
+
+ /([ \t]*)(def)([ \t]+)([^(]*)/ {
+ /* indentation */
+ language_print ($1);
+
+ /* def */
+ keyword_face (true);
+ language_print ($2);
+ keyword_face (false);
+
+ /* middle */
+ language_print ($3);
+
+ /* Function name. */
+ function_name_face (true);
+ language_print ($4);
+ function_name_face (false);
+ }
+
+ /\$[!@&`'+~=\/\\,;.<>_*$?:"]/ {
+ variable_name_face (true);
+ language_print ($0);
+ variable_name_face (false);
+ }
+
+ /* Highlighting
+ --Type face
+ private protected public
+
+ --Reference face
+ require include load
+
+ --Builtin face (I consider these to be somewhat special)
+ alias alias_method attr attr_accessor attr_reader attr_writer
+ module_alias module_function self super
+
+ --Keyword face
+ and begin break case class def defined? do else elsif end
+ ensure eval extend false for if in method module next nil not
+ or redo rescue retry return then true undef unless until when
+ while yield proc lambda loop catch throw __LINE__ __FILE__ END BEGIN
+ */
+/\\b(private|protected|public)\\b/ {
+ type_face (true);
+ language_print ($0);
+ type_face (false);
+ }
+
+/\\b(include|require|load)\\b/ {
+ reference_face (true);
+ language_print ($0);
+ reference_face (false);
+ }
+
+/\\b(alias|alias_method|attr|attr_accessor|attr_reader|attr_writer\\
+|module_alias|module_function|self|super)\\b/ {
+ builtin_face (true);
+ language_print ($0);
+ builtin_face (false);
+ }
+
+/\\b(and|begin|break|case|class|def|defined?|do|else|elsif|end|ensure|eval\\
+|extend|false|for|if|in|method|module|next|nil|not|or|raise|redo|rescue|retry\\
+|return|then|true|undef|unless|until|when|while|yield|proc|lambda|loop|catch\\
+|throw|__LINE__|__FILE__|END|BEGIN)\\b/ {
+ keyword_face (true);
+ language_print ($0);
+ keyword_face (false);
+ }
+
+ LANGUAGE_SPECIALS {
+ language_print ($0);
+ }
+}
+
+
+/*
+Local variables:
+mode: c
+End:
+*/