Skip to content

Commit

Permalink
fix some ruby warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gfx committed Jun 10, 2017
1 parent 4a642bd commit 4a9e3c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/elixir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Elixir < RegexLexer
rule /#.*$/, Comment::Single
rule %r{\b(case|cond|end|bc|lc|if|unless|try|loop|receive|fn|defmodule|
defp?|defprotocol|defimpl|defrecord|defmacrop?|defdelegate|
defexception|exit|raise|throw|unless|after|rescue|catch|else)\b(?![?!])|
defexception|exit|raise|throw|after|rescue|catch|else)\b(?![?!])|
(?<!\.)\b(do|\-\>)\b}x, Keyword
rule /\b(import|require|use|recur|quote|unquote|super|refer)\b(?![?!])/, Keyword::Namespace
rule /(?<!\.)\b(and|not|or|when|xor|in)\b/, Operator::Word
Expand Down
6 changes: 3 additions & 3 deletions lib/rouge/lexers/praat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def self.analyze_text(text)
push :comma_list
end

rule /[\s\n]/, Text, :pop!
rule /[\s]/, Text, :pop!
end

state :procedure_call do
Expand All @@ -175,7 +175,7 @@ def self.analyze_text(text)
rule /(:|\s*\()/, Punctuation, :pop!

rule /'/, Name::Function
rule /[^:\('\n\s]+/, Name::Function
rule /[^:\('\s]+/, Name::Function

rule /(?=\s+)/ do
token Text
Expand All @@ -187,7 +187,7 @@ def self.analyze_text(text)
state :procedure_definition do
rule /(:|\s*\()/, Punctuation, :pop!

rule /[^:\(\n\s]+/, Name::Function
rule /[^:\(\s]+/, Name::Function

rule /(\s+)/, Text, :pop!
end
Expand Down
3 changes: 2 additions & 1 deletion lib/rouge/regex_lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def initialize(name, &defn)
@name = name
@defn = defn
@rules = []
@loaded = false
end

def to_state(lexer_class)
Expand Down Expand Up @@ -300,7 +301,7 @@ def step(state, stream)
# the most common, for now...
next if rule.beginning_of_line && !stream.beginning_of_line?

if size = stream.skip(rule.re)
if (size = stream.skip(rule.re))
puts " got #{stream[0].inspect}" if @debug

instance_exec(stream, &rule.callback)
Expand Down

0 comments on commit 4a9e3c9

Please sign in to comment.