Skip to content

Commit

Permalink
Split backquote definitions into a separate file.
Browse files Browse the repository at this point in the history
This is in preparation for auto-generating them from the same source as
the Dyalog Windows IME.
  • Loading branch information
jayfoad committed Oct 19, 2017
1 parent e84f869 commit c27ba14
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 115 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@
<script src=src/prf_menu.js ></script>
<script src=src/ed.js ></script>
<script src=src/se.js ></script>
<script src=src/bq.js ></script>
<script src=src/km.js ></script>
<script src=src/ide.js ></script>
<script src=src/ipc.js ></script>
Expand Down
181 changes: 181 additions & 0 deletions src/bq.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
D.sqglDesc={
'←':'Left Arrow',
'+':'Plus',
'-':'Minus',
'×':'Times',
'÷':'Divide',
'*':'Star',
'⍟':'Log',
'⌹':'Domino',
'○':'Circle',
'!':'Exclamation Mark',
'?':'Question Mark',
'|':'Stile',
'⌈':'Upstile',
'⌊':'Downstile',
'⊥':'Up Tack',
'⊤':'Down Tack',
'⊣':'Left Tack',
'⊢':'Right Tack',
'=':'Equal',
'≠':'Not Equal',
'≤':'Less Than Or Equal To',
'<':'Less Than',
'>':'Greater Than',
'≥':'Greater Than Or Equal To',
'≡':'Equal Underbar',
'≢':'Equal Underbar Slash',
'∧':'Logical AND',
'∨':'Logical OR',
'⍲':'Logical NAND',
'⍱':'Logical NOR',
'↑':'Up Arrow',
'↓':'Down Arrow',
'⊂':'Left Shoe',
'⊃':'Right Shoe',
'⌷':'Squad',
'⍋':'Grade Up',
'⍒':'Grade Down',
'⍳':'Iota',
'⍷':'Epsilon Underbar',
'∪':'Down Shoe',
'∩':'Up Shoe',
'∊':'Epsilon',
'~':'Tilde',
'/':'Slash',
'\\':'',
'⌿':'Slash Bar',
'⍀':'Backslash Bar',
',':'Comma',
'⍪':'Comma Bar',
'⍴':'Rho',
'⌽':'Circle Stile',
'⊖':'Circle Bar',
'⍉':'Transpose',
'¨':'Diaeresis',
'⍨':'Tilde Diaeresis',
'⍣':'Star Diaeresis',
'.':'Dot',
'∘':'Jot',
'⍤':'Jot Diaeresis',
'⍞':'Quote Quad',
'⎕':'Quad',
'⍠':'Quad Colon',
'⌸':'Quad Equal',
'⍎':'Hydrant',
'⍕':'Thorn',
'⋄':'Diamond',
'⍝':'Lamp',
'→':'Right Arrow',
'⍵':'Omega',
'⍺':'Alpha',
'∇':'Del',
'&':'Ampersand',
'¯':'High Minus',
'⍬':'Zilde',
'⌶':'I-Beam',
'¤':'',
'∥':'',
'∆':'',
'⍙':'',
'⍥':'',
'⍫':'',
'Á':'',
'⍸':'Iota Underbar',
'⊆':'Left Shoe Underbar',
'@':'At',
'⌺':'Quad Diamond',
}

