Skip to content

Commit 9d1f778

Browse files
committed
update-tables: Improve char width table parsing
Make the script used to parse EastAsianWidth more robust, mapping ambiguous width characters to double-width ones.
1 parent 1b91aa9 commit 9d1f778

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ jobs:
1414
strategy:
1515
matrix:
1616
lua:
17-
- "lua 5.1"
18-
- "lua 5.2"
19-
- "lua 5.3"
20-
- "lua 5.4"
21-
- "luajit 2.0"
22-
- "luajit 2.1"
17+
- "5.1"
18+
- "5.2"
19+
- "5.3"
20+
- "5.4"
21+
- "5.5"
22+
- "luajit-2.0"
23+
- "luajit-2.1"
2324
steps:
2425
- name: Checkout
2526
uses: actions/checkout@v6
@@ -30,20 +31,23 @@ jobs:
3031
.lua/
3132
.luarocks/
3233
key: ${{ runner.os }}-${{ matrix.lua }}-${{ hashFiles('.github/workflows/build.yml') }}
34+
- name: Setup Lua
35+
uses: leafo/gh-actions-lua@v12
36+
if: steps.cache.outputs.cache-hit != 'true'
37+
with:
38+
luaVersion: ${{ matrix.lua }}
39+
- name: Setup LuaRocks
40+
- uses: leafo/gh-actions-luarocks@v6
3341
- name: Dependencies
3442
run: |-
3543
sudo apt install -y libreadline-dev
36-
pip install hererocks
37-
hererocks env --${{ matrix.lua }} -rlatest
38-
source env/bin/activate
3944
luarocks install --only-deps $(find luarocks -name '*-scm-*.rockspec' | sort -g | tail -1)
4045
luarocks install dromozoa-utf8
4146
luarocks install cluacov
4247
luarocks install busted
4348
luarocks install luacov-coveralls
4449
- name: Test
4550
run: |-
46-
source env/bin/activate
4751
timeout 120 busted -c
4852
- name: Coverage Report
4953
run: |

update-tables

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,21 @@ wide_table () {
7575
local tmpfile="${TMPDIR:-/tmp}/update-tables-$$-${RANDOM}"
7676
echo "-- Autogenerated from ${WIDE_FILE##*/}"
7777
echo 'return {'
78-
while read -r item rest ; do
79-
if [[ -z ${item} || ${item} = \#* ]] ; then
78+
while read -r line ; do
79+
if [[ -z ${line} || ${line} = \#* ]] ; then
80+
read -r line rest <<< "${line}"
8081
if [[ ${rest} = *.txt ]] ; then
8182
WIDE_VER=${rest}
8283
elif [[ ${rest} = Date:\ 20* || ${rest} = ©\ 20* ]] ; then
8384
WIDE_VER="${WIDE_VER}, ${rest}"
8485
fi
8586
continue
8687
fi
87-
range=${item%;*}
88-
flags=${item#*;}
89-
if [[ ${flags} = W* || ${flags} = F* ]] ; then
90-
format_range "${range}"
91-
fi
88+
read -r -a items <<< "${line}"
89+
case ${items[2]} in
90+
F | W | A )
91+
format_range "${items[0]}" ;;
92+
esac
9293
done > "${tmpfile}"
9394
sort "${tmpfile}"
9495
rm "${tmpfile}"

0 commit comments

Comments
 (0)