---input---
form Highlighter test
  # This is a regular comment
  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 discarded
  boolean Binary 1
  boolean Text no
  boolean Quoted "yes"
  comment This should be a string
  optionmenu Drop-down: 1
    option Foo
    option 100
  choice Radio: 1
    option Foo
    option 100
  real left_Range -123.6
  positive right_Range_max 3.3
  integer Int 4
  natural Nat 4
endform

beginPause: "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 discarded"
  boolean: "Binary", 1
  comment: "This should be a string"
  optionMenu: "Drop-down", 1
    option: "Foo"
    option: "100"
  choice: "Choice", 1
    option: "Foo"
    option: "100"
  real: "left Range", -123.6
  positive: "right Range max", 3.3
  integer: "Int", 4
  natural: "Nat", 4
button = endPause("Cancel", "OK", 1, 2)

# 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"
execute /path/to/file

# Predefined variables
a  = praatVersion
a  = e + pi * ( all+right) / left mod average + (mono - stereo)
a$ = homeDirectory$ + tab$ + newline$
a$ = temporaryDirectory$
a$ = praatVersion$
a$ = shellDirectory$
a$ = homeDirectory$
a$ = preferencesDirectory$
a$ = defaultDirectory$
nocheck selectObject: undefined
# Not predefined variables
a$ = e$
a$ = pi$

# Arrays are not comments
a# = zero# (5, 6)
a [3], 5 = 7
printline 'a[3,5]', 'a[3]'
a [1] = 2
b [a [1]] = 3
assert b [a [1]] = 3
printline 'b[2]'

# if-block with built-in variables
if windows
  # We are on Windows
elsif unix = 1 or !macintosh
  exitScript: "We are on Linux"
else macintosh == 1
  exit We are on Mac
endif

# Interpolation with precision digits
echo unquoted 'a:3'
echo unquoted 'a.a:3'
echo unquoted 'a[1]:3'
echo unquoted 'a1:3'

appendInfoLine: "quoted 'a:3'"
appendInfoLine: "quoted 'a.a:3'"
appendInfoLine: "quoted 'a[1]:3'"
appendInfoLine: "quoted 'a1:3'"

# Interpolations are not recursive
echo unquoted 'a'1':3'
appendInfoLine: "quoted 'a'1':3'"

# Interpolation without precision digits
echo unquoted 'var' numeric
echo unquoted 'var$' string
echo unquoted 'var["a"]' numeric hash
echo unquoted 'var$["a"]' string hash
echo unquoted 'var[1]' numeric indexed variable
echo unquoted 'var$[1]' string indexed variable

appendInfoLine: "quoted 'var' numeric"
appendInfoLine: "quoted 'var$' string"
appendInfoLine: "quoted 'var["a"]' numeric hash"
appendInfoLine: "quoted 'var$["a"]' string hash"
appendInfoLine: "quoted 'var[1]' numeric indexed variable"
appendInfoLine: "quoted 'var$[1]' string indexed variable"

# Indeces in interpolations must be literal
echo 'var[a]'
echo 'var[a$]'

string$ = "But don't interpolate everything!"
string$ = "interpolatin' " + "across" + " strings ain't cool either"
string$(10) ; This is a function

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

rows   = Object_'table'.nrow
value$ = Table_'table'$[25, "f0"]
fixed  = Sound_10.xmin
fixed  = Object_foo.xmin
fixed  = Procrustes_foo.nx
var["vaa"] = 1 ; Hash

# Special two-word keyword
select all
# Keyword with a predefined variable
select  all

# old-style procedure call
call oldStyle "quoted" 2 unquoted string
assert oldStyle.local = 1

# New-style procedure call with parens
@newStyle("quoted", 2, "quoted string")
if praatVersion >= 5364
  # New-style procedure call with colon
  @newStyle: "quoted", 2, "quoted string"
endif

# inline if with inline comment
var = if macintosh = 1 then 0 else 1 fi ; This is an inline comment

# for-loop with explicit from using local variable
# and paren-style function calls and variable interpolation
n = numberOfSelected("Sound")
for i from newStyle.local to n
  name = selected$(extractWord$(selected$(), " "))
  sound'i' = selected("Sound", i+(a*b))
  sound[i] = sound'i'
endfor

i = 1
while i < n
  i += 1
  # Different styles of object selection
  select sound'i'
  sound = selected()
  sound$ = selected$("Sound")
  select Sound 'sound$'
  selectObject( sound[i])
  selectObject: sound

  # Pause commands
  beginPause("Viewing " + sound$)
  if i > 1
    button = endPause("Stop", "Previous",
      ...if i = total_sounds then "Finish" else "Next" fi,
      ...3, 1)
  else
    button = endPause("Stop",
      ...if i = total_sounds then "Finish" else "Next" fi,
      ...2, 1)
  endif
  editor_name$ = if total_textgrids then "TextGrid " else "Sound " fi + name$
  nocheck editor Sound 'editor_name$'
    nocheck Close
  nocheck endeditor
  editor_id = editor: editor_name$
    Close
  endeditor

  # New-style standalone command call
  Rename: "SomeName"

  # Command call with assignment
  duration = Get total duration

  # 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 f" + string$(3) + " " +
    ..."duration response"

  # Function call with trailing space
  removeObject: pitch, table

  # Picture window commands
  selectObject: sound
  # do-style command
  do("Select inner viewport...", 1, 6, 0.5, 1.5)
  Black
  Draw... 0 0 0 0 "no" Curve
  Draw inner box
  Text bottom: "yes", sound$
  Erase all

  # Demo window commands
  demo Erase all
  demo Select inner viewport... 0 100 0 100
  demo Axes... 0 100 0 100
  demo Paint rectangle... white 0 100 0 100
  demo Text... 50 centre 50 half Click to finish
  demoWaitForInput ( )
  demo Erase all
  demo Text: 50, "centre", 50, "half", "Finished"
endwhile

switch$ = if switch == 1 then "a" else
  ...     if switch == 2 then "b" else
  ...     if switch == 3 then "c" else
  ...     if switch == 4 then "d" else
  ...     "default" fi fi fi fi

# An old-style sendpraat block
# All these lines should be a string!
sendpraat Praat
  ...'newline$' Create Sound as pure tone... "tone" 1 0 0.4 44100 440 0.2 0.01 0.01
  ...'newline$' Play
  ...'newline$' Remove

# A new-style sendpraat block
beginSendPraat: "Praat"
  Create Sound as pure tone: "tone", 1, 0, 0.4, 44100, 440, 0.2, 0.01, 0.01
  duration = Get total duration
  Remove
endSendPraat: "duration"
appendInfoLine: "The generated sound lasted for ", duration, "seconds"

# Number types
a =   10%
a =  -10
a =  +10
a =   10.4
a =  294e12
a =    2.94e12

