summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJJ Atria <jjatria@gmail.com>2016-03-19 18:32:36 +0000
committerJJ Atria <jjatria@gmail.com>2016-03-19 18:32:36 +0000
commit3c47a863609e2c3fcf69830a58ce934692373162 (patch)
treee8a176b2780feb40aa450548cedb6e8b70fffeb8
parent6affb65198037120b7b423d67ff9e15a5df97e9c (diff)
downloadpygments-3c47a863609e2c3fcf69830a58ce934692373162.tar.gz
Expanded Praat example file
-rw-r--r--tests/examplefiles/example.praat53
1 files changed, 44 insertions, 9 deletions
diff --git a/tests/examplefiles/example.praat b/tests/examplefiles/example.praat
index bf2d005f..40881bcd 100644
--- a/tests/examplefiles/example.praat
+++ b/tests/examplefiles/example.praat
@@ -2,17 +2,27 @@ form Highlighter test
sentence Blank
sentence My_sentence This should all be a string
text My_text This should also all be a string
- word My_word Only the first word is a string, the rest is invalid
+ word My_word Only the first word is a string, the rest is discarded
boolean Binary 1
boolean Text no
boolean Quoted "yes"
comment This should be a string
+ optionmenu Choice: 1
+ option Foo
+ option Bar
+ option 100
real left_Range -123.6
positive right_Range_max 3.3
integer Int 4
natural Nat 4
endform
+# Periods do not establish boundaries for keywords
+form.var = 10
+# Or operators
+not.an.operator$ = "Bad variable name"
+bad.or.not = 1
+
# External scripts
include /path/to/file
runScript: "/path/to/file"
@@ -51,12 +61,16 @@ endif
string$ = "Strings can be 'interpolated'"
string$ = "But don't interpolate everything!"
+string$(10)
+
+repeat
+ string$ = string$ - right$(string$)
+until !length(string$)
Text... 1 Right 0.2 Half many----hyphens
Text... 1 Right -0.4 Bottom aحبيبa
Text... 1 Right -0.6 Bottom 日本
Draw circle (mm)... 0.5 0.5 i
-x=1
rows = Object_'table'.nrow
value$ = Table_'table'$[25, "f0"]
@@ -83,17 +97,19 @@ var = if macintosh = 1 then 0 else 1 fi ; This is an inline comment
n = numberOfSelected("Sound")
for i from newStyle.local to n
name = selected$(extractWord$(selected$(), " "))
- sound'i' = selected("Sound", i)
+ sound'i' = selected("Sound", i+(a*b))
sound[i] = sound'i'
endfor
-for i from 1 to n
+i = 1
+while i < n
+ i++
# Different styles of object selection
select sound'i'
sound = selected()
sound$ = selected$("Sound")
select Sound 'sound$'
- selectObject(sound[i])
+ selectObject( sound[i])
selectObject: sound
# Pause commands
@@ -124,18 +140,20 @@ for i from 1 to n
# Multi-line command with modifier
pitch = noprogress To Pitch (ac): 0, 75, 15, "no",
...0.03, 0.45, 0.01, 0.35, 0.14, 600
+ # Formulas are strings
+ Formula: "if col = 1 then row * Object_'pitch'.dx + 'first' else self fi"
# do-style command with assignment
minimum = do("Get minimum...", 0, 0, "Hertz", "Parabolic")
# New-style multi-line command call with broken strings
table = Create Table with column names: "table", 0,
- ..."file subject speaker
- ...f0 f1 f2 f3 " +
+ ..."file subject speaker
+ ... f0 f1 f2 f" + string$(3) + " " +
..."duration response"
# Function call with trailing space
- removeObject: pitch, table
+ removeObject: pitch, table
# Picture window commands
selectObject: sound
@@ -156,7 +174,7 @@ for i from 1 to n
demoWaitForInput ( )
demo Erase all
demo Text: 50, "centre", 50, "half", "Finished"
-endfor
+endwhile
switch$ = if switch == 1 then "a" else
... if switch == 2 then "b" else
@@ -207,6 +225,11 @@ assert a != b && c
assert a <> b || c
assert a < b | c
assert a > b
+
+assert (a)or (b)
+assert (a) or(b)
+assert (a)and(b)
+
assert "hello" = "he" + "llo"
assert "hello" == "hello world" - " world"
@@ -243,3 +266,15 @@ endproc
asserterror Unknown symbol:'newline$'« _
assert '_new_style.local'
+@proc: a, selected("string"), b
+# Comment
+
+for i to saveSelection.n
+ selectObject: saveSelection.id[i]
+ appendInfoLine: selected$()
+endfor
+
+@ok(if selected$("Sound") = "tone" then 1 else 0 fi,
+ ... "selected sound is tone")
+
+@ok_formula("selected$(""Sound"") = ""tone""", "selected sound is tone")