{ scopeName = 'source.praat'; fileTypes = ( 'praat', 'psc' ); foldingStartMarker = '^\s*(if|form|repeat|procedure|for|while|beginPause)\b.*$'; foldingStopMarker = '^\s*(endif|endform|until|endproc|endfor|endwhile|endPause)\b.*$'; patterns = ( { name = 'variable.parameter.praat'; comment = 'variable substitution'; match = "'\w+?\$?'"; }, { name = 'keyword.control.praat'; comment = 'flow control'; match = '^\s*\b(if|else|elsif|elif|endif|for|endfor|endform|while|endwhile|repeat|until|procedure|endproc|beginPause|endPause|editor|endeditor|Close|call)\b'; }, { comment = 'for...from...to is special'; match = '(?<=for ).*?(?:(from).+){0,1}( to )\b'; captures = { 1 = { name = 'keyword.control.praat'; }; 2 = { name = 'keyword.control.praat'; }; }; }, { comment = 'treat text following "form" as string'; match = '^\s*(form)\b\s+(.+)$'; captures = { 1 = { name = 'keyword.control.praat'; }; 2 = { name = 'string.quoted.single.praat'; }; }; }, { contentName = 'string.quoted.double.praat'; comment = 'commands with 1 argument + string argument'; begin = "^\s*(demo )*((?:fileappend)|(?:Text (?:top|bottom|left|right)\.\.\.))\s+?(?:('\S+?')|(\S+?))\s+?"; end = '$'; beginCaptures = { 1 = { name = 'keyword.control.import'; }; 2 = { name = 'keyword.other.praat'; }; 3 = { name = 'variable.parameter.praat'; }; 4 = { name = ''; }; }; patterns = ( { name = 'variable.parameter.praat'; comment = 'recognize variable substitution in quoted strings'; match = "'\w+?\$?'"; }, ); }, { contentName = 'string.quoted.double.praat'; comment = 'commands with 2 arguments + string argument'; begin = "^\s*((?:Set string value\.\.\.)|(?:Set interval text\.\.\.))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?"; end = '$'; beginCaptures = { 1 = { name = 'keyword.other.praat'; }; 2 = { name = 'variable.parameter.praat'; }; 3 = { name = ''; }; 4 = { name = 'variable.parameter.praat'; }; 5 = { name = ''; }; }; patterns = ( { name = 'variable.parameter.praat'; comment = 'recognize variable substitution in quoted strings'; match = "'\w+?\$?'"; }, ); }, { contentName = 'string.quoted.double.praat'; comment = 'commands with 4 arguments + string argument'; begin = "^\s*(demo )*((?:Text\.\.\.)|(?:One mark (?:top|bottom|left|right)\.\.\.))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?"; end = '$'; beginCaptures = { 1 = { name = 'keyword.control.import'; }; 2 = { name = 'keyword.other.praat'; }; 3 = { name = 'variable.parameter.praat'; }; 4 = { name = ''; }; 5 = { name = 'variable.parameter.praat'; }; 6 = { name = ''; }; 7 = { name = 'variable.parameter.praat'; }; 8 = { name = ''; }; 9 = { name = 'variable.parameter.praat'; }; 10 = { name = ''; }; }; patterns = ( { name = 'variable.parameter.praat'; comment = 'recognize variable substitution in quoted strings'; match = "'\w+?\$?'"; }, ); }, { contentName = 'string.quoted.double.praat'; comment = 'commands with 7 arguments + string argument'; begin = "^\s*(demo )*(Text special\.\.\.)\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?(?:('\S+?')|(\S+?))\s+?"; end = '$'; beginCaptures = { 1 = { name = 'keyword.control.import'; }; 2 = { name = 'keyword.other.praat'; }; 3 = { name = 'variable.parameter.praat'; }; 4 = { name = ''; }; 5 = { name = 'variable.parameter.praat'; }; 6 = { name = ''; }; 7 = { name = 'variable.parameter.praat'; }; 8 = { name = ''; }; 9 = { name = 'variable.parameter.praat'; }; 10 = { name = ''; }; 11 = { name = 'variable.parameter.praat'; }; 12 = { name = ''; }; 13 = { name = 'variable.parameter.praat'; }; 14 = { name = ''; }; 15 = { name = 'variable.parameter.praat'; }; 16 = { name = ''; }; }; patterns = ( { name = 'variable.parameter.praat'; comment = 'recognize variable substitution in quoted strings'; match = "'\w+?\$?'"; }, ); }, { name = 'markup.list.praat'; comment = 'catch names of procedures'; match = '(?<=call |procedure )\S+'; }, { name = 'comment.line.number-sign.praat'; match = '^\s*#.*$'; }, { comment = 'highlight goto/label'; match = '^\s*(goto|label) (.+)$'; captures = { 1 = { name = 'keyword.control.praat'; }; 2 = { name = 'constant.other.praat'; }; }; }, { name = 'variable.language.praat'; match = '\bself\b'; }, { name = 'support.function.praat'; comment = 'recognize build-in functions'; match = '(?<=\=)\s*?\w+\$?(?= ?\([^\)]*\))'; }, { name = 'support.function.praat'; comment = 'more function-like stuff'; match = '\b(fileReadable|createDirectory|deleteFile|numberOfSelected|stopwatch|demoWaitForInput|demoClickedIn)(?= ?\()'; }, { comment = " uncomment to markup variables (works well with string variables, not so well with numeric variables) { name = 'variable.other.praat'; match = '\b[a-z]{1}\w+\$(?! *\()'; }, { name = 'variable.other.praat'; match = '^\s*\b[a-z]{1}\w+(?= *=)'; }, "; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla keyword bla bla... keyword... keyword '; match = '\b(Add|Append|Draw|Filter|Play|Edit)( [^\.]+$| [^\.]+\.\.\. |\.\.\. |\s*$)'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla keyword bla bla... keyword... '; match = '\b(Copy|Formula|Learn|Scale|Select|Stylize|Voice)( [^\.]+$| [^\.]+\.\.\. |\.\.\. )'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla keyword bla bla... keyword '; match = '\b(Remove)( [^\.]+$| [^\.]+\.\.\. |\s*$)'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla... keyword... keyword '; match = '\b(Multiply|Sort)( [^\.]+\.\.\. |\.\.\. |\s*$)'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla keyword bla bla... '; match = '\b(Create|Down|Extract|Generate|Get|Insert|Interpolate|Log|Move|Read|Report|Set|Shift|Show|Subtract|To|Write)( [^\.]+$| [^\.]+\.\.\. )'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla... keyword... '; match = '\b(Normalize|Paint|Speckle|Viewport|Change|Font|Reset)( [^\.]+\.\.\. |\.\.\. )'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla... keyword '; match = '\b(Invert)( [^\.]+\.\.\. |\s*$)'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla keyword... '; match = '\b(Zoom|Evaluate|Fill)( [^\.]+$|\.\.\. )'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla keyword '; match = '\b(View|Merge|Reverse)( [^\.]+$|\s*$)'; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla... '; match = '\b(Horizontal|Input[s]?|Is|Logarithmic|Marks|One|Scatter|Search|Up to|Vertical|Sound input|Sound output|Advanced|Cepstral|PostScript|Record|Truncate|Weights) [^\.]+\.\.\. '; }, { name = 'keyword.other.praat'; comment = ' keyword... '; match = '\b(Rename|Resample|Axes|Buttons|Calculator|Line width)\.\.\. '; }, { name = 'keyword.other.praat'; comment = ' keyword bla bla '; match = '\b(Pulses|Replace) [^\.]+$'; }, { name = 'constant.character.praat'; comment = 'special directives'; match = '\b(nowarn|assert|noprogress|nocheck|execute)\b'; }, { comment = 'conditionals in formulas'; begin = '\b(if)\b'; end = '\b(fi)\b'; captures = { 1 = { name = 'constant.character.praat'; }; }; patterns = ( { name = 'constant.character.praat'; match = ' (and|or|then|else) '; }, { name = 'variable.language.praat'; match = '\bself\b'; }, { name = 'support.function.praat'; comment = 'recognize build-in mathematical functions'; match = '\b[a-z]\w+?(?= ?\()'; }, ); }, { contentName = 'string.quoted.single.praat'; comment = 'treat text following print-like commands as unquoted strings'; begin = '^\s*(printline|print|exit|pause|echo|comment|Text width .{4}\.\.\. )\b'; end = '$'; beginCaptures = { 1 = { name = 'keyword.other.praat'; }; }; patterns = ( { name = 'variable.parameter.praat'; comment = 'recognize variable substitution'; match = "'\w+?\$?'"; }, ); }, { name = 'keyword.other.praat'; comment = 'misc stuff'; match = '^\s*\b(clearinfo|printtab|select all|select|plus|minus|filedelete|fappendinfo|include|system|system_nocheck|sendsocket|Sound & Pulses -- Pitch & Duration.+|Sound autoscaling|LPC -- Pitch.+|LPC smoothing\.\.\.|Into TextGrid)\b'; }, { contentName = ''; comment = 'field types in forms'; begin = '^\s*(real|positive|integer|natural|word|sentence|text|boolean|choice|button|optionmenu|optionMenu|option)\b'; end = '$'; beginCaptures = { 1 = { name = 'keyword.other.praat'; }; }; patterns = ( { name = 'variable.parameter.praat'; comment = 'recognize variable substitution'; match = "'\w+?\$?'"; }, ); }, { comment = 'picture window: simple commands'; match = '^\s*(demo )?\b(Plain line$|Dashed line$|Dotted line$|Erase all$|10$|12$|14$|18$|24$|Times$|Helvetica$|Palatino$|Courier$|New Century Schoolbook$|Black$|Blue$|Cyan$|Green$|Grey$|Lime$|Magenta$|Maroon$|Navy$|Olive$|Purple$|Red$|Silver$|White$|Yellow$)\b'; captures = { 1 = { name = 'keyword.control.import'; }; 2 = { name = 'keyword.other.praat'; }; }; }, { name = 'keyword.control.import'; match = '^\s*demo '; }, { name = 'constant.other.praat'; comment = 'object types'; match = '(?<=[a-z] )\b(TextGrid|Sound|LongSound|Spectrogram|Spectrum|Pitch|PitchTier|PointProcess|Formant|Intensity|TableOfReal|Table|LPC|Discriminant|Manipulation|DurationTier) (?=[^$])'; }, { name = 'keyword.other.praat'; comment = 'special treatment for object type names in ordinary commands'; match = '\b(Intensity|Pitch|Formant) (listing|settings\.\.\.) '; }, { name = 'string.quoted.double.praat'; begin = '"'; end = '"'; patterns = ( { name = 'variable.parameter.praat'; comment = 'recognize variable substitution in quoted strings'; match = "'\w+?\$?'"; }, ); }, { name = 'keyword.other.praat'; comment = 'the rest / todo'; match = '\b(Align eigenvectors|Centralize|Centre columns|Centre rows|Collect to Table|Compute trend line\.\.\.|Concatenate|Concatenate recoverably|Condense\.\.\.|Confidence intervals\.\.\.|Conflate|Conjugate|Convolve|Count differences|Count labels\.\.\.|Count voiced frames|Covariance help|Cross-correlate\.\.\.|Cut|De-emphasize \(in-line\)\.\.\.|Debug\.\.\.|Deepen band modulation\.\.\.|Delete log file 1|Delete log file 2|Difference|Difference\.\.\.|Divide\.\.\.|Double centre|Duplicate tier\.\.\.|Eigen|End to centre\.\.\.|Equalize intensities\.\.\.|Extend time\.\.\.|Find path\.\.\.|Forget duration|Forward|Genericize|Has word\.\.\.|Hide action command\.\.\.|Hide menu command\.\.\.|Hum|Info|Inspect|Interpolate|Interrupt playing|Intersection|Join|Kill octave jumps|Lengthen \(PSOLA\)\.\.\.|Map|Measure typology|Monotone regression\.\.\.|Movie|Nativize|New duration|Next not allowed word\.\.\.|Object window|Open long sound file\.\.\.|Override sample rate\.\.\.|PCA help|Page down|Page up|Paste after selection|Permute\.\.\.|Polish roots|Power\.\.\.|Praat test\.\.\.|Pre-emphasize \(in-line\)\.\.\.|Predict\.\.\.|Print page\.\.\.|Print\.\.\.|Programming|Project|Project\.\.\.|Publish resynthesis|Pulse listing|Quit|Randomize|Rotate \(pc\)|Rotate\.\.\.|Run|Run script\.\.\.|Scroll page back|Scroll page forward|Settings report|Smooth\.\.\.|Solve equation\.\.\.|Spectrogram settings\.\.\.|Split into Pattern and Categories\.\.\.|Standardize columns|Standardize rows|Start to centre\.\.\.|Statistics\.\.\.|Stop playing sound|Sum|Teal|Test sorting\.\.\.|Time step settings\.\.\.|Track\.\.\.|Translate\.\.\.|Transplant time domain|Transpose|Types of objects|Undo|Union)\b'; }, { name = 'constant.other.praat'; comment = 'continue command on new line'; match = '^\s*\.\.\. '; }, ); }