# Operators
a = 2 ^ -6
a = -(1+1)^6
a = 4^3 ^ 2
a = 54 div 5.1
a = 54.3 mod 5
a = 3 ** 8 - 7
a = 3 / (8 + 7)
a = (7 * (3 + 5)) / ((2 + 3) - 1)

# Logical operators
assert (a =   b) and c
assert  a == (b  or  c)
assert  a <=  b  not c
assert  a >=  b     !c
assert  a !=  b  &   c
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"

stopwatch
time = stopwatch
clearinfo
echo This script took
print 'time' seconds to
printline execute.

# Old-style procedure declaration
procedure oldStyle .str1$ .num .str2$
  .local = 1
endproc

# New-style procedure declaration with parentheses
procedure newStyle (.str1$, .num, .str2$)
  # Command with "local" variable
  .local = Get total duration
  .local = Get 'some' duration
  .local = Get 'some[1]' value... hello 10 p[i]
  .local = Get 'some[1,3]' value: "hello", 10, p[i]
  .local = Get 'some$' duration
  .local = Get 'some$[1]' duration
endproc

# New-style procedure declaration with colon
procedure _new_style: .str1$, .num, .str2$
  # Command with "local" variable
  # Initial underscores in variables not allowed (unless interpolated)
  _new_style.local = Get total duration
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")

---tokens---
'form'        Keyword
' '           Text
'Highlighter test' Literal.String
'\n  '        Text
'# This is a regular comment' Comment.Single
'\n  '        Text
'sentence'    Keyword
' Blank'      Text
'\n'          Text

'  '          Text
'sentence'    Keyword
' My_sentence' Text
' '           Text
'This should all be a string' Literal.String
'\n'          Text

'  '          Text
'text'        Keyword
' My_text'    Text
' '           Text
'This should also all be a string' Literal.String
'\n'          Text

'  '          Text
'word'        Keyword
' My_word '   Text
'Only'        Literal.String
' the first word is a string, the rest is discarded' Text
'\n  '        Text
'boolean'     Keyword
' Binary '    Text
'1'           Name.Variable
'\n  '        Text
'boolean'     Keyword
' Text '      Text
'no'          Name.Variable
'\n  '        Text
'boolean'     Keyword
' Quoted '    Text
'"yes"'       Name.Variable
'\n  '        Text
'comment'     Keyword
' '           Text
'This should be a string' Literal.String
'\n'          Text

'  '          Text
'optionmenu'  Keyword
' Drop-down: ' Text
'1'           Literal.Number
'\n'          Text

'    '        Text
'option'      Keyword
' '           Text
'Foo'         Literal.String
'\n'          Text

'    '        Text
'option'      Keyword
' '           Text
'100'         Literal.String
'\n'          Text

'  '          Text
'choice'      Keyword
' Radio: '    Text
'1'           Literal.Number
'\n'          Text

'    '        Text
'option'      Keyword
' '           Text
'Foo'         Literal.String
'\n'          Text

'    '        Text
'option'      Keyword
' '           Text
'100'         Literal.String
'\n'          Text

'  '          Text
'real'        Keyword
' left_Range ' Text
'-'           Operator
'123.6'       Literal.Number
'\n  '        Text
'positive'    Keyword
' right_Range_max ' Text
'3.3'         Literal.Number
'\n  '        Text
'integer'     Keyword
' Int '       Text
'4'           Literal.Number
'\n  '        Text
'natural'     Keyword
' Nat '       Text
'4'           Literal.Number
'\n'          Text

'endform'     Keyword
'\n\n'        Text

'beginPause'  Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Highlighter test' Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'sentence'    Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Blank'       Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'sentence'    Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'My sentence' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'This should all be a string' Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'text'        Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'My text'     Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'This should also all be a string' Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'word'        Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'My word'     Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'Only the first word is a string, the rest is discarded' Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'boolean'     Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Binary'      Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'1'           Literal.Number
'\n'          Text

'  '          Text
'comment'     Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'This should be a string' Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'optionMenu'  Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Drop-down'   Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'1'           Literal.Number
'\n'          Text

'    '        Text
'option'      Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Foo'         Literal.String
'"'           Literal.String
'\n'          Text

'    '        Text
'option'      Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'100'         Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'choice'      Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Choice'      Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'1'           Literal.Number
'\n'          Text

'    '        Text
'option'      Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Foo'         Literal.String
'"'           Literal.String
'\n'          Text

'    '        Text
'option'      Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'100'         Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'real'        Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'left Range'  Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'-'           Operator
'123.6'       Literal.Number
'\n'          Text

'  '          Text
'positive'    Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'right Range max' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'3.3'         Literal.Number
'\n'          Text

'  '          Text
'integer'     Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Int'         Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'4'           Literal.Number
'\n'          Text

'  '          Text
'natural'     Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Nat'         Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'4'           Literal.Number
'\n'          Text

'button'      Text
' '           Text
'='           Operator
' '           Text
'endPause'    Name.Function
'('           Punctuation
'"'           Literal.String
'Cancel'      Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'OK'          Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'1'           Literal.Number
','           Punctuation
' '           Text
'2'           Literal.Number
')'           Text
'\n\n'        Text

'# Periods do not establish boundaries for keywords' Comment.Single
'\n'          Text

'form.var'    Text
' '           Text
'='           Operator
' '           Text
'10'          Literal.Number
'\n'          Text

'# Or operators' Comment.Single
'\n'          Text

'not.an.operator$' Text
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'Bad variable name' Literal.String
'"'           Literal.String
'\n'          Text

'bad.or.not'  Text
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number
'\n\n'        Text

'# External scripts' Comment.Single
'\n'          Text

'include'     Keyword
' '           Text
'/path/to/file' Literal.String
'\n'          Text

'runScript'   Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'/path/to/file' Literal.String
'"'           Literal.String
'\n'          Text

'execute'     Keyword
' '           Text
'/path/to/file' Literal.String
'\n'          Text

'\n'          Text

'# Predefined variables' Comment.Single
'\n'          Text

'a'           Text
'  '          Text
'='           Operator
' '           Text
'praatVersion' Name.Variable.Global
'\n'          Text

'a'           Text
'  '          Text
'='           Operator
' '           Text
'e'           Name.Variable.Global
' '           Text
'+'           Operator
' '           Text
'pi'          Name.Variable.Global
' '           Text
'*'           Operator
' '           Text
'('           Punctuation
' '           Text
'all'         Text
'+'           Operator
'right'       Text
')'           Punctuation
' '           Text
'/'           Operator
' '           Text
'left'        Text
' '           Text
'mod'         Operator.Word
' '           Text
'average'     Text
' '           Text
'+'           Operator
' '           Text
'('           Punctuation
'mono'        Text
' '           Text
'-'           Operator
' '           Text
'stereo'      Text
')'           Punctuation
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'homeDirectory$' Name.Variable.Global
' '           Text
'+'           Operator
' '           Text
'tab$'        Name.Variable.Global
' '           Text
'+'           Operator
' '           Text
'newline$'    Name.Variable.Global
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'temporaryDirectory$' Name.Variable.Global
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'praatVersion$' Name.Variable.Global
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'shellDirectory$' Name.Variable.Global
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'homeDirectory$' Name.Variable.Global
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'preferencesDirectory$' Name.Variable.Global
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'defaultDirectory$' Name.Variable.Global
'\n'          Text

