class Gettext::PluralForm::Parser
- Gettext::PluralForm::Parser
- Lens::Base::Parser(Gettext::PluralForm::Token, Gettext::PluralForm::TokenTypes, Gettext::PluralForm::Scanner)
- Reference
- Object
Overview
Parser for generating plural-form expression ASTs out of an array of tokens
Based on this parser from crafting interpreters
Defined in:
backend/gettext/plural-forms/parser.crConstructors
-
.new(source : String)
Creates a new parser instance from the given array of tokens
Instance Method Summary
-
#parse
Parse an array of tokens into abstract syntax trees that represents a plural-form expression (C)
Instance methods inherited from class Lens::Base::Parser(Gettext::PluralForm::Token, Gettext::PluralForm::TokenTypes, Gettext::PluralForm::Scanner)
parse
parse
Constructor methods inherited from class Lens::Base::Parser(Gettext::PluralForm::Token, Gettext::PluralForm::TokenTypes, Gettext::PluralForm::Scanner)
new(source : String)
new
Constructor Detail
Instance Method Detail
def parse
#
Parse an array of tokens into abstract syntax trees that represents a plural-form expression (C)
plural_form_scanner = Gettext::PluralForm::Scanner.new("nplurals=2; plural=(n > 1);")
tokens = plural_form_scanner.scan
plural_form_parser = Gettext::PluralForm::Parser.new(tokens)
plural_form_parser.parse # => Array(Expressions)