'# Examples taken from http://crystal-lang.org/docs/' Comment.Single '\n' Text '# Copyright 2012-2018 Manas Technology Solutions.' Comment.Single '\n' Text '# Updated on May 17th, 2018 by @faustinoaq.' Comment.Single '\n\n' Text 'require' Keyword ' ' Text '"' Literal.String.Double 'http/server' Literal.String.Double '"' Literal.String.Double '\n\n' Text 'server' Name ' ' Text '=' Operator ' ' Text 'HTTP' Name '::' Operator 'Server' Name '.' Operator 'new' Name '(' Punctuation '8080' Literal.Number.Integer ')' Punctuation ' ' Text 'do' Keyword ' ' Text '|' Operator 'context' Name '|' Operator '\n ' Text 'context' Name '.' Operator 'response' Name '.' Operator 'content_type' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'text/plain' Literal.String.Double '"' Literal.String.Double '\n ' Text 'context' Name '.' Operator 'response' Name '.' Operator 'print' Name ' ' Text '"' Literal.String.Double 'Hello world! The time is ' Literal.String.Double '#{' Literal.String.Interpol 'Time' Name '.' Operator 'now' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Listening on http://0.0.0.0:8080' Literal.String.Double '"' Literal.String.Double '\n' Text 'server' Name '.' Operator 'listen' Name '\n\n' Text 'module' Keyword ' ' Text 'HTTP' Name.Namespace '\n ' Text 'class' Keyword ' ' Text 'RequestHandler' Name.Class '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'alias' Keyword ' ' Text 'NumericValue' Name.Class ' ' Text '=' Operator ' ' Text 'Float32' Name ' ' Text '|' Operator ' ' Text 'Float64' Name ' ' Text '|' Operator ' ' Text 'Int32' Name ' ' Text '|' Operator ' ' Text 'Int64' Name '\n\n' Text 'enum' Keyword ' ' Text 'Time::' Name.Namespace 'DayOfWeek' Name.Class '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Greeting' Name.Class '\n ' Text 'class_property' Name.Builtin.Pseudo ' ' Text 'global_greeting' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'Hello world' Literal.String.Double '"' Literal.String.Double '\n\n ' Text '@@default_greeting' Name.Variable.Class ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'Hello world' Literal.String.Double '"' Literal.String.Double '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@custom_greeting' Name.Variable.Instance ' ' Text '=' Operator ' ' Text 'nil' Keyword.Constant ')' Punctuation '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'print_greeting' Name.Function '\n ' Text 'greeting' Name ' ' Text '=' Operator ' ' Text '@custom_greeting' Name.Variable.Instance ' ' Text '||' Operator ' ' Text '@@default_greeting' Name.Variable.Class '\n ' Text 'puts' Name.Builtin ' ' Text 'greeting' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'LUCKY_NUMBERS' Name.Constant ' ' Text '=' Operator ' ' Text '[' Operator '3' Literal.Number.Integer ',' Punctuation ' ' Text '7' Literal.Number.Integer ',' Punctuation ' ' Text '11' Literal.Number.Integer ']' Operator '\n' Text 'DOCUMENTATION_URL' Name.Constant ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'http://crystal-lang.org/docs' Literal.String.Double '"' Literal.String.Double '\n\n' Text 'module' Keyword ' ' Text 'Scorecard' Name.Namespace '\n ' Text 'class' Keyword ' ' Text 'Parser' Name.Class '\n ' Text 'def' Keyword ' ' Text 'parse' Name.Function '(' Punctuation 'score_text' Name ')' Punctuation '\n ' Text 'begin' Keyword '\n ' Text 'score_text' Name '.' Operator 'scan' Name '(' Punctuation 'SCORE_PATTERN' Name.Constant ')' Punctuation ' ' Text 'do' Keyword ' ' Text '|' Operator 'match' Name '|' Operator '\n ' Text 'handle_match' Name '(' Punctuation 'match' Name ')' Punctuation '\n ' Text 'end' Keyword '\n ' Text 'rescue' Keyword ' ' Text 'err' Name ' ' Text ':' Punctuation ' ' Text 'ParseError' Name '\n ' Text '# handle error ...' Comment.Single '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'module' Keyword ' ' Text 'Money' Name.Namespace '\n ' Text 'CURRENCIES' Name.Constant ' ' Text '=' Operator ' ' Text '{' Punctuation '\n ' Text '"' Literal.String.Double 'EUR' Literal.String.Double '"' Literal.String.Double ' ' Text '=' Operator '>' Operator ' ' Text '1.0' Literal.Number.Float ',' Punctuation '\n ' Text '"' Literal.String.Double 'ARS' Literal.String.Double '"' Literal.String.Double ' ' Text '=' Operator '>' Operator ' ' Text '10.55' Literal.Number.Float ',' Punctuation '\n ' Text '"' Literal.String.Double 'USD' Literal.String.Double '"' Literal.String.Double ' ' Text '=' Operator '>' Operator ' ' Text '1.12' Literal.Number.Float ',' Punctuation '\n ' Text '"' Literal.String.Double 'JPY' Literal.String.Double '"' Literal.String.Double ' ' Text '=' Operator '>' Operator ' ' Text '134.15' Literal.Number.Float ',' Punctuation '\n ' Text '}' Punctuation '\n\n ' Text 'class' Keyword ' ' Text 'Amount' Name.Class '\n ' Text 'getter' Name.Builtin.Pseudo ' ' Text ':currency' Literal.String.Symbol ',' Punctuation ' ' Text ':value' Literal.String.Symbol '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@currency' Name.Variable.Instance ',' Punctuation ' ' Text '@value' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n\n ' Text 'class' Keyword ' ' Text 'CurrencyConversion' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@amount' Name.Variable.Instance ',' Punctuation ' ' Text '@target_currency' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'amount' Name.Function '\n ' Text '# implement conversion ...' Comment.Single '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'i' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'while' Keyword ' ' Text 'i' Name ' ' Text '<' Operator ' ' Text '10' Literal.Number.Integer '\n ' Text 'proc' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text 'do' Keyword '\n ' Text 'spawn' Name.Builtin.Pseudo ' ' Text 'do' Keyword '\n ' Text 'puts' Name.Builtin '(' Punctuation 'x' Name ')' Punctuation '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n ' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation 'i' Name ')' Punctuation '\n ' Text 'i' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'Fiber' Name '.' Operator 'yield' Name '\n\n' Text '# A buffered channel of capacity 2' Comment.Single '\n' Text 'channel' Name ' ' Text '=' Operator ' ' Text 'Channel' Name '(' Punctuation 'Int32' Name ')' Punctuation '.' Operator 'new' Name '(' Punctuation '2' Literal.Number.Integer ')' Punctuation '\n\n' Text 'spawn' Name.Builtin.Pseudo ' ' Text 'do' Keyword '\n ' Text 'channel' Name '.' Operator 'send' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation '\n ' Text 'channel' Name '.' Operator 'send' Name '(' Punctuation '2' Literal.Number.Integer ')' Punctuation '\n ' Text 'channel' Name '.' Operator 'send' Name '(' Punctuation '3' Literal.Number.Integer ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text '3' Literal.Number.Integer '.' Operator 'times' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text 'channel' Name '.' Operator 'receive' Name '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'MyDictionary' Name.Class '(' Punctuation 'K' Name ',' Punctuation ' ' Text 'V' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'MyBox' Name '.' Operator 'new' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# :: MyBox(Int32)' Comment.Single '\n' Text 'MyBox' Name '.' Operator 'new' Name '(' Punctuation '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ')' Punctuation ' ' Text '# :: MyBox(String)' Comment.Single '\n\n' Text 'module' Keyword ' ' Text 'Moo' Name.Namespace '(' Punctuation 'T' Name ')' Punctuation '\n ' Text 'def' Keyword ' ' Text 't' Name.Function '\n ' Text 'T' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Foo' Name.Class '(' Punctuation 'U' Name.Class ')' Punctuation '\n ' Text 'include' Keyword ' ' Text 'Moo' Name '(' Punctuation 'U' Name ')' Punctuation '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@value' Name.Variable.Instance ' ' Text ':' Punctuation ' ' Text 'U' Name ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'foo' Name ' ' Text '=' Operator ' ' Text 'Foo' Name '.' Operator 'new' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation '\n' Text 'foo' Name '.' Operator 't' Name ' ' Text '# Int32' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Parent' Name.Class '(' Punctuation 'T' Name.Class ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Int32Child' Name.Class ' ' Text '<' Operator ' ' Text 'Parent' Name '(' Punctuation 'Int32' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'GenericChild' Name.Class '(' Punctuation 'T' Name.Class ')' Punctuation ' ' Text '<' Operator ' ' Text 'Parent' Name '(' Punctuation 'T' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'ptr' Name ' ' Text '=' Operator ' ' Text 'pointerof' Keyword.Pseudo '(' Punctuation 'a' Name ')' Punctuation '\n' Text 'ptr' Name '[' Operator '100_000' Literal.Number.Integer ']' Operator ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '# undefined behaviour, probably a segmentation fault' Comment.Single '\n\n' Text 'alias' Keyword ' ' Text 'Int32OrString' Name.Class ' ' Text '=' Operator ' ' Text 'Int32' Name ' ' Text '|' Operator ' ' Text 'String' Name '\n\n' Text 'alias' Keyword ' ' Text 'Int32OrNil' Name.Class ' ' Text '=' Operator ' ' Text 'Int32?' Name '\n\n' Text 'alias' Keyword ' ' Text 'Int32OrNil_' Name.Class ' ' Text '=' Operator ' ' Text 'Int32' Name ' ' Text '|' Operator ' ' Text '::' Operator 'Nil' Name '\n\n' Text 'alias' Keyword ' ' Text 'Int32Ptr' Name.Class ' ' Text '=' Operator ' ' Text 'Int32' Name '*' Operator '\n\n' Text 'alias' Keyword ' ' Text 'Int32Ptr_' Name.Class ' ' Text '=' Operator ' ' Text 'Pointer' Name '(' Punctuation 'Int32' Name ')' Punctuation '\n\n' Text 'alias' Keyword ' ' Text 'Int32_8' Name.Class ' ' Text '=' Operator ' ' Text 'Int32' Name '[' Operator '8' Literal.Number.Integer ']' Operator '\n\n' Text 'alias' Keyword ' ' Text 'Int32_8_' Name.Class ' ' Text '=' Operator ' ' Text 'StaticArray' Name '(' Punctuation 'Int32' Name ',' Punctuation ' ' Text '8' Literal.Number.Integer ')' Punctuation '\n\n' Text 'alias' Keyword ' ' Text 'Int32StringTuple' Name.Class ' ' Text '=' Operator ' ' Text '{' Punctuation 'Int32' Name ',' Punctuation ' ' Text 'String' Name '}' Punctuation '\n\n' Text 'alias' Keyword ' ' Text 'Int32StringTuple_' Name.Class ' ' Text '=' Operator ' ' Text 'Tuple' Name '(' Punctuation 'Int32' Name ',' Punctuation ' ' Text 'String' Name ')' Punctuation '\n\n' Text 'alias' Keyword ' ' Text 'Int32ToString' Name.Class ' ' Text '=' Operator ' ' Text 'Int32' Name ' ' Text '-' Operator '>' Operator ' ' Text 'String' Name '\n\n' Text 'alias' Keyword ' ' Text 'Int32ToString_' Name.Class ' ' Text '=' Operator ' ' Text 'Proc' Name '(' Punctuation 'Int32' Name ',' Punctuation ' ' Text 'String' Name ')' Punctuation '\n\n' Text 'alias' Keyword ' ' Text 'ProcThatReturnsInt32' Name.Class ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator ' ' Text 'Int32' Name '\n\n' Text 'alias' Keyword ' ' Text 'Int32AndCharToString' Name.Class ' ' Text '=' Operator ' ' Text 'Int32' Name ',' Punctuation ' ' Text 'Char' Name ' ' Text '-' Operator '>' Operator ' ' Text 'String' Name '\n\n' Text 'alias' Keyword ' ' Text 'ComplexProc' Name.Class ' ' Text '=' Operator ' ' Text '(' Punctuation 'Int32' Name ' ' Text '-' Operator '>' Operator ' ' Text 'Int32' Name ')' Punctuation ' ' Text '-' Operator '>' Operator ' ' Text 'String' Name '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation '\n ' Text '"' Literal.String.Double 'instance' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '.' Operator 'class' Name ')' Punctuation '\n ' Text '"' Literal.String.Double 'class' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'foo' Name ' ' Text '1' Literal.Number.Integer ' ' Text '# "instance"' Comment.Single '\n' Text 'foo' Name ' ' Text 'Int32' Name ' ' Text '# "class"' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Parent' Name.Class '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Child1' Name.Class ' ' Text '<' Operator ' ' Text 'Parent' Name '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Child2' Name.Class ' ' Text '<' Operator ' ' Text 'Parent' Name '\n' Text 'end' Keyword '\n\n' Text 'ary' Name ' ' Text '=' Operator ' ' Text '[' Operator ']' Operator ' ' Text 'of' Keyword ' ' Text 'Parent' Name '.' Operator 'class' Name '\n' Text 'ary' Name ' ' Text '<<' Operator ' ' Text 'Child1' Name '\n' Text 'ary' Name ' ' Text '<<' Operator ' ' Text 'Child2' Name '\n\n' Text '# Same as not specifying a restriction, not very useful' Comment.Single '\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text '_' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text '# A bit more useful: any two arguments Proc that returns an Int32:' Comment.Single '\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text '_' Name ',' Punctuation ' ' Text '_' Name ' ' Text '-' Operator '>' Operator ' ' Text 'Int32' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text '# alias SameAsInt32 = typeof(2)' Comment.Single '\n' Text '# alias Int32OrString_ = typeof(1, "a")' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation 'name' Name ')' Punctuation '\n ' Text '@name' Name.Variable.Instance ' ' Text '=' Operator ' ' Text 'name' Name '\n ' Text '@age' Name.Variable.Instance ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'name' Name.Function '\n ' Text '@name' Name.Variable.Instance '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'age' Name.Function '\n ' Text '@age' Name.Variable.Instance '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'peter' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'Peter' Literal.String.Double '"' Literal.String.Double '\n\n' Text 'john' Name '.' Operator 'name' Name ' ' Text '# => "John"' Comment.Single '\n' Text 'john' Name '.' Operator 'age' Name ' ' Text '# => 0' Comment.Single '\n\n' Text 'peter' Name '.' Operator 'name' Name ' ' Text '# => "Peter"' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'self' Name.Class '.' Operator 'new' Name.Function '(' Punctuation 'name' Name ')' Punctuation '\n ' Text 'instance' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'allocate' Name '\n ' Text 'instance' Name '.' Operator 'initialize' Name '(' Punctuation 'name' Name ')' Punctuation '\n ' Text 'instance' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text 'a' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'String' Name ')' Punctuation '\n ' Text '# here a is a String' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text 'b' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'Number' Name ')' Punctuation '\n ' Text '# here b is a Number' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text 'some_condition' Name ' ' Text '?' Punctuation ' ' Text '1' Literal.Number.Integer ' ' Text ':' Punctuation ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text '# a : Int32 | String' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'a' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'Number' Name ')' Punctuation '\n ' Text '# a : Int32' Comment.Single '\n' Text 'else' Keyword '\n ' Text '# a : String' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text 'a' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'String' Name ')' Punctuation ' ' Text '&&' Operator ' ' Text 'b' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'Number' Name ')' Punctuation '\n ' Text '# here a is a String and b is a Number' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'a' Name '.' Operator '+' Name.Operator '(' Punctuation 'b' Name ')' Punctuation '\n\n' Text 'struct' Keyword ' ' Text 'Vector2' Name.Class '\n ' Text 'getter' Name.Builtin.Pseudo ' ' Text 'x' Name ',' Punctuation ' ' Text 'y' Name '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@x' Name.Variable.Instance ',' Punctuation ' ' Text '@y' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text '+' Name.Function '(' Punctuation 'other' Name ')' Punctuation '\n ' Text 'Vector2' Name '.' Operator 'new' Name '(' Punctuation 'x' Name ' ' Text '+' Operator ' ' Text 'other' Name '.' Operator 'x' Name ',' Punctuation ' ' Text 'y' Name ' ' Text '+' Operator ' ' Text 'other' Name '.' Operator 'y' Name ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'v1' Name ' ' Text '=' Operator ' ' Text 'Vector2' Name '.' Operator 'new' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation '\n' Text 'v2' Name ' ' Text '=' Operator ' ' Text 'Vector2' Name '.' Operator 'new' Name '(' Punctuation '3' Literal.Number.Integer ',' Punctuation ' ' Text '4' Literal.Number.Integer ')' Punctuation '\n' Text 'v1' Name ' ' Text '+' Operator ' ' Text 'v2' Name ' ' Text '# => Vector2(@x=4, @y=6)' Comment.Single '\n\n' Text 'struct' Keyword ' ' Text 'Vector2' Name.Class '\n ' Text 'def' Keyword ' ' Text '-' Name.Function '\n ' Text 'Vector2' Name '.' Operator 'new' Name '(' Punctuation '-' Operator 'x' Name ',' Punctuation ' ' Text '-' Operator 'y' Name ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'v1' Name ' ' Text '=' Operator ' ' Text 'Vector2' Name '.' Operator 'new' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation '\n' Text '-' Operator 'v1' Name ' ' Text '# => Vector2(@x=-1, @y=-2)' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'MyArray' Name.Class '\n ' Text 'def' Keyword ' ' Text '[]' Name.Function '(' Punctuation 'index' Name ')' Punctuation '\n ' Text '# ...' Comment.Single '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text '[]' Name.Function '(' Punctuation 'index1' Name ',' Punctuation ' ' Text 'index2' Name ',' Punctuation ' ' Text 'index3' Name ')' Punctuation '\n ' Text '# ...' Comment.Single '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text '[]=' Name.Function '(' Punctuation 'index' Name ',' Punctuation ' ' Text 'value' Name ')' Punctuation '\n ' Text '# ...' Comment.Single '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'array' Name ' ' Text '=' Operator ' ' Text 'MyArray' Name '.' Operator 'new' Name '\n\n' Text 'array' Name '[' Operator '1' Literal.Number.Integer ']' Operator ' ' Text '# invokes the first method' Comment.Single '\n' Text 'array' Name '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator ' ' Text '# invokes the second method' Comment.Single '\n' Text 'array' Name '[' Operator '1' Literal.Number.Integer ']' Operator ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '# invokes the third method' Comment.Single '\n\n' Text 'array' Name '.' Operator '[]' Name.Operator '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# invokes the first method' Comment.Single '\n' Text 'array' Name '.' Operator '[]' Name.Operator '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ')' Punctuation ' ' Text '# invokes the second method' Comment.Single '\n' Text 'array' Name '.' Operator '[]=' Name.Operator '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation ' ' Text '# invokes the third method' Comment.Single '\n\n' Text 'raise' Name.Builtin ' ' Text '"' Literal.String.Double 'OH NO!' Literal.String.Double '"' Literal.String.Double '\n' Text 'raise' Name.Builtin ' ' Text 'Exception' Name '.' Operator 'new' Name '(' Punctuation '"' Literal.String.Double 'Some error' Literal.String.Double '"' Literal.String.Double ')' Punctuation '\n\n' Text 'class' Keyword ' ' Text 'MyException' Name.Class ' ' Text '<' Operator ' ' Text 'Exception' Name '\n' Text 'end' Keyword '\n\n' Text 'begin' Keyword '\n ' Text 'raise' Name.Builtin ' ' Text 'MyException' Name '.' Operator 'new' Name '(' Punctuation '"' Literal.String.Double 'OH NO!' Literal.String.Double '"' Literal.String.Double ')' Punctuation '\n' Text 'rescue' Keyword ' ' Text 'ex' Name ' ' Text ':' Punctuation ' ' Text 'MyException' Name '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Rescued MyException: ' Literal.String.Double '#{' Literal.String.Interpol 'ex' Name '.' Operator 'message' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'begin' Keyword '\n ' Text '# ...' Comment.Single '\n' Text 'rescue' Keyword ' ' Text 'ex' Name ' ' Text ':' Punctuation ' ' Text 'MyException' Name ' ' Text '|' Operator ' ' Text 'MyOtherException' Name '\n ' Text '# only MyException or MyOtherException' Comment.Single '\n' Text 'rescue' Keyword '\n ' Text '# any other kind of exception' Comment.Single '\n' Text 'ensure' Keyword '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Cleanup...' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'some_method' Name.Function '\n ' Text 'something_dangerous' Name '\n' Text 'rescue' Keyword '\n ' Text '# execute if an exception is raised' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'array' Name ' ' Text '=' Operator ' ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n' Text 'array' Name '[' Operator '4' Literal.Number.Integer ']' Operator ' ' Text '# raises because of IndexError' Comment.Single '\n' Text 'array' Name '[' Operator '4' Literal.Number.Integer ']?' Operator ' ' Text '# returns nil because of index out of bounds' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'some_proc' Name.Function '(' Punctuation '&' Operator 'block' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ' ' Text '-' Operator '>' Operator ' ' Text 'Int32' Name ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator '(' Punctuation 'i' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text '{' Punctuation ' ' Text 'x' Name ' ' Text '+=' Operator ' ' Text 'i' Name ' ' Text '}' Punctuation '\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'some_proc' Name '(' Punctuation '&' Operator 'proc' Name ')' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# => 1' Comment.Single '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '10' Literal.Number.Integer ')' Punctuation ' ' Text '# => 11' Comment.Single '\n' Text 'x' Name ' ' Text '# => 11' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'add' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text 'adder' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator 'add' Name '(' Punctuation 'Int32' Name ',' Punctuation ' ' Text 'Int32' Name ')' Punctuation '\n' Text 'adder' Name '.' Operator 'call' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation ' ' Text '# => 3' Comment.Single '\n\n' Text 'module' Keyword ' ' Text 'Curses' Name.Namespace '\n ' Text 'class' Keyword ' ' Text 'Window' Name.Class '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Curses' Name '::' Operator 'Window' Name '.' Operator 'new' Name '\n\n' Text 'module' Keyword ' ' Text 'ItemsSize' Name.Namespace '\n ' Text 'def' Keyword ' ' Text 'size' Name.Function '\n ' Text 'items' Name '.' Operator 'size' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Items' Name.Class '\n ' Text 'include' Keyword ' ' Text 'ItemsSize' Name '\n\n ' Text 'def' Keyword ' ' Text 'items' Name.Function '\n ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'items' Name ' ' Text '=' Operator ' ' Text 'Items' Name '.' Operator 'new' Name '\n' Text 'items' Name '.' Operator 'size' Name ' ' Text '# => 3' Comment.Single '\n\n' Text 'module' Keyword ' ' Text 'Base64' Name.Namespace '\n ' Text 'extend' Keyword ' ' Text 'self' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'encode64' Name.Function '(' Punctuation 'string' Name ')' Punctuation '\n ' Text '# ...' Comment.Single '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'decode64' Name.Function '(' Punctuation 'string' Name ')' Punctuation '\n ' Text '# ...' Comment.Single '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Base64' Name '.' Operator 'encode64' Name ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '# => "aGVsbG8="' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'else' Keyword '\n ' Text 'a' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'a_as_int' Name ' ' Text '=' Operator ' ' Text 'a' Name '.as' Keyword.Pseudo '(' Punctuation 'Int32' Name ')' Punctuation '\n' Text 'a_as_int' Name '.' Operator 'abs' Name ' ' Text '# works, compiler knows that a_as_int is Int32' Comment.Single '\n\n' Text 'ptr' Name ' ' Text '=' Operator ' ' Text 'Pointer' Name '(' Punctuation 'Int32' Name ')' Punctuation '.' Operator 'malloc' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation '\n' Text 'ptr' Name '.as' Keyword.Pseudo '(' Punctuation 'Int8' Name '*' Operator ')' Punctuation ' ' Text '# :: Pointer(Int8)' Comment.Single '\n\n' Text 'array' Name ' ' Text '=' Operator ' ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n\n' Text '# object_id returns the address of an object in memory,' Comment.Single '\n' Text '# so we create a pointer with that address' Comment.Single '\n' Text 'ptr' Name ' ' Text '=' Operator ' ' Text 'Pointer' Name '(' Punctuation 'Void' Name ')' Punctuation '.' Operator 'new' Name '(' Punctuation 'array' Name '.' Operator 'object_id' Name ')' Punctuation '\n\n' Text '# Now we cast that pointer to the same type, and' Comment.Single '\n' Text '# we should get the same value' Comment.Single '\n' Text 'array2' Name ' ' Text '=' Operator ' ' Text 'ptr' Name '.as' Keyword.Pseudo '(' Punctuation 'Array' Name '(' Punctuation 'Int32' Name ')' Punctuation ')' Punctuation '\n' Text 'array2' Name '.' Operator 'same?' Name '(' Punctuation 'array' Name ')' Punctuation ' ' Text '# => true' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'b' Name ' ' Text '=' Operator ' ' Text 'a' Name '.as' Keyword.Pseudo '(' Punctuation 'Int32' Name ' ' Text '|' Operator ' ' Text 'Float64' Name ')' Punctuation '\n' Text 'b' Name ' ' Text '# :: Int32 | Float64' Comment.Single '\n\n' Text 'ary' Name ' ' Text '=' Operator ' ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n\n' Text '# We want to create an array 1, 2, 3 of Int32 | Float64' Comment.Single '\n' Text 'ary2' Name ' ' Text '=' Operator ' ' Text 'ary' Name '.' Operator 'map' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name '.as' Keyword.Pseudo '(' Punctuation 'Int32' Name ' ' Text '|' Operator ' ' Text 'Float64' Name ')' Punctuation ' ' Text '}' Punctuation '\n\n' Text 'ary2' Name ' ' Text '# :: Array(Int32 | Float64)' Comment.Single '\n' Text 'ary2' Name ' ' Text '<<' Operator ' ' Text '1.5' Literal.Number.Float ' ' Text '# OK' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'name' Name.Function '\n ' Text '@name' Name.Variable.Instance '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '[' Operator ']' Operator ' ' Text 'of' Keyword ' ' Text 'Person' Name '\n' Text 'x' Name ' ' Text '=' Operator ' ' Text 'a' Name '.' Operator 'map' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'f' Name '|' Operator ' ' Text 'f' Name '.' Operator 'name' Name ' ' Text '}' Punctuation ' ' Text "# Error: can't infer block return type" Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '[' Operator ']' Operator ' ' Text 'of' Keyword ' ' Text 'Person' Name '\n' Text 'x' Name ' ' Text '=' Operator ' ' Text 'a' Name '.' Operator 'map' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'f' Name '|' Operator ' ' Text 'f' Name '.' Operator 'name' Name '.as' Keyword.Pseudo '(' Punctuation 'String' Name ')' Punctuation ' ' Text '}' Punctuation ' ' Text '# OK' Comment.Single '\n\n' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '[' Operator ']' Operator ' ' Text 'of' Keyword ' ' Text 'Person' Name '\n' Text 'x' Name ' ' Text '=' Operator ' ' Text 'a' Name '.' Operator 'map' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'f' Name '|' Operator ' ' Text 'f' Name '.' Operator 'name' Name ' ' Text '}' Punctuation ' ' Text '# OK' Comment.Single '\n\n' Text 'loop' Name.Builtin ' ' Text 'do' Keyword '\n ' Text 'do_something' Name '\n ' Text 'break' Keyword ' ' Text 'if' Keyword ' ' Text 'some_condition' Name '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Point' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@x' Name.Variable.Instance ',' Punctuation ' ' Text '@y' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Point' Name '.' Operator 'new' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer '\n\n' Text '# 2 x Int32 = 2 x 4 = 8' Comment.Single '\n' Text 'instance_sizeof' Keyword.Pseudo '(' Punctuation 'Point' Name ')' Punctuation ' ' Text '# => 12' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'while' Keyword ' ' Text 'a' Name ' ' Text '<' Operator ' ' Text '5' Literal.Number.Integer '\n ' Text 'a' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'if' Keyword ' ' Text 'a' Name ' ' Text '==' Operator ' ' Text '3' Literal.Number.Integer '\n ' Text 'next' Keyword '\n ' Text 'end' Keyword '\n ' Text 'puts' Name.Builtin ' ' Text 'a' Name '\n' Text 'end' Keyword '\n\n' Text '# The above prints the numbers 2, 4 and 5' Comment.Single '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text '# In C: double cos(double x)' Comment.Single '\n ' Text 'fun' Keyword ' ' Text 'cos' Name.Function '(' Punctuation 'value' Name ' ' Text ':' Punctuation ' ' Text 'Float64' Name ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'Float64' Name '\n\n ' Text 'fun' Keyword ' ' Text 'getch' Name.Function ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n\n ' Text 'fun' Keyword ' ' Text 'srand' Name.Function '(' Punctuation 'seed' Name ' ' Text ':' Punctuation ' ' Text 'UInt32' Name ')' Punctuation '\n\n ' Text 'fun' Keyword ' ' Text 'exit' Name.Function '(' Punctuation 'status' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'NoReturn' Name '\n\n ' Text 'fun' Keyword ' ' Text 'printf' Name.Function '(' Punctuation 'format' Name ' ' Text ':' Punctuation ' ' Text 'UInt8' Name '*' Operator ',' Punctuation ' ' Text '...' Operator ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text 'C' Name '.' Operator 'cos' Name '(' Punctuation '1.5' Literal.Number.Float ')' Punctuation ' ' Text '# => 0.0707372' Comment.Single '\n' Text 'C' Name '.' Operator 'srand' Name '(' Punctuation '1_u32' Literal.Number.Integer ')' Punctuation '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'b' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n' Text 'C' Name '.' Operator 'printf' Name ' ' Text '"' Literal.String.Double '%d + %d = %d' Literal.String.Double '\\n' Literal.String.Escape '"' Literal.String.Double ',' Punctuation ' ' Text 'a' Name ',' Punctuation ' ' Text 'b' Name ',' Punctuation ' ' Text 'a' Name ' ' Text '+' Operator ' ' Text 'b' Name '\n\n' Text 'lib' Keyword ' ' Text 'LibSDL' Name.Namespace '\n ' Text 'fun' Keyword ' ' Text 'init' Name.Function ' ' Text '=' Operator ' ' Text 'SDL_Init' Name '(' Punctuation 'flags' Name ' ' Text ':' Punctuation ' ' Text 'UInt32' Name ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'LLVMIntrinsics' Name.Namespace '\n ' Text 'fun' Keyword ' ' Text 'ceil_f32' Name.Function ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'llvm.ceil.f32' Literal.String.Double '"' Literal.String.Double '(' Punctuation 'value' Name ' ' Text ':' Punctuation ' ' Text 'Float32' Name ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'Float32' Name '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'MyLib' Name.Namespace '\n ' Text 'fun' Keyword ' ' Text 'my_fun' Name.Function '(' Punctuation 'some_size' Name ' ' Text ':' Punctuation ' ' Text 'LibC' Name '::' Operator 'SizeT' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text '@[' Operator 'Link' Name.Decorator '(' Punctuation '"' Literal.String.Double 'pcre' Literal.String.Double '"' Literal.String.Double ')' Punctuation ']' Operator '\n' Text 'lib' Keyword ' ' Text 'LibPCRE' Name.Namespace '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text '{%' Literal.String.Interpol ' ' Text 'if' Keyword ' ' Text 'flag?' Name '(' Punctuation ':x86_64' Literal.String.Symbol ')' Punctuation ' ' Text '%}' Literal.String.Interpol '\n ' Text 'alias' Keyword ' ' Text 'SizeT' Name.Class ' ' Text '=' Operator ' ' Text 'UInt64' Name '\n ' Text '{%' Literal.String.Interpol ' ' Text 'else' Keyword ' ' Text '%}' Literal.String.Interpol '\n ' Text 'alias' Keyword ' ' Text 'SizeT' Name.Class ' ' Text '=' Operator ' ' Text 'UInt32' Name '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n\n ' Text 'fun' Keyword ' ' Text 'memcmp' Name.Function '(' Punctuation 'p1' Name ' ' Text ':' Punctuation ' ' Text 'Void' Name '*' Operator ',' Punctuation ' ' Text 'p2' Name ' ' Text ':' Punctuation ' ' Text 'Void' Name '*' Operator ',' Punctuation ' ' Text 'size' Name ' ' Text ':' Punctuation ' ' Text 'C' Name '::' Operator 'SizeT' Name ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'X' Name.Namespace '\n ' Text 'enum' Keyword ' ' Text 'SomeEnum' Name.Class '\n ' Text 'Ten' Name ' ' Text '=' Operator ' ' Text '10' Literal.Number.Integer '\n ' Text 'Twenty' Name ' ' Text '=' Operator ' ' Text '10' Literal.Number.Integer ' ' Text '*' Operator ' ' Text '2' Literal.Number.Integer '\n ' Text 'ThirtyTwo' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '<<' Operator ' ' Text '5' Literal.Number.Integer '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'X' Name.Namespace '\n ' Text 'enum' Keyword ' ' Text 'SomeEnum' Name.Class '\n ' Text 'A' Name ' ' Text '=' Operator ' ' Text '1_u32' Literal.Number.Integer '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'X' Name '::' Operator 'SomeEnum' Name '::' Operator 'Zero' Name ' ' Text '# => 0_i8' Comment.Single '\n' Text 'X' Name '::' Operator 'SomeEnum' Name '::' Operator 'Two' Name ' ' Text '# => 2_i8' Comment.Single '\n\n' Text 'lib' Keyword ' ' Text 'X' Name.Namespace '\n ' Text 'fun' Keyword ' ' Text 'callback' Name.Function '(' Punctuation 'f' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ' ' Text '-' Operator '>' Operator ' ' Text 'Int32' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'f' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text '{' Punctuation ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation '\n' Text 'X' Name '.' Operator 'callback' Name '(' Punctuation 'f' Name ')' Punctuation '\n\n' Text 'X' Name '.' Operator 'callback' Name ' ' Text '-' Operator '>' Operator '(' Punctuation 'x' Name ')' Punctuation ' ' Text '{' Punctuation ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation '\n\n' Text 'X' Name '.' Operator 'callback' Name ' ' Text 'nil' Keyword.Constant '\n\n' Text 'lib' Keyword ' ' Text 'LibFoo' Name.Namespace '\n ' Text 'fun' Keyword ' ' Text 'store_callback' Name.Function '(' Punctuation 'callback' Name ' ' Text ':' Punctuation ' ' Text '-' Operator '>' Operator ')' Punctuation '\n ' Text 'fun' Keyword ' ' Text 'execute_callback' Name.Function '\n' Text 'end' Keyword '\n\n' Text 'LibFoo' Name '.' Operator 'store_callback' Name ' ' Text '-' Operator '>' Operator '{' Punctuation ' ' Text 'raise' Name.Builtin ' ' Text '"' Literal.String.Double 'OH NO!' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n' Text 'LibFoo' Name '.' Operator 'execute_callback' Name '\n\n' Text 'lib' Keyword ' ' Text 'LibFoo' Name.Namespace '\n ' Text 'fun' Keyword ' ' Text 'store_callback' Name.Function '(' Punctuation 'callback' Name ' ' Text ':' Punctuation ' ' Text '-' Operator '>' Operator ')' Punctuation '\n\n ' Text '@[' Operator 'Raises' Name.Decorator ']' Operator '\n ' Text 'fun' Keyword ' ' Text 'execute_callback' Name.Function '\n' Text 'end' Keyword '\n\n' Text '@[' Operator 'Link' Name.Decorator '(' Punctuation '"' Literal.String.Double 'pcre' Literal.String.Double '"' Literal.String.Double ')' Punctuation ']' Operator '\n' Text 'lib' Keyword ' ' Text 'PCRE' Name.Namespace '\n ' Text 'INFO_CAPTURECOUNT' Name.Constant ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'PCRE' Name '::' Operator 'INFO_CAPTURECOUNT' Name.Constant ' ' Text '# => 2' Comment.Single '\n\n' Text 'lib' Keyword ' ' Text 'U' Name.Namespace '\n ' Text '# In C:' Comment.Single '\n ' Text '#' Comment.Single '\n ' Text '# union IntOrFloat {' Comment.Single '\n ' Text '# int some_int;' Comment.Single '\n ' Text '# double some_float;' Comment.Single '\n ' Text '# };' Comment.Single '\n ' Text 'union' Keyword ' ' Text 'IntOrFloat' Name.Class '\n ' Text 'some_int' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n ' Text 'some_float' Name ' ' Text ':' Punctuation ' ' Text 'Float64' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'value' Name ' ' Text '=' Operator ' ' Text 'U' Name '::' Operator 'IntOrFloat' Name '.' Operator 'new' Name '\n\n' Text 'value' Name ' ' Text '=' Operator ' ' Text 'uninitialized' Keyword.Pseudo ' ' Text 'U' Name '::' Operator 'IntOrFlaot' Name '\n' Text 'value' Name '.' Operator 'some_int' Name ' ' Text '# => some garbage value' Comment.Single '\n\n' Text 'value' Name ' ' Text '=' Operator ' ' Text 'U' Name '::' Operator 'IntOrFloat' Name '.' Operator 'new' Name '\n' Text 'value' Name '.' Operator 'some_int' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'value' Name '.' Operator 'some_int' Name ' ' Text '# => 1' Comment.Single '\n' Text 'value' Name '.' Operator 'some_float' Name ' ' Text '# => 4.94066e-324' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'change_it' Name.Function '(' Punctuation 'value' Name ')' Punctuation '\n ' Text 'value' Name '.' Operator 'some_int' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'value' Name ' ' Text '=' Operator ' ' Text 'U' Name '::' Operator 'IntOrFloat' Name '.' Operator 'new' Name '\n' Text 'change_it' Name ' ' Text 'value' Name '\n' Text 'value' Name '.' Operator 'some_int' Name ' ' Text '# => 0' Comment.Single '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text '# In C:' Comment.Single '\n ' Text '#' Comment.Single '\n ' Text '# struct TimeZone {' Comment.Single '\n ' Text '# int minutes_west;' Comment.Single '\n ' Text '# int dst_time;' Comment.Single '\n ' Text '# };' Comment.Single '\n ' Text 'struct' Keyword ' ' Text 'TimeZone' Name.Class '\n ' Text 'minutes_west' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n ' Text 'dst_time' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text '# This is a forward declaration' Comment.Single '\n ' Text 'struct' Keyword ' ' Text 'Node' Name.Class '\n ' Text 'end' Keyword '\n\n ' Text 'struct' Keyword ' ' Text 'Node' Name.Class '\n ' Text 'node' Name ' ' Text ':' Punctuation ' ' Text 'Node' Name '*' Operator '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'tz' Name ' ' Text '=' Operator ' ' Text 'C' Name '::' Operator 'TimeZone' Name '.' Operator 'new' Name '\n\n' Text 'tz' Name ' ' Text '=' Operator ' ' Text 'uninitialized' Keyword.Pseudo ' ' Text 'C' Name '::' Operator 'TimeZone' Name '\n' Text 'tz' Name '.' Operator 'minutes_west' Name ' ' Text '# => some garbage value' Comment.Single '\n\n' Text 'tz' Name ' ' Text '=' Operator ' ' Text 'C' Name '::' Operator 'TimeZone' Name '.' Operator 'new' Name '\n' Text 'tz' Name '.' Operator 'minutes_west' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'tz' Name '.' Operator 'minutes_west' Name ' ' Text '# => 1' Comment.Single '\n\n' Text 'tz' Name ' ' Text '=' Operator ' ' Text 'C' Name '::' Operator 'TimeZone' Name '.' Operator 'new' Name ' ' Text 'minutes_west' Literal.String.Symbol ':' Punctuation ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text 'dst_time' Literal.String.Symbol ':' Punctuation ' ' Text '2' Literal.Number.Integer '\n' Text 'tz' Name '.' Operator 'minutes_west' Name ' ' Text '# => 1' Comment.Single '\n' Text 'tz' Name '.' Operator 'dst_time' Name ' ' Text '# => 2' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'change_it' Name.Function '(' Punctuation 'tz' Name ')' Punctuation '\n ' Text 'tz' Name '.' Operator 'minutes_west' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'tz' Name ' ' Text '=' Operator ' ' Text 'C' Name '::' Operator 'TimeZone' Name '.' Operator 'new' Name '\n' Text 'change_it' Name ' ' Text 'tz' Name '\n' Text 'tz' Name '.' Operator 'minutes_west' Name ' ' Text '# => 0' Comment.Single '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text '$errno' Name.Variable.Global ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text 'C' Name '.' Operator 'errno' Name ' ' Text '# => some value' Comment.Single '\n' Text 'C' Name '.' Operator 'errno' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'C' Name '.' Operator 'errno' Name ' ' Text '# => 0' Comment.Single '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text '@[' Operator 'ThreadLocal' Name.Decorator ']' Operator '\n ' Text '$errno' Name.Variable.Global ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text 'fun' Keyword ' ' Text 'waitpid' Name.Function '(' Punctuation 'pid' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ',' Punctuation ' ' Text 'status_ptr' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '*' Operator ',' Punctuation ' ' Text 'options' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text 'status_ptr' Name ' ' Text '=' Operator ' ' Text 'uninitialized' Keyword.Pseudo ' ' Text 'Int32' Name '\n\n' Text 'C' Name '.' Operator 'waitpid' Name '(' Punctuation 'pid' Name ',' Punctuation ' ' Text 'pointerof' Keyword.Pseudo '(' Punctuation 'status_ptr' Name ')' Punctuation ',' Punctuation ' ' Text 'options' Name ')' Punctuation '\n\n' Text 'C' Name '.' Operator 'waitpid' Name '(' Punctuation 'pid' Name ',' Punctuation ' ' Text 'out' Keyword.Pseudo ' ' Text 'status_ptr' Name ',' Punctuation ' ' Text 'options' Name ')' Punctuation '\n\n' Text 'lib' Keyword ' ' Text 'X' Name.Namespace '\n ' Text 'type' Keyword ' ' Text 'CInt' Name.Class ' ' Text '=' Operator ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text '{%' Literal.String.Interpol ' ' Text 'if' Keyword ' ' Text 'flag?' Name '(' Punctuation ':x86_64' Literal.String.Symbol ')' Punctuation ' ' Text '%}' Literal.String.Interpol '\n ' Text '# some specific code for 64 bits platforms' Comment.Single '\n' Text '{%' Literal.String.Interpol ' ' Text 'else' Keyword ' ' Text '%}' Literal.String.Interpol '\n ' Text '# some specific code for non-64 bits platforms' Comment.Single '\n' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n\n' Text '{%' Literal.String.Interpol ' ' Text 'if' Keyword ' ' Text 'flag?' Name '(' Punctuation ':linux' Literal.String.Symbol ')' Punctuation ' ' Text '&&' Operator ' ' Text 'flag?' Name '(' Punctuation ':x86_64' Literal.String.Symbol ')' Punctuation ' ' Text '%}' Literal.String.Interpol '\n ' Text '# some specific code for linux 64 bits' Comment.Single '\n' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n\n' Text 'lib' Keyword ' ' Text 'C' Name.Namespace '\n ' Text '{%' Literal.String.Interpol ' ' Text 'if' Keyword ' ' Text 'flag?' Name '(' Punctuation ':linux' Literal.String.Symbol ')' Punctuation ' ' Text '&&' Operator ' ' Text 'flag?' Name '(' Punctuation ':x86_64' Literal.String.Symbol ')' Punctuation ' ' Text '%}' Literal.String.Interpol '\n ' Text 'struct' Keyword ' ' Text 'SomeStruct' Name.Class '\n ' Text 'some_field' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n ' Text 'end' Keyword '\n ' Text '{%' Literal.String.Interpol ' ' Text 'else' Keyword ' ' Text '%}' Literal.String.Interpol '\n ' Text 'struct' Keyword ' ' Text 'SomeStruct' Name.Class '\n ' Text 'some_field' Name ' ' Text ':' Punctuation ' ' Text 'Int64' Name '\n ' Text 'end' Keyword '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n' Text 'end' Keyword '\n\n' Text '# Assigns to a local variable' Comment.Single '\n' Text 'local' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n\n' Text '# Assigns to a global property' Comment.Single '\n' Text 'class' Keyword ' ' Text 'Global' Name.Class '\n ' Text 'class_property' Name.Builtin.Pseudo ' ' Text 'global1' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'class_getter' Name.Builtin.Pseudo ' ' Text 'global2' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n ' Text 'class_setter' Name.Builtin.Pseudo ' ' Text 'global3' Name ' ' Text '=' Operator ' ' Text '3' Literal.Number.Integer '\n\n ' Text '# Fails on nil' Comment.Single '\n ' Text 'class_property!' Name.Builtin.Pseudo ' ' Text 'global4' Name ' ' Text '=' Operator ' ' Text '4' Literal.Number.Integer '\n ' Text 'class_getter!' Name.Builtin.Pseudo ' ' Text 'global5' Name ' ' Text '=' Operator ' ' Text '5' Literal.Number.Integer '\n ' Text 'class_setter' Name.Builtin.Pseudo '!' Operator ' ' Text 'global6' Name ' ' Text '=' Operator ' ' Text '6' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Testing' Name.Class '\n ' Text '# Assigns to an instance variable' Comment.Single '\n ' Text '@instance' Name.Variable.Instance ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n\n ' Text '# Assigns to a class variable' Comment.Single '\n ' Text '@@class' Name.Variable.Class ' ' Text '=' Operator ' ' Text '3' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'local' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '# same as: local = local + 1' Comment.Single '\n\n' Text '# The above is valid with these operators:' Comment.Single '\n' Text '# +, -, *, /, %, |, &, ^, **, <<, >>' Comment.Single '\n\n' Text 'local' Name ' ' Text '||' Operator '=' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '# same as: local || (local = 1)' Comment.Single '\n' Text 'local' Name ' ' Text '&&' Operator '=' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '# same as: local && (local = 1)' Comment.Single '\n\n' Text '# A setter' Comment.Single '\n' Text 'person' Name '.' Operator 'name' Name '=' Operator '(' Punctuation '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double ')' Punctuation '\n\n' Text '# The above can be written as:' Comment.Single '\n' Text 'person' Name '.' Operator 'name' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n\n' Text '# An indexed assignment' Comment.Single '\n' Text 'objects' Name '.' Operator '[]=' Name.Operator '(' Punctuation '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ')' Punctuation '\n\n' Text '# The above can be written as:' Comment.Single '\n' Text 'objects' Name '[' Operator '2' Literal.Number.Integer ']' Operator ' ' Text '=' Operator ' ' Text '3' Literal.Number.Integer '\n\n' Text '# Not assignment-related, but also syntax sugar:' Comment.Single '\n' Text 'objects' Name '.' Operator '[]' Name.Operator '(' Punctuation '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ')' Punctuation '\n\n' Text '# The above can be written as:' Comment.Single '\n' Text 'objects' Name '[' Operator '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n\n' Text 'person' Name '.' Operator 'age' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '# same as: person.age = person.age + 1' Comment.Single '\n\n' Text 'person' Name '.' Operator 'name' Name ' ' Text '||' Operator '=' Operator ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double ' ' Text '# same as: person.name || (person.name = "John")' Comment.Single '\n' Text 'person' Name '.' Operator 'name' Name ' ' Text '&&' Operator '=' Operator ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double ' ' Text '# same as: person.name && (person.name = "John")' Comment.Single '\n\n' Text 'objects' Name '[' Operator '1' Literal.Number.Integer ']' Operator ' ' Text '+=' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '# same as: objects[1] = objects[1] + 2' Comment.Single '\n\n' Text 'objects' Name '[' Operator '1' Literal.Number.Integer ']' Operator ' ' Text '||' Operator '=' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '# same as: objects[1]? || (objects[1] = 2)' Comment.Single '\n' Text 'objects' Name '[' Operator '1' Literal.Number.Integer ']' Operator ' ' Text '&&' Operator '=' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '# same as: objects[1]? && (objects[1] = 2)' Comment.Single '\n\n' Text 'alias' Keyword ' ' Text 'PInt32' Name.Class ' ' Text '=' Operator ' ' Text 'Pointer' Name '(' Punctuation 'Int32' Name ')' Punctuation '\n\n' Text 'ptr' Name ' ' Text '=' Operator ' ' Text 'PInt32' Name '.' Operator 'malloc' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# : Pointer(Int32)' Comment.Single '\n\n' Text 'alias' Keyword ' ' Text 'RecArray' Name.Class ' ' Text '=' Operator ' ' Text 'Array' Name '(' Punctuation 'Int32' Name ')' Punctuation ' ' Text '|' Operator ' ' Text 'Array' Name '(' Punctuation 'RecArray' Name ')' Punctuation '\n\n' Text 'ary' Name ' ' Text '=' Operator ' ' Text '[' Operator ']' Operator ' ' Text 'of' Keyword ' ' Text 'RecArray' Name '\n' Text 'ary' Name '.' Operator 'push' Name ' ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n' Text 'ary' Name '.' Operator 'push' Name ' ' Text 'ary' Name '\n' Text 'ary' Name ' ' Text '# => [[1, 2, 3], [...]]' Comment.Single '\n\n' Text 'module' Keyword ' ' Text 'Json' Name.Namespace '\n ' Text 'alias' Keyword ' ' Text 'Type' Name.Class ' ' Text '=' Operator ' ' Text 'Nil' Name ' ' Text '|' Operator '\n ' Text 'Bool' Name ' ' Text '|' Operator '\n ' Text 'Int64' Name ' ' Text '|' Operator '\n ' Text 'Float64' Name ' ' Text '|' Operator '\n ' Text 'String' Name ' ' Text '|' Operator '\n ' Text 'Array' Name '(' Punctuation 'Type' Name ')' Punctuation ' ' Text '|' Operator '\n ' Text 'Hash' Name '(' Punctuation 'String' Name ',' Punctuation ' ' Text 'Type' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'if' Keyword ' ' Text 'a' Name ' ' Text '>' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'a' Name ' ' Text '=' Operator ' ' Text '10' Literal.Number.Integer '\n' Text 'end' Keyword '\n' Text 'a' Name ' ' Text '# => 10' Comment.Single '\n\n' Text 'b' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'if' Keyword ' ' Text 'b' Name ' ' Text '>' Operator ' ' Text '2' Literal.Number.Integer '\n ' Text 'b' Name ' ' Text '=' Operator ' ' Text '10' Literal.Number.Integer '\n' Text 'else' Keyword '\n ' Text 'b' Name ' ' Text '=' Operator ' ' Text '20' Literal.Number.Integer '\n' Text 'end' Keyword '\n' Text 'b' Name ' ' Text '# => 20' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'do_something' Name '\n' Text 'elsif' Keyword ' ' Text 'some_other_condition' Name '\n ' Text 'do_something_else' Name '\n' Text 'else' Keyword '\n ' Text 'do_that' Name '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'a' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'else' Keyword '\n ' Text 'a' Name ' ' Text '=' Operator ' ' Text 'true' Keyword.Constant '\n' Text 'end' Keyword '\n' Text '# a : String | Bool' Comment.Single '\n\n' Text 'b' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'b' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n' Text '# b : Int32 | String' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'c' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'else' Keyword '\n ' Text 'c' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n' Text '# c : Int32 | String' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'd' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n' Text '# d : Int32 | Nil' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'a' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n ' Text '# a : String' Comment.Single '\n ' Text 'a' Name '.' Operator 'size' Name '\n' Text 'end' Keyword '\n' Text '# a : String | Int32' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'some_condition' Name '\n ' Text 'e' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'else' Keyword '\n ' Text 'e' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n ' Text '# e : String' Comment.Single '\n ' Text 'return' Keyword '\n' Text 'end' Keyword '\n' Text '# e : Int32' Comment.Single '\n\n' Text 'enum' Keyword ' ' Text 'Color' Name.Class ' ' Text ':' Punctuation ' ' Text 'UInt8' Name '\n ' Text 'Red' Name ' ' Text '# 0' Comment.Single '\n ' Text 'Green' Name ' ' Text '# 1' Comment.Single '\n ' Text 'Blue' Name ' ' Text '=' Operator ' ' Text '5' Literal.Number.Integer ' ' Text '# overwritten to 5' Comment.Single '\n ' Text 'Yellow' Name ' ' Text '# 6 (5 + 1)' Comment.Single '\n\n ' Text 'def' Keyword ' ' Text 'red?' Name.Function '\n ' Text 'self' Keyword ' ' Text '==' Operator ' ' Text 'Color' Name '::' Operator 'Red' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Color' Name '::' Operator 'Red' Name '.' Operator 'value' Name ' ' Text '# :: UInt8' Comment.Single '\n\n' Text '@[' Operator 'Flags' Name.Decorator ']' Operator '\n' Text 'enum' Keyword ' ' Text 'IOMode' Name.Class '\n ' Text 'Read' Name ' ' Text '# 1' Comment.Single '\n ' Text 'Write' Name ' ' Text '# 2' Comment.Single '\n ' Text 'Async' Name ' ' Text '# 4' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'IOMode' Name '::' Operator 'None' Name '.' Operator 'value' Name ' ' Text '# => 0' Comment.Single '\n' Text 'IOMode' Name '::' Operator 'All' Name '.' Operator 'value' Name ' ' Text '# => 7' Comment.Single '\n\n' Text 'puts' Name.Builtin '(' Punctuation 'Color' Name '::' Operator 'Red' Name ')' Punctuation ' ' Text '# prints "Red"' Comment.Single '\n' Text 'puts' Name.Builtin '(' Punctuation 'IOMode' Name '::' Operator 'Write' Name ' ' Text '|' Operator ' ' Text 'IOMode' Name '::' Operator 'Async' Name ')' Punctuation ' ' Text '# prints "Write, Async"' Comment.Single '\n\n' Text 'puts' Name.Builtin ' ' Text 'Color' Name '.' Operator 'new' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# => prints "Green"' Comment.Single '\n\n' Text 'puts' Name.Builtin ' ' Text 'Color' Name '.' Operator 'new' Name '(' Punctuation '10' Literal.Number.Integer ')' Punctuation ' ' Text '# => prints "10"' Comment.Single '\n\n' Text 'Color' Name '::' Operator 'Red' Name '.' Operator 'red?' Name ' ' Text '# => true' Comment.Single '\n' Text 'Color' Name '::' Operator 'Blue' Name '.' Operator 'red?' Name ' ' Text '# => false' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'paint' Name.Function '(' Punctuation 'color' Name ' ' Text ':' Punctuation ' ' Text 'Color' Name ')' Punctuation '\n ' Text 'case' Keyword ' ' Text 'color' Name '\n ' Text 'when' Keyword ' ' Text 'Color' Name '::' Operator 'Red' Name '\n ' Text '# ...' Comment.Single '\n ' Text 'else' Keyword '\n ' Text '# Unusual, but still can happen' Comment.Single '\n ' Text 'raise' Name.Builtin ' ' Text '"' Literal.String.Double 'unknown color: ' Literal.String.Double '#{' Literal.String.Interpol 'color' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'paint' Name ' ' Text 'Color' Name '::' Operator 'Red' Name '\n\n' Text 'def' Keyword ' ' Text 'paint' Name.Function '(' Punctuation 'color' Name ' ' Text ':' Punctuation ' ' Text 'Symbol' Name ')' Punctuation '\n ' Text 'case' Keyword ' ' Text 'color' Name '\n ' Text 'when' Keyword ' ' Text ':red' Literal.String.Symbol '\n ' Text '# ...' Comment.Single '\n ' Text 'else' Keyword '\n ' Text 'raise' Name.Builtin ' ' Text '"' Literal.String.Double 'unknown color: ' Literal.String.Double '#{' Literal.String.Interpol 'color' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'paint' Name ' ' Text ':red' Literal.String.Symbol '\n\n' Text 'name' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'Crystal' Literal.String.Double '"' Literal.String.Double '\n' Text 'age' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n\n' Text 'flower' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'Tulip' Literal.String.Double '"' Literal.String.Double '\n' Text "# At this point 'flower' is a String" Comment.Single '\n\n' Text 'flower' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n\n' Text "# At this point 'flower' is an Int32" Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Foo' Name.Class '\n ' Text 'def' Keyword ' ' Text 'finalize' Name.Function '\n ' Text '# Invoked when Foo is garbage-collected' Comment.Single '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Bye bye from ' Literal.String.Double '#{' Literal.String.Interpol 'self' Keyword '}' Literal.String.Interpol '!' Literal.String.Double '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text '# Prints "Bye bye ...!" for ever' Comment.Single '\n' Text 'loop' Name.Builtin ' ' Text 'do' Keyword '\n ' Text 'Foo' Name '.' Operator 'new' Name '\n' Text 'end' Keyword '\n\n' Text '# Defines a method in the program' Comment.Single '\n' Text 'def' Keyword ' ' Text 'add' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text '# Invokes the add method in the program' Comment.Single '\n' Text 'add' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation ' ' Text '# => 3' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'even?' Name.Function '(' Punctuation 'num' Name ')' Punctuation '\n ' Text 'if' Keyword ' ' Text 'num' Name ' ' Text '%' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '==' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'return' Keyword ' ' Text 'true' Keyword.Constant '\n ' Text 'end' Keyword '\n\n ' Text 'return' Keyword ' ' Text 'false' Keyword.Constant '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'add' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Foo' Name.Class '\n ' Text 'def' Keyword ' ' Text 'bar' Name.Function '\n ' Text "# invokes the program's add method" Comment.Single '\n ' Text 'add' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation '\n\n ' Text "# invokes Foo's baz method" Comment.Single '\n ' Text 'baz' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'baz' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '*' Operator ' ' Text 'y' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'baz' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Foo' Name.Class '\n ' Text 'def' Keyword ' ' Text 'bar' Name.Function '\n ' Text 'baz' Name '(' Punctuation '4' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation ' ' Text '# => 2' Comment.Single '\n ' Text '::' Operator 'baz' Name '(' Punctuation '4' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation ' ' Text '# => 6' Comment.Single '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'baz' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '-' Operator ' ' Text 'y' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n\n' Text 'def' Keyword ' ' Text 'add' Name.Function '(' Punctuation 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name ' ' Text "# error: undefined local variable or method 'x'" Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'add' Name '(' Punctuation '2' Literal.Number.Integer ')' Punctuation '\n\n' Text 'add' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ' ' Text '# same as add(1, 2)' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Counter' Name.Class '\n ' Text '@@instances' Name.Variable.Class ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '\n ' Text '@@instances' Name.Variable.Class ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'self' Name.Class '.' Operator 'instances' Name.Function '\n ' Text '@@instances' Name.Variable.Class '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Counter' Name '.' Operator 'instances' Name ' ' Text '# => 0' Comment.Single '\n' Text 'Counter' Name '.' Operator 'new' Name '\n' Text 'Counter' Name '.' Operator 'new' Name '\n' Text 'Counter' Name '.' Operator 'new' Name '\n' Text 'Counter' Name '.' Operator 'instances' Name ' ' Text '# => 3' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Counter' Name.Class '\n ' Text 'def' Keyword ' ' Text 'self' Name.Class '.' Operator 'increment' Name.Function '\n ' Text '@@instances' Name.Variable.Class ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Counter' Name '.' Operator 'increment' Name ' ' Text "# Error: undefined method '+' for Nil" Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Parent' Name.Class '\n ' Text '@@counter' Name.Variable.Class ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Child' Name.Class ' ' Text '<' Operator ' ' Text 'Parent' Name '\n ' Text 'def' Keyword ' ' Text 'self' Name.Class '.' Operator 'counter' Name.Function '\n ' Text '@@counter' Name.Variable.Class '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Child' Name '.' Operator 'counter' Name ' ' Text '# => nil' Comment.Single '\n\n' Text 'unless' Keyword ' ' Text 'some_condition' Name '\n ' Text 'then_expression' Name '\n' Text 'else' Keyword '\n ' Text 'else_expression' Name '\n' Text 'end' Keyword '\n\n' Text '# Can also be written as a suffix' Comment.Single '\n' Text 'close_door' Name ' ' Text 'unless' Keyword ' ' Text 'door_closed?' Name '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'b' Name ' ' Text '=' Operator ' ' Text 'typeof' Keyword.Pseudo '(' Punctuation 'a' Name ')' Punctuation ' ' Text '# => Int32' Comment.Single '\n\n' Text 'typeof' Keyword.Pseudo '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '"' Literal.String.Double 'a' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text "'a'" Literal.String.Char ')' Punctuation ' ' Text '# => (Int32 | String | Char)' Comment.Single '\n\n' Text 'hash' Name ' ' Text '=' Operator ' ' Text '{' Punctuation '}' Punctuation ' ' Text 'of' Keyword ' ' Text 'Int32' Name ' ' Text '=' Operator '>' Operator ' ' Text 'String' Name '\n' Text 'another_hash' Name ' ' Text '=' Operator ' ' Text 'typeof' Keyword.Pseudo '(' Punctuation 'hash' Name ')' Punctuation '.' Operator 'new' Name ' ' Text '# :: Hash(Int32, String)' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Array' Name.Class '\n ' Text 'def' Keyword ' ' Text 'self' Name.Class '.' Operator 'elem_type' Name.Function '(' Punctuation 'typ' Name ')' Punctuation '\n ' Text 'if' Keyword ' ' Text 'typ' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'Array' Name ')' Punctuation '\n ' Text 'elem_type' Name '(' Punctuation 'typ' Name '.' Operator 'first' Name ')' Punctuation '\n ' Text 'else' Keyword '\n ' Text 'typ' Name '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'nest' Name ' ' Text '=' Operator ' ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '[' Operator '"' Literal.String.Double 'b' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '[' Operator ':c' Literal.String.Symbol ',' Punctuation ' ' Text '[' Operator "'d'" Literal.String.Char ']' Operator ']' Operator ']' Operator ']' Operator '\n' Text 'flat' Name ' ' Text '=' Operator ' ' Text 'Array' Name '(' Punctuation 'typeof' Keyword.Pseudo '(' Punctuation 'Array' Name '.' Operator 'elem_type' Name '(' Punctuation 'nest' Name ')' Punctuation ')' Punctuation ')' Punctuation '.' Operator 'new' Name '\n' Text 'typeof' Keyword.Pseudo '(' Punctuation 'nest' Name ')' Punctuation ' ' Text '# => Array(Int32 | Array(String | Array(Symbol | Array(Char))))' Comment.Single '\n' Text 'typeof' Keyword.Pseudo '(' Punctuation 'flat' Name ')' Punctuation ' ' Text '# => Array(String | Int32 | Symbol | Char)' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer ' ' Text 'if' Keyword ' ' Text 'some_condition' Name '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator '{' Punctuation ' ' Text 'x' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation ' ' Text 'x' Name ' ' Text '}' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name ' ' Text '# => 1' Comment.Single '\n' Text 'proc' Name '.' Operator 'call' Name ' ' Text '# => 2' Comment.Single '\n' Text 'x' Name ' ' Text '# => 2' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'counter' Name.Function '\n ' Text 'x' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text '-' Operator '>' Operator '{' Punctuation ' ' Text 'x' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation ' ' Text 'x' Name ' ' Text '}' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'counter' Name '\n' Text 'proc' Name '.' Operator 'call' Name ' ' Text '# => 1' Comment.Single '\n' Text 'proc' Name '.' Operator 'call' Name ' ' Text '# => 2' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '\n ' Text 'yield' Keyword '\n' Text 'end' Keyword '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'foo' Name ' ' Text 'do' Keyword '\n ' Text 'x' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n' Text 'x' Name ' ' Text '# : Int32 | String' Comment.Single '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'foo' Name ' ' Text 'do' Keyword '\n ' Text 'x' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n' Text 'x' Name ' ' Text '# : Int32 | String' Comment.Single '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text "'a'" Literal.String.Char '\n' Text 'x' Name ' ' Text '# : Char' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'capture' Name.Function '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'capture' Name ' ' Text '{' Punctuation ' ' Text 'x' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text "'a'" Literal.String.Char '\n' Text 'x' Name ' ' Text '# : Int32 | String | Char' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'capture' Name.Function '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text '-' Operator '>' Operator '{' Punctuation ' ' Text 'x' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text "'a'" Literal.String.Char '\n' Text 'x' Name ' ' Text '# : Int32 | String | Char' Comment.Single '\n\n' Text 'abstract' Keyword ' ' Text 'class' Keyword ' ' Text 'Animal' Name.Class '\n ' Text '# Makes this animal talk' Comment.Single '\n ' Text 'abstract' Keyword ' ' Text 'def' Keyword ' ' Text 'talk' Name.Function '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Dog' Name.Class ' ' Text '<' Operator ' ' Text 'Animal' Name '\n ' Text 'def' Keyword ' ' Text 'talk' Name.Function '\n ' Text '"' Literal.String.Double 'Woof!' Literal.String.Double '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Cat' Name.Class ' ' Text '<' Operator ' ' Text 'Animal' Name '\n ' Text 'def' Keyword ' ' Text 'talk' Name.Function '\n ' Text '"' Literal.String.Double 'Miau' Literal.String.Double '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'getter' Name.Builtin.Pseudo ' ' Text 'pet' Name '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ',' Punctuation ' ' Text '@pet' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text 'Dog' Name '.' Operator 'new' Name '\n' Text 'peter' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'Peter' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text 'Cat' Name '.' Operator 'new' Name '\n\n' Text 'john' Name '.' Operator 'pet' Name '.' Operator 'talk' Name ' ' Text '# => "Woof!"' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '>' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '?' Operator ' ' Text '3' Literal.Number.Integer ' ' Text ':' Punctuation ' ' Text '4' Literal.Number.Integer '\n\n' Text '# The above is the same as:' Comment.Single '\n' Text 'a' Name ' ' Text '=' Operator ' ' Text 'if' Keyword ' ' Text '1' Literal.Number.Integer ' ' Text '>' Operator ' ' Text '2' Literal.Number.Integer '\n ' Text '3' Literal.Number.Integer '\n ' Text 'else' Keyword '\n ' Text '4' Literal.Number.Integer '\n ' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'some_method' Name.Function ' ' Text ':' Punctuation ' ' Text 'String' Name '\n ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'PI' Name.Constant ' ' Text '=' Operator ' ' Text '3.14' Literal.Number.Float '\n\n' Text 'module' Keyword ' ' Text 'Earth' Name.Namespace '\n ' Text 'RADIUS' Name.Constant ' ' Text '=' Operator ' ' Text '6_371_000' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'PI' Name.Constant ' ' Text '# => 3.14' Comment.Single '\n' Text 'Earth' Name '::' Operator 'RADIUS' Name.Constant ' ' Text '# => 6_371_000' Comment.Single '\n\n' Text 'TEN' Name.Constant ' ' Text '=' Operator ' ' Text 'begin' Keyword '\n ' Text 'a' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'while' Keyword ' ' Text 'a' Name ' ' Text '<' Operator ' ' Text '10' Literal.Number.Integer '\n ' Text 'a' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'end' Keyword '\n ' Text 'a' Name '\n' Text 'end' Keyword '\n\n' Text 'TEN' Name.Constant ' ' Text '# => 10' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'getter' Name.Builtin.Pseudo ' ' Text 'name' Name '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ')' Punctuation '\n ' Text '@age' Name.Variable.Instance ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'john' Name '.' Operator 'name' Name ' ' Text '# => "John"' Comment.Single '\n' Text 'john' Name '.' Operator 'name' Name '.' Operator 'size' Name ' ' Text '# => 4' Comment.Single '\n\n' Text 'one' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '1' Literal.Number.Integer '\n' Text 'one' Name '.' Operator 'name' Name ' ' Text '# => 1' Comment.Single '\n' Text 'one' Name '.' Operator 'name' Name ' ' Text '+' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '# => 3' Comment.Single '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'one' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '1' Literal.Number.Integer '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'one' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '1' Literal.Number.Integer '\n\n' Text "# Error: undefined method 'size' for Int32" Comment.Single '\n' Text 'john' Name '.' Operator 'name' Name '.' Operator 'size' Name '\n\n' Text "# Error: no overload matches 'String#+' with types Int32" Comment.Single '\n' Text 'john' Name '.' Operator 'name' Name ' ' Text '+' Operator ' ' Text '3' Literal.Number.Integer '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'john' Name '.' Operator 'name' Name '.' Operator 'size' Name '\n' Text 'one' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '1' Literal.Number.Integer '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'getter' Name.Builtin.Pseudo ' ' Text 'name' Name '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ')' Punctuation '\n ' Text '@age' Name.Variable.Instance ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'address' Name.Function '\n ' Text '@address' Name.Variable.Instance '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'address' Name.Function '=' Operator '(' Punctuation '@address' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'john' Name '.' Operator 'address' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'Argentina' Literal.String.Double '"' Literal.String.Double '\n\n' Text "# Error: undefined method 'size' for Nil" Comment.Single '\n' Text 'john' Name '.' Operator 'address' Name '.' Operator 'size' Name '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text '@age' Name.Variable.Instance ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text '@age' Name.Variable.Instance ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ')' Punctuation '\n ' Text '@age' Name.Variable.Instance ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text 'if' Keyword ' ' Text '2' Literal.Number.Integer ' ' Text '>' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text '3' Literal.Number.Integer '\n ' Text 'else' Keyword '\n ' Text '4' Literal.Number.Integer '\n ' Text 'end' Keyword '\n' Text 'a' Name ' ' Text '# => 3' Comment.Single '\n\n' Text 'if' Keyword ' ' Text '1' Literal.Number.Integer ' ' Text '>' Operator ' ' Text '2' Literal.Number.Integer '\n' Text 'else' Keyword '\n ' Text '3' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text 'yield' Keyword '\n ' Text 'yield' Keyword '\n' Text 'end' Keyword '\n\n' Text 'twice' Name '(' Punctuation ')' Punctuation ' ' Text 'do' Keyword '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello!' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text 'do' Keyword '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello!' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text '{' Punctuation ' ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello!' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got ' Literal.String.Double '#{' Literal.String.Interpol 'i' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'i' Name '|' Operator ' ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got ' Literal.String.Double '#{' Literal.String.Interpol 'i' Name '}' Literal.String.Interpol '"' Literal.String.Double ' ' Text '}' Punctuation '\n\n' Text 'def' Keyword ' ' Text 'many' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'many' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'x' Name ',' Punctuation ' ' Text 'y' Name ',' Punctuation ' ' Text 'z' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name ' ' Text '+' Operator ' ' Text 'z' Name '\n' Text 'end' Keyword '\n\n' Text '# Output: 6' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'many' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'many' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'x' Name ',' Punctuation ' ' Text 'y' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text '# Output: 3' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'yield' Keyword '\n ' Text 'yield' Keyword '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text 'i' Name '.' Operator 'inspect' Name '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'some' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text "'a'" Literal.String.Char '\n ' Text 'yield' Keyword ' ' Text 'true' Keyword.Constant ',' Punctuation ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'some' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'first' Name ',' Punctuation ' ' Text 'second' Name '|' Operator '\n ' Text '# first is Int32 | Bool' Comment.Single '\n ' Text '# second is Char | String | Nil' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'method' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'argument' Name '|' Operator '\n ' Text 'argument' Name '.' Operator 'some_method' Name '\n' Text 'end' Keyword '\n\n' Text 'method' Name '(' Punctuation '&' Operator '.' Operator 'some_method' Name ')' Punctuation '\n\n' Text 'method' Name ' ' Text '&' Operator '.' Operator 'some_method' Name '(' Punctuation 'arg1' Name ',' Punctuation ' ' Text 'arg2' Name ')' Punctuation '\n\n' Text 'method' Name ' ' Text '&' Operator '.' Operator '+' Name.Operator '(' Punctuation '2' Literal.Number.Integer ')' Punctuation '\n' Text 'method' Name ' ' Text '&' Operator '.' Operator '[' Name 'index' Name ']' Operator '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'v1' Name ' ' Text '=' Operator ' ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text 'v1' Name '\n\n ' Text 'v2' Name ' ' Text '=' Operator ' ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text 'v2' Name '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'i' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'ary' Name ' ' Text '=' Operator ' ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n' Text 'ary' Name '.' Operator 'map' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation ' ' Text '# => [2, 3, 4]' Comment.Single '\n' Text 'ary' Name '.' Operator 'select' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name ' ' Text '%' Operator ' ' Text '2' Literal.Number.Integer ' ' Text '==' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation ' ' Text '# => [1, 3]' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'transform' Name.Function '(' Punctuation 'value' Name ')' Punctuation '\n ' Text 'yield' Keyword ' ' Text 'value' Name '\n' Text 'end' Keyword '\n\n' Text 'transform' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation ' ' Text '# => 2' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'thrice' Name.Function '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Before 1' Literal.String.Double '"' Literal.String.Double '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Before 2' Literal.String.Double '"' Literal.String.Double '\n ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Before 3' Literal.String.Double '"' Literal.String.Double '\n ' Text 'yield' Keyword ' ' Text '3' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'After 3' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'thrice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'if' Keyword ' ' Text 'i' Name ' ' Text '==' Operator ' ' Text '2' Literal.Number.Integer '\n ' Text 'break' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'i' Name '|' Operator ' ' Text 'i' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation ' ' Text '# => 3' Comment.Single '\n' Text 'twice' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'i' Name '|' Operator ' ' Text 'break' Keyword ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation ' ' Text '# => "hello"' Comment.Single '\n\n' Text 'value' Name ' ' Text '=' Operator ' ' Text 'twice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'if' Keyword ' ' Text 'i' Name ' ' Text '==' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'break' Keyword ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n ' Text 'end' Keyword '\n ' Text 'i' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n' Text 'value' Name ' ' Text '# :: Int32 | String' Comment.Single '\n\n' Text 'values' Name ' ' Text '=' Operator ' ' Text 'twice' Name ' ' Text '{' Punctuation ' ' Text 'break' Keyword ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ' ' Text '}' Punctuation '\n' Text 'values' Name ' ' Text '# => {1, 2}' Comment.Single '\n\n' Text 'value' Name ' ' Text '=' Operator ' ' Text 'twice' Name ' ' Text '{' Punctuation ' ' Text 'break' Keyword ' ' Text '}' Punctuation '\n' Text 'value' Name ' ' Text '# => nil' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'if' Keyword ' ' Text 'i' Name ' ' Text '==' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Skipping 1' Literal.String.Double '"' Literal.String.Double '\n ' Text 'next' Keyword '\n ' Text 'end' Keyword '\n\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got ' Literal.String.Double '#{' Literal.String.Interpol 'i' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'v1' Name ' ' Text '=' Operator ' ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text 'v1' Name '\n\n ' Text 'v2' Name ' ' Text '=' Operator ' ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text 'v2' Name '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'if' Keyword ' ' Text 'i' Name ' ' Text '==' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'next' Keyword ' ' Text '10' Literal.Number.Integer '\n ' Text 'end' Keyword '\n\n ' Text 'i' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text '# Output' Comment.Single '\n' Text '# 10' Comment.Single '\n' Text '# 3' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Foo' Name.Class '\n ' Text 'def' Keyword ' ' Text 'one' Name.Function '\n ' Text '1' Literal.Number.Integer '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'yield_with_self' Name.Function '\n ' Text 'with' Keyword ' ' Text 'self' Keyword ' ' Text 'yield' Keyword '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'yield_normally' Name.Function '\n ' Text 'yield' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'one' Name.Function '\n ' Text '"' Literal.String.Double 'one' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'Foo' Name '.' Operator 'new' Name '.' Operator 'yield_with_self' Name ' ' Text '{' Punctuation ' ' Text 'one' Name ' ' Text '}' Punctuation ' ' Text '# => 1' Comment.Single '\n' Text 'Foo' Name '.' Operator 'new' Name '.' Operator 'yield_normally' Name ' ' Text '{' Punctuation ' ' Text 'one' Name ' ' Text '}' Punctuation ' ' Text '# => "one"' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n ' Text 'yield' Keyword ' ' Text '2' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got: ' Literal.String.Double '#{' Literal.String.Interpol 'i' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'i' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got: ' Literal.String.Double '#{' Literal.String.Interpol 'i' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n' Text 'i' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got: ' Literal.String.Double '#{' Literal.String.Interpol 'i' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n\n' Text '3' Literal.Number.Integer '.' Operator 'times' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text 'i' Name '\n' Text 'end' Keyword '\n\n' Text 'struct' Keyword ' ' Text 'Int' Name.Class '\n ' Text 'def' Keyword ' ' Text 'times' Name.Function '\n ' Text 'i' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'while' Keyword ' ' Text 'i' Name ' ' Text '<' Operator ' ' Text 'self' Keyword '\n ' Text 'yield' Keyword ' ' Text 'i' Name '\n ' Text 'i' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'i' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'while' Keyword ' ' Text 'i' Name ' ' Text '<' Operator ' ' Text '3' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text 'i' Name '\n ' Text 'i' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'greet' Name.Function '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double "Hi, I'm " Literal.String.Double '#{' Literal.String.Interpol '@name' Name.Variable.Instance '}' Literal.String.Interpol '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Employee' Name.Class ' ' Text '<' Operator ' ' Text 'Person' Name '\n' Text 'end' Keyword '\n\n' Text 'employee' Name ' ' Text '=' Operator ' ' Text 'Employee' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'employee' Name '.' Operator 'greet' Name ' ' Text '# "Hi, I\'m John"' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Employee' Name.Class ' ' Text '<' Operator ' ' Text 'Person' Name '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ',' Punctuation ' ' Text '@company_name' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Employee' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '"' Literal.String.Double 'Acme' Literal.String.Double '"' Literal.String.Double ' ' Text '# OK' Comment.Single '\n' Text 'Employee' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'Peter' Literal.String.Double '"' Literal.String.Double ' ' Text '# Error: wrong number of arguments' Comment.Single '\n' Text "# for 'Employee:Class#new' (1 for 2)" Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'greet' Name.Function '(' Punctuation 'msg' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hi, ' Literal.String.Double '#{' Literal.String.Interpol 'msg' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Employee' Name.Class ' ' Text '<' Operator ' ' Text 'Person' Name '\n ' Text 'def' Keyword ' ' Text 'greet' Name.Function '(' Punctuation 'msg' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello, ' Literal.String.Double '#{' Literal.String.Interpol 'msg' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'p' Name.Builtin ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name '\n' Text 'p' Name.Builtin '.' Operator 'greet' Name ' ' Text '"' Literal.String.Double 'everyone' Literal.String.Double '"' Literal.String.Double ' ' Text '# "Hi, everyone"' Comment.Single '\n\n' Text 'e' Name ' ' Text '=' Operator ' ' Text 'Employee' Name '.' Operator 'new' Name '\n' Text 'e' Name '.' Operator 'greet' Name ' ' Text '"' Literal.String.Double 'everyone' Literal.String.Double '"' Literal.String.Double ' ' Text '# "Hello, everyone"' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'greet' Name.Function '(' Punctuation 'msg' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hi, ' Literal.String.Double '#{' Literal.String.Interpol 'msg' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Employee' Name.Class ' ' Text '<' Operator ' ' Text 'Person' Name '\n ' Text 'def' Keyword ' ' Text 'greet' Name.Function '(' Punctuation 'msg' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hi, this is a number: ' Literal.String.Double '#{' Literal.String.Interpol 'msg' Name '}' Literal.String.Interpol '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'e' Name ' ' Text '=' Operator ' ' Text 'Employee' Name '.' Operator 'new' Name '\n' Text 'e' Name '.' Operator 'greet' Name ' ' Text '"' Literal.String.Double 'everyone' Literal.String.Double '"' Literal.String.Double ' ' Text '# "Hi, everyone"' Comment.Single '\n\n' Text 'e' Name '.' Operator 'greet' Name ' ' Text '1' Literal.Number.Integer ' ' Text '# "Hi, this is a number: 1"' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'greet' Name.Function '(' Punctuation 'msg' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello, ' Literal.String.Double '"' Literal.String.Double ' ' Text '# {msg}"' Comment.Single '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Employee' Name.Class ' ' Text '<' Operator ' ' Text 'Person' Name '\n ' Text 'def' Keyword ' ' Text 'greet' Name.Function '(' Punctuation 'msg' Name ')' Punctuation '\n ' Text 'super' Keyword ' ' Text '# Same as: super(msg)' Comment.Single '\n ' Text 'super' Keyword '(' Punctuation '"' Literal.String.Double 'another message' Literal.String.Double '"' Literal.String.Double ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'int_to_int' Name.Function '(' Punctuation '&' Operator 'block' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ' ' Text '-' Operator '>' Operator ' ' Text 'Int32' Name ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'int_to_int' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# => 2' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Model' Name.Class '\n ' Text 'def' Keyword ' ' Text 'on_save' Name.Function '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text '@on_save_callback' Name.Variable.Instance ' ' Text '=' Operator ' ' Text 'block' Name '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'save' Name.Function '\n ' Text 'if' Keyword ' ' Text 'callback' Name ' ' Text '=' Operator ' ' Text '@on_save_callback' Name.Variable.Instance '\n ' Text 'callback' Name '.' Operator 'call' Name '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'model' Name ' ' Text '=' Operator ' ' Text 'Model' Name '.' Operator 'new' Name '\n' Text 'model' Name '.' Operator 'on_save' Name ' ' Text '{' Punctuation ' ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Saved!' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n' Text 'model' Name '.' Operator 'save' Name ' ' Text '# prints "Saved!"' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'some_proc' Name.Function '(' Punctuation '&' Operator 'block' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ' ' Text '-' Operator '>' Operator ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'some_proc' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# void' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'some_proc' Name.Function '(' Punctuation '&' Operator 'block' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ' ' Text '-' Operator '>' Operator ' ' Text '_' Name ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'some_proc' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# 2' Comment.Single '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'some_proc' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name '.' Operator 'to_s' Name ' ' Text '}' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# "1"' Comment.Single '\n\n' Text 'macro' Keyword ' ' Text 'update_x' Name.Function '\n ' Text 'x' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'update_x' Name '\n' Text 'x' Name ' ' Text '# => 1' Comment.Single '\n\n' Text 'macro' Keyword ' ' Text 'dont_update_x' Name.Function '\n ' Text '%' Operator 'x' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'puts' Name.Builtin ' ' Text '%' Operator 'x' Name '\n' Text 'end' Keyword '\n\n' Text 'x' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text 'dont_update_x' Name ' ' Text '# outputs 1' Comment.Single '\n' Text 'x' Name ' ' Text '# => 0' Comment.Single '\n\n' Text 'macro' Keyword ' ' Text 'fresh_vars_sample' Name.Function '(' Punctuation '*' Operator 'names' Name ')' Punctuation '\n ' Text '# First declare vars' Comment.Single '\n ' Text '{%' Literal.String.Interpol ' ' Text 'for' Keyword ' ' Text 'name' Name ',' Punctuation ' ' Text 'index' Name ' ' Text 'in' Keyword ' ' Text 'names' Name ' ' Text '%}' Literal.String.Interpol '\n ' Text 'print' Name.Builtin ' ' Text '"' Literal.String.Double 'Declaring: ' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '"' Literal.String.Double '%name{index}' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text "'\\n'" Literal.String.Char '\n ' Text '%' Operator 'name' Name '{' Punctuation 'index' Name '}' Punctuation ' ' Text '=' Operator ' ' Text '{{' Literal.String.Interpol 'index' Name '}}' Literal.String.Interpol '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n\n ' Text '# Then print them' Comment.Single '\n ' Text '{%' Literal.String.Interpol ' ' Text 'for' Keyword ' ' Text 'name' Name ',' Punctuation ' ' Text 'index' Name ' ' Text 'in' Keyword ' ' Text 'names' Name ' ' Text '%}' Literal.String.Interpol '\n ' Text 'print' Name.Builtin ' ' Text '"' Literal.String.Double '%name{index}: ' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '%' Operator 'name' Name '{' Punctuation 'index' Name '}' Punctuation ',' Punctuation ' ' Text "'\\n'" Literal.String.Char '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n' Text 'end' Keyword '\n\n' Text 'fresh_vars_sample' Name ' ' Text 'a' Name ',' Punctuation ' ' Text 'b' Name ',' Punctuation ' ' Text 'c' Name '\n\n' Text '# Sample output:' Comment.Single '\n' Text '# Declaring: __temp_255' Comment.Single '\n' Text '# Declaring: __temp_256' Comment.Single '\n' Text '# Declaring: __temp_257' Comment.Single '\n' Text '# __temp_255: 0' Comment.Single '\n' Text '# __temp_256: 1' Comment.Single '\n' Text '# __temp_257: 2' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Object' Name.Class '\n ' Text 'macro' Keyword ' ' Text 'instance_vars_names' Name.Function '\n ' Text 'def' Keyword ' ' Text 'instance_vars_names' Name.Function ' ' Text ':' Punctuation ' ' Text 'Array' Name '(' Punctuation 'String' Name ')' Punctuation '\n ' Text '{{' Literal.String.Interpol ' ' Text '@type' Name.Variable.Instance '.' Operator 'instance_vars' Name '.' Operator 'map' Name ' ' Text '&' Operator '.' Operator 'name' Name '.' Operator 'stringify' Name ' ' Text '}}' Literal.String.Interpol '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@name' Name.Variable.Instance ',' Punctuation ' ' Text '@age' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'person' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '30' Literal.Number.Integer '\n' Text 'person' Name '.' Operator 'instance_vars_names' Name ' ' Text '# => ["name", "age"]' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Object' Name.Class '\n ' Text 'macro' Keyword ' ' Text 'has_instance_var?' Name.Function '(' Punctuation 'name' Name ')' Punctuation '\n ' Text 'def' Keyword ' ' Text 'has_instance_var?' Name.Function '(' Punctuation 'name' Name ')' Punctuation ' ' Text ':' Punctuation ' ' Text 'Bool' Name '\n ' Text '# We cannot access name inside the macro expansion here,' Comment.Single '\n ' Text '# instead we need to use the macro language to construct an array' Comment.Single '\n ' Text '# and do the inclusion check at runtime.' Comment.Single '\n ' Text '{{' Literal.String.Interpol ' ' Text '@type' Name.Variable.Instance '.' Operator 'instance_vars' Name '.' Operator 'map' Name ' ' Text '&' Operator '.' Operator 'name' Name '.' Operator 'stringify' Name ' ' Text '}}' Literal.String.Interpol '.' Operator 'includes?' Name ' ' Text 'name' Name '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'person' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '30' Literal.Number.Integer '\n' Text 'person' Name '.' Operator 'has_instance_var?' Name '(' Punctuation '"' Literal.String.Double 'name' Literal.String.Double '"' Literal.String.Double ')' Punctuation ' ' Text '# => true' Comment.Single '\n' Text 'person' Name '.' Operator 'has_instance_var?' Name '(' Punctuation '"' Literal.String.Double 'birthday' Literal.String.Double '"' Literal.String.Double ')' Punctuation ' ' Text '# => false' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Parent' Name.Class '\n ' Text 'macro' Keyword ' ' Text 'inherited' Name.Function '\n ' Text 'def' Keyword ' ' Text '{{' Literal.String.Interpol '@type' Name.Variable.Instance '.' Operator 'name' Name '.' Operator 'downcase' Name '.' Operator 'id' Name '}}' Literal.String.Interpol '\n ' Text '1' Literal.Number.Integer '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Child' Name.Class ' ' Text '<' Operator ' ' Text 'Parent' Name '\n' Text 'end' Keyword '\n\n' Text 'Child' Name '.' Operator 'new' Name '.' Operator 'child' Name ' ' Text '# => 1' Comment.Single '\n\n' Text 'macro' Keyword ' ' Text 'method_missing' Name.Function '(' Punctuation 'name' Name ',' Punctuation ' ' Text 'args' Name ',' Punctuation ' ' Text 'block' Name ')' Punctuation '\n ' Text 'print' Name.Builtin ' ' Text '"' Literal.String.Double 'Got ' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '{{' Literal.String.Interpol 'name' Name '.' Operator 'id' Name '.' Operator 'stringify' Name '}}' Literal.String.Interpol ',' Punctuation ' ' Text '"' Literal.String.Double ' with ' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '{{' Literal.String.Interpol 'args' Name '.' Operator 'size' Name '}}' Literal.String.Interpol ',' Punctuation ' ' Text '"' Literal.String.Double ' arguments' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text "'\\n'" Literal.String.Char '\n' Text 'end' Keyword '\n\n' Text 'foo' Name ' ' Text '# Prints: Got foo with 0 arguments' Comment.Single '\n' Text 'bar' Name ' ' Text "'a'" Literal.String.Char ',' Punctuation ' ' Text "'b'" Literal.String.Char ' ' Text '# Prints: Got bar with 2 arguments' Comment.Single '\n\n' Text 'sizeof' Keyword.Pseudo '(' Punctuation 'Int32' Name ')' Punctuation ' ' Text '# => 4' Comment.Single '\n' Text 'sizeof' Keyword.Pseudo '(' Punctuation 'Int64' Name ')' Punctuation ' ' Text '# => 8' Comment.Single '\n\n' Text '# On a 64 bits machine' Comment.Single '\n' Text 'sizeof' Keyword.Pseudo '(' Punctuation 'Pointer' Name '(' Punctuation 'Int32' Name ')' Punctuation ')' Punctuation ' ' Text '# => 8' Comment.Single '\n' Text 'sizeof' Keyword.Pseudo '(' Punctuation 'String' Name ')' Punctuation ' ' Text '# => 8' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'sizeof' Keyword.Pseudo '(' Punctuation 'typeof' Keyword.Pseudo '(' Punctuation 'a' Name ')' Punctuation ')' Punctuation ' ' Text '# => 4' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Foo' Name.Class '\n ' Text 'macro' Keyword ' ' Text 'emphasize' Name.Function '(' Punctuation 'value' Name ')' Punctuation '\n ' Text '"' Literal.String.Double '***' Literal.String.Double '#{' Literal.String.Interpol ' ' Text '{' Literal.String.Interpol '{' Literal.String.Interpol 'value' Name '}' Literal.String.Interpol '}' Literal.String.Interpol ' ' Text '}' Literal.String.Interpol '***' Literal.String.Double '"' Literal.String.Double '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'yield_with_self' Name.Function '\n ' Text 'with' Keyword ' ' Text 'self' Keyword ' ' Text 'yield' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Foo' Name '.' Operator 'new' Name '.' Operator 'yield_with_self' Name ' ' Text '{' Punctuation ' ' Text 'emphasize' Name '(' Punctuation '10' Literal.Number.Integer ')' Punctuation ' ' Text '}' Punctuation ' ' Text '# => "***10***"' Comment.Single '\n\n' Text '# This generates:' Comment.Single '\n' Text '#' Comment.Single '\n' Text '# def :foo' Comment.Single '\n' Text '# 1' Comment.Single '\n' Text '# end' Comment.Single '\n' Text 'define_method' Name ' ' Text ':foo' Literal.String.Symbol ',' Punctuation ' ' Text '1' Literal.Number.Integer '\n\n' Text 'macro' Keyword ' ' Text 'define_method' Name.Function '(' Punctuation 'name' Name ',' Punctuation ' ' Text 'content' Name ')' Punctuation '\n ' Text 'def' Keyword ' ' Text '{{' Literal.String.Interpol 'name' Name '.' Operator 'id' Name '}}' Literal.String.Interpol '\n ' Text '{{' Literal.String.Interpol 'content' Name '}}' Literal.String.Interpol '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text '# This correctly generates:' Comment.Single '\n' Text '#' Comment.Single '\n' Text '# def foo' Comment.Single '\n' Text '# 1' Comment.Single '\n' Text '# end' Comment.Single '\n' Text 'define_method' Name ' ' Text ':foo' Literal.String.Symbol ',' Punctuation ' ' Text '1' Literal.Number.Integer '\n\n' Text 'macro' Keyword ' ' Text 'define_method' Name.Function '(' Punctuation 'name' Name ',' Punctuation ' ' Text 'content' Name ')' Punctuation '\n ' Text 'def' Keyword ' ' Text '{{' Literal.String.Interpol 'name' Name '}}' Literal.String.Interpol '\n ' Text '{%' Literal.String.Interpol ' ' Text 'if' Keyword ' ' Text 'content' Name ' ' Text '==' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '%}' Literal.String.Interpol '\n ' Text '"' Literal.String.Double 'one' Literal.String.Double '"' Literal.String.Double '\n ' Text '{%' Literal.String.Interpol ' ' Text 'else' Keyword ' ' Text '%}' Literal.String.Interpol '\n ' Text '{{' Literal.String.Interpol 'content' Name '}}' Literal.String.Interpol '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'define_method' Name ' ' Text 'foo' Name ',' Punctuation ' ' Text '1' Literal.Number.Integer '\n' Text 'define_method' Name ' ' Text 'bar' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer '\n\n' Text 'foo' Name ' ' Text '# => one' Comment.Single '\n' Text 'bar' Name ' ' Text '# => 2' Comment.Single '\n\n' Text '{%' Literal.String.Interpol ' ' Text 'if' Keyword ' ' Text 'env' Name '(' Punctuation '"' Literal.String.Double 'TEST' Literal.String.Double '"' Literal.String.Double ')' Punctuation ' ' Text '%}' Literal.String.Interpol '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'We are in test mode' Literal.String.Double '"' Literal.String.Double '\n' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n\n' Text 'macro' Keyword ' ' Text 'define_dummy_methods' Name.Function '(' Punctuation 'names' Name ')' Punctuation '\n ' Text '{%' Literal.String.Interpol ' ' Text 'for' Keyword ' ' Text 'name' Name ',' Punctuation ' ' Text 'index' Name ' ' Text 'in' Keyword ' ' Text 'names' Name ' ' Text '%}' Literal.String.Interpol '\n ' Text 'def' Keyword ' ' Text '{{' Literal.String.Interpol 'name' Name '.' Operator 'id' Name '}}' Literal.String.Interpol '\n ' Text '{{' Literal.String.Interpol 'index' Name '}}' Literal.String.Interpol '\n ' Text 'end' Keyword '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n' Text 'end' Keyword '\n\n' Text 'define_dummy_methods' Name ' ' Text '[' Operator 'foo' Name ',' Punctuation ' ' Text 'bar' Name ',' Punctuation ' ' Text 'baz' Name ']' Operator '\n\n' Text 'foo' Name ' ' Text '# => 0' Comment.Single '\n' Text 'bar' Name ' ' Text '# => 1' Comment.Single '\n' Text 'baz' Name ' ' Text '# => 2' Comment.Single '\n\n' Text 'macro' Keyword ' ' Text 'define_dummy_methods' Name.Function '(' Punctuation 'hash' Name ')' Punctuation '\n ' Text '{%' Literal.String.Interpol ' ' Text 'for' Keyword ' ' Text 'key' Name ',' Punctuation ' ' Text 'value' Name ' ' Text 'in' Keyword ' ' Text 'hash' Name ' ' Text '%}' Literal.String.Interpol '\n ' Text 'def' Keyword ' ' Text '{{' Literal.String.Interpol 'key' Name '.' Operator 'id' Name '}}' Literal.String.Interpol '\n ' Text '{{' Literal.String.Interpol 'value' Name '}}' Literal.String.Interpol '\n ' Text 'end' Keyword '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n' Text 'end' Keyword '\n\n' Text 'define_dummy_methods' Name '(' Punctuation '{' Punctuation 'foo' Literal.String.Symbol ':' Punctuation ' ' Text '10' Literal.Number.Integer ',' Punctuation ' ' Text 'bar' Literal.String.Symbol ':' Punctuation ' ' Text '20' Literal.Number.Integer '}' Punctuation ')' Punctuation '\n' Text 'foo' Name ' ' Text '# => 10' Comment.Single '\n' Text 'bar' Name ' ' Text '# => 20' Comment.Single '\n\n' Text '{%' Literal.String.Interpol ' ' Text 'for' Keyword ' ' Text 'name' Name ',' Punctuation ' ' Text 'index' Name ' ' Text 'in' Keyword ' ' Text '[' Operator '"' Literal.String.Double 'foo' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '"' Literal.String.Double 'bar' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '"' Literal.String.Double 'baz' Literal.String.Double '"' Literal.String.Double ']' Operator ' ' Text '%}' Literal.String.Interpol '\n ' Text 'def' Keyword ' ' Text '{{' Literal.String.Interpol 'name' Name '.' Operator 'id' Name '}}' Literal.String.Interpol '\n ' Text '{{' Literal.String.Interpol 'index' Name '}}' Literal.String.Interpol '\n ' Text 'end' Keyword '\n' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n\n' Text 'foo' Name ' ' Text '# => 0' Comment.Single '\n' Text 'bar' Name ' ' Text '# => 1' Comment.Single '\n' Text 'baz' Name ' ' Text '# => 2' Comment.Single '\n\n' Text 'macro' Keyword ' ' Text 'define_dummy_methods' Name.Function '(' Punctuation '*' Operator 'names' Name ')' Punctuation '\n ' Text '{%' Literal.String.Interpol ' ' Text 'for' Keyword ' ' Text 'name' Name ',' Punctuation ' ' Text 'index' Name ' ' Text 'in' Keyword ' ' Text 'names' Name ' ' Text '%}' Literal.String.Interpol '\n ' Text 'def' Keyword ' ' Text '{{' Literal.String.Interpol 'name' Name '.' Operator 'id' Name '}}' Literal.String.Interpol '\n ' Text '{{' Literal.String.Interpol 'index' Name '}}' Literal.String.Interpol '\n ' Text 'end' Keyword '\n ' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n' Text 'end' Keyword '\n\n' Text 'define_dummy_methods' Name ' ' Text 'foo' Name ',' Punctuation ' ' Text 'bar' Name ',' Punctuation ' ' Text 'baz' Name '\n\n' Text 'foo' Name ' ' Text '# => 0' Comment.Single '\n' Text 'bar' Name ' ' Text '# => 1' Comment.Single '\n' Text 'baz' Name ' ' Text '# => 2' Comment.Single '\n\n' Text 'macro' Keyword ' ' Text 'println' Name.Function '(' Punctuation '*' Operator 'values' Name ')' Punctuation '\n ' Text 'print' Name.Builtin ' ' Text '{{' Literal.String.Interpol '*' Operator 'values' Name '}}' Literal.String.Interpol ',' Punctuation ' ' Text "'\\n'" Literal.String.Char '\n' Text 'end' Keyword '\n\n' Text 'println' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ' ' Text '# outputs 123\\n' Comment.Single '\n\n' Text 'VALUES' Name.Constant ' ' Text '=' Operator ' ' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator '\n\n' Text '{%' Literal.String.Interpol ' ' Text 'for' Keyword ' ' Text 'value' Name ' ' Text 'in' Keyword ' ' Text 'VALUES' Name.Constant ' ' Text '%}' Literal.String.Interpol '\n ' Text 'puts' Name.Builtin ' ' Text '{{' Literal.String.Interpol 'value' Name '}}' Literal.String.Interpol '\n' Text '{%' Literal.String.Interpol ' ' Text 'end' Keyword ' ' Text '%}' Literal.String.Interpol '\n\n' Text 'until' Keyword ' ' Text 'some_condition' Name '\n ' Text 'do_this' Name '\n' Text 'end' Keyword '\n\n' Text '# The above is the same as:' Comment.Single '\n' Text 'while' Keyword ' ' Text '!' Operator 'some_condition' Name '\n ' Text 'do_this' Name '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text 'some_condition' Name ' ' Text '?' Punctuation ' ' Text 'nil' Keyword.Constant ' ' Text ':' Punctuation ' ' Text '3' Literal.Number.Integer '\n' Text '# a is Int32 or Nil' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'a' Name '\n ' Text '# Since the only way to get here is if a is truthy,' Comment.Single '\n ' Text "# a can't be nil. So here a is Int32." Comment.Single '\n ' Text 'a' Name '.' Operator 'abs' Name '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text 'a' Name ' ' Text '=' Operator ' ' Text 'some_expression' Name '\n ' Text '# here a is not nil' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text 'a' Name ' ' Text '&&' Operator ' ' Text 'b' Name '\n ' Text '# here both a and b are guaranteed not to be Nil' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text '@a' Name.Variable.Instance '\n ' Text '# here @a can be nil' Comment.Single '\n' Text 'end' Keyword '\n\n' Text '# First option: assign it to a variable' Comment.Single '\n' Text 'if' Keyword ' ' Text 'a' Name ' ' Text '=' Operator ' ' Text '@a' Name.Variable.Instance '\n ' Text "# here a can't be nil" Comment.Single '\n' Text 'end' Keyword '\n\n' Text '# Second option: use `Object#try` found in the standard library' Comment.Single '\n' Text '@a' Name.Variable.Instance '.' Operator 'try' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'a' Name '|' Operator '\n ' Text "# here a can't be nil" Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text 'method' Name ' ' Text '# first call to a method that can return Int32 or Nil' Comment.Single '\n ' Text '# here we know that the first call did not return Nil' Comment.Single '\n ' Text 'method' Name ' ' Text '# second call can still return Int32 or Nil' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'become_older' Name.Function '(' Punctuation 'by' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ')' Punctuation '\n ' Text '@age' Name.Variable.Instance ' ' Text '+=' Operator ' ' Text 'by' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'john' Name '.' Operator 'age' Name ' ' Text '# => 0' Comment.Single '\n\n' Text 'john' Name '.' Operator 'become_older' Name '\n' Text 'john' Name '.' Operator 'age' Name ' ' Text '# => 1' Comment.Single '\n\n' Text 'john' Name '.' Operator 'become_older' Name ' ' Text '2' Literal.Number.Integer '\n' Text 'john' Name '.' Operator 'age' Name ' ' Text '# => 3' Comment.Single '\n\n' Text 'john' Name '.' Operator 'become_older' Name ' ' Text 'by' Literal.String.Symbol ':' Punctuation ' ' Text '5' Literal.Number.Integer '\n\n' Text 'def' Keyword ' ' Text 'some_method' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text 'z' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'w' Name ' ' Text '=' Operator ' ' Text '3' Literal.Number.Integer ')' Punctuation '\n ' Text '# do something...' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'some_method' Name ' ' Text '10' Literal.Number.Integer ' ' Text '# x = 10, y = 1, z = 2, w = 3' Comment.Single '\n' Text 'some_method' Name ' ' Text '10' Literal.Number.Integer ',' Punctuation ' ' Text 'z' Literal.String.Symbol ':' Punctuation ' ' Text '10' Literal.Number.Integer ' ' Text '# x = 10, y = 1, z = 10, w = 3' Comment.Single '\n' Text 'some_method' Name ' ' Text '10' Literal.Number.Integer ',' Punctuation ' ' Text 'w' Literal.String.Symbol ':' Punctuation ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text 'y' Literal.String.Symbol ':' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'z' Literal.String.Symbol ':' Punctuation ' ' Text '3' Literal.Number.Integer ' ' Text '# x = 10, y = 2, z = 3, w = 1' Comment.Single '\n\n' Text 'case' Keyword ' ' Text 'exp' Name '\n' Text 'when' Keyword ' ' Text 'value1' Name ',' Punctuation ' ' Text 'value2' Name '\n ' Text 'do_something' Name '\n' Text 'when' Keyword ' ' Text 'value3' Name '\n ' Text 'do_something_else' Name '\n' Text 'else' Keyword '\n ' Text 'do_another_thing' Name '\n' Text 'end' Keyword '\n\n' Text 'case' Keyword ' ' Text 'var' Name '\n' Text 'when' Keyword ' ' Text 'String' Name '\n ' Text '# var : String' Comment.Single '\n ' Text 'do_something' Name '\n' Text 'when' Keyword ' ' Text 'Int32' Name '\n ' Text '# var : Int32' Comment.Single '\n ' Text 'do_something_else' Name '\n' Text 'else' Keyword '\n ' Text '# here var is neither a String nor an Int32' Comment.Single '\n ' Text 'do_another_thing' Name '\n' Text 'end' Keyword '\n\n' Text 'case' Keyword ' ' Text 'num' Name '\n' Text 'when' Keyword ' ' Text '.' Operator 'even?' Name '\n ' Text 'do_something' Name '\n' Text 'when' Keyword ' ' Text '.' Operator 'odd?' Name '\n ' Text 'do_something_else' Name '\n' Text 'end' Keyword '\n\n' Text 'case' Keyword '\n' Text 'when' Keyword ' ' Text 'cond1' Name ',' Punctuation ' ' Text 'cond2' Name '\n ' Text 'do_something' Name '\n' Text 'when' Keyword ' ' Text 'cond3' Name '\n ' Text 'do_something_else' Name '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'a' Name '.responds_to?' Keyword.Pseudo '(' Punctuation ':abs' Literal.String.Symbol ')' Punctuation ' ' Text '# => true' Comment.Single '\n' Text 'a' Name '.responds_to?' Keyword.Pseudo '(' Punctuation ':size' Literal.String.Symbol ')' Punctuation ' ' Text '# => false' Comment.Single '\n\n' Text 'foo_or_bar' Name ' ' Text '=' Operator ' ' Text '/' Literal.String.Regex 'foo|bar' Literal.String.Regex '/' Literal.String.Regex '\n' Text 'heeello' Name ' ' Text '=' Operator ' ' Text '/' Literal.String.Regex 'h(e+)llo' Literal.String.Regex '/' Literal.String.Regex '\n' Text 'integer' Name ' ' Text '=' Operator ' ' Text '/' Literal.String.Regex '\\' Literal.String.Regex 'd+' Literal.String.Regex '/' Literal.String.Regex '\n\n' Text 'r' Name ' ' Text '=' Operator ' ' Text '/' Literal.String.Regex 'foo' Literal.String.Regex '/imx' Literal.String.Regex '\n\n' Text 'slash' Name ' ' Text '=' Operator ' ' Text '/' Literal.String.Regex '\\/' Literal.String.Regex '/' Literal.String.Regex '\n\n' Text 'r' Name ' ' Text '=' Operator ' ' Text '%r(' Literal.String.Regex 'regex with slash: /' Literal.String.Regex ')' Literal.String.Regex '\n\n' Text '"' Literal.String.Double 'hello world' Literal.String.Double '"' Literal.String.Double '\n\n' Text '"' Literal.String.Double '\\"' Literal.String.Escape '"' Literal.String.Double ' ' Text '# double quote' Comment.Single '\n' Text '"' Literal.String.Double '\\\\' Literal.String.Escape '"' Literal.String.Double ' ' Text '# backslash' Comment.Single '\n' Text '"' Literal.String.Double '\\e' Literal.String.Escape '"' Literal.String.Double ' ' Text '# escape' Comment.Single '\n' Text '"' Literal.String.Double '\\f' Literal.String.Escape '"' Literal.String.Double ' ' Text '# form feed' Comment.Single '\n' Text '"' Literal.String.Double '\\n' Literal.String.Escape '"' Literal.String.Double ' ' Text '# newline' Comment.Single '\n' Text '"' Literal.String.Double '\\r' Literal.String.Escape '"' Literal.String.Double ' ' Text '# carriage return' Comment.Single '\n' Text '"' Literal.String.Double '\\t' Literal.String.Escape '"' Literal.String.Double ' ' Text '# tab' Comment.Single '\n' Text '"' Literal.String.Double '\\v' Literal.String.Escape '"' Literal.String.Double ' ' Text '# vertical tab' Comment.Single '\n\n' Text '"' Literal.String.Double '\\101' Literal.String.Escape '"' Literal.String.Double ' ' Text '# == "A"' Comment.Single '\n' Text '"' Literal.String.Double '\\123' Literal.String.Escape '"' Literal.String.Double ' ' Text '# == "S"' Comment.Single '\n' Text '"' Literal.String.Double '\\12' Literal.String.Escape '"' Literal.String.Double ' ' Text '# == "\\n"' Comment.Single '\n' Text '"' Literal.String.Double '\\1' Literal.String.Escape '"' Literal.String.Double ' ' Text '# string with one character with code point 1' Comment.Single '\n\n' Text '"' Literal.String.Double '\\u0041' Literal.String.Escape '"' Literal.String.Double ' ' Text '# == "A"' Comment.Single '\n\n' Text '"' Literal.String.Double '\\u{41}' Literal.String.Escape '"' Literal.String.Double ' ' Text '# == "A"' Comment.Single '\n' Text '"' Literal.String.Double '\\u{1F52E}' Literal.String.Escape '"' Literal.String.Double '\n\n' Text '"' Literal.String.Double 'hello\n world' Literal.String.Double '"' Literal.String.Double ' ' Text '# same as "hello\\n world"' Comment.Single '\n\n' Text '"' Literal.String.Double 'hello ' Literal.String.Double '"' Literal.String.Double ' ' Text '\\' Punctuation '\n' Text '"' Literal.String.Double 'world, ' Literal.String.Double '"' Literal.String.Double ' ' Text '\\' Punctuation '\n' Text '"' Literal.String.Double 'no newlines' Literal.String.Double '"' Literal.String.Double ' ' Text '# same as "hello world, no newlines"' Comment.Single '\n\n' Text '"' Literal.String.Double 'hello ' Literal.String.Double '\\' Literal.String.Double '\n world, ' Literal.String.Double '\\' Literal.String.Double '\n no newlines' Literal.String.Double '"' Literal.String.Double ' ' Text '# same as "hello world, no newlines"' Comment.Single '\n\n' Text '%(' Literal.String.Other 'hello ' Literal.String.Other '(' Literal.String.Other '"world"' Literal.String.Other ')' Literal.String.Other ')' Literal.String.Other ' ' Text '# => "hello (\\"world\\")"' Comment.Single '\n' Text '%[' Literal.String.Other 'hello ' Literal.String.Other '[' Literal.String.Other '"world"' Literal.String.Other ']' Literal.String.Other ']' Literal.String.Other ' ' Text '# => "hello [\\"world\\"]"' Comment.Single '\n' Text '%{' Literal.String.Other 'hello ' Literal.String.Other '{' Literal.String.Other '"world"' Literal.String.Other '}' Literal.String.Other '}' Literal.String.Other ' ' Text '# => "hello {\\"world\\"}"' Comment.Single '\n' Text '%<' Literal.String.Other 'hello ' Literal.String.Other '<' Literal.String.Other '"world"' Literal.String.Other '>' Literal.String.Other '>' Literal.String.Other ' ' Text '# => "hello <\\"world\\">"' Comment.Single '\n' Text '%|' Literal.String.Other 'hello "world"' Literal.String.Other '|' Literal.String.Other ' ' Text '# => "hello \\"world\\""' Comment.Single '\n\n' Text '<<-' Operator '' Literal.String.Heredoc 'XML' Literal.String.Delimiter '' Literal.String.Heredoc '\n' Text '\n' Literal.String.Heredoc ' \n' Literal.String.Heredoc '\n' Literal.String.Heredoc 'XML\n' Literal.String.Delimiter '\n' Text '# Same as "Hello\\n world"' Comment.Single '\n' Text '<<-' Operator '' Literal.String.Heredoc 'STRING' Literal.String.Delimiter '' Literal.String.Heredoc '\n' Text ' Hello\n' Literal.String.Heredoc ' world\n' Literal.String.Heredoc ' STRING\n' Literal.String.Delimiter '\n' Text '# Same as " Hello\\n world"' Comment.Single '\n' Text '<<-' Operator '' Literal.String.Heredoc 'STRING' Literal.String.Delimiter '' Literal.String.Heredoc '\n' Text ' Hello\n' Literal.String.Heredoc ' world\n' Literal.String.Heredoc ' STRING\n' Literal.String.Delimiter '\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'b' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n' Text '"' Literal.String.Double 'sum = ' Literal.String.Double '#{' Literal.String.Interpol 'a' Name ' ' Text '+' Operator ' ' Text 'b' Name '}' Literal.String.Interpol '"' Literal.String.Double ' ' Text '# "sum = 3"' Comment.Single '\n\n' Text '1.0' Literal.Number.Float ' ' Text '# Float64' Comment.Single '\n' Text '1.0_f32' Literal.Number.Float ' ' Text '# Float32' Comment.Single '\n' Text '1_f32' Literal.Number.Float ' ' Text '# Float32' Comment.Single '\n\n' Text '1e10' Literal.Number.Float ' ' Text '# Float64' Comment.Single '\n' Text '1.5e10' Literal.Number.Float ' ' Text '# Float64' Comment.Single '\n' Text '1.5e-7' Literal.Number.Float ' ' Text '# Float64' Comment.Single '\n\n' Text '+' Operator '1.3' Literal.Number.Float ' ' Text '# Float64' Comment.Single '\n' Text '-' Operator '0.5' Literal.Number.Float ' ' Text '# Float64' Comment.Single '\n\n' Text '1_000_000.111_111' Literal.Number.Float ' ' Text '# better than 1000000.111111' Comment.Single '\n\n' Text "'a'" Literal.String.Char '\n' Text "'z'" Literal.String.Char '\n' Text "'0'" Literal.String.Char '\n' Text "'_'" Literal.String.Char '\n' Text '"' Literal.String.Double 'ã\x81‚' Literal.String.Double '"' Literal.String.Double '\n\n' Text "'\\''" Literal.String.Char ' ' Text '# single quote' Comment.Single '\n' Text "'\\\\'" Literal.String.Char ' ' Text '# backslash' Comment.Single '\n' Text "'\\e'" Literal.String.Char ' ' Text '# escape' Comment.Single '\n' Text "'\\f'" Literal.String.Char ' ' Text '# form feed' Comment.Single '\n' Text "'\\n'" Literal.String.Char ' ' Text '# newline' Comment.Single '\n' Text "'\\r'" Literal.String.Char ' ' Text '# carriage return' Comment.Single '\n' Text "'\\t'" Literal.String.Char ' ' Text '# tab' Comment.Single '\n' Text "'\\v'" Literal.String.Char ' ' Text '# vertical tab' Comment.Single '\n\n' Text '"' Literal.String.Double '\\101' Literal.String.Escape '"' Literal.String.Double ' ' Text "# == 'A'" Comment.Single '\n' Text '"' Literal.String.Double '\\123' Literal.String.Escape '"' Literal.String.Double ' ' Text "# == 'S'" Comment.Single '\n' Text '"' Literal.String.Double '\\12' Literal.String.Escape '"' Literal.String.Double ' ' Text "# == '\\n'" Comment.Single '\n' Text '"' Literal.String.Double '\\1' Literal.String.Escape '"' Literal.String.Double ' ' Text '# code point 1' Comment.Single '\n\n' Text "'\\u0041'" Literal.String.Char ' ' Text "# == 'A'" Comment.Single '\n\n' Text "'\\u{41}'" Literal.String.Char ' ' Text "# == 'A'" Comment.Single '\n' Text "'\\u{1F52E}'" Literal.String.Char '\n\n' Text '{' Punctuation '1' Literal.Number.Integer ' ' Text '=' Operator '>' Operator ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ' ' Text '=' Operator '>' Operator ' ' Text '4' Literal.Number.Integer '}' Punctuation ' ' Text '# Hash(Int32, Int32)' Comment.Single '\n' Text '{' Punctuation '1' Literal.Number.Integer ' ' Text '=' Operator '>' Operator ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text "'a'" Literal.String.Char ' ' Text '=' Operator '>' Operator ' ' Text '3' Literal.Number.Integer '}' Punctuation ' ' Text '# Hash(Int32 | Char, Int32)' Comment.Single '\n\n' Text '{' Punctuation '}' Punctuation ' ' Text 'of' Keyword ' ' Text 'Int32' Name ' ' Text '=' Operator '>' Operator ' ' Text 'Int32' Name ' ' Text '# same as Hash(Int32, Int32).new' Comment.Single '\n\n' Text '{' Punctuation 'key1' Literal.String.Symbol ':' Punctuation ' ' Text "'a'" Literal.String.Char ',' Punctuation ' ' Text 'key2' Literal.String.Symbol ':' Punctuation ' ' Text "'b'" Literal.String.Char '}' Punctuation ' ' Text '# Hash(Symbol, Char)' Comment.Single '\n\n' Text '{' Punctuation '"' Literal.String.Double 'key1' Literal.String.Double '"' Literal.String.Double ':' Punctuation ' ' Text "'a'" Literal.String.Char ',' Punctuation ' ' Text '"' Literal.String.Double 'key2' Literal.String.Double '"' Literal.String.Double ':' Punctuation ' ' Text "'b'" Literal.String.Char '}' Punctuation ' ' Text '# Hash(String, Char)' Comment.Single '\n\n' Text 'MyType' Name '{' Punctuation '"' Literal.String.Double 'foo' Literal.String.Double '"' Literal.String.Double ' ' Text '=' Operator '>' Operator ' ' Text '"' Literal.String.Double 'bar' Literal.String.Double '"' Literal.String.Double '}' Punctuation '\n\n' Text 'tmp' Name ' ' Text '=' Operator ' ' Text 'MyType' Name '.' Operator 'new' Name '\n' Text 'tmp' Name '[' Operator '"' Literal.String.Double 'foo' Literal.String.Double '"' Literal.String.Double ']' Operator ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'bar' Literal.String.Double '"' Literal.String.Double '\n' Text 'tmp' Name '\n\n' Text 'tmp' Name ' ' Text '=' Operator ' ' Text 'MyType' Name '(' Punctuation 'typeof' Keyword.Pseudo '(' Punctuation '"' Literal.String.Double 'foo' Literal.String.Double '"' Literal.String.Double ')' Punctuation ',' Punctuation ' ' Text 'typeof' Keyword.Pseudo '(' Punctuation '"' Literal.String.Double 'bar' Literal.String.Double '"' Literal.String.Double ')' Punctuation ')' Punctuation '.' Operator 'new' Name '\n' Text 'tmp' Name '[' Operator '"' Literal.String.Double 'foo' Literal.String.Double '"' Literal.String.Double ']' Operator ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'bar' Literal.String.Double '"' Literal.String.Double '\n' Text 'tmp' Name '\n\n' Text 'MyType' Name '(' Punctuation 'String' Name ',' Punctuation ' ' Text 'String' Name ')' Punctuation '{' Punctuation '"' Literal.String.Double 'foo' Literal.String.Double '"' Literal.String.Double ' ' Text '=' Operator '>' Operator ' ' Text '"' Literal.String.Double 'bar' Literal.String.Double '"' Literal.String.Double '}' Punctuation '\n\n' Text ':hello' Literal.String.Symbol '\n' Text ':good_bye' Literal.String.Symbol '\n\n' Text '# With spaces and symbols' Comment.Single '\n' Text ':"' Literal.String.Symbol 'symbol with spaces' Literal.String.Symbol '"' Literal.String.Symbol '\n\n' Text '# Ending with question and exclamation marks' Comment.Single '\n' Text ':question?' Literal.String.Symbol '\n' Text ':exclamation!' Literal.String.Symbol '\n\n' Text '# For the operators' Comment.Single '\n' Text ':+' Literal.String.Symbol '\n' Text ':-' Literal.String.Symbol '\n' Text ':*' Literal.String.Symbol '\n' Text ':/' Literal.String.Symbol '\n' Text ':==' Literal.String.Symbol '\n' Text ':<' Literal.String.Symbol '\n' Text ':<=' Literal.String.Symbol '\n' Text ':>' Literal.String.Symbol '\n' Text ':>=' Literal.String.Symbol '\n' Text ':!' Literal.String.Symbol '\n' Text ':!=' Literal.String.Symbol '\n' Text ':=~' Literal.String.Symbol '\n' Text ':!~' Literal.String.Symbol '\n' Text ':&' Literal.String.Symbol '\n' Text ':|' Literal.String.Symbol '\n' Text ':^' Literal.String.Symbol '\n' Text ':~' Literal.String.Symbol '\n' Text ':**' Literal.String.Symbol '\n' Text ':>>' Literal.String.Symbol '\n' Text ':<<' Literal.String.Symbol '\n' Text ':%' Literal.String.Symbol '\n' Text ':[]' Literal.String.Symbol '\n' Text ':[]?' Literal.String.Symbol '\n' Text ':[]=' Literal.String.Symbol '\n' Text ':<=>' Literal.String.Symbol '\n' Text ':===' Literal.String.Symbol '\n\n' Text 'x' Name '..' Operator 'y' Name ' ' Text '# an inclusive range, in mathematics: [x, y]' Comment.Single '\n' Text 'x' Name '...' Operator 'y' Name ' ' Text '# an exclusive range, in mathematics: [x, y)' Comment.Single '\n\n' Text '# A proc without arguments' Comment.Single '\n' Text '-' Operator '>' Operator '{' Punctuation ' ' Text '1' Literal.Number.Integer ' ' Text '}' Punctuation ' ' Text '# Proc(Int32)' Comment.Single '\n\n' Text '# A proc with one argument' Comment.Single '\n' Text '-' Operator '>' Operator '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text '{' Punctuation ' ' Text 'x' Name '.' Operator 'to_s' Name ' ' Text '}' Punctuation ' ' Text '# Proc(Int32, String)' Comment.Single '\n\n' Text '# A proc with two arguments:' Comment.Single '\n' Text '-' Operator '>' Operator '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ',' Punctuation ' ' Text 'y' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text '{' Punctuation ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name ' ' Text '}' Punctuation ' ' Text '# Proc(Int32, Int32, Int32)' Comment.Single '\n\n' Text 'Proc' Name '(' Punctuation 'Int32' Name ',' Punctuation ' ' Text 'String' Name ')' Punctuation '.' Operator 'new' Name ' ' Text '{' Punctuation ' ' Text '|' Operator 'x' Name '|' Operator ' ' Text 'x' Name '.' Operator 'to_s' Name ' ' Text '}' Punctuation ' ' Text '# Proc(Int32, String)' Comment.Single '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ',' Punctuation ' ' Text 'y' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation ' ' Text '{' Punctuation ' ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name ' ' Text '}' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ')' Punctuation ' ' Text '# => 3' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'one' Name.Function '\n ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator 'one' Name '\n' Text 'proc' Name '.' Operator 'call' Name ' ' Text '# => 1' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'plus_one' Name.Function '(' Punctuation 'x' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator 'plus_one' Name '(' Punctuation 'Int32' Name ')' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation '41' Literal.Number.Integer ')' Punctuation ' ' Text '# => 42' Comment.Single '\n\n' Text 'str' Name ' ' Text '=' Operator ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text '-' Operator '>' Operator 'str' Name '.' Operator 'count' Name '(' Punctuation 'Char' Name ')' Punctuation '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation "'e'" Literal.String.Char ')' Punctuation ' ' Text '# => 1' Comment.Single '\n' Text 'proc' Name '.' Operator 'call' Name '(' Punctuation "'l'" Literal.String.Char ')' Punctuation ' ' Text '# => 2' Comment.Single '\n\n' Text 'tuple' Name ' ' Text '=' Operator ' ' Text '{' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text "'x'" Literal.String.Char '}' Punctuation ' ' Text '# Tuple(Int32, String, Char)' Comment.Single '\n' Text 'tuple' Name '[' Operator '0' Literal.Number.Integer ']' Operator ' ' Text '# => 1 (Int32)' Comment.Single '\n' Text 'tuple' Name '[' Operator '1' Literal.Number.Integer ']' Operator ' ' Text '# => "hello" (String)' Comment.Single '\n' Text 'tuple' Name '[' Operator '2' Literal.Number.Integer ']' Operator ' ' Text "# => 'x' (Char)" Comment.Single '\n\n' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ']' Operator ' ' Text '# Array(Int32)' Comment.Single '\n' Text '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text "'x'" Literal.String.Char ']' Operator ' ' Text '# Array(Int32 | String | Char)' Comment.Single '\n\n' Text '[' Operator ']' Operator ' ' Text 'of' Keyword ' ' Text 'Int32' Name ' ' Text '# same as Array(Int32).new' Comment.Single '\n\n' Text '%w(' Literal.String.Other 'one two three' Literal.String.Other ')' Literal.String.Other ' ' Text '# ["one", "two", "three"]' Comment.Single '\n\n' Text '%i(' Literal.String.Other 'one two three' Literal.String.Other ')' Literal.String.Other ' ' Text '# [:one, :two, :three]' Comment.Single '\n\n' Text 'MyType' Name '{' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer '}' Punctuation '\n\n' Text 'tmp' Name ' ' Text '=' Operator ' ' Text 'MyType' Name '.' Operator 'new' Name '\n' Text 'tmp' Name ' ' Text '<<' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'tmp' Name ' ' Text '<<' Operator ' ' Text '2' Literal.Number.Integer '\n' Text 'tmp' Name ' ' Text '<<' Operator ' ' Text '3' Literal.Number.Integer '\n' Text 'tmp' Name '\n\n' Text 'tmp' Name ' ' Text '=' Operator ' ' Text 'MyType' Name '(' Punctuation 'typeof' Keyword.Pseudo '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ')' Punctuation ')' Punctuation '.' Operator 'new' Name '\n' Text 'tmp' Name ' ' Text '<<' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'tmp' Name ' ' Text '<<' Operator ' ' Text '2' Literal.Number.Integer '\n' Text 'tmp' Name ' ' Text '<<' Operator ' ' Text '3' Literal.Number.Integer '\n' Text 'tmp' Name '\n\n' Text 'MyType' Name '(' Punctuation 'Int32' Name ' ' Text '|' Operator ' ' Text 'String' Name ')' Punctuation '{' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '"' Literal.String.Double 'foo' Literal.String.Double '"' Literal.String.Double '}' Punctuation '\n\n' Text 'nil' Keyword.Constant '\n\n' Text '1' Literal.Number.Integer ' ' Text '# Int32' Comment.Single '\n\n' Text '1_i8' Literal.Number.Integer ' ' Text '# Int8' Comment.Single '\n' Text '1_i16' Literal.Number.Integer ' ' Text '# Int16' Comment.Single '\n' Text '1_i32' Literal.Number.Integer ' ' Text '# Int32' Comment.Single '\n' Text '1_i64' Literal.Number.Integer ' ' Text '# Int64' Comment.Single '\n\n' Text '1_u8' Literal.Number.Integer ' ' Text '# UInt8' Comment.Single '\n' Text '1_u16' Literal.Number.Integer ' ' Text '# UInt16' Comment.Single '\n' Text '1_u32' Literal.Number.Integer ' ' Text '# UInt32' Comment.Single '\n' Text '1_u64' Literal.Number.Integer ' ' Text '# UInt64' Comment.Single '\n\n' Text '+' Operator '10' Literal.Number.Integer ' ' Text '# Int32' Comment.Single '\n' Text '-' Operator '20' Literal.Number.Integer ' ' Text '# Int32' Comment.Single '\n\n' Text '2147483648' Literal.Number.Integer ' ' Text '# Int64' Comment.Single '\n' Text '9223372036854775808' Literal.Number.Integer ' ' Text '# UInt64' Comment.Single '\n\n' Text '1_000_000' Literal.Number.Integer ' ' Text '# better than 1000000' Comment.Single '\n\n' Text '0b1101' Literal.Number.Bin ' ' Text '# == 13' Comment.Single '\n\n' Text '0o123' Literal.Number.Oct ' ' Text '# == 83' Comment.Single '\n\n' Text '0xFE012D' Literal.Number.Hex ' ' Text '# == 16646445' Comment.Single '\n' Text '0xfe012d' Literal.Number.Hex ' ' Text '# == 16646445' Comment.Single '\n\n' Text 'true' Keyword.Constant ' ' Text '# A Bool that is true' Comment.Single '\n' Text 'false' Keyword.Constant ' ' Text '# A Bool that is false' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n\n' Text 'ptr' Name ' ' Text '=' Operator ' ' Text 'pointerof' Keyword.Pseudo '(' Punctuation 'a' Name ')' Punctuation '\n' Text 'ptr' Name '.' Operator 'value' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n\n' Text 'a' Name ' ' Text '# => 2' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Point' Name.Class '\n ' Text 'def' Keyword ' ' Text 'initialize' Name.Function '(' Punctuation '@x' Name.Variable.Instance ',' Punctuation ' ' Text '@y' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'x' Name.Function '\n ' Text '@x' Name.Variable.Instance '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'x_ptr' Name.Function '\n ' Text 'pointerof' Keyword.Pseudo '(' Punctuation '@x' Name.Variable.Instance ')' Punctuation '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'point' Name ' ' Text '=' Operator ' ' Text 'Point' Name '.' Operator 'new' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer '\n\n' Text 'ptr' Name ' ' Text '=' Operator ' ' Text 'point' Name '.' Operator 'x_ptr' Name '\n' Text 'ptr' Name '.' Operator 'value' Name ' ' Text '=' Operator ' ' Text '10' Literal.Number.Integer '\n\n' Text 'point' Name '.' Operator 'x' Name ' ' Text '# => 10' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'add' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Number' Name ',' Punctuation ' ' Text 'y' Name ' ' Text ':' Punctuation ' ' Text 'Number' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text '# Ok' Comment.Single '\n' Text 'add' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ' ' Text '# Ok' Comment.Single '\n\n' Text "# Error: no overload matches 'add' with types Bool, Bool" Comment.Single '\n' Text 'add' Name ' ' Text 'true' Keyword.Constant ',' Punctuation ' ' Text 'false' Keyword.Constant '\n\n' Text 'def' Keyword ' ' Text 'add' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text 'add' Name ' ' Text 'true' Keyword.Constant ',' Punctuation ' ' Text 'false' Keyword.Constant '\n\n' Text "# A class that has a + method but isn't a Number" Comment.Single '\n' Text 'class' Keyword ' ' Text 'Six' Name.Class '\n ' Text 'def' Keyword ' ' Text '+' Name.Function '(' Punctuation 'other' Name ')' Punctuation '\n ' Text '6' Literal.Number.Integer ' ' Text '+' Operator ' ' Text 'other' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text '# add method without type restrictions' Comment.Single '\n' Text 'def' Keyword ' ' Text 'add' Name.Function '(' Punctuation 'x' Name ',' Punctuation ' ' Text 'y' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text '# OK' Comment.Single '\n' Text 'add' Name ' ' Text 'Six' Name '.' Operator 'new' Name ',' Punctuation ' ' Text '10' Literal.Number.Integer '\n\n' Text '# add method with type restrictions' Comment.Single '\n' Text 'def' Keyword ' ' Text 'restricted_add' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Number' Name ',' Punctuation ' ' Text 'y' Name ' ' Text ':' Punctuation ' ' Text 'Number' Name ')' Punctuation '\n ' Text 'x' Name ' ' Text '+' Operator ' ' Text 'y' Name '\n' Text 'end' Keyword '\n\n' Text "# Error: no overload matches 'restricted_add' with types Six, Int32" Comment.Single '\n' Text 'restricted_add' Name ' ' Text 'Six' Name '.' Operator 'new' Name ',' Punctuation ' ' Text '10' Literal.Number.Integer '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text '==' Name.Function '(' Punctuation 'other' Name ' ' Text ':' Punctuation ' ' Text 'self' Keyword ')' Punctuation '\n ' Text 'other' Name '.' Operator 'name' Name ' ' Text '==' Operator ' ' Text 'name' Name '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text '==' Name.Function '(' Punctuation 'other' Name ')' Punctuation '\n ' Text 'false' Keyword.Constant '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'another_john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'peter' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'Peter' Literal.String.Double '"' Literal.String.Double '\n\n' Text 'john' Name ' ' Text '==' Operator ' ' Text 'another_john' Name ' ' Text '# => true' Comment.Single '\n' Text 'john' Name ' ' Text '==' Operator ' ' Text 'peter' Name ' ' Text '# => false (names differ)' Comment.Single '\n' Text 'john' Name ' ' Text '==' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '# => false (because 1 is not a Person)' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'def' Keyword ' ' Text 'self' Name.Class '.' Operator 'compare' Name.Function '(' Punctuation 'p1' Name ' ' Text ':' Punctuation ' ' Text 'self' Keyword ',' Punctuation ' ' Text 'p2' Name ' ' Text ':' Punctuation ' ' Text 'self' Keyword ')' Punctuation '\n ' Text 'p1' Name '.' Operator 'name' Name ' ' Text '==' Operator ' ' Text 'p2' Name '.' Operator 'name' Name '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'john' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n' Text 'peter' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'Peter' Literal.String.Double '"' Literal.String.Double '\n\n' Text 'Person' Name '.' Operator 'compare' Name '(' Punctuation 'john' Name ',' Punctuation ' ' Text 'peter' Name ')' Punctuation ' ' Text '# OK' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'foo' Name ' ' Text '1' Literal.Number.Integer ' ' Text '# OK' Comment.Single '\n' Text 'foo' Name ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '# Error' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '.' Operator 'class' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'foo' Name ' ' Text 'Int32' Name ' ' Text '# OK' Comment.Single '\n' Text 'foo' Name ' ' Text 'String' Name ' ' Text '# Error' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name '.' Operator 'class' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got Int32' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'String' Name '.' Operator 'class' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Got String' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'foo' Name ' ' Text 'Int32' Name ' ' Text '# prints "Got Int32"' Comment.Single '\n' Text 'foo' Name ' ' Text 'String' Name ' ' Text '# prints "Got String"' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation '*' Operator 'args' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation '*' Operator 'args' Name ' ' Text ':' Punctuation ' ' Text 'String' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'foo' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ' ' Text '# OK, invokes first overload' Comment.Single '\n' Text 'foo' Name ' ' Text '"' Literal.String.Double 'a' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '"' Literal.String.Double 'b' Literal.String.Double '"' Literal.String.Double ',' Punctuation ' ' Text '"' Literal.String.Double 'c' Literal.String.Double '"' Literal.String.Double ' ' Text '# OK, invokes second overload' Comment.Single '\n' Text 'foo' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '# Error' Comment.Single '\n' Text 'foo' Name '(' Punctuation ')' Punctuation ' ' Text '# Error' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '\n ' Text '# This is the empty-tuple case' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'T' Name ')' Punctuation '\n ' Text 'T' Name '\n' Text 'end' Keyword '\n\n' Text 'foo' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ' ' Text '# => Int32' Comment.Single '\n' Text 'foo' Name '(' Punctuation '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ')' Punctuation ' ' Text '# => String' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'Array' Name '(' Punctuation 'T' Name ')' Punctuation ')' Punctuation '\n ' Text 'T' Name '\n' Text 'end' Keyword '\n\n' Text 'foo' Name '(' Punctuation '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ']' Operator ')' Punctuation ' ' Text '# => Int32' Comment.Single '\n' Text 'foo' Name '(' Punctuation '[' Operator '1' Literal.Number.Integer ',' Punctuation ' ' Text '"' Literal.String.Double 'a' Literal.String.Double '"' Literal.String.Double ']' Operator ')' Punctuation ' ' Text '# => (Int32 | String)' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '(' Punctuation 'x' Name ' ' Text ':' Punctuation ' ' Text 'T' Name '.' Operator 'class' Name ')' Punctuation '\n ' Text 'Array' Name '(' Punctuation 'T' Name ')' Punctuation '\n' Text 'end' Keyword '\n\n' Text 'foo' Name '(' Punctuation 'Int32' Name ')' Punctuation ' ' Text '# => Array(Int32)' Comment.Single '\n' Text 'foo' Name '(' Punctuation 'String' Name ')' Punctuation ' ' Text '# => Array(String)' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text '# Increases age by one' Comment.Single '\n ' Text 'def' Keyword ' ' Text 'become_older' Name.Function '\n ' Text '@age' Name.Variable.Instance ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer '\n ' Text 'end' Keyword '\n\n ' Text '# Increases age by the given number of years' Comment.Single '\n ' Text 'def' Keyword ' ' Text 'become_older' Name.Function '(' Punctuation 'years' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ')' Punctuation '\n ' Text '@age' Name.Variable.Instance ' ' Text '+=' Operator ' ' Text 'years' Name '\n ' Text 'end' Keyword '\n\n ' Text '# Increases age by the given number of years, as a String' Comment.Single '\n ' Text 'def' Keyword ' ' Text 'become_older' Name.Function '(' Punctuation 'years' Name ' ' Text ':' Punctuation ' ' Text 'String' Name ')' Punctuation '\n ' Text '@age' Name.Variable.Instance ' ' Text '+=' Operator ' ' Text 'years' Name '.' Operator 'to_i' Name '\n ' Text 'end' Keyword '\n\n ' Text '# Yields the current age of this person and increases' Comment.Single '\n ' Text '# its age by the value returned by the block' Comment.Single '\n ' Text 'def' Keyword ' ' Text 'become_older' Name.Function '\n ' Text '@age' Name.Variable.Instance ' ' Text '+=' Operator ' ' Text 'yield' Keyword ' ' Text '@age' Name.Variable.Instance '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'person' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'John' Literal.String.Double '"' Literal.String.Double '\n\n' Text 'person' Name '.' Operator 'become_older' Name '\n' Text 'person' Name '.' Operator 'age' Name ' ' Text '# => 1' Comment.Single '\n\n' Text 'person' Name '.' Operator 'become_older' Name ' ' Text '5' Literal.Number.Integer '\n' Text 'person' Name '.' Operator 'age' Name ' ' Text '# => 6' Comment.Single '\n\n' Text 'person' Name '.' Operator 'become_older' Name ' ' Text '"' Literal.String.Double '12' Literal.String.Double '"' Literal.String.Double '\n' Text 'person' Name '.' Operator 'age' Name ' ' Text '# => 18' Comment.Single '\n\n' Text 'person' Name '.' Operator 'become_older' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'current_age' Name '|' Operator '\n ' Text 'current_age' Name ' ' Text '<' Operator ' ' Text '20' Literal.Number.Integer ' ' Text '?' Operator ' ' Text '10' Literal.Number.Integer ' ' Text ':' Punctuation ' ' Text '30' Literal.Number.Integer '\n' Text 'end' Keyword '\n' Text 'person' Name '.' Operator 'age' Name ' ' Text '# => 28' Comment.Single '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text 'a' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'Int32' Name ')' Punctuation ' ' Text '# => true' Comment.Single '\n' Text 'a' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'String' Name ')' Punctuation ' ' Text '# => false' Comment.Single '\n' Text 'a' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'Number' Name ')' Punctuation ' ' Text '# => true' Comment.Single '\n' Text 'a' Name '.is_a?' Keyword.Pseudo '(' Punctuation 'Int32' Name ' ' Text '|' Operator ' ' Text 'String' Name ')' Punctuation ' ' Text '# => true' Comment.Single '\n\n' Text '# One for each thread' Comment.Single '\n' Text '@[' Operator 'ThreadLocal' Name.Decorator ']' Operator '\n' Text 'values' Name ' ' Text '=' Operator ' ' Text '[' Operator ']' Operator ' ' Text 'of' Keyword ' ' Text 'Int32' Name '\n\n' Text '@[' Operator 'AlwaysInline' Name.Decorator ']' Operator '\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '\n ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text '@[' Operator 'NoInline' Name.Decorator ']' Operator '\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '\n ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'lib' Keyword ' ' Text 'LibFoo' Name.Namespace '\n ' Text '@[' Operator 'CallConvention' Name.Decorator '(' Punctuation '"' Literal.String.Double 'X86_StdCall' Literal.String.Double '"' Literal.String.Double ')' Punctuation ']' Operator '\n ' Text 'fun' Keyword ' ' Text 'foo' Name.Function ' ' Text ':' Punctuation ' ' Text 'Int32' Name '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'sum' Name.Function '(' Punctuation '*' Operator 'elements' Name ')' Punctuation '\n ' Text 'total' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer '\n ' Text 'elements' Name '.' Operator 'each' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'value' Name '|' Operator '\n ' Text 'total' Name ' ' Text '+=' Operator ' ' Text 'value' Name '\n ' Text 'end' Keyword '\n ' Text 'total' Name '\n' Text 'end' Keyword '\n\n' Text '# elements is Tuple(Int32, Int32, Int32, Float64)' Comment.Single '\n' Text 'sum' Name ' ' Text '1' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text '3' Literal.Number.Integer ',' Punctuation ' ' Text '4.5' Literal.Number.Float '\n\n' Text 'if' Keyword ' ' Text 'a' Name '.responds_to?' Keyword.Pseudo '(' Punctuation ':abs' Literal.String.Symbol ')' Punctuation '\n ' Text "# here a's type will be reduced to those responding to the 'abs' method" Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text 'some_condition' Name ' ' Text '?' Punctuation ' ' Text '1' Literal.Number.Integer ' ' Text ':' Punctuation ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n' Text '# a : Int32 | String' Comment.Single '\n\n' Text 'if' Keyword ' ' Text 'a' Name '.responds_to?' Keyword.Pseudo '(' Punctuation ':abs' Literal.String.Symbol ')' Punctuation '\n ' Text "# here a will be Int32, since Int32#abs exists but String#abs doesn't" Comment.Single '\n' Text 'else' Keyword '\n ' Text '# here a will be String' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'if' Keyword ' ' Text '(' Punctuation 'a' Name ' ' Text '=' Operator ' ' Text '@a' Name.Variable.Instance ')' Punctuation '.responds_to?' Keyword.Pseudo '(' Punctuation ':abs' Literal.String.Symbol ')' Punctuation '\n ' Text '# here a is guaranteed to respond to `abs`' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'capture' Name.Function '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'invoke' Name.Function '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text 'block' Name '.' Operator 'call' Name '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'capture' Name ' ' Text '{' Punctuation ' ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n' Text 'invoke' Name '(' Punctuation '&' Operator 'proc' Name ')' Punctuation ' ' Text '# prints "Hello"' Comment.Single '\n\n' Text 'def' Keyword ' ' Text 'capture' Name.Function '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text 'block' Name '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'twice' Name.Function '\n ' Text 'yield' Keyword '\n ' Text 'yield' Keyword '\n' Text 'end' Keyword '\n\n' Text 'proc' Name ' ' Text '=' Operator ' ' Text 'capture' Name ' ' Text '{' Punctuation ' ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n' Text 'twice' Name ' ' Text '&' Operator 'proc' Name '\n\n' Text 'twice' Name ' ' Text '&' Operator '-' Operator '>' Operator '{' Punctuation ' ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello' Literal.String.Double '"' Literal.String.Double ' ' Text '}' Punctuation '\n\n' Text 'def' Keyword ' ' Text 'say_hello' Name.Function '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'twice' Name ' ' Text '&' Operator '-' Operator '>' Operator 'say_hello' Name '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'wrap_foo' Name.Function '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Before foo' Literal.String.Double '"' Literal.String.Double '\n ' Text 'foo' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'x' Name '|' Operator '\n ' Text 'yield' Keyword ' ' Text 'x' Name '\n ' Text 'end' Keyword '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'After foo' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'wrap_foo' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text 'i' Name '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'foo' Name.Function '\n ' Text 'yield' Keyword ' ' Text '1' Literal.Number.Integer '\n' Text 'end' Keyword '\n\n' Text 'def' Keyword ' ' Text 'wrap_foo' Name.Function '(' Punctuation '&' Operator 'block' Name ' ' Text ':' Punctuation ' ' Text 'Int32' Name ' ' Text '-' Operator '>' Operator ' ' Text '_' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Before foo' Literal.String.Double '"' Literal.String.Double '\n ' Text 'foo' Name '(' Punctuation '&' Operator 'block' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'After foo' Literal.String.Double '"' Literal.String.Double '\n' Text 'end' Keyword '\n\n' Text 'wrap_foo' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'puts' Name.Builtin ' ' Text 'i' Name '\n' Text 'end' Keyword '\n\n' Text 'foo_forward' Name ' ' Text 'do' Keyword ' ' Text '|' Operator 'i' Name '|' Operator '\n ' Text 'break' Keyword ' ' Text '# error' Comment.Single '\n' Text 'end' Keyword '\n\n' Text 'a' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer '\n' Text 'while' Keyword ' ' Text '(' Punctuation 'a' Name ' ' Text '+=' Operator ' ' Text '1' Literal.Number.Integer ')' Punctuation ' ' Text '<' Operator ' ' Text '20' Literal.Number.Integer '\n ' Text 'if' Keyword ' ' Text 'a' Name ' ' Text '==' Operator ' ' Text '10' Literal.Number.Integer '\n ' Text "# goes to 'puts a'" Comment.Single '\n ' Text 'break' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n' Text 'puts' Name.Builtin ' ' Text 'a' Name ' ' Text '# => 10' Comment.Single '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'private' Keyword ' ' Text 'def' Keyword ' ' Text 'say' Name.Function '(' Punctuation 'message' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text 'message' Name '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'say_hello' Name.Function '\n ' Text 'say' Name ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '# OK, no receiver' Comment.Single '\n ' Text 'self' Keyword '.' Operator 'say' Name ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '# Error, self is a receiver' Comment.Single '\n\n ' Text 'other' Name ' ' Text '=' Operator ' ' Text 'Person' Name '.' Operator 'new' Name ' ' Text '"' Literal.String.Double 'Other' Literal.String.Double '"' Literal.String.Double '\n ' Text 'other' Name '.' Operator 'say' Name ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double ' ' Text '# Error, other is a receiver' Comment.Single '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'class' Keyword ' ' Text 'Employee' Name.Class ' ' Text '<' Operator ' ' Text 'Person' Name '\n ' Text 'def' Keyword ' ' Text 'say_bye' Name.Function '\n ' Text 'say' Name ' ' Text '"' Literal.String.Double 'bye' Literal.String.Double '"' Literal.String.Double ' ' Text '# OK' Comment.Single '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'module' Keyword ' ' Text 'Namespace' Name.Namespace '\n ' Text 'class' Keyword ' ' Text 'Foo' Name.Class '\n ' Text 'protected' Keyword ' ' Text 'def' Keyword ' ' Text 'foo' Name.Function '\n ' Text 'puts' Name.Builtin ' ' Text '"' Literal.String.Double 'Hello' Literal.String.Double '"' Literal.String.Double '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n\n ' Text 'class' Keyword ' ' Text 'Bar' Name.Class '\n ' Text 'def' Keyword ' ' Text 'bar' Name.Function '\n ' Text '# Works, because Foo and Bar are under Namespace' Comment.Single '\n ' Text 'Foo' Name '.' Operator 'new' Name '.' Operator 'foo' Name '\n ' Text 'end' Keyword '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'Namespace' Name '::' Operator 'Bar' Name '.' Operator 'new' Name '.' Operator 'bar' Name '\n\n' Text 'class' Keyword ' ' Text 'Person' Name.Class '\n ' Text 'protected' Keyword ' ' Text 'def' Keyword ' ' Text 'self' Name.Class '.' Operator 'say' Name.Function '(' Punctuation 'message' Name ')' Punctuation '\n ' Text 'puts' Name.Builtin ' ' Text 'message' Name '\n ' Text 'end' Keyword '\n\n ' Text 'def' Keyword ' ' Text 'say_hello' Name.Function '\n ' Text 'Person' Name '.' Operator 'say' Name ' ' Text '"' Literal.String.Double 'hello' Literal.String.Double '"' Literal.String.Double '\n ' Text 'end' Keyword '\n' Text 'end' Keyword '\n\n' Text 'buffer' Name ' ' Text '=' Operator ' ' Text 'uninitialized' Keyword.Pseudo ' ' Text 'UInt8' Name '[' Operator '256' Literal.Number.Integer ']' Operator '\n\n' Text 'foo' Name ' ' Text '=' Operator ' ' Text 'rand' Name.Builtin '(' Punctuation '5' Literal.Number.Integer ')' Punctuation ' ' Text '>' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '?' Operator ' ' Text '1' Literal.Number.Integer ' ' Text ':' Punctuation ' ' Text 'nil' Keyword.Constant '\n\n' Text 'foo' Name '.' Operator 'not_nil!' Name '.' Operator 'to_i' Name '\n' Text