'nocheck'     Keyword
' '           Text
'selectObject' Name.Function
':'           Punctuation
' '           Text
'undefined'   Name.Variable.Global
'\n'          Text

'# Not predefined variables' Comment.Single
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'e$'          Text
'\n'          Text

'a$'          Text
' '           Text
'='           Operator
' '           Text
'pi$'         Text
'\n\n'        Text

'# Arrays are not comments' Comment.Single
'\n'          Text

'a#'          Text
' '           Text
'='           Operator
' '           Text
'zero#'       Name.Function
' '           Text
'('           Punctuation
'5'           Literal.Number
','           Punctuation
' '           Text
'6'           Literal.Number
')'           Text
'\n'          Text

'a'           Text
' '           Text
'['           Punctuation
'3'           Literal.Number
']'           Text
','           Punctuation
' '           Text
'5'           Literal.Number
' '           Text
'='           Operator
' '           Text
'7'           Literal.Number
'\n'          Text

'printline'   Keyword
' '           Text
"'a[3,5]'"    Literal.String.Interpol
', '          Literal.String
"'a[3]'"      Literal.String.Interpol
'\n'          Text

'a'           Text
' '           Text
'['           Punctuation
'1'           Literal.Number
']'           Text
' '           Text
'='           Operator
' '           Text
'2'           Literal.Number
'\n'          Text

'b'           Text
' '           Text
'['           Punctuation
'a'           Text
' '           Text
'['           Punctuation
'1'           Literal.Number
']'           Text
']'           Text
' '           Text
'='           Operator
' '           Text
'3'           Literal.Number
'\n'          Text

'assert'      Keyword
' '           Text
'b'           Text
' '           Text
'['           Punctuation
'a'           Text
' '           Text
'['           Punctuation
'1'           Literal.Number
']'           Text
']'           Text
' '           Text
'='           Operator
' '           Text
'3'           Literal.Number
'\n'          Text

'printline'   Keyword
' '           Text
"'b[2]'"      Literal.String.Interpol
'\n'          Text

'\n'          Text

'# if-block with built-in variables' Comment.Single
'\n'          Text

'if'          Keyword
' '           Text
'windows'     Name.Variable.Global
'\n  '        Text
'# We are on Windows' Comment.Single
'\n'          Text

'elsif'       Keyword
' '           Text
'unix'        Name.Variable.Global
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number
' '           Text
'or'          Operator.Word
' '           Text
'!'           Operator
'macintosh'   Name.Variable.Global
'\n  '        Text
'exitScript'  Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'We are on Linux' Literal.String
'"'           Literal.String
'\n'          Text

'else'        Keyword
' '           Text
'macintosh'   Name.Variable.Global
' '           Text
'=='          Operator
' '           Text
'1'           Literal.Number
'\n  '        Text
'exit'        Keyword
' '           Text
'We are on Mac' Literal.String
'\n'          Text

'endif'       Keyword
'\n\n'        Text

'# Interpolation with precision digits' Comment.Single
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'a:3'"       Literal.String.Interpol
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'a.a:3'"     Literal.String.Interpol
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'a[1]:3'"    Literal.String.Interpol
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'a1:3'"      Literal.String.Interpol
'\n'          Text

'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'a:3'"       Literal.String.Interpol
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'a.a:3'"     Literal.String.Interpol
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'a[1]:3'"    Literal.String.Interpol
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'a1:3'"      Literal.String.Interpol
'"'           Literal.String
'\n\n'        Text

'# Interpolations are not recursive' Comment.Single
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'a'"         Literal.String.Interpol
'1'           Literal.String
"'"           Literal.String
':3'          Literal.String
"'"           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'a'"         Literal.String.Interpol
'1'           Literal.String
"'"           Literal.String
':3'          Literal.String
"'"           Literal.String
'"'           Literal.String
'\n\n'        Text

'# Interpolation without precision digits' Comment.Single
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'var'"       Literal.String.Interpol
' '           Text
'numeric'     Literal.String
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'var$'"      Literal.String.Interpol
' '           Text
'string'      Literal.String
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
'\'var["a"]\'' Literal.String.Interpol
' '           Text
'numeric hash' Literal.String
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
'\'var$["a"]\'' Literal.String.Interpol
' '           Text
'string hash' Literal.String
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'var[1]'"    Literal.String.Interpol
' '           Text
'numeric indexed variable' Literal.String
'\n'          Text

'echo'        Keyword
' '           Text
'unquoted '   Literal.String
"'var$[1]'"   Literal.String.Interpol
' '           Text
'string indexed variable' Literal.String
'\n'          Text

'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'var'"       Literal.String.Interpol
' numeric'    Literal.String
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'var$'"      Literal.String.Interpol
' string'     Literal.String
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
'\'var["a"]\'' Literal.String.Interpol
' numeric hash' Literal.String
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
'\'var$["a"]\'' Literal.String.Interpol
' string hash' Literal.String
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'var[1]'"    Literal.String.Interpol
' numeric indexed variable' Literal.String
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'quoted '     Literal.String
"'var$[1]'"   Literal.String.Interpol
' string indexed variable' Literal.String
'"'           Literal.String
'\n\n'        Text

'# Indeces in interpolations must be literal' Comment.Single
'\n'          Text

'echo'        Keyword
' '           Text
"'"           Literal.String
'var[a]'      Literal.String
"'"           Literal.String
'\n'          Text

'echo'        Keyword
' '           Text
"'"           Literal.String
'var[a$]'     Literal.String
"'"           Literal.String
'\n'          Text

'\n'          Text

'string$'     Text
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'But don'     Literal.String
"'"           Literal.String
't interpolate everything!' Literal.String
'"'           Literal.String
'\n'          Text

'string$'     Text
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'interpolatin' Literal.String
"'"           Literal.String
' '           Literal.String
'"'           Literal.String
' '           Text
'+'           Operator
' '           Text
'"'           Literal.String
'across'      Literal.String
'"'           Literal.String
' '           Text
'+'           Operator
' '           Text
'"'           Literal.String
' strings ain' Literal.String
"'"           Literal.String
't cool either' Literal.String
'"'           Literal.String
'\n'          Text

'string$'     Name.Function
'('           Punctuation
'10'          Literal.Number
')'           Text
' '           Text
'; This is a function' Comment.Single
'\n\n'        Text

'repeat'      Keyword
'\n  '        Text
'string$'     Text
' '           Text
'='           Operator
' '           Text
'string$'     Text
' '           Text
'-'           Operator
' '           Text
'right$'      Name.Function
'('           Punctuation
'string$'     Text
')'           Text
'\n'          Text

