# liblouis: Russian translation table for program sources
#
# -----------
#-index-name: Russian, for program sources
#-display-name: Russian braille for program sources
#
#+language:ru
#+type:literary
#+contraction:no
#+grade:0
#+variant:for-source-code
#
# TODO: Please add a reference to official documentation about
# the implemented braille code. Preferably submit the documents
# to https://github.com/liblouis/braille-specs.
# -----------
#
# Copyright (C) 2013 Igor B. Poretsky <poretsky@mlbox.ru>
#
# This file is part of liblouis.
#
# liblouis is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1 of
# the License, or (at your option) any later version.
#
# liblouis is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with liblouis. If not, see
# <http://www.gnu.org/licenses/>.

# This table is not a computer braille in usual sense.
# It is intended for producing printable braille representation
# of a program source text, especially when it contains
# Russian comments or literals. Use it as an alternative
# literary braille table.

# Display and character definitions:
include ru-letters.dis

# Character definitions for unicode cyrillic letters.
# All dot-patterns have dot 9 set to make them distinguishable from the latins.
# Dot 7 indicates uppercase letters.

lowercase \x0430 19
lowercase \x0431 129
lowercase \x0432 24569
lowercase \x0433 12459
lowercase \x0434 1459
lowercase \x0435 159
lowercase \x0436 2459
lowercase \x0437 13569
lowercase \x0438 249
lowercase \x0439 123469
lowercase \x043A 139
lowercase \x043B 1239
lowercase \x043C 1349
lowercase \x043D 13459
lowercase \x043E 1359
lowercase \x043F 12349
lowercase \x0440 12359
lowercase \x0441 2349
lowercase \x0442 23459
lowercase \x0443 1369
lowercase \x0444 1249
lowercase \x0445 1259
lowercase \x0446 149
lowercase \x0447 123459
lowercase \x0448 1569
lowercase \x0449 13469
lowercase \x044A 123569
lowercase \x044B 23469
lowercase \x044C 234569
lowercase \x044D 2469
lowercase \x044E 12569
lowercase \x044F 12469
lowercase \x0451 169

# Uppercase letters
base uppercase \x0401 \x0451
base uppercase \x0410 \x0430
base uppercase \x0411 \x0431
base uppercase \x0412 \x0432
base uppercase \x0413 \x0433
base uppercase \x0414 \x0434
base uppercase \x0415 \x0435
base uppercase \x0416 \x0436
base uppercase \x0417 \x0437
base uppercase \x0418 \x0438
base uppercase \x0419 \x0439
base uppercase \x041A \x043A
base uppercase \x041B \x043B
base uppercase \x041C \x043C
base uppercase \x041D \x043D
base uppercase \x041E \x043E
base uppercase \x041F \x043F
base uppercase \x0420 \x0440
base uppercase \x0421 \x0441
base uppercase \x0422 \x0442
base uppercase \x0423 \x0443
base uppercase \x0424 \x0444
base uppercase \x0425 \x0445
base uppercase \x0426 \x0446
base uppercase \x0427 \x0447
base uppercase \x0428 \x0448
base uppercase \x0429 \x0449
base uppercase \x042A \x044A
base uppercase \x042B \x044B
base uppercase \x042C \x044C
base uppercase \x042D \x044D
base uppercase \x042E \x044E
base uppercase \x042F \x044F

