module Crycco

Overview

In Crystal it's good to use modules to namespace the code. Specially since Crycco also works as a library!

You can add it to a project and use it by adding it as a dependency in shard.yml

dependencies:
  crycco:
    github: ralsina/crycco

And then in your code just require "crycco" and use it. I intend to do it in my Nicolino project.

For an example of how to use it, you can look at the process method at the end of this file.

Extended Modules

Defined in:

collection.cr
crycco.cr

Constant Summary

LANGUAGES = Hash(String, Language).new
NOT_COMMENT = /(^#!|^\s*#\{)/

This matches shebangs and things that only LOOK like comments, such as string interpolations.

VERSION = {{ (`shards version /srv/crystaldoc.info/github-ralsina-crycco-v0.3.1/src`).chomp.stringify }}

Class Method Summary

Class Method Detail

def self.load_languages(file : String | Nil) #

The description of how to parse a language is stored in a YAML file which we read here in Crycco.load_languages. If no file is given it defaults to the embedded one.

The match regex is used to detect if a line is a comment or code.


[View source]