'until'       Keyword
' '           Text
'!'           Operator
'length'      Name.Function
'('           Punctuation
'string$'     Text
')'           Text
'\n\n'        Text

'T'           Keyword
'ext'         Keyword
'...'         Keyword
' '           Text
'1'           Literal.Number
' '           Text
'R'           Text
'ight'        Text
' '           Text
'0.2'         Literal.Number
' '           Text
'H'           Text
'alf'         Text
' '           Text
'many'        Text
'-'           Operator
'-'           Operator
'-'           Operator
'-'           Operator
'hyphens'     Text
'\n'          Text

'T'           Keyword
'ext'         Keyword
'...'         Keyword
' '           Text
'1'           Literal.Number
' '           Text
'R'           Text
'ight'        Text
' '           Text
'-'           Operator
'0.4'         Literal.Number
' '           Text
'B'           Text
'ottom'       Text
' '           Text
'aحبيبa'      Text
'\n'          Text

'T'           Keyword
'ext'         Keyword
'...'         Keyword
' '           Text
'1'           Literal.Number
' '           Text
'R'           Text
'ight'        Text
' '           Text
'-'           Operator
'0.6'         Literal.Number
' '           Text
'B'           Text
'ottom'       Text
' '           Text
'日'           Text
'本'           Text
'\n'          Text

'D'           Keyword
'raw '        Keyword
'circle '     Keyword
'(mm)'        Keyword
'...'         Keyword
' '           Text
'0.5'         Literal.Number
' '           Text
'0.5'         Literal.Number
' '           Text
'i'           Text
'\n'          Text

'\n'          Text

'rows'        Text
'   '         Text
'='           Operator
' '           Text
'Object'      Name.Builtin
'_'           Name.Builtin
"'table'"     Literal.String.Interpol
'.nrow'       Name.Builtin
'\n'          Text

'value$'      Text
' '           Text
'='           Operator
' '           Text
'Table'       Name.Builtin
'_'           Name.Builtin
"'table'"     Literal.String.Interpol
'$'           Name.Builtin
'['           Text
'25'          Literal.Number
','           Punctuation
' '           Text
'"'           Literal.String
'f0'          Literal.String
'"'           Literal.String
']'           Punctuation
'\n'          Text

'fixed'       Text
'  '          Text
'='           Operator
' '           Text
'Sound'       Name.Builtin
'_'           Name.Builtin
'10'          Name.Builtin
'.xmin'       Name.Builtin
'\n'          Text

'fixed'       Text
'  '          Text
'='           Operator
' '           Text
'Object'      Name.Builtin
'_'           Name.Builtin
'foo'         Name.Builtin
'.xmin'       Name.Builtin
'\n'          Text

'fixed'       Text
'  '          Text
'='           Operator
' '           Text
'Procrustes'  Name.Builtin
'_'           Name.Builtin
'foo'         Name.Builtin
'.nx'         Name.Builtin
'\n'          Text

'var'         Text
'['           Punctuation
'"'           Literal.String
'vaa'         Literal.String
'"'           Literal.String
']'           Text
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number
' '           Text
'; Hash'      Comment.Single
'\n\n'        Text

'# Special two-word keyword' Comment.Single
'\n'          Text

'select'      Keyword
' '           Text
'all'         Text
'\n'          Text

'# Keyword with a predefined variable' Comment.Single
'\n'          Text

'select'      Keyword
'  '          Text
'all'         Text
'\n\n'        Text

'# old-style procedure call' Comment.Single
'\n'          Text

'call'        Keyword
' '           Text
'oldStyle'    Name.Function
' '           Text
'"'           Literal.String
'quoted'      Literal.String
'"'           Literal.String
' '           Text
'2'           Literal.Number
' '           Text
'unquoted'    Text
' '           Text
'string'      Text
'\n'          Text

'assert'      Keyword
' '           Text
'oldStyle.local' Text
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number
'\n\n'        Text

'# New-style procedure call with parens' Comment.Single
'\n'          Text

'@'           Name.Function
'newStyle'    Name.Function
'('           Text
'"'           Literal.String
'quoted'      Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'2'           Literal.Number
','           Punctuation
' '           Text
'"'           Literal.String
'quoted string' Literal.String
'"'           Literal.String
')'           Punctuation
'\n'          Text

'if'          Keyword
' '           Text
'praatVersion' Name.Variable.Global
' '           Text
'>='          Operator
' '           Text
'5364'        Literal.Number
'\n  '        Text
'# New-style procedure call with colon' Comment.Single
'\n  '        Text
'@'           Name.Function
'newStyle'    Name.Function
':'           Text
' '           Text
'"'           Literal.String
'quoted'      Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'2'           Literal.Number
','           Punctuation
' '           Text
'"'           Literal.String
'quoted string' Literal.String
'"'           Literal.String
'\n'          Text

'endif'       Keyword
'\n\n'        Text

'# inline if with inline comment' Comment.Single
'\n'          Text

'var'         Text
' '           Text
'='           Operator
' '           Text
'if'          Keyword
' '           Text
'macintosh'   Name.Variable.Global
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number
' '           Text
'then'        Keyword
' '           Text
'0'           Literal.Number
' '           Text
'else'        Keyword
' '           Text
'1'           Literal.Number
' '           Text
'fi'          Keyword
' '           Text
'; This is an inline comment' Comment.Single
'\n\n'        Text

'# for-loop with explicit from using local variable' Comment.Single
'\n'          Text

'# and paren-style function calls and variable interpolation' Comment.Single
'\n'          Text

'n'           Text
' '           Text
'='           Operator
' '           Text
'numberOfSelected' Name.Function
'('           Punctuation
'"'           Literal.String
'Sound'       Literal.String
'"'           Literal.String
')'           Text
'\n'          Text

'for'         Keyword
' '           Text
'i'           Text
' '           Text
'from'        Keyword
' '           Text
'newStyle.local' Text
' '           Text
'to'          Keyword
' '           Text
'n'           Text
'\n  '        Text
'name'        Text
' '           Text
'='           Operator
' '           Text
'selected$'   Name.Function
'('           Punctuation
'extractWord$' Name.Function
'('           Punctuation
'selected$'   Name.Function
'('           Punctuation
')'           Text
','           Punctuation
' '           Text
'"'           Literal.String
' '           Literal.String
'"'           Literal.String
')'           Text
')'           Text
'\n  '        Text
'sound'       Text
"'i'"         Literal.String.Interpol
' '           Text
'='           Operator
' '           Text
'selected'    Name.Function
'('           Punctuation
'"'           Literal.String
'Sound'       Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'i'           Text
'+'           Operator
'('           Text
'a'           Text
'*'           Operator
'b'           Text
')'           Text
')'           Punctuation
'\n  '        Text
'sound'       Text
'['           Punctuation
'i'           Text
']'           Text
' '           Text
'='           Operator
' '           Text
'sound'       Text
"'i'"         Literal.String.Interpol
'\n'          Text

