lib/rouge/lexers/praat.rb in rouge-3.30.0 vs lib/rouge/lexers/praat.rb in rouge-4.0.0

- old
+ new

@@ -56,10 +56,20 @@ functions_array = %w( linear randomGauss randomInteger randomUniform zero ) + 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 + ) + + functions_string_vector = %w( + empty fileNames folderNames readLinesFromFile splitByWhitespace + ) + objects = %w( Activation AffineTransform AmplitudeTier Art Artword Autosegment BarkFilter BarkSpectrogram CCA Categories Cepstrogram Cepstrum Cepstrumc ChebyshevSeries ClassificationTable Cochleagram Collection ComplexSpectrogram Configuration Confusion ContingencyTable Corpus @@ -140,10 +150,11 @@ groups Keyword, Text, Name::Label end mixin :variable_name mixin :number + mixin :vector_literal rule %r/"/, Literal::String, :string rule %r/\b(?:#{objects.join('|')})(?=\s+\S+\n)/, Name::Class, :string_unquoted @@ -194,10 +205,12 @@ end state :function_call do rule %r/\b(#{functions_string.join('|')})\$(?=\s*[:(])/, Name::Function, :function rule %r/\b(#{functions_array.join('|')})#(?=\s*[:(])/, Name::Function, :function + rule %r/\b(#{functions_matrix.join('|')})##(?=\s*[:(])/, Name::Function, :function + rule %r/\b(#{functions_string_vector.join('|')})\$#(?=\s*[:(])/, Name::Function, :function rule %r/\b(#{functions_numeric.join('|')})(?=\s*[:(])/, Name::Function, :function end state :function do rule %r/\s+/, Text @@ -212,20 +225,21 @@ state :comma_list do rule %r/(\s*\n\s*)(\.{3})/ do groups Text, Punctuation end - rule %r/\s*[\])\n]/, Text, :pop! + rule %r/\s*[\]\})\n]/, Text, :pop! rule %r/\s+/, Text rule %r/"/, Literal::String, :string rule %r/\b(if|then|else|fi|endif)\b/, Keyword mixin :function_call mixin :variable_name mixin :operator mixin :number + mixin :vector_literal rule %r/[()]/, Text rule %r/,/, Punctuation end @@ -255,12 +269,16 @@ rule %r/\b(Object|#{objects.join('|')})_/ do token Name::Builtin push :object_reference end - rule %r/\.?[a-z][a-zA-Z0-9_.]*(\$|#)?/, Text + rule %r/\.?[a-z][a-zA-Z0-9_.]*(\$#|##|\$|#)?/, Text rule %r/[\[\]]/, Text, :comma_list mixin :string_interpolated + end + + state :vector_literal do + rule %r/(\{)/, Text, :comma_list end state :object_reference do mixin :string_interpolated rule %r/([a-z][a-zA-Z0-9_]*|\d+)/, Name::Builtin