class Gettext::PluralForm::Scanner

Overview

A scanner to tokenize a subset of C's grammar

Based on https://www.craftinginterpreters.com/scanning.html

Defined in:

backend/gettext/plural-forms/lexer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(source : String) #

Creates a new scanner instance with the given source

plural_form_scanner = Gettext::PluralForm::Scanner.new("nplurals=2; plural=(n > 1);")

[View source]

Instance Method Detail

def scan #

Tokenizes the subset of C's grammar needed for parsing plural-forms

plural_form_scanner = Gettext::PluralForm::Scanner.new("nplurals=2; plural=(n > 1);")
tokens = plural_form_scanner.scan # => Array(Tokens)

[View source]