'endfor'      Keyword
'\n\n'        Text

'i'           Text
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number
'\n'          Text

'while'       Keyword
' '           Text
'i'           Text
' '           Text
'<'           Operator
' '           Text
'n'           Text
'\n  '        Text
'i'           Text
' '           Text
'+='          Operator
' '           Text
'1'           Literal.Number
'\n  '        Text
'# Different styles of object selection' Comment.Single
'\n  '        Text
'select'      Keyword
' '           Text
'sound'       Text
"'i'"         Literal.String.Interpol
'\n  '        Text
'sound'       Text
' '           Text
'='           Operator
' '           Text
'selected'    Name.Function
'('           Punctuation
')'           Text
'\n  '        Text
'sound$'      Text
' '           Text
'='           Operator
' '           Text
'selected$'   Name.Function
'('           Punctuation
'"'           Literal.String
'Sound'       Literal.String
'"'           Literal.String
')'           Text
'\n  '        Text
'select'      Keyword
' '           Text
'Sound'       Name.Class
' '           Text
"'sound$'"    Literal.String.Interpol
'\n'          Text

'  '          Text
'selectObject' Name.Function
'('           Punctuation
' '           Text
'sound'       Text
'['           Punctuation
'i'           Text
']'           Text
')'           Text
'\n  '        Text
'selectObject' Name.Function
':'           Punctuation
' '           Text
'sound'       Text
'\n\n'        Text

'  '          Text
'# Pause commands' Comment.Single
'\n  '        Text
'beginPause'  Name.Function
'('           Punctuation
'"'           Literal.String
'Viewing '    Literal.String
'"'           Literal.String
' '           Text
'+'           Operator
' '           Text
'sound$'      Text
')'           Text
'\n  '        Text
'if'          Keyword
' '           Text
'i'           Text
' '           Text
'>'           Operator
' '           Text
'1'           Literal.Number
'\n    '      Text
'button'      Text
' '           Text
'='           Operator
' '           Text
'endPause'    Name.Function
'('           Punctuation
'"'           Literal.String
'Stop'        Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'Previous'    Literal.String
'"'           Literal.String
','           Punctuation
'\n      '    Text
'...'         Punctuation
'if'          Keyword
' '           Text
'i'           Text
' '           Text
'='           Operator
' '           Text
'total_sounds' Text
' '           Text
'then'        Keyword
' '           Text
'"'           Literal.String
'Finish'      Literal.String
'"'           Literal.String
' '           Text
'else'        Keyword
' '           Text
'"'           Literal.String
'Next'        Literal.String
'"'           Literal.String
' '           Text
'fi'          Keyword
','           Punctuation
'\n      '    Text
'...'         Punctuation
'3'           Literal.Number
','           Punctuation
' '           Text
'1'           Literal.Number
')'           Text
'\n  '        Text
'else'        Keyword
'\n    '      Text
'button'      Text
' '           Text
'='           Operator
' '           Text
'endPause'    Name.Function
'('           Punctuation
'"'           Literal.String
'Stop'        Literal.String
'"'           Literal.String
','           Punctuation
'\n      '    Text
'...'         Punctuation
'if'          Keyword
' '           Text
'i'           Text
' '           Text
'='           Operator
' '           Text
'total_sounds' Text
' '           Text
'then'        Keyword
' '           Text
'"'           Literal.String
'Finish'      Literal.String
'"'           Literal.String
' '           Text
'else'        Keyword
' '           Text
'"'           Literal.String
'Next'        Literal.String
'"'           Literal.String
' '           Text
'fi'          Keyword
','           Punctuation
'\n      '    Text
'...'         Punctuation
'2'           Literal.Number
','           Punctuation
' '           Text
'1'           Literal.Number
')'           Text
'\n  '        Text
'endif'       Keyword
'\n  '        Text
'editor_name$' Text
' '           Text
'='           Operator
' '           Text
'if'          Keyword
' '           Text
'total_textgrids' Text
' '           Text
'then'        Keyword
' '           Text
'"'           Literal.String
'TextGrid '   Literal.String
'"'           Literal.String
' '           Text
'else'        Keyword
' '           Text
'"'           Literal.String
'Sound '      Literal.String
'"'           Literal.String
' '           Text
'fi'          Keyword
' '           Text
'+'           Operator
' '           Text
'name$'       Text
'\n  '        Text
'nocheck'     Keyword
' '           Text
'editor'      Keyword
' '           Text
'Sound'       Name.Class
' '           Text
"'editor_name$'" Literal.String.Interpol
'\n'          Text

'    '        Text
'nocheck'     Keyword
' '           Text
'C'           Keyword
'lose'        Keyword
'\n'          Text

'  '          Text
'nocheck'     Keyword
' '           Text
'endeditor'   Keyword
'\n  '        Text
'editor_id'   Text
' '           Text
'='           Operator
' '           Text
'editor'      Name.Function
':'           Punctuation
' '           Text
'editor_name$' Text
'\n'          Text

'    '        Text
'C'           Keyword
'lose'        Keyword
'\n'          Text

'  '          Text
'endeditor'   Keyword
'\n\n  '      Text
'# New-style standalone command call' Comment.Single
'\n  '        Text
'R'           Keyword
'ename'       Keyword
':'           Keyword
' '           Text
'"'           Literal.String
'SomeName'    Literal.String
'"'           Literal.String
'\n\n'        Text

'  '          Text
'# Command call with assignment' Comment.Single
'\n  '        Text
'duration'    Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
'total '      Keyword
'duration'    Keyword
'\n'          Text

'\n  '        Text
'# Multi-line command with modifier' Comment.Single
'\n  '        Text
'pitch'       Text
' '           Text
'='           Operator
' '           Text
'noprogress'  Keyword
' '           Text
'T'           Keyword
'o '          Keyword
'Pitch '      Keyword
'(ac)'        Keyword
':'           Keyword
' '           Text
'0'           Literal.Number
','           Punctuation
' '           Text
'75'          Literal.Number
','           Punctuation
' '           Text
'15'          Literal.Number
','           Punctuation
' '           Text
'"'           Literal.String
'no'          Literal.String
'"'           Literal.String
','           Punctuation
'\n    '      Text
'...'         Punctuation
'0.03'        Literal.Number
','           Punctuation
' '           Text
'0.45'        Literal.Number
','           Punctuation
' '           Text
'0.01'        Literal.Number
','           Punctuation
' '           Text
'0.35'        Literal.Number
','           Punctuation
' '           Text
'0.14'        Literal.Number
','           Punctuation
' '           Text
'600'         Literal.Number
'\n'          Text

'  '          Text
'# Formulas are strings' Comment.Single
'\n  '        Text
'F'           Keyword
'ormula'      Keyword
':'           Keyword
' '           Text
'"'           Literal.String
'if col = 1 then row * Object_' Literal.String
"'pitch'"     Literal.String.Interpol
'.dx + '      Literal.String
"'first'"     Literal.String.Interpol
' else self fi' Literal.String
'"'           Literal.String
'\n\n'        Text

