//Language: Ruby


// tokens
Token=tnone
Token=trbstring
Token=trbcomment
Token=trbident
Token=trbglobal
Token=trbinstance
Token=trbclassvar
Token=trbinteger
Token=trbfloat
Token=trbresword
Token=trbsymbol
Token=turl
Token=twhitespace


// states
State=srbnormal
State=srbglobal
State=srbinstance
State=srbclassvar
State=srbstring1
State=srbstring2
State=srbstring3
State=srbcomment1
State=srbcomment2

//delims
Delimiters=;.,:'"{}[]()?!@#$%^&*-+=|\/

// reswords
srbnormal 'BEGIN'     srbnormal trbresword
srbnormal 'END'       srbnormal trbresword
srbnormal 'alias'     srbnormal trbresword
srbnormal 'and'       srbnormal trbresword
srbnormal 'begin'     srbnormal trbresword
srbnormal 'break'     srbnormal trbresword
srbnormal 'case'      srbnormal trbresword
srbnormal 'class'     srbnormal trbresword
srbnormal 'def'       srbnormal trbresword
srbnormal 'defined'   srbnormal trbresword
srbnormal 'do'        srbnormal trbresword
srbnormal 'else'      srbnormal trbresword
srbnormal 'elsif'     srbnormal trbresword
srbnormal 'end'       srbnormal trbresword
srbnormal 'ensure'    srbnormal trbresword
srbnormal 'for'       srbnormal trbresword
srbnormal 'if'        srbnormal trbresword
srbnormal 'in'        srbnormal trbresword
srbnormal 'module'    srbnormal trbresword
srbnormal 'next'      srbnormal trbresword
srbnormal 'nil'       srbnormal trbresword
srbnormal 'not'       srbnormal trbresword
srbnormal 'or'        srbnormal trbresword
srbnormal 'redo'      srbnormal trbresword
srbnormal 'rescue'    srbnormal trbresword
srbnormal 'retry'     srbnormal trbresword
srbnormal 'return'    srbnormal trbresword
srbnormal 'self'      srbnormal trbresword
srbnormal 'super'     srbnormal trbresword
srbnormal 'then'      srbnormal trbresword
srbnormal 'undef'     srbnormal trbresword
srbnormal 'unless'    srbnormal trbresword
srbnormal 'until'     srbnormal trbresword
srbnormal 'when'      srbnormal trbresword
srbnormal 'while'     srbnormal trbresword
srbnormal 'yield'     srbnormal trbresword
srbnormal 'FALSE'     srbnormal trbresword
srbnormal 'TRUE'      srbnormal trbresword

// numbers
srbnormal [0-9][0-9]*                            srbnormal trbinteger
srbnormal 0b[0-9]+                               srbnormal trbinteger
srbnormal 0x[0-9A-F]+                            srbnormal trbinteger
srbnormal [0-9][0-9]*\.[0-9]*                    srbnormal trbfloat
srbnormal [0-9][0-9]*{\.[0-9]+}|e{[\+\-]}|[0-9]+ srbnormal trbfloat

//idents
srbnormal   [a-zA-Z][a-z_A-Z0-9]*  srbnormal   trbident

// global variables
srbnormal \$[a-z_A-Z][a-z_A-Z0-9\.]*    srbnormal    trbglobal

// instance variables
srbnormal @[a-z_A-Z][a-z_A-Z0-9\.]*     srbnormal     trbinstance

// class variables
srbnormal @@[a-z_A-Z][a-z_A-Z0-9\.]*  srbnormal     trbclassvar

//white space
//srbnormal #32*                      srbnormal   twhitespace

//symbols  (must be before heredoc)
srbnormal  [=<>()\[\]\{\}\.\\/?&!,:;|~^+\-\*]     srbnormal     trbsymbol

//comments
srbnormal    \#                       srbcomment1 trbcomment
srbcomment1  .*                       srbnormal   trbcomment
srbcomment1 $                         srbnormal   trbcomment

srbnormal    =begin      srbcomment2  trbcomment
srbcomment2     [^=]*    srbcomment2  trbcomment
srbcomment2     =[^e]    srbcomment2  trbcomment
srbcomment2     =end     srbnormal    trbcomment

//heredoc
srbnormal <<<EO[A-Z]$             srbstring3   tphpstring
srbstring3  .*$                 srbstring3   trbstring
srbstring3  ^EO[A-Z];$          srbnormal      trbstring
srbstring3  ^EO[A-Z]$           srbnormal      trbstring

//strings
srbnormal  \'                   srbstring1   trbstring
srbstring1  [^\']*              srbstring1   trbstring
srbstring1  \'                  srbnormal    trbstring
srbstring1  \'\'                srbstring1   trbstring
srbstring1   \\\\               srbstring1   trbstring
srbstring1   \\\'               srbstring1   trbstring
srbstring1   \\[^\\]            srbstring1   trbstring

srbnormal  \"                   srbstring2   trbstring
srbstring2  [^\"]*              srbstring2   trbstring
srbstring2  \"                  srbnormal    trbstring
srbstring2  \"\"                srbstring2   trbstring
srbstring2   \\\\               srbstring2   trbstring
srbstring2   \\\"               srbstring2   trbstring
srbstring2   \\[^\\]            srbstring2   trbstring

 
 