//backquote-backquote name completions
//mentioned in http://wiki.dyalog.bramley/index.php/New_Glyphs
D.informal=[
//'squiggle alias0 alias1 ...'
'← leftarrow assign gets is copula',
'+ plus add conjugate mate',
'- minus hyphen subtract negate',
'× cross times multiply sgn signum direction',
'÷ divide reciprocal obelus',
'* star asterisk power exponential',
'⍟ logarithm naturallogarithm circlestar starcircle splat',
'⌹ domino matrixdivide matrixinverse quaddivide leastsquares',
'○ pi circular trigonometric hyperbolic complex imaginary',
'! exclamation bang shriek factorial binomial combinations',
'? question roll deal random',
'| stile stroke verticalline modulo abs magnitude residue remainder',
'⌈ upstile maximum ceiling',
'⌊ downstile minimum floor',
'⊥ base decode uptack',
'⊤ antibase encode downtack representation',
'⊣ left lev lefttack sameleft',
'⊢ right dex righttack sameright',
'= equal xnor logicalxnor',
'≠ ne notequal xor logicalxor',
'≤ le lessorequal fore logicalimplication',
'< lessthan before',
'> greaterthan after',
'≥ ge greaterorequal aft',
'≡ match equalunderbar identical depth',
'≢ notmatch natch equalunderbarslash notidentical tally',
'∧ and conjunction lcm logicaland lowestcommonmultiple caret',
'∨ or disjunction gcd vel logicalor greatestcommondivisor hcf highestcommonfactor',
'⍲ nand notand andtilde logicalnand carettilde',
'⍱ nor notor ortilde logicalnor',
'↑ uparrow mix take',
'↓ downarrow split drop',
'⊂ enclose leftshoe partitionedenclose',
'⊃ disclose rightshoe pick first',
'⌷ squishquad squad index default materialise',
'⍋ gradeup deltastile upgrade pine',
'⍒ gradedown delstile downgrade spine',
'⍳ iota indices indexof',
'⍷ find epsilonunderbar',
'∪ cup union unique downshoe distinct',
'∩ cap intersection upshoe',
'∊ epsilon in membership enlist flatten type',
'~ tilde not logicalnot without except',
'/ slash reduce fold insert select compress replicate solidus',
'\\ backslash slope scan expand cumulativereduce',
'⌿ slashbar reducefirst foldfirst insertfirst',
'⍀ slopebar backslashbar scanfirst expandfirst',
', comma catenate laminate ravel concatenate',
'⍪ commabar table catenatefirst concatenatefirst',
'⍴ rho shape reshape',
'⌽ reverse rotate circlestile',
'⊖ reversefirst rotatefirst circlebar rowel upset',
'⍉ transpose circlebackslash cant diagonal',
'¨ each diaeresis',
'⍨ commute switch selfie tildediaeresis swap',
'⍣ poweroperator stardiaeresis powerlimit fixedpoint fixpoint converge while',
'. dotproduct innerproduct namespaceseparator',
'∘ jot compose bind curry ring outerproduct',
'⍤ jotdiaeresis rank paw',
'⍞ quotequad input output characterinput rawinput',
'⎕ quad evaluatedinput',
'⍠ colonquad quadcolon variant option',
'⌸ equalquad quadequal key group',
'⍎ execute eval uptackjot hydrant',
'⍕ format downtackjot thorn',
'⋄ diamond statementseparator',
'⍝ comment lamp',
'→ rightarrow branch abort goto',
'⍵ omega rightarg',
'⍺ alpha leftarg',
'∇ del recurse triangledown downtriangle carrot',
'& ampersand spawn et',
'¯ macron negative highminus',
'⍬ zilde empty',
'⌶ ibeam',
'¤ currency isolate',
'∥ parallel',
'∆ delta triangleup uptriangle',
'⍙ deltaunderbar',
'⍥ circlediaeresis hoof holler',
'⍫ deltilde',
'Á aacute underscoredalphabet',
'⍸ where intervalindex iotaunderbar',
'⊆ leftshoeunderbar encloseifsimple conditionalenclose partition nest',
'@ at substitute merge amend',
'⌺ diamondquad quaddiamond stencil tessellate tile',
]
for(var i=0;i<26;i++)D.informal.push(String.fromCharCode(i+0x24b6)+' _'+String.fromCharCode(i+0x61/*a*/)) //Ⓐ _a
118 changes: 3 additions & 115 deletions src/km.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,6 @@
D.prf.prefixKey(function(x,old){
if(x!==old){var m=CM.keyMap.dyalogDefault;m["'"+x+"'"]=m["'"+old+"'"];delete m["'"+old+"'"]}
})
var sqglDesc={
'¨':'each' ,'←':'assignment' ,'⊤':'encode (123→1 2 3)','⌹':'matrix inv/div' ,
'¯':'negative' ,'→':'branch' ,'|':'abs/modulo' ,'⍷':'find' ,
'∨':'or (GCD)' ,'⍺':'left argument' ,'⍝':'comment' ,'⍨':'commute' ,
'∧':'and (LCM)' ,'⌈':'ceil/max' ,'⍀':'\\[⎕io]' ,'⍣':'power operator' ,
'×':'signum/times' ,'⌊':'floor/min' ,'⌿':'/[⎕io]' ,'⍞':'char I/O' ,
'÷':'reciprocal/divide','∇':'recur' ,'⋄':'statement sep' ,'⍬':'zilde (⍳0)' ,
'?':'roll/deal' ,'∘':'compose' ,'⌶':'I-beam' ,'⍤':'rank' ,
'⍵':'right argument' ,'⎕':'evaluated input' ,'⍒':'grade down' ,'⌸':'key' ,
'∊':'enlist/membership','⍎':'execute' ,'⍋':'grade up' ,'⌷':'default/index' ,
'⍴':'shape/reshape' ,'⍕':'format' ,'⌽':'reverse/rotate' ,'≡':'depth/match' ,
'~':'not/without' ,'⊢':'right' ,'⍉':'transpose' ,'≢':'tally/not match',
'↑':'mix/take' ,'⊂':'enclose/partition' ,'⊖':'⌽[⎕io]' ,'⊣':'left' ,
'↓':'split/drop' ,'⊃':'disclose/pick' ,'⍟':'logarithm' ,'⍪':'table / ,[⎕io]' ,
'⍳':'indices/index of' ,'∩':'intersection' ,'⍱':'nor' ,'⍠':'variant' ,
'○':'pi/trig' ,'∪':'unique/union' ,'⍲':'nand' ,'⌺':'stencil' ,
'*':'exp/power' ,'⊥':'decode (1 2 3→123)','!':'factorial/binomial','⍸':'where/interval index',
'⊆':'nest/partition'
}