'  '          Text
'# do-style command with assignment' Comment.Single
'\n  '        Text
'minimum'     Text
' '           Text
'='           Operator
' '           Text
'do'          Name.Function
'('           Punctuation
'"'           Literal.String
'Get minimum...' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'0'           Literal.Number
','           Punctuation
' '           Text
'0'           Literal.Number
','           Punctuation
' '           Text
'"'           Literal.String
'Hertz'       Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'Parabolic'   Literal.String
'"'           Literal.String
')'           Text
'\n\n  '      Text
'# New-style multi-line command call with broken strings' Comment.Single
'\n  '        Text
'table'       Text
' '           Text
'='           Operator
' '           Text
'C'           Keyword
'reate '      Keyword
'Table '      Keyword
'with '       Keyword
'column '     Keyword
'names'       Keyword
':'           Keyword
' '           Text
'"'           Literal.String
'table'       Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'0'           Literal.Number
','           Punctuation
'\n    '      Text
'...'         Punctuation
'"'           Literal.String
'file subject speaker' Literal.String
'\n    '      Text
'...'         Punctuation
' f0 f1 f2 f' Literal.String
'"'           Literal.String
' '           Text
'+'           Operator
' '           Text
'string$'     Name.Function
'('           Punctuation
'3'           Literal.Number
')'           Text
' '           Text
'+'           Operator
' '           Text
'"'           Literal.String
' '           Literal.String
'"'           Literal.String
' '           Text
'+'           Operator
'\n    '      Text
'...'         Punctuation
'"'           Literal.String
'duration response' Literal.String
'"'           Literal.String
'\n\n'        Text

'  '          Text
'# Function call with trailing space' Comment.Single
'\n  '        Text
'removeObject' Name.Function
':'           Punctuation
' '           Text
'pitch'       Text
','           Punctuation
' '           Text
'table'       Text
'\n\n'        Text

'  '          Text
'# Picture window commands' Comment.Single
'\n  '        Text
'selectObject' Name.Function
':'           Punctuation
' '           Text
'sound'       Text
'\n'          Text

'  '          Text
'# do-style command' Comment.Single
'\n  '        Text
'do'          Name.Function
'('           Punctuation
'"'           Literal.String
'Select inner viewport...' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'1'           Literal.Number
','           Punctuation
' '           Text
'6'           Literal.Number
','           Punctuation
' '           Text
'0.5'         Literal.Number
','           Punctuation
' '           Text
'1.5'         Literal.Number
')'           Text
'\n  '        Text
'B'           Keyword
'lack'        Keyword
'\n'          Text

'  '          Text
'D'           Keyword
'raw'         Keyword
'...'         Keyword
' '           Text
'0'           Literal.Number
' '           Text
'0'           Literal.Number
' '           Text
'0'           Literal.Number
' '           Text
'0'           Literal.Number
' '           Text
'"'           Literal.String
'no'          Literal.String
'"'           Literal.String
' '           Text
'C'           Text
'urve'        Text
'\n'          Text

'  '          Text
'D'           Keyword
'raw '        Keyword
'inner '      Keyword
'box'         Keyword
'\n'          Text

'  '          Text
'T'           Keyword
'ext '        Keyword
'bottom'      Keyword
':'           Keyword
' '           Text
'"'           Literal.String
'yes'         Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'sound$'      Text
'\n'          Text

'  '          Text
'E'           Keyword
'rase '       Keyword
'all'         Keyword
'\n'          Text

'\n  '        Text
'# Demo window commands' Comment.Single
'\n  '        Text
'demo'        Keyword
' '           Text
'E'           Keyword
'rase '       Keyword
'all'         Keyword
'\n'          Text

'  '          Text
'demo'        Keyword
' '           Text
'S'           Keyword
'elect '      Keyword
'inner '      Keyword
'viewport'    Keyword
'...'         Keyword
' '           Text
'0'           Literal.Number
' '           Text
'100'         Literal.Number
' '           Text
'0'           Literal.Number
' '           Text
'100'         Literal.Number
'\n'          Text

'  '          Text
'demo'        Keyword
' '           Text
'A'           Keyword
'xes'         Keyword
'...'         Keyword
' '           Text
'0'           Literal.Number
' '           Text
'100'         Literal.Number
' '           Text
'0'           Literal.Number
' '           Text
'100'         Literal.Number
'\n'          Text

'  '          Text
'demo'        Keyword
' '           Text
'P'           Keyword
'aint '       Keyword
'rectangle'   Keyword
'...'         Keyword
' '           Text
'white'       Text
' '           Text
'0'           Literal.Number
' '           Text
'100'         Literal.Number
' '           Text
'0'           Literal.Number
' '           Text
'100'         Literal.Number
'\n'          Text

'  '          Text
'demo'        Keyword
' '           Text
'T'           Keyword
'ext'         Keyword
'...'         Keyword
' '           Text
'50'          Literal.Number
' '           Text
'centre'      Text
' '           Text
'50'          Literal.Number
' '           Text
'half'        Text
' '           Text
'C'           Text
'lick'        Text
' '           Text
'to'          Text
' '           Text
'finish'      Text
'\n'          Text

'  '          Text
'demoWaitForInput' Name.Function
' '           Text
'('           Punctuation
' )'          Text
'\n  '        Text
'demo'        Keyword
' '           Text
'E'           Keyword
'rase '       Keyword
'all'         Keyword
'\n'          Text

'  '          Text
'demo'        Keyword
' '           Text
'T'           Keyword
'ext'         Keyword
':'           Keyword
' '           Text
'50'          Literal.Number
','           Punctuation
' '           Text
'"'           Literal.String
'centre'      Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'50'          Literal.Number
','           Punctuation
' '           Text
'"'           Literal.String
'half'        Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'Finished'    Literal.String
'"'           Literal.String
'\n'          Text

'endwhile'    Keyword
'\n\n'        Text

'switch$'     Text
' '           Text
'='           Operator
' '           Text
'if'          Keyword
' '           Text
'switch'      Text
' '           Text
'=='          Operator
' '           Text
'1'           Literal.Number
' '           Text
'then'        Keyword
' '           Text
'"'           Literal.String
'a'           Literal.String
'"'           Literal.String
' '           Text
'else'        Keyword
'\n  '        Text
'...'         Punctuation
'     '       Text
'if'          Keyword
' '           Text
'switch'      Text
' '           Text
'=='          Operator
' '           Text
'2'           Literal.Number
' '           Text
'then'        Keyword
' '           Text
'"'           Literal.String
'b'           Literal.String
'"'           Literal.String
' '           Text
'else'        Keyword
'\n  '        Text
'...'         Punctuation
'     '       Text
'if'          Keyword
' '           Text
'switch'      Text
' '           Text
'=='          Operator
' '           Text
'3'           Literal.Number
' '           Text
'then'        Keyword
' '           Text
'"'           Literal.String
'c'           Literal.String
'"'           Literal.String
' '           Text
'else'        Keyword
'\n  '        Text
'...'         Punctuation
'     '       Text
'if'          Keyword
' '           Text
'switch'      Text
' '           Text
'=='          Operator
' '           Text
'4'           Literal.Number
' '           Text
'then'        Keyword
' '           Text
'"'           Literal.String
'd'           Literal.String
'"'           Literal.String
' '           Text
'else'        Keyword
'\n  '        Text
'...'         Punctuation
'     '       Text
'"'           Literal.String
'default'     Literal.String
'"'           Literal.String
' '           Text
'fi'          Keyword
' '           Text
'fi'          Keyword
' '           Text
'fi'          Keyword
' '           Text
'fi'          Keyword
'\n\n'        Text

