class OracleSqlParser::Grammar::ReservedWordGenerator::KeywordRule
Attributes
keyword[R]
Public Class Methods
new(keyword)
click to toggle source
# File lib/oracle-sql-parser/grammar/reserved_word_generator.rb, line 13 def initialize(keyword) @keyword = keyword end
Public Instance Methods
matcher()
click to toggle source
# File lib/oracle-sql-parser/grammar/reserved_word_generator.rb, line 33 def matcher matcher = [] keyword.each_char do |ch| if ch.match(/[A-Z]/) matcher << "[#{ch.downcase}#{ch.upcase}]" else matcher << "'#{ch}'" end end matcher << '( ![A-Za-z0-9] )' matcher.join(' ') end
rule_name()
click to toggle source
# File lib/oracle-sql-parser/grammar/reserved_word_generator.rb, line 29 def rule_name "#{@keyword.downcase}_keyword" end
to_s()
click to toggle source
# File lib/oracle-sql-parser/grammar/reserved_word_generator.rb, line 17 def to_s content = [] content << " rule #{rule_name}" content << " #{matcher} {" content << " def ast" content << " OracleSqlParser::Ast::Keyword.new(:name => text_value)" content << " end" content << " }" content << " end" content.join("\n") end