======
symbol
======
:foo
:foo!
:foo?
:foo=
:@foo
:@foo_0123_bar
:@@foo
:$foo
:$0
:_bar
:åäö
---
(program
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol))
======
symbol operators
======
:+
:-
:+@
:-@
:[]
:[]=
:&
:!
:`
:^
:|
:~
:/
:%
:*
:**
:==
:===
:=~
:>
:>=
:>>
:<
:<=
:<<
:<=>
---
(program
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol)
(symbol))
====================
single quoted symbol
====================
:'foo bar'
:'#{'
---
(program
(symbol)
(symbol))
====================
double quoted symbol
====================
:"foo bar"
:"#"
---
(program (symbol) (symbol))
=======================================
double quoted symbol with interpolation
=======================================
:"foo #{bar}"
---
(program (symbol (interpolation (identifier))))
=========================================
percent symbol with unbalanced delimiters
=========================================
%s/a/
%s\a\
%s#a#
---
(program (symbol) (symbol) (symbol))
=======================================
percent symbol with balanced delimiters
=======================================
%s{a{b}c}
%sc>
%s(a(b)c)
%s[a[b]c]
---
(program (symbol) (symbol) (symbol) (symbol))
=======================================
global variables
=======================================
$foo
$$
$!
$@
$&
$`
$'
$+
$~
$=
$/
$\
$,
$;
$.
$<
$>
$_
$0
$*
$$
$?
$:
$"
$0
$1
$2
$3
$4
$5
$6
$7
$8
$9
$0
$10
$stdin
$stdout
$stderr
$DEBUG
$FILENAME
$LOAD_PATH
$VERBOSE
---
(program
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable)
(global_variable))
=======
integer
=======
1234
---
(program (integer))
=======
integer as object
=======
3.times
---
(program (call (integer) (identifier)))
=======================
integer with underscore
=======================
1_234
---
(program (integer))
===========================
integer with decimal prefix
===========================
0d1_234
0D1_234
---
(program (integer) (integer))
===============================
integer with hexadecimal prefix
===============================
0xa_bcd_ef0_123_456_789
---
(program (integer))
=========================
integer with octal prefix
=========================
01234567
0o1234567
---
(program (integer) (integer))
==========================
integer with binary prefix
==========================
0b1_0
0B1_0
---
(program (integer) (integer))
=====
float
=====
1.234_5e678_90
1E30
1.0e+6
1.0e-6
---
(program (float) (float) (float) (float))
=====
complex
=====
-2i
+2i
1+1i
1-10i
10+3i
12-34i
---
(program (unary (complex)) (complex) (complex) (complex) (complex) (complex))
========
rational
========
2/3r
---
(program (binary (integer) (rational (integer))))
=======
boolean
=======
true
false
---
(program (true) (false))
===
nil
===
nil
---
(program (nil))
====================
single-quoted string
====================
''
' '
' '
---
(program (string) (string) (string))
==============================================
single-quoted strings with backslashes
==============================================
'\''
'\\ \n'
'\x00\x01\x02'
---
(program
(string)
(string)
(string))
=================================================
single-quoted string with pound and curly brace
=================================================
'#{hello'
---
(program (string))
====================
double-quoted string
====================
""
" "
" "
---
(program (string) (string) (string))
==============================================
double-quoted strings with escape sequences
==============================================
"\""
"\\"
"\d"
"\#{foo}"
---
(program
(string (escape_sequence))
(string (escape_sequence))
(string (escape_sequence))
(string (escape_sequence)))
=================================
double-quoted string with just pound
=================================
"#"
---
(program (string))
=============
interpolation
=============
"#{foo}"
"#{':foo' unless bar}"
---
(program
(string (interpolation (identifier)))
(string (interpolation (unless_modifier (string) (identifier)))))
===========================================
percent q string with unbalanced delimiters
===========================================
%q/a/
%q\a\
%q#a#
---
(program (string) (string) (string))
=========================================
percent q string with balanced delimiters
=========================================
%qc>
%q{a{b}c}
%q[a[b]c]
%q(a(b)c)
---
(program (string) (string) (string) (string))
=========================================
percent string with unbalanced delimiters
=========================================
%/a/
%\a\
%#a#
---
(program (string) (string) (string))
=========================================
percent string with balanced delimiters
=========================================
%c>
%{a{b}c}
%[a[b]c]
%(a(b)c)
---
(program (string) (string) (string) (string))
===========================================
percent Q string with unbalanced delimiters
===========================================
%Q#a#
%Q/a/
%Q\a\
---
(program (string) (string) (string))
=========================================
percent Q string with balanced delimiters
=========================================
%Qc>
%Q{a{b}c}
%Q[a[b]c]
%Q(a(b)c)
---
(program (string) (string) (string) (string))
===============
string chaining
===============
%q(a) "b" "c"
"d" "e"
---
(program
(chained_string (string) (string) (string))
(chained_string (string) (string)))
==========================
newline-delimited strings
==========================
flash[:notice] = "Pattern addition failed for '%s' in '%s'", %
[pattern, key]
----
(program (assignment
(element_reference (identifier) (symbol))
(right_assignment_list (string) (string))))
==========================
% formatting that looks like a newline-delimited strings
==========================
foo("%s '%s' " %
[a, b])
----
(program
(method_call
(identifier)
(argument_list
(binary
(string)
(array (identifier) (identifier))))))
========================================
Single character string literals
========================================
?a
??
?\n
?\\
?\377
?\u{41}
?\M-a
?\C-a
?\M-\C-a
?あ
foo(?/)
---
(program
(character)
(character)
(character)
(character)
(character)
(character)
(character)
(character)
(character)
(character)
(method_call (identifier) (argument_list (character))))
========================================
nested strings with different delimiters
========================================
"abc#{
%r(def(ghi#{
`whoami`
})klm)
}nop"
---
(program
(string (interpolation (regex (interpolation (subshell))))))
========================================
basic heredocs
========================================
<