25 |
25 |
26 name = 'Praat' |
26 name = 'Praat' |
27 aliases = ['praat'] |
27 aliases = ['praat'] |
28 filenames = ['*.praat', '*.proc', '*.psc'] |
28 filenames = ['*.praat', '*.proc', '*.psc'] |
29 |
29 |
30 keywords = [ |
30 keywords = ( |
31 'if', 'then', 'else', 'elsif', 'elif', 'endif', 'fi', 'for', 'from', 'to', |
31 'if', 'then', 'else', 'elsif', 'elif', 'endif', 'fi', 'for', 'from', 'to', |
32 'endfor', 'endproc', 'while', 'endwhile', 'repeat', 'until', 'select', 'plus', |
32 'endfor', 'endproc', 'while', 'endwhile', 'repeat', 'until', 'select', 'plus', |
33 'minus', 'demo', 'assert', 'stopwatch', 'nocheck', 'nowarn', 'noprogress', |
33 'minus', 'demo', 'assert', 'stopwatch', 'nocheck', 'nowarn', 'noprogress', |
34 'editor', 'endeditor', 'clearinfo', |
34 'editor', 'endeditor', 'clearinfo', |
35 ] |
35 ) |
36 |
36 |
37 functions_string = [ |
37 functions_string = ( |
38 'backslashTrigraphsToUnicode', 'chooseDirectory', 'chooseReadFile', |
38 'backslashTrigraphsToUnicode', 'chooseDirectory', 'chooseReadFile', |
39 'chooseWriteFile', 'date', 'demoKey', 'do', 'environment', 'extractLine', |
39 'chooseWriteFile', 'date', 'demoKey', 'do', 'environment', 'extractLine', |
40 'extractWord', 'fixed', 'info', 'left', 'mid', 'percent', 'readFile', 'replace', |
40 'extractWord', 'fixed', 'info', 'left', 'mid', 'percent', 'readFile', 'replace', |
41 'replace_regex', 'right', 'selected', 'string', 'unicodeToBackslashTrigraphs', |
41 'replace_regex', 'right', 'selected', 'string', 'unicodeToBackslashTrigraphs', |
42 ] |
42 ) |
43 |
43 |
44 functions_numeric = [ |
44 functions_numeric = ( |
45 'abs', 'appendFile', 'appendFileLine', 'appendInfo', 'appendInfoLine', 'arccos', |
45 'abs', 'appendFile', 'appendFileLine', 'appendInfo', 'appendInfoLine', 'arccos', |
46 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'barkToHertz', |
46 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'barkToHertz', |
47 'beginPause', 'beginSendPraat', 'besselI', 'besselK', 'beta', 'beta2', |
47 'beginPause', 'beginSendPraat', 'besselI', 'besselK', 'beta', 'beta2', |
48 'binomialP', 'binomialQ', 'boolean', 'ceiling', 'chiSquareP', 'chiSquareQ', |
48 'binomialP', 'binomialQ', 'boolean', 'ceiling', 'chiSquareP', 'chiSquareQ', |
49 'choice', 'comment', 'cos', 'cosh', 'createDirectory', 'deleteFile', |
49 'choice', 'comment', 'cos', 'cosh', 'createDirectory', 'deleteFile', |
65 'round', 'runScript', 'runSystem', 'runSystem_nocheck', 'selectObject', |
65 'round', 'runScript', 'runSystem', 'runSystem_nocheck', 'selectObject', |
66 'selected', 'semitonesToHertz', 'sentencetext', 'sigmoid', 'sin', 'sinc', |
66 'selected', 'semitonesToHertz', 'sentencetext', 'sigmoid', 'sin', 'sinc', |
67 'sincpi', 'sinh', 'soundPressureToPhon', 'sqrt', 'startsWith', 'studentP', |
67 'sincpi', 'sinh', 'soundPressureToPhon', 'sqrt', 'startsWith', 'studentP', |
68 'studentQ', 'tan', 'tanh', 'variableExists', 'word', 'writeFile', 'writeFileLine', |
68 'studentQ', 'tan', 'tanh', 'variableExists', 'word', 'writeFile', 'writeFileLine', |
69 'writeInfo', 'writeInfoLine', |
69 'writeInfo', 'writeInfoLine', |
70 ] |
70 ) |
71 |
71 |
72 functions_array = [ |
72 functions_array = ( |
73 'linear', 'randomGauss', 'randomInteger', 'randomUniform', 'zero', |
73 'linear', 'randomGauss', 'randomInteger', 'randomUniform', 'zero', |
74 ] |
74 ) |
75 |
75 |
76 objects = [ |
76 objects = ( |
77 'Activation', 'AffineTransform', 'AmplitudeTier', 'Art', 'Artword', |
77 'Activation', 'AffineTransform', 'AmplitudeTier', 'Art', 'Artword', |
78 'Autosegment', 'BarkFilter', 'BarkSpectrogram', 'CCA', 'Categories', |
78 'Autosegment', 'BarkFilter', 'BarkSpectrogram', 'CCA', 'Categories', |
79 'Cepstrogram', 'Cepstrum', 'Cepstrumc', 'ChebyshevSeries', 'ClassificationTable', |
79 'Cepstrogram', 'Cepstrum', 'Cepstrumc', 'ChebyshevSeries', 'ClassificationTable', |
80 'Cochleagram', 'Collection', 'ComplexSpectrogram', 'Configuration', 'Confusion', |
80 'Cochleagram', 'Collection', 'ComplexSpectrogram', 'Configuration', 'Confusion', |
81 'ContingencyTable', 'Corpus', 'Correlation', 'Covariance', |
81 'ContingencyTable', 'Corpus', 'Correlation', 'Covariance', |
98 'Similarity', 'SimpleString', 'SortedSetOfString', 'Sound', 'Speaker', |
98 'Similarity', 'SimpleString', 'SortedSetOfString', 'Sound', 'Speaker', |
99 'Spectrogram', 'Spectrum', 'SpectrumTier', 'SpeechSynthesizer', 'SpellingChecker', |
99 'Spectrogram', 'Spectrum', 'SpectrumTier', 'SpeechSynthesizer', 'SpellingChecker', |
100 'Strings', 'StringsIndex', 'Table', 'TableOfReal', 'TextGrid', 'TextInterval', |
100 'Strings', 'StringsIndex', 'Table', 'TableOfReal', 'TextGrid', 'TextInterval', |
101 'TextPoint', 'TextTier', 'Tier', 'Transition', 'VocalTract', 'VocalTractTier', |
101 'TextPoint', 'TextTier', 'Tier', 'Transition', 'VocalTract', 'VocalTractTier', |
102 'Weight', 'WordList', |
102 'Weight', 'WordList', |
103 ] |
103 ) |
104 |
104 |
105 variables_numeric = [ |
105 variables_numeric = ( |
106 'macintosh', 'windows', 'unix', 'praatVersion', 'pi', 'e', 'undefined', |
106 'macintosh', 'windows', 'unix', 'praatVersion', 'pi', 'e', 'undefined', |
107 ] |
107 ) |
108 |
108 |
109 variables_string = [ |
109 variables_string = ( |
110 'praatVersion', 'tab', 'shellDirectory', 'homeDirectory', |
110 'praatVersion', 'tab', 'shellDirectory', 'homeDirectory', |
111 'preferencesDirectory', 'newline', 'temporaryDirectory', |
111 'preferencesDirectory', 'newline', 'temporaryDirectory', |
112 'defaultDirectory', |
112 'defaultDirectory', |
113 ] |
113 ) |
114 |
114 |
115 tokens = { |
115 tokens = { |
116 'root': [ |
116 'root': [ |
117 (r'(\s+)(#.*?$)', bygroups(Text, Comment.Single)), |
117 (r'(\s+)(#.*?$)', bygroups(Text, Comment.Single)), |
118 (r'^#.*?$', Comment.Single), |
118 (r'^#.*?$', Comment.Single), |
149 'command': [ |
149 'command': [ |
150 (r'( ?[\w()-]+ ?)', Keyword), |
150 (r'( ?[\w()-]+ ?)', Keyword), |
151 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
151 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
152 (r'\.{3}', Keyword, ('#pop', 'old_arguments')), |
152 (r'\.{3}', Keyword, ('#pop', 'old_arguments')), |
153 (r':', Keyword, ('#pop', 'comma_list')), |
153 (r':', Keyword, ('#pop', 'comma_list')), |
154 (r'[\s\n]', Text, '#pop'), |
154 (r'\s', Text, '#pop'), |
155 ], |
155 ], |
156 'procedure_call': [ |
156 'procedure_call': [ |
157 (r'\s+', Text), |
157 (r'\s+', Text), |
158 (r'([\w.]+)(:|\s*\()', |
158 (r'([\w.]+)(:|\s*\()', |
159 bygroups(Name.Function, Text), '#pop'), |
159 bygroups(Name.Function, Text), '#pop'), |
166 (r'([\w.]+)([^\n]*)', |
166 (r'([\w.]+)([^\n]*)', |
167 bygroups(Name.Function, Text), '#pop'), |
167 bygroups(Name.Function, Text), '#pop'), |
168 ], |
168 ], |
169 'function_call': [ |
169 'function_call': [ |
170 (words(functions_string, suffix=r'\$(?=\s*[:(])'), Name.Function, 'function'), |
170 (words(functions_string, suffix=r'\$(?=\s*[:(])'), Name.Function, 'function'), |
171 (words(functions_array, suffix=r'#(?=\s*[:(])'), Name.Function, 'function'), |
171 (words(functions_array, suffix=r'#(?=\s*[:(])'), Name.Function, 'function'), |
172 (words(functions_numeric, suffix=r'(?=\s*[:(])'), Name.Function, 'function'), |
172 (words(functions_numeric, suffix=r'(?=\s*[:(])'), Name.Function, 'function'), |
173 ], |
173 ], |
174 'function': [ |
174 'function': [ |
175 (r'\s+', Text), |
175 (r'\s+', Text), |
176 (r':', Punctuation, ('#pop', 'comma_list')), |
176 (r':', Punctuation, ('#pop', 'comma_list')), |
177 (r'\s*\(', Punctuation, ('#pop', 'comma_list')), |
177 (r'\s*\(', Punctuation, ('#pop', 'comma_list')), |
228 ('object_attributes', 'string_interpolated')), |
230 ('object_attributes', 'string_interpolated')), |
229 (words(objects, prefix=r'\b', suffix=r"(_)(')"), |
231 (words(objects, prefix=r'\b', suffix=r"(_)(')"), |
230 bygroups(Name.Builtin, Name.Builtin, String.Interpol), |
232 bygroups(Name.Builtin, Name.Builtin, String.Interpol), |
231 ('object_attributes', 'string_interpolated')), |
233 ('object_attributes', 'string_interpolated')), |
232 |
234 |
233 (r'\.?_?[a-z][a-zA-Z0-9_.]*(\$|#)?', Text), |
235 (r'\.?_?[a-z][\w.]*(\$|#)?', Text), |
234 (r'[\[\]]', Punctuation, 'comma_list'), |
236 (r'[\[\]]', Punctuation, 'comma_list'), |
235 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
237 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
236 ], |
238 ], |
237 'operator': [ |
239 'operator': [ |
238 (r'([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)', Operator), |
240 (r'([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)', Operator), |
239 (r'\b(and|or|not|div|mod)\b', Operator.Word), |
241 (r'(?<![\w.])(and|or|not|div|mod)(?![\w.])', Operator.Word), |
240 ], |
242 ], |
241 'string_interpolated': [ |
243 'string_interpolated': [ |
242 (r'\.?[_a-z][a-zA-Z0-9_.]*[\$#]?(?:\[[a-zA-Z0-9,]+\])?(:[0-9]+)?', |
244 (r'\.?[_a-z][\w.]*[$#]?(?:\[[a-zA-Z0-9,]+\])?(:[0-9]+)?', |
243 String.Interpol), |
245 String.Interpol), |
244 (r"'", String.Interpol, '#pop'), |
246 (r"'", String.Interpol, '#pop'), |
245 ], |
247 ], |
246 'string_unquoted': [ |
248 'string_unquoted': [ |
247 (r'(\n\s*)(\.{3})', bygroups(Text, Punctuation)), |
249 (r'(\n\s*)(\.{3})', bygroups(Text, Punctuation)), |
265 |
267 |
266 (r'(optionmenu|choice)([ \t]+\S+:[ \t]+)', |
268 (r'(optionmenu|choice)([ \t]+\S+:[ \t]+)', |
267 bygroups(Keyword, Text), 'number'), |
269 bygroups(Keyword, Text), 'number'), |
268 |
270 |
269 (r'(option|button)([ \t]+)', |
271 (r'(option|button)([ \t]+)', |
270 bygroups(Keyword, Text), 'number'), |
|
271 |
|
272 (r'(option|button)([ \t]+)', |
|
273 bygroups(Keyword, Text), 'string_unquoted'), |
272 bygroups(Keyword, Text), 'string_unquoted'), |
274 |
273 |
275 (r'(sentence|text)([ \t]+\S+)', |
274 (r'(sentence|text)([ \t]+\S+)', |
276 bygroups(Keyword, Text), 'string_unquoted'), |
275 bygroups(Keyword, Text), 'string_unquoted'), |
277 |
276 |