/* * CUE sheetの拡張子クラス * */ function class_cue() { this.name = 'cue'; this.parent = 'srcfile'; this.ext = '\\.cue$'; this.keywords = new Array( 'TITLE' , 'PERFORMER' , 'REM' , 'FILE' , 'WAVE' , 'BIN' , 'BINARY' , 'CATALOG' , 'ISRC' , 'FLAGS DCP' , 'PREGAP' ); this.keywords_add=new Array( 'TRACK', 'INDEX 00' , 'INDEX 01' , 'AUDIO' , 'DATA' ); this.remsub = new Array( 'COMMENT' , 'DISCID' , 'GENRE' , 'DATE' ); } var f = class_cue.prototype; f.onInitProp = function (arg, classname, methodname) { var lex = App.Lexes.Add('cue'); App.Prop(this.name, 'lex') = lex.name; //自動補完を開始するまでの文字数 App.Prop(this.name, 'auto-completion-delay-count') = 3; lex.DefaultStyle(1) = 'exstyle:デフォルト'; lex.Add( 'literal', '1/"([^"]|\\\\")*"/', 'exstyle:リテラル-文字列'); lex.Add( 'time', '1/[0-9][0-9]\\:[0-9][0-9]\\:[0-9][0-9]/', 'exstyle:TIME'); lex.Add( 'indexes', '1/INDEX [0-9][0-9]/', 'exstyle:INDEX'); lex.Add( 'track', '1/TRACK [0-9][0-9] (AUDIO|DATA)/', 'exstyle:TRACK'); lex.AddKeywords( 'keyword', '1/' + this.keywords.join(' ') + '/', 'exstyle:キーワード'); /* lex.AddKeywords( 'remsub', '1/' + this.remsub.join(' ') + '/', 'exstyle:REM項目'); */ lex.Add( 'remsub',// // '1/((' + this.remsub.join(')|(') + ')|(DISCID [0-9A-Z]+$)|(DATE (([0-9][0-9][0-9][0-9])|([0-9][0-9][0-9][0-9]\\/[0-9][0-9]\\/[0-9][0-9]))$))/', '1/(' + this.remsub.join('|') + '|DISCID [0-9A-Z]+$|DATE ([0-9][0-9][0-9][0-9]|[0-9][0-9][0-9][0-9]\\/(0?[1-9]|1[0-2])\\/(0?[1-9]|[12][0-9]|30|31))$)/', 'exstyle:REM項目'); lex.Add( 'catalog,ISRC', '1/[0-9]+|JP[0-9A-Z]+/', 'exstyle:NUMBER'); }; f.onCompleteRequest = function (arg, classname, methodname) { var lp = getLeftParagraph(); App.CompletionList.Clear(); if(lp.match(/REM $/)){ App.CompletionList.Add( 'identifier', this.remsub.join('\n')); }else{ App.CompletionList.Add( 'keyword', this.keywords.join('\n')+'\n'+this.keywords_add.join('\n')); } /* App.CompletionList.Add( 'identifier', getDynCompletionCandidates(*/ // /'([^']|\\')*'|"([^"]|\\")*"'/g, // /[_a-zA-Z][_a-zA-Z0-9]*/g).join('\n')); App.CompletionList.Popup( App.Prop(this.name, 'completion-case-sensitive')); }; f.onKeyPrintable = function (arg, classname, methodname) { invoke(arg, this.parent, methodname); if (!App.CompletionList.Active) { var needcompletion = false; var delaychars; if (arg.match(/[_a-zA-Z0-9]/) && (delaychars = App.Prop(classname, 'auto-completion-delay-count') - 0) >= 0 && getLeftParagraph().match(/([_a-zA-Z][_a-zA-Z0-9]*)$/) && RegExp.$1.length >= delaychars) { needcompletion = true; } else if (getLeftParagraph().match(/REM $/) && App.Prop(classname, 'member-completion-enabled')) { needcompletion = true; } if (needcompletion) { var ls = App.Caret.LexState(App.Caret.Col - 1); if (ls.Name == 'cue' && ls.State == 1) invoke(arg, classname, 'onCompleteRequest'); } } }; f.onKeySpace = function (arg, classname, methodname) { switch (arg & KEYMASK) { case KEYMASK_CTRL: invoke(arg, classname, 'onCompleteRequest'); break; default: invoke(arg, this.parent, methodname); break; } }; addClass(new class_cue());