lib/rouge/lexers/praat.rb in rouge-2.0.2 vs lib/rouge/lexers/praat.rb in rouge-2.0.3
- old
+ new
@@ -35,11 +35,11 @@
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
+ 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
@@ -102,17 +102,26 @@
state :root do
rule /(\s+)(#.*?$)/ do
groups Text, Comment::Single
end
- rule /^#.*?$/, Comment::Single
- rule /;[^\n]*/, Comment::Single
- rule /\s+/, Text
- rule /\bprocedure\b/, Keyword, :procedure_definition
- rule /\bcall\b/, Keyword, :procedure_call
- rule /@/, Name::Function, :procedure_call
+ rule /^#.*?$/, Comment::Single
+ rule /;[^\n]*/, Comment::Single
+ rule /\s+/, Text
+ rule /(\bprocedure)(\s+)/ do
+ groups Keyword, Text
+ push :procedure_definition
+ end
+
+ rule /(\bcall)(\s+)/ do
+ groups Keyword, Text
+ push :procedure_call
+ end
+
+ rule /@/, Name::Function, :procedure_call
+
mixin :function_call
rule /\b(?:select all)\b/, Keyword
rule /\b(?:#{keywords.join('|')})\b/, Keyword
@@ -140,11 +149,11 @@
rule /\b(?=[A-Z])/, Text, :command
rule /(\.{3}|[)(,\$])/, Punctuation
end
state :command do
- rule /( ?[\w()-]+ ?)/, Keyword
+ rule /( ?([^\s:\.'])+ ?)/, Keyword
mixin :string_interpolated
rule /\.{3}/ do
token Keyword
pop!
@@ -159,35 +168,29 @@
rule /[\s\n]/, Text, :pop!
end
state :procedure_call do
- rule /\s+/, Text
+ mixin :string_interpolated
- rule /([\w.]+)(:|\s*\()/ do
- groups Name::Function, Punctuation
- pop!
- end
+ rule /(:|\s*\()/, Punctuation, :pop!
- rule /([\w.]+)/ do
- token Name::Function
+ rule /'/, Name::Function
+ rule /[^:\('\n\s]+/, Name::Function
+
+ rule /(?=\s+)/ do
+ token Text
pop!
push :old_arguments
end
end
state :procedure_definition do
- rule /\s/, Text
+ rule /(:|\s*\()/, Punctuation, :pop!
- rule /([\w.]+)(\s*?[(:])/ do
- groups Name::Function, Text
- pop!
- end
+ rule /[^:\(\n\s]+/, Name::Function
- rule /([\w.]+)([^\n]*)/ do
- groups Name::Function, Text
- pop!
- end
+ rule /(\s+)/, Text, :pop!
end
state :function_call do
rule /\b(#{functions_string.join('|')})\$(?=\s*[:(])/, Name::Function, :function
rule /\b(#{functions_array.join('|')})#(?=\s*[:(])/, Name::Function, :function