/usr/share/jed/jed-extra/mupad.sl is in jed-extra 2.5.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | % Mode for editing Mupad files.
% (MuPad is a computer algebra system, see http://www.mupad.de)
%
% Copyright (c) 2003 Günter Milde
% Released under the terms of the GNU General Public License (ver. 2 or later)
%
% Based on Guido Gonzatos matlab.sl <guido@ibogeo.df.unibo.it>
% Enables interactive work using ishell.sl
%
% 0.9 19 May 1999 first public version
% 0.9.1 2005-04-25 bugfix to work with SLang2 (report Jörg Sommer)
% 0.9.2 2005-11-02 fix public definiton of mupad_mode()
% requirements
require("comments");
autoload ("ishell_send_input", "ishell.sl");
autoload ("ishell_mode", "ishell.sl");
private variable modename = "Mupad";
custom_variable ("Mupad_Command", "mupad");
% do commenting with comments.sl
set_comment_info (modename, "# ", " #", 7);
% Now create and initialize a simple syntax table.
create_syntax_table (modename);
% (only two comment definitions work at the same time, MuPad has three)
define_syntax ("#", "#", '%', modename); % comments
%define_syntax ("/*", "*/", '%', modename); % comments
define_syntax ("//", "", '%', modename); % comments
define_syntax ("([{", ")]}", '(', modename); % parentheses
define_syntax ('"', '"', modename); % strings
define_syntax ('\\', '\\', modename); % escape character
define_syntax ("0-9a-zA-Z_", 'w', modename); % identifiers
define_syntax ("0-9a-fA-F.xXL", '0', modename); % numbers
define_syntax (",;", ',', modename); % delimiters
define_syntax ("!&+-.*^;<>\|~='/:", '+', modename); % operators
define_syntax ('>', '#', modename); % preprocess (used for output)
set_syntax_flags (modename, 4);
% Mupad reserved words. Are there more?
() = define_keywords_n (modename, "doifinofto", 2, 0);
() = define_keywords_n (modename, "for", 3, 0);
() = define_keywords_n (modename, "caseelifelsefromholdnextprocthen", 4, 0);
() = define_keywords_n (modename, "beginbreaklocaluntilwhile", 5, 0);
() = define_keywords_n (modename, "end_ifrepeatreturn", 6, 0);
() = define_keywords_n (modename, "end_for", 7, 0);
() = define_keywords_n (modename, "end_procend_case", 8, 0);
() = define_keywords_n (modename, "end_whileotherwise", 9, 0);
() = define_keywords_n (modename, "end_repeat", 10, 0);
%() = define_keywords_n (modename, "edit_history", 12, 0);
%() = define_keywords_n (modename, "end_try_catch", 13, 0);
variable Mupad_Indent = 2;
% Mupad indent routine.
define mupad_indent ()
{
variable goal = 1;
variable cs = CASE_SEARCH;
variable ch;
% goto beginning of line and skip past continuation char
USER_BLOCK0
{
bol ();
skip_white ();
}
push_spot ();
push_spot ();
CASE_SEARCH = 1; % Mupad is case sensitive
while (up_1 ())
{
bol_skip_white();
if ( eolp() ) continue;
X_USER_BLOCK0 ();
goal = what_column ();
% if (looking_at("switch"))
% goal += 2 * Mupad_Indent; % to account for 'case'
if (looking_at ("if") or
looking_at ("else") or
looking_at ("elif") or
looking_at ("case") or
looking_at ("for") or
looking_at ("while") or
looking_at ("repeat") or
looking_at ("proc") or
looking_at ("begin") )
goal += Mupad_Indent;
break;
}
% now check the current line
pop_spot ();
push_spot ();
X_USER_BLOCK0 ();
% if (looking_at ("end_procswitch"))
% goal -= 2 * Mupad_Indent;
if (looking_at ("end_if") or
looking_at ("else") or
looking_at ("elif") or
looking_at ("end_case") or
looking_at ("end_for") or
looking_at ("end_while") or
looking_at ("end_repeat") or
looking_at ("end_proc") )
goal -= Mupad_Indent;
CASE_SEARCH = cs; % done getting indent
if (goal < 1) goal = 1;
pop_spot ();
bol_skip_white ();
ch = char(what_char());
bol_trim ();
goal--;
insert_spaces (goal);
pop_spot ();
skip_white ();
} % mupad_indent
define mupad_newline ()
{
if (bolp ())
{
newline ();
return;
}
mupad_indent ();
newline ();
mupad_indent ();
}
% interactive MuPad session with the actual document as template
public define mupad_shell()
{
ishell_mode(Mupad_Command);
}
define mupad_help()
{
!if(is_substr(get_mode_name(), "ishell"))
error("Currently help only works in mupad-shell mode");
variable topic = "";
if (_NARGS)
topic = ();
if (topic == "")
topic = read_mini("Gnuplot Help for: ", "", "");
set_blocal_var("o", "IShell_output_placement");
% closing NL needed by send_process
send_process(get_blocal_var("IShell_Id"), "?" + topic + "\n");
}
% --- the mode dependend menu
static define init_menu (menu)
{
% menu_append_item (menu, "&Evaluate Region/Buffer", "mupad_run");
menu_append_item (menu, "Mupad &Shell", "mupad_shell");
menu_append_item (menu, "Mupad &Help", "mupad_help");
}
% --- keybindings
%!if (keymap_p (modename)) make_keymap (modename);
% TODO
%!%+
%\function{mupad_mode}
%\synopsis{a mode for edition of mupad skripts}
%\description
% Protoytype: Void mupad_mode ();
% This is a mode that is dedicated to facilitate the editing of
% Mupad language files.
% Hooks: \var{mupad_mode_hook}
%!%-
public define mupad_mode ()
{
set_mode(modename, 2);
% use_keymap(modename);
use_syntax_table (modename);
set_buffer_hook ("indent_hook", "mupad_indent");
set_buffer_hook ("newline_indent_hook", "mupad_newline");
mode_set_mode_info (modename, "init_mode_menu", &init_menu);
define_blocal_var("help_for_word_hook", "mupad_help");
run_mode_hooks("mupad_mode_hook");
}
provide("mupad");
% --- End of file mupad.sl ---
|