From 13ac3fdc6fa5330c9eacc6ac9be92a869ab8d3be Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 14 Feb 2016 15:08:30 +0100 Subject: optional push state (return nil) --- lib/coderay/scanners/lua2.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/coderay/scanners') diff --git a/lib/coderay/scanners/lua2.rb b/lib/coderay/scanners/lua2.rb index 4b99a44..8426834 100644 --- a/lib/coderay/scanners/lua2.rb +++ b/lib/coderay/scanners/lua2.rb @@ -66,17 +66,15 @@ module Scanners on %r/::\s*[a-zA-Z_][a-zA-Z0-9_]+\s*::/, :label # ::goto_label:: on %r/_[A-Z]+/, :predefined # _UPPERCASE are names reserved for Lua on check_if { |brace_depth| brace_depth > 0 }, %r/([a-zA-Z_][a-zA-Z0-9_]*) (\s+)?(=)/x, groups(:key, :space, :operator) - on %r/[a-zA-Z_][a-zA-Z0-9_]*/, kind { |match| IDENT_KIND[match] }, push_state { |match, kind, state| # Normal letters (or letters followed by digits) + on %r/[a-zA-Z_][a-zA-Z0-9_]*/, kind { |match| IDENT_KIND[match] }, push_state { |match, kind| # Normal letters (or letters followed by digits) # Extra highlighting for entities following certain keywords if kind == :keyword && match == 'function' - state = :function_expected + :function_expected elsif kind == :keyword && match == 'goto' - state = :goto_label_expected + :goto_label_expected elsif kind == :keyword && match == 'local' - state = :local_var_expected + :local_var_expected end - - state } on %r/\{/, push(:map), kind { |brace_depth| brace_depth > 0 ? :inline_delimiter : :delimiter }, increment(:brace_depth) # Opening table brace { -- cgit v1.2.1