53 'demoWindowTitle', 'demoX', 'demoY', 'differenceLimensToPhon', 'do', 'editor', |
53 'demoWindowTitle', 'demoX', 'demoY', 'differenceLimensToPhon', 'do', 'editor', |
54 'endPause', 'endSendPraat', 'endsWith', 'erb', 'erbToHertz', 'erf', 'erfc', |
54 'endPause', 'endSendPraat', 'endsWith', 'erb', 'erbToHertz', 'erf', 'erfc', |
55 'exitScript', 'exp', 'extractNumber', 'fileReadable', 'fisherP', 'fisherQ', |
55 'exitScript', 'exp', 'extractNumber', 'fileReadable', 'fisherP', 'fisherQ', |
56 'floor', 'gaussP', 'gaussQ', 'hertzToBark', 'hertzToErb', 'hertzToMel', |
56 'floor', 'gaussP', 'gaussQ', 'hertzToBark', 'hertzToErb', 'hertzToMel', |
57 'hertzToSemitones', 'imax', 'imin', 'incompleteBeta', 'incompleteGammaP', 'index', |
57 'hertzToSemitones', 'imax', 'imin', 'incompleteBeta', 'incompleteGammaP', 'index', |
58 'index_regex', 'invBinomialP', 'invBinomialQ', 'invChiSquareQ', 'invFisherQ', |
58 'index_regex', 'integer', 'invBinomialP', 'invBinomialQ', 'invChiSquareQ', 'invFisherQ', |
59 'invGaussQ', 'invSigmoid', 'invStudentQ', 'length', 'ln', 'lnBeta', 'lnGamma', |
59 'invGaussQ', 'invSigmoid', 'invStudentQ', 'length', 'ln', 'lnBeta', 'lnGamma', |
60 'log10', 'log2', 'max', 'melToHertz', 'min', 'minusObject', 'natural', 'number', |
60 'log10', 'log2', 'max', 'melToHertz', 'min', 'minusObject', 'natural', 'number', |
61 'numberOfColumns', 'numberOfRows', 'numberOfSelected', 'objectsAreIdentical', |
61 'numberOfColumns', 'numberOfRows', 'numberOfSelected', 'objectsAreIdentical', |
62 'option', 'optionMenu', 'pauseScript', 'phonToDifferenceLimens', 'plusObject', |
62 'option', 'optionMenu', 'pauseScript', 'phonToDifferenceLimens', 'plusObject', |
63 'positive', 'randomBinomial', 'randomGauss', 'randomInteger', 'randomPoisson', |
63 'positive', 'randomBinomial', 'randomGauss', 'randomInteger', 'randomPoisson', |
64 'randomUniform', 'real', 'readFile', 'removeObject', 'rindex', 'rindex_regex', |
64 'randomUniform', 'real', 'readFile', 'removeObject', 'rindex', 'rindex_regex', |
65 'round', 'runScript', 'runSystem', 'runSystem_nocheck', 'selectObject', |
65 'round', 'runScript', 'runSystem', 'runSystem_nocheck', 'selectObject', |
66 'selected', 'semitonesToHertz', 'sentencetext', 'sigmoid', 'sin', 'sinc', |
66 'selected', 'semitonesToHertz', 'sentence', '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', 'text', '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', |
88 'HMM_Observation', 'HMM_ObservationSequence', 'HMM_State', 'HMM_StateSequence', |
88 'HMM_Observation', 'HMM_ObservationSequence', 'HMM_State', 'HMM_StateSequence', |
89 'Harmonicity', 'ISpline', 'Index', 'Intensity', 'IntensityTier', 'IntervalTier', |
89 'Harmonicity', 'ISpline', 'Index', 'Intensity', 'IntensityTier', 'IntervalTier', |
90 'KNN', 'KlattGrid', 'KlattTable', 'LFCC', 'LPC', 'Label', 'LegendreSeries', |
90 'KNN', 'KlattGrid', 'KlattTable', 'LFCC', 'LPC', 'Label', 'LegendreSeries', |
91 'LinearRegression', 'LogisticRegression', 'LongSound', 'Ltas', 'MFCC', 'MSpline', |
91 'LinearRegression', 'LogisticRegression', 'LongSound', 'Ltas', 'MFCC', 'MSpline', |
92 'ManPages', 'Manipulation', 'Matrix', 'MelFilter', 'MelSpectrogram', |
92 'ManPages', 'Manipulation', 'Matrix', 'MelFilter', 'MelSpectrogram', |
93 'MixingMatrix', 'Movie', 'Network', 'OTGrammar', 'OTHistory', 'OTMulti', 'PCA', |
93 'MixingMatrix', 'Movie', 'Network', 'Object', 'OTGrammar', 'OTHistory', 'OTMulti', |
94 'PairDistribution', 'ParamCurve', 'Pattern', 'Permutation', 'Photo', 'Pitch', |
94 'PCA', 'PairDistribution', 'ParamCurve', 'Pattern', 'Permutation', 'Photo', |
95 'PitchModeler', 'PitchTier', 'PointProcess', 'Polygon', 'Polynomial', |
95 'Pitch', 'PitchModeler', 'PitchTier', 'PointProcess', 'Polygon', 'Polynomial', |
96 'PowerCepstrogram', 'PowerCepstrum', 'Procrustes', 'RealPoint', 'RealTier', |
96 'PowerCepstrogram', 'PowerCepstrum', 'Procrustes', 'RealPoint', 'RealTier', |
97 'ResultsMFC', 'Roots', 'SPINET', 'SSCP', 'SVD', 'Salience', 'ScalarProduct', |
97 'ResultsMFC', 'Roots', 'SPINET', 'SSCP', 'SVD', 'Salience', 'ScalarProduct', |
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', |
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 object_attributes = ( |
|
116 'ncol', 'nrow', 'xmin', 'ymin', 'xmax', 'ymax', 'nx', 'ny', 'dx', 'dy', |
|
117 ) |
|
118 |
115 tokens = { |
119 tokens = { |
116 'root': [ |
120 'root': [ |
117 (r'(\s+)(#.*?$)', bygroups(Text, Comment.Single)), |
121 (r'(\s+)(#.*?$)', bygroups(Text, Comment.Single)), |
118 (r'^#.*?$', Comment.Single), |
122 (r'^#.*?$', Comment.Single), |
119 (r';[^\n]*', Comment.Single), |
123 (r';[^\n]*', Comment.Single), |
146 (r'\b[A-Z]', Keyword, 'command'), |
150 (r'\b[A-Z]', Keyword, 'command'), |
147 (r'(\.{3}|[)(,])', Punctuation), |
151 (r'(\.{3}|[)(,])', Punctuation), |
148 ], |
152 ], |
149 'command': [ |
153 'command': [ |
150 (r'( ?[\w()-]+ ?)', Keyword), |
154 (r'( ?[\w()-]+ ?)', Keyword), |
151 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
155 |
|
156 include('string_interpolated'), |
|
157 |
152 (r'\.{3}', Keyword, ('#pop', 'old_arguments')), |
158 (r'\.{3}', Keyword, ('#pop', 'old_arguments')), |
153 (r':', Keyword, ('#pop', 'comma_list')), |
159 (r':', Keyword, ('#pop', 'comma_list')), |
154 (r'\s', Text, '#pop'), |
160 (r'\s', Text, '#pop'), |
155 ], |
161 ], |
156 'procedure_call': [ |
162 'procedure_call': [ |
205 ], |
211 ], |
206 'number': [ |
212 'number': [ |
207 (r'\n', Text, '#pop'), |
213 (r'\n', Text, '#pop'), |
208 (r'\b\d+(\.\d*)?([eE][-+]?\d+)?%?', Number), |
214 (r'\b\d+(\.\d*)?([eE][-+]?\d+)?%?', Number), |
209 ], |
215 ], |
210 'object_attributes': [ |
216 'object_reference': [ |
211 (r'\.?(n(col|row)|[xy]min|[xy]max|[nd][xy])\b', Name.Builtin, '#pop'), |
217 include('string_interpolated'), |
212 (r'(\.?(?:col|row)\$)(\[)', |
218 (r'([a-z][a-zA-Z0-9_]*|\d+)', Name.Builtin), |
213 bygroups(Name.Builtin, Text), 'variable_name'), |
219 |
214 (r'(\$?)(\[)', |
220 (words(object_attributes, prefix=r'\.'), Name.Builtin, '#pop'), |
215 bygroups(Name.Builtin, Text), ('#pop', 'comma_list')), |
221 |
|
222 (r'\$', Name.Builtin), |
|
223 (r'\[', Text, '#pop'), |
216 ], |
224 ], |
217 'variable_name': [ |
225 'variable_name': [ |
218 include('operator'), |
226 include('operator'), |
219 include('number'), |
227 include('number'), |
220 |
228 |
221 (words(variables_string, suffix=r'\$'), Name.Variable.Global), |
229 (words(variables_string, suffix=r'\$'), Name.Variable.Global), |
222 (words(variables_numeric, suffix=r'\b'), Name.Variable.Global), |
230 (words(variables_numeric, |
223 |
231 suffix=r'(?=[^a-zA-Z0-9\._"\'\$#\[:\(]|\s|^|$)'), |
224 (r'\bObject_\w+', Name.Builtin, 'object_attributes'), |
232 Name.Variable.Global), |
225 (words(objects, prefix=r'\b', suffix=r'_\w+'), |
233 |
226 Name.Builtin, 'object_attributes'), |
234 (words(objects, prefix=r'\b', suffix=r"(_)"), |
227 |
235 bygroups(Name.Builtin, Name.Builtin), |
228 (r"\b(Object_)(')", |
236 'object_reference'), |
229 bygroups(Name.Builtin, String.Interpol), |
|
230 ('object_attributes', 'string_interpolated')), |
|
231 (words(objects, prefix=r'\b', suffix=r"(_)(')"), |
|
232 bygroups(Name.Builtin, Name.Builtin, String.Interpol), |
|
233 ('object_attributes', 'string_interpolated')), |
|
234 |
237 |
235 (r'\.?_?[a-z][\w.]*(\$|#)?', Text), |
238 (r'\.?_?[a-z][\w.]*(\$|#)?', Text), |
236 (r'[\[\]]', Punctuation, 'comma_list'), |
239 (r'[\[\]]', Punctuation, 'comma_list'), |
237 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
240 |
|
241 include('string_interpolated'), |
238 ], |
242 ], |
239 'operator': [ |
243 'operator': [ |
240 (r'([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)', Operator), |
244 (r'([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)', Operator), |
241 (r'(?<![\w.])(and|or|not|div|mod)(?![\w.])', Operator.Word), |
245 (r'(?<![\w.])(and|or|not|div|mod)(?![\w.])', Operator.Word), |
242 ], |
246 ], |
243 'string_interpolated': [ |
247 'string_interpolated': [ |
244 (r'\.?[_a-z][\w.]*[$#]?(?:\[[a-zA-Z0-9,]+\])?(:[0-9]+)?', |
248 (r'\'[_a-z][^\[\]\'":]*(\[([\d,]+|"[\w\d,]+")\])?(:[0-9]+)?\'', |
245 String.Interpol), |
249 String.Interpol), |
246 (r"'", String.Interpol, '#pop'), |
|
247 ], |
250 ], |
248 'string_unquoted': [ |
251 'string_unquoted': [ |
249 (r'(\n\s*)(\.{3})', bygroups(Text, Punctuation)), |
252 (r'(\n\s*)(\.{3})', bygroups(Text, Punctuation)), |
250 |
253 |
251 (r'\n', Text, '#pop'), |
254 (r'\n', Text, '#pop'), |
252 (r'\s', Text), |
255 (r'\s', Text), |
253 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
256 |
|
257 include('string_interpolated'), |
|
258 |
254 (r"'", String), |
259 (r"'", String), |
255 (r"[^'\n]+", String), |
260 (r"[^'\n]+", String), |
256 ], |
261 ], |
257 'string': [ |
262 'string': [ |
258 (r'(\n\s*)(\.{3})', bygroups(Text, Punctuation)), |
263 (r'(\n\s*)(\.{3})', bygroups(Text, Punctuation)), |
259 |
264 |
260 (r'"', String, '#pop'), |
265 (r'"', String, '#pop'), |
261 (r"'(?=.*')", String.Interpol, 'string_interpolated'), |
266 |
|
267 include('string_interpolated'), |
|
268 |
262 (r"'", String), |
269 (r"'", String), |
263 (r'[^\'"\n]+', String), |
270 (r'[^\'"\n]+', String), |
264 ], |
271 ], |
265 'old_form': [ |
272 'old_form': [ |
|
273 (r'(\s+)(#.*?$)', bygroups(Text, Comment.Single)), |
266 (r'\s+', Text), |
274 (r'\s+', Text), |
267 |
275 |
268 (r'(optionmenu|choice)([ \t]+\S+:[ \t]+)', |
276 (r'(optionmenu|choice)([ \t]+\S+:[ \t]+)', |
269 bygroups(Keyword, Text), 'number'), |
277 bygroups(Keyword, Text), 'number'), |
270 |
278 |