class

Gettext::PluralForm::Scanner

Inherits Reference / Object

A scanner to tokenize a subset of C's grammar

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

Constructors

new(source : String)

Creates a new scanner instance with the given source

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

Instance methods

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)
Source