Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/dylan
File: index.html
<!doctype html>
[0] Fix | Delete
[1] Fix | Delete
<title>CodeMirror: Dylan mode</title>
[2] Fix | Delete
<meta charset="utf-8"/>
[3] Fix | Delete
<link rel=stylesheet href="../../doc/docs.css">
[4] Fix | Delete
[5] Fix | Delete
<link rel="stylesheet" href="../../lib/codemirror.css">
[6] Fix | Delete
<script src="../../lib/codemirror.js"></script>
[7] Fix | Delete
<script src="../../addon/edit/matchbrackets.js"></script>
[8] Fix | Delete
<script src="../../addon/comment/continuecomment.js"></script>
[9] Fix | Delete
<script src="../../addon/comment/comment.js"></script>
[10] Fix | Delete
<script src="dylan.js"></script>
[11] Fix | Delete
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
[12] Fix | Delete
<div id=nav>
[13] Fix | Delete
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
[14] Fix | Delete
[15] Fix | Delete
<ul>
[16] Fix | Delete
<li><a href="../../index.html">Home</a>
[17] Fix | Delete
<li><a href="../../doc/manual.html">Manual</a>
[18] Fix | Delete
<li><a href="https://github.com/codemirror/codemirror">Code</a>
[19] Fix | Delete
</ul>
[20] Fix | Delete
<ul>
[21] Fix | Delete
<li><a href="../index.html">Language modes</a>
[22] Fix | Delete
<li><a class=active href="#">Dylan</a>
[23] Fix | Delete
</ul>
[24] Fix | Delete
</div>
[25] Fix | Delete
[26] Fix | Delete
<article>
[27] Fix | Delete
<h2>Dylan mode</h2>
[28] Fix | Delete
[29] Fix | Delete
[30] Fix | Delete
<div><textarea id="code" name="code">
[31] Fix | Delete
Module: locators-internals
[32] Fix | Delete
Synopsis: Abstract modeling of locations
[33] Fix | Delete
Author: Andy Armstrong
[34] Fix | Delete
Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
[35] Fix | Delete
All rights reserved.
[36] Fix | Delete
License: See License.txt in this distribution for details.
[37] Fix | Delete
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
[38] Fix | Delete
[39] Fix | Delete
define open generic locator-server
[40] Fix | Delete
(locator :: <locator>) => (server :: false-or(<server-locator>));
[41] Fix | Delete
define open generic locator-host
[42] Fix | Delete
(locator :: <locator>) => (host :: false-or(<string>));
[43] Fix | Delete
define open generic locator-volume
[44] Fix | Delete
(locator :: <locator>) => (volume :: false-or(<string>));
[45] Fix | Delete
define open generic locator-directory
[46] Fix | Delete
(locator :: <locator>) => (directory :: false-or(<directory-locator>));
[47] Fix | Delete
define open generic locator-relative?
[48] Fix | Delete
(locator :: <locator>) => (relative? :: <boolean>);
[49] Fix | Delete
define open generic locator-path
[50] Fix | Delete
(locator :: <locator>) => (path :: <sequence>);
[51] Fix | Delete
define open generic locator-base
[52] Fix | Delete
(locator :: <locator>) => (base :: false-or(<string>));
[53] Fix | Delete
define open generic locator-extension
[54] Fix | Delete
(locator :: <locator>) => (extension :: false-or(<string>));
[55] Fix | Delete
[56] Fix | Delete
/// Locator classes
[57] Fix | Delete
[58] Fix | Delete
define open abstract class <directory-locator> (<physical-locator>)
[59] Fix | Delete
end class <directory-locator>;
[60] Fix | Delete
[61] Fix | Delete
define open abstract class <file-locator> (<physical-locator>)
[62] Fix | Delete
end class <file-locator>;
[63] Fix | Delete
[64] Fix | Delete
define method as
[65] Fix | Delete
(class == <directory-locator>, string :: <string>)
[66] Fix | Delete
=> (locator :: <directory-locator>)
[67] Fix | Delete
as(<native-directory-locator>, string)
[68] Fix | Delete
end method as;
[69] Fix | Delete
[70] Fix | Delete
define method make
[71] Fix | Delete
(class == <directory-locator>,
[72] Fix | Delete
#key server :: false-or(<server-locator>) = #f,
[73] Fix | Delete
path :: <sequence> = #[],
[74] Fix | Delete
relative? :: <boolean> = #f,
[75] Fix | Delete
name :: false-or(<string>) = #f)
[76] Fix | Delete
=> (locator :: <directory-locator>)
[77] Fix | Delete
make(<native-directory-locator>,
[78] Fix | Delete
server: server,
[79] Fix | Delete
path: path,
[80] Fix | Delete
relative?: relative?,
[81] Fix | Delete
name: name)
[82] Fix | Delete
end method make;
[83] Fix | Delete
[84] Fix | Delete
define method as
[85] Fix | Delete
(class == <file-locator>, string :: <string>)
[86] Fix | Delete
=> (locator :: <file-locator>)
[87] Fix | Delete
as(<native-file-locator>, string)
[88] Fix | Delete
end method as;
[89] Fix | Delete
[90] Fix | Delete
define method make
[91] Fix | Delete
(class == <file-locator>,
[92] Fix | Delete
#key directory :: false-or(<directory-locator>) = #f,
[93] Fix | Delete
base :: false-or(<string>) = #f,
[94] Fix | Delete
extension :: false-or(<string>) = #f,
[95] Fix | Delete
name :: false-or(<string>) = #f)
[96] Fix | Delete
=> (locator :: <file-locator>)
[97] Fix | Delete
make(<native-file-locator>,
[98] Fix | Delete
directory: directory,
[99] Fix | Delete
base: base,
[100] Fix | Delete
extension: extension,
[101] Fix | Delete
name: name)
[102] Fix | Delete
end method make;
[103] Fix | Delete
[104] Fix | Delete
/// Locator coercion
[105] Fix | Delete
[106] Fix | Delete
//---*** andrewa: This caching scheme doesn't work yet, so disable it.
[107] Fix | Delete
define constant $cache-locators? = #f;
[108] Fix | Delete
define constant $cache-locator-strings? = #f;
[109] Fix | Delete
[110] Fix | Delete
define constant $locator-to-string-cache = make(<object-table>, weak: #"key");
[111] Fix | Delete
define constant $string-to-locator-cache = make(<string-table>, weak: #"value");
[112] Fix | Delete
[113] Fix | Delete
define open generic locator-as-string
[114] Fix | Delete
(class :: subclass(<string>), locator :: <locator>)
[115] Fix | Delete
=> (string :: <string>);
[116] Fix | Delete
[117] Fix | Delete
define open generic string-as-locator
[118] Fix | Delete
(class :: subclass(<locator>), string :: <string>)
[119] Fix | Delete
=> (locator :: <locator>);
[120] Fix | Delete
[121] Fix | Delete
define sealed sideways method as
[122] Fix | Delete
(class :: subclass(<string>), locator :: <locator>)
[123] Fix | Delete
=> (string :: <string>)
[124] Fix | Delete
let string = element($locator-to-string-cache, locator, default: #f);
[125] Fix | Delete
if (string)
[126] Fix | Delete
as(class, string)
[127] Fix | Delete
else
[128] Fix | Delete
let string = locator-as-string(class, locator);
[129] Fix | Delete
if ($cache-locator-strings?)
[130] Fix | Delete
element($locator-to-string-cache, locator) := string;
[131] Fix | Delete
else
[132] Fix | Delete
string
[133] Fix | Delete
end
[134] Fix | Delete
end
[135] Fix | Delete
end method as;
[136] Fix | Delete
[137] Fix | Delete
define sealed sideways method as
[138] Fix | Delete
(class :: subclass(<locator>), string :: <string>)
[139] Fix | Delete
=> (locator :: <locator>)
[140] Fix | Delete
let locator = element($string-to-locator-cache, string, default: #f);
[141] Fix | Delete
if (instance?(locator, class))
[142] Fix | Delete
locator
[143] Fix | Delete
else
[144] Fix | Delete
let locator = string-as-locator(class, string);
[145] Fix | Delete
if ($cache-locators?)
[146] Fix | Delete
element($string-to-locator-cache, string) := locator;
[147] Fix | Delete
else
[148] Fix | Delete
locator
[149] Fix | Delete
end
[150] Fix | Delete
end
[151] Fix | Delete
end method as;
[152] Fix | Delete
[153] Fix | Delete
/// Locator conditions
[154] Fix | Delete
[155] Fix | Delete
define class <locator-error> (<format-string-condition>, <error>)
[156] Fix | Delete
end class <locator-error>;
[157] Fix | Delete
[158] Fix | Delete
define function locator-error
[159] Fix | Delete
(format-string :: <string>, #rest format-arguments)
[160] Fix | Delete
error(make(<locator-error>,
[161] Fix | Delete
format-string: format-string,
[162] Fix | Delete
format-arguments: format-arguments))
[163] Fix | Delete
end function locator-error;
[164] Fix | Delete
[165] Fix | Delete
/// Useful locator protocols
[166] Fix | Delete
[167] Fix | Delete
define open generic locator-test
[168] Fix | Delete
(locator :: <directory-locator>) => (test :: <function>);
[169] Fix | Delete
[170] Fix | Delete
define method locator-test
[171] Fix | Delete
(locator :: <directory-locator>) => (test :: <function>)
[172] Fix | Delete
\=
[173] Fix | Delete
end method locator-test;
[174] Fix | Delete
[175] Fix | Delete
define open generic locator-might-have-links?
[176] Fix | Delete
(locator :: <directory-locator>) => (links? :: <boolean>);
[177] Fix | Delete
[178] Fix | Delete
define method locator-might-have-links?
[179] Fix | Delete
(locator :: <directory-locator>) => (links? :: singleton(#f))
[180] Fix | Delete
#f
[181] Fix | Delete
end method locator-might-have-links?;
[182] Fix | Delete
[183] Fix | Delete
define method locator-relative?
[184] Fix | Delete
(locator :: <file-locator>) => (relative? :: <boolean>)
[185] Fix | Delete
let directory = locator.locator-directory;
[186] Fix | Delete
~directory | directory.locator-relative?
[187] Fix | Delete
end method locator-relative?;
[188] Fix | Delete
[189] Fix | Delete
define method current-directory-locator?
[190] Fix | Delete
(locator :: <directory-locator>) => (current-directory? :: <boolean>)
[191] Fix | Delete
locator.locator-relative?
[192] Fix | Delete
& locator.locator-path = #[#"self"]
[193] Fix | Delete
end method current-directory-locator?;
[194] Fix | Delete
[195] Fix | Delete
define method locator-directory
[196] Fix | Delete
(locator :: <directory-locator>) => (parent :: false-or(<directory-locator>))
[197] Fix | Delete
let path = locator.locator-path;
[198] Fix | Delete
unless (empty?(path))
[199] Fix | Delete
make(object-class(locator),
[200] Fix | Delete
server: locator.locator-server,
[201] Fix | Delete
path: copy-sequence(path, end: path.size - 1),
[202] Fix | Delete
relative?: locator.locator-relative?)
[203] Fix | Delete
end
[204] Fix | Delete
end method locator-directory;
[205] Fix | Delete
[206] Fix | Delete
/// Simplify locator
[207] Fix | Delete
[208] Fix | Delete
define open generic simplify-locator
[209] Fix | Delete
(locator :: <physical-locator>)
[210] Fix | Delete
=> (simplified-locator :: <physical-locator>);
[211] Fix | Delete
[212] Fix | Delete
define method simplify-locator
[213] Fix | Delete
(locator :: <directory-locator>)
[214] Fix | Delete
=> (simplified-locator :: <directory-locator>)
[215] Fix | Delete
let path = locator.locator-path;
[216] Fix | Delete
let relative? = locator.locator-relative?;
[217] Fix | Delete
let resolve-parent? = ~locator.locator-might-have-links?;
[218] Fix | Delete
let simplified-path
[219] Fix | Delete
= simplify-path(path,
[220] Fix | Delete
resolve-parent?: resolve-parent?,
[221] Fix | Delete
relative?: relative?);
[222] Fix | Delete
if (path ~= simplified-path)
[223] Fix | Delete
make(object-class(locator),
[224] Fix | Delete
server: locator.locator-server,
[225] Fix | Delete
path: simplified-path,
[226] Fix | Delete
relative?: locator.locator-relative?)
[227] Fix | Delete
else
[228] Fix | Delete
locator
[229] Fix | Delete
end
[230] Fix | Delete
end method simplify-locator;
[231] Fix | Delete
[232] Fix | Delete
define method simplify-locator
[233] Fix | Delete
(locator :: <file-locator>) => (simplified-locator :: <file-locator>)
[234] Fix | Delete
let directory = locator.locator-directory;
[235] Fix | Delete
let simplified-directory = directory & simplify-locator(directory);
[236] Fix | Delete
if (directory ~= simplified-directory)
[237] Fix | Delete
make(object-class(locator),
[238] Fix | Delete
directory: simplified-directory,
[239] Fix | Delete
base: locator.locator-base,
[240] Fix | Delete
extension: locator.locator-extension)
[241] Fix | Delete
else
[242] Fix | Delete
locator
[243] Fix | Delete
end
[244] Fix | Delete
end method simplify-locator;
[245] Fix | Delete
[246] Fix | Delete
/// Subdirectory locator
[247] Fix | Delete
[248] Fix | Delete
define open generic subdirectory-locator
[249] Fix | Delete
(locator :: <directory-locator>, #rest sub-path)
[250] Fix | Delete
=> (subdirectory :: <directory-locator>);
[251] Fix | Delete
[252] Fix | Delete
define method subdirectory-locator
[253] Fix | Delete
(locator :: <directory-locator>, #rest sub-path)
[254] Fix | Delete
=> (subdirectory :: <directory-locator>)
[255] Fix | Delete
let old-path = locator.locator-path;
[256] Fix | Delete
let new-path = concatenate-as(<simple-object-vector>, old-path, sub-path);
[257] Fix | Delete
make(object-class(locator),
[258] Fix | Delete
server: locator.locator-server,
[259] Fix | Delete
path: new-path,
[260] Fix | Delete
relative?: locator.locator-relative?)
[261] Fix | Delete
end method subdirectory-locator;
[262] Fix | Delete
[263] Fix | Delete
/// Relative locator
[264] Fix | Delete
[265] Fix | Delete
define open generic relative-locator
[266] Fix | Delete
(locator :: <physical-locator>, from-locator :: <physical-locator>)
[267] Fix | Delete
=> (relative-locator :: <physical-locator>);
[268] Fix | Delete
[269] Fix | Delete
define method relative-locator
[270] Fix | Delete
(locator :: <directory-locator>, from-locator :: <directory-locator>)
[271] Fix | Delete
=> (relative-locator :: <directory-locator>)
[272] Fix | Delete
let path = locator.locator-path;
[273] Fix | Delete
let from-path = from-locator.locator-path;
[274] Fix | Delete
case
[275] Fix | Delete
~locator.locator-relative? & from-locator.locator-relative? =>
[276] Fix | Delete
locator-error
[277] Fix | Delete
("Cannot find relative path of absolute locator %= from relative locator %=",
[278] Fix | Delete
locator, from-locator);
[279] Fix | Delete
locator.locator-server ~= from-locator.locator-server =>
[280] Fix | Delete
locator;
[281] Fix | Delete
path = from-path =>
[282] Fix | Delete
make(object-class(locator),
[283] Fix | Delete
path: vector(#"self"),
[284] Fix | Delete
relative?: #t);
[285] Fix | Delete
otherwise =>
[286] Fix | Delete
make(object-class(locator),
[287] Fix | Delete
path: relative-path(path, from-path, test: locator.locator-test),
[288] Fix | Delete
relative?: #t);
[289] Fix | Delete
end
[290] Fix | Delete
end method relative-locator;
[291] Fix | Delete
[292] Fix | Delete
define method relative-locator
[293] Fix | Delete
(locator :: <file-locator>, from-directory :: <directory-locator>)
[294] Fix | Delete
=> (relative-locator :: <file-locator>)
[295] Fix | Delete
let directory = locator.locator-directory;
[296] Fix | Delete
let relative-directory = directory & relative-locator(directory, from-directory);
[297] Fix | Delete
if (relative-directory ~= directory)
[298] Fix | Delete
simplify-locator
[299] Fix | Delete
(make(object-class(locator),
[300] Fix | Delete
directory: relative-directory,
[301] Fix | Delete
base: locator.locator-base,
[302] Fix | Delete
extension: locator.locator-extension))
[303] Fix | Delete
else
[304] Fix | Delete
locator
[305] Fix | Delete
end
[306] Fix | Delete
end method relative-locator;
[307] Fix | Delete
[308] Fix | Delete
define method relative-locator
[309] Fix | Delete
(locator :: <physical-locator>, from-locator :: <file-locator>)
[310] Fix | Delete
=> (relative-locator :: <physical-locator>)
[311] Fix | Delete
let from-directory = from-locator.locator-directory;
[312] Fix | Delete
case
[313] Fix | Delete
from-directory =>
[314] Fix | Delete
relative-locator(locator, from-directory);
[315] Fix | Delete
~locator.locator-relative? =>
[316] Fix | Delete
locator-error
[317] Fix | Delete
("Cannot find relative path of absolute locator %= from relative locator %=",
[318] Fix | Delete
locator, from-locator);
[319] Fix | Delete
otherwise =>
[320] Fix | Delete
locator;
[321] Fix | Delete
end
[322] Fix | Delete
end method relative-locator;
[323] Fix | Delete
[324] Fix | Delete
/// Merge locators
[325] Fix | Delete
[326] Fix | Delete
define open generic merge-locators
[327] Fix | Delete
(locator :: <physical-locator>, from-locator :: <physical-locator>)
[328] Fix | Delete
=> (merged-locator :: <physical-locator>);
[329] Fix | Delete
[330] Fix | Delete
/// Merge locators
[331] Fix | Delete
[332] Fix | Delete
define method merge-locators
[333] Fix | Delete
(locator :: <directory-locator>, from-locator :: <directory-locator>)
[334] Fix | Delete
=> (merged-locator :: <directory-locator>)
[335] Fix | Delete
if (locator.locator-relative?)
[336] Fix | Delete
let path = concatenate(from-locator.locator-path, locator.locator-path);
[337] Fix | Delete
simplify-locator
[338] Fix | Delete
(make(object-class(locator),
[339] Fix | Delete
server: from-locator.locator-server,
[340] Fix | Delete
path: path,
[341] Fix | Delete
relative?: from-locator.locator-relative?))
[342] Fix | Delete
else
[343] Fix | Delete
locator
[344] Fix | Delete
end
[345] Fix | Delete
end method merge-locators;
[346] Fix | Delete
[347] Fix | Delete
define method merge-locators
[348] Fix | Delete
(locator :: <file-locator>, from-locator :: <directory-locator>)
[349] Fix | Delete
=> (merged-locator :: <file-locator>)
[350] Fix | Delete
let directory = locator.locator-directory;
[351] Fix | Delete
let merged-directory
[352] Fix | Delete
= if (directory)
[353] Fix | Delete
merge-locators(directory, from-locator)
[354] Fix | Delete
else
[355] Fix | Delete
simplify-locator(from-locator)
[356] Fix | Delete
end;
[357] Fix | Delete
if (merged-directory ~= directory)
[358] Fix | Delete
make(object-class(locator),
[359] Fix | Delete
directory: merged-directory,
[360] Fix | Delete
base: locator.locator-base,
[361] Fix | Delete
extension: locator.locator-extension)
[362] Fix | Delete
else
[363] Fix | Delete
locator
[364] Fix | Delete
end
[365] Fix | Delete
end method merge-locators;
[366] Fix | Delete
[367] Fix | Delete
define method merge-locators
[368] Fix | Delete
(locator :: <physical-locator>, from-locator :: <file-locator>)
[369] Fix | Delete
=> (merged-locator :: <physical-locator>)
[370] Fix | Delete
let from-directory = from-locator.locator-directory;
[371] Fix | Delete
if (from-directory)
[372] Fix | Delete
merge-locators(locator, from-directory)
[373] Fix | Delete
else
[374] Fix | Delete
locator
[375] Fix | Delete
end
[376] Fix | Delete
end method merge-locators;
[377] Fix | Delete
[378] Fix | Delete
/// Locator protocols
[379] Fix | Delete
[380] Fix | Delete
define sideways method supports-open-locator?
[381] Fix | Delete
(locator :: <file-locator>) => (openable? :: <boolean>)
[382] Fix | Delete
~locator.locator-relative?
[383] Fix | Delete
end method supports-open-locator?;
[384] Fix | Delete
[385] Fix | Delete
define sideways method open-locator
[386] Fix | Delete
(locator :: <file-locator>, #rest keywords, #key, #all-keys)
[387] Fix | Delete
=> (stream :: <stream>)
[388] Fix | Delete
apply(open-file-stream, locator, keywords)
[389] Fix | Delete
end method open-locator;
[390] Fix | Delete
</textarea></div>
[391] Fix | Delete
[392] Fix | Delete
<script>
[393] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
[394] Fix | Delete
mode: "text/x-dylan",
[395] Fix | Delete
lineNumbers: true,
[396] Fix | Delete
matchBrackets: true,
[397] Fix | Delete
continueComments: "Enter",
[398] Fix | Delete
extraKeys: {"Ctrl-Q": "toggleComment"},
[399] Fix | Delete
tabMode: "indent",
[400] Fix | Delete
indentUnit: 2
[401] Fix | Delete
});
[402] Fix | Delete
</script>
[403] Fix | Delete
[404] Fix | Delete
<p><strong>MIME types defined:</strong> <code>text/x-dylan</code>.</p>
[405] Fix | Delete
</article>
[406] Fix | Delete
[407] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function