Class: CodeRay::Scanners::Lua

Inherits:
Scanner
  • Object
show all
Defined in:
lib/coderay/scanners/lua.rb

Overview

Scanner for the Lua programming lanuage.

The language’s complete syntax is defined in the Lua manual, which is what this scanner tries to conform to.

Constant Summary collapse

KEYWORDS =

Keywords used in Lua.

%w[and break do else elseif end
  for function goto if in
  local not or repeat return
  then until while
]
PREDEFINED_CONSTANTS =

Constants set by the Lua core.

%w[false true nil]
PREDEFINED_EXPRESSIONS =

The expressions contained in this array are parts of Lua’s ‘basic’ library. Although it’s not entirely necessary to load that library, it is highly recommended and one would have to provide own implementations of some of these expressions if one does not do so. They however aren’t keywords, neither are they constants, but nearly predefined, so they get tagged as ‘predefined’ rather than anything else.

This list excludes values of form ‘_UPPERCASE’ because the Lua manual requires such identifiers to be reserved by Lua anyway and they are highlighted directly accordingly, without the need for specific identifiers to be listed here.

%w[
  assert collectgarbage dofile error getmetatable
  ipairs load loadfile next pairs pcall print
  rawequal rawget rawlen rawset select setmetatable
  tonumber tostring type xpcall
]
IDENT_KIND =

Automatic token kind selection for normal words.

CodeRay::WordList.new(:ident).
add(KEYWORDS, :keyword).
add(PREDEFINED_CONSTANTS, :predefined_constant).
add(PREDEFINED_EXPRESSIONS, :predefined)

Constants inherited from Scanner

Scanner::DEFAULT_OPTIONS, Scanner::KINDS_NOT_LOC, Scanner::ScanError

Instance Attribute Summary

Attributes inherited from Scanner

#state

Attributes included from Plugin

#plugin_id

Method Summary

Methods inherited from Scanner

#binary_string, #column, #each, encoding, file_extension, #file_extension, #initialize, #lang, lang, #line, normalize, #reset, #string=, #tokenize, #tokens

Methods included from Plugin

#aliases, #plugin_host, #register_for, #title

Constructor Details

This class inherits a constructor from CodeRay::Scanners::Scanner