'# An old-style sendpraat block' Comment.Single
'\n'          Text

'# All these lines should be a string!' Comment.Single
'\n'          Text

'sendpraat'   Keyword
' '           Text
'Praat'       Literal.String
'\n  '        Text
'...'         Punctuation
"'newline$'"  Literal.String.Interpol
' '           Text
'Create Sound as pure tone... "tone" 1 0 0.4 44100 440 0.2 0.01 0.01' Literal.String
'\n  '        Text
'...'         Punctuation
"'newline$'"  Literal.String.Interpol
' '           Text
'Play'        Literal.String
'\n  '        Text
'...'         Punctuation
"'newline$'"  Literal.String.Interpol
' '           Text
'Remove'      Literal.String
'\n'          Text

'\n'          Text

'# A new-style sendpraat block' Comment.Single
'\n'          Text

'beginSendPraat' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'Praat'       Literal.String
'"'           Literal.String
'\n'          Text

'  '          Text
'C'           Keyword
'reate '      Keyword
'Sound '      Keyword
'as '         Keyword
'pure '       Keyword
'tone'        Keyword
':'           Keyword
' '           Text
'"'           Literal.String
'tone'        Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'1'           Literal.Number
','           Punctuation
' '           Text
'0'           Literal.Number
','           Punctuation
' '           Text
'0.4'         Literal.Number
','           Punctuation
' '           Text
'44100'       Literal.Number
','           Punctuation
' '           Text
'440'         Literal.Number
','           Punctuation
' '           Text
'0.2'         Literal.Number
','           Punctuation
' '           Text
'0.01'        Literal.Number
','           Punctuation
' '           Text
'0.01'        Literal.Number
'\n'          Text

'  '          Text
'duration'    Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
'total '      Keyword
'duration'    Keyword
'\n'          Text

'  '          Text
'R'           Keyword
'emove'       Keyword
'\n'          Text

'endSendPraat' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'duration'    Literal.String
'"'           Literal.String
'\n'          Text

'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'"'           Literal.String
'The generated sound lasted for ' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'duration'    Text
','           Punctuation
' '           Text
'"'           Literal.String
'seconds'     Literal.String
'"'           Literal.String
'\n\n'        Text

'# Number types' Comment.Single
'\n'          Text

'a'           Text
' '           Text
'='           Operator
'   '         Text
'10%'         Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
'  '          Text
'-'           Operator
'10'          Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
'  '          Text
'+'           Operator
'10'          Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
'   '         Text
'10.4'        Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
'  '          Text
'294e12'      Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
'    '        Text
'2.94e12'     Literal.Number
'\n\n'        Text

'# Operators' Comment.Single
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'2'           Literal.Number
' '           Text
'^'           Operator
' '           Text
'-'           Operator
'6'           Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'-'           Operator
'('           Punctuation
'1'           Literal.Number
'+'           Operator
'1'           Literal.Number
')'           Punctuation
'^'           Operator
'6'           Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'4'           Literal.Number
'^'           Operator
'3'           Literal.Number
' '           Text
'^'           Operator
' '           Text
'2'           Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'54'          Literal.Number
' '           Text
'div'         Operator.Word
' '           Text
'5.1'         Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'54.3'        Literal.Number
' '           Text
'mod'         Operator.Word
' '           Text
'5'           Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'3'           Literal.Number
' '           Text
'*'           Operator
'*'           Operator
' '           Text
'8'           Literal.Number
' '           Text
'-'           Operator
' '           Text
'7'           Literal.Number
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'3'           Literal.Number
' '           Text
'/'           Operator
' '           Text
'('           Punctuation
'8'           Literal.Number
' '           Text
'+'           Operator
' '           Text
'7'           Literal.Number
')'           Punctuation
'\n'          Text

'a'           Text
' '           Text
'='           Operator
' '           Text
'('           Punctuation
'7'           Literal.Number
' '           Text
'*'           Operator
' '           Text
'('           Punctuation
'3'           Literal.Number
' '           Text
'+'           Operator
' '           Text
'5'           Literal.Number
')'           Punctuation
')'           Punctuation
' '           Text
'/'           Operator
' '           Text
'('           Punctuation
'('           Punctuation
'2'           Literal.Number
' '           Text
'+'           Operator
' '           Text
'3'           Literal.Number
')'           Punctuation
' '           Text
'-'           Operator
' '           Text
'1'           Literal.Number
')'           Punctuation
'\n\n'        Text

'# Logical operators' Comment.Single
'\n'          Text

'assert'      Keyword
' '           Text
'('           Punctuation
'a'           Text
' '           Text
'='           Operator
'   '         Text
'b'           Text
')'           Punctuation
' '           Text
'and'         Operator.Word
' '           Text
'c'           Text
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'=='          Operator
' '           Text
'('           Punctuation
'b'           Text
'  '          Text
'or'          Operator.Word
'  '          Text
'c'           Text
')'           Punctuation
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'<='          Operator
'  '          Text
'b'           Text
'  '          Text
'not'         Operator.Word
' '           Text
'c'           Text
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'>='          Operator
'  '          Text
'b'           Text
'     '       Text
'!'           Operator
'c'           Text
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'!='          Operator
'  '          Text
'b'           Text
'  '          Text
'&'           Operator
'   '         Text
'c'           Text
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'!='          Operator
'  '          Text
'b'           Text
'  '          Text
'&&'          Operator
'  '          Text
'c'           Text
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'<'           Operator
'>'           Operator
'  '          Text
'b'           Text
'  '          Text
'||'          Operator
'  '          Text
'c'           Text
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'<'           Operator
'   '         Text
'b'           Text
'  '          Text
'|'           Operator
'   '         Text
'c'           Text
'\n'          Text

'assert'      Keyword
'  '          Text
'a'           Text
' '           Text
'>'           Operator
'   '         Text
'b'           Text
'\n\n'        Text

'assert'      Keyword
' '           Text
'('           Punctuation
'a'           Text
')'           Punctuation
'or'          Operator.Word
' '           Text
'('           Punctuation
'b'           Text
')'           Punctuation
'\n'          Text