var ctid=0 //backquote completion timeout id
CM.keyMap.dyalogDefault={fallthrough:'default',End:'goLineEndSmart'}
Expand Down Expand Up @@ -145,7 +126,7 @@ $.extend(CM.commands,{
var data={from:c0,to:cm.getCursor(),list:ks.map(function(k){
var v=bq[k];return(k===pk
?{text:'',hint:bqbqHint,render:function(e){e.innerHTML=' '+pk+pk+' <i>completion by name</i>'}}
:{text:v,render:function(x){x.textContent=v+' '+pk+k+' '+(sqglDesc[v]||'')+' '}}
:{text:v,render:function(x){x.textContent=v+' '+pk+k+' '+(D.sqglDesc[v]||'')+' '}}
)
})}
CM.on(data,'select',function(x){sel=x})
Expand Down Expand Up @@ -266,102 +247,9 @@ function bqbqHint(cm){
CM.on(data,'select',function(x){sel=x});return data}})
}

//backquote-backquote name completions
//mentioned in http://wiki.dyalog.bramley/index.php/New_Glyphs
var informal=[
//'squiggle alias0 alias1 ...'
'← leftarrow assign gets is copula',
'+ plus add conjugate mate',
'- minus hyphen subtract negate',
'× cross times multiply sgn signum direction',
'÷ divide reciprocal obelus',
'* star asterisk power exponential',
'⍟ logarithm naturallogarithm circlestar starcircle splat',
'⌹ domino matrixdivide matrixinverse quaddivide leastsquares',
'○ pi circular trigonometric hyperbolic complex imaginary',
'! exclamation bang shriek factorial binomial combinations',
'? question roll deal random',
'| stile stroke verticalline modulo abs magnitude residue remainder',
'⌈ upstile maximum ceiling',
'⌊ downstile minimum floor',
'⊥ base decode uptack',
'⊤ antibase encode downtack representation',
'⊣ left lev lefttack sameleft',
'⊢ right dex righttack sameright',
'= equal xnor logicalxnor',
'≠ ne notequal xor logicalxor',
'≤ le lessorequal fore logicalimplication',
'< lessthan before',
'> greaterthan after',
'≥ ge greaterorequal aft',
'≡ match equalunderbar identical depth',
'≢ notmatch natch equalunderbarslash notidentical tally',
'∧ and conjunction lcm logicaland lowestcommonmultiple caret',
'∨ or disjunction gcd vel logicalor greatestcommondivisor hcf highestcommonfactor',
'⍲ nand notand andtilde logicalnand carettilde',
'⍱ nor notor ortilde logicalnor',
'↑ uparrow mix take',
'↓ downarrow split drop',
'⊂ enclose leftshoe partitionedenclose',
'⊃ disclose rightshoe pick first',
'⌷ squishquad squad index default materialise',
'⍋ gradeup deltastile upgrade pine',
'⍒ gradedown delstile downgrade spine',
'⍳ iota indices indexof',
'⍷ find epsilonunderbar',
'∪ cup union unique downshoe distinct',
'∩ cap intersection upshoe',
'∊ epsilon in membership enlist flatten type',
'~ tilde not logicalnot without except',
'/ slash reduce fold insert select compress replicate solidus',
'\\ backslash slope scan expand cumulativereduce',
'⌿ slashbar reducefirst foldfirst insertfirst',
'⍀ slopebar backslashbar scanfirst expandfirst',
', comma catenate laminate ravel concatenate',
'⍪ commabar table catenatefirst concatenatefirst',
'⍴ rho shape reshape',
'⌽ reverse rotate circlestile',
'⊖ reversefirst rotatefirst circlebar rowel upset',
'⍉ transpose circlebackslash cant diagonal',
'¨ each diaeresis',
'⍨ commute switch selfie tildediaeresis swap',
'⍣ poweroperator stardiaeresis powerlimit fixedpoint fixpoint converge while',
'. dotproduct innerproduct namespaceseparator',
'∘ jot compose bind curry ring outerproduct',
'⍤ jotdiaeresis rank paw',
'⍞ quotequad input output characterinput rawinput',
'⎕ quad evaluatedinput',
'⍠ colonquad quadcolon variant option',
'⌸ equalquad quadequal key group',
'⍎ execute eval uptackjot hydrant',
'⍕ format downtackjot thorn',
'⋄ diamond statementseparator',
'⍝ comment lamp',
'→ rightarrow branch abort goto',
'⍵ omega rightarg',
'⍺ alpha leftarg',
'∇ del recurse triangledown downtriangle carrot',
'& ampersand spawn et',
'¯ macron negative highminus',
'⍬ zilde empty',
'⌶ ibeam',
'¤ currency isolate',
'∥ parallel',
'∆ delta triangleup uptriangle',
'⍙ deltaunderbar',
'⍥ circlediaeresis hoof holler',
'⍫ deltilde',
'Á aacute underscoredalphabet',
'⍸ where intervalindex iotaunderbar',
'⊆ leftshoeunderbar encloseifsimple conditionalenclose partition nest',
'@ at substitute merge amend',
'⌺ diamondquad quaddiamond stencil tessellate tile'
]
for(var i=0;i<26;i++)informal.push(String.fromCharCode(i+0x24b6)+' _'+String.fromCharCode(i+0x61/*a*/)) //Ⓐ _a

var bqbqc=[] //backquote-backquote completions
for(var i=0;i<informal.length;i++){
var a=informal[i].split(' ')
for(var i=0;i<D.informal.length;i++){
var a=D.informal[i].split(' ')
for(var j=1;j<a.length;j++)bqbqc.push({name:a[j],text:a[0],render:
(function(squiggle,name){ //bind squiggle=a[0] and name=a[j]
return function(x){var key=D.getBQKeyFor(squiggle),pk=D.prf.prefixKey() //the actual .render() function
Expand Down

0 comments on commit c27ba14

Please sign in to comment.