# Uppercase letters in computer braille mode
comp6 \x0401 1679
comp6 \x0410 179
comp6 \x0411 1279
comp6 \x0412 245679
comp6 \x0413 124579
comp6 \x0414 14579
comp6 \x0415 1579
comp6 \x0416 24579
comp6 \x0417 135679
comp6 \x0418 2479
comp6 \x0419 1234679
comp6 \x041A 1379
comp6 \x041B 12379
comp6 \x041C 13479
comp6 \x041D 134579
comp6 \x041E 13579
comp6 \x041F 123479
comp6 \x0420 123579
comp6 \x0421 23479
comp6 \x0422 234579
comp6 \x0423 13679
comp6 \x0424 12479
comp6 \x0425 12579
comp6 \x0426 1479
comp6 \x0427 1234579
comp6 \x0428 15679
comp6 \x0429 134679
comp6 \x042A 1235679
comp6 \x042B 234679
comp6 \x042C 2345679
comp6 \x042D 24679
comp6 \x042E 125679
comp6 \x042F 124679
nofor always \x0401 1679
nofor always \x0410 179
nofor always \x0411 1279
nofor always \x0412 245679
nofor always \x0413 124579
nofor always \x0414 14579
nofor always \x0415 1579
nofor always \x0416 24579
nofor always \x0417 135679
nofor always \x0418 2479
nofor always \x0419 1234679
nofor always \x041A 1379
nofor always \x041B 12379
nofor always \x041C 13479
nofor always \x041D 134579
nofor always \x041E 13579
nofor always \x041F 123479
nofor always \x0420 123579
nofor always \x0421 23479
nofor always \x0422 234579
nofor always \x0423 13679
nofor always \x0424 12479
nofor always \x0425 12579
nofor always \x0426 1479
nofor always \x0427 1234579
nofor always \x0428 15679
nofor always \x0429 134679
nofor always \x042A 1235679
nofor always \x042B 234679
nofor always \x042C 2345679
nofor always \x042D 24679
nofor always \x042E 125679
nofor always \x042F 124679

# English character definitions
include en-chardefs.cti

# Braille indicators:
numsign 3456  number sign, just a dots operand
capsletter 46
begcapsword 56
endcapsword 6

# The decimal digits:
include litdigits6Dots.uti

# Punctuations:
decpoint . 256
prepunc " 236
postpunc " 356
hyphen - 36
noback always . 256
noback always , 2
always ; 6-23
noback always : 25
always ? 6-26
always ! 6-235
noback always ' 3
noback always ` 4

# Special symbols:
always @ 4-1
always # 4-1345
always $ 4-145
always % 3456-356
always ^ 56-26
always & 6-12346
noback always * 23
noback always ( 126
noback always ) 345
always _ 6-25
noback always [ 12356
noback always ] 23456
always { 46-126
always } 46-345
always \\ 4-16
always | 456-3
noback always ~ 26

# mathematical symbols:
noback always - 36
noback always + 235
always / 6-34
always < 4-246
always > 4-135
noback always = 2356

# Symbol classes for special rules below:
attribute upperlatin ABCDEFGHIJKLMNOPQRSTUVWXYZ
attribute lowerlatin abcdefghijklmnopqrstuvwxyz
attribute uppercyrillic \x0401\x0410\x0411\x0412\x0413\x0414\x0415\x0416\x0417\x0418\x0419\x041A\x041B\x041C\x041D\x041E\x041F\x0420\x0421\x0422\x0423\x0424\x0425\x0426\x0427\x0428\x0429\x042A\x042B\x042C\x042D\x042E\x042F
attribute lowercyrillic \x0430\x0431\x0432\x0433\x0434\x0435\x0436\x0437\x0438\x0439\x043A\x043B\x043C\x043D\x043E\x043F\x0440\x0441\x0442\x0443\x0444\x0445\x0446\x0447\x0448\x0449\x044A\x044B\x044C\x044D\x044E\x044F\x0451

attribute latin ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
attribute cyrillic \x0401\x0410\x0411\x0412\x0413\x0414\x0415\x0416\x0417\x0418\x0419\x041A\x041B\x041C\x041D\x041E\x041F\x0420\x0421\x0422\x0423\x0424\x0425\x0426\x0427\x0428\x0429\x042A\x042B\x042C\x042D\x042E\x042F\x0430\x0431\x0432\x0433\x0434\x0435\x0436\x0437\x0438\x0439\x043A\x043B\x043C\x043D\x043E\x043F\x0440\x0441\x0442\x0443\x0444\x0445\x0446\x0447\x0448\x0449\x044A\x044B\x044C\x044D\x044E\x044F\x0451

swapcd updigit 1234567890 1,12,14,145,15,124,1245,125,24,245

# Mark letters immediately following digits.
noback context [$d]%lowerlatin %updigit@6
noback context [$d]%lowercyrillic %updigit@5
noback context [$d"."]%lowerlatin %updigit@256@6
noback context [$d"."]%lowercyrillic %updigit@256@5

# Fix cyrillic letter marks.
noback pass2 [@46]%cyrillic @45
noback pass2 [@56]%cyrillic @456
noback pass2 [@6]%cyrillic @5
