Class: Rouge::Lexers::Praat

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/praat.rb

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, get_state, #get_state, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, #state, state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, continue_lex, #continue_lex, debug_enabled?, demo, demo_file, desc, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, #lex, lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.detect?(text) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/rouge/lexers/praat.rb', line 14

def self.detect?(text)
  return true if text.shebang? 'praat'
end

.functions_arrayObject



63
64
65
66
67
# File 'lib/rouge/lexers/praat.rb', line 63

def self.functions_array
  @functions_array ||= %w(
    linear# randomGauss# randomInteger# randomUniform# zero#
  )
end

.functions_builtinObject



83
84
85
86
87
88
89
90
# File 'lib/rouge/lexers/praat.rb', line 83

def self.functions_builtin
  @functions_builtin ||=
    self.functions_string |
    self.functions_numeric |
    self.functions_array |
    self.functions_matrix |
    self.functions_string_vector
end

.functions_matrixObject



69
70
71
72
73
74
75
# File 'lib/rouge/lexers/praat.rb', line 69

def self.functions_matrix
  @functions_matrix ||= %w(
    linear## mul## mul_fast## mul_metal## mul_nt## mul_tn## mul_tt## outer## peaks##
    randomGamma## randomGauss## randomInteger## randomUniform## softmaxPerRow##
    solve## transpose## zero##
  )
end

.functions_numericObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rouge/lexers/praat.rb', line 35

def self.functions_numeric
  @functions_numeric ||= %w(
    abs appendFile appendFileLine appendInfo appendInfoLine arccos arccosh
    arcsin arcsinh arctan arctan2 arctanh barkToHertz beginPause
    beginSendPraat besselI besselK beta beta2 binomialP binomialQ boolean
    ceiling chiSquareP chiSquareQ choice comment cos cosh createDirectory
    deleteFile demoClicked demoClickedIn demoCommandKeyPressed
    demoExtraControlKeyPressed demoInput demoKeyPressed
    demoOptionKeyPressed demoShiftKeyPressed demoShow demoWaitForInput
    demoWindowTitle demoX demoY differenceLimensToPhon do editor endPause
    endSendPraat endsWith erb erbToHertz erf erfc exitScript exp
    extractNumber fileReadable fisherP fisherQ floor gaussP gaussQ hash
    hertzToBark hertzToErb hertzToMel hertzToSemitones imax imin
    incompleteBeta incompleteGammaP index index_regex integer invBinomialP
    invBinomialQ invChiSquareQ invFisherQ invGaussQ invSigmoid invStudentQ
    length ln lnBeta lnGamma log10 log2 max melToHertz min minusObject
    natural number numberOfColumns numberOfRows numberOfSelected
    objectsAreIdentical option optionMenu pauseScript
    phonToDifferenceLimens plusObject positive randomBinomial randomGauss
    randomInteger randomPoisson randomUniform real readFile removeObject
    rindex rindex_regex round runScript runSystem runSystem_nocheck
    selectObject selected semitonesToHertz sentence sentencetext sigmoid
    sin sinc sincpi sinh soundPressureToPhon sqrt startsWith studentP
    studentQ tan tanh text variableExists word writeFile writeFileLine
    writeInfo writeInfoLine
  )
end

.functions_stringObject



26
27
28
29
30
31
32
33
# File 'lib/rouge/lexers/praat.rb', line 26

def self.functions_string
  @functions_string ||= %w(
    backslashTrigraphsToUnicode$ chooseDirectory$ chooseReadFile$
    chooseWriteFile$ date$ demoKey$ do$ environment$ extractLine$ extractWord$
    fixed$ info$ left$ mid$ percent$ readFile$ replace$ replace_regex$ right$
    selected$ string$ unicodeToBackslashTrigraphs$
  )
end

.functions_string_vectorObject



77
78
79
80
81
# File 'lib/rouge/lexers/praat.rb', line 77

def self.functions_string_vector
  @functions_string_vector ||= %w(
    empty$# fileNames$# folderNames$# readLinesFromFile$# splitByWhitespace$#
  )
end

.keywordsObject



18
19
20
21
22
23
24
# File 'lib/rouge/lexers/praat.rb', line 18

def self.keywords
  @keywords ||= %w(
    if then else elsif elif endif fi for from to endfor endproc while
    endwhile repeat until select plus minus demo assert stopwatch
    nocheck nowarn noprogress editor endeditor clearinfo
  )
end

.object_attributesObject



136
137
138
139
140
# File 'lib/rouge/lexers/praat.rb', line 136

def self.object_attributes
  @object_attributes ||= %w(
    ncol nrow xmin ymin xmax ymax nx ny dx dy
  )
end

.objectsObject



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/rouge/lexers/praat.rb', line 92

def self.objects
  @objects ||= %w(
    Activation AffineTransform AmplitudeTier Art Artword Autosegment
    BarkFilter BarkSpectrogram CCA Categories Cepstrogram Cepstrum
    Cepstrumc ChebyshevSeries ClassificationTable Cochleagram Collection
    ComplexSpectrogram Configuration Confusion ContingencyTable Corpus
    Correlation Covariance CrossCorrelationTable CrossCorrelationTableList
    CrossCorrelationTables DTW DataModeler Diagonalizer Discriminant
    Dissimilarity Distance Distributions DurationTier EEG ERP ERPTier
    EditCostsTable EditDistanceTable Eigen Excitation Excitations
    ExperimentMFC FFNet FeatureWeights FileInMemory FilesInMemory Formant
    FormantFilter FormantGrid FormantModeler FormantPoint FormantTier
    GaussianMixture HMM HMM_Observation HMM_ObservationSequence HMM_State
    HMM_StateSequence HMMObservation HMMObservationSequence HMMState
    HMMStateSequence Harmonicity ISpline Index Intensity IntensityTier
    IntervalTier KNN KlattGrid KlattTable LFCC LPC Label LegendreSeries
    LinearRegression LogisticRegression LongSound Ltas MFCC MSpline ManPages
    Manipulation Matrix MelFilter MelSpectrogram MixingMatrix Movie Network
    OTGrammar OTHistory OTMulti PCA PairDistribution ParamCurve Pattern
    Permutation Photo Pitch PitchModeler PitchTier PointProcess Polygon
    Polynomial PowerCepstrogram PowerCepstrum Procrustes RealPoint RealTier
    ResultsMFC Roots SPINET SSCP SVD Salience ScalarProduct Similarity
    SimpleString SortedSetOfString Sound Speaker Spectrogram Spectrum
    SpectrumTier SpeechSynthesizer SpellingChecker Strings StringsIndex
    Table TableOfReal TextGrid TextInterval TextPoint TextTier Tier
    Transition VocalTract VocalTractTier Weight WordList
  )
end

.variables_numericObject



121
122
123
124
125
126
# File 'lib/rouge/lexers/praat.rb', line 121

def self.variables_numeric
  @variables_numeric ||= %w(
    all average e left macintosh mono pi praatVersion right stereo
    undefined unix windows
  )
end

.variables_stringObject



128
129
130
131
132
133
134
# File 'lib/rouge/lexers/praat.rb', line 128

def self.variables_string
  @variables_string ||= %w(
    praatVersion$ tab$ shellDirectory$ homeDirectory$
    preferencesDirectory$ newline$ temporaryDirectory$
    defaultDirectory$
  )
end