From 79b4a7df86d1c3fa3929287300edc50a3128656e Mon Sep 17 00:00:00 2001 From: cn Date: Sat, 7 Jul 2012 14:44:42 +0200 Subject: [PATCH 1/5] Add puppet support --- ftyperc | 6 +++ puppet.jsf | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 puppet.jsf diff --git a/ftyperc b/ftyperc index b112f80..c773519 100644 --- a/ftyperc +++ b/ftyperc @@ -926,3 +926,9 @@ *.sieve -syntax sieve -autoindent + + Puppet +*.pp +-syntax puppet +-pound_comment +-autoindent diff --git a/puppet.jsf b/puppet.jsf new file mode 100644 index 0000000..e0fa7c7 --- /dev/null +++ b/puppet.jsf @@ -0,0 +1,109 @@ +# JOE syntax highlight file for Puppet + +=Idle +=Comment green +=CommentLabel bold green +=Constant cyan +=Escape bold cyan +=Type bold +=Keyword bold +=Bad bold red +=Var yellow +=Brace magenta + +=KeywordAttr bold + +:idle Idle + * idle + "\n" idle + "#" comment recolor=-1 + "{[]}" brace recolor=-1 + "0" first_digit recolor=-1 + "1-9" decimal recolor=-1 + "\"" string recolor=-1 + "'" char recolor=-1 + "/" regex recolor=-1 + "$" variable recolor=-1 + "a-zA-Z_" ident buffer + +:comment Comment + * comment + "\n" idle + +:brace Brace + * idle noeat + +:first_digit Constant + * idle noeat + "0-7" octal + "89" bad_number recolor=-1 + +:bad_number Bad + * idle noeat + "0-9" bad_number + +:octal Constant + * idle noeat + "0-7_" octal + "89" bad_number recolor=-1 + +:decimal Constant + * idle noeat + "0-9_" decimal + +:char Constant + * char + "'" idle + +:string Constant + * string + "\"" idle + "$" maybe_string_subst recolor=-1 + +:maybe_string_subst Constant + * string noeat + "{" string_subst recolor=-2 + +:string_subst Escape + * string_subst + "}" string + +:regex Constant + * regex + "\\" regex_quote recolor=-1 + "/" idle + +:regex_quote Escape + * regex + +:variable Var + * idle noeat + "a-zA-Z0-9_:" variable + +:ident Idle + * idle noeat strings + "case" kw + "class" kw + "else" kw + "elsif" kw + "false" kw + "if" kw + "true" kw + "undef" kw + # prominent attrs + "ensure" kw_attr + # methods + "fail" method + "notice" method + "template" method +done + "a-zA-Z0-9_" ident + +:kw Keyword + * idle noeat + +:kw_attr KeywordAttr + * idle noeat + +:method Keyword + * idle noeat From ed8da20dbc32d84abe8a5d372e65c5a5d748a190 Mon Sep 17 00:00:00 2001 From: cn Date: Sat, 7 Jul 2012 16:02:42 +0200 Subject: [PATCH 2/5] Puppet: add Type regocnition --- puppet.jsf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/puppet.jsf b/puppet.jsf index e0fa7c7..ed21370 100644 --- a/puppet.jsf +++ b/puppet.jsf @@ -8,7 +8,7 @@ =Type bold =Keyword bold =Bad bold red -=Var yellow +=Var fg_310 # brown =Brace magenta =KeywordAttr bold @@ -24,7 +24,8 @@ "'" char recolor=-1 "/" regex recolor=-1 "$" variable recolor=-1 - "a-zA-Z_" ident buffer + "A-Z" type recolor=-1 + "a-z" ident buffer :comment Comment * comment @@ -80,6 +81,10 @@ * idle noeat "a-zA-Z0-9_:" variable +:type Type + * idle noeat + "a-zA-Z0-9_" type + :ident Idle * idle noeat strings "case" kw From b92c346681f3619c2c7e1d3dd81636fe24bbc5d0 Mon Sep 17 00:00:00 2001 From: cn Date: Sun, 8 Jul 2012 14:00:12 +0200 Subject: [PATCH 3/5] Add ip(6)tables syntax highlighter for iptables-save output --- ftyperc | 11 +++++++++++ iptables.jsf | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 iptables.jsf diff --git a/ftyperc b/ftyperc index c773519..0e25d25 100644 --- a/ftyperc +++ b/ftyperc @@ -932,3 +932,14 @@ -syntax puppet -pound_comment -autoindent + + ip(6)tables +* ++# Generated by iptables-save +-syntax iptables +-pound_comment + +* ++# Generated by ip6tables-save +-syntax iptables +-pound_comment diff --git a/iptables.jsf b/iptables.jsf new file mode 100644 index 0000000..fdc8c05 --- /dev/null +++ b/iptables.jsf @@ -0,0 +1,56 @@ +# JOE syntax highlight file for ip(6)tables-save and -restore + +=Idle +=Comment green +=Constant cyan +=Escape bold cyan +=Bad bold red + +=Table bold blue +=Policy fg_310 # brown + +:line_start Idle + * rest noeat + "#" line_comment recolor=-1 + "*" maybe_table buffer + ":" default_policy recolor=-1 + "C" maybe_commit buffer + +:rest Idle + * rest + "\n" line_start + +:line_comment Comment + * line_comment + "\n" line_start + +:maybe_table Idle + * bad noeat strings + "*filter" table_name + "*mangle" table_name + "*nat" table_name + "*raw" table_name +done + "a-z" maybe_table + +:table_name Table + * bad noeat + "\n" line_start + +:default_policy Policy + * default_policy + "\n" line_start + +:maybe_commit Idle + * bad noeat strings + "COMMIT" commit +done + "A-Z" maybe_commit + +:commit Table + * bad noeat + "\n" line_start + +:bad Bad + * bad + "\n" line_start From a1886c8c18999cb060f80e67b143b3df69f253cb Mon Sep 17 00:00:00 2001 From: cn Date: Sun, 8 Jul 2012 14:09:58 +0200 Subject: [PATCH 4/5] Erlang: allow keywords to be followed by a ( without being lit as function name A new rule skips whitespace after any non-keyword atom to search for a ( and highlights the current buffer as function name when found. --- erlang.jsf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erlang.jsf b/erlang.jsf index 99f338e..5d5747c 100644 --- a/erlang.jsf +++ b/erlang.jsf @@ -101,7 +101,7 @@ * idle noeat :atom Idle - * idle noeat strings + * maybe_function noeat strings "after" kw "and" kw "andalso" kw @@ -131,13 +131,17 @@ "when" kw "xor" kw done - "(" function recolormark noeat ":" module recolormark noeat "a-zA-Z0-9_@" atom :module Module * idle noeat +:maybe_function Idle + * idle noeat + " " maybe_function + "(" function recolormark noeat + :function Fun * idle noeat From b5a46a6cb962bfe94974a63bc5f3e89d0f9787bf Mon Sep 17 00:00:00 2001 From: cn Date: Sun, 8 Jul 2012 21:54:05 +0200 Subject: [PATCH 5/5] iptables: highlight important options and numbers --- iptables.jsf | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/iptables.jsf b/iptables.jsf index fdc8c05..7eb9b01 100644 --- a/iptables.jsf +++ b/iptables.jsf @@ -6,8 +6,9 @@ =Escape bold cyan =Bad bold red -=Table bold blue -=Policy fg_310 # brown +=Table bold +=Policy bold blue +=Option fg_310 # brown :line_start Idle * rest noeat @@ -15,6 +16,7 @@ "*" maybe_table buffer ":" default_policy recolor=-1 "C" maybe_commit buffer + "-" command :rest Idle * rest @@ -51,6 +53,64 @@ done * bad noeat "\n" line_start +:command Idle + * bad noeat + "ADINX" chain_name_pre + +:chain_name_pre Idle + * chain_name noeat + " " chain_name_pre + +:chain_name Option + * chain_name + " " rule_spec + +:rule_spec Idle + * rule_option noeat + " " rule_spec + "\n" line_start + +:rule_option Idle + * rule_option + " " rule_spec + "\n" line_start + "-" rule_flag + +:rule_flag Idle + * rule_option + "-" rule_flag_flag + "iojp" rule_iojp_pre + "sd" rule_sd_pre + +:rule_flag_flag Idle + * rule_flag_flag1 buffer + +:rule_flag_flag1 Idle + * rule_option noeat strings + "sport" rule_sd_pre + "dport" rule_sd_pre +done + "a-z-_" rule_flag_flag1 + + +:rule_iojp_pre Idle + * rule_iojp noeat + " " rule_iojp_pre + +:rule_iojp Option + * rule_iojp + " " rule_option + "\n" line_start + +:rule_sd_pre Idle + * rule_sd noeat + " " rule_sd_pre + +:rule_sd Constant + * rule_sd + " " rule_option + "\n" line_start + :bad Bad * bad "\n" line_start