class Rouge::Lexers::J

def self.control_words

def self.control_words
  @control_words ||= Set.new %w(
    assert break case catch catchd catcht continue do else elseif end
    fcase for if return select throw try while whilst
  )
end

def self.control_words_id

def self.control_words_id
  @control_words_id ||= Set.new %w(for goto label)
end

def self.inflection_list

https://code.jsoftware.com/wiki/NuVoc
def self.inflection_list
  @inflection_list ||= ['', '.', ':', '..', '.:', ':.', '::']
end

def self.primitive(char, inflection)

def self.primitive(char, inflection)
  i = inflection_list.index(inflection) or return Error
  token_map[primitive_table[char][i]]
end

def self.primitive_table

def self.primitive_table
  @primitive_table ||= Hash.new([:name]).tap do |h|
    {
      '()' => [:other],
      '=' => [:verb, :other, :other],
      '<>+-*%$|,#' => [:verb, :verb, :verb],
      '^' => [:verb, :verb, :modifier],
      '~"' => [:modifier, :verb, :verb],
      '.:@' => [:modifier, :modifier, :modifier],
      ';' => [:verb, :modifier, :verb],
      '!' => [:verb, :modifier, :modifier],
      '/\\' => [:modifier, :modifier, :verb],
      '[' => [:verb, nil, :verb],
      ']' => [:verb],
      '{' => [:verb, :verb, :verb, nil, nil, nil, :verb],
      '}' => [:modifier, :verb, :verb, nil, nil, nil, :modifier],
      '`' => [:modifier, nil, :modifier],
      '&' => [:modifier, :modifier, :modifier, nil, :modifier],
      '?' => [:verb, :verb],
      'a' => [:name, :noun, :noun],
      'ACeEIjorv' => [:name, :verb],
      'bdfHMT' => [:name, :modifier],
      'Dt' => [:name, :modifier, :modifier],
      'F' => [:name, :modifier, :modifier, :modifier, :modifier,
              :modifier, :modifier],
      'iu' => [:name, :verb, :verb],
      'L' => [:name, :verb, :modifier],
      'mny' => [:param],
      'p' => [:name, :verb, :verb, :verb],
      'qsZ' => [:name, nil, :verb],
      'S' => [:name, nil, :modifier],
      'u' => [:param, :verb, :verb],
      'v' => [:param, :verb],
      'x' => [:param, nil, :verb],
    }.each {|k, v| k.each_char {|c| h[c] = v } }
  end
end

def self.token_map

https://code.jsoftware.com/wiki/Vocabulary/PartsOfSpeech
def self.token_map
  @token_map ||= {
    noun: Keyword::Constant,
    verb: Name::Function,
    modifier: Operator,
    name: Name,
    param: Name::Builtin::Pseudo,
    other: Punctuation,
    nil => Error,
  }
end