Changeset b34530c60d70d0477f7a08eec79f7f24188eee49

Show
Ignore:
Timestamp:
06/10/2008 09:41:51 AM (2 months ago)
Author:
mitchell <mitchell@frost.(none)>
git-committer:
mitchell <mitchell@frost.(none)> 1213116111 -0400
git-parent:

[678401c3f101b8679ac04892e5623b79da6feb7c]

git-author:
mitchell <mitchell@frost.(none)> 1213116111 -0400
Message:

Added Lua entity machine.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ext/ohcount_native/ragel_parsers/lua.rl

    r42afa2b rb34530c  
    103103 
    104104  action lua_ecallback { 
    105     callback(LUA_LANG, entity, cint(ts), cint(te)); 
     105    callback(LUA_LANG, lua_entities[entity], cint(ts), cint(te)); 
    106106  } 
    107107 
    108   lua_entity := 'TODO:'; 
     108  lua_block_comment_entity = 
     109    '--[' >lua_long_ec_res '='* $lua_long_ec_inc '[' any* 
     110    :>> (']' '='* $lua_long_ec_dec ']' when { equal_count == 0 }); 
     111  lua_line_comment_entity = '--' (nonnewline)*; 
     112  lua_comment_entity = lua_block_comment_entity | lua_line_comment_entity; 
     113 
     114  lua_string_entity = sq_str_with_escapes | dq_str_with_escapes; 
     115 
     116  lua_integer = '-'? (dec_num | hex_num); 
     117  lua_number_entity = float | lua_integer; 
     118 
     119  lua_keyword_entity = 
     120    'and' | 'break' | 'do' | 'else' | 'elseif' | 'end' | 'false' | 'for' | 
     121    'function' | 'if' | 'in' | 'local' | 'nil' | 'not' | 'or' | 'repeat' | 
     122    'return' | 'then' | 'true' | 'until' | 'while'; 
     123 
     124  lua_identifier_entity = (alpha | '_') alnum*; 
     125 
     126  lua_operator_entity = '~=' | [+\-*/%^#=<>;:,.{}\[\]()]; 
     127 
     128  lua_entity := |* 
     129    space+                ${ entity = LUA_SPACE;      } => lua_ecallback; 
     130    lua_comment_entity    ${ entity = LUA_COMMENT;    } => lua_ecallback; 
     131    lua_string_entity     ${ entity = LUA_STRING;     } => lua_ecallback; 
     132    lua_number_entity     ${ entity = LUA_NUMBER;     } => lua_ecallback; 
     133    lua_identifier_entity ${ entity = LUA_IDENTIFIER; } => lua_ecallback; 
     134    lua_keyword_entity    ${ entity = LUA_KEYWORD;    } => lua_ecallback; 
     135    lua_operator_entity   ${ entity = LUA_OPERATOR;   } => lua_ecallback; 
     136    ^space                ${ entity = LUA_ANY;        } => lua_ecallback; 
     137  *|; 
    109138}%% 
    110139