'assert'      Keyword
' '           Text
'('           Punctuation
'a'           Text
')'           Punctuation
' '           Text
'or'          Operator.Word
'('           Punctuation
'b'           Text
')'           Punctuation
'\n'          Text

'assert'      Keyword
' '           Text
'('           Punctuation
'a'           Text
')'           Punctuation
'and'         Operator.Word
'('           Punctuation
'b'           Text
')'           Punctuation
'\n\n'        Text

'assert'      Keyword
' '           Text
'"'           Literal.String
'hello'       Literal.String
'"'           Literal.String
' '           Text
'='           Operator
'  '          Text
'"'           Literal.String
'he'          Literal.String
'"'           Literal.String
' '           Text
'+'           Operator
' '           Text
'"'           Literal.String
'llo'         Literal.String
'"'           Literal.String
'\n'          Text

'assert'      Keyword
' '           Text
'"'           Literal.String
'hello'       Literal.String
'"'           Literal.String
' '           Text
'=='          Operator
' '           Text
'"'           Literal.String
'hello world' Literal.String
'"'           Literal.String
' '           Text
'-'           Operator
' '           Text
'"'           Literal.String
' world'      Literal.String
'"'           Literal.String
'\n\n'        Text

'stopwatch'   Keyword
'\n'          Text

'time'        Text
' '           Text
'='           Operator
' '           Text
'stopwatch'   Keyword
'\n'          Text

'clearinfo'   Keyword
'\n'          Text

'echo'        Keyword
' '           Text
'This script took' Literal.String
'\n'          Text

'print'       Keyword
' '           Text
"'time'"      Literal.String.Interpol
' '           Text
'seconds to'  Literal.String
'\n'          Text

'printline'   Keyword
' '           Text
'execute.'    Literal.String
'\n'          Text

'\n'          Text

'# Old-style procedure declaration' Comment.Single
'\n'          Text

'procedure'   Keyword
' '           Text
'oldStyle'    Name.Function
' .str1$ .num .str2$' Text
'\n  '        Text
'.local'      Text
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number
'\n'          Text

'endproc'     Keyword
'\n\n'        Text

'# New-style procedure declaration with parentheses' Comment.Single
'\n'          Text

'procedure'   Keyword
' '           Text
'newStyle'    Name.Function
' ('          Text
'.str1$'      Text
','           Punctuation
' '           Text
'.num'        Text
','           Punctuation
' '           Text
'.str2$'      Text
')'           Punctuation
'\n  '        Text
'# Command with "local" variable' Comment.Single
'\n  '        Text
'.local'      Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
'total '      Keyword
'duration'    Keyword
'\n'          Text

'  '          Text
'.local'      Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
"'some'"      Literal.String.Interpol
' duration'   Keyword
'\n'          Text

'  '          Text
'.local'      Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
"'some[1]'"   Literal.String.Interpol
' value'      Keyword
'...'         Keyword
' '           Text
'hello'       Text
' '           Text
'10'          Literal.Number
' '           Text
'p'           Text
'['           Punctuation
'i'           Text
']'           Text
'\n'          Text

'  '          Text
'.local'      Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
"'some[1,3]'" Literal.String.Interpol
' value'      Keyword
':'           Keyword
' '           Text
'"'           Literal.String
'hello'       Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'10'          Literal.Number
','           Punctuation
' '           Text
'p'           Text
'['           Punctuation
'i'           Text
']'           Text
'\n'          Text

'  '          Text
'.local'      Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
"'some$'"     Literal.String.Interpol
' duration'   Keyword
'\n'          Text

'  '          Text
'.local'      Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
"'some$[1]'"  Literal.String.Interpol
' duration'   Keyword
'\n'          Text

'endproc'     Keyword
'\n\n'        Text

'# New-style procedure declaration with colon' Comment.Single
'\n'          Text

'procedure'   Keyword
' '           Text
'_new_style'  Name.Function
':'           Text
' '           Text
'.str1$'      Text
','           Punctuation
' '           Text
'.num'        Text
','           Punctuation
' '           Text
'.str2$'      Text
'\n  '        Text
'# Command with "local" variable' Comment.Single
'\n  '        Text
'# Initial underscores in variables not allowed (unless interpolated)' Comment.Single
'\n  '        Text
'_new_style.local' Text
' '           Text
'='           Operator
' '           Text
'G'           Keyword
'et '         Keyword
'total '      Keyword
'duration'    Keyword
'\n'          Text

'endproc'     Keyword
'\n\n'        Text

'asserterror' Keyword
' '           Text
'Unknown symbol:' Literal.String
"'newline$'"  Literal.String.Interpol
'« _'         Literal.String
'\n'          Text

'assert'      Keyword
' '           Text
"'_new_style.local'" Literal.String.Interpol
'\n\n'        Text

'@'           Name.Function
'proc'        Name.Function
':'           Text
' '           Text
'a'           Text
','           Punctuation
' '           Text
'selected'    Name.Function
'('           Punctuation
'"'           Literal.String
'string'      Literal.String
'"'           Literal.String
')'           Text
','           Punctuation
' '           Text
'b'           Text
'\n'          Text

'# Comment'   Comment.Single
'\n\n'        Text

'for'         Keyword
' '           Text
'i'           Text
' '           Text
'to'          Keyword
' '           Text
'saveSelection.n' Text
'\n  '        Text
'selectObject' Name.Function
':'           Punctuation
' '           Text
'saveSelection.id' Text
'['           Punctuation
'i'           Text
']'           Text
'\n'          Text

'  '          Text
'appendInfoLine' Name.Function
':'           Punctuation
' '           Text
'selected$'   Name.Function
'('           Punctuation
')'           Text
'\n'          Text

'endfor'      Keyword
'\n\n'        Text

'@'           Name.Function
'ok'          Name.Function
'('           Text
'if'          Keyword
' '           Text
'selected$'   Name.Function
'('           Punctuation
'"'           Literal.String
'Sound'       Literal.String
'"'           Literal.String
')'           Text
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'tone'        Literal.String
'"'           Literal.String
' '           Text
'then'        Keyword
' '           Text
'1'           Literal.Number
' '           Text
'else'        Keyword
' '           Text
'0'           Literal.Number
' '           Text
'fi'          Keyword
','           Punctuation
'\n  '        Text
'...'         Punctuation
' '           Text
'"'           Literal.String
'selected sound is tone' Literal.String
'"'           Literal.String
')'           Punctuation
'\n\n'        Text

'@'           Name.Function
'ok_formula'  Name.Function
'('           Text
'"'           Literal.String
'selected$('  Literal.String
'"'           Literal.String
'"'           Literal.String
'Sound'       Literal.String
'"'           Literal.String
'"'           Literal.String
') = '        Literal.String
'"'           Literal.String
'"'           Literal.String
'tone'        Literal.String
'"'           Literal.String
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'selected sound is tone' Literal.String
'"'           Literal.String
')'           Punctuation
'\n'          Text
