class Gettext::PluralForm::Scanner
- Gettext::PluralForm::Scanner
- Reference
- Object
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.crConstructors
-
.new(source : String)
Creates a new scanner instance with the given source
Instance Method Summary
-
#scan
Tokenizes the subset of C's grammar needed for parsing plural-forms
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);")
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)