• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 9307175333

30 May 2024 06:08PM UTC coverage: 70.644% (-3.5%) from 74.124%
9307175333

push

github

web-flow
Merge b18390e74 into 70ff5c335

1910 of 2592 new or added lines in 108 files covered. (73.69%)

901 existing lines in 52 files now uncovered.

12203 of 17274 relevant lines covered (70.64%)

6112.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/languages/my.lua
1
local function charclass (u)
2
   if (u >= 0x1000 and u <= 0x102A) or u == 0x104E or u == 0x25CC or u == 0x2d then
×
3
      return "CI"
×
4
   end
5
   if u == 0x1039 then
×
6
      return "VI"
×
7
   end
8
   if u >= 0x103B and u <= 0x103E then
×
9
      return "ME"
×
10
   end
11
   if u == 0x1031 then
×
12
      return "EV"
×
13
   end
14
   if u == 0x102F or u == 0x1030 then
×
15
      return "LV"
×
16
   end
17
   if u == 0x102D or u == 0x102E or u == 0x1032 then
×
18
      return "UV"
×
19
   end
20
   if u == 0x102C or u == 0x102B then -- 0x102b added by SC because it was splitting visargas
×
21
      return "AV"
×
22
   end
23
   if u == 0x1036 then
×
24
      return "AN"
×
25
   end
26
   if u == 0x103A then
×
27
      return "KI"
×
28
   end
29
   if u == 0x1037 then
×
30
      return "LD"
×
31
   end
32
   if u == 0x1038 then
×
33
      return "VG"
×
34
   end
35
   if u >= 0x1040 and u <= 0x1049 then
×
36
      return "MD"
×
37
   end
38
   if u == 0x104A or u == 0x104B or u == 0x2c or u == 0x2e or u == 0x3a or u == 0x3b then
×
39
      return "SE"
×
40
   end
41
   if u == 0x104C or u == 0x104D or u == 0x104F then
×
42
      return "VS"
×
43
   end
44
   if u >= 0x1050 and u <= 0x1055 then
×
45
      return "PL"
×
46
   end
47
   if u >= 0x1056 and u <= 0x1059 then
×
48
      return "PV"
×
49
   end
50
   if u == 0x20 or (u >= 0x2000 and u <= 0x200b) then
×
51
      return "SP"
×
52
   end
53
   if u == 0x28 or u == 0x5b or u == 0x7b or u == 0xab or u == 0x2018 or u == 0x201C or u == 0x2039 then
×
54
      return "LQ"
×
55
   end
56
   if u == 0x29 or u == 0x5d or u == 0x7d or u == 0xbb or u == 0x2019 or u == 0x201d or u == 0x203a then
×
57
      return "RQ"
×
58
   end
59
   if u == 0x200c then
×
60
      return "NJ"
×
61
   end
62
   if u == 0x2060 or u == 0x200d then
×
63
      return "WJ"
×
64
   end
65
   return "OT"
×
66
end
67

68
-- "Syllable Based Dual Weight Algorithm for Line Breaking in Myanmar Unicode"
69
-- Keith Stribley, http://thanlwinsoft.github.io/www.thanlwinsoft.org/ThanLwinSoft/MyanmarUnicode/Parsing/my2weightLineBreakAlg1_1.pdf
NEW
70
local p2 = SILE.types.node.penalty({ penalty = -25 })
×
NEW
71
local p1 = SILE.types.node.penalty({ penalty = -50 })
×
72

73
local penaltyFor = function (ca, cb)
74
   if ca == "WJ" or ca == "LQ" then
×
75
      return
×
76
   end
77
   if cb == "RQ" or cb == "WJ" then
×
78
      return
×
79
   end
80
   if ca == "OT" then
×
81
      return p1
×
82
   end
83
   if ca == "RQ" then
×
84
      return p2
×
85
   end
86
   if cb == "LQ" then
×
87
      return p2
×
88
   end
89

90
   if cb == "CI" then
×
91
      if ca == "AN" or ca == "KI" or ca == "LD" or ca == "VG" or ca == "PL" or ca == "PV" or ca == "RQ" then
×
92
         return p2
×
93
      end
94
      if ca == "MD" or ca == "SE" or ca == "VS" or ca == "SP" then
×
95
         return p1
×
96
      end
97
      return
×
98
   end
99
   if ca == "MD" and not (cb == "VI" or cb == "MD") then
×
100
      return p1
×
101
   end
102
   if cb == "PL" then
×
103
      if ca == "VI" then
×
104
         return
×
105
      end
106
      if ca == "SE" or ca == "VB" then
×
107
         return p1
×
108
      end
109
      return p2
×
110
   end
111
end
112

113
SILE.tokenizers.my = function (string)
×
114
   return coroutine.wrap(function ()
×
115
      local lastclass = ""
×
116
      local collection = ""
×
117
      for uchar in string.gmatch(string, "([%z\1-\127\194-\244][\128-\191]*)") do
×
118
         local thiscp = SU.codepoint(uchar)
×
119
         local thisclass = charclass(thiscp)
×
120
         if thisclass == "SP" then
×
121
            coroutine.yield({ separator = uchar })
×
122
         else
123
            local pen = penaltyFor(lastclass, thisclass)
×
124
            if pen then
×
125
               coroutine.yield({ node = pen })
×
126
               coroutine.yield({ string = collection })
×
127
               collection = ""
×
128
            end
129
            collection = collection .. uchar
×
130
         end
131
         lastclass = thisclass
×
132
      end
133
      coroutine.yield({ string = collection })
×
134
   